summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIan Romanick <ian.d.romanick@intel.com>2009-11-20 14:54:12 -0800
committerIan Romanick <ian.d.romanick@intel.com>2009-11-20 14:54:12 -0800
commitd3507ec738f71f6b012ab06d6249b66c57904ab8 (patch)
treec22c476d63e0beb0506dcde09333c8b7e37e88ba
parentc62c54474727357eb6b595b105bee3fb08b7d203 (diff)
ARB_texture_rg: Add GL_RED as a valid GL_DEPTH_TEXTURE_MODE
With these changes, i965 passes piglit's depth-tex-modes-rg.
-rw-r--r--src/mesa/drivers/dri/i965/brw_defines.h2
-rw-r--r--src/mesa/drivers/dri/i965/brw_wm_surface_state.c13
-rw-r--r--src/mesa/main/texparam.c3
-rw-r--r--src/mesa/main/texstate.c6
-rw-r--r--src/mesa/swrast/s_texfilter.c3
5 files changed, 19 insertions, 8 deletions
diff --git a/src/mesa/drivers/dri/i965/brw_defines.h b/src/mesa/drivers/dri/i965/brw_defines.h
index c19510bbd4..4df1f7b2d9 100644
--- a/src/mesa/drivers/dri/i965/brw_defines.h
+++ b/src/mesa/drivers/dri/i965/brw_defines.h
@@ -322,7 +322,7 @@
#define BRW_SURFACEFORMAT_R32_SINT 0x0D6
#define BRW_SURFACEFORMAT_R32_UINT 0x0D7
#define BRW_SURFACEFORMAT_R32_FLOAT 0x0D8
-#define BRW_SURFACEFORMAT_R24_UNORM_X8_TYPELESS 0x0D9
+#define BRW_SURFACEFORMAT_R24X8_UNORM 0x0D9
#define BRW_SURFACEFORMAT_X24_TYPELESS_G8_UINT 0x0DA
#define BRW_SURFACEFORMAT_L16A16_UNORM 0x0DF
#define BRW_SURFACEFORMAT_I24X8_UNORM 0x0E0
diff --git a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
index 829badc919..2039d49825 100644
--- a/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
+++ b/src/mesa/drivers/dri/i965/brw_wm_surface_state.c
@@ -170,12 +170,13 @@ static GLuint translate_tex_format( gl_format mesa_format,
/* XXX: these different surface formats don't seem to
* make any difference for shadow sampler/compares.
*/
- if (depth_mode == GL_INTENSITY)
- return BRW_SURFACEFORMAT_I24X8_UNORM;
- else if (depth_mode == GL_ALPHA)
- return BRW_SURFACEFORMAT_A24X8_UNORM;
- else
- return BRW_SURFACEFORMAT_L24X8_UNORM;
+ switch (depth_mode) {
+ case GL_INTENSITY: return BRW_SURFACEFORMAT_I24X8_UNORM;
+ case GL_ALPHA: return BRW_SURFACEFORMAT_A24X8_UNORM;
+ case GL_LUMINANCE: return BRW_SURFACEFORMAT_L24X8_UNORM;
+ case GL_RED: return BRW_SURFACEFORMAT_R24X8_UNORM;
+ default: assert(0); return 0;
+ }
case MESA_FORMAT_DUDV8:
return BRW_SURFACEFORMAT_R8G8_SNORM;
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index c93a979e1d..70dbee61cc 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -356,7 +356,8 @@ set_tex_parameteri(GLcontext *ctx,
if (ctx->Extensions.ARB_depth_texture &&
(params[0] == GL_LUMINANCE ||
params[0] == GL_INTENSITY ||
- params[0] == GL_ALPHA)) {
+ params[0] == GL_ALPHA ||
+ (ctx->Extensions.ARB_texture_rg && params[0] == GL_RED))) {
if (texObj->DepthMode != params[0]) {
flush(ctx, texObj);
texObj->DepthMode = params[0];
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index c735e18aff..5fb31cc54d 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -181,6 +181,8 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state,
break;
case GL_LUMINANCE:
+ case GL_RED:
+ case GL_RG:
case GL_RGB:
case GL_YCBCR_MESA:
case GL_DUDV_ATI:
@@ -221,6 +223,8 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state,
case GL_INTENSITY:
state->SourceRGB[0] = GL_PREVIOUS;
break;
+ case GL_RED:
+ case GL_RG:
case GL_RGB:
case GL_YCBCR_MESA:
case GL_DUDV_ATI:
@@ -246,6 +250,8 @@ calculate_derived_texenv( struct gl_tex_env_combine_state *state,
state->OperandA[2] = GL_SRC_ALPHA;
/* FALLTHROUGH */
case GL_LUMINANCE:
+ case GL_RED:
+ case GL_RG:
case GL_RGB:
case GL_LUMINANCE_ALPHA:
case GL_RGBA:
diff --git a/src/mesa/swrast/s_texfilter.c b/src/mesa/swrast/s_texfilter.c
index 0bb988e3ef..34364123e1 100644
--- a/src/mesa/swrast/s_texfilter.c
+++ b/src/mesa/swrast/s_texfilter.c
@@ -3018,6 +3018,9 @@ sample_depth_texture( GLcontext *ctx,
case GL_ALPHA:
ASSIGN_4V(texel[i], 0.0F, 0.0F, 0.0F, result);
break;
+ case GL_RED:
+ ASSIGN_4V(texel[i], result, 0.0F, 0.0F, 1.0F);
+ break;
default:
_mesa_problem(ctx, "Bad depth texture mode");
}