Added OpenGL 1.4's per-texture LOD bias.
This commit is contained in:
@@ -290,6 +290,7 @@ _mesa_enable_1_4_extensions(GLcontext *ctx)
|
||||
ctx->Extensions.EXT_point_parameters = GL_TRUE;
|
||||
ctx->Extensions.EXT_secondary_color = GL_TRUE;
|
||||
ctx->Extensions.EXT_stencil_wrap = GL_TRUE;
|
||||
ctx->Extensions.EXT_texture_lod_bias = GL_TRUE;
|
||||
ctx->Extensions.SGIS_generate_mipmap = GL_TRUE;
|
||||
}
|
||||
|
||||
|
@@ -6428,6 +6428,7 @@ _mesa_GetString( GLenum name )
|
||||
ctx->Extensions.EXT_point_parameters && /*aka ARB*/
|
||||
ctx->Extensions.EXT_secondary_color &&
|
||||
ctx->Extensions.EXT_stencil_wrap &&
|
||||
ctx->Extensions.EXT_texture_lod_bias &&
|
||||
ctx->Extensions.SGIS_generate_mipmap) {
|
||||
if (ctx->Extensions.ARB_occlusion_query &&
|
||||
ctx->Extensions.ARB_point_sprite &&
|
||||
|
@@ -1073,6 +1073,7 @@ struct gl_texture_object {
|
||||
GLenum MagFilter; /**< magnification filter */
|
||||
GLfloat MinLod; /**< min lambda, OpenGL 1.2 */
|
||||
GLfloat MaxLod; /**< max lambda, OpenGL 1.2 */
|
||||
GLfloat LodBias; /**< OpenGL 1.4 */
|
||||
GLint BaseLevel; /**< min mipmap level, OpenGL 1.2 */
|
||||
GLint MaxLevel; /**< max mipmap level, OpenGL 1.2 */
|
||||
GLfloat MaxAnisotropy; /**< GL_EXT_texture_filter_anisotropic */
|
||||
|
@@ -114,6 +114,7 @@ _mesa_initialize_texture_object( struct gl_texture_object *obj,
|
||||
obj->MagFilter = GL_LINEAR;
|
||||
obj->MinLod = -1000.0;
|
||||
obj->MaxLod = 1000.0;
|
||||
obj->LodBias = 0.0;
|
||||
obj->BaseLevel = 0;
|
||||
obj->MaxLevel = 1000;
|
||||
obj->MaxAnisotropy = 1.0;
|
||||
@@ -242,6 +243,7 @@ _mesa_copy_texture_object( struct gl_texture_object *dest,
|
||||
dest->MagFilter = src->MagFilter;
|
||||
dest->MinLod = src->MinLod;
|
||||
dest->MaxLod = src->MaxLod;
|
||||
dest->LodBias = src->LodBias;
|
||||
dest->BaseLevel = src->BaseLevel;
|
||||
dest->MaxLevel = src->MaxLevel;
|
||||
dest->MaxAnisotropy = src->MaxAnisotropy;
|
||||
|
@@ -1399,6 +1399,14 @@ _mesa_TexParameterfv( GLenum target, GLenum pname, const GLfloat *params )
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case GL_TEXTURE_LOD_BIAS:
|
||||
/* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias*/
|
||||
if (ctx->Extensions.EXT_texture_lod_bias) {
|
||||
texObj->LodBias = CLAMP(params[0],
|
||||
-ctx->Const.MaxTextureLodBias,
|
||||
ctx->Const.MaxTextureLodBias);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
_mesa_error(ctx, GL_INVALID_ENUM,
|
||||
@@ -1775,6 +1783,12 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params )
|
||||
return;
|
||||
}
|
||||
break;
|
||||
case GL_TEXTURE_LOD_BIAS:
|
||||
if (ctx->Extensions.EXT_texture_lod_bias) {
|
||||
*params = obj->LodBias;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
; /* silence warnings */
|
||||
}
|
||||
@@ -1801,6 +1815,12 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params )
|
||||
switch (pname) {
|
||||
case GL_TEXTURE_MAG_FILTER:
|
||||
*params = (GLint) obj->MagFilter;
|
||||
case GL_TEXTURE_LOD_BIAS:
|
||||
if (ctx->Extensions.EXT_texture_lod_bias) {
|
||||
*params = (GLint) obj->LodBias;
|
||||
break;
|
||||
}
|
||||
break;
|
||||
return;
|
||||
case GL_TEXTURE_MIN_FILTER:
|
||||
*params = (GLint) obj->MinFilter;
|
||||
|
@@ -4198,11 +4198,11 @@ _swrast_texture_span( GLcontext *ctx, struct sw_span *span )
|
||||
|
||||
/* adjust texture lod (lambda) */
|
||||
if (span->arrayMask & SPAN_LAMBDA) {
|
||||
if (texUnit->LodBias != 0.0F) {
|
||||
if (texUnit->LodBias + curObj->LodBias != 0.0F) {
|
||||
/* apply LOD bias, but don't clamp yet */
|
||||
GLuint i;
|
||||
for (i = 0; i < span->end; i++) {
|
||||
lambda[i] += texUnit->LodBias;
|
||||
lambda[i] += (texUnit->LodBias + curObj->LodBias);
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user