diff options
author | Kenneth Graunke <[email protected]> | 2012-08-26 00:34:03 -0700 |
---|---|---|
committer | Kenneth Graunke <[email protected]> | 2012-08-27 14:23:40 -0700 |
commit | 85b24b07512c5f3f05c5a3eb9561598ace97526c (patch) | |
tree | 652d2c78b8032b037b7a075212f123740ca59dfb /src/mesa/drivers/dri | |
parent | f3d0daf7ea7e42ff9ce11e8bd6fba1059a2406e8 (diff) |
i965/fs: Assume shadow sampler swizzling is <X, X, X, 1>.
Our previous assumption, SWIZZLE_XYZW, was completely bogus for depth
textures. There are no Y, Z, or W components.
DEPTH_TEXTURE_MODE has three options:
- GL_LUMINANCE: <X, X, X, 1>
- GL_INTENSITY: <X, X, X, X>
- GL_ALPHA: <0, 0, 0, X>
The default value is GL_LUMINANCE, and most applications don't seem to
alter DEPTH_TEXTURE_MODE. Make that our precompile guess.
Signed-off-by: Kenneth Graunke <[email protected]>
Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r-- | src/mesa/drivers/dri/i965/brw_fs.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp b/src/mesa/drivers/dri/i965/brw_fs.cpp index d896b008fd7..a8d55ffc35e 100644 --- a/src/mesa/drivers/dri/i965/brw_fs.cpp +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp @@ -2179,8 +2179,14 @@ brw_fs_precompile(struct gl_context *ctx, struct gl_shader_program *prog) key.clamp_fragment_color = true; for (int i = 0; i < MAX_SAMPLERS; i++) { - /* FINISHME: depth compares might use (0,0,0,W) for example */ - key.tex.swizzles[i] = SWIZZLE_XYZW; + if (fp->Base.ShadowSamplers & (1 << i)) { + /* Assume DEPTH_TEXTURE_MODE is the default: X, X, X, 1 */ + key.tex.swizzles[i] = + MAKE_SWIZZLE4(SWIZZLE_X, SWIZZLE_X, SWIZZLE_X, SWIZZLE_ONE); + } else { + /* Color sampler: assume no swizzling. */ + key.tex.swizzles[i] = SWIZZLE_XYZW; + } } if (fp->Base.InputsRead & FRAG_BIT_WPOS) { |