[Mesa-stable] [Mesa-dev] [PATCH] glsl: Emit better warnings for things that look like default precision statements
Ian Romanick
idr at freedesktop.org
Tue Aug 13 17:16:27 PDT 2013
On 08/13/2013 03:50 PM, Matt Turner wrote:
> On Tue, Aug 13, 2013 at 1:35 PM, Ian Romanick <idr at freedesktop.org> wrote:
>> and the spec doesn't explicitly forbid it.
>
> I was surprised by this, so I verified it.
>
> In the GLSL ES 3.0 spec:
>
> single_declaration
> fully_specified_type
> type_specifier
> precision_qualifier type_specifier_no_prec
>
> precision_qualifier
> <highp, mediump, lowp>
>
> type_specifier_no_prec
> type_specifier_nonarray
> <expands to list of built-in types>
>
> Seems weird, but legitimate.
C allows empty declarations too. I believe it's a side-effect of
function prototypes without formal parameter names. If you can do
int foo(int, float, struct S *);
it's easy to end up with a parser that can also do
int;
float;
struct S *;
It's actually more work to reject those (or generate a warning).
> Have we actually seen 'highp float;' in the wild (outside of piglit)?
Not that I know of.
> Assuming that the two instances of "highp" in precision_names is
> intentional (or was not, but is fixed)
I had to put something in the ast_precision_none slot, and that seemed
as good a choice as any. "" didn't seem too good. :)
> Reviewed-by: Matt Turner <mattst88 at gmail.com>
More information about the mesa-stable
mailing list