Mesa (master): mesa/main: fix version/extension checks in _mesa_ClampColor

Nicolai Hähnle nh at kemper.freedesktop.org
Fri Jan 13 10:07:09 UTC 2017


Module: Mesa
Branch: master
Commit: 963311b71fd9900351a4a9dd1cd5f5db391f7e1b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=963311b71fd9900351a4a9dd1cd5f5db391f7e1b

Author: Nicolai Hähnle <nicolai.haehnle at amd.com>
Date:   Thu Jan 12 10:55:33 2017 +0100

mesa/main: fix version/extension checks in _mesa_ClampColor

Add a proper check for feature support, and raise an invalid enum for
GL_CLAMP_VERTEX/FRAGMENT_COLOR unconditionally in core profiles, since
those enums were explicitly removed after the extension was promoted
to core functionality (not in the profile sense) with OpenGL 3.0.

This matches the behavior of the AMD closed source driver and fixes
GL45-CTS.gtf30.GL3Tests.half_float.half_float_textures.

Cc: "12.0 13.0" <mesa-stable at lists.freedesktop.org>
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>

---

 src/mesa/main/blend.c | 16 ++++++++++------
 1 file changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/mesa/main/blend.c b/src/mesa/main/blend.c
index 0322799..955fda1 100644
--- a/src/mesa/main/blend.c
+++ b/src/mesa/main/blend.c
@@ -861,6 +861,14 @@ _mesa_ClampColor(GLenum target, GLenum clamp)
 {
    GET_CURRENT_CONTEXT(ctx);
 
+   /* Check for both the extension and the GL version, since the Intel driver
+    * does not advertise the extension in core profiles.
+    */
+   if (ctx->Version <= 30 && !ctx->Extensions.ARB_color_buffer_float) {
+      _mesa_error(ctx, GL_INVALID_OPERATION, "glClampColor()");
+      return;
+   }
+
    if (clamp != GL_TRUE && clamp != GL_FALSE && clamp != GL_FIXED_ONLY_ARB) {
       _mesa_error(ctx, GL_INVALID_ENUM, "glClampColorARB(clamp)");
       return;
@@ -868,19 +876,15 @@ _mesa_ClampColor(GLenum target, GLenum clamp)
 
    switch (target) {
    case GL_CLAMP_VERTEX_COLOR_ARB:
-      if (ctx->API == API_OPENGL_CORE &&
-          !ctx->Extensions.ARB_color_buffer_float) {
+      if (ctx->API == API_OPENGL_CORE)
          goto invalid_enum;
-      }
       FLUSH_VERTICES(ctx, _NEW_LIGHT);
       ctx->Light.ClampVertexColor = clamp;
       _mesa_update_clamp_vertex_color(ctx, ctx->DrawBuffer);
       break;
    case GL_CLAMP_FRAGMENT_COLOR_ARB:
-      if (ctx->API == API_OPENGL_CORE &&
-          !ctx->Extensions.ARB_color_buffer_float) {
+      if (ctx->API == API_OPENGL_CORE)
          goto invalid_enum;
-      }
       FLUSH_VERTICES(ctx, _NEW_FRAG_CLAMP);
       ctx->Color.ClampFragmentColor = clamp;
       _mesa_update_clamp_fragment_color(ctx, ctx->DrawBuffer);




More information about the mesa-commit mailing list