intel: Add hiz_region to intel_renderbuffer
A hiz surface must be supplied to the hardware when rendering to a depth buffer with hiz. There are three potential places to store that surface: 1. Allocate a larger intel_region for the depthbuffer, and let the region's tail be the hiz surface. 2. Allocate a separate intel_region for hiz, and store it as brw_context state. 3. Allocate a separate intel_region for hiz, and store it in intel_renderbuffer. We choose method 3. Method 1 has not been chosen due to future complications it might cause when requesting a DRI drawable's depth buffer attachment from X. Method 2 has not been chosen because storing the hiz region apart from the depth region makes lazy hiz/depth resolves difficult to implement. Reviewed-by: Eric Anholt <eric@anholt.net> Signed-off-by: Chad Versace <chad@chad-versace.us>
This commit is contained in:
@@ -79,6 +79,9 @@ intel_delete_renderbuffer(struct gl_renderbuffer *rb)
|
||||
if (intel && irb->region) {
|
||||
intel_region_release(&irb->region);
|
||||
}
|
||||
if (intel && irb->hiz_region) {
|
||||
intel_region_release(&irb->hiz_region);
|
||||
}
|
||||
|
||||
free(irb);
|
||||
}
|
||||
@@ -148,6 +151,9 @@ intel_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer
|
||||
if (irb->region) {
|
||||
intel_region_release(&irb->region);
|
||||
}
|
||||
if (irb->hiz_region) {
|
||||
intel_region_release(&irb->hiz_region);
|
||||
}
|
||||
|
||||
/* allocate new memory region/renderbuffer */
|
||||
|
||||
@@ -194,6 +200,19 @@ intel_alloc_renderbuffer_storage(struct gl_context * ctx, struct gl_renderbuffer
|
||||
|
||||
ASSERT(irb->region->buffer);
|
||||
|
||||
if (intel->vtbl.is_hiz_depth_format(intel, rb->Format)) {
|
||||
irb->hiz_region = intel_region_alloc(intel->intelScreen,
|
||||
I915_TILING_Y,
|
||||
irb->region->cpp,
|
||||
irb->region->width,
|
||||
irb->region->height,
|
||||
GL_TRUE);
|
||||
if (!irb->hiz_region) {
|
||||
intel_region_release(&irb->region);
|
||||
return GL_FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
rb->Width = width;
|
||||
rb->Height = height;
|
||||
|
||||
|
Reference in New Issue
Block a user