Mesa (master): i965/fs: Assume shadow sampler swizzling is <X, X, X, 1>.
Kenneth Graunke
kwg at kemper.freedesktop.org
Mon Aug 27 21:24:58 UTC 2012
Module: Mesa
Branch: master
Commit: 85b24b07512c5f3f05c5a3eb9561598ace97526c
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=85b24b07512c5f3f05c5a3eb9561598ace97526c
Author: Kenneth Graunke <kenneth at whitecape.org>
Date: Sun Aug 26 00:34:03 2012 -0700
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 <kenneth at whitecape.org>
Reviewed-by: Eric Anholt <eric at anholt.net>
---
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 d896b00..a8d55ff 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) {
More information about the mesa-commit
mailing list