[Mesa-dev] [PATCH 4/7] mesa: add support for GL_AMD_depth_clamp_separate tokens

Sagar Ghuge sagar.ghuge at intel.com
Wed Aug 22 06:18:41 UTC 2018


On 08/21/2018 09:28 PM, Marek Olšák wrote:
> On Tue, Aug 21, 2018 at 8:02 PM Sagar Ghuge <sagar.ghuge at intel.com> wrote:
>>
>> _mesa_set_enable() and _mesa_IsEnabled() extended to accept new two
>> tokens GL_DEPTH_CLAMP_NEAR_AMD and GL_DEPTH_CLAMP_FAR_AMD.
>>
>> Signed-off-by: Sagar Ghuge <sagar.ghuge at intel.com>
>> ---
>>  src/mesa/main/enable.c | 36 ++++++++++++++++++++++++++++++++++++
>>  1 file changed, 36 insertions(+)
>>
>> diff --git a/src/mesa/main/enable.c b/src/mesa/main/enable.c
>> index 4bde9052bc..66e224676a 100644
>> --- a/src/mesa/main/enable.c
>> +++ b/src/mesa/main/enable.c
>> @@ -1017,6 +1017,30 @@ _mesa_set_enable(struct gl_context *ctx, GLenum cap, GLboolean state)
>>           ctx->Transform.DepthClampFar = state;
>>           break;
>>
>> +      case GL_DEPTH_CLAMP_NEAR_AMD:
>> +         if (!_mesa_is_desktop_gl(ctx))
>> +            goto invalid_enum_error;
>> +         CHECK_EXTENSION(AMD_depth_clamp_separate, cap);
>> +         if (ctx->Transform.DepthClampNear == state)
>> +            return;
>> +         FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepthClamp ? 0 :
>> +                                                           _NEW_TRANSFORM);
>> +         ctx->NewDriverState |= ctx->DriverFlags.NewDepthClamp;
>> +         ctx->Transform.DepthClampNear = state;
>> +         break;
>> +
>> +      case GL_DEPTH_CLAMP_FAR_AMD:
>> +         if (!_mesa_is_desktop_gl(ctx))
>> +            goto invalid_enum_error;
>> +         CHECK_EXTENSION(AMD_depth_clamp_separate, cap);
>> +         if (ctx->Transform.DepthClampFar == state)
>> +            return;
>> +         FLUSH_VERTICES(ctx, ctx->DriverFlags.NewDepthClamp ? 0 :
>> +                                                           _NEW_TRANSFORM);
>> +         ctx->NewDriverState |= ctx->DriverFlags.NewDepthClamp;
>> +         ctx->Transform.DepthClampFar = state;
>> +         break;
>> +
>>        case GL_FRAGMENT_SHADER_ATI:
>>           if (ctx->API != API_OPENGL_COMPAT)
>>              goto invalid_enum_error;
>> @@ -1689,6 +1713,18 @@ _mesa_IsEnabled( GLenum cap )
>>           return (ctx->Transform.DepthClampNear ||
>>                   ctx->Transform.DepthClampFar);
>>
>> +      case GL_DEPTH_CLAMP_NEAR_AMD:
>> +         if (!_mesa_is_desktop_gl(ctx))
>> +            goto invalid_enum_error;
>> +         CHECK_EXTENSION(AMD_depth_clamp_separate);
>> +         return (ctx->Transform.DepthClampNear);
>> +
>> +      case GL_DEPTH_CLAMP_FAR_AMD:
>> +         if (!_mesa_is_desktop_gl(ctx))
>> +            goto invalid_enum_error;
>> +         CHECK_EXTENSION(AMD_depth_clamp_separate);
>> +         return (ctx->Transform.DepthClampFar);
> 
> I'm not really digging these unnecessary parentheses.

I should not copy/paste statements. Sorry about that. I will fix those and send v2. 
Thanks for reviewing all the patches. 
> 
> Marek
> 
>> +
>>        case GL_FRAGMENT_SHADER_ATI:
>>           if (ctx->API != API_OPENGL_COMPAT)
>>              goto invalid_enum_error;
>> --
>> 2.17.1
>>


More information about the mesa-dev mailing list