Commit 532543c1 by John Kessenich

HLSL: Grammar: Make comma-separated declaration lists work.

parent 92d44b1b
...@@ -31,12 +31,13 @@ gl_FragCoord origin is upper left ...@@ -31,12 +31,13 @@ gl_FragCoord origin is upper left
0:10 0 (const int) 0:10 0 (const int)
0:10 true case 0:10 true case
0:11 Branch: Kill 0:11 Branch: Kill
0:12 move second child to first child (temp float) 0:12 Sequence
0:12 'f' (temp float) 0:12 move second child to first child (temp float)
0:12 direct index (temp float) 0:12 'f' (temp float)
0:12 'input' (in 4-component vector of float) 0:12 direct index (temp float)
0:12 Constant: 0:12 'input' (in 4-component vector of float)
0:12 0 (const int) 0:12 Constant:
0:12 0 (const int)
0:13 Branch: Kill 0:13 Branch: Kill
0:? Linker Objects 0:? Linker Objects
...@@ -76,12 +77,13 @@ gl_FragCoord origin is upper left ...@@ -76,12 +77,13 @@ gl_FragCoord origin is upper left
0:10 0 (const int) 0:10 0 (const int)
0:10 true case 0:10 true case
0:11 Branch: Kill 0:11 Branch: Kill
0:12 move second child to first child (temp float) 0:12 Sequence
0:12 'f' (temp float) 0:12 move second child to first child (temp float)
0:12 direct index (temp float) 0:12 'f' (temp float)
0:12 'input' (in 4-component vector of float) 0:12 direct index (temp float)
0:12 Constant: 0:12 'input' (in 4-component vector of float)
0:12 0 (const int) 0:12 Constant:
0:12 0 (const int)
0:13 Branch: Kill 0:13 Branch: Kill
0:? Linker Objects 0:? Linker Objects
......
...@@ -2,14 +2,16 @@ hlsl.float1.frag ...@@ -2,14 +2,16 @@ hlsl.float1.frag
Shader version: 450 Shader version: 450
gl_FragCoord origin is upper left gl_FragCoord origin is upper left
0:? Sequence 0:? Sequence
0:1 move second child to first child (temp 1-component vector of float) 0:1 Sequence
0:1 'f1' (temp 1-component vector of float) 0:1 move second child to first child (temp 1-component vector of float)
0:1 Constant: 0:1 'f1' (temp 1-component vector of float)
0:1 1.000000 0:1 Constant:
0:2 move second child to first child (temp float) 0:1 1.000000
0:2 'scalar' (temp float) 0:2 Sequence
0:2 Constant: 0:2 move second child to first child (temp float)
0:2 2.000000 0:2 'scalar' (temp float)
0:2 Constant:
0:2 2.000000
0:8 Function Definition: ShaderFunction(vf1;f1; (temp 1-component vector of float) 0:8 Function Definition: ShaderFunction(vf1;f1; (temp 1-component vector of float)
0:5 Function Parameters: 0:5 Function Parameters:
0:5 'inFloat1' (in 1-component vector of float) 0:5 'inFloat1' (in 1-component vector of float)
...@@ -34,14 +36,16 @@ Linked fragment stage: ...@@ -34,14 +36,16 @@ Linked fragment stage:
Shader version: 450 Shader version: 450
gl_FragCoord origin is upper left gl_FragCoord origin is upper left
0:? Sequence 0:? Sequence
0:1 move second child to first child (temp 1-component vector of float) 0:1 Sequence
0:1 'f1' (temp 1-component vector of float) 0:1 move second child to first child (temp 1-component vector of float)
0:1 Constant: 0:1 'f1' (temp 1-component vector of float)
0:1 1.000000 0:1 Constant:
0:2 move second child to first child (temp float) 0:1 1.000000
0:2 'scalar' (temp float) 0:2 Sequence
0:2 Constant: 0:2 move second child to first child (temp float)
0:2 2.000000 0:2 'scalar' (temp float)
0:2 Constant:
0:2 2.000000
0:8 Function Definition: ShaderFunction(vf1;f1; (temp 1-component vector of float) 0:8 Function Definition: ShaderFunction(vf1;f1; (temp 1-component vector of float)
0:5 Function Parameters: 0:5 Function Parameters:
0:5 'inFloat1' (in 1-component vector of float) 0:5 'inFloat1' (in 1-component vector of float)
...@@ -61,7 +65,7 @@ gl_FragCoord origin is upper left ...@@ -61,7 +65,7 @@ gl_FragCoord origin is upper left
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 24 // Id's are bound by 26
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
...@@ -80,21 +84,25 @@ gl_FragCoord origin is upper left ...@@ -80,21 +84,25 @@ gl_FragCoord origin is upper left
6: TypeFloat 32 6: TypeFloat 32
7: TypePointer Function 6(float) 7: TypePointer Function 6(float)
8: TypeFunction 6(float) 7(ptr) 7(ptr) 8: TypeFunction 6(float) 7(ptr) 7(ptr)
14: 6(float) Constant 1065353216
16: 6(float) Constant 1073741824
4(PixelShaderFunction): 2 Function None 3 4(PixelShaderFunction): 2 Function None 3
5: Label 5: Label
13(f1): 7(ptr) Variable Function
15(scalar): 7(ptr) Variable Function
Store 13(f1) 14
Store 15(scalar) 16
FunctionEnd FunctionEnd
11(ShaderFunction(vf1;f1;): 6(float) Function None 8 11(ShaderFunction(vf1;f1;): 6(float) Function None 8
9(inFloat1): 7(ptr) FunctionParameter 9(inFloat1): 7(ptr) FunctionParameter
10(inScalar): 7(ptr) FunctionParameter 10(inScalar): 7(ptr) FunctionParameter
12: Label 12: Label
13(f1): 7(ptr) Variable Function 17: 6(float) Load 13(f1)
15(scalar): 7(ptr) Variable Function 18: 6(float) Load 15(scalar)
14: 6(float) Load 13(f1) 19: 6(float) IMul 17 18
16: 6(float) Load 15(scalar) 20: 6(float) Load 9(inFloat1)
17: 6(float) IMul 14 16 21: 6(float) Load 10(inScalar)
18: 6(float) Load 9(inFloat1) 22: 6(float) IMul 20 21
19: 6(float) Load 10(inScalar) 23: 6(float) FAdd 19 22
20: 6(float) IMul 18 19 ReturnValue 23
21: 6(float) FAdd 17 20
ReturnValue 21
FunctionEnd FunctionEnd
...@@ -2,13 +2,14 @@ hlsl.float4.frag ...@@ -2,13 +2,14 @@ hlsl.float4.frag
Shader version: 450 Shader version: 450
gl_FragCoord origin is upper left gl_FragCoord origin is upper left
0:? Sequence 0:? Sequence
0:1 move second child to first child (temp 4-component vector of float) 0:1 Sequence
0:1 'AmbientColor' (temp 4-component vector of float) 0:1 move second child to first child (temp 4-component vector of float)
0:? Constant: 0:1 'AmbientColor' (temp 4-component vector of float)
0:? 1.000000 0:? Constant:
0:? 0.500000 0:? 1.000000
0:? 0.000000 0:? 0.500000
0:? 1.000000 0:? 0.000000
0:? 1.000000
0:12 Function Definition: ShaderFunction(vf4; (temp 4-component vector of float) 0:12 Function Definition: ShaderFunction(vf4; (temp 4-component vector of float)
0:9 Function Parameters: 0:9 Function Parameters:
0:9 'input' (in 4-component vector of float) 0:9 'input' (in 4-component vector of float)
...@@ -31,13 +32,14 @@ Linked fragment stage: ...@@ -31,13 +32,14 @@ Linked fragment stage:
Shader version: 450 Shader version: 450
gl_FragCoord origin is upper left gl_FragCoord origin is upper left
0:? Sequence 0:? Sequence
0:1 move second child to first child (temp 4-component vector of float) 0:1 Sequence
0:1 'AmbientColor' (temp 4-component vector of float) 0:1 move second child to first child (temp 4-component vector of float)
0:? Constant: 0:1 'AmbientColor' (temp 4-component vector of float)
0:? 1.000000 0:? Constant:
0:? 0.500000 0:? 1.000000
0:? 0.000000 0:? 0.500000
0:? 1.000000 0:? 0.000000
0:? 1.000000
0:12 Function Definition: ShaderFunction(vf4; (temp 4-component vector of float) 0:12 Function Definition: ShaderFunction(vf4; (temp 4-component vector of float)
0:9 Function Parameters: 0:9 Function Parameters:
0:9 'input' (in 4-component vector of float) 0:9 'input' (in 4-component vector of float)
...@@ -55,7 +57,7 @@ gl_FragCoord origin is upper left ...@@ -55,7 +57,7 @@ gl_FragCoord origin is upper left
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 25 // Id's are bound by 29
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
...@@ -66,34 +68,39 @@ gl_FragCoord origin is upper left ...@@ -66,34 +68,39 @@ gl_FragCoord origin is upper left
Name 4 "PixelShaderFunction" Name 4 "PixelShaderFunction"
Name 11 "ShaderFunction(vf4;" Name 11 "ShaderFunction(vf4;"
Name 10 "input" Name 10 "input"
Name 14 "AmbientColor" Name 13 "AmbientColor"
Name 21 "ff1" Name 25 "ff1"
Name 22 "ff2" Name 26 "ff2"
Name 23 "ff3" Name 27 "ff3"
Name 24 "ff4" Name 28 "ff4"
Decorate 21(ff1) BuiltIn FrontFacing Decorate 25(ff1) BuiltIn FrontFacing
Decorate 24(ff4) BuiltIn FragCoord Decorate 28(ff4) BuiltIn FragCoord
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
7: TypeVector 6(float) 4 7: TypeVector 6(float) 4
8: TypePointer Function 7(fvec4) 8: TypePointer Function 7(fvec4)
9: TypeFunction 7(fvec4) 8(ptr) 9: TypeFunction 7(fvec4) 8(ptr)
19: TypeBool 14: 6(float) Constant 1065353216
20: TypePointer Function 19(bool) 15: 6(float) Constant 1056964608
16: 6(float) Constant 0
17: 7(fvec4) ConstantComposite 14 15 16 14
23: TypeBool
24: TypePointer Function 23(bool)
4(PixelShaderFunction): 2 Function None 3 4(PixelShaderFunction): 2 Function None 3
5: Label 5: Label
13(AmbientColor): 8(ptr) Variable Function
Store 13(AmbientColor) 17
FunctionEnd FunctionEnd
11(ShaderFunction(vf4;): 7(fvec4) Function None 9 11(ShaderFunction(vf4;): 7(fvec4) Function None 9
10(input): 8(ptr) FunctionParameter 10(input): 8(ptr) FunctionParameter
12: Label 12: Label
14(AmbientColor): 8(ptr) Variable Function 25(ff1): 24(ptr) Variable Function
21(ff1): 20(ptr) Variable Function 26(ff2): 8(ptr) Variable Function
22(ff2): 8(ptr) Variable Function 27(ff3): 8(ptr) Variable Function
23(ff3): 8(ptr) Variable Function 28(ff4): 8(ptr) Variable Function
24(ff4): 8(ptr) Variable Function 18: 7(fvec4) Load 10(input)
13: 7(fvec4) Load 10(input) 19: 7(fvec4) Load 13(AmbientColor)
15: 7(fvec4) Load 14(AmbientColor) 20: 7(fvec4) FMul 18 19
16: 7(fvec4) FMul 13 15 ReturnValue 20
ReturnValue 16
FunctionEnd FunctionEnd
hlsl.init.frag
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:1 Sequence
0:1 move second child to first child (temp 4-component vector of float)
0:1 'a1' (temp 4-component vector of float)
0:? Constant:
0:? 1.000000
0:? 0.500000
0:? 0.000000
0:? 1.000000
0:1 move second child to first child (temp 4-component vector of float)
0:1 'b1' (temp 4-component vector of float)
0:? Constant:
0:? 2.000000
0:? 2.500000
0:? 2.100000
0:? 2.200000
0:2 Sequence
0:2 move second child to first child (temp float)
0:2 'a2' (temp float)
0:2 Constant:
0:2 0.200000
0:? Sequence
0:3 move second child to first child (temp float)
0:3 'b3' (temp float)
0:3 Constant:
0:3 0.300000
0:? Sequence
0:4 move second child to first child (temp float)
0:4 'b4' (temp float)
0:4 Constant:
0:4 0.400000
0:5 Sequence
0:5 move second child to first child (temp float)
0:5 'a5' (temp float)
0:5 Constant:
0:5 0.500000
0:5 move second child to first child (temp float)
0:5 'c5' (temp float)
0:5 Constant:
0:5 1.500000
0:13 Function Definition: ShaderFunction(vf4; (temp 4-component vector of float)
0:8 Function Parameters:
0:8 'input' (in 4-component vector of float)
0:? Sequence
0:9 Sequence
0:9 move second child to first child (temp 4-component vector of float)
0:9 'a2' (temp 4-component vector of float)
0:? Constant:
0:? 0.200000
0:? 0.300000
0:? 0.400000
0:? 0.500000
0:11 Branch: Return with expression
0:11 component-wise multiply (temp 4-component vector of float)
0:11 'input' (in 4-component vector of float)
0:11 'a1' (temp 4-component vector of float)
0:? Linker Objects
0:? 'a1' (temp 4-component vector of float)
0:? 'b1' (temp 4-component vector of float)
0:? 'a2' (temp float)
0:? 'b2' (temp float)
0:? 'a3' (temp float)
0:? 'b3' (temp float)
0:? 'a4' (temp float)
0:? 'b4' (temp float)
0:? 'c4' (temp float)
0:? 'a5' (temp float)
0:? 'b5' (temp float)
0:? 'c5' (temp float)
Linked fragment stage:
Shader version: 450
gl_FragCoord origin is upper left
0:? Sequence
0:1 Sequence
0:1 move second child to first child (temp 4-component vector of float)
0:1 'a1' (temp 4-component vector of float)
0:? Constant:
0:? 1.000000
0:? 0.500000
0:? 0.000000
0:? 1.000000
0:1 move second child to first child (temp 4-component vector of float)
0:1 'b1' (temp 4-component vector of float)
0:? Constant:
0:? 2.000000
0:? 2.500000
0:? 2.100000
0:? 2.200000
0:2 Sequence
0:2 move second child to first child (temp float)
0:2 'a2' (temp float)
0:2 Constant:
0:2 0.200000
0:? Sequence
0:3 move second child to first child (temp float)
0:3 'b3' (temp float)
0:3 Constant:
0:3 0.300000
0:? Sequence
0:4 move second child to first child (temp float)
0:4 'b4' (temp float)
0:4 Constant:
0:4 0.400000
0:5 Sequence
0:5 move second child to first child (temp float)
0:5 'a5' (temp float)
0:5 Constant:
0:5 0.500000
0:5 move second child to first child (temp float)
0:5 'c5' (temp float)
0:5 Constant:
0:5 1.500000
0:13 Function Definition: ShaderFunction(vf4; (temp 4-component vector of float)
0:8 Function Parameters:
0:8 'input' (in 4-component vector of float)
0:? Sequence
0:9 Sequence
0:9 move second child to first child (temp 4-component vector of float)
0:9 'a2' (temp 4-component vector of float)
0:? Constant:
0:? 0.200000
0:? 0.300000
0:? 0.400000
0:? 0.500000
0:11 Branch: Return with expression
0:11 component-wise multiply (temp 4-component vector of float)
0:11 'input' (in 4-component vector of float)
0:11 'a1' (temp 4-component vector of float)
0:? Linker Objects
0:? 'a1' (temp 4-component vector of float)
0:? 'b1' (temp 4-component vector of float)
0:? 'a2' (temp float)
0:? 'b2' (temp float)
0:? 'a3' (temp float)
0:? 'b3' (temp float)
0:? 'a4' (temp float)
0:? 'b4' (temp float)
0:? 'c4' (temp float)
0:? 'a5' (temp float)
0:? 'b5' (temp float)
0:? 'c5' (temp float)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 43
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "ShaderFunction" 33
ExecutionMode 4 OriginUpperLeft
Source HLSL 450
Name 4 "ShaderFunction"
Name 9 "a1"
Name 14 "b1"
Name 21 "a2"
Name 23 "b3"
Name 25 "b4"
Name 27 "a5"
Name 28 "c5"
Name 30 "a2"
Name 33 "input"
Name 38 "b2"
Name 39 "a3"
Name 40 "a4"
Name 41 "c4"
Name 42 "b5"
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypePointer Function 7(fvec4)
10: 6(float) Constant 1065353216
11: 6(float) Constant 1056964608
12: 6(float) Constant 0
13: 7(fvec4) ConstantComposite 10 11 12 10
15: 6(float) Constant 1073741824
16: 6(float) Constant 1075838976
17: 6(float) Constant 1074161254
18: 6(float) Constant 1074580685
19: 7(fvec4) ConstantComposite 15 16 17 18
20: TypePointer Function 6(float)
22: 6(float) Constant 1045220557
24: 6(float) Constant 1050253722
26: 6(float) Constant 1053609165
29: 6(float) Constant 1069547520
31: 7(fvec4) ConstantComposite 22 24 26 11
32: TypePointer Input 7(fvec4)
33(input): 32(ptr) Variable Input
4(ShaderFunction): 2 Function None 3
5: Label
9(a1): 8(ptr) Variable Function
14(b1): 8(ptr) Variable Function
21(a2): 20(ptr) Variable Function
23(b3): 20(ptr) Variable Function
25(b4): 20(ptr) Variable Function
27(a5): 20(ptr) Variable Function
28(c5): 20(ptr) Variable Function
30(a2): 8(ptr) Variable Function
38(b2): 20(ptr) Variable Function
39(a3): 20(ptr) Variable Function
40(a4): 20(ptr) Variable Function
41(c4): 20(ptr) Variable Function
42(b5): 20(ptr) Variable Function
Store 9(a1) 13
Store 14(b1) 19
Store 21(a2) 22
Store 23(b3) 24
Store 25(b4) 26
Store 27(a5) 11
Store 28(c5) 29
Store 30(a2) 31
34: 7(fvec4) Load 33(input)
35: 7(fvec4) Load 9(a1)
36: 7(fvec4) FMul 34 35
ReturnValue 36
FunctionEnd
...@@ -13,18 +13,20 @@ gl_FragCoord origin is upper left ...@@ -13,18 +13,20 @@ gl_FragCoord origin is upper left
0:5 'inU1a' (in uint) 0:5 'inU1a' (in uint)
0:5 'inU1b' (in uint) 0:5 'inU1b' (in uint)
0:? Sequence 0:? Sequence
0:6 move second child to first child (temp double) 0:6 Sequence
0:6 'r00' (temp double) 0:6 move second child to first child (temp double)
0:6 fma (global double) 0:6 'r00' (temp double)
0:6 'inDV1a' (in double) 0:6 fma (global double)
0:6 'inDV1b' (in double) 0:6 'inDV1a' (in double)
0:6 'inDV1c' (in double) 0:6 'inDV1b' (in double)
0:7 move second child to first child (temp double) 0:6 'inDV1c' (in double)
0:7 'r01' (temp double) 0:7 Sequence
0:7 uint64BitsToDouble (temp double) 0:7 move second child to first child (temp double)
0:7 Construct uvec2 (temp 2-component vector of uint) 0:7 'r01' (temp double)
0:7 'inU1a' (in uint) 0:7 uint64BitsToDouble (temp double)
0:7 'inU1b' (in uint) 0:7 Construct uvec2 (temp 2-component vector of uint)
0:7 'inU1a' (in uint)
0:7 'inU1b' (in uint)
0:9 Branch: Return with expression 0:9 Branch: Return with expression
0:9 Constant: 0:9 Constant:
0:9 0.000000 0:9 0.000000
...@@ -48,18 +50,20 @@ gl_FragCoord origin is upper left ...@@ -48,18 +50,20 @@ gl_FragCoord origin is upper left
0:5 'inU1a' (in uint) 0:5 'inU1a' (in uint)
0:5 'inU1b' (in uint) 0:5 'inU1b' (in uint)
0:? Sequence 0:? Sequence
0:6 move second child to first child (temp double) 0:6 Sequence
0:6 'r00' (temp double) 0:6 move second child to first child (temp double)
0:6 fma (global double) 0:6 'r00' (temp double)
0:6 'inDV1a' (in double) 0:6 fma (global double)
0:6 'inDV1b' (in double) 0:6 'inDV1a' (in double)
0:6 'inDV1c' (in double) 0:6 'inDV1b' (in double)
0:7 move second child to first child (temp double) 0:6 'inDV1c' (in double)
0:7 'r01' (temp double) 0:7 Sequence
0:7 uint64BitsToDouble (temp double) 0:7 move second child to first child (temp double)
0:7 Construct uvec2 (temp 2-component vector of uint) 0:7 'r01' (temp double)
0:7 'inU1a' (in uint) 0:7 uint64BitsToDouble (temp double)
0:7 'inU1b' (in uint) 0:7 Construct uvec2 (temp 2-component vector of uint)
0:7 'inU1a' (in uint)
0:7 'inU1b' (in uint)
0:9 Branch: Return with expression 0:9 Branch: Return with expression
0:9 Constant: 0:9 Constant:
0:9 0.000000 0:9 0.000000
......
This source diff could not be displayed because it is too large. You can view the blob instead.
...@@ -8,32 +8,33 @@ gl_FragCoord origin is upper left ...@@ -8,32 +8,33 @@ gl_FragCoord origin is upper left
0:2 'n_dot_h' (in float) 0:2 'n_dot_h' (in float)
0:2 'm' (in float) 0:2 'm' (in float)
0:? Sequence 0:? Sequence
0:3 move second child to first child (temp 4-component vector of float) 0:3 Sequence
0:3 'r0' (temp 4-component vector of float) 0:3 move second child to first child (temp 4-component vector of float)
0:3 Construct vec4 (temp 4-component vector of float) 0:3 'r0' (temp 4-component vector of float)
0:3 Constant: 0:3 Construct vec4 (temp 4-component vector of float)
0:3 1.000000
0:3 max (temp float)
0:3 'n_dot_l' (in float)
0:3 Constant: 0:3 Constant:
0:3 0.000000 0:3 1.000000
0:3 Test condition and select (temp float) 0:3 max (temp float)
0:3 Condition 0:3 'n_dot_l' (in float)
0:3 Compare Less Than (temp bool) 0:3 Constant:
0:3 min (temp float) 0:3 0.000000
0:3 'n_dot_l' (in float) 0:3 Test condition and select (temp float)
0:3 'n_dot_h' (in float) 0:3 Condition
0:3 Compare Less Than (temp bool)
0:3 min (temp float)
0:3 'n_dot_l' (in float)
0:3 'n_dot_h' (in float)
0:3 Constant:
0:3 0.000000
0:3 true case
0:3 Constant: 0:3 Constant:
0:3 0.000000 0:3 0.000000
0:3 true case 0:3 false case
0:3 component-wise multiply (temp float)
0:3 'n_dot_h' (in float)
0:3 'm' (in float)
0:3 Constant: 0:3 Constant:
0:3 0.000000 0:3 1.000000
0:3 false case
0:3 component-wise multiply (temp float)
0:3 'n_dot_h' (in float)
0:3 'm' (in float)
0:3 Constant:
0:3 1.000000
0:? Linker Objects 0:? Linker Objects
...@@ -49,32 +50,33 @@ gl_FragCoord origin is upper left ...@@ -49,32 +50,33 @@ gl_FragCoord origin is upper left
0:2 'n_dot_h' (in float) 0:2 'n_dot_h' (in float)
0:2 'm' (in float) 0:2 'm' (in float)
0:? Sequence 0:? Sequence
0:3 move second child to first child (temp 4-component vector of float) 0:3 Sequence
0:3 'r0' (temp 4-component vector of float) 0:3 move second child to first child (temp 4-component vector of float)
0:3 Construct vec4 (temp 4-component vector of float) 0:3 'r0' (temp 4-component vector of float)
0:3 Constant: 0:3 Construct vec4 (temp 4-component vector of float)
0:3 1.000000
0:3 max (temp float)
0:3 'n_dot_l' (in float)
0:3 Constant: 0:3 Constant:
0:3 0.000000 0:3 1.000000
0:3 Test condition and select (temp float) 0:3 max (temp float)
0:3 Condition 0:3 'n_dot_l' (in float)
0:3 Compare Less Than (temp bool) 0:3 Constant:
0:3 min (temp float) 0:3 0.000000
0:3 'n_dot_l' (in float) 0:3 Test condition and select (temp float)
0:3 'n_dot_h' (in float) 0:3 Condition
0:3 Compare Less Than (temp bool)
0:3 min (temp float)
0:3 'n_dot_l' (in float)
0:3 'n_dot_h' (in float)
0:3 Constant:
0:3 0.000000
0:3 true case
0:3 Constant: 0:3 Constant:
0:3 0.000000 0:3 0.000000
0:3 true case 0:3 false case
0:3 component-wise multiply (temp float)
0:3 'n_dot_h' (in float)
0:3 'm' (in float)
0:3 Constant: 0:3 Constant:
0:3 0.000000 0:3 1.000000
0:3 false case
0:3 component-wise multiply (temp float)
0:3 'n_dot_h' (in float)
0:3 'm' (in float)
0:3 Constant:
0:3 1.000000
0:? Linker Objects 0:? Linker Objects
// Module Version 10000 // Module Version 10000
......
...@@ -2,10 +2,11 @@ hlsl.matType.frag ...@@ -2,10 +2,11 @@ hlsl.matType.frag
Shader version: 450 Shader version: 450
gl_FragCoord origin is upper left gl_FragCoord origin is upper left
0:? Sequence 0:? Sequence
0:1 move second child to first child (temp 1-component vector of float) 0:1 Sequence
0:1 'f1' (temp 1-component vector of float) 0:1 move second child to first child (temp 1-component vector of float)
0:1 Constant: 0:1 'f1' (temp 1-component vector of float)
0:1 1.000000 0:1 Constant:
0:1 1.000000
0:11 Function Definition: ShaderFunction(vf1;f1; (temp 1-component vector of float) 0:11 Function Definition: ShaderFunction(vf1;f1; (temp 1-component vector of float)
0:9 Function Parameters: 0:9 Function Parameters:
0:9 'inFloat1' (in 1-component vector of float) 0:9 'inFloat1' (in 1-component vector of float)
...@@ -25,10 +26,11 @@ Linked fragment stage: ...@@ -25,10 +26,11 @@ Linked fragment stage:
Shader version: 450 Shader version: 450
gl_FragCoord origin is upper left gl_FragCoord origin is upper left
0:? Sequence 0:? Sequence
0:1 move second child to first child (temp 1-component vector of float) 0:1 Sequence
0:1 'f1' (temp 1-component vector of float) 0:1 move second child to first child (temp 1-component vector of float)
0:1 Constant: 0:1 'f1' (temp 1-component vector of float)
0:1 1.000000 0:1 Constant:
0:1 1.000000
0:11 Function Definition: ShaderFunction(vf1;f1; (temp 1-component vector of float) 0:11 Function Definition: ShaderFunction(vf1;f1; (temp 1-component vector of float)
0:9 Function Parameters: 0:9 Function Parameters:
0:9 'inFloat1' (in 1-component vector of float) 0:9 'inFloat1' (in 1-component vector of float)
...@@ -43,7 +45,7 @@ gl_FragCoord origin is upper left ...@@ -43,7 +45,7 @@ gl_FragCoord origin is upper left
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 36 // Id's are bound by 37
Capability Shader Capability Shader
Capability Float64 Capability Float64
...@@ -56,46 +58,48 @@ gl_FragCoord origin is upper left ...@@ -56,46 +58,48 @@ gl_FragCoord origin is upper left
Name 11 "ShaderFunction(vf1;f1;" Name 11 "ShaderFunction(vf1;f1;"
Name 9 "inFloat1" Name 9 "inFloat1"
Name 10 "inScalar" Name 10 "inScalar"
Name 14 "f1" Name 13 "f1"
Name 18 "fmat11" Name 19 "fmat11"
Name 22 "fmat41" Name 23 "fmat41"
Name 25 "fmat12" Name 26 "fmat12"
Name 30 "dmat23" Name 31 "dmat23"
Name 35 "int44" Name 36 "int44"
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
7: TypePointer Function 6(float) 7: TypePointer Function 6(float)
8: TypeFunction 6(float) 7(ptr) 7(ptr) 8: TypeFunction 6(float) 7(ptr) 7(ptr)
15: TypeVector 6(float) 1 14: 6(float) Constant 1065353216
16: TypeMatrix 15(fvec) 1 16: TypeVector 6(float) 1
17: TypePointer Function 16 17: TypeMatrix 16(fvec) 1
19: TypeVector 6(float) 4 18: TypePointer Function 17
20: TypeMatrix 19(fvec4) 1 20: TypeVector 6(float) 4
21: TypePointer Function 20 21: TypeMatrix 20(fvec4) 1
23: TypeMatrix 15(fvec) 2 22: TypePointer Function 21
24: TypePointer Function 23 24: TypeMatrix 16(fvec) 2
26: TypeFloat 64 25: TypePointer Function 24
27: TypeVector 26(float) 2 27: TypeFloat 64
28: TypeMatrix 27(fvec2) 3 28: TypeVector 27(float) 2
29: TypePointer Function 28 29: TypeMatrix 28(fvec2) 3
31: TypeInt 32 1 30: TypePointer Function 29
32: TypeVector 31(int) 4 32: TypeInt 32 1
33: TypeMatrix 32(ivec4) 4 33: TypeVector 32(int) 4
34: TypePointer Function 33 34: TypeMatrix 33(ivec4) 4
35: TypePointer Function 34
4(PixelShaderFunction): 2 Function None 3 4(PixelShaderFunction): 2 Function None 3
5: Label 5: Label
13(f1): 7(ptr) Variable Function
Store 13(f1) 14
FunctionEnd FunctionEnd
11(ShaderFunction(vf1;f1;): 6(float) Function None 8 11(ShaderFunction(vf1;f1;): 6(float) Function None 8
9(inFloat1): 7(ptr) FunctionParameter 9(inFloat1): 7(ptr) FunctionParameter
10(inScalar): 7(ptr) FunctionParameter 10(inScalar): 7(ptr) FunctionParameter
12: Label 12: Label
14(f1): 7(ptr) Variable Function 19(fmat11): 18(ptr) Variable Function
18(fmat11): 17(ptr) Variable Function 23(fmat41): 22(ptr) Variable Function
22(fmat41): 21(ptr) Variable Function 26(fmat12): 25(ptr) Variable Function
25(fmat12): 24(ptr) Variable Function 31(dmat23): 30(ptr) Variable Function
30(dmat23): 29(ptr) Variable Function 36(int44): 35(ptr) Variable Function
35(int44): 34(ptr) Variable Function 15: 6(float) Undef
13: 6(float) Undef ReturnValue 15
ReturnValue 13
FunctionEnd FunctionEnd
...@@ -2,13 +2,14 @@ hlsl.swizzle.frag ...@@ -2,13 +2,14 @@ hlsl.swizzle.frag
Shader version: 450 Shader version: 450
gl_FragCoord origin is upper left gl_FragCoord origin is upper left
0:? Sequence 0:? Sequence
0:1 move second child to first child (temp 4-component vector of float) 0:1 Sequence
0:1 'AmbientColor' (temp 4-component vector of float) 0:1 move second child to first child (temp 4-component vector of float)
0:? Constant: 0:1 'AmbientColor' (temp 4-component vector of float)
0:? 1.000000 0:? Constant:
0:? 0.500000 0:? 1.000000
0:? 0.000000 0:? 0.500000
0:? 1.000000 0:? 0.000000
0:? 1.000000
0:7 Function Definition: ShaderFunction(vf4; (temp 4-component vector of float) 0:7 Function Definition: ShaderFunction(vf4; (temp 4-component vector of float)
0:4 Function Parameters: 0:4 Function Parameters:
0:4 'input' (in 4-component vector of float) 0:4 'input' (in 4-component vector of float)
...@@ -41,13 +42,14 @@ Linked fragment stage: ...@@ -41,13 +42,14 @@ Linked fragment stage:
Shader version: 450 Shader version: 450
gl_FragCoord origin is upper left gl_FragCoord origin is upper left
0:? Sequence 0:? Sequence
0:1 move second child to first child (temp 4-component vector of float) 0:1 Sequence
0:1 'AmbientColor' (temp 4-component vector of float) 0:1 move second child to first child (temp 4-component vector of float)
0:? Constant: 0:1 'AmbientColor' (temp 4-component vector of float)
0:? 1.000000 0:? Constant:
0:? 0.500000 0:? 1.000000
0:? 0.000000 0:? 0.500000
0:? 1.000000 0:? 0.000000
0:? 1.000000
0:7 Function Definition: ShaderFunction(vf4; (temp 4-component vector of float) 0:7 Function Definition: ShaderFunction(vf4; (temp 4-component vector of float)
0:4 Function Parameters: 0:4 Function Parameters:
0:4 'input' (in 4-component vector of float) 0:4 'input' (in 4-component vector of float)
...@@ -75,7 +77,7 @@ gl_FragCoord origin is upper left ...@@ -75,7 +77,7 @@ gl_FragCoord origin is upper left
// Module Version 10000 // Module Version 10000
// Generated by (magic number): 80001 // Generated by (magic number): 80001
// Id's are bound by 25 // Id's are bound by 29
Capability Shader Capability Shader
1: ExtInstImport "GLSL.std.450" 1: ExtInstImport "GLSL.std.450"
...@@ -86,28 +88,33 @@ gl_FragCoord origin is upper left ...@@ -86,28 +88,33 @@ gl_FragCoord origin is upper left
Name 4 "PixelShaderFunction" Name 4 "PixelShaderFunction"
Name 11 "ShaderFunction(vf4;" Name 11 "ShaderFunction(vf4;"
Name 10 "input" Name 10 "input"
Name 15 "AmbientColor" Name 13 "AmbientColor"
2: TypeVoid 2: TypeVoid
3: TypeFunction 2 3: TypeFunction 2
6: TypeFloat 32 6: TypeFloat 32
7: TypeVector 6(float) 4 7: TypeVector 6(float) 4
8: TypePointer Function 7(fvec4) 8: TypePointer Function 7(fvec4)
9: TypeFunction 7(fvec4) 8(ptr) 9: TypeFunction 7(fvec4) 8(ptr)
16: TypeInt 32 0 14: 6(float) Constant 1065353216
17: 16(int) Constant 2 15: 6(float) Constant 1056964608
18: TypePointer Function 6(float) 16: 6(float) Constant 0
17: 7(fvec4) ConstantComposite 14 15 16 14
20: TypeInt 32 0
21: 20(int) Constant 2
22: TypePointer Function 6(float)
4(PixelShaderFunction): 2 Function None 3 4(PixelShaderFunction): 2 Function None 3
5: Label 5: Label
13(AmbientColor): 8(ptr) Variable Function
Store 13(AmbientColor) 17
FunctionEnd FunctionEnd
11(ShaderFunction(vf4;): 7(fvec4) Function None 9 11(ShaderFunction(vf4;): 7(fvec4) Function None 9
10(input): 8(ptr) FunctionParameter 10(input): 8(ptr) FunctionParameter
12: Label 12: Label
15(AmbientColor): 8(ptr) Variable Function 18: 7(fvec4) Load 10(input)
13: 7(fvec4) Load 10(input) 19: 7(fvec4) VectorShuffle 18 18 3 3 1 0
14: 7(fvec4) VectorShuffle 13 13 3 3 1 0 23: 22(ptr) AccessChain 13(AmbientColor) 21
19: 18(ptr) AccessChain 15(AmbientColor) 17 24: 6(float) Load 23
20: 6(float) Load 19 25: 7(fvec4) CompositeConstruct 24 24 24 24
21: 7(fvec4) CompositeConstruct 20 20 20 20 26: 7(fvec4) FMul 19 25
22: 7(fvec4) FMul 14 21 ReturnValue 26
ReturnValue 22
FunctionEnd FunctionEnd
float4 a1 = float4(1, 0.5, 0, 1), b1 = float4(2.0, 2.5, 2.1, 2.2);
float a2 = 0.2, b2;
float a3, b3 = 0.3;
float a4, b4 = 0.4, c4;
float a5 = 0.5, b5, c5 = 1.5;
float4 ShaderFunction(float4 input) : COLOR0
{
float4 a2 = float4(0.2, 0.3, 0.4, 0.5);
return input * a1;
}
...@@ -82,6 +82,7 @@ INSTANTIATE_TEST_CASE_P( ...@@ -82,6 +82,7 @@ INSTANTIATE_TEST_CASE_P(
{"hlsl.float4.frag", "PixelShaderFunction"}, {"hlsl.float4.frag", "PixelShaderFunction"},
{"hlsl.forLoop.frag", "PixelShaderFunction"}, {"hlsl.forLoop.frag", "PixelShaderFunction"},
{"hlsl.if.frag", "PixelShaderFunction"}, {"hlsl.if.frag", "PixelShaderFunction"},
{"hlsl.init.frag", "ShaderFunction"},
{"hlsl.intrinsics.barriers.comp", "ComputeShaderFunction"}, {"hlsl.intrinsics.barriers.comp", "ComputeShaderFunction"},
{"hlsl.intrinsics.comp", "ComputeShaderFunction"}, {"hlsl.intrinsics.comp", "ComputeShaderFunction"},
{"hlsl.intrinsics.evalfns.frag", "main"}, {"hlsl.intrinsics.evalfns.frag", "main"},
......
...@@ -107,12 +107,23 @@ bool HlslGrammar::acceptCompilationUnit() ...@@ -107,12 +107,23 @@ bool HlslGrammar::acceptCompilationUnit()
// declaration // declaration
// : SEMICOLON // : SEMICOLON
// | fully_specified_type SEMICOLON // | fully_specified_type init_declarator_list SEMICOLON
// | fully_specified_type identifier array_specifier post_decls (EQUAL expression)opt SEMICOLON
// | fully_specified_type identifier function_parameters post_decls SEMICOLON // function prototype // | fully_specified_type identifier function_parameters post_decls SEMICOLON // function prototype
// | fully_specified_type identifier function_parameters post_decls compound_statement // function definition // | fully_specified_type identifier function_parameters post_decls compound_statement // function definition
// //
// 'node' could get created if the declaration creates code, like an initializer // init_declarator_list
// : init_declarator COMMA init_declarator COMMA init_declarator...
//
// init_declarator
// : identifier array_specifier post_decls
// | identifier array_specifier post_decls EQUAL assignment_expression
//
// Parsing has to go pretty far in to know whether it's an init_declarator_list
// or not, so the implementation below doesn't perfectly divide up the grammar
// as above. (The 'identifier' in the first item in init_declarator list is the
// same as 'identifier' for function declarations.)
//
// 'node' could get populated if the declaration creates code, like an initializer
// or a function body. // or a function body.
// //
bool HlslGrammar::acceptDeclaration(TIntermNode*& node) bool HlslGrammar::acceptDeclaration(TIntermNode*& node)
...@@ -134,18 +145,72 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& node) ...@@ -134,18 +145,72 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& node)
// post_decls // post_decls
acceptPostDecls(type); acceptPostDecls(type);
// EQUAL expression // EQUAL assignment_expression
TIntermTyped* expressionNode = nullptr; TIntermTyped* expressionNode = nullptr;
if (acceptTokenClass(EHTokAssign)) { if (acceptTokenClass(EHTokAssign)) {
if (! acceptExpression(expressionNode)) { if (! acceptAssignmentExpression(expressionNode)) {
expected("initializer"); expected("initializer");
return false; return false;
} }
} }
// COMMA
// This means we've been in an init_declarator_list.
// Finish the first init_declarator and recognize the rest of the list.
if (acceptTokenClass(EHTokComma)) {
// init_declarator
// we know have multiple declarations
node = parseContext.declareVariable(idToken.loc, *idToken.string, type, arraySizes, expressionNode);
node = intermediate.makeAggregate(node);
do {
// identifier
if (! acceptIdentifier(idToken)) {
expected("identifier");
return false;
}
// array_specifier
arraySizes = nullptr;
acceptArraySpecifier(arraySizes);
// post_decls
acceptPostDecls(type);
// EQUAL assignment_expression
TIntermTyped* expressionNode = nullptr;
if (acceptTokenClass(EHTokAssign)) {
if (! acceptAssignmentExpression(expressionNode)) {
expected("initializer");
return false;
}
}
node = intermediate.growAggregate(node, parseContext.declareVariable(idToken.loc, *idToken.string, type, arraySizes, expressionNode));
if (acceptTokenClass(EHTokSemicolon)) {
if (node != nullptr)
node->getAsAggregate()->setOperator(EOpSequence);
return true;
}
if (acceptTokenClass(EHTokComma))
continue;
expected(", or ;");
return false;
} while (true);
}
// SEMICOLON // SEMICOLON
// This also means we've been in an init_declarator_list, but with no COMMA seen.
// Recognize the init_declarator_list, which contains a single declaration.
if (acceptTokenClass(EHTokSemicolon)) { if (acceptTokenClass(EHTokSemicolon)) {
node = parseContext.declareVariable(idToken.loc, *idToken.string, type, arraySizes, expressionNode); node = parseContext.declareVariable(idToken.loc, *idToken.string, type, arraySizes, expressionNode);
// use standard AST shape for declarations; just to be safe
node = intermediate.makeAggregate(node);
if (node != nullptr)
node->getAsAggregate()->setOperator(EOpSequence);
return true; return true;
} }
...@@ -451,8 +516,6 @@ bool HlslGrammar::acceptMatrixTemplateType(TType& type) ...@@ -451,8 +516,6 @@ bool HlslGrammar::acceptMatrixTemplateType(TType& type)
// Otherwise, return false, and don't advance // Otherwise, return false, and don't advance
bool HlslGrammar::acceptType(TType& type) bool HlslGrammar::acceptType(TType& type)
{ {
TBasicType basicType;
switch (peek()) { switch (peek()) {
case EHTokVector: case EHTokVector:
return acceptVectorTemplateType(type); return acceptVectorTemplateType(type);
......
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