[Mesa-dev] [PATCH 1/2] glsl: always enable OES_standard_derivatives features if supported

Timothy Arceri tarceri at itsqueeze.com
Wed May 16 12:04:48 UTC 2018



On 16/05/18 21:12, Ilia Mirkin wrote:
>  From the spec,
> 
> """
>      The built-in derivative functions dFdx, dFdy, and fwidth are optional, and
>      must be enabled by
> 
>      #extension GL_OES_standard_derivatives : enable
> 
>      before being used.
> """
> 
> Sounds like you need an application override?

The ES spec has no such wording is simply states:

"dFdx(), dFdy(), and fwidth() are made optional."

As sloppy as it is for the spec to do this it seem perfectly legal to 
expose them if we choose to do so. The wording in the 
OES_standard_derivatives spec makes sense if you don't expose them 
normally but it you choose to do so its redundant.

> 
> On Wed, May 16, 2018 at 3:04 AM, Timothy Arceri <tarceri at itsqueeze.com> wrote:
>> The GLSL ES 1.0 spec made these features optional. With
>> OES_standard_derivatives they are guaranteed to be available
>> but currently the extension must be enabled to use them.
>>
>> Instead this changes the code to check if the driver supports
>> the extension and if so always enables them.
>>
>> This fixes compiler errors in Google Earth VR.
>> ---
>>   src/compiler/glsl/builtin_functions.cpp | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/src/compiler/glsl/builtin_functions.cpp b/src/compiler/glsl/builtin_functions.cpp
>> index e1ee9943172..1ecbdc98404 100644
>> --- a/src/compiler/glsl/builtin_functions.cpp
>> +++ b/src/compiler/glsl/builtin_functions.cpp
>> @@ -446,7 +446,7 @@ fs_oes_derivatives(const _mesa_glsl_parse_state *state)
>>   {
>>      return state->stage == MESA_SHADER_FRAGMENT &&
>>             (state->is_version(110, 300) ||
>> -           state->OES_standard_derivatives_enable);
>> +           state->extensions->OES_standard_derivatives);
>>   }
>>
>>   static bool
>> --
>> 2.17.0
>>
>> _______________________________________________
>> 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