summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJordan Justen <jordan.l.justen@intel.com>2016-06-11 16:21:36 -0700
committerJordan Justen <jordan.l.justen@intel.com>2016-08-18 16:33:48 -0700
commit5c9f0b051b916182e216873490293b7b944d04ed (patch)
tree94d9cd2f659f478f39adcb0a8c12068c729545e2
parent6fa43dde05d8786a5cf8eb470ca2b56be64ca854 (diff)
i965: Add stencil miptree copy for sampling
For gen < 8, we can't sample from the stencil buffer. We'll make a copy of the stencil data into a new texture that we can sample using the R8_UINT surface type. Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
-rw-r--r--src/mesa/drivers/dri/i965/intel_mipmap_tree.c2
-rw-r--r--src/mesa/drivers/dri/i965/intel_mipmap_tree.h12
2 files changed, 14 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 0836b92f983..7246aa89a97 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -532,6 +532,7 @@ intel_miptree_create_layout(struct brw_context *brw,
intel_miptree_release(&mt);
return NULL;
}
+ mt->stencil_mt->stencil_tex_needs_update = true;
/* Fix up the Z miptree format for how we're splitting out separate
* stencil. Gen7 expects there to be no stencil bits in its depth buffer.
@@ -995,6 +996,7 @@ intel_miptree_release(struct intel_mipmap_tree **mt)
drm_intel_bo_unreference((*mt)->bo);
intel_miptree_release(&(*mt)->stencil_mt);
+ intel_miptree_release(&(*mt)->stencil_tex_mt);
if ((*mt)->hiz_buf) {
if ((*mt)->hiz_buf->mt)
intel_miptree_release(&(*mt)->hiz_buf->mt);
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
index c28fb3364f6..4d93f952aae 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.h
@@ -615,6 +615,18 @@ struct intel_mipmap_tree
struct intel_mipmap_tree *stencil_mt;
/**
+ * \brief Stencil texturing miptree for sampling from a stencil texture
+ *
+ * Some hardware doesn't support sampling from the stencil texture as
+ * required by the GL_ARB_stencil_texturing extenion. To overcome this we
+ * blit the texture into a new texture that can be sampled.
+ *
+ * \see intel_miptree_stencil_texturing()
+ */
+ struct intel_mipmap_tree *stencil_tex_mt;
+ bool stencil_tex_needs_update;
+
+ /**
* \brief MCS miptree.
*
* This miptree contains the "multisample control surface", which stores