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 <pauli.nieminen@linux.intel.com> Reviewed-by: Brian Paul <brianp@vmware.com> Reviewed-by: Eric Anholt <eric@anholt.net>
This commit is contained in:

committed by
Eric Anholt

parent
c18806cebf
commit
c37efbfe4c
@@ -168,7 +168,7 @@ i915_update_tex_unit(struct intel_context *intel, GLuint unit, GLuint ss3)
|
|||||||
i915->state.tex_offset[unit] = intelObj->mt->offset;
|
i915->state.tex_offset[unit] = intelObj->mt->offset;
|
||||||
|
|
||||||
format = translate_texture_format(firstImage->TexFormat,
|
format = translate_texture_format(firstImage->TexFormat,
|
||||||
sampler->DepthMode);
|
tObj->DepthMode);
|
||||||
pitch = intelObj->mt->region->pitch * intelObj->mt->cpp;
|
pitch = intelObj->mt->region->pitch * intelObj->mt->cpp;
|
||||||
|
|
||||||
state[I915_TEXREG_MS3] =
|
state[I915_TEXREG_MS3] =
|
||||||
|
@@ -374,7 +374,7 @@ brw_populate_sampler_prog_key_data(struct gl_context *ctx,
|
|||||||
* format overrides because shadow comparison always returns the
|
* format overrides because shadow comparison always returns the
|
||||||
* result of the comparison in all channels anyway.
|
* result of the comparison in all channels anyway.
|
||||||
*/
|
*/
|
||||||
switch (sampler->DepthMode) {
|
switch (t->DepthMode) {
|
||||||
case GL_ALPHA:
|
case GL_ALPHA:
|
||||||
swizzles[0] = SWIZZLE_ZERO;
|
swizzles[0] = SWIZZLE_ZERO;
|
||||||
swizzles[1] = SWIZZLE_ZERO;
|
swizzles[1] = SWIZZLE_ZERO;
|
||||||
|
@@ -732,7 +732,7 @@ brw_update_texture_surface( struct gl_context *ctx, GLuint unit )
|
|||||||
BRW_SURFACE_CUBEFACE_ENABLES |
|
BRW_SURFACE_CUBEFACE_ENABLES |
|
||||||
(translate_tex_format(mt->format,
|
(translate_tex_format(mt->format,
|
||||||
firstImage->InternalFormat,
|
firstImage->InternalFormat,
|
||||||
sampler->DepthMode,
|
tObj->DepthMode,
|
||||||
sampler->sRGBDecode) <<
|
sampler->sRGBDecode) <<
|
||||||
BRW_SURFACE_FORMAT_SHIFT));
|
BRW_SURFACE_FORMAT_SHIFT));
|
||||||
|
|
||||||
|
@@ -296,7 +296,7 @@ gen7_update_texture_surface(struct gl_context *ctx, GLuint unit)
|
|||||||
surf->ss0.surface_type = translate_tex_target(tObj->Target);
|
surf->ss0.surface_type = translate_tex_target(tObj->Target);
|
||||||
surf->ss0.surface_format = translate_tex_format(mt->format,
|
surf->ss0.surface_format = translate_tex_format(mt->format,
|
||||||
firstImage->InternalFormat,
|
firstImage->InternalFormat,
|
||||||
sampler->DepthMode,
|
tObj->DepthMode,
|
||||||
sampler->sRGBDecode);
|
sampler->sRGBDecode);
|
||||||
if (tObj->Target == GL_TEXTURE_CUBE_MAP) {
|
if (tObj->Target == GL_TEXTURE_CUBE_MAP) {
|
||||||
surf->ss0.cube_pos_x = 1;
|
surf->ss0.cube_pos_x = 1;
|
||||||
|
@@ -806,7 +806,7 @@ pop_texture_group(struct gl_context *ctx, struct texture_state *texstate)
|
|||||||
samp->CompareFunc);
|
samp->CompareFunc);
|
||||||
}
|
}
|
||||||
if (ctx->Extensions.ARB_depth_texture)
|
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 */
|
/* remove saved references to the texture objects */
|
||||||
|
@@ -1253,9 +1253,6 @@ struct gl_sampler_object
|
|||||||
GLfloat CompareFailValue; /**< GL_ARB_shadow_ambient */
|
GLfloat CompareFailValue; /**< GL_ARB_shadow_ambient */
|
||||||
GLenum sRGBDecode; /**< GL_DECODE_EXT or GL_SKIP_DECODE_EXT */
|
GLenum sRGBDecode; /**< GL_DECODE_EXT or GL_SKIP_DECODE_EXT */
|
||||||
GLboolean CubeMapSeamless; /**< GL_AMD_seamless_cubemap_per_texture */
|
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;
|
struct gl_sampler_object Sampler;
|
||||||
|
|
||||||
|
GLenum DepthMode; /**< GL_ARB_depth_texture */
|
||||||
|
|
||||||
GLfloat Priority; /**< in [0,1] */
|
GLfloat Priority; /**< in [0,1] */
|
||||||
GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */
|
GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */
|
||||||
GLint MaxLevel; /**< max mipmap level, OpenGL 1.2 */
|
GLint MaxLevel; /**< max mipmap level, OpenGL 1.2 */
|
||||||
|
@@ -133,10 +133,8 @@ _mesa_init_sampler_object(struct gl_sampler_object *sampObj, GLuint name)
|
|||||||
sampObj->CompareFailValue = 0.0;
|
sampObj->CompareFailValue = 0.0;
|
||||||
sampObj->sRGBDecode = GL_DECODE_EXT;
|
sampObj->sRGBDecode = GL_DECODE_EXT;
|
||||||
sampObj->CubeMapSeamless = GL_FALSE;
|
sampObj->CubeMapSeamless = GL_FALSE;
|
||||||
sampObj->DepthMode = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fallback for ctx->Driver.NewSamplerObject();
|
* Fallback for ctx->Driver.NewSamplerObject();
|
||||||
*/
|
*/
|
||||||
|
@@ -145,7 +145,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj,
|
|||||||
obj->Sampler.CompareMode = GL_NONE; /* ARB_shadow */
|
obj->Sampler.CompareMode = GL_NONE; /* ARB_shadow */
|
||||||
obj->Sampler.CompareFunc = GL_LEQUAL; /* ARB_shadow */
|
obj->Sampler.CompareFunc = GL_LEQUAL; /* ARB_shadow */
|
||||||
obj->Sampler.CompareFailValue = 0.0F; /* ARB_shadow_ambient */
|
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->Sampler.CubeMapSeamless = GL_FALSE;
|
||||||
obj->Swizzle[0] = GL_RED;
|
obj->Swizzle[0] = GL_RED;
|
||||||
obj->Swizzle[1] = GL_GREEN;
|
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.CompareFunc = src->Sampler.CompareFunc;
|
||||||
dest->Sampler.CompareFailValue = src->Sampler.CompareFailValue;
|
dest->Sampler.CompareFailValue = src->Sampler.CompareFailValue;
|
||||||
dest->Sampler.CubeMapSeamless = src->Sampler.CubeMapSeamless;
|
dest->Sampler.CubeMapSeamless = src->Sampler.CubeMapSeamless;
|
||||||
dest->Sampler.DepthMode = src->Sampler.DepthMode;
|
dest->DepthMode = src->DepthMode;
|
||||||
dest->Sampler.sRGBDecode = src->Sampler.sRGBDecode;
|
dest->Sampler.sRGBDecode = src->Sampler.sRGBDecode;
|
||||||
dest->_MaxLevel = src->_MaxLevel;
|
dest->_MaxLevel = src->_MaxLevel;
|
||||||
dest->_MaxLambda = src->_MaxLambda;
|
dest->_MaxLambda = src->_MaxLambda;
|
||||||
|
@@ -383,14 +383,14 @@ set_tex_parameteri(struct gl_context *ctx,
|
|||||||
|
|
||||||
case GL_DEPTH_TEXTURE_MODE_ARB:
|
case GL_DEPTH_TEXTURE_MODE_ARB:
|
||||||
if (ctx->Extensions.ARB_depth_texture) {
|
if (ctx->Extensions.ARB_depth_texture) {
|
||||||
if (texObj->Sampler.DepthMode == params[0])
|
if (texObj->DepthMode == params[0])
|
||||||
return GL_FALSE;
|
return GL_FALSE;
|
||||||
if (params[0] == GL_LUMINANCE ||
|
if (params[0] == GL_LUMINANCE ||
|
||||||
params[0] == GL_INTENSITY ||
|
params[0] == GL_INTENSITY ||
|
||||||
params[0] == GL_ALPHA ||
|
params[0] == GL_ALPHA ||
|
||||||
(ctx->Extensions.ARB_texture_rg && params[0] == GL_RED)) {
|
(ctx->Extensions.ARB_texture_rg && params[0] == GL_RED)) {
|
||||||
flush(ctx);
|
flush(ctx);
|
||||||
texObj->Sampler.DepthMode = params[0];
|
texObj->DepthMode = params[0];
|
||||||
return GL_TRUE;
|
return GL_TRUE;
|
||||||
}
|
}
|
||||||
goto invalid_param;
|
goto invalid_param;
|
||||||
@@ -1157,7 +1157,7 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
|
|||||||
case GL_DEPTH_TEXTURE_MODE_ARB:
|
case GL_DEPTH_TEXTURE_MODE_ARB:
|
||||||
if (!ctx->Extensions.ARB_depth_texture)
|
if (!ctx->Extensions.ARB_depth_texture)
|
||||||
goto invalid_pname;
|
goto invalid_pname;
|
||||||
*params = (GLfloat) obj->Sampler.DepthMode;
|
*params = (GLfloat) obj->DepthMode;
|
||||||
break;
|
break;
|
||||||
case GL_TEXTURE_LOD_BIAS:
|
case GL_TEXTURE_LOD_BIAS:
|
||||||
*params = obj->Sampler.LodBias;
|
*params = obj->Sampler.LodBias;
|
||||||
@@ -1303,7 +1303,7 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
|
|||||||
case GL_DEPTH_TEXTURE_MODE_ARB:
|
case GL_DEPTH_TEXTURE_MODE_ARB:
|
||||||
if (!ctx->Extensions.ARB_depth_texture)
|
if (!ctx->Extensions.ARB_depth_texture)
|
||||||
goto invalid_pname;
|
goto invalid_pname;
|
||||||
*params = (GLint) obj->Sampler.DepthMode;
|
*params = (GLint) obj->DepthMode;
|
||||||
break;
|
break;
|
||||||
case GL_TEXTURE_LOD_BIAS:
|
case GL_TEXTURE_LOD_BIAS:
|
||||||
*params = (GLint) obj->Sampler.LodBias;
|
*params = (GLint) obj->Sampler.LodBias;
|
||||||
|
@@ -407,7 +407,7 @@ update_tex_combine(struct gl_context *ctx, struct gl_texture_unit *texUnit)
|
|||||||
GLenum format = texObj->Image[0][texObj->BaseLevel]->_BaseFormat;
|
GLenum format = texObj->Image[0][texObj->BaseLevel]->_BaseFormat;
|
||||||
|
|
||||||
if (format == GL_DEPTH_COMPONENT || format == GL_DEPTH_STENCIL_EXT) {
|
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);
|
calculate_derived_texenv(&texUnit->_EnvMode, texUnit->EnvMode, format);
|
||||||
texUnit->_CurrentCombine = & texUnit->_EnvMode;
|
texUnit->_CurrentCombine = & texUnit->_EnvMode;
|
||||||
|
@@ -147,7 +147,7 @@ st_create_texture_sampler_view_from_stobj(struct pipe_context *pipe,
|
|||||||
struct pipe_sampler_view templ;
|
struct pipe_sampler_view templ;
|
||||||
GLuint swizzle = apply_depthmode(stObj->pt->format,
|
GLuint swizzle = apply_depthmode(stObj->pt->format,
|
||||||
stObj->base._Swizzle,
|
stObj->base._Swizzle,
|
||||||
samp->DepthMode);
|
stObj->base.DepthMode);
|
||||||
|
|
||||||
u_sampler_view_default_template(&templ,
|
u_sampler_view_default_template(&templ,
|
||||||
stObj->pt,
|
stObj->pt,
|
||||||
@@ -240,7 +240,7 @@ update_single_texture(struct st_context *st,
|
|||||||
if (stObj->sampler_view) {
|
if (stObj->sampler_view) {
|
||||||
if (check_sampler_swizzle(stObj->sampler_view,
|
if (check_sampler_swizzle(stObj->sampler_view,
|
||||||
stObj->base._Swizzle,
|
stObj->base._Swizzle,
|
||||||
samp->DepthMode) ||
|
stObj->base.DepthMode) ||
|
||||||
(st_view_format != stObj->sampler_view->format) ||
|
(st_view_format != stObj->sampler_view->format) ||
|
||||||
stObj->base.BaseLevel != stObj->sampler_view->u.tex.first_level) {
|
stObj->base.BaseLevel != stObj->sampler_view->u.tex.first_level) {
|
||||||
pipe_sampler_view_reference(&stObj->sampler_view, NULL);
|
pipe_sampler_view_reference(&stObj->sampler_view, NULL);
|
||||||
|
@@ -3468,7 +3468,7 @@ sample_depth_texture( struct gl_context *ctx,
|
|||||||
|
|
||||||
result = shadow_compare(function, depthRef, depthSample, ambient);
|
result = shadow_compare(function, depthRef, depthSample, ambient);
|
||||||
|
|
||||||
switch (tObj->Sampler.DepthMode) {
|
switch (tObj->DepthMode) {
|
||||||
case GL_LUMINANCE:
|
case GL_LUMINANCE:
|
||||||
ASSIGN_4V(texel[i], result, result, result, 1.0F);
|
ASSIGN_4V(texel[i], result, result, result, 1.0F);
|
||||||
break;
|
break;
|
||||||
@@ -3563,7 +3563,7 @@ sample_depth_texture( struct gl_context *ctx,
|
|||||||
depth00, depth01, depth10, depth11,
|
depth00, depth01, depth10, depth11,
|
||||||
ambient, wi, wj);
|
ambient, wi, wj);
|
||||||
|
|
||||||
switch (tObj->Sampler.DepthMode) {
|
switch (tObj->DepthMode) {
|
||||||
case GL_LUMINANCE:
|
case GL_LUMINANCE:
|
||||||
ASSIGN_4V(texel[i], result, result, result, 1.0F);
|
ASSIGN_4V(texel[i], result, result, result, 1.0F);
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user