Vulkan: Have desktop shaders respect precision qualifiers.

Sets highp defaults for the appropriate types, for all stages,
and turns on precision qualifiers for non-ES shaders.  Required
fixing some qualifier orders for desktop built-in declarations
for pre-420 shaders.
This commit is contained in:
John Kessenich
2016-08-03 16:41:53 -06:00
parent 4d535640e4
commit 54571c2519
11 changed files with 164 additions and 114 deletions

View File

@@ -63,6 +63,7 @@ Linked vertex stage:
Decorate 55(sampb2) Binding 5
Decorate 56(sampb4) DescriptorSet 0
Decorate 56(sampb4) Binding 31
MemberDecorate 59(S) 0 RelaxedPrecision
Decorate 62(var) Flat
Decorate 62(var) Location 0
MemberDecorate 63(MS) 0 Location 17

View File

@@ -64,6 +64,11 @@ Linked fragment stage:
Decorate 66(ub2) BufferBlock
Decorate 68(uName2) DescriptorSet 0
Decorate 97(samp2D) DescriptorSet 0
Decorate 101(coord) RelaxedPrecision
Decorate 102 RelaxedPrecision
Decorate 107 RelaxedPrecision
Decorate 108 RelaxedPrecision
Decorate 129 RelaxedPrecision
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1

View File

@@ -18,7 +18,9 @@ Linked vertex stage:
Name 8 "i"
Name 18 "flag"
Name 31 "r"
Decorate 18(flag) RelaxedPrecision
Decorate 18(flag) Location 0
Decorate 19 RelaxedPrecision
Decorate 31(r) Location 0
2: TypeVoid
3: TypeFunction 2

View File

@@ -25,6 +25,26 @@ Linked fragment stage:
Name 30 "gl_FragColor"
Name 36 "d"
Name 59 "bigColor"
Decorate 10(unreachableReturn() RelaxedPrecision
Decorate 16(foo(vf4;) RelaxedPrecision
Decorate 15(bar) RelaxedPrecision
Decorate 18(color) RelaxedPrecision
Decorate 20(BaseColor) RelaxedPrecision
Decorate 22 RelaxedPrecision
Decorate 23 RelaxedPrecision
Decorate 24 RelaxedPrecision
Decorate 27(f) RelaxedPrecision
Decorate 28 RelaxedPrecision
Decorate 30(gl_FragColor) RelaxedPrecision
Decorate 31 RelaxedPrecision
Decorate 32 RelaxedPrecision
Decorate 33 RelaxedPrecision
Decorate 36(d) RelaxedPrecision
Decorate 37 RelaxedPrecision
Decorate 52 RelaxedPrecision
Decorate 55 RelaxedPrecision
Decorate 56 RelaxedPrecision
Decorate 59(bigColor) RelaxedPrecision
2: TypeVoid
3: TypeFunction 2
8: TypeFloat 32

View File

@@ -91,13 +91,17 @@ Linked vertex stage:
Decorate 13 ArrayStride 32
MemberDecorate 14(S) 0 Offset 0
MemberDecorate 14(S) 1 ColMajor
MemberDecorate 14(S) 1 RelaxedPrecision
MemberDecorate 14(S) 1 Offset 16
MemberDecorate 14(S) 1 MatrixStride 16
MemberDecorate 14(S) 2 RelaxedPrecision
MemberDecorate 14(S) 2 Offset 144
Decorate 16 ArrayStride 160
Decorate 18 ArrayStride 480
MemberDecorate 19(Block140) 0 RelaxedPrecision
MemberDecorate 19(Block140) 0 Offset 0
MemberDecorate 19(Block140) 1 Offset 16
MemberDecorate 19(Block140) 2 RelaxedPrecision
MemberDecorate 19(Block140) 2 Offset 976
Decorate 19(Block140) Block
Decorate 21(inst140) DescriptorSet 0
@@ -105,17 +109,23 @@ Linked vertex stage:
Decorate 22 ArrayStride 16
MemberDecorate 23(S) 0 Offset 0
MemberDecorate 23(S) 1 ColMajor
MemberDecorate 23(S) 1 RelaxedPrecision
MemberDecorate 23(S) 1 Offset 16
MemberDecorate 23(S) 1 MatrixStride 8
MemberDecorate 23(S) 2 RelaxedPrecision
MemberDecorate 23(S) 2 Offset 80
Decorate 24 ArrayStride 96
Decorate 25 ArrayStride 288
MemberDecorate 26(Block430) 0 RelaxedPrecision
MemberDecorate 26(Block430) 0 Offset 0
MemberDecorate 26(Block430) 1 Offset 16
MemberDecorate 26(Block430) 2 RelaxedPrecision
MemberDecorate 26(Block430) 2 Offset 592
Decorate 26(Block430) BufferBlock
Decorate 28(inst430) DescriptorSet 0
Decorate 28(inst430) Binding 1
MemberDecorate 29(S) 1 RelaxedPrecision
MemberDecorate 29(S) 2 RelaxedPrecision
MemberDecorate 35(T) 0 RowMajor
MemberDecorate 35(T) 0 Offset 0
MemberDecorate 35(T) 0 MatrixStride 16
@@ -164,7 +174,9 @@ Linked vertex stage:
Decorate 60(bBtn3) Binding 0
Decorate 62(sout) Flat
MemberDecorate 63(S) 0 Invariant
MemberDecorate 63(S) 1 RelaxedPrecision
MemberDecorate 63(S) 1 Invariant
MemberDecorate 63(S) 2 RelaxedPrecision
MemberDecorate 63(S) 2 Invariant
Decorate 65(soutinv) Invariant
2: TypeVoid

View File

@@ -34,6 +34,8 @@ Linked fragment stage:
Name 44 "coord"
Name 49 "foo"
Decorate 40(samp2D) DescriptorSet 0
Decorate 44(coord) RelaxedPrecision
Decorate 45 RelaxedPrecision
2: TypeVoid
3: TypeFunction 2
6: TypeInt 32 1

View File

@@ -7,76 +7,76 @@ Shader version: 450
0:7 Function Parameters:
0:9 Sequence
0:9 Convert float to bool (temp bool)
0:9 'scf1' (specialization-constant const float)
0:9 'scf1' (specialization-constant const highp float)
0:9 1.000000
0:10 Construct bool (specialization-constant const bool)
0:10 'scbt' (specialization-constant const bool)
0:10 true (const bool)
0:11 Convert int to bool (specialization-constant const bool)
0:11 'sci2' (specialization-constant const int)
0:11 'sci2' (specialization-constant const highp int)
0:11 2 (const int)
0:13 Construct float (temp float)
0:13 'scf1' (specialization-constant const float)
0:13 'scf1' (specialization-constant const highp float)
0:13 1.000000
0:14 Convert bool to float (temp float)
0:14 'scbt' (specialization-constant const bool)
0:14 true (const bool)
0:15 Convert int to float (temp float)
0:15 'sci2' (specialization-constant const int)
0:15 'sci2' (specialization-constant const highp int)
0:15 2 (const int)
0:17 Convert float to int (temp int)
0:17 'scf1' (specialization-constant const float)
0:17 'scf1' (specialization-constant const highp float)
0:17 1.000000
0:18 Convert bool to int (specialization-constant const int)
0:18 'scbt' (specialization-constant const bool)
0:18 true (const bool)
0:19 Construct int (specialization-constant const int)
0:19 'sci2' (specialization-constant const int)
0:19 'sci2' (specialization-constant const highp int)
0:19 2 (const int)
0:21 component-wise multiply (temp float)
0:21 'scf1' (specialization-constant const float)
0:21 component-wise multiply (temp highp float)
0:21 'scf1' (specialization-constant const highp float)
0:21 1.000000
0:21 'scf1' (specialization-constant const float)
0:21 'scf1' (specialization-constant const highp float)
0:21 1.000000
0:22 logical-or (specialization-constant const bool)
0:22 'scbt' (specialization-constant const bool)
0:22 true (const bool)
0:22 'scbt' (specialization-constant const bool)
0:22 true (const bool)
0:23 component-wise multiply (specialization-constant const int)
0:23 'sci2' (specialization-constant const int)
0:23 component-wise multiply (specialization-constant const highp int)
0:23 'sci2' (specialization-constant const highp int)
0:23 2 (const int)
0:23 'sci2' (specialization-constant const int)
0:23 'sci2' (specialization-constant const highp int)
0:23 2 (const int)
0:24 add (temp float)
0:24 'scf1' (specialization-constant const float)
0:24 add (temp highp float)
0:24 'scf1' (specialization-constant const highp float)
0:24 1.000000
0:24 Convert int to float (temp float)
0:24 'sci2' (specialization-constant const int)
0:24 Convert int to float (temp highp float)
0:24 'sci2' (specialization-constant const highp int)
0:24 2 (const int)
0:26 Negate value (temp float)
0:26 'scf1' (specialization-constant const float)
0:26 Negate value (temp highp float)
0:26 'scf1' (specialization-constant const highp float)
0:26 1.000000
0:27 Negate conditional (specialization-constant const bool)
0:27 'scbt' (specialization-constant const bool)
0:27 true (const bool)
0:28 Negate value (specialization-constant const int)
0:28 'sci2' (specialization-constant const int)
0:28 Negate value (specialization-constant const highp int)
0:28 'sci2' (specialization-constant const highp int)
0:28 2 (const int)
0:30 Compare Greater Than (temp bool)
0:30 'scf1' (specialization-constant const float)
0:30 'scf1' (specialization-constant const highp float)
0:30 1.000000
0:30 'scf1' (specialization-constant const float)
0:30 'scf1' (specialization-constant const highp float)
0:30 1.000000
0:31 Compare Greater Than (specialization-constant const bool)
0:31 'sci2' (specialization-constant const int)
0:31 'sci2' (specialization-constant const highp int)
0:31 2 (const int)
0:31 'sci2' (specialization-constant const int)
0:31 'sci2' (specialization-constant const highp int)
0:31 2 (const int)
0:33 Compare Not Equal (temp bool)
0:33 'scf1' (specialization-constant const float)
0:33 'scf1' (specialization-constant const highp float)
0:33 1.000000
0:33 'scf1' (specialization-constant const float)
0:33 'scf1' (specialization-constant const highp float)
0:33 1.000000
0:34 Compare Not Equal (specialization-constant const bool)
0:34 'scbt' (specialization-constant const bool)
@@ -84,48 +84,48 @@ Shader version: 450
0:34 'scbt' (specialization-constant const bool)
0:34 true (const bool)
0:35 Compare Not Equal (specialization-constant const bool)
0:35 'sci2' (specialization-constant const int)
0:35 'sci2' (specialization-constant const highp int)
0:35 2 (const int)
0:35 'sci2' (specialization-constant const int)
0:35 'sci2' (specialization-constant const highp int)
0:35 2 (const int)
0:37 Construct ivec2 (specialization-constant const 2-component vector of int)
0:37 'sci2' (specialization-constant const int)
0:37 'sci2' (specialization-constant const highp int)
0:37 2 (const int)
0:37 'sci2' (specialization-constant const int)
0:37 'sci2' (specialization-constant const highp int)
0:37 2 (const int)
0:38 Construct ivec2 (temp 2-element array of 2-component vector of int)
0:38 Construct ivec2 (specialization-constant const 2-component vector of int)
0:38 'sci2' (specialization-constant const int)
0:38 'sci2' (specialization-constant const highp int)
0:38 2 (const int)
0:38 'sci2' (specialization-constant const int)
0:38 'sci2' (specialization-constant const highp int)
0:38 2 (const int)
0:38 Construct ivec2 (specialization-constant const 2-component vector of int)
0:38 'sci2' (specialization-constant const int)
0:38 'sci2' (specialization-constant const highp int)
0:38 2 (const int)
0:38 'sci2' (specialization-constant const int)
0:38 'sci2' (specialization-constant const highp int)
0:38 2 (const int)
0:40 Construct vec2 (temp 2-component vector of float)
0:40 'scf1' (specialization-constant const float)
0:40 'scf1' (specialization-constant const highp float)
0:40 1.000000
0:40 'scf1' (specialization-constant const float)
0:40 'scf1' (specialization-constant const highp float)
0:40 1.000000
0:41 Construct vec2 (temp 2-element array of 2-component vector of float)
0:41 Construct vec2 (temp 2-component vector of float)
0:41 'scf1' (specialization-constant const float)
0:41 'scf1' (specialization-constant const highp float)
0:41 1.000000
0:41 'scf1' (specialization-constant const float)
0:41 'scf1' (specialization-constant const highp float)
0:41 1.000000
0:41 Construct vec2 (temp 2-component vector of float)
0:41 'scf1' (specialization-constant const float)
0:41 'scf1' (specialization-constant const highp float)
0:41 1.000000
0:41 'scf1' (specialization-constant const float)
0:41 'scf1' (specialization-constant const highp float)
0:41 1.000000
0:? Linker Objects
0:? 'scf1' (specialization-constant const float)
0:? 'scf1' (specialization-constant const highp float)
0:? 1.000000
0:? 'scbt' (specialization-constant const bool)
0:? true (const bool)
0:? 'sci2' (specialization-constant const int)
0:? 'sci2' (specialization-constant const highp int)
0:? 2 (const int)
@@ -138,76 +138,76 @@ Shader version: 450
0:7 Function Parameters:
0:9 Sequence
0:9 Convert float to bool (temp bool)
0:9 'scf1' (specialization-constant const float)
0:9 'scf1' (specialization-constant const highp float)
0:9 1.000000
0:10 Construct bool (specialization-constant const bool)
0:10 'scbt' (specialization-constant const bool)
0:10 true (const bool)
0:11 Convert int to bool (specialization-constant const bool)
0:11 'sci2' (specialization-constant const int)
0:11 'sci2' (specialization-constant const highp int)
0:11 2 (const int)
0:13 Construct float (temp float)
0:13 'scf1' (specialization-constant const float)
0:13 'scf1' (specialization-constant const highp float)
0:13 1.000000
0:14 Convert bool to float (temp float)
0:14 'scbt' (specialization-constant const bool)
0:14 true (const bool)
0:15 Convert int to float (temp float)
0:15 'sci2' (specialization-constant const int)
0:15 'sci2' (specialization-constant const highp int)
0:15 2 (const int)
0:17 Convert float to int (temp int)
0:17 'scf1' (specialization-constant const float)
0:17 'scf1' (specialization-constant const highp float)
0:17 1.000000
0:18 Convert bool to int (specialization-constant const int)
0:18 'scbt' (specialization-constant const bool)
0:18 true (const bool)
0:19 Construct int (specialization-constant const int)
0:19 'sci2' (specialization-constant const int)
0:19 'sci2' (specialization-constant const highp int)
0:19 2 (const int)
0:21 component-wise multiply (temp float)
0:21 'scf1' (specialization-constant const float)
0:21 component-wise multiply (temp highp float)
0:21 'scf1' (specialization-constant const highp float)
0:21 1.000000
0:21 'scf1' (specialization-constant const float)
0:21 'scf1' (specialization-constant const highp float)
0:21 1.000000
0:22 logical-or (specialization-constant const bool)
0:22 'scbt' (specialization-constant const bool)
0:22 true (const bool)
0:22 'scbt' (specialization-constant const bool)
0:22 true (const bool)
0:23 component-wise multiply (specialization-constant const int)
0:23 'sci2' (specialization-constant const int)
0:23 component-wise multiply (specialization-constant const highp int)
0:23 'sci2' (specialization-constant const highp int)
0:23 2 (const int)
0:23 'sci2' (specialization-constant const int)
0:23 'sci2' (specialization-constant const highp int)
0:23 2 (const int)
0:24 add (temp float)
0:24 'scf1' (specialization-constant const float)
0:24 add (temp highp float)
0:24 'scf1' (specialization-constant const highp float)
0:24 1.000000
0:24 Convert int to float (temp float)
0:24 'sci2' (specialization-constant const int)
0:24 Convert int to float (temp highp float)
0:24 'sci2' (specialization-constant const highp int)
0:24 2 (const int)
0:26 Negate value (temp float)
0:26 'scf1' (specialization-constant const float)
0:26 Negate value (temp highp float)
0:26 'scf1' (specialization-constant const highp float)
0:26 1.000000
0:27 Negate conditional (specialization-constant const bool)
0:27 'scbt' (specialization-constant const bool)
0:27 true (const bool)
0:28 Negate value (specialization-constant const int)
0:28 'sci2' (specialization-constant const int)
0:28 Negate value (specialization-constant const highp int)
0:28 'sci2' (specialization-constant const highp int)
0:28 2 (const int)
0:30 Compare Greater Than (temp bool)
0:30 'scf1' (specialization-constant const float)
0:30 'scf1' (specialization-constant const highp float)
0:30 1.000000
0:30 'scf1' (specialization-constant const float)
0:30 'scf1' (specialization-constant const highp float)
0:30 1.000000
0:31 Compare Greater Than (specialization-constant const bool)
0:31 'sci2' (specialization-constant const int)
0:31 'sci2' (specialization-constant const highp int)
0:31 2 (const int)
0:31 'sci2' (specialization-constant const int)
0:31 'sci2' (specialization-constant const highp int)
0:31 2 (const int)
0:33 Compare Not Equal (temp bool)
0:33 'scf1' (specialization-constant const float)
0:33 'scf1' (specialization-constant const highp float)
0:33 1.000000
0:33 'scf1' (specialization-constant const float)
0:33 'scf1' (specialization-constant const highp float)
0:33 1.000000
0:34 Compare Not Equal (specialization-constant const bool)
0:34 'scbt' (specialization-constant const bool)
@@ -215,48 +215,48 @@ Shader version: 450
0:34 'scbt' (specialization-constant const bool)
0:34 true (const bool)
0:35 Compare Not Equal (specialization-constant const bool)
0:35 'sci2' (specialization-constant const int)
0:35 'sci2' (specialization-constant const highp int)
0:35 2 (const int)
0:35 'sci2' (specialization-constant const int)
0:35 'sci2' (specialization-constant const highp int)
0:35 2 (const int)
0:37 Construct ivec2 (specialization-constant const 2-component vector of int)
0:37 'sci2' (specialization-constant const int)
0:37 'sci2' (specialization-constant const highp int)
0:37 2 (const int)
0:37 'sci2' (specialization-constant const int)
0:37 'sci2' (specialization-constant const highp int)
0:37 2 (const int)
0:38 Construct ivec2 (temp 2-element array of 2-component vector of int)
0:38 Construct ivec2 (specialization-constant const 2-component vector of int)
0:38 'sci2' (specialization-constant const int)
0:38 'sci2' (specialization-constant const highp int)
0:38 2 (const int)
0:38 'sci2' (specialization-constant const int)
0:38 'sci2' (specialization-constant const highp int)
0:38 2 (const int)
0:38 Construct ivec2 (specialization-constant const 2-component vector of int)
0:38 'sci2' (specialization-constant const int)
0:38 'sci2' (specialization-constant const highp int)
0:38 2 (const int)
0:38 'sci2' (specialization-constant const int)
0:38 'sci2' (specialization-constant const highp int)
0:38 2 (const int)
0:40 Construct vec2 (temp 2-component vector of float)
0:40 'scf1' (specialization-constant const float)
0:40 'scf1' (specialization-constant const highp float)
0:40 1.000000
0:40 'scf1' (specialization-constant const float)
0:40 'scf1' (specialization-constant const highp float)
0:40 1.000000
0:41 Construct vec2 (temp 2-element array of 2-component vector of float)
0:41 Construct vec2 (temp 2-component vector of float)
0:41 'scf1' (specialization-constant const float)
0:41 'scf1' (specialization-constant const highp float)
0:41 1.000000
0:41 'scf1' (specialization-constant const float)
0:41 'scf1' (specialization-constant const highp float)
0:41 1.000000
0:41 Construct vec2 (temp 2-component vector of float)
0:41 'scf1' (specialization-constant const float)
0:41 'scf1' (specialization-constant const highp float)
0:41 1.000000
0:41 'scf1' (specialization-constant const float)
0:41 'scf1' (specialization-constant const highp float)
0:41 1.000000
0:? Linker Objects
0:? 'scf1' (specialization-constant const float)
0:? 'scf1' (specialization-constant const highp float)
0:? 1.000000
0:? 'scbt' (specialization-constant const bool)
0:? true (const bool)
0:? 'sci2' (specialization-constant const int)
0:? 'sci2' (specialization-constant const highp int)
0:? 2 (const int)
// Module Version 10000

View File

@@ -14,7 +14,7 @@ ERROR: 0:25: 'sampler2DShadow' : sampler-constructor second argument presence of
ERROR: 0:28: 'sampler2D' : sampler/image types can only be used in uniform variables or function parameters: s2D
ERROR: 0:29: 'sampler3D' : sampler-constructor cannot make an array of samplers
ERROR: 0:29: 'sampler3D' : sampler/image types can only be used in uniform variables or function parameters: s3d
ERROR: 0:29: '=' : cannot convert from 'const float' to 'global 4-element array of sampler3D'
ERROR: 0:29: '=' : cannot convert from 'const float' to 'global 4-element array of highp sampler3D'
ERROR: 0:39: 'push_constant' : can only be used with a uniform
ERROR: 0:43: 'non-opaque uniforms outside a block' : not allowed when using GLSL for Vulkan
ERROR: 0:43: 'push_constant' : can only be used with a block

View File

@@ -15,7 +15,7 @@ ERROR: 0:15: 'constant_id' : can only be applied to a scalar
ERROR: 0:16: 'constant_id' : specialization-constant id already used
ERROR: 0:16: 'constant_id' : cannot declare a default, can only be used on a scalar
ERROR: 0:20: 'subpassLoad' : no matching overloaded function found
ERROR: 0:20: 'assign' : cannot convert from 'const float' to 'smooth out 4-component vector of float'
ERROR: 0:20: 'assign' : cannot convert from 'const float' to 'smooth out highp 4-component vector of float'
ERROR: 0:23: 'atomic counter types' : not allowed when using GLSL for Vulkan
ERROR: 0:24: 'shared' : not allowed when generating SPIR-V
ERROR: 0:25: 'packed' : not allowed when generating SPIR-V