From cfa3c8a0d326e031c349039b95fc1232d9d623eb Mon Sep 17 00:00:00 2001 From: Chris Forbes Date: Sun, 11 Aug 2013 09:55:30 +1200 Subject: i965: w/a for gather4 green RG32F V4: Only flag quirks if there are any uses of gather in the shader, to avoid spurious recompiles just because someone happened to use RG32F. Signed-off-by: Chris Forbes Reviewed-by: Kenneth Graunke --- src/mesa/drivers/dri/i965/brw_fs_visitor.cpp | 4 ++++ src/mesa/drivers/dri/i965/brw_program.h | 5 +++++ src/mesa/drivers/dri/i965/brw_vec4_visitor.cpp | 4 ++++ src/mesa/drivers/dri/i965/brw_wm.c | 9 +++++++++ 4 files changed, 22 insertions(+) diff --git a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp index 262cead1cce..a8ad65928c0 100644 --- a/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs_visitor.cpp @@ -1584,6 +1584,10 @@ uint32_t fs_visitor::gather_channel(ir_texture *ir, int sampler) { int swiz = GET_SWZ(c->key.tex.swizzles[sampler], 0 /* red */); + if (c->key.tex.gather_channel_quirk_mask & (1<tex.swizzles[sampler], 0 /* red */); + if (key->tex.gather_channel_quirk_mask & (1<yuvtex_mask, key->yuvtex_mask); found |= key_debug(brw, "GL_MESA_ycbcr UV swapping\n", old_key->yuvtex_swap_mask, key->yuvtex_swap_mask); + found |= key_debug(brw, "gather channel quirk on any texture unit", + old_key->gather_channel_quirk_mask, key->gather_channel_quirk_mask); return found; } @@ -342,6 +345,12 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx, if (sampler->WrapR == GL_CLAMP) key->gl_clamp_mask[2] |= 1 << s; } + + /* gather4's channel select for green from RG32F is broken */ + if (brw->gen >= 7 && prog->UsesGather) { + if (img->InternalFormat == GL_RG32F && GET_SWZ(t->_Swizzle, 0) == 1) + key->gather_channel_quirk_mask |= 1 << s; + } } } } -- cgit v1.2.3