[Mesa-dev] [PATCH v2] glsl: Correct several built-in functions availability

Ian Romanick idr at freedesktop.org
Thu Nov 1 19:41:13 UTC 2018


On 10/31/2018 03:05 PM, Timothy Arceri wrote:
> If we are going to start tightening up this stuff I would really really
> like to see CTS tests (not piglit tests) to go along with this stuff.
> 
> We are already way stricter with these type of things than the closed
> source drivers and this leads to some apps not working. Before we go
> ahead and tighten things up more we should get this stuff covered by the
> CTS so that we are not the only ones enforcing the rules (i.e. fighting
> an unwinnable battle).

Yeah, I was pretty surprised by this list of functions.  I think the
absolute minimum bar is a set of piglit tests that pass on at least one
of NVIDIA or AMD closed-source drivers.  Adding CTS tests that only
operate on GLSL 1.10 or 1.20 is unlikely to be successful.  GLSL ES 1.00
tests have more of a chance, but it's still a very slim chance.

> On 1/11/18 5:37 am, Vadym Shovkoplias wrote:
>> In GLSL versions 1.00 ES, 1.10 and 1.20, Mesa includes
>> some built-in functions which shouldn't be present in
>> that version, namely:
>>
>>     genIType abs(genIType x)
>>     genIType sign(genIType x)
>>     genIType min(genIType x, genIType y)
>>     genIType min(genIType x, int y)
>>     genIType max(genIType x, genIType y)
>>     genIType max(genIType x, int y)
>>     genIType clamp(genIType x, genIType minVal, genIType maxVal)
>>     genIType clamp(genIType x, int minVal, int maxVal)
>>     genType trunc(genType x)
>>     genType round(genType x)
>>     genType roundEven(genType x)
>>     genType modf(genType x, out genType i)
>>
>> v2: genIType sign(genIType x) was added in 1.30 GLSL spec, not in
>> 1.50 spec
>>
>> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=108160
>> Signed-off-by: Vadym Shovkoplias <vadym.shovkoplias at globallogic.com>
>> ---
>>   src/compiler/glsl/builtin_functions.cpp | 30 ++++++++++++-------------
>>   1 file changed, 15 insertions(+), 15 deletions(-)
>>
>> diff --git a/src/compiler/glsl/builtin_functions.cpp
>> b/src/compiler/glsl/builtin_functions.cpp
>> index 5650365d1d..52e0599ad2 100644
>> --- a/src/compiler/glsl/builtin_functions.cpp
>> +++ b/src/compiler/glsl/builtin_functions.cpp
>> @@ -1439,10 +1439,10 @@ builtin_builder::create_builtins()
>>                   _##NAME(always_available, glsl_type::vec2_type),  \
>>                   _##NAME(always_available, glsl_type::vec3_type),  \
>>                   _##NAME(always_available, glsl_type::vec4_type),  \
>> -                _##NAME(always_available, glsl_type::int_type),   \
>> -                _##NAME(always_available, glsl_type::ivec2_type), \
>> -                _##NAME(always_available, glsl_type::ivec3_type), \
>> -                _##NAME(always_available, glsl_type::ivec4_type), \
>> +                _##NAME(v130, glsl_type::int_type),   \
>> +                _##NAME(v130, glsl_type::ivec2_type), \
>> +                _##NAME(v130, glsl_type::ivec3_type), \
>> +                _##NAME(v130, glsl_type::ivec4_type), \
>>                   _##NAME(fp64, glsl_type::double_type), \
>>                   _##NAME(fp64, glsl_type::dvec2_type),  \
>>                   _##NAME(fp64, glsl_type::dvec3_type),  \
>> @@ -1534,14 +1534,14 @@ builtin_builder::create_builtins()
>>                   _##NAME(always_available, glsl_type::vec3_type, 
>> glsl_type::vec3_type),  \
>>                   _##NAME(always_available, glsl_type::vec4_type, 
>> glsl_type::vec4_type),  \
>>                                                                                           
>> \
>> -                _##NAME(always_available, glsl_type::int_type,  
>> glsl_type::int_type),   \
>> -                _##NAME(always_available, glsl_type::ivec2_type,
>> glsl_type::int_type),   \
>> -                _##NAME(always_available, glsl_type::ivec3_type,
>> glsl_type::int_type),   \
>> -                _##NAME(always_available, glsl_type::ivec4_type,
>> glsl_type::int_type),   \
>> +                _##NAME(v130, glsl_type::int_type,  
>> glsl_type::int_type),   \
>> +                _##NAME(v130, glsl_type::ivec2_type,
>> glsl_type::int_type),   \
>> +                _##NAME(v130, glsl_type::ivec3_type,
>> glsl_type::int_type),   \
>> +                _##NAME(v130, glsl_type::ivec4_type,
>> glsl_type::int_type),   \
>>                                                                                           
>> \
>> -                _##NAME(always_available, glsl_type::ivec2_type,
>> glsl_type::ivec2_type), \
>> -                _##NAME(always_available, glsl_type::ivec3_type,
>> glsl_type::ivec3_type), \
>> -                _##NAME(always_available, glsl_type::ivec4_type,
>> glsl_type::ivec4_type), \
>> +                _##NAME(v130, glsl_type::ivec2_type,
>> glsl_type::ivec2_type), \
>> +                _##NAME(v130, glsl_type::ivec3_type,
>> glsl_type::ivec3_type), \
>> +                _##NAME(v130, glsl_type::ivec4_type,
>> glsl_type::ivec4_type), \
>>                                                                                           
>> \
>>                   _##NAME(v130, glsl_type::uint_type, 
>> glsl_type::uint_type),              \
>>                   _##NAME(v130, glsl_type::uvec2_type,
>> glsl_type::uint_type),              \
>> @@ -1611,9 +1611,9 @@ builtin_builder::create_builtins()
>>      FI64(abs)
>>      FI64(sign)
>>      FD(floor)
>> -   FD(trunc)
>> -   FD(round)
>> -   FD(roundEven)
>> +   FD130(trunc)
>> +   FD130(round)
>> +   FD130(roundEven)
>>      FD(ceil)
>>      FD(fract)
>>   @@ -1637,7 +1637,7 @@ builtin_builder::create_builtins()
>>                   _mod(fp64, glsl_type::dvec4_type, 
>> glsl_type::dvec4_type),
>>                   NULL);
>>   -   FD(modf)
>> +   FD130(modf)
>>        FIUD2_MIXED(min)
>>      FIUD2_MIXED(max)
>>
> _______________________________________________
> 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