intel_update_wrapper(struct gl_context *ctx, struct intel_renderbuffer *irb,
struct gl_texture_image *texImage)
{
+ struct intel_context *intel = intel_context(ctx);
struct intel_texture_image *intel_image = intel_texture_image(texImage);
if (!intel_span_supports_format(texImage->TexFormat)) {
intel_region_reference(&irb->region, intel_image->mt->region);
}
+ /* Allocate the texture's hiz region if necessary. */
+ if (intel->vtbl.is_hiz_depth_format(intel, texImage->TexFormat)
+ && !intel_image->mt->hiz_region) {
+ intel_image->mt->hiz_region =
+ intel_region_alloc(intel->intelScreen,
+ I915_TILING_Y,
+ _mesa_get_format_bytes(texImage->TexFormat),
+ texImage->Width,
+ texImage->Height,
+ GL_TRUE);
+ if (!intel_image->mt->hiz_region)
+ return GL_FALSE;
+ }
+
+ /* Point the renderbuffer's hiz region to the texture's hiz region. */
+ if (irb->hiz_region != intel_image->mt->hiz_region) {
+ intel_region_release(&irb->hiz_region);
+ intel_region_reference(&irb->hiz_region, intel_image->mt->hiz_region);
+ }
+
return GL_TRUE;
}
DBG("%s deleting %p\n", __FUNCTION__, *mt);
intel_region_release(&((*mt)->region));
+ intel_region_release(&((*mt)->hiz_region));
for (i = 0; i < MAX_TEXTURE_LEVELS; i++) {
free((*mt)->level[i].x_offset);
*/
struct intel_region *region;
+ /**
+ * This points to an auxillary hiz region if all of the following hold:
+ * 1. The texture has been attached to an FBO as a depthbuffer.
+ * 2. The texture format is hiz compatible.
+ * 3. The intel context supports hiz.
+ *
+ * When a texture is attached to multiple FBO's, a separate renderbuffer
+ * wrapper is created for each attachment. This necessitates storing the
+ * hiz region in the texture itself instead of the renderbuffer wrapper.
+ *
+ * \see intel_fbo.c:intel_wrap_texture()
+ */
+ struct intel_region *hiz_region;
+
/* These are also refcounted:
*/
GLuint refcount;