From 2747e720362869c0a3ff7724745d4b9c11c86f9a Mon Sep 17 00:00:00 2001 From: Tapani Pälli Date: Wed, 20 Nov 2013 13:27:10 +0200 Subject: mesa: enable GL_TEXTURE_LOD_BIAS set/get MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Earlier comments suggest this was removed from GL core spec but it is still there. Enabling makes 'texture_lod_bias_getter' Khronos conformance tests pass, also removes some errors from Metro Last Light game which is using this API. v2: leave NOTE comment (Ian) Cc: "9.0 9.1 9.2 10.0" Reviewed-by: Kenneth Graunke Reviewed-by: Ian Romanick Signed-off-by: Tapani Pälli (cherry picked from commit 7e61b44dcd6175579f60d8ff2f703a6c83e33d27) --- src/mesa/main/texparam.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/mesa/main/texparam.c') diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c index d56b7d9d774..f77e7f68ad6 100644 --- a/src/mesa/main/texparam.c +++ b/src/mesa/main/texparam.c @@ -684,11 +684,8 @@ set_tex_parameterf(struct gl_context *ctx, return GL_FALSE; case GL_TEXTURE_LOD_BIAS: - /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias. - * It was removed in core-profile, and it has never existed in OpenGL - * ES. - */ - if (ctx->API != API_OPENGL_COMPAT) + /* NOTE: this is really part of OpenGL 1.4, not EXT_texture_lod_bias. */ + if (_mesa_is_gles(ctx)) goto invalid_pname; if (!target_allows_setting_sampler_parameters(texObj->Target)) @@ -1513,7 +1510,7 @@ _mesa_GetTexParameterfv( GLenum target, GLenum pname, GLfloat *params ) *params = (GLfloat) obj->DepthMode; break; case GL_TEXTURE_LOD_BIAS: - if (ctx->API != API_OPENGL_COMPAT) + if (_mesa_is_gles(ctx)) goto invalid_pname; *params = obj->Sampler.LodBias; @@ -1701,10 +1698,13 @@ _mesa_GetTexParameteriv( GLenum target, GLenum pname, GLint *params ) *params = (GLint) obj->DepthMode; break; case GL_TEXTURE_LOD_BIAS: - if (ctx->API != API_OPENGL_COMPAT) + if (_mesa_is_gles(ctx)) goto invalid_pname; - *params = (GLint) obj->Sampler.LodBias; + /* GL spec 'Data Conversions' section specifies that floating-point + * value in integer Get function is rounded to nearest integer + */ + *params = (GLint) roundf(obj->Sampler.LodBias); break; case GL_TEXTURE_CROP_RECT_OES: if (ctx->API != API_OPENGLES || !ctx->Extensions.OES_draw_texture) -- cgit v1.2.3