[Mesa-dev] [PATCH] glsl: Do not allow scalar types in vector relational functions

Ian Romanick idr at freedesktop.org
Tue Nov 8 20:01:01 UTC 2016


On 11/08/2016 11:58 AM, Ian Romanick wrote:
> On 11/04/2016 12:23 PM, Matt Turner wrote:
>> On Sun, Oct 30, 2016 at 11:45 PM, Boyan Ding <boyan.j.ding at gmail.com> wrote:
>>> According to OpenGL Shading Language 4.50 spec, Section 8.7 "Vector
>>> Relational Functions", functions of this type do not operate on scalar
>>> types, so remove scalar types from signature definitions to make the
>>> behavior consistent with glslangValidator and other drivers.
>>
>> Yep. Looks like it's always been this way.
>>
>> The patch is
>>
>> Reviewed-by: Matt Turner <mattst88 at gmail.com>
>>
>> Since this seems to be untested by any suite, could you provide some
>> piglit parser tests that confirm that lessThanEqual(scalar, scalar),
>> et al doesn't work?
>>
>> Rant: what a stupid mess to require <= for scalars but lessThanEqual
>> for vectors.
> 
> I think it makes sense.  What would 'vec4(...) < vec4(...)' return?  A
> bvec4?  How much time would like to spend with a the compiler error that
> would result from

Or did you mean that you can't use lessThanEqual and friends with
scalars is stupid?  I think we just didn't consider that when we added
the ability to swizzle scalars, but we probably should have added that
too.  I could get behind an extension that makes vector functions also
work with vec1.

>     if (a < b) {
>         ...
>     }
> 
> because a and b happen to be vectors.  I bet about an equal number of
> people think that would be stupid as think the current requirement of
> comparison functions for vectors is stupid. :)
> 
>> Somewhere on my todo list is a GLSL extension that fixes things like this...
>> _______________________________________________
>> 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