mirror of
https://github.com/RPCS3/glslang.git
synced 2024-12-11 04:43:36 +00:00
0842dbb39a
This PR adds a CreateParseContext() fn analogous to CreateBuiltInParseables(), to create a language specific built in parser. (This code was present before but not encapsualted in a fn). This can now be used to create a source language specific parser for builtins. Along with this, the code creating HLSL intrinsic prototypes can now produce them in HLSL syntax, rather than GLSL syntax. This relaxes certain prior restrictions at the parser level. Lower layers (e.g, SPIR-V) may still have such restrictions, such as around Nx1 matrices: this code does not impact that. This PR also fleshes out matrix types for bools and ints, both of which were partially in place before. This was easier than maintaining the restrictions in the HLSL prototype generator to avoid creating protoypes with those types. Many tests change because the result type from intrinsics moves from "global" to "temp". Several new tests are added for the new types.
262 lines
12 KiB
Plaintext
262 lines
12 KiB
Plaintext
hlsl.matNx1.frag
|
|
Shader version: 450
|
|
gl_FragCoord origin is upper left
|
|
0:? Sequence
|
|
0:3 Function Definition: TestMatNx1( (temp void)
|
|
0:3 Function Parameters:
|
|
0:? Sequence
|
|
0:13 Sequence
|
|
0:13 move second child to first child (temp 1X1 matrix of float)
|
|
0:13 'r00' (temp 1X1 matrix of float)
|
|
0:13 transpose (temp 1X1 matrix of float)
|
|
0:13 'f1x1' (temp 1X1 matrix of float)
|
|
0:14 Sequence
|
|
0:14 move second child to first child (temp 1X2 matrix of float)
|
|
0:14 'r01' (temp 1X2 matrix of float)
|
|
0:14 transpose (temp 1X2 matrix of float)
|
|
0:14 'f2x1' (temp 2X1 matrix of float)
|
|
0:15 Sequence
|
|
0:15 move second child to first child (temp 1X3 matrix of float)
|
|
0:15 'r02' (temp 1X3 matrix of float)
|
|
0:15 transpose (temp 1X3 matrix of float)
|
|
0:15 'f3x1' (temp 3X1 matrix of float)
|
|
0:16 Sequence
|
|
0:16 move second child to first child (temp 1X4 matrix of float)
|
|
0:16 'r03' (temp 1X4 matrix of float)
|
|
0:16 transpose (temp 1X4 matrix of float)
|
|
0:16 'f4x1' (temp 4X1 matrix of float)
|
|
0:18 Sequence
|
|
0:18 move second child to first child (temp 1X1 matrix of float)
|
|
0:18 'r10' (temp 1X1 matrix of float)
|
|
0:18 transpose (temp 1X1 matrix of float)
|
|
0:18 'f1x1' (temp 1X1 matrix of float)
|
|
0:19 Sequence
|
|
0:19 move second child to first child (temp 2X1 matrix of float)
|
|
0:19 'r11' (temp 2X1 matrix of float)
|
|
0:19 transpose (temp 2X1 matrix of float)
|
|
0:19 'f1x2' (temp 1X2 matrix of float)
|
|
0:20 Sequence
|
|
0:20 move second child to first child (temp 3X1 matrix of float)
|
|
0:20 'r12' (temp 3X1 matrix of float)
|
|
0:20 transpose (temp 3X1 matrix of float)
|
|
0:20 'f1x3' (temp 1X3 matrix of float)
|
|
0:21 Sequence
|
|
0:21 move second child to first child (temp 4X1 matrix of float)
|
|
0:21 'r13' (temp 4X1 matrix of float)
|
|
0:21 transpose (temp 4X1 matrix of float)
|
|
0:21 'f1x4' (temp 1X4 matrix of float)
|
|
0:27 Function Definition: main( (temp structure{temp 4-component vector of float color})
|
|
0:27 Function Parameters:
|
|
0:? Sequence
|
|
0:29 move second child to first child (temp 4-component vector of float)
|
|
0:29 color: direct index for structure (temp 4-component vector of float)
|
|
0:29 'ps_output' (temp structure{temp 4-component vector of float color})
|
|
0:29 Constant:
|
|
0:29 0 (const int)
|
|
0:29 Constant:
|
|
0:29 1.000000
|
|
0:29 1.000000
|
|
0:29 1.000000
|
|
0:29 1.000000
|
|
0:30 Sequence
|
|
0:30 Sequence
|
|
0:30 move second child to first child (temp 4-component vector of float)
|
|
0:? 'color' (layout(location=0 ) out 4-component vector of float)
|
|
0:30 color: direct index for structure (temp 4-component vector of float)
|
|
0:30 'ps_output' (temp structure{temp 4-component vector of float color})
|
|
0:30 Constant:
|
|
0:30 0 (const int)
|
|
0:30 Branch: Return
|
|
0:? Linker Objects
|
|
0:? 'color' (layout(location=0 ) out 4-component vector of float)
|
|
|
|
|
|
Linked fragment stage:
|
|
|
|
|
|
Shader version: 450
|
|
gl_FragCoord origin is upper left
|
|
0:? Sequence
|
|
0:3 Function Definition: TestMatNx1( (temp void)
|
|
0:3 Function Parameters:
|
|
0:? Sequence
|
|
0:13 Sequence
|
|
0:13 move second child to first child (temp 1X1 matrix of float)
|
|
0:13 'r00' (temp 1X1 matrix of float)
|
|
0:13 transpose (temp 1X1 matrix of float)
|
|
0:13 'f1x1' (temp 1X1 matrix of float)
|
|
0:14 Sequence
|
|
0:14 move second child to first child (temp 1X2 matrix of float)
|
|
0:14 'r01' (temp 1X2 matrix of float)
|
|
0:14 transpose (temp 1X2 matrix of float)
|
|
0:14 'f2x1' (temp 2X1 matrix of float)
|
|
0:15 Sequence
|
|
0:15 move second child to first child (temp 1X3 matrix of float)
|
|
0:15 'r02' (temp 1X3 matrix of float)
|
|
0:15 transpose (temp 1X3 matrix of float)
|
|
0:15 'f3x1' (temp 3X1 matrix of float)
|
|
0:16 Sequence
|
|
0:16 move second child to first child (temp 1X4 matrix of float)
|
|
0:16 'r03' (temp 1X4 matrix of float)
|
|
0:16 transpose (temp 1X4 matrix of float)
|
|
0:16 'f4x1' (temp 4X1 matrix of float)
|
|
0:18 Sequence
|
|
0:18 move second child to first child (temp 1X1 matrix of float)
|
|
0:18 'r10' (temp 1X1 matrix of float)
|
|
0:18 transpose (temp 1X1 matrix of float)
|
|
0:18 'f1x1' (temp 1X1 matrix of float)
|
|
0:19 Sequence
|
|
0:19 move second child to first child (temp 2X1 matrix of float)
|
|
0:19 'r11' (temp 2X1 matrix of float)
|
|
0:19 transpose (temp 2X1 matrix of float)
|
|
0:19 'f1x2' (temp 1X2 matrix of float)
|
|
0:20 Sequence
|
|
0:20 move second child to first child (temp 3X1 matrix of float)
|
|
0:20 'r12' (temp 3X1 matrix of float)
|
|
0:20 transpose (temp 3X1 matrix of float)
|
|
0:20 'f1x3' (temp 1X3 matrix of float)
|
|
0:21 Sequence
|
|
0:21 move second child to first child (temp 4X1 matrix of float)
|
|
0:21 'r13' (temp 4X1 matrix of float)
|
|
0:21 transpose (temp 4X1 matrix of float)
|
|
0:21 'f1x4' (temp 1X4 matrix of float)
|
|
0:27 Function Definition: main( (temp structure{temp 4-component vector of float color})
|
|
0:27 Function Parameters:
|
|
0:? Sequence
|
|
0:29 move second child to first child (temp 4-component vector of float)
|
|
0:29 color: direct index for structure (temp 4-component vector of float)
|
|
0:29 'ps_output' (temp structure{temp 4-component vector of float color})
|
|
0:29 Constant:
|
|
0:29 0 (const int)
|
|
0:29 Constant:
|
|
0:29 1.000000
|
|
0:29 1.000000
|
|
0:29 1.000000
|
|
0:29 1.000000
|
|
0:30 Sequence
|
|
0:30 Sequence
|
|
0:30 move second child to first child (temp 4-component vector of float)
|
|
0:? 'color' (layout(location=0 ) out 4-component vector of float)
|
|
0:30 color: direct index for structure (temp 4-component vector of float)
|
|
0:30 'ps_output' (temp structure{temp 4-component vector of float color})
|
|
0:30 Constant:
|
|
0:30 0 (const int)
|
|
0:30 Branch: Return
|
|
0:? Linker Objects
|
|
0:? 'color' (layout(location=0 ) out 4-component vector of float)
|
|
|
|
// Module Version 10000
|
|
// Generated by (magic number): 80001
|
|
// Id's are bound by 72
|
|
|
|
Capability Shader
|
|
1: ExtInstImport "GLSL.std.450"
|
|
MemoryModel Logical GLSL450
|
|
EntryPoint Fragment 4 "main" 68
|
|
ExecutionMode 4 OriginUpperLeft
|
|
Name 4 "main"
|
|
Name 6 "TestMatNx1("
|
|
Name 12 "r00"
|
|
Name 13 "f1x1"
|
|
Name 19 "r01"
|
|
Name 22 "f2x1"
|
|
Name 28 "r02"
|
|
Name 31 "f3x1"
|
|
Name 37 "r03"
|
|
Name 40 "f4x1"
|
|
Name 43 "r10"
|
|
Name 46 "r11"
|
|
Name 47 "f1x2"
|
|
Name 50 "r12"
|
|
Name 51 "f1x3"
|
|
Name 54 "r13"
|
|
Name 55 "f1x4"
|
|
Name 58 "PS_OUTPUT"
|
|
MemberName 58(PS_OUTPUT) 0 "color"
|
|
Name 60 "ps_output"
|
|
Name 68 "color"
|
|
Decorate 68(color) Location 0
|
|
2: TypeVoid
|
|
3: TypeFunction 2
|
|
8: TypeFloat 32
|
|
9: TypeVector 8(float) 1
|
|
10: TypeMatrix 9(fvec) 1
|
|
11: TypePointer Function 10
|
|
16: TypeVector 8(float) 2
|
|
17: TypeMatrix 16(fvec2) 1
|
|
18: TypePointer Function 17
|
|
20: TypeMatrix 9(fvec) 2
|
|
21: TypePointer Function 20
|
|
25: TypeVector 8(float) 3
|
|
26: TypeMatrix 25(fvec3) 1
|
|
27: TypePointer Function 26
|
|
29: TypeMatrix 9(fvec) 3
|
|
30: TypePointer Function 29
|
|
34: TypeVector 8(float) 4
|
|
35: TypeMatrix 34(fvec4) 1
|
|
36: TypePointer Function 35
|
|
38: TypeMatrix 9(fvec) 4
|
|
39: TypePointer Function 38
|
|
58(PS_OUTPUT): TypeStruct 34(fvec4)
|
|
59: TypePointer Function 58(PS_OUTPUT)
|
|
61: TypeInt 32 1
|
|
62: 61(int) Constant 0
|
|
63: 8(float) Constant 1065353216
|
|
64: 34(fvec4) ConstantComposite 63 63 63 63
|
|
65: TypePointer Function 34(fvec4)
|
|
67: TypePointer Output 34(fvec4)
|
|
68(color): 67(ptr) Variable Output
|
|
4(main): 2 Function None 3
|
|
5: Label
|
|
60(ps_output): 59(ptr) Variable Function
|
|
66: 65(ptr) AccessChain 60(ps_output) 62
|
|
Store 66 64
|
|
69: 65(ptr) AccessChain 60(ps_output) 62
|
|
70: 34(fvec4) Load 69
|
|
Store 68(color) 70
|
|
Return
|
|
FunctionEnd
|
|
6(TestMatNx1(): 2 Function None 3
|
|
7: Label
|
|
12(r00): 11(ptr) Variable Function
|
|
13(f1x1): 11(ptr) Variable Function
|
|
19(r01): 18(ptr) Variable Function
|
|
22(f2x1): 21(ptr) Variable Function
|
|
28(r02): 27(ptr) Variable Function
|
|
31(f3x1): 30(ptr) Variable Function
|
|
37(r03): 36(ptr) Variable Function
|
|
40(f4x1): 39(ptr) Variable Function
|
|
43(r10): 11(ptr) Variable Function
|
|
46(r11): 21(ptr) Variable Function
|
|
47(f1x2): 18(ptr) Variable Function
|
|
50(r12): 30(ptr) Variable Function
|
|
51(f1x3): 27(ptr) Variable Function
|
|
54(r13): 39(ptr) Variable Function
|
|
55(f1x4): 36(ptr) Variable Function
|
|
14: 10 Load 13(f1x1)
|
|
15: 10 Transpose 14
|
|
Store 12(r00) 15
|
|
23: 20 Load 22(f2x1)
|
|
24: 17 Transpose 23
|
|
Store 19(r01) 24
|
|
32: 29 Load 31(f3x1)
|
|
33: 26 Transpose 32
|
|
Store 28(r02) 33
|
|
41: 38 Load 40(f4x1)
|
|
42: 35 Transpose 41
|
|
Store 37(r03) 42
|
|
44: 10 Load 13(f1x1)
|
|
45: 10 Transpose 44
|
|
Store 43(r10) 45
|
|
48: 17 Load 47(f1x2)
|
|
49: 20 Transpose 48
|
|
Store 46(r11) 49
|
|
52: 26 Load 51(f1x3)
|
|
53: 29 Transpose 52
|
|
Store 50(r12) 53
|
|
56: 35 Load 55(f1x4)
|
|
57: 38 Transpose 56
|
|
Store 54(r13) 57
|
|
Return
|
|
FunctionEnd
|