summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTapani Pälli <tapani.palli@intel.com>2013-11-20 13:27:10 +0200
committerCarl Worth <cworth@cworth.org>2013-11-26 16:30:45 -0800
commitdfaf5de46052ea5f8408d3c7fcac5f8393d6fc8e (patch)
treec65d9095c593232b4e5a6700b6cb59dd3b3b9e9d
parentb9990d758bef30c3e77b6f9cc117008f6cf84090 (diff)
mesa: enable GL_TEXTURE_LOD_BIAS set/get
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" <mesa-stable@lists.freedesktop.org> Reviewed-by: Kenneth Graunke <kenneth@whitecape.org> Reviewed-by: Ian Romanick <ian.d.romanick@intel.com> Signed-off-by: Tapani Pälli <tapani.palli@intel.com> (cherry picked from commit 7e61b44dcd6175579f60d8ff2f703a6c83e33d27)
-rw-r--r--src/mesa/main/texparam.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mesa/main/texparam.c b/src/mesa/main/texparam.c
index 32109951cb5..b437d88f450 100644
--- a/src/mesa/main/texparam.c
+++ b/src/mesa/main/texparam.c
@@ -660,11 +660,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))
@@ -1489,7 +1486,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;
@@ -1677,10 +1674,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)