HLSL: support binary literals

Fixes #3089
This commit is contained in:
Dawid-Lorenz-Mobica 2023-07-18 17:35:36 +02:00 committed by GitHub
parent 9e41635d74
commit d5f3ad6c9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 745 additions and 252 deletions

View file

@ -2,94 +2,124 @@ hlsl.numericsuffixes.frag
Shader version: 500
gl_FragCoord origin is upper left
0:? Sequence
0:5 Function Definition: @main( ( temp structure{ temp 4-component vector of float color})
0:5 Function Parameters:
0:8 Function Definition: @main( ( temp structure{ temp 4-component vector of float color})
0:8 Function Parameters:
0:? Sequence
0:7 Sequence
0:7 move second child to first child ( temp float)
0:7 'r00' ( temp float)
0:7 Constant:
0:7 1.000000
0:8 Sequence
0:8 move second child to first child ( temp uint)
0:8 'r01' ( temp uint)
0:8 Constant:
0:8 1 (const uint)
0:9 Sequence
0:9 move second child to first child ( temp uint)
0:9 'r02' ( temp uint)
0:9 Constant:
0:9 2 (const uint)
0:10 Sequence
0:10 move second child to first child ( temp uint)
0:10 'r03' ( temp uint)
0:10 move second child to first child ( temp float)
0:10 'r00' ( temp float)
0:10 Constant:
0:10 2748 (const uint)
0:10 1.000000
0:11 Sequence
0:11 move second child to first child ( temp uint)
0:11 'r04' ( temp uint)
0:11 'r01' ( temp uint)
0:11 Constant:
0:11 2748 (const uint)
0:11 1 (const uint)
0:12 Sequence
0:12 move second child to first child ( temp int)
0:12 'r05' ( temp int)
0:12 move second child to first child ( temp uint)
0:12 'r02' ( temp uint)
0:12 Constant:
0:12 5 (const int)
0:12 2 (const uint)
0:13 Sequence
0:13 move second child to first child ( temp int)
0:13 'r06' ( temp int)
0:13 move second child to first child ( temp uint)
0:13 'r03' ( temp uint)
0:13 Constant:
0:13 6 (const int)
0:13 2748 (const uint)
0:14 Sequence
0:14 move second child to first child ( temp int)
0:14 'r07' ( temp int)
0:14 move second child to first child ( temp uint)
0:14 'r04' ( temp uint)
0:14 Constant:
0:14 57 (const int)
0:14 2748 (const uint)
0:15 Sequence
0:15 move second child to first child ( temp uint)
0:15 'r08' ( temp uint)
0:15 move second child to first child ( temp int)
0:15 'r05' ( temp int)
0:15 Constant:
0:15 58 (const uint)
0:15 5 (const int)
0:16 Sequence
0:16 move second child to first child ( temp float)
0:16 'r09' ( temp float)
0:16 move second child to first child ( temp int)
0:16 'r06' ( temp int)
0:16 Constant:
0:16 1.000000
0:16 6 (const int)
0:17 Sequence
0:17 move second child to first child ( temp float)
0:17 'r10' ( temp float)
0:17 move second child to first child ( temp int)
0:17 'r07' ( temp int)
0:17 Constant:
0:17 1.000000
0:17 57 (const int)
0:18 Sequence
0:18 move second child to first child ( temp float)
0:18 'r11' ( temp float)
0:18 move second child to first child ( temp uint)
0:18 'r08' ( temp uint)
0:18 Constant:
0:18 1.100000
0:18 58 (const uint)
0:19 Sequence
0:19 move second child to first child ( temp float)
0:19 'r12' ( temp float)
0:19 'r09' ( temp float)
0:19 Constant:
0:19 1.100000
0:22 move second child to first child ( temp 4-component vector of float)
0:22 color: direct index for structure ( temp 4-component vector of float)
0:22 'ps_output' ( temp structure{ temp 4-component vector of float color})
0:19 1.000000
0:20 Sequence
0:20 move second child to first child ( temp float)
0:20 'r10' ( temp float)
0:20 Constant:
0:20 1.000000
0:21 Sequence
0:21 move second child to first child ( temp float)
0:21 'r11' ( temp float)
0:21 Constant:
0:21 1.100000
0:22 Sequence
0:22 move second child to first child ( temp float)
0:22 'r12' ( temp float)
0:22 Constant:
0:22 0 (const int)
0:22 Construct vec4 ( temp 4-component vector of float)
0:22 Convert int to float ( temp float)
0:22 'r07' ( temp int)
0:23 Branch: Return with expression
0:23 'ps_output' ( temp structure{ temp 4-component vector of float color})
0:5 Function Definition: main( ( temp void)
0:5 Function Parameters:
0:22 1.100000
0:23 Sequence
0:23 move second child to first child ( temp uint)
0:23 'r13' ( temp uint)
0:23 Constant:
0:23 1 (const uint)
0:24 Sequence
0:24 move second child to first child ( temp uint)
0:24 'r14' ( temp uint)
0:24 Constant:
0:24 2 (const uint)
0:25 Sequence
0:25 move second child to first child ( temp int)
0:25 'r15' ( temp int)
0:25 Constant:
0:25 3 (const int)
0:26 Sequence
0:26 move second child to first child ( temp int)
0:26 'r16' ( temp int)
0:26 Constant:
0:26 4 (const int)
0:27 Sequence
0:27 move second child to first child ( temp uint)
0:27 'r17' ( temp uint)
0:27 Constant:
0:27 1 (const uint)
0:28 Sequence
0:28 move second child to first child ( temp int)
0:28 'r18' ( temp int)
0:28 Constant:
0:28 3 (const int)
0:31 move second child to first child ( temp 4-component vector of float)
0:31 color: direct index for structure ( temp 4-component vector of float)
0:31 'ps_output' ( temp structure{ temp 4-component vector of float color})
0:31 Constant:
0:31 0 (const int)
0:31 Construct vec4 ( temp 4-component vector of float)
0:31 Convert int to float ( temp float)
0:31 'r07' ( temp int)
0:32 Branch: Return with expression
0:32 'ps_output' ( temp structure{ temp 4-component vector of float color})
0:8 Function Definition: main( ( temp void)
0:8 Function Parameters:
0:? Sequence
0:5 Sequence
0:5 move second child to first child ( temp 4-component vector of float)
0:8 Sequence
0:8 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput.color' (layout( location=0) out 4-component vector of float)
0:5 color: direct index for structure ( temp 4-component vector of float)
0:5 Function Call: @main( ( temp structure{ temp 4-component vector of float color})
0:5 Constant:
0:5 0 (const int)
0:8 color: direct index for structure ( temp 4-component vector of float)
0:8 Function Call: @main( ( temp structure{ temp 4-component vector of float color})
0:8 Constant:
0:8 0 (const int)
0:? Linker Objects
0:? '@entryPointOutput.color' (layout( location=0) out 4-component vector of float)
@ -100,105 +130,135 @@ Linked fragment stage:
Shader version: 500
gl_FragCoord origin is upper left
0:? Sequence
0:5 Function Definition: @main( ( temp structure{ temp 4-component vector of float color})
0:5 Function Parameters:
0:8 Function Definition: @main( ( temp structure{ temp 4-component vector of float color})
0:8 Function Parameters:
0:? Sequence
0:7 Sequence
0:7 move second child to first child ( temp float)
0:7 'r00' ( temp float)
0:7 Constant:
0:7 1.000000
0:8 Sequence
0:8 move second child to first child ( temp uint)
0:8 'r01' ( temp uint)
0:8 Constant:
0:8 1 (const uint)
0:9 Sequence
0:9 move second child to first child ( temp uint)
0:9 'r02' ( temp uint)
0:9 Constant:
0:9 2 (const uint)
0:10 Sequence
0:10 move second child to first child ( temp uint)
0:10 'r03' ( temp uint)
0:10 move second child to first child ( temp float)
0:10 'r00' ( temp float)
0:10 Constant:
0:10 2748 (const uint)
0:10 1.000000
0:11 Sequence
0:11 move second child to first child ( temp uint)
0:11 'r04' ( temp uint)
0:11 'r01' ( temp uint)
0:11 Constant:
0:11 2748 (const uint)
0:11 1 (const uint)
0:12 Sequence
0:12 move second child to first child ( temp int)
0:12 'r05' ( temp int)
0:12 move second child to first child ( temp uint)
0:12 'r02' ( temp uint)
0:12 Constant:
0:12 5 (const int)
0:12 2 (const uint)
0:13 Sequence
0:13 move second child to first child ( temp int)
0:13 'r06' ( temp int)
0:13 move second child to first child ( temp uint)
0:13 'r03' ( temp uint)
0:13 Constant:
0:13 6 (const int)
0:13 2748 (const uint)
0:14 Sequence
0:14 move second child to first child ( temp int)
0:14 'r07' ( temp int)
0:14 move second child to first child ( temp uint)
0:14 'r04' ( temp uint)
0:14 Constant:
0:14 57 (const int)
0:14 2748 (const uint)
0:15 Sequence
0:15 move second child to first child ( temp uint)
0:15 'r08' ( temp uint)
0:15 move second child to first child ( temp int)
0:15 'r05' ( temp int)
0:15 Constant:
0:15 58 (const uint)
0:15 5 (const int)
0:16 Sequence
0:16 move second child to first child ( temp float)
0:16 'r09' ( temp float)
0:16 move second child to first child ( temp int)
0:16 'r06' ( temp int)
0:16 Constant:
0:16 1.000000
0:16 6 (const int)
0:17 Sequence
0:17 move second child to first child ( temp float)
0:17 'r10' ( temp float)
0:17 move second child to first child ( temp int)
0:17 'r07' ( temp int)
0:17 Constant:
0:17 1.000000
0:17 57 (const int)
0:18 Sequence
0:18 move second child to first child ( temp float)
0:18 'r11' ( temp float)
0:18 move second child to first child ( temp uint)
0:18 'r08' ( temp uint)
0:18 Constant:
0:18 1.100000
0:18 58 (const uint)
0:19 Sequence
0:19 move second child to first child ( temp float)
0:19 'r12' ( temp float)
0:19 'r09' ( temp float)
0:19 Constant:
0:19 1.100000
0:22 move second child to first child ( temp 4-component vector of float)
0:22 color: direct index for structure ( temp 4-component vector of float)
0:22 'ps_output' ( temp structure{ temp 4-component vector of float color})
0:19 1.000000
0:20 Sequence
0:20 move second child to first child ( temp float)
0:20 'r10' ( temp float)
0:20 Constant:
0:20 1.000000
0:21 Sequence
0:21 move second child to first child ( temp float)
0:21 'r11' ( temp float)
0:21 Constant:
0:21 1.100000
0:22 Sequence
0:22 move second child to first child ( temp float)
0:22 'r12' ( temp float)
0:22 Constant:
0:22 0 (const int)
0:22 Construct vec4 ( temp 4-component vector of float)
0:22 Convert int to float ( temp float)
0:22 'r07' ( temp int)
0:23 Branch: Return with expression
0:23 'ps_output' ( temp structure{ temp 4-component vector of float color})
0:5 Function Definition: main( ( temp void)
0:5 Function Parameters:
0:22 1.100000
0:23 Sequence
0:23 move second child to first child ( temp uint)
0:23 'r13' ( temp uint)
0:23 Constant:
0:23 1 (const uint)
0:24 Sequence
0:24 move second child to first child ( temp uint)
0:24 'r14' ( temp uint)
0:24 Constant:
0:24 2 (const uint)
0:25 Sequence
0:25 move second child to first child ( temp int)
0:25 'r15' ( temp int)
0:25 Constant:
0:25 3 (const int)
0:26 Sequence
0:26 move second child to first child ( temp int)
0:26 'r16' ( temp int)
0:26 Constant:
0:26 4 (const int)
0:27 Sequence
0:27 move second child to first child ( temp uint)
0:27 'r17' ( temp uint)
0:27 Constant:
0:27 1 (const uint)
0:28 Sequence
0:28 move second child to first child ( temp int)
0:28 'r18' ( temp int)
0:28 Constant:
0:28 3 (const int)
0:31 move second child to first child ( temp 4-component vector of float)
0:31 color: direct index for structure ( temp 4-component vector of float)
0:31 'ps_output' ( temp structure{ temp 4-component vector of float color})
0:31 Constant:
0:31 0 (const int)
0:31 Construct vec4 ( temp 4-component vector of float)
0:31 Convert int to float ( temp float)
0:31 'r07' ( temp int)
0:32 Branch: Return with expression
0:32 'ps_output' ( temp structure{ temp 4-component vector of float color})
0:8 Function Definition: main( ( temp void)
0:8 Function Parameters:
0:? Sequence
0:5 Sequence
0:5 move second child to first child ( temp 4-component vector of float)
0:8 Sequence
0:8 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput.color' (layout( location=0) out 4-component vector of float)
0:5 color: direct index for structure ( temp 4-component vector of float)
0:5 Function Call: @main( ( temp structure{ temp 4-component vector of float color})
0:5 Constant:
0:5 0 (const int)
0:8 color: direct index for structure ( temp 4-component vector of float)
0:8 Function Call: @main( ( temp structure{ temp 4-component vector of float color})
0:8 Constant:
0:8 0 (const int)
0:? Linker Objects
0:? '@entryPointOutput.color' (layout( location=0) out 4-component vector of float)
// Module Version 10000
// Generated by (magic number): 8000b
// Id's are bound by 54
// Id's are bound by 62
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 51
EntryPoint Fragment 4 "main" 59
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
@ -218,9 +278,15 @@ gl_FragCoord origin is upper left
Name 35 "r10"
Name 36 "r11"
Name 38 "r12"
Name 40 "ps_output"
Name 51 "@entryPointOutput.color"
Decorate 51(@entryPointOutput.color) Location 0
Name 39 "r13"
Name 40 "r14"
Name 41 "r15"
Name 43 "r16"
Name 45 "r17"
Name 46 "r18"
Name 48 "ps_output"
Name 59 "@entryPointOutput.color"
Decorate 59(@entryPointOutput.color) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
@ -241,16 +307,18 @@ gl_FragCoord origin is upper left
31: 24(int) Constant 57
33: 15(int) Constant 58
37: 6(float) Constant 1066192077
39: TypePointer Function 8(PS_OUTPUT)
41: 24(int) Constant 0
45: TypePointer Function 7(fvec4)
50: TypePointer Output 7(fvec4)
51(@entryPointOutput.color): 50(ptr) Variable Output
42: 24(int) Constant 3
44: 24(int) Constant 4
47: TypePointer Function 8(PS_OUTPUT)
49: 24(int) Constant 0
53: TypePointer Function 7(fvec4)
58: TypePointer Output 7(fvec4)
59(@entryPointOutput.color): 58(ptr) Variable Output
4(main): 2 Function None 3
5: Label
52:8(PS_OUTPUT) FunctionCall 10(@main()
53: 7(fvec4) CompositeExtract 52 0
Store 51(@entryPointOutput.color) 53
60:8(PS_OUTPUT) FunctionCall 10(@main()
61: 7(fvec4) CompositeExtract 60 0
Store 59(@entryPointOutput.color) 61
Return
FunctionEnd
10(@main():8(PS_OUTPUT) Function None 9
@ -268,7 +336,13 @@ gl_FragCoord origin is upper left
35(r10): 12(ptr) Variable Function
36(r11): 12(ptr) Variable Function
38(r12): 12(ptr) Variable Function
40(ps_output): 39(ptr) Variable Function
39(r13): 16(ptr) Variable Function
40(r14): 16(ptr) Variable Function
41(r15): 25(ptr) Variable Function
43(r16): 25(ptr) Variable Function
45(r17): 16(ptr) Variable Function
46(r18): 25(ptr) Variable Function
48(ps_output): 47(ptr) Variable Function
Store 13(r00) 14
Store 17(r01) 18
Store 19(r02) 20
@ -282,11 +356,17 @@ gl_FragCoord origin is upper left
Store 35(r10) 14
Store 36(r11) 37
Store 38(r12) 37
42: 24(int) Load 30(r07)
43: 6(float) ConvertSToF 42
44: 7(fvec4) CompositeConstruct 43 43 43 43
46: 45(ptr) AccessChain 40(ps_output) 41
Store 46 44
47:8(PS_OUTPUT) Load 40(ps_output)
ReturnValue 47
Store 39(r13) 18
Store 40(r14) 20
Store 41(r15) 42
Store 43(r16) 44
Store 45(r17) 18
Store 46(r18) 42
50: 24(int) Load 30(r07)
51: 6(float) ConvertSToF 50
52: 7(fvec4) CompositeConstruct 51 51 51 51
54: 53(ptr) AccessChain 48(ps_output) 49
Store 54 52
55:8(PS_OUTPUT) Load 48(ps_output)
ReturnValue 55
FunctionEnd