summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/intel/intel_fbo.c21
-rw-r--r--src/mesa/drivers/dri/intel/intel_mipmap_tree.c1
-rw-r--r--src/mesa/drivers/dri/intel/intel_mipmap_tree.h14
3 files changed, 36 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_fbo.c b/src/mesa/drivers/dri/intel/intel_fbo.c
index 61aba7d580f..18675ab16a5 100644
--- a/src/mesa/drivers/dri/intel/intel_fbo.c
+++ b/src/mesa/drivers/dri/intel/intel_fbo.c
@@ -420,6 +420,7 @@ static GLboolean
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)) {
@@ -446,6 +447,26 @@ intel_update_wrapper(struct gl_context *ctx, struct intel_renderbuffer *irb,
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;
}
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
index a3409274fb7..e62905de7c3 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c
@@ -200,6 +200,7 @@ intel_miptree_release(struct intel_context *intel,
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);
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
index 760a8bce601..325e3916981 100644
--- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h
@@ -113,6 +113,20 @@ struct intel_mipmap_tree
*/
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;