[Mesa-dev] [RFC 26/27] i965/fs: Recompile when switching to/from stencil indexing

Topi Pohjolainen topi.pohjolainen at intel.com
Sat Feb 22 01:05:52 PST 2014


Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/mesa/drivers/dri/i965/brw_program.h | 7 +++++++
 src/mesa/drivers/dri/i965/brw_wm.c      | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/src/mesa/drivers/dri/i965/brw_program.h b/src/mesa/drivers/dri/i965/brw_program.h
index 6aa0ac1..fc00517 100644
--- a/src/mesa/drivers/dri/i965/brw_program.h
+++ b/src/mesa/drivers/dri/i965/brw_program.h
@@ -55,6 +55,13 @@ struct brw_sampler_prog_key_data {
     * For Sandybridge, which shader w/a we need for gather quirks.
     */
    uint8_t gen6_gather_wa[MAX_SAMPLERS];
+
+   /**
+    * ARB_stencil_texturing on gen6/7 requires W-tiled surface to be
+    * configured as Y-tiled for the HW, and then for the fragment program
+    * to compensate for the difference in coordinates.
+    */
+   uint16_t translate_y_to_w[MAX_SAMPLERS];
 };
 
 #ifdef __cplusplus
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index 9edb245..cab37ad 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -231,6 +231,9 @@ brw_debug_recompile_sampler_key(struct brw_context *brw,
    for (unsigned int i = 0; i < MAX_SAMPLERS; i++) {
       found |= key_debug(brw, "EXT_texture_swizzle or DEPTH_TEXTURE_MODE",
                          old_key->swizzles[i], key->swizzles[i]);
+      found |= key_debug(brw, "texturing needs Y to W tiling translation",
+                         old_key->translate_y_to_w[i],
+                         key->translate_y_to_w[i]);
    }
    found |= key_debug(brw, "GL_CLAMP enabled on any texture unit's 1st coordinate",
                       old_key->gl_clamp_mask[0], key->gl_clamp_mask[0]);
@@ -330,6 +333,7 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx,
 
    for (int s = 0; s < sampler_count; s++) {
       key->swizzles[s] = SWIZZLE_NOOP;
+      key->translate_y_to_w[s] = false;
 
       if (!(prog->SamplersUsed & (1 << s)))
 	 continue;
@@ -387,6 +391,9 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx,
              intel_tex->mt->msaa_layout == INTEL_MSAA_LAYOUT_CMS) {
             key->compressed_multisample_layout_mask |= 1 << s;
          }
+
+         if (brw->gen < 8 && t->StencilSampling)
+            key->translate_y_to_w[s] = true;
       }
    }
 }
-- 
1.8.3.1



More information about the mesa-dev mailing list