summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2010-10-02 23:27:31 -0700
committerEric Anholt <[email protected]>2010-10-02 23:48:14 -0700
commita7fa00dfc5ab5782b2e497fbf4ca292dde69cdbd (patch)
treecb4de56e2f3c6c647cbfba0c61499f4d51090d76 /src
parent4fb0c92c6986cf4e88296bab8837320210f1794f (diff)
i965: Set up swizzling of shadow compare results for GL_DEPTH_TEXTURE_MODE.
The brw_wm_surface_state.c handling of GL_DEPTH_TEXTURE_MODE doesn't apply to shadow compares, which always return an intensity value. The texture swizzles can do the job for us. Fixes: glsl1-shadow2D(): 1 glsl1-shadow2D(): 3
Diffstat (limited to 'src')
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm.c33
1 files changed, 32 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_wm.c b/src/mesa/drivers/dri/i965/brw_wm.c
index 9ca8e709f55..66106408c9e 100644
--- a/src/mesa/drivers/dri/i965/brw_wm.c
+++ b/src/mesa/drivers/dri/i965/brw_wm.c
@@ -342,13 +342,44 @@ static void brw_wm_populate_key( struct brw_context *brw,
if (unit->_ReallyEnabled) {
const struct gl_texture_object *t = unit->_Current;
const struct gl_texture_image *img = t->Image[0][t->BaseLevel];
+
+ key->tex_swizzles[i] = SWIZZLE_NOOP;
+
+ /* GL_DEPTH_TEXTURE_MODE is normally handled through
+ * brw_wm_surface_state, but it applies to shadow compares as
+ * well and our shadow compares always return the result in
+ * all 4 channels.
+ */
+ if (t->CompareMode == GL_COMPARE_R_TO_TEXTURE_ARB) {
+ if (t->DepthMode == GL_ALPHA) {
+ key->tex_swizzles[i] =
+ MAKE_SWIZZLE4(SWIZZLE_ZERO,
+ SWIZZLE_ZERO,
+ SWIZZLE_ZERO,
+ SWIZZLE_X);
+ } else if (t->DepthMode == GL_LUMINANCE) {
+ key->tex_swizzles[i] =
+ MAKE_SWIZZLE4(SWIZZLE_X,
+ SWIZZLE_X,
+ SWIZZLE_X,
+ SWIZZLE_ONE);
+ }
+ }
+
if (img->InternalFormat == GL_YCBCR_MESA) {
key->yuvtex_mask |= 1 << i;
if (img->TexFormat == MESA_FORMAT_YCBCR)
key->yuvtex_swap_mask |= 1 << i;
}
- key->tex_swizzles[i] = t->_Swizzle;
+ key->tex_swizzles[i] = MAKE_SWIZZLE4(GET_SWZ(key->tex_swizzles[i],
+ GET_SWZ(t->_Swizzle, 0)),
+ GET_SWZ(key->tex_swizzles[i],
+ GET_SWZ(t->_Swizzle, 1)),
+ GET_SWZ(key->tex_swizzles[i],
+ GET_SWZ(t->_Swizzle, 2)),
+ GET_SWZ(key->tex_swizzles[i],
+ GET_SWZ(t->_Swizzle, 3)));
}
else {
key->tex_swizzles[i] = SWIZZLE_NOOP;