[Mesa-dev] Precision qualifiers in the IR

Kenneth Graunke kenneth at whitecape.org
Thu Jan 8 01:49:11 PST 2015


On Thursday, January 08, 2015 10:21:45 AM Iago Toral wrote:
> Hi,
> 
> In GLSL ES when the same uniform is declared in multiple shaders it must
> have the same precision qualifier. There are a few dEQP tests that fail
> because this is not checked in Mesa.
> 
> I think the right place to add this check would be in
> cross_validate_globals(), but to do this we would need to access
> precision qualifiers from an ir_variable (specifically, I think we need
> this to be in glsl_type so we can do this check with uniform structs
> too, which is what the tests actually check).
> 
> I see precision qualifiers being parsed and stored in the AST, but I
> don't see where this information is passed to the IR: ir_variable or
> glsl_type don't have this info, in fact,
> apply_type_qualifier_to_variable() in ast_to_hir.cpp seems to ignore the
> ast precision qualifier data completely.
> 
> So I am guessing that we should add precision information to the
> glsl_type, but I wonder if there is a reason why this hasn't been done
> yet, considering that there seems to be some kind of support for
> precision qualifiers already, at least in the parser... am I missing
> something?
> 
> Iago

When we implemented the compiler, nobody really cared about lower precision.
Desktop GLSL is actually spec'd to parse and ignore the qualifiers - they
literally are mandated to mean nothing - so they're only useful for ES, and
we've seen very few ES apps.

Making lowp, mediump, and highp the same precision is valid, and at the time,
we were mostly targeting desktop hardware that didn't have a lower precision
option anyway.  These days, we could potentially use it for half float.

Hooking it up isn't a bad plan - we just haven't gotten around to it.
It does seem like we need to at least be tracking it so we can properly
enforce the rules, and adding that would be a good step towards actually
doing something with it.

--Ken
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150108/cfb32942/attachment.sig>


More information about the mesa-dev mailing list