SPV 1.4: Lookup tables: Use variable initializer and NonWritable...
...when doing a variable lookup on an array of constants.
This commit is contained in:
59
Test/baseResults/spv.1.4.NonWritable.frag.out
Executable file
59
Test/baseResults/spv.1.4.NonWritable.frag.out
Executable file
@@ -0,0 +1,59 @@
|
||||
spv.1.4.NonWritable.frag
|
||||
Validation failed
|
||||
// Module Version 10400
|
||||
// Generated by (magic number): 80007
|
||||
// Id's are bound by 38
|
||||
|
||||
Capability Shader
|
||||
1: ExtInstImport "GLSL.std.450"
|
||||
MemoryModel Logical GLSL450
|
||||
EntryPoint Fragment 4 "main" 8 31
|
||||
ExecutionMode 4 OriginUpperLeft
|
||||
Source GLSL 450
|
||||
Name 4 "main"
|
||||
Name 8 "color"
|
||||
Name 31 "index"
|
||||
Name 34 "indexable"
|
||||
Decorate 8(color) Location 0
|
||||
Decorate 31(index) Flat
|
||||
Decorate 31(index) Location 0
|
||||
Decorate 34(indexable) NonWritable
|
||||
2: TypeVoid
|
||||
3: TypeFunction 2
|
||||
6: TypeFloat 32
|
||||
7: TypePointer Output 6(float)
|
||||
8(color): 7(ptr) Variable Output
|
||||
9: TypeInt 32 0
|
||||
10: 9(int) Constant 16
|
||||
11: TypeArray 6(float) 10
|
||||
12: 6(float) Constant 1065353216
|
||||
13: 6(float) Constant 1073741824
|
||||
14: 6(float) Constant 1077936128
|
||||
15: 6(float) Constant 1082130432
|
||||
16: 6(float) Constant 1084227584
|
||||
17: 6(float) Constant 1086324736
|
||||
18: 6(float) Constant 1088421888
|
||||
19: 6(float) Constant 1090519040
|
||||
20: 6(float) Constant 1091567616
|
||||
21: 6(float) Constant 1092616192
|
||||
22: 6(float) Constant 1093664768
|
||||
23: 6(float) Constant 1094713344
|
||||
24: 6(float) Constant 1095761920
|
||||
25: 6(float) Constant 1096810496
|
||||
26: 6(float) Constant 1097859072
|
||||
27: 6(float) Constant 1098907648
|
||||
28: 11 ConstantComposite 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
||||
29: TypeInt 32 1
|
||||
30: TypePointer Input 29(int)
|
||||
31(index): 30(ptr) Variable Input
|
||||
33: TypePointer Function 11
|
||||
35: TypePointer Function 6(float)
|
||||
4(main): 2 Function None 3
|
||||
5: Label
|
||||
34(indexable): 33(ptr) Variable Function 28
|
||||
32: 29(int) Load 31(index)
|
||||
36: 35(ptr) AccessChain 34(indexable) 32
|
||||
37: 6(float) Load 36
|
||||
Store 8(color) 37
|
||||
Return
|
||||
FunctionEnd
|
||||
13
Test/spv.1.4.NonWritable.frag
Executable file
13
Test/spv.1.4.NonWritable.frag
Executable file
@@ -0,0 +1,13 @@
|
||||
#version 450
|
||||
|
||||
layout(location = 0) flat in int index;
|
||||
|
||||
layout(location = 0) out float color;
|
||||
|
||||
// lookup table
|
||||
const float table[16] = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16 };
|
||||
|
||||
void main()
|
||||
{
|
||||
color = table[index];
|
||||
}
|
||||
Reference in New Issue
Block a user