SPV: RelaxedPrecision: Plumb this through the full AST->SPV translator.

This commit is contained in:
John Kessenich
2016-02-02 12:37:46 -07:00
parent 26bd6a313d
commit 32cfd49b68
11 changed files with 411 additions and 109 deletions

View File

@@ -23,12 +23,28 @@ Linked fragment stage:
Name 21 "low"
Name 26 "high"
Name 36 "Color"
Decorate 8(foo() RelaxedPrecision
Decorate 11(face1) RelaxedPrecision
Decorate 13(face2) RelaxedPrecision
Decorate 17(z) RelaxedPrecision
Decorate 21(low) RelaxedPrecision
Decorate 22 RelaxedPrecision
Decorate 23 RelaxedPrecision
Decorate 25 RelaxedPrecision
Decorate 26(high) RelaxedPrecision
Decorate 27 RelaxedPrecision
Decorate 32 RelaxedPrecision
Decorate 33 RelaxedPrecision
Decorate 36(Color) RelaxedPrecision
Decorate 37 RelaxedPrecision
Decorate 38 RelaxedPrecision
Decorate 39 RelaxedPrecision
Decorate 40 RelaxedPrecision
Decorate 41 RelaxedPrecision
Decorate 42 RelaxedPrecision
Decorate 43 RelaxedPrecision
Decorate 44 RelaxedPrecision
Decorate 45 RelaxedPrecision
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32

View File

@@ -32,6 +32,10 @@ Linked vertex stage:
MemberDecorate 22(gl_PerVertex) 1 BuiltIn PointSize
Decorate 22(gl_PerVertex) Block
Decorate 27(ps) RelaxedPrecision
Decorate 28 RelaxedPrecision
Decorate 32 RelaxedPrecision
Decorate 39 RelaxedPrecision
Decorate 42 RelaxedPrecision
Decorate 48(gl_InstanceID) BuiltIn InstanceId
2: TypeVoid
3: TypeFunction 2

View File

@@ -27,11 +27,17 @@ Linked fragment stage:
Decorate 9(c) RelaxedPrecision
Decorate 9(c) Location 7
Decorate 11(color) RelaxedPrecision
Decorate 12 RelaxedPrecision
MemberDecorate 13(S) 0 RelaxedPrecision
MemberDecorate 13(S) 1 RelaxedPrecision
Decorate 19 RelaxedPrecision
Decorate 20 RelaxedPrecision
Decorate 26(p) RelaxedPrecision
Decorate 26(p) Location 3
Decorate 29(pos) RelaxedPrecision
Decorate 30 RelaxedPrecision
Decorate 33 RelaxedPrecision
Decorate 34 RelaxedPrecision
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32

View File

@@ -46,6 +46,8 @@ Linked vertex stage:
Name 247 "v4"
Name 268 "gl_VertexID"
Name 269 "gl_InstanceID"
Decorate 261 RelaxedPrecision
Decorate 265 RelaxedPrecision
Decorate 268(gl_VertexID) BuiltIn VertexId
Decorate 269(gl_InstanceID) BuiltIn InstanceId
2: TypeVoid

View File

@@ -7,12 +7,12 @@ Linked fragment stage:
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 114
// Id's are bound by 127
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 23 59 61 73
EntryPoint Fragment 4 "main" 23 59 61 73 116
ExecutionMode 4 OriginLowerLeft
Source ESSL 310
Name 4 "main"
@@ -35,15 +35,58 @@ Linked fragment stage:
Name 73 "mediumfout"
Name 104 "ub2"
Name 105 "param"
Name 114 "S"
MemberName 114(S) 0 "a"
MemberName 114(S) 1 "b"
Name 116 "s"
Decorate 12(foo(vf3;) RelaxedPrecision
Decorate 11(mv3) RelaxedPrecision
Decorate 38(sum) RelaxedPrecision
Decorate 40(uniform_medium) RelaxedPrecision
Decorate 41 RelaxedPrecision
Decorate 46 RelaxedPrecision
Decorate 48(uniform_low) RelaxedPrecision
Decorate 49 RelaxedPrecision
Decorate 50 RelaxedPrecision
Decorate 51 RelaxedPrecision
Decorate 53(arg1) RelaxedPrecision
Decorate 55(arg2) RelaxedPrecision
Decorate 57(d) RelaxedPrecision
Decorate 59(lowfin) RelaxedPrecision
Decorate 60 RelaxedPrecision
Decorate 61(mediumfin) RelaxedPrecision
Decorate 62 RelaxedPrecision
Decorate 63 RelaxedPrecision
Decorate 73(mediumfout) RelaxedPrecision
Decorate 74 RelaxedPrecision
Decorate 75 RelaxedPrecision
Decorate 76 RelaxedPrecision
Decorate 77 RelaxedPrecision
Decorate 78 RelaxedPrecision
Decorate 79 RelaxedPrecision
Decorate 83 RelaxedPrecision
Decorate 85 RelaxedPrecision
Decorate 87 RelaxedPrecision
Decorate 88 RelaxedPrecision
Decorate 90 RelaxedPrecision
Decorate 91 RelaxedPrecision
Decorate 94 RelaxedPrecision
Decorate 95 RelaxedPrecision
Decorate 96 RelaxedPrecision
Decorate 97 RelaxedPrecision
Decorate 98 RelaxedPrecision
Decorate 99 RelaxedPrecision
Decorate 100 RelaxedPrecision
Decorate 101 RelaxedPrecision
Decorate 102 RelaxedPrecision
Decorate 110 RelaxedPrecision
Decorate 112 RelaxedPrecision
Decorate 113 RelaxedPrecision
MemberDecorate 114(S) 1 RelaxedPrecision
Decorate 120 RelaxedPrecision
Decorate 124 RelaxedPrecision
Decorate 125 RelaxedPrecision
Decorate 126 RelaxedPrecision
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@@ -85,6 +128,11 @@ Linked fragment stage:
103: TypePointer UniformConstant 15(bvec2)
104(ub2): 103(ptr) Variable UniformConstant
111: 6(float) Constant 1065353216
114(S): TypeStruct 6(float) 6(float)
115: TypePointer Input 114(S)
116(s): 115(ptr) Variable Input
117: 36(int) Constant 0
122: 36(int) Constant 1
4(main): 2 Function None 3
5: Label
38(sum): 37(ptr) Variable Function
@@ -157,6 +205,16 @@ Linked fragment stage:
Store 73(mediumfout) 113
Branch 109
109: Label
118: 58(ptr) AccessChain 116(s) 117
119: 6(float) Load 118
120: 21(fvec4) Load 73(mediumfout)
121: 21(fvec4) VectorTimesScalar 120 119
Store 73(mediumfout) 121
123: 58(ptr) AccessChain 116(s) 122
124: 6(float) Load 123
125: 21(fvec4) Load 73(mediumfout)
126: 21(fvec4) VectorTimesScalar 125 124
Store 73(mediumfout) 126
Return
FunctionEnd
12(foo(vf3;): 9(fvec2) Function None 10

View File

@@ -42,15 +42,137 @@ Linked fragment stage:
Name 246 "param"
Name 248 "param"
Name 250 "param"
Decorate 15(foo1(vf4;vf4;i1;) RelaxedPrecision
Decorate 12(v1) RelaxedPrecision
Decorate 13(v2) RelaxedPrecision
Decorate 14(i1) RelaxedPrecision
Decorate 20(foo2(vf4;vf4;i1;) RelaxedPrecision
Decorate 17(v1) RelaxedPrecision
Decorate 18(v2) RelaxedPrecision
Decorate 19(i1) RelaxedPrecision
Decorate 22 RelaxedPrecision
Decorate 27 RelaxedPrecision
Decorate 29 RelaxedPrecision
Decorate 31 RelaxedPrecision
Decorate 32 RelaxedPrecision
Decorate 33 RelaxedPrecision
Decorate 40 RelaxedPrecision
Decorate 46 RelaxedPrecision
Decorate 51 RelaxedPrecision
Decorate 53 RelaxedPrecision
Decorate 54 RelaxedPrecision
Decorate 55 RelaxedPrecision
Decorate 60(local) RelaxedPrecision
Decorate 62(c) RelaxedPrecision
Decorate 63 RelaxedPrecision
Decorate 64 RelaxedPrecision
Decorate 66 RelaxedPrecision
Decorate 67 RelaxedPrecision
Decorate 73(f) RelaxedPrecision
Decorate 75(x) RelaxedPrecision
Decorate 76 RelaxedPrecision
Decorate 77 RelaxedPrecision
Decorate 79 RelaxedPrecision
Decorate 80 RelaxedPrecision
Decorate 82 RelaxedPrecision
Decorate 83 RelaxedPrecision
Decorate 85 RelaxedPrecision
Decorate 90 RelaxedPrecision
Decorate 91 RelaxedPrecision
Decorate 92 RelaxedPrecision
Decorate 93 RelaxedPrecision
Decorate 94 RelaxedPrecision
Decorate 95 RelaxedPrecision
Decorate 96 RelaxedPrecision
Decorate 97 RelaxedPrecision
Decorate 99 RelaxedPrecision
Decorate 100 RelaxedPrecision
Decorate 101 RelaxedPrecision
Decorate 102 RelaxedPrecision
Decorate 104 RelaxedPrecision
Decorate 108 RelaxedPrecision
Decorate 109 RelaxedPrecision
Decorate 110 RelaxedPrecision
Decorate 111 RelaxedPrecision
Decorate 113 RelaxedPrecision
Decorate 114 RelaxedPrecision
Decorate 115 RelaxedPrecision
Decorate 116 RelaxedPrecision
Decorate 119 RelaxedPrecision
Decorate 124 RelaxedPrecision
Decorate 125 RelaxedPrecision
Decorate 126 RelaxedPrecision
Decorate 127 RelaxedPrecision
Decorate 129(d) RelaxedPrecision
Decorate 130 RelaxedPrecision
Decorate 134 RelaxedPrecision
Decorate 135 RelaxedPrecision
Decorate 136 RelaxedPrecision
Decorate 137 RelaxedPrecision
Decorate 138 RelaxedPrecision
Decorate 139 RelaxedPrecision
Decorate 140 RelaxedPrecision
Decorate 142 RelaxedPrecision
Decorate 143 RelaxedPrecision
Decorate 144 RelaxedPrecision
Decorate 145 RelaxedPrecision
Decorate 146 RelaxedPrecision
Decorate 150 RelaxedPrecision
Decorate 151 RelaxedPrecision
Decorate 152 RelaxedPrecision
Decorate 153 RelaxedPrecision
Decorate 155(i) RelaxedPrecision
Decorate 162 RelaxedPrecision
Decorate 166 RelaxedPrecision
Decorate 171 RelaxedPrecision
Decorate 172 RelaxedPrecision
Decorate 173 RelaxedPrecision
Decorate 174 RelaxedPrecision
Decorate 175(j) RelaxedPrecision
Decorate 182 RelaxedPrecision
Decorate 185 RelaxedPrecision
Decorate 186 RelaxedPrecision
Decorate 187 RelaxedPrecision
Decorate 193 RelaxedPrecision
Decorate 194 RelaxedPrecision
Decorate 196 RelaxedPrecision
Decorate 197 RelaxedPrecision
Decorate 198 RelaxedPrecision
Decorate 199 RelaxedPrecision
Decorate 202 RelaxedPrecision
Decorate 203 RelaxedPrecision
Decorate 204 RelaxedPrecision
Decorate 205 RelaxedPrecision
Decorate 207 RelaxedPrecision
Decorate 213 RelaxedPrecision
Decorate 214 RelaxedPrecision
Decorate 215 RelaxedPrecision
Decorate 219 RelaxedPrecision
Decorate 220 RelaxedPrecision
Decorate 221 RelaxedPrecision
Decorate 222 RelaxedPrecision
Decorate 227(color) RelaxedPrecision
Decorate 228 RelaxedPrecision
Decorate 229 RelaxedPrecision
Decorate 230 RelaxedPrecision
Decorate 231 RelaxedPrecision
Decorate 233(v) RelaxedPrecision
Decorate 235 RelaxedPrecision
Decorate 237 RelaxedPrecision
Decorate 239 RelaxedPrecision
Decorate 240 RelaxedPrecision
Decorate 243 RelaxedPrecision
Decorate 244 RelaxedPrecision
Decorate 245 RelaxedPrecision
Decorate 247 RelaxedPrecision
Decorate 249 RelaxedPrecision
Decorate 251 RelaxedPrecision
Decorate 252 RelaxedPrecision
Decorate 254 RelaxedPrecision
Decorate 255 RelaxedPrecision
Decorate 256 RelaxedPrecision
Decorate 257 RelaxedPrecision
Decorate 264 RelaxedPrecision
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32

View File

@@ -41,19 +41,102 @@ Linked fragment stage:
Decorate 12(u) RelaxedPrecision
Decorate 15(t) RelaxedPrecision
Decorate 15(t) Flat
Decorate 19 RelaxedPrecision
Decorate 21 RelaxedPrecision
Decorate 27 RelaxedPrecision
Decorate 28 RelaxedPrecision
Decorate 32 RelaxedPrecision
Decorate 33 RelaxedPrecision
Decorate 38 RelaxedPrecision
Decorate 39 RelaxedPrecision
Decorate 43 RelaxedPrecision
Decorate 44 RelaxedPrecision
Decorate 48 RelaxedPrecision
Decorate 49 RelaxedPrecision
Decorate 53 RelaxedPrecision
Decorate 54 RelaxedPrecision
Decorate 55(shiftedii) RelaxedPrecision
Decorate 57(shiftedui) RelaxedPrecision
Decorate 59(shiftediu) RelaxedPrecision
Decorate 60(shifteduu) RelaxedPrecision
Decorate 61 RelaxedPrecision
Decorate 62 RelaxedPrecision
Decorate 68(c) RelaxedPrecision
Decorate 72(usampler) RelaxedPrecision
Decorate 73 RelaxedPrecision
Decorate 77(tc) RelaxedPrecision
Decorate 78 RelaxedPrecision
Decorate 79 RelaxedPrecision
Decorate 80 RelaxedPrecision
Decorate 81 RelaxedPrecision
Decorate 85 RelaxedPrecision
Decorate 86 RelaxedPrecision
Decorate 88 RelaxedPrecision
Decorate 89 RelaxedPrecision
Decorate 90 RelaxedPrecision
Decorate 91 RelaxedPrecision
Decorate 92 RelaxedPrecision
Decorate 97 RelaxedPrecision
Decorate 98 RelaxedPrecision
Decorate 101 RelaxedPrecision
Decorate 102 RelaxedPrecision
Decorate 105 RelaxedPrecision
Decorate 111(af) RelaxedPrecision
Decorate 112 RelaxedPrecision
Decorate 113 RelaxedPrecision
Decorate 116 RelaxedPrecision
Decorate 118(ai) RelaxedPrecision
Decorate 119 RelaxedPrecision
Decorate 120 RelaxedPrecision
Decorate 121 RelaxedPrecision
Decorate 122 RelaxedPrecision
Decorate 124 RelaxedPrecision
Decorate 125 RelaxedPrecision
Decorate 126 RelaxedPrecision
Decorate 127 RelaxedPrecision
Decorate 128 RelaxedPrecision
Decorate 129 RelaxedPrecision
Decorate 130 RelaxedPrecision
Decorate 131 RelaxedPrecision
Decorate 135 RelaxedPrecision
Decorate 136 RelaxedPrecision
Decorate 140 RelaxedPrecision
Decorate 141 RelaxedPrecision
Decorate 145 RelaxedPrecision
Decorate 146 RelaxedPrecision
Decorate 150 RelaxedPrecision
Decorate 151 RelaxedPrecision
Decorate 152(mask1) RelaxedPrecision
Decorate 154(mask2) RelaxedPrecision
Decorate 156(mask3) RelaxedPrecision
Decorate 157 RelaxedPrecision
Decorate 159 RelaxedPrecision
Decorate 160(mask4) RelaxedPrecision
Decorate 162 RelaxedPrecision
Decorate 163 RelaxedPrecision
Decorate 167 RelaxedPrecision
Decorate 168 RelaxedPrecision
Decorate 169 RelaxedPrecision
Decorate 170 RelaxedPrecision
Decorate 171 RelaxedPrecision
Decorate 175 RelaxedPrecision
Decorate 176 RelaxedPrecision
Decorate 177 RelaxedPrecision
Decorate 178 RelaxedPrecision
Decorate 179 RelaxedPrecision
Decorate 180 RelaxedPrecision
Decorate 184 RelaxedPrecision
Decorate 185 RelaxedPrecision
Decorate 186 RelaxedPrecision
Decorate 187 RelaxedPrecision
Decorate 188 RelaxedPrecision
Decorate 192 RelaxedPrecision
Decorate 193 RelaxedPrecision
Decorate 194 RelaxedPrecision
Decorate 195 RelaxedPrecision
Decorate 196 RelaxedPrecision
Decorate 197 RelaxedPrecision
Decorate 198 RelaxedPrecision
Decorate 200(f) RelaxedPrecision
Decorate 202(v) RelaxedPrecision
Decorate 204(i) RelaxedPrecision

View File

@@ -23,6 +23,13 @@ bool boolfun(bvec2 bv2)
return bv2 == bvec2(false, true);
}
struct S {
highp float a;
lowp float b;
};
in S s;
void main()
{
lowp int sum = uniform_medium + uniform_high;
@@ -47,4 +54,7 @@ void main()
if (boolfun(ub2))
++mediumfout;
mediumfout *= s.a;
mediumfout *= s.b;
}