i965/gen7: Use R8_UINT stencil copy when sampling the stencil texture
authorJordan Justen <jordan.l.justen@intel.com>
Sat, 11 Jun 2016 23:41:18 +0000 (16:41 -0700)
committerJordan Justen <jordan.l.justen@intel.com>
Fri, 26 Aug 2016 17:09:22 +0000 (10:09 -0700)
v2:
 * Check gen <= 7, rather than gen == 7. (Ian)

Signed-off-by: Jordan Justen <jordan.l.justen@intel.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
src/mesa/drivers/dri/i965/brw_wm_surface_state.c

index 023b1ffbf9db207b3cfffb03cef59b4226ee5c20..bfd973b0c965d094ee20538831be6a00d6b68609 100644 (file)
@@ -499,8 +499,16 @@ brw_update_texture_surface(struct gl_context *ctx,
       }
 
       if (obj->StencilSampling && firstImage->_BaseFormat == GL_DEPTH_STENCIL) {
-         assert(brw->gen >= 8);
-         mt = mt->stencil_mt;
+         if (brw->gen <= 7) {
+            assert(mt->r8stencil_mt && !mt->stencil_mt->r8stencil_needs_update);
+            mt = mt->r8stencil_mt;
+         } else {
+            mt = mt->stencil_mt;
+         }
+         format = BRW_SURFACEFORMAT_R8_UINT;
+      } else if (brw->gen <= 7 && mt->format == MESA_FORMAT_S_UINT8) {
+         assert(mt->r8stencil_mt && !mt->r8stencil_needs_update);
+         mt = mt->r8stencil_mt;
          format = BRW_SURFACEFORMAT_R8_UINT;
       }