Commit af459216 by John Kessenich

Correct precision qualification on built-in functions.

This is a replacement commit for pull request #238. This is a design change, followed by implementation change that A) fixes the changes caused by the design change, and B) fixes some cases that were originally incorrect. The design change is to not give built-in functions default precision qualification. This is to allow the rule that the precision of some built-in functions adopt their precision qualification from the calling arguments. This is A above. A consequence of this design change is that all built-ins that are supposed to have an explicit precision qualifier must now be declared that way. So, a lot more built-in declarations now have precision qualifiers, just to keep things the same. This is B above.
parent f88a5c75
......@@ -4,14 +4,16 @@ ERROR: 0:17: 'b' : function name is redeclaration of existing name
ERROR: 0:20: 'c' : redefinition
ERROR: 0:22: 'f' : redefinition
ERROR: 0:24: 'redefinition of built-in function' : not supported with this profile: es
ERROR: 0:24: 'highp' : overloaded functions must have the same parameter precision qualifiers for argument 1
ERROR: 0:25: 'redefinition of built-in function' : not supported with this profile: es
ERROR: 0:25: 'highp' : overloaded functions must have the same parameter precision qualifiers for argument 1
ERROR: 0:38: 'local function declaration' : not supported with this profile: es
ERROR: 0:43: 'sin' : can't use function syntax on variable
ERROR: 0:57: 'z' : undeclared identifier
ERROR: 0:57: 'z' : redefinition
ERROR: 0:73: 'degrees' : can't use function syntax on variable
ERROR: 0:76: 'vertex-shader struct output' : not supported for this version or the enabled extensions
ERROR: 12 compilation errors. No code generated.
ERROR: 14 compilation errors. No code generated.
Shader version: 100
......
......@@ -147,44 +147,44 @@ ERROR: node is still EOpNull!
0:69 'c2D' (smooth in lowp 2-component vector of float)
0:72 move second child to first child (temp mediump 4-component vector of int)
0:72 'iv' (temp mediump 4-component vector of int)
0:72 texture (global mediump 4-component vector of int)
0:72 texture (global lowp 4-component vector of int)
0:72 'is2D' (uniform lowp isampler2D)
0:72 'c2D' (smooth in lowp 2-component vector of float)
0:73 move second child to first child (temp mediump 4-component vector of int)
0:73 'iv' (temp mediump 4-component vector of int)
0:73 textureProjOffset (global mediump 4-component vector of int)
0:73 textureProjOffset (global lowp 4-component vector of int)
0:73 'is2D' (uniform lowp isampler2D)
0:73 'c4D' (smooth temp lowp 4-component vector of float)
0:73 'ic2D' (flat in mediump 2-component vector of int)
0:74 move second child to first child (temp mediump 4-component vector of int)
0:74 'iv' (temp mediump 4-component vector of int)
0:74 textureProjLod (global mediump 4-component vector of int)
0:74 textureProjLod (global lowp 4-component vector of int)
0:74 'is2D' (uniform lowp isampler2D)
0:74 'c3D' (smooth in lowp 3-component vector of float)
0:74 'c1D' (smooth in lowp float)
0:75 move second child to first child (temp mediump 4-component vector of int)
0:75 'iv' (temp mediump 4-component vector of int)
0:75 textureProjGrad (global mediump 4-component vector of int)
0:75 textureProjGrad (global lowp 4-component vector of int)
0:75 'is2D' (uniform lowp isampler2D)
0:75 'c3D' (smooth in lowp 3-component vector of float)
0:75 'c2D' (smooth in lowp 2-component vector of float)
0:75 'c2D' (smooth in lowp 2-component vector of float)
0:76 move second child to first child (temp mediump 4-component vector of int)
0:76 'iv' (temp mediump 4-component vector of int)
0:76 texture (global mediump 4-component vector of int)
0:76 texture (global lowp 4-component vector of int)
0:76 'is3D' (uniform lowp isampler3D)
0:76 'c3D' (smooth in lowp 3-component vector of float)
0:76 Constant:
0:76 4.200000
0:77 move second child to first child (temp mediump 4-component vector of int)
0:77 'iv' (temp mediump 4-component vector of int)
0:77 textureLod (global mediump 4-component vector of int)
0:77 textureLod (global lowp 4-component vector of int)
0:77 'isCube' (uniform lowp isamplerCube)
0:77 'c3D' (smooth in lowp 3-component vector of float)
0:77 'c1D' (smooth in lowp float)
0:78 move second child to first child (temp mediump 4-component vector of int)
0:78 'iv' (temp mediump 4-component vector of int)
0:78 textureFetch (global mediump 4-component vector of int)
0:78 textureFetch (global lowp 4-component vector of int)
0:78 'is2DArray' (uniform lowp isampler2DArray)
0:78 'ic3D' (flat in mediump 3-component vector of int)
0:78 'ic1D' (flat in mediump int)
......@@ -503,44 +503,44 @@ ERROR: node is still EOpNull!
0:69 'c2D' (smooth in lowp 2-component vector of float)
0:72 move second child to first child (temp mediump 4-component vector of int)
0:72 'iv' (temp mediump 4-component vector of int)
0:72 texture (global mediump 4-component vector of int)
0:72 texture (global lowp 4-component vector of int)
0:72 'is2D' (uniform lowp isampler2D)
0:72 'c2D' (smooth in lowp 2-component vector of float)
0:73 move second child to first child (temp mediump 4-component vector of int)
0:73 'iv' (temp mediump 4-component vector of int)
0:73 textureProjOffset (global mediump 4-component vector of int)
0:73 textureProjOffset (global lowp 4-component vector of int)
0:73 'is2D' (uniform lowp isampler2D)
0:73 'c4D' (smooth temp lowp 4-component vector of float)
0:73 'ic2D' (flat in mediump 2-component vector of int)
0:74 move second child to first child (temp mediump 4-component vector of int)
0:74 'iv' (temp mediump 4-component vector of int)
0:74 textureProjLod (global mediump 4-component vector of int)
0:74 textureProjLod (global lowp 4-component vector of int)
0:74 'is2D' (uniform lowp isampler2D)
0:74 'c3D' (smooth in lowp 3-component vector of float)
0:74 'c1D' (smooth in lowp float)
0:75 move second child to first child (temp mediump 4-component vector of int)
0:75 'iv' (temp mediump 4-component vector of int)
0:75 textureProjGrad (global mediump 4-component vector of int)
0:75 textureProjGrad (global lowp 4-component vector of int)
0:75 'is2D' (uniform lowp isampler2D)
0:75 'c3D' (smooth in lowp 3-component vector of float)
0:75 'c2D' (smooth in lowp 2-component vector of float)
0:75 'c2D' (smooth in lowp 2-component vector of float)
0:76 move second child to first child (temp mediump 4-component vector of int)
0:76 'iv' (temp mediump 4-component vector of int)
0:76 texture (global mediump 4-component vector of int)
0:76 texture (global lowp 4-component vector of int)
0:76 'is3D' (uniform lowp isampler3D)
0:76 'c3D' (smooth in lowp 3-component vector of float)
0:76 Constant:
0:76 4.200000
0:77 move second child to first child (temp mediump 4-component vector of int)
0:77 'iv' (temp mediump 4-component vector of int)
0:77 textureLod (global mediump 4-component vector of int)
0:77 textureLod (global lowp 4-component vector of int)
0:77 'isCube' (uniform lowp isamplerCube)
0:77 'c3D' (smooth in lowp 3-component vector of float)
0:77 'c1D' (smooth in lowp float)
0:78 move second child to first child (temp mediump 4-component vector of int)
0:78 'iv' (temp mediump 4-component vector of int)
0:78 textureFetch (global mediump 4-component vector of int)
0:78 textureFetch (global lowp 4-component vector of int)
0:78 'is2DArray' (uniform lowp isampler2DArray)
0:78 'ic3D' (flat in mediump 3-component vector of int)
0:78 'ic1D' (flat in mediump int)
......
......@@ -193,7 +193,7 @@ ERROR: node is still EOpNull!
0:124 Sequence
0:124 move second child to first child (temp highp 4-component vector of float)
0:124 'x4' (temp highp 4-component vector of float)
0:124 texture (global highp 4-component vector of float)
0:124 texture (global lowp 4-component vector of float)
0:124 's2D' (uniform lowp sampler2D)
0:124 'c2D' (in highp 2-component vector of float)
0:125 Constant:
......@@ -201,7 +201,7 @@ ERROR: node is still EOpNull!
0:126 Sequence
0:126 move second child to first child (temp highp 4-component vector of float)
0:126 'x5' (temp highp 4-component vector of float)
0:126 textureProjOffset (global highp 4-component vector of float)
0:126 textureProjOffset (global lowp 4-component vector of float)
0:126 's3D' (uniform lowp sampler3D)
0:126 Constant:
0:126 0.200000
......@@ -217,7 +217,7 @@ ERROR: node is still EOpNull!
0:128 Sequence
0:128 move second child to first child (temp highp float)
0:128 'x6' (temp highp float)
0:128 textureProjGradOffset (global highp float)
0:128 textureProjGradOffset (global lowp float)
0:128 's2DS' (uniform lowp sampler2DShadow)
0:128 'invIn' (invariant in highp 4-component vector of float)
0:128 Constant:
......@@ -477,7 +477,7 @@ ERROR: node is still EOpNull!
0:124 Sequence
0:124 move second child to first child (temp highp 4-component vector of float)
0:124 'x4' (temp highp 4-component vector of float)
0:124 texture (global highp 4-component vector of float)
0:124 texture (global lowp 4-component vector of float)
0:124 's2D' (uniform lowp sampler2D)
0:124 'c2D' (in highp 2-component vector of float)
0:125 Constant:
......@@ -485,7 +485,7 @@ ERROR: node is still EOpNull!
0:126 Sequence
0:126 move second child to first child (temp highp 4-component vector of float)
0:126 'x5' (temp highp 4-component vector of float)
0:126 textureProjOffset (global highp 4-component vector of float)
0:126 textureProjOffset (global lowp 4-component vector of float)
0:126 's3D' (uniform lowp sampler3D)
0:126 Constant:
0:126 0.200000
......@@ -501,7 +501,7 @@ ERROR: node is still EOpNull!
0:128 Sequence
0:128 move second child to first child (temp highp float)
0:128 'x6' (temp highp float)
0:128 textureProjGradOffset (global highp float)
0:128 textureProjGradOffset (global lowp float)
0:128 's2DS' (uniform lowp sampler2DShadow)
0:128 'invIn' (invariant in highp 4-component vector of float)
0:128 Constant:
......
......@@ -24,18 +24,18 @@ ERROR: node is still EOpNull!
0:42 Function Definition: main( (global void)
0:42 Function Parameters:
0:44 Sequence
0:44 texture (global mediump 4-component vector of int)
0:44 texture (global lowp 4-component vector of int)
0:44 sampler: direct index for structure (global lowp isampler3D)
0:44 's' (uniform structure{global mediump 4-component vector of float u, global mediump 4-component vector of uint v, global lowp isampler3D sampler, global mediump 3-component vector of float w, global structure{global mediump int a} t})
0:44 Constant:
0:44 2 (const int)
0:44 Construct vec3 (temp mediump 3-component vector of float)
0:44 Convert int to float (temp mediump float)
0:44 Construct vec3 (temp lowp 3-component vector of float)
0:44 Convert int to float (temp lowp float)
0:44 ni: direct index for structure (layout(column_major shared ) uniform mediump int)
0:44 'inst' (layout(column_major shared ) uniform block{layout(column_major shared ) uniform mediump 4-component vector of uint nbv, layout(column_major shared ) uniform mediump int ni})
0:44 Constant:
0:44 1 (const int)
0:44 Convert uint to float (temp mediump float)
0:44 Convert uint to float (temp lowp float)
0:44 direct index (temp mediump uint)
0:44 bv: direct index for structure (layout(column_major shared ) uniform mediump 4-component vector of uint)
0:44 'anon@0' (layout(column_major shared ) uniform block{layout(column_major shared ) uniform mediump 4-component vector of uint bv, layout(column_major shared ) uniform mediump 2X2 matrix of float bm2, layout(column_major shared ) uniform lowp isampler2D sampler, layout(column_major shared ) uniform structure{global mediump int a} t, layout(column_major shared ) uniform structure{global mediump 4-component vector of float u, global mediump 4-component vector of uint v, global lowp isampler3D sampler, global mediump 3-component vector of float w, global structure{global mediump int a} t} fbs})
......@@ -43,7 +43,7 @@ ERROR: node is still EOpNull!
0:44 0 (const uint)
0:44 Constant:
0:44 1 (const int)
0:44 Convert uint to float (temp mediump float)
0:44 Convert uint to float (temp lowp float)
0:44 direct index (temp mediump uint)
0:44 nbv: direct index for structure (layout(column_major shared ) uniform mediump 4-component vector of uint)
0:44 direct index (layout(column_major shared ) temp block{layout(column_major shared ) uniform mediump 4-component vector of uint nbv, layout(column_major shared ) uniform mediump int ni})
......@@ -92,18 +92,18 @@ ERROR: node is still EOpNull!
0:42 Function Definition: main( (global void)
0:42 Function Parameters:
0:44 Sequence
0:44 texture (global mediump 4-component vector of int)
0:44 texture (global lowp 4-component vector of int)
0:44 sampler: direct index for structure (global lowp isampler3D)
0:44 's' (uniform structure{global mediump 4-component vector of float u, global mediump 4-component vector of uint v, global lowp isampler3D sampler, global mediump 3-component vector of float w, global structure{global mediump int a} t})
0:44 Constant:
0:44 2 (const int)
0:44 Construct vec3 (temp mediump 3-component vector of float)
0:44 Convert int to float (temp mediump float)
0:44 Construct vec3 (temp lowp 3-component vector of float)
0:44 Convert int to float (temp lowp float)
0:44 ni: direct index for structure (layout(column_major shared ) uniform mediump int)
0:44 'inst' (layout(column_major shared ) uniform block{layout(column_major shared ) uniform mediump 4-component vector of uint nbv, layout(column_major shared ) uniform mediump int ni})
0:44 Constant:
0:44 1 (const int)
0:44 Convert uint to float (temp mediump float)
0:44 Convert uint to float (temp lowp float)
0:44 direct index (temp mediump uint)
0:44 bv: direct index for structure (layout(column_major shared ) uniform mediump 4-component vector of uint)
0:44 'anon@0' (layout(column_major shared ) uniform block{layout(column_major shared ) uniform mediump 4-component vector of uint bv, layout(column_major shared ) uniform mediump 2X2 matrix of float bm2, layout(column_major shared ) uniform lowp isampler2D sampler, layout(column_major shared ) uniform structure{global mediump int a} t, layout(column_major shared ) uniform structure{global mediump 4-component vector of float u, global mediump 4-component vector of uint v, global lowp isampler3D sampler, global mediump 3-component vector of float w, global structure{global mediump int a} t} fbs})
......@@ -111,7 +111,7 @@ ERROR: node is still EOpNull!
0:44 0 (const uint)
0:44 Constant:
0:44 1 (const int)
0:44 Convert uint to float (temp mediump float)
0:44 Convert uint to float (temp lowp float)
0:44 direct index (temp mediump uint)
0:44 nbv: direct index for structure (layout(column_major shared ) uniform mediump 4-component vector of uint)
0:44 direct index (layout(column_major shared ) temp block{layout(column_major shared ) uniform mediump 4-component vector of uint nbv, layout(column_major shared ) uniform mediump int ni})
......
......@@ -5,8 +5,10 @@ ERROR: 0:20: 'c' : redefinition
ERROR: 0:22: 'f' : redefinition
ERROR: 0:23: 'tan' : redefinition
ERROR: 0:24: 'redefinition of built-in function' : not supported with this profile: es
ERROR: 0:24: 'highp' : overloaded functions must have the same parameter precision qualifiers for argument 1
ERROR: 0:24: 'sin' : function name is redeclaration of existing name
ERROR: 0:25: 'redefinition of built-in function' : not supported with this profile: es
ERROR: 0:25: 'highp' : overloaded functions must have the same parameter precision qualifiers for argument 1
ERROR: 0:25: 'cos' : function name is redeclaration of existing name
ERROR: 0:25: 'cos' : function already has a body
ERROR: 0:27: 'return' : void function cannot return a value
......@@ -18,7 +20,7 @@ ERROR: 0:43: 'sin' : can't use function syntax on variable
ERROR: 0:57: 'z' : undeclared identifier
ERROR: 0:57: 'z' : redefinition
ERROR: 0:73: 'degrees' : can't use function syntax on variable
ERROR: 19 compilation errors. No code generated.
ERROR: 21 compilation errors. No code generated.
Shader version: 300
......
......@@ -186,11 +186,11 @@ ERROR: node is still EOpNull!
0:33 'u3' (temp highp 3-component vector of uint)
0:34 move second child to first child (temp highp 2-component vector of int)
0:34 'i2' (temp highp 2-component vector of int)
0:34 findLSB (global highp 2-component vector of int)
0:34 findLSB (global lowp 2-component vector of int)
0:34 'i2' (temp highp 2-component vector of int)
0:35 move second child to first child (temp highp 4-component vector of int)
0:35 'i4' (temp highp 4-component vector of int)
0:35 findLSB (global highp 4-component vector of int)
0:35 findLSB (global lowp 4-component vector of int)
0:35 'u4' (temp highp 4-component vector of uint)
0:36 move second child to first child (temp highp int)
0:36 'i1' (temp highp int)
......@@ -1117,11 +1117,11 @@ ERROR: node is still EOpNull!
0:33 'u3' (temp highp 3-component vector of uint)
0:34 move second child to first child (temp highp 2-component vector of int)
0:34 'i2' (temp highp 2-component vector of int)
0:34 findLSB (global highp 2-component vector of int)
0:34 findLSB (global lowp 2-component vector of int)
0:34 'i2' (temp highp 2-component vector of int)
0:35 move second child to first child (temp highp 4-component vector of int)
0:35 'i4' (temp highp 4-component vector of int)
0:35 findLSB (global highp 4-component vector of int)
0:35 findLSB (global lowp 4-component vector of int)
0:35 'u4' (temp highp 4-component vector of uint)
0:36 move second child to first child (temp highp int)
0:36 'i1' (temp highp int)
......
......@@ -13,7 +13,7 @@ ERROR: node is still EOpNull!
0:20 Sequence
0:20 move second child to first child (temp highp 4-component vector of float)
0:20 't' (temp highp 4-component vector of float)
0:20 texture (global highp 4-component vector of float)
0:20 texture (global lowp 4-component vector of float)
0:20 's2D' (uniform lowp sampler2D)
0:20 Constant:
0:20 0.100000
......@@ -27,7 +27,7 @@ ERROR: node is still EOpNull!
0:21 0.200000
0:22 add second child into first child (temp highp 4-component vector of float)
0:22 't' (temp highp 4-component vector of float)
0:22 texture (global highp float)
0:22 texture (global mediump float)
0:22 's2dAS' (uniform mediump sampler2DArrayShadow)
0:22 Constant:
0:22 0.500000
......@@ -61,7 +61,7 @@ ERROR: node is still EOpNull!
0:20 Sequence
0:20 move second child to first child (temp highp 4-component vector of float)
0:20 't' (temp highp 4-component vector of float)
0:20 texture (global highp 4-component vector of float)
0:20 texture (global lowp 4-component vector of float)
0:20 's2D' (uniform lowp sampler2D)
0:20 Constant:
0:20 0.100000
......@@ -75,7 +75,7 @@ ERROR: node is still EOpNull!
0:21 0.200000
0:22 add second child into first child (temp highp 4-component vector of float)
0:22 't' (temp highp 4-component vector of float)
0:22 texture (global highp float)
0:22 texture (global mediump float)
0:22 's2dAS' (uniform mediump sampler2DArrayShadow)
0:22 Constant:
0:22 0.500000
......
......@@ -44,6 +44,8 @@ Linked vertex stage:
Name 173 "u3"
Name 182 "i3"
Name 247 "v4"
Decorate 223 RelaxedPrecision
Decorate 230 RelaxedPrecision
Decorate 261 RelaxedPrecision
Decorate 265 RelaxedPrecision
2: TypeVoid
......
......@@ -113,7 +113,7 @@ ERROR: node is still EOpNull!
0:55 true case
0:56 move second child to first child (temp mediump 4-component vector of uint)
0:56 'c' (out mediump 4-component vector of uint)
0:56 texture (global mediump 4-component vector of uint)
0:56 texture (global lowp 4-component vector of uint)
0:56 'usampler' (uniform lowp usampler2D)
0:56 'tc' (smooth in highp 2-component vector of float)
0:57 Test condition and select (temp void)
......@@ -124,7 +124,7 @@ ERROR: node is still EOpNull!
0:57 true case
0:58 move second child to first child (temp mediump 4-component vector of uint)
0:58 'c' (out mediump 4-component vector of uint)
0:58 texture (global mediump 4-component vector of uint)
0:58 texture (global lowp 4-component vector of uint)
0:58 'usampler' (uniform lowp usampler2D)
0:58 add (temp highp 2-component vector of float)
0:58 'tc' (smooth in highp 2-component vector of float)
......@@ -139,7 +139,7 @@ ERROR: node is still EOpNull!
0:59 true case
0:60 move second child to first child (temp mediump 4-component vector of uint)
0:60 'c' (out mediump 4-component vector of uint)
0:60 texture (global mediump 4-component vector of uint)
0:60 texture (global lowp 4-component vector of uint)
0:60 'usampler' (uniform lowp usampler2D)
0:60 subtract (temp highp 2-component vector of float)
0:60 'tc' (smooth in highp 2-component vector of float)
......@@ -412,7 +412,7 @@ ERROR: node is still EOpNull!
0:55 true case
0:56 move second child to first child (temp mediump 4-component vector of uint)
0:56 'c' (out mediump 4-component vector of uint)
0:56 texture (global mediump 4-component vector of uint)
0:56 texture (global lowp 4-component vector of uint)
0:56 'usampler' (uniform lowp usampler2D)
0:56 'tc' (smooth in highp 2-component vector of float)
0:57 Test condition and select (temp void)
......@@ -423,7 +423,7 @@ ERROR: node is still EOpNull!
0:57 true case
0:58 move second child to first child (temp mediump 4-component vector of uint)
0:58 'c' (out mediump 4-component vector of uint)
0:58 texture (global mediump 4-component vector of uint)
0:58 texture (global lowp 4-component vector of uint)
0:58 'usampler' (uniform lowp usampler2D)
0:58 add (temp highp 2-component vector of float)
0:58 'tc' (smooth in highp 2-component vector of float)
......@@ -438,7 +438,7 @@ ERROR: node is still EOpNull!
0:59 true case
0:60 move second child to first child (temp mediump 4-component vector of uint)
0:60 'c' (out mediump 4-component vector of uint)
0:60 texture (global mediump 4-component vector of uint)
0:60 texture (global lowp 4-component vector of uint)
0:60 'usampler' (uniform lowp usampler2D)
0:60 subtract (temp highp 2-component vector of float)
0:60 'tc' (smooth in highp 2-component vector of float)
......
......@@ -778,16 +778,16 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
"uint atomicMin(coherent volatile inout uint, uint);"
" int atomicMin(coherent volatile inout int, int);"
"uint atomicMax(coherent volatile inout uint, uint);"
" int atomicMax(coherent volatile inout int, int);"
"uint atomicAnd(coherent volatile inout uint, uint);"
" int atomicAnd(coherent volatile inout int, int);"
"uint atomicOr (coherent volatile inout uint, uint);"
" int atomicOr (coherent volatile inout int, int);"
"uint atomicXor(coherent volatile inout uint, uint);"
" int atomicXor(coherent volatile inout int, int);"
......@@ -1242,15 +1242,15 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 400)) {
commonBuiltins.append(
" uint uaddCarry( uint, uint, out uint carry);"
"uvec2 uaddCarry(uvec2, uvec2, out uvec2 carry);"
"uvec3 uaddCarry(uvec3, uvec3, out uvec3 carry);"
"uvec4 uaddCarry(uvec4, uvec4, out uvec4 carry);"
"highp uint uaddCarry( uint, uint, out uint carry);"
"highp uvec2 uaddCarry(uvec2, uvec2, out uvec2 carry);"
"highp uvec3 uaddCarry(uvec3, uvec3, out uvec3 carry);"
"highp uvec4 uaddCarry(uvec4, uvec4, out uvec4 carry);"
" uint usubBorrow( uint, uint, out uint borrow);"
"uvec2 usubBorrow(uvec2, uvec2, out uvec2 borrow);"
"uvec3 usubBorrow(uvec3, uvec3, out uvec3 borrow);"
"uvec4 usubBorrow(uvec4, uvec4, out uvec4 borrow);"
"highp uint usubBorrow( uint, uint, out uint borrow);"
"highp uvec2 usubBorrow(uvec2, uvec2, out uvec2 borrow);"
"highp uvec3 usubBorrow(uvec3, uvec3, out uvec3 borrow);"
"highp uvec4 usubBorrow(uvec4, uvec4, out uvec4 borrow);"
"void umulExtended( uint, uint, out uint, out uint lsb);"
"void umulExtended(uvec2, uvec2, out uvec2, out uvec2 lsb);"
......@@ -1302,15 +1302,15 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
"ivec3 bitCount(uvec3);"
"ivec4 bitCount(uvec4);"
" int findLSB( int);"
"ivec2 findLSB(ivec2);"
"ivec3 findLSB(ivec3);"
"ivec4 findLSB(ivec4);"
"lowp int findLSB( int);"
"lowp ivec2 findLSB(ivec2);"
"lowp ivec3 findLSB(ivec3);"
"lowp ivec4 findLSB(ivec4);"
" int findLSB( uint);"
"ivec2 findLSB(uvec2);"
"ivec3 findLSB(uvec3);"
"ivec4 findLSB(uvec4);"
"lowp int findLSB( uint);"
"lowp ivec2 findLSB(uvec2);"
"lowp ivec3 findLSB(uvec3);"
"lowp ivec4 findLSB(uvec4);"
" int findMSB( int);"
"ivec2 findMSB(ivec2);"
......@@ -1731,14 +1731,14 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
if ((profile != EEsProfile && version >= 430) ||
(profile == EEsProfile && version >= 310)) {
stageBuiltins[EShLangCompute].append(
"in uvec3 gl_NumWorkGroups;"
"const uvec3 gl_WorkGroupSize = uvec3(1,1,1);"
"in highp uvec3 gl_NumWorkGroups;"
"const highp uvec3 gl_WorkGroupSize = uvec3(1,1,1);"
"in uvec3 gl_WorkGroupID;"
"in uvec3 gl_LocalInvocationID;"
"in highp uvec3 gl_WorkGroupID;"
"in highp uvec3 gl_LocalInvocationID;"
"in uvec3 gl_GlobalInvocationID;"
"in uint gl_LocalInvocationIndex;"
"in highp uvec3 gl_GlobalInvocationID;"
"in highp uint gl_LocalInvocationIndex;"
"\n");
}
......@@ -1976,12 +1976,12 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
"in highp int gl_InvocationID;"
"\n"
"out gl_PerVertex {"
"vec4 gl_Position;"
"float gl_PointSize;"
"highp vec4 gl_Position;"
"highp float gl_PointSize;"
"};"
"\n"
"out int gl_PrimitiveID;"
"out int gl_Layer;"
"out highp int gl_PrimitiveID;"
"out highp int gl_Layer;"
"\n"
);
}
......@@ -2102,8 +2102,8 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
"patch in highp float gl_TessLevelInner[2];"
"out gl_PerVertex {"
"vec4 gl_Position;"
"float gl_PointSize;"
"highp vec4 gl_Position;"
"highp float gl_PointSize;"
);
stageBuiltins[EShLangTessEvaluation].append(
"};"
......@@ -2444,6 +2444,8 @@ void TBuiltIns::addImageFunctions(TSampler sampler, TString& typeName, int versi
if (sampler.ms)
imageParams.append(", int");
if (profile == EEsProfile)
commonBuiltins.append("highp ");
commonBuiltins.append(prefixes[sampler.type]);
commonBuiltins.append("vec4 imageLoad(readonly volatile coherent ");
commonBuiltins.append(imageParams);
......@@ -2467,7 +2469,7 @@ void TBuiltIns::addImageFunctions(TSampler sampler, TString& typeName, int versi
if ( profile != EEsProfile ||
(profile == EEsProfile && version >= 310)) {
if (sampler.type == EbtInt || sampler.type == EbtUint) {
const char* dataType = sampler.type == EbtInt ? "int" : "uint";
const char* dataType = sampler.type == EbtInt ? "highp int" : "highp uint";
const int numBuiltins = 7;
......
......@@ -69,7 +69,7 @@ TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, b
for (int type = 0; type < maxSamplerIndex; ++type)
defaultSamplerPrecision[type] = EpqNone;
// replace with real defaults for those that have them
// replace with real precision defaults for those that have them
if (profile == EEsProfile) {
TSampler sampler;
sampler.set(EbtFloat, Esd2D);
......@@ -80,16 +80,22 @@ TParseContext::TParseContext(TSymbolTable& symbolTable, TIntermediate& interm, b
sampler.external = true;
defaultSamplerPrecision[computeSamplerTypeIndex(sampler)] = EpqLow;
switch (language) {
case EShLangFragment:
defaultPrecision[EbtInt] = EpqMedium;
defaultPrecision[EbtUint] = EpqMedium;
break;
default:
defaultPrecision[EbtInt] = EpqHigh;
defaultPrecision[EbtUint] = EpqHigh;
defaultPrecision[EbtFloat] = EpqHigh;
break;
// If we are parsing built-in computational variables/functions, it is meaningful to record
// whether the built-in has no precision qualifier, as that ambiguity
// is used to resolve the precision from the supplied arguments/operands instead.
// So, we don't actually want to replace EpqNone with a default precision for built-ins.
if (! parsingBuiltins) {
switch (language) {
case EShLangFragment:
defaultPrecision[EbtInt] = EpqMedium;
defaultPrecision[EbtUint] = EpqMedium;
break;
default:
defaultPrecision[EbtInt] = EpqHigh;
defaultPrecision[EbtUint] = EpqHigh;
defaultPrecision[EbtFloat] = EpqHigh;
break;
}
}
defaultPrecision[EbtSampler] = EpqLow;
......
......@@ -334,7 +334,7 @@ protected:
TParseContext(TParseContext&);
TParseContext& operator=(TParseContext&);
bool parsingBuiltins; // true if parsing built-in symbols/functions
const bool parsingBuiltins; // true if parsing built-in symbols/functions
static const int maxSamplerIndex = EsdNumDims * (EbtNumTypes * (2 * 2 * 2)); // see computeSamplerTypeIndex()
TPrecisionQualifier defaultSamplerPrecision[maxSamplerIndex];
bool afterEOF;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment