diff options
author | Julian de Bhal <julian.debhal@nokia.com> | 2009-10-12 04:18:51 (GMT) |
---|---|---|
committer | Julian de Bhal <julian.debhal@nokia.com> | 2009-10-12 04:18:51 (GMT) |
commit | 52aef13521af2137db15ee878893f5c5150471e5 (patch) | |
tree | ac6265f8621bd337e02db52d2f2a10d55265b3c1 /util/qlalr | |
parent | 44e41d17baa7519f309b8ca10df26ec61d8c2fc7 (diff) | |
download | Qt-52aef13521af2137db15ee878893f5c5150471e5.zip Qt-52aef13521af2137db15ee878893f5c5150471e5.tar.gz Qt-52aef13521af2137db15ee878893f5c5150471e5.tar.bz2 |
GL ES 2.0 Shader language compatibility
Add precision modifiers to variable declarations in glsl for GL ES 2.0
compatibility. Precision modifiers are optional, so GL 2.0 languages
will continue to parse unchanged.
rweather
Diffstat (limited to 'util/qlalr')
-rw-r--r-- | util/qlalr/examples/glsl/glsl-lex.l | 3 | ||||
-rw-r--r-- | util/qlalr/examples/glsl/glsl.g | 58 |
2 files changed, 37 insertions, 24 deletions
diff --git a/util/qlalr/examples/glsl/glsl-lex.l b/util/qlalr/examples/glsl/glsl-lex.l index 2a4826d..b50a2e2 100644 --- a/util/qlalr/examples/glsl/glsl-lex.l +++ b/util/qlalr/examples/glsl/glsl-lex.l @@ -150,6 +150,9 @@ icst ({dec}|0{oct}*|0[xX]{hex}+) "while" { return WHILE; } "^=" { return XOR_ASSIGN; } "^" { return XOR_OP; } +"highp" { return HIGH_PRECISION; } +"mediump" { return MEDIUM_PRECISION; } +"lowp" { return LOW_PRECISION; } #[ \t]+[0-9]+.* { char *eptr = 0; diff --git a/util/qlalr/examples/glsl/glsl.g b/util/qlalr/examples/glsl/glsl.g index 44c24d8..3e825bc 100644 --- a/util/qlalr/examples/glsl/glsl.g +++ b/util/qlalr/examples/glsl/glsl.g @@ -132,6 +132,9 @@ %token XOR_ASSIGN %token XOR_OP %token ERROR +%token HIGH_PRECISION +%token MEDIUM_PRECISION +%token LOW_PRECISION %start translation_unit @@ -487,30 +490,37 @@ type_qualifier ::= ATTRIBUTE ; -- Vertex only. type_qualifier ::= VARYING ; type_qualifier ::= UNIFORM ; -type_specifier ::= VOID ; -type_specifier ::= FLOAT ; -type_specifier ::= INT ; -type_specifier ::= BOOL ; -type_specifier ::= VEC2 ; -type_specifier ::= VEC3 ; -type_specifier ::= VEC4 ; -type_specifier ::= BVEC2 ; -type_specifier ::= BVEC3 ; -type_specifier ::= BVEC4 ; -type_specifier ::= IVEC2 ; -type_specifier ::= IVEC3 ; -type_specifier ::= IVEC4 ; -type_specifier ::= MAT2 ; -type_specifier ::= MAT3 ; -type_specifier ::= MAT4 ; -type_specifier ::= SAMPLER1D ; -type_specifier ::= SAMPLER2D ; -type_specifier ::= SAMPLER3D ; -type_specifier ::= SAMPLERCUBE ; -type_specifier ::= SAMPLER1DSHADOW ; -type_specifier ::= SAMPLER2DSHADOW ; -type_specifier ::= struct_specifier ; -type_specifier ::= TYPE_NAME ; +type_specifier ::= type_specifier_no_prec ; +type_specifier ::= precision_qualifier type_specifier_no_prec ; + +type_specifier_no_prec ::= VOID ; +type_specifier_no_prec ::= FLOAT ; +type_specifier_no_prec ::= INT ; +type_specifier_no_prec ::= BOOL ; +type_specifier_no_prec ::= VEC2 ; +type_specifier_no_prec ::= VEC3 ; +type_specifier_no_prec ::= VEC4 ; +type_specifier_no_prec ::= BVEC2 ; +type_specifier_no_prec ::= BVEC3 ; +type_specifier_no_prec ::= BVEC4 ; +type_specifier_no_prec ::= IVEC2 ; +type_specifier_no_prec ::= IVEC3 ; +type_specifier_no_prec ::= IVEC4 ; +type_specifier_no_prec ::= MAT2 ; +type_specifier_no_prec ::= MAT3 ; +type_specifier_no_prec ::= MAT4 ; +type_specifier_no_prec ::= SAMPLER1D ; +type_specifier_no_prec ::= SAMPLER2D ; +type_specifier_no_prec ::= SAMPLER3D ; +type_specifier_no_prec ::= SAMPLERCUBE ; +type_specifier_no_prec ::= SAMPLER1DSHADOW ; +type_specifier_no_prec ::= SAMPLER2DSHADOW ; +type_specifier_no_prec ::= struct_specifier ; +type_specifier_no_prec ::= TYPE_NAME ; + +precision_qualifier ::= HIGH_PRECISION ; +precision_qualifier ::= MEDIUM_PRECISION ; +precision_qualifier ::= LOW_PRECISION ; struct_specifier ::= STRUCT IDENTIFIER LEFT_BRACE struct_declaration_list RIGHT_BRACE ; /. |