HLSL: cast bracket dereference index to int type if not.
HLSL can index arrays using operator[] with non-integer types, and inserts a conversion to a uint if needed.
This commit is contained in:
151
Test/baseResults/hlsl.nonint-index.frag.out
Normal file
151
Test/baseResults/hlsl.nonint-index.frag.out
Normal file
@@ -0,0 +1,151 @@
|
||||
hlsl.nonint-index.frag
|
||||
Shader version: 450
|
||||
gl_FragCoord origin is upper left
|
||||
0:? Sequence
|
||||
0:4 Function Definition: @main(f1; ( temp float)
|
||||
0:4 Function Parameters:
|
||||
0:4 'input' ( in float)
|
||||
0:? Sequence
|
||||
0:7 Branch: Return with expression
|
||||
0:7 add ( temp float)
|
||||
0:7 add ( temp float)
|
||||
0:7 add ( temp float)
|
||||
0:7 indirect index ( temp float)
|
||||
0:7 Constant:
|
||||
0:7 1.000000
|
||||
0:7 2.000000
|
||||
0:7 3.000000
|
||||
0:7 Convert float to uint ( temp uint)
|
||||
0:7 'input' ( in float)
|
||||
0:7 Constant:
|
||||
0:7 3.000000
|
||||
0:7 Constant:
|
||||
0:7 2.000000
|
||||
0:7 Constant:
|
||||
0:7 1.000000
|
||||
0:4 Function Definition: main( ( temp void)
|
||||
0:4 Function Parameters:
|
||||
0:? Sequence
|
||||
0:4 move second child to first child ( temp float)
|
||||
0:? 'input' ( temp float)
|
||||
0:? 'input' (layout( location=0) in float)
|
||||
0:4 move second child to first child ( temp float)
|
||||
0:? '@entryPointOutput' (layout( location=0) out float)
|
||||
0:4 Function Call: @main(f1; ( temp float)
|
||||
0:? 'input' ( temp float)
|
||||
0:? Linker Objects
|
||||
0:? 'array' ( const 3-element array of float)
|
||||
0:? 1.000000
|
||||
0:? 2.000000
|
||||
0:? 3.000000
|
||||
0:? '@entryPointOutput' (layout( location=0) out float)
|
||||
0:? 'input' (layout( location=0) in float)
|
||||
|
||||
|
||||
Linked fragment stage:
|
||||
|
||||
|
||||
Shader version: 450
|
||||
gl_FragCoord origin is upper left
|
||||
0:? Sequence
|
||||
0:4 Function Definition: @main(f1; ( temp float)
|
||||
0:4 Function Parameters:
|
||||
0:4 'input' ( in float)
|
||||
0:? Sequence
|
||||
0:7 Branch: Return with expression
|
||||
0:7 add ( temp float)
|
||||
0:7 add ( temp float)
|
||||
0:7 add ( temp float)
|
||||
0:7 indirect index ( temp float)
|
||||
0:7 Constant:
|
||||
0:7 1.000000
|
||||
0:7 2.000000
|
||||
0:7 3.000000
|
||||
0:7 Convert float to uint ( temp uint)
|
||||
0:7 'input' ( in float)
|
||||
0:7 Constant:
|
||||
0:7 3.000000
|
||||
0:7 Constant:
|
||||
0:7 2.000000
|
||||
0:7 Constant:
|
||||
0:7 1.000000
|
||||
0:4 Function Definition: main( ( temp void)
|
||||
0:4 Function Parameters:
|
||||
0:? Sequence
|
||||
0:4 move second child to first child ( temp float)
|
||||
0:? 'input' ( temp float)
|
||||
0:? 'input' (layout( location=0) in float)
|
||||
0:4 move second child to first child ( temp float)
|
||||
0:? '@entryPointOutput' (layout( location=0) out float)
|
||||
0:4 Function Call: @main(f1; ( temp float)
|
||||
0:? 'input' ( temp float)
|
||||
0:? Linker Objects
|
||||
0:? 'array' ( const 3-element array of float)
|
||||
0:? 1.000000
|
||||
0:? 2.000000
|
||||
0:? 3.000000
|
||||
0:? '@entryPointOutput' (layout( location=0) out float)
|
||||
0:? 'input' (layout( location=0) in float)
|
||||
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80001
|
||||
// Id's are bound by 39
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 32 35
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Name 4 "main"
|
||||
Name 10 "@main(f1;"
|
||||
Name 9 "input"
|
||||
Name 22 "indexable"
|
||||
Name 30 "input"
|
||||
Name 32 "input"
|
||||
Name 35 "@entryPointOutput"
|
||||
Name 36 "param"
|
||||
Decorate 32(input) Location 0
|
||||
Decorate 35(@entryPointOutput) Location 0
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
7: TypePointer Function 6(float)
|
||||
8: TypeFunction 6(float) 7(ptr)
|
||||
12: TypeInt 32 0
|
||||
13: 12(int) Constant 3
|
||||
14: TypeArray 6(float) 13
|
||||
15: 6(float) Constant 1065353216
|
||||
16: 6(float) Constant 1073741824
|
||||
17: 6(float) Constant 1077936128
|
||||
18: 14 ConstantComposite 15 16 17
|
||||
21: TypePointer Function 14
|
||||
31: TypePointer Input 6(float)
|
||||
32(input): 31(ptr) Variable Input
|
||||
34: TypePointer Output 6(float)
|
||||
35(@entryPointOutput): 34(ptr) Variable Output
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
30(input): 7(ptr) Variable Function
|
||||
36(param): 7(ptr) Variable Function
|
||||
33: 6(float) Load 32(input)
|
||||
Store 30(input) 33
|
||||
37: 6(float) Load 30(input)
|
||||
Store 36(param) 37
|
||||
38: 6(float) FunctionCall 10(@main(f1;) 36(param)
|
||||
Store 35(@entryPointOutput) 38
|
||||
Return
|
||||
FunctionEnd
|
||||
10(@main(f1;): 6(float) Function None 8
|
||||
9(input): 7(ptr) FunctionParameter
|
||||
11: Label
|
||||
22(indexable): 21(ptr) Variable Function
|
||||
19: 6(float) Load 9(input)
|
||||
20: 12(int) ConvertFToU 19
|
||||
Store 22(indexable) 18
|
||||
23: 7(ptr) AccessChain 22(indexable) 20
|
||||
24: 6(float) Load 23
|
||||
25: 6(float) FAdd 24 17
|
||||
26: 6(float) FAdd 25 16
|
||||
27: 6(float) FAdd 26 15
|
||||
ReturnValue 27
|
||||
FunctionEnd
|
||||
Reference in New Issue
Block a user