[Mesa-dev] [PATCH] mesa/main: fix version/extension checks in _mesa_ClampColor

Nicolai Hähnle nhaehnle at gmail.com
Mon Jan 16 11:21:04 UTC 2017


Emil, I'm going to follow up with a patch to try to fix the reported 
i915 regression, but feel free to drop the patch from this thread from 
mesa-stable entirely. It's not an important fix.

Cheers,
Nicolai

On 13.01.2017 21:23, Mark Janes wrote:
> This patch regressed i915 systems:
>
> https://bugs.freedesktop.org/show_bug.cgi?id=99401
>
> Please don't apply to stable until the bug is resolved.
>
> Nicolai Hähnle <nhaehnle at gmail.com> writes:
>
>> From: Nicolai Hähnle <nicolai.haehnle at amd.com>
>>
>> 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>
>> ---
>>  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
>> @@ -854,40 +854,44 @@ _mesa_ColorMaski( GLuint buf, GLboolean red, GLboolean green,
>>     FLUSH_VERTICES(ctx, _NEW_COLOR);
>>     COPY_4UBV(ctx->Color.ColorMask[buf], tmp);
>>  }
>>
>>
>>  void GLAPIENTRY
>>  _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;
>>     }
>>
>>     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);
>>        break;
>>     case GL_CLAMP_READ_COLOR_ARB:
>>        ctx->Color.ClampReadColor = clamp;
>>        break;
>>     default:
>>        goto invalid_enum;
>>     }
>> --
>> 2.7.4
>>
>> _______________________________________________
>> mesa-dev mailing list
>> mesa-dev at lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list