summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/i965/brw_wm.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/i965/brw_wm.c')
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index a0758d2527f..7eccbcb07e1 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -317,6 +317,20 @@ brw_wm_debug_recompile(struct brw_context *brw,
}
}
+static uint8_t
+gen6_gather_workaround(GLenum internalformat)
+{
+ switch (internalformat) {
+ case GL_R8I: return WA_SIGN | WA_8BIT;
+ case GL_R8UI: return WA_8BIT;
+ case GL_R16I: return WA_SIGN | WA_16BIT;
+ case GL_R16UI: return WA_16BIT;
+ /* note that even though GL_R32I and GL_R32UI have format overrides
+ * in the surface state, there is no shader w/a required */
+ default: return 0;
+ }
+}
+
void
brw_populate_sampler_prog_key_data(struct gl_context *ctx,
const struct gl_program *prog,
@@ -372,6 +386,13 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx,
key->gather_channel_quirk_mask |= 1 << s;
}
+ /* Gen6's gather4 is broken for UINT/SINT; we treat them as
+ * UNORM/FLOAT instead and fix it in the shader.
+ */
+ if (brw->gen == 6 && prog->UsesGather) {
+ key->gen6_gather_wa[s] = gen6_gather_workaround(img->InternalFormat);
+ }
+
/* If this is a multisample sampler, and uses the CMS MSAA layout,
* then we need to emit slightly different code to first sample the
* MCS surface.