Use proper precision qualifiers for bitfield build-in functions on ES

This change causes ES shaders to precision qualifiers for build-in functions as defined in ESSL spec. It especially mattersfor functions that are defined as highp or taking a highp.

Fixes vulkanCTS dEQP-VK.glsl.builtin.function.integer.bitfieldreverse.*, where bitfieldReverse() retval was wrongly marked as RelaxedPrecision.

Note: floatBitsToInt/floatBitsToUInt precision is also broken, but in different way - so it is not addressed here.
This commit is contained in:
scygan 2016-05-09 17:51:25 +02:00
parent d3d3ce7160
commit 9c56d84b73
3 changed files with 102 additions and 38 deletions

View File

@ -179,11 +179,11 @@ ERROR: node is still EOpNull!
0:31 'u4' (temp highp 4-component vector of uint)
0:32 move second child to first child (temp highp int)
0:32 'i1' (temp highp int)
0:32 bitCount (global highp int)
0:32 bitCount (global lowp int)
0:32 'i1' (temp highp int)
0:33 move second child to first child (temp highp 3-component vector of int)
0:33 'i3' (temp highp 3-component vector of int)
0:33 bitCount (global highp 3-component vector of int)
0:33 bitCount (global lowp 3-component vector of int)
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)
@ -195,11 +195,11 @@ ERROR: node is still EOpNull!
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)
0:36 findMSB (global highp int)
0:36 findMSB (global lowp int)
0:36 'i1' (temp highp int)
0:37 move second child to first child (temp highp 2-component vector of int)
0:37 'i2' (temp highp 2-component vector of int)
0:37 findMSB (global highp 2-component vector of int)
0:37 findMSB (global lowp 2-component vector of int)
0:37 'u2' (temp highp 2-component vector of uint)
0:40 move second child to first child (temp highp 3-component vector of float)
0:40 'v3' (temp highp 3-component vector of float)
@ -1110,11 +1110,11 @@ ERROR: node is still EOpNull!
0:31 'u4' (temp highp 4-component vector of uint)
0:32 move second child to first child (temp highp int)
0:32 'i1' (temp highp int)
0:32 bitCount (global highp int)
0:32 bitCount (global lowp int)
0:32 'i1' (temp highp int)
0:33 move second child to first child (temp highp 3-component vector of int)
0:33 'i3' (temp highp 3-component vector of int)
0:33 bitCount (global highp 3-component vector of int)
0:33 bitCount (global lowp 3-component vector of int)
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)
@ -1126,11 +1126,11 @@ ERROR: node is still EOpNull!
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)
0:36 findMSB (global highp int)
0:36 findMSB (global lowp int)
0:36 'i1' (temp highp int)
0:37 move second child to first child (temp highp 2-component vector of int)
0:37 'i2' (temp highp 2-component vector of int)
0:37 findMSB (global highp 2-component vector of int)
0:37 findMSB (global lowp 2-component vector of int)
0:37 'u2' (temp highp 2-component vector of uint)
0:40 move second child to first child (temp highp 3-component vector of float)
0:40 'v3' (temp highp 3-component vector of float)

View File

@ -44,8 +44,12 @@ Linked vertex stage:
Name 173 "u3"
Name 182 "i3"
Name 247 "v4"
Decorate 210 RelaxedPrecision
Decorate 216 RelaxedPrecision
Decorate 223 RelaxedPrecision
Decorate 230 RelaxedPrecision
Decorate 234 RelaxedPrecision
Decorate 240 RelaxedPrecision
Decorate 261 RelaxedPrecision
Decorate 265 RelaxedPrecision
2: TypeVoid

View File

@ -1242,26 +1242,6 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
if ((profile == EEsProfile && version >= 310) ||
(profile != EEsProfile && version >= 400)) {
commonBuiltins.append(
"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);"
"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);"
"void umulExtended(uvec3, uvec3, out uvec3, out uvec3 lsb);"
"void umulExtended(uvec4, uvec4, out uvec4, out uvec4 lsb);"
"void imulExtended( int, int, out int, out int lsb);"
"void imulExtended(ivec2, ivec2, out ivec2, out ivec2 lsb);"
"void imulExtended(ivec3, ivec3, out ivec3, out ivec3 lsb);"
"void imulExtended(ivec4, ivec4, out ivec4, out ivec4 lsb);"
" int bitfieldExtract( int, int, int);"
"ivec2 bitfieldExtract(ivec2, int, int);"
"ivec3 bitfieldExtract(ivec3, int, int);"
@ -1282,6 +1262,41 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
"uvec3 bitfieldInsert(uvec3 base, uvec3, int, int);"
"uvec4 bitfieldInsert(uvec4 base, uvec4, int, int);"
"lowp int findLSB( int);"
"lowp ivec2 findLSB(ivec2);"
"lowp ivec3 findLSB(ivec3);"
"lowp ivec4 findLSB(ivec4);"
"lowp int findLSB( uint);"
"lowp ivec2 findLSB(uvec2);"
"lowp ivec3 findLSB(uvec3);"
"lowp ivec4 findLSB(uvec4);"
"\n");
}
if (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);"
" 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);"
"void umulExtended( uint, uint, out uint, out uint lsb);"
"void umulExtended(uvec2, uvec2, out uvec2, out uvec2 lsb);"
"void umulExtended(uvec3, uvec3, out uvec3, out uvec3 lsb);"
"void umulExtended(uvec4, uvec4, out uvec4, out uvec4 lsb);"
"void imulExtended( int, int, out int, out int lsb);"
"void imulExtended(ivec2, ivec2, out ivec2, out ivec2 lsb);"
"void imulExtended(ivec3, ivec3, out ivec3, out ivec3 lsb);"
"void imulExtended(ivec4, ivec4, out ivec4, out ivec4 lsb);"
" int bitfieldReverse( int);"
"ivec2 bitfieldReverse(ivec2);"
"ivec3 bitfieldReverse(ivec3);"
@ -1302,16 +1317,6 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
"ivec3 bitCount(uvec3);"
"ivec4 bitCount(uvec4);"
"lowp int findLSB( int);"
"lowp ivec2 findLSB(ivec2);"
"lowp ivec3 findLSB(ivec3);"
"lowp ivec4 findLSB(ivec4);"
"lowp int findLSB( uint);"
"lowp ivec2 findLSB(uvec2);"
"lowp ivec3 findLSB(uvec3);"
"lowp ivec4 findLSB(uvec4);"
" int findMSB( int);"
"ivec2 findMSB(ivec2);"
"ivec3 findMSB(ivec3);"
@ -1321,6 +1326,61 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan)
"ivec2 findMSB(uvec2);"
"ivec3 findMSB(uvec3);"
"ivec4 findMSB(uvec4);"
"\n");
}
if (profile == EEsProfile && version >= 310) {
commonBuiltins.append(
"highp uint uaddCarry(highp uint, highp uint, out lowp uint carry);"
"highp uvec2 uaddCarry(highp uvec2, highp uvec2, out lowp uvec2 carry);"
"highp uvec3 uaddCarry(highp uvec3, highp uvec3, out lowp uvec3 carry);"
"highp uvec4 uaddCarry(highp uvec4, highp uvec4, out lowp uvec4 carry);"
"highp uint usubBorrow(highp uint, highp uint, out lowp uint borrow);"
"highp uvec2 usubBorrow(highp uvec2, highp uvec2, out lowp uvec2 borrow);"
"highp uvec3 usubBorrow(highp uvec3, highp uvec3, out lowp uvec3 borrow);"
"highp uvec4 usubBorrow(highp uvec4, highp uvec4, out lowp uvec4 borrow);"
"void umulExtended(highp uint, highp uint, highp out uint, out highp uint lsb);"
"void umulExtended(highp uvec2, highp uvec2, highp out uvec2, out highp uvec2 lsb);"
"void umulExtended(highp uvec3, highp uvec3, highp out uvec3, out highp uvec3 lsb);"
"void umulExtended(highp uvec4, highp uvec4, highp out uvec4, out highp uvec4 lsb);"
"void imulExtended(highp int, highp int, highp out int, out highp int lsb);"
"void imulExtended(highp ivec2, highp ivec2, highp out ivec2, out highp ivec2 lsb);"
"void imulExtended(highp ivec3, highp ivec3, highp out ivec3, out highp ivec3 lsb);"
"void imulExtended(highp ivec4, highp ivec4, highp out ivec4, out highp ivec4 lsb);"
"highp int bitfieldReverse(highp int);"
"highp ivec2 bitfieldReverse(highp ivec2);"
"highp ivec3 bitfieldReverse(highp ivec3);"
"highp ivec4 bitfieldReverse(highp ivec4);"
"highp uint bitfieldReverse(highp uint);"
"highp uvec2 bitfieldReverse(highp uvec2);"
"highp uvec3 bitfieldReverse(highp uvec3);"
"highp uvec4 bitfieldReverse(highp uvec4);"
"lowp int bitCount( int);"
"lowp ivec2 bitCount(ivec2);"
"lowp ivec3 bitCount(ivec3);"
"lowp ivec4 bitCount(ivec4);"
"lowp int bitCount( uint);"
"lowp ivec2 bitCount(uvec2);"
"lowp ivec3 bitCount(uvec3);"
"lowp ivec4 bitCount(uvec4);"
"lowp int findMSB(highp int);"
"lowp ivec2 findMSB(highp ivec2);"
"lowp ivec3 findMSB(highp ivec3);"
"lowp ivec4 findMSB(highp ivec4);"
"lowp int findMSB(highp uint);"
"lowp ivec2 findMSB(highp uvec2);"
"lowp ivec3 findMSB(highp uvec3);"
"lowp ivec4 findMSB(highp uvec4);"
"\n");
}