aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/main
diff options
context:
space:
mode:
authorPauli Nieminen <[email protected]>2012-06-12 21:38:46 +0300
committerEric Anholt <[email protected]>2012-08-01 15:30:13 -0700
commitc37efbfe4c415b6fd2d4f968220d7c9b62f11ecf (patch)
treef7da2ce6c2f12c397139ca47660c781847ff6d05 /src/mesa/main
parentc18806cebf107d03751b11cc8866062c3822a56f (diff)
mesa: Move DepthMode to texture object
GL_DEPTH_TEXTURE_MODE isn't meant to be part of sampler state based on compatibility profile specifications. OpenGL specification 4.1 compatibility 20100725 3.9.2: "... The values accepted in the pname parameter are TEXTURE_WRAP_S, TEXTURE_WRAP_T, TEXTURE_WRAP_R, TEXTURE_MIN_- FILTER, TEXTURE_MAG_FILTER, TEXTURE_BORDER_COLOR, TEXTURE_MIN_- LOD, TEXTURE_MAX_LOD, TEXTURE_LOD_BIAS, TEXTURE_COMPARE_MODE, and TEXTURE_COMPARE_FUNC. Texture state listed in table 6.25 but not listed here and in the sampler state in table 6.26 is not part of the sampler state, and remains in the texture object." The list of states is in Table 6.24 "Textures (state per texture object)" instead of 6.25 mentioned in the specification text. Same can be found from 3.3 compatibility specification. Signed-off-by: Pauli Nieminen <[email protected]> Reviewed-by: Brian Paul <[email protected]> Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/main')
-rw-r--r--src/mesa/main/attrib.c2
-rw-r--r--src/mesa/main/mtypes.h5
-rw-r--r--src/mesa/main/samplerobj.c2
-rw-r--r--src/mesa/main/texobj.c4
-rw-r--r--src/mesa/main/texparam.c8
-rw-r--r--src/mesa/main/texstate.c2
6 files changed, 10 insertions, 13 deletions
diff --git a/src/mesa/main/attrib.c b/src/mesa/main/attrib.c
index 318d576e850..8bc7c348fab 100644
--- a/src/mesa/main/attrib.c
+++ b/src/mesa/main/attrib.c
@@ -806,7 +806,7 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate)
samp->CompareFunc);
}
if (ctx->Extensions.ARB_depth_texture)
- _mesa_TexParameteri(target, GL_DEPTH_TEXTURE_MODE, samp->DepthMode);
+ _mesa_TexParameteri(target, GL_DEPTH_TEXTURE_MODE, obj->DepthMode);
}
/* remove saved references to the texture objects */
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 7d7213f4d03..68e05a605fb 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1253,9 +1253,6 @@ struct gl_sampler_object
GLfloat CompareFailValue; /**< GL_ARB_shadow_ambient */
GLenum sRGBDecode; /**< GL_DECODE_EXT or GL_SKIP_DECODE_EXT */
GLboolean CubeMapSeamless; /**< GL_AMD_seamless_cubemap_per_texture */
-
- /* deprecated sampler state */
- GLenum DepthMode; /**< GL_ARB_depth_texture */
};
@@ -1272,6 +1269,8 @@ struct gl_texture_object
struct gl_sampler_object Sampler;
+ GLenum DepthMode; /**< GL_ARB_depth_texture */
+
GLfloat Priority; /**< in [0,1] */
GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */
GLint MaxLevel; /**< max mipmap level, OpenGL 1.2 */
diff --git a/src/mesa/main/samplerobj.c b/src/mesa/main/samplerobj.c
index 5d1b2adbb08..8c54c9a4c34 100644
--- a/src/mesa/main/samplerobj.c
+++ b/src/mesa/main/samplerobj.c
@@ -133,10 +133,8 @@ _mesa_init_sampler_object(struct gl_sampler_object *sampObj, GLuint name)
sampObj->CompareFailValue = 0.0;
sampObj->sRGBDecode = GL_DECODE_EXT;
sampObj->CubeMapSeamless = GL_FALSE;
- sampObj->DepthMode = 0;
}
-
/**
* Fallback for ctx->Driver.NewSamplerObject();
*/
diff --git a/src/mesa/main/texobj.c b/src/mesa/main/texobj.c
index e0494c94028..529a6d44929 100644
--- a/src/mesa/main/texobj.c
+++ b/src/mesa/main/texobj.c
@@ -145,7 +145,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj,
obj->Sampler.CompareMode = GL_NONE; /* ARB_shadow */
obj->Sampler.CompareFunc = GL_LEQUAL; /* ARB_shadow */
obj->Sampler.CompareFailValue = 0.0F; /* ARB_shadow_ambient */
- obj->Sampler.DepthMode = GL_LUMINANCE; /* ARB_depth_texture */
+ obj->DepthMode = GL_LUMINANCE;
obj->Sampler.CubeMapSeamless = GL_FALSE;
obj->Swizzle[0] = GL_RED;
obj->Swizzle[1] = GL_GREEN;
@@ -259,7 +259,7 @@ _mesa_copy_texture_object( struct gl_texture_object *dest,
dest->Sampler.CompareFunc = src->Sampler.CompareFunc;
dest->Sampler.CompareFailValue = src->Sampler.CompareFailValue;
dest->Sampler.CubeMapSeamless = src->Sampler.CubeMapSeamless;
- dest->Sampler.DepthMode = src->Sampler.DepthMode;
+ dest->DepthMode = src->DepthMode;
dest->Sampler.sRGBDecode = src->Sampler.sRGBDecode;
dest->_MaxLevel = src->_MaxLevel;
dest->_MaxLambda = src->_MaxLambda;
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 1376219d72a..9213499a489 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -383,14 +383,14 @@ set_tex_parameteri(struct gl_context *ctx,
case GL_DEPTH_TEXTURE_MODE_ARB:
if (ctx->Extensions.ARB_depth_texture) {
- if (texObj->Sampler.DepthMode == params[0])
+ if (texObj->DepthMode == params[0])
return GL_FALSE;
if (params[0] == GL_LUMINANCE ||
params[0] == GL_INTENSITY ||
params[0] == GL_ALPHA ||
(ctx->Extensions.ARB_texture_rg && params[0] == GL_RED)) {
flush(ctx);
- texObj->Sampler.DepthMode = params[0];
+ texObj->DepthMode = params[0];
return GL_TRUE;
}
goto invalid_param;
@@ -1157,7 +1157,7 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
case GL_DEPTH_TEXTURE_MODE_ARB:
if (!ctx->Extensions.ARB_depth_texture)
goto invalid_pname;
- *params = (GLfloat) obj->Sampler.DepthMode;
+ *params = (GLfloat) obj->DepthMode;
break;
case GL_TEXTURE_LOD_BIAS:
*params = obj->Sampler.LodBias;
@@ -1303,7 +1303,7 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
case GL_DEPTH_TEXTURE_MODE_ARB:
if (!ctx->Extensions.ARB_depth_texture)
goto invalid_pname;
- *params = (GLint) obj->Sampler.DepthMode;
+ *params = (GLint) obj->DepthMode;
break;
case GL_TEXTURE_LOD_BIAS:
*params = (GLint) obj->Sampler.LodBias;
diff --git a/src/mesa/main/texstate.c b/src/mesa/main/texstate.c
index 8ca9092ce01..fa1fef27eac 100644
--- a/src/mesa/main/texstate.c
+++ b/src/mesa/main/texstate.c
@@ -407,7 +407,7 @@ update_tex_combine(struct gl_context *ctx, struct gl_texture_unit *texUnit)
GLenum format = texObj->Image[0][texObj->BaseLevel]->_BaseFormat;
if (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL_EXT) {
- format = texObj->Sampler.DepthMode;
+ format = texObj->DepthMode;
}
calculate_derived_texenv(&texUnit->_EnvMode, texUnit->EnvMode, format);
texUnit->_CurrentCombine = & texUnit->_EnvMode;