diff --git a/Test/baseResults/300BuiltIns.frag.out b/Test/baseResults/300BuiltIns.frag.out index 2bb4cf5eb..edcae462b 100644 --- a/Test/baseResults/300BuiltIns.frag.out +++ b/Test/baseResults/300BuiltIns.frag.out @@ -136,24 +136,24 @@ ERROR: node is still EOpNull! 0:53 isinf (global 4-component vector of bool) 0:53 'v4' (global mediump 4-component vector of float) 0:56 Sequence -0:56 move second child to first child (temp mediump int) +0:56 move second child to first child (temp highp int) 0:56 'i' (temp mediump int) -0:56 floatBitsToInt (global mediump int) +0:56 floatBitsToInt (global highp int) 0:56 'f' (global mediump float) 0:57 Sequence -0:57 move second child to first child (temp mediump 4-component vector of uint) +0:57 move second child to first child (temp highp 4-component vector of uint) 0:57 'uv11' (temp mediump 4-component vector of uint) -0:57 floatBitsToUint (global mediump 4-component vector of uint) +0:57 floatBitsToUint (global highp 4-component vector of uint) 0:57 'v4' (global mediump 4-component vector of float) 0:58 Sequence -0:58 move second child to first child (temp mediump 4-component vector of float) +0:58 move second child to first child (temp highp 4-component vector of float) 0:58 'v14' (temp mediump 4-component vector of float) -0:58 intBitsToFloat (global mediump 4-component vector of float) +0:58 intBitsToFloat (global highp 4-component vector of float) 0:58 'iv4a' (global mediump 4-component vector of int) 0:59 Sequence -0:59 move second child to first child (temp mediump 2-component vector of float) +0:59 move second child to first child (temp highp 2-component vector of float) 0:59 'v15' (temp mediump 2-component vector of float) -0:59 uintBitsToFloat (global mediump 2-component vector of float) +0:59 uintBitsToFloat (global highp 2-component vector of float) 0:59 'uv2c' (global mediump 2-component vector of uint) 0:62 Sequence 0:62 move second child to first child (temp highp uint) @@ -343,24 +343,24 @@ ERROR: node is still EOpNull! 0:53 isinf (global 4-component vector of bool) 0:53 'v4' (global mediump 4-component vector of float) 0:56 Sequence -0:56 move second child to first child (temp mediump int) +0:56 move second child to first child (temp highp int) 0:56 'i' (temp mediump int) -0:56 floatBitsToInt (global mediump int) +0:56 floatBitsToInt (global highp int) 0:56 'f' (global mediump float) 0:57 Sequence -0:57 move second child to first child (temp mediump 4-component vector of uint) +0:57 move second child to first child (temp highp 4-component vector of uint) 0:57 'uv11' (temp mediump 4-component vector of uint) -0:57 floatBitsToUint (global mediump 4-component vector of uint) +0:57 floatBitsToUint (global highp 4-component vector of uint) 0:57 'v4' (global mediump 4-component vector of float) 0:58 Sequence -0:58 move second child to first child (temp mediump 4-component vector of float) +0:58 move second child to first child (temp highp 4-component vector of float) 0:58 'v14' (temp mediump 4-component vector of float) -0:58 intBitsToFloat (global mediump 4-component vector of float) +0:58 intBitsToFloat (global highp 4-component vector of float) 0:58 'iv4a' (global mediump 4-component vector of int) 0:59 Sequence -0:59 move second child to first child (temp mediump 2-component vector of float) +0:59 move second child to first child (temp highp 2-component vector of float) 0:59 'v15' (temp mediump 2-component vector of float) -0:59 uintBitsToFloat (global mediump 2-component vector of float) +0:59 uintBitsToFloat (global highp 2-component vector of float) 0:59 'uv2c' (global mediump 2-component vector of uint) 0:62 Sequence 0:62 move second child to first child (temp highp uint) diff --git a/Test/baseResults/spv.310.bitcast.frag.out b/Test/baseResults/spv.310.bitcast.frag.out new file mode 100755 index 000000000..80df3b1a7 --- /dev/null +++ b/Test/baseResults/spv.310.bitcast.frag.out @@ -0,0 +1,234 @@ +spv.310.bitcast.frag +Warning, version 310 is not yet complete; most version-specific features are present, but some are missing. + + +Linked fragment stage: + + +// Module Version 10000 +// Generated by (magic number): 80001 +// Id's are bound by 153 + + Capability Shader + 1: ExtInstImport "GLSL.std.450" + MemoryModel Logical GLSL450 + EntryPoint Fragment 4 "main" 14 26 37 48 89 98 107 116 122 130 139 148 + ExecutionMode 4 OriginUpperLeft + Source ESSL 310 + Name 4 "main" + Name 9 "idata" + Name 14 "f1" + Name 26 "f2" + Name 37 "f3" + Name 48 "f4" + Name 55 "udata" + Name 85 "fdata" + Name 89 "i1" + Name 98 "i2" + Name 107 "i3" + Name 116 "i4" + Name 122 "u1" + Name 130 "u2" + Name 139 "u3" + Name 148 "u4" + Decorate 14(f1) RelaxedPrecision + Decorate 15 RelaxedPrecision + Decorate 26(f2) RelaxedPrecision + Decorate 27 RelaxedPrecision + Decorate 37(f3) RelaxedPrecision + Decorate 38 RelaxedPrecision + Decorate 57 RelaxedPrecision + Decorate 64 RelaxedPrecision + Decorate 72 RelaxedPrecision + Decorate 89(i1) RelaxedPrecision + Decorate 89(i1) Flat + Decorate 90 RelaxedPrecision + Decorate 98(i2) RelaxedPrecision + Decorate 98(i2) Flat + Decorate 99 RelaxedPrecision + Decorate 107(i3) RelaxedPrecision + Decorate 107(i3) Flat + Decorate 108 RelaxedPrecision + Decorate 116(i4) Flat + Decorate 122(u1) RelaxedPrecision + Decorate 122(u1) Flat + Decorate 123 RelaxedPrecision + Decorate 130(u2) RelaxedPrecision + Decorate 130(u2) Flat + Decorate 131 RelaxedPrecision + Decorate 139(u3) RelaxedPrecision + Decorate 139(u3) Flat + Decorate 140 RelaxedPrecision + Decorate 148(u4) Flat + 2: TypeVoid + 3: TypeFunction 2 + 6: TypeInt 32 1 + 7: TypeVector 6(int) 4 + 8: TypePointer Function 7(ivec4) + 10: 6(int) Constant 0 + 11: 7(ivec4) ConstantComposite 10 10 10 10 + 12: TypeFloat 32 + 13: TypePointer Input 12(float) + 14(f1): 13(ptr) Variable Input + 17: TypeInt 32 0 + 18: 17(int) Constant 0 + 19: TypePointer Function 6(int) + 24: TypeVector 12(float) 2 + 25: TypePointer Input 24(fvec2) + 26(f2): 25(ptr) Variable Input + 28: TypeVector 6(int) 2 + 35: TypeVector 12(float) 3 + 36: TypePointer Input 35(fvec3) + 37(f3): 36(ptr) Variable Input + 39: TypeVector 6(int) 3 + 46: TypeVector 12(float) 4 + 47: TypePointer Input 46(fvec4) + 48(f4): 47(ptr) Variable Input + 53: TypeVector 17(int) 4 + 54: TypePointer Function 53(ivec4) + 56: 53(ivec4) ConstantComposite 18 18 18 18 + 59: TypePointer Function 17(int) + 65: TypeVector 17(int) 2 + 73: TypeVector 17(int) 3 + 84: TypePointer Function 46(fvec4) + 86: 12(float) Constant 0 + 87: 46(fvec4) ConstantComposite 86 86 86 86 + 88: TypePointer Input 6(int) + 89(i1): 88(ptr) Variable Input + 92: TypePointer Function 12(float) + 97: TypePointer Input 28(ivec2) + 98(i2): 97(ptr) Variable Input + 106: TypePointer Input 39(ivec3) + 107(i3): 106(ptr) Variable Input + 115: TypePointer Input 7(ivec4) + 116(i4): 115(ptr) Variable Input + 121: TypePointer Input 17(int) + 122(u1): 121(ptr) Variable Input + 129: TypePointer Input 65(ivec2) + 130(u2): 129(ptr) Variable Input + 138: TypePointer Input 73(ivec3) + 139(u3): 138(ptr) Variable Input + 147: TypePointer Input 53(ivec4) + 148(u4): 147(ptr) Variable Input + 4(main): 2 Function None 3 + 5: Label + 9(idata): 8(ptr) Variable Function + 55(udata): 54(ptr) Variable Function + 85(fdata): 84(ptr) Variable Function + Store 9(idata) 11 + 15: 12(float) Load 14(f1) + 16: 6(int) Bitcast 15 + 20: 19(ptr) AccessChain 9(idata) 18 + 21: 6(int) Load 20 + 22: 6(int) IAdd 21 16 + 23: 19(ptr) AccessChain 9(idata) 18 + Store 23 22 + 27: 24(fvec2) Load 26(f2) + 29: 28(ivec2) Bitcast 27 + 30: 7(ivec4) Load 9(idata) + 31: 28(ivec2) VectorShuffle 30 30 0 1 + 32: 28(ivec2) IAdd 31 29 + 33: 7(ivec4) Load 9(idata) + 34: 7(ivec4) VectorShuffle 33 32 4 5 2 3 + Store 9(idata) 34 + 38: 35(fvec3) Load 37(f3) + 40: 39(ivec3) Bitcast 38 + 41: 7(ivec4) Load 9(idata) + 42: 39(ivec3) VectorShuffle 41 41 0 1 2 + 43: 39(ivec3) IAdd 42 40 + 44: 7(ivec4) Load 9(idata) + 45: 7(ivec4) VectorShuffle 44 43 4 5 6 3 + Store 9(idata) 45 + 49: 46(fvec4) Load 48(f4) + 50: 7(ivec4) Bitcast 49 + 51: 7(ivec4) Load 9(idata) + 52: 7(ivec4) IAdd 51 50 + Store 9(idata) 52 + Store 55(udata) 56 + 57: 12(float) Load 14(f1) + 58: 17(int) Bitcast 57 + 60: 59(ptr) AccessChain 55(udata) 18 + 61: 17(int) Load 60 + 62: 17(int) IAdd 61 58 + 63: 59(ptr) AccessChain 55(udata) 18 + Store 63 62 + 64: 24(fvec2) Load 26(f2) + 66: 65(ivec2) Bitcast 64 + 67: 53(ivec4) Load 55(udata) + 68: 65(ivec2) VectorShuffle 67 67 0 1 + 69: 65(ivec2) IAdd 68 66 + 70: 53(ivec4) Load 55(udata) + 71: 53(ivec4) VectorShuffle 70 69 4 5 2 3 + Store 55(udata) 71 + 72: 35(fvec3) Load 37(f3) + 74: 73(ivec3) Bitcast 72 + 75: 53(ivec4) Load 55(udata) + 76: 73(ivec3) VectorShuffle 75 75 0 1 2 + 77: 73(ivec3) IAdd 76 74 + 78: 53(ivec4) Load 55(udata) + 79: 53(ivec4) VectorShuffle 78 77 4 5 6 3 + Store 55(udata) 79 + 80: 46(fvec4) Load 48(f4) + 81: 53(ivec4) Bitcast 80 + 82: 53(ivec4) Load 55(udata) + 83: 53(ivec4) IAdd 82 81 + Store 55(udata) 83 + Store 85(fdata) 87 + 90: 6(int) Load 89(i1) + 91: 12(float) Bitcast 90 + 93: 92(ptr) AccessChain 85(fdata) 18 + 94: 12(float) Load 93 + 95: 12(float) FAdd 94 91 + 96: 92(ptr) AccessChain 85(fdata) 18 + Store 96 95 + 99: 28(ivec2) Load 98(i2) + 100: 24(fvec2) Bitcast 99 + 101: 46(fvec4) Load 85(fdata) + 102: 24(fvec2) VectorShuffle 101 101 0 1 + 103: 24(fvec2) FAdd 102 100 + 104: 46(fvec4) Load 85(fdata) + 105: 46(fvec4) VectorShuffle 104 103 4 5 2 3 + Store 85(fdata) 105 + 108: 39(ivec3) Load 107(i3) + 109: 35(fvec3) Bitcast 108 + 110: 46(fvec4) Load 85(fdata) + 111: 35(fvec3) VectorShuffle 110 110 0 1 2 + 112: 35(fvec3) FAdd 111 109 + 113: 46(fvec4) Load 85(fdata) + 114: 46(fvec4) VectorShuffle 113 112 4 5 6 3 + Store 85(fdata) 114 + 117: 7(ivec4) Load 116(i4) + 118: 46(fvec4) Bitcast 117 + 119: 46(fvec4) Load 85(fdata) + 120: 46(fvec4) FAdd 119 118 + Store 85(fdata) 120 + 123: 17(int) Load 122(u1) + 124: 12(float) Bitcast 123 + 125: 92(ptr) AccessChain 85(fdata) 18 + 126: 12(float) Load 125 + 127: 12(float) FAdd 126 124 + 128: 92(ptr) AccessChain 85(fdata) 18 + Store 128 127 + 131: 65(ivec2) Load 130(u2) + 132: 24(fvec2) Bitcast 131 + 133: 46(fvec4) Load 85(fdata) + 134: 24(fvec2) VectorShuffle 133 133 0 1 + 135: 24(fvec2) FAdd 134 132 + 136: 46(fvec4) Load 85(fdata) + 137: 46(fvec4) VectorShuffle 136 135 4 5 2 3 + Store 85(fdata) 137 + 140: 73(ivec3) Load 139(u3) + 141: 35(fvec3) Bitcast 140 + 142: 46(fvec4) Load 85(fdata) + 143: 35(fvec3) VectorShuffle 142 142 0 1 2 + 144: 35(fvec3) FAdd 143 141 + 145: 46(fvec4) Load 85(fdata) + 146: 46(fvec4) VectorShuffle 145 144 4 5 6 3 + Store 85(fdata) 146 + 149: 53(ivec4) Load 148(u4) + 150: 46(fvec4) Bitcast 149 + 151: 46(fvec4) Load 85(fdata) + 152: 46(fvec4) FAdd 151 150 + Store 85(fdata) 152 + Return + FunctionEnd diff --git a/Test/spv.310.bitcast.frag b/Test/spv.310.bitcast.frag new file mode 100644 index 000000000..dbde52f87 --- /dev/null +++ b/Test/spv.310.bitcast.frag @@ -0,0 +1,41 @@ +#version 310 es + +flat in mediump int i1; +flat in lowp ivec2 i2; +flat in mediump ivec3 i3; +flat in highp ivec4 i4; + +flat in mediump uint u1; +flat in lowp uvec2 u2; +flat in mediump uvec3 u3; +flat in highp uvec4 u4; + +mediump in float f1; +lowp in vec2 f2; +mediump in vec3 f3; +highp in vec4 f4; + +void main() +{ + highp ivec4 idata = ivec4(0); + idata.x += floatBitsToInt(f1); + idata.xy += floatBitsToInt(f2); + idata.xyz += floatBitsToInt(f3); + idata += floatBitsToInt(f4); + + highp uvec4 udata = uvec4(0); + udata.x += floatBitsToUint(f1); + udata.xy += floatBitsToUint(f2); + udata.xyz += floatBitsToUint(f3); + udata += floatBitsToUint(f4); + + highp vec4 fdata = vec4(0.0); + fdata.x += intBitsToFloat(i1); + fdata.xy += intBitsToFloat(i2); + fdata.xyz += intBitsToFloat(i3); + fdata += intBitsToFloat(i4); + fdata.x += uintBitsToFloat(u1); + fdata.xy += uintBitsToFloat(u2); + fdata.xyz += uintBitsToFloat(u3); + fdata += uintBitsToFloat(u4); +} \ No newline at end of file diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index 6a9fb2019..f53620227 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -859,26 +859,26 @@ void TBuiltIns::initialize(int version, EProfile profile, int spv, int vulkan) if ((profile == EEsProfile && version >= 300) || (profile != EEsProfile && version >= 330)) { commonBuiltins.append( - "int floatBitsToInt(float value);" - "ivec2 floatBitsToInt(vec2 value);" - "ivec3 floatBitsToInt(vec3 value);" - "ivec4 floatBitsToInt(vec4 value);" + "highp int floatBitsToInt(highp float value);" + "highp ivec2 floatBitsToInt(highp vec2 value);" + "highp ivec3 floatBitsToInt(highp vec3 value);" + "highp ivec4 floatBitsToInt(highp vec4 value);" - "uint floatBitsToUint(float value);" - "uvec2 floatBitsToUint(vec2 value);" - "uvec3 floatBitsToUint(vec3 value);" - "uvec4 floatBitsToUint(vec4 value);" - - "float intBitsToFloat(int value);" - "vec2 intBitsToFloat(ivec2 value);" - "vec3 intBitsToFloat(ivec3 value);" - "vec4 intBitsToFloat(ivec4 value);" - - "float uintBitsToFloat(uint value);" - "vec2 uintBitsToFloat(uvec2 value);" - "vec3 uintBitsToFloat(uvec3 value);" - "vec4 uintBitsToFloat(uvec4 value);" - + "highp uint floatBitsToUint(highp float value);" + "highp uvec2 floatBitsToUint(highp vec2 value);" + "highp uvec3 floatBitsToUint(highp vec3 value);" + "highp uvec4 floatBitsToUint(highp vec4 value);" + + "highp float intBitsToFloat(highp int value);" + "highp vec2 intBitsToFloat(highp ivec2 value);" + "highp vec3 intBitsToFloat(highp ivec3 value);" + "highp vec4 intBitsToFloat(highp ivec4 value);" + + "highp float uintBitsToFloat(highp uint value);" + "highp vec2 uintBitsToFloat(highp uvec2 value);" + "highp vec3 uintBitsToFloat(highp uvec3 value);" + "highp vec4 uintBitsToFloat(highp uvec4 value);" + "\n"); } diff --git a/gtests/Spv.FromFile.cpp b/gtests/Spv.FromFile.cpp index 054e293a6..fd9a38b55 100644 --- a/gtests/Spv.FromFile.cpp +++ b/gtests/Spv.FromFile.cpp @@ -100,6 +100,7 @@ INSTANTIATE_TEST_CASE_P( "spv.300layout.vert", "spv.300layoutp.vert", "spv.310.comp", + "spv.310.bitcast.frag", "spv.330.geom", "spv.400.frag", "spv.400.tesc",