Updated glslang.

This commit is contained in:
Branimir Karadžić
2017-04-14 21:17:34 -07:00
parent c7ce95280c
commit cd8d2e9452
29 changed files with 2071 additions and 514 deletions

View File

@@ -39,5 +39,6 @@ static const char* const E_SPV_KHR_subgroup_vote = "SPV_KHR_subgroup_vo
static const char* const E_SPV_KHR_device_group = "SPV_KHR_device_group";
static const char* const E_SPV_KHR_multiview = "SPV_KHR_multiview";
static const char* const E_SPV_KHR_shader_draw_parameters = "SPV_KHR_shader_draw_parameters";
static const char* const E_SPV_KHR_16bit_storage = "SPV_KHR_16bit_storage";
#endif // #ifndef GLSLextKHR_H

View File

@@ -2074,6 +2074,24 @@ spv::Id TGlslangToSpvTraverser::createSpvVariable(const glslang::TIntermSymbol*
spv::StorageClass storageClass = TranslateStorageClass(node->getType());
spv::Id spvType = convertGlslangToSpvType(node->getType());
#ifdef AMD_EXTENSIONS
const bool contains16BitType = node->getType().containsBasicType(glslang::EbtFloat16);
if (contains16BitType) {
if (storageClass == spv::StorageClassInput || storageClass == spv::StorageClassOutput) {
builder.addExtension(spv::E_SPV_KHR_16bit_storage);
builder.addCapability(spv::CapabilityStorageInputOutput16);
} else if (storageClass == spv::StorageClassPushConstant) {
builder.addExtension(spv::E_SPV_KHR_16bit_storage);
builder.addCapability(spv::CapabilityStoragePushConstant16);
} else if (storageClass == spv::StorageClassUniform) {
builder.addExtension(spv::E_SPV_KHR_16bit_storage);
builder.addCapability(spv::CapabilityStorageUniform16);
if (node->getType().getQualifier().storage == glslang::EvqBuffer)
builder.addCapability(spv::CapabilityStorageUniformBufferBlock16);
}
}
#endif
const char* name = node->getName().c_str();
if (glslang::IsAnonymous(name))
name = "";

View File

@@ -830,6 +830,11 @@ const char* CapabilityString(int info)
case 4427: return "DrawParameters";
case 4431: return "SubgroupVoteKHR";
case 4433: return "StorageUniformBufferBlock16";
case 4434: return "StorageUniform16";
case 4435: return "StoragePushConstant16";
case 4436: return "StorageInputOutput16";
case 4437: return "DeviceGroup";
case 4439: return "MultiView";

View File

@@ -179,7 +179,7 @@ ERROR: node is still EOpNull!
0:83 Constant:
0:83 2147483647 (const int)
0:84 Constant:
0:84 inf
0:84 +1.#INF
0:88 Constant:
0:88 2 (const uint)
0:88 3 (const uint)

View File

@@ -0,0 +1,363 @@
hlsl.boolConv.vert
Shader version: 500
0:? Sequence
0:1 Sequence
0:1 move second child to first child ( temp bool)
0:1 'b' ( global bool)
0:1 Constant:
0:1 true (const bool)
0:3 Function Definition: @main( ( temp 4-component vector of float)
0:3 Function Parameters:
0:? Sequence
0:4 Sequence
0:4 move second child to first child ( temp int)
0:4 'r' ( temp int)
0:4 Constant:
0:4 0 (const int)
0:6 add second child into first child ( temp int)
0:6 'r' ( temp int)
0:6 Convert bool to int ( temp int)
0:6 add ( temp bool)
0:6 Convert bool to int ( temp int)
0:6 'a' ( global bool)
0:6 Convert bool to int ( temp int)
0:6 'b' ( global bool)
0:7 add second child into first child ( temp int)
0:7 'r' ( temp int)
0:7 Convert bool to int ( temp int)
0:7 subtract ( temp bool)
0:7 Convert bool to int ( temp int)
0:7 'a' ( global bool)
0:7 Convert bool to int ( temp int)
0:7 'b' ( global bool)
0:8 add second child into first child ( temp int)
0:8 'r' ( temp int)
0:8 Convert bool to int ( temp int)
0:8 component-wise multiply ( temp bool)
0:8 Convert bool to int ( temp int)
0:8 'a' ( global bool)
0:8 Convert bool to int ( temp int)
0:8 'b' ( global bool)
0:9 add second child into first child ( temp int)
0:9 'r' ( temp int)
0:9 Convert bool to int ( temp int)
0:9 divide ( temp bool)
0:9 Convert bool to int ( temp int)
0:9 'a' ( global bool)
0:9 Convert bool to int ( temp int)
0:9 'b' ( global bool)
0:10 add second child into first child ( temp int)
0:10 'r' ( temp int)
0:10 Convert bool to int ( temp int)
0:10 mod ( temp bool)
0:10 Convert bool to int ( temp int)
0:10 'a' ( global bool)
0:10 Convert bool to int ( temp int)
0:10 'b' ( global bool)
0:12 add second child into first child ( temp int)
0:12 'r' ( temp int)
0:12 Convert bool to int ( temp int)
0:12 bitwise and ( temp bool)
0:12 Convert bool to int ( temp int)
0:12 'a' ( global bool)
0:12 Convert bool to int ( temp int)
0:12 'b' ( global bool)
0:13 add second child into first child ( temp int)
0:13 'r' ( temp int)
0:13 Convert bool to int ( temp int)
0:13 inclusive-or ( temp bool)
0:13 Convert bool to int ( temp int)
0:13 'a' ( global bool)
0:13 Convert bool to int ( temp int)
0:13 'b' ( global bool)
0:14 add second child into first child ( temp int)
0:14 'r' ( temp int)
0:14 Convert bool to int ( temp int)
0:14 exclusive-or ( temp bool)
0:14 Convert bool to int ( temp int)
0:14 'a' ( global bool)
0:14 Convert bool to int ( temp int)
0:14 'b' ( global bool)
0:16 add second child into first child ( temp int)
0:16 'r' ( temp int)
0:16 Convert bool to int ( temp int)
0:16 left-shift ( temp bool)
0:16 Convert bool to int ( temp int)
0:16 'a' ( global bool)
0:16 Convert bool to int ( temp int)
0:16 'b' ( global bool)
0:17 add second child into first child ( temp int)
0:17 'r' ( temp int)
0:17 Convert bool to int ( temp int)
0:17 right-shift ( temp bool)
0:17 Convert bool to int ( temp int)
0:17 'a' ( global bool)
0:17 Convert bool to int ( temp int)
0:17 'b' ( global bool)
0:19 Branch: Return with expression
0:19 Construct vec4 ( temp 4-component vector of float)
0:19 Convert int to float ( temp float)
0:19 'r' ( temp int)
0:3 Function Definition: main( ( temp void)
0:3 Function Parameters:
0:? Sequence
0:3 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' ( out 4-component vector of float Position)
0:3 Function Call: @main( ( temp 4-component vector of float)
0:? Linker Objects
0:? 'a' ( global bool)
0:? 'b' ( global bool)
0:? '@entryPointOutput' ( out 4-component vector of float Position)
Linked vertex stage:
Shader version: 500
0:? Sequence
0:1 Sequence
0:1 move second child to first child ( temp bool)
0:1 'b' ( global bool)
0:1 Constant:
0:1 true (const bool)
0:3 Function Definition: @main( ( temp 4-component vector of float)
0:3 Function Parameters:
0:? Sequence
0:4 Sequence
0:4 move second child to first child ( temp int)
0:4 'r' ( temp int)
0:4 Constant:
0:4 0 (const int)
0:6 add second child into first child ( temp int)
0:6 'r' ( temp int)
0:6 Convert bool to int ( temp int)
0:6 add ( temp bool)
0:6 Convert bool to int ( temp int)
0:6 'a' ( global bool)
0:6 Convert bool to int ( temp int)
0:6 'b' ( global bool)
0:7 add second child into first child ( temp int)
0:7 'r' ( temp int)
0:7 Convert bool to int ( temp int)
0:7 subtract ( temp bool)
0:7 Convert bool to int ( temp int)
0:7 'a' ( global bool)
0:7 Convert bool to int ( temp int)
0:7 'b' ( global bool)
0:8 add second child into first child ( temp int)
0:8 'r' ( temp int)
0:8 Convert bool to int ( temp int)
0:8 component-wise multiply ( temp bool)
0:8 Convert bool to int ( temp int)
0:8 'a' ( global bool)
0:8 Convert bool to int ( temp int)
0:8 'b' ( global bool)
0:9 add second child into first child ( temp int)
0:9 'r' ( temp int)
0:9 Convert bool to int ( temp int)
0:9 divide ( temp bool)
0:9 Convert bool to int ( temp int)
0:9 'a' ( global bool)
0:9 Convert bool to int ( temp int)
0:9 'b' ( global bool)
0:10 add second child into first child ( temp int)
0:10 'r' ( temp int)
0:10 Convert bool to int ( temp int)
0:10 mod ( temp bool)
0:10 Convert bool to int ( temp int)
0:10 'a' ( global bool)
0:10 Convert bool to int ( temp int)
0:10 'b' ( global bool)
0:12 add second child into first child ( temp int)
0:12 'r' ( temp int)
0:12 Convert bool to int ( temp int)
0:12 bitwise and ( temp bool)
0:12 Convert bool to int ( temp int)
0:12 'a' ( global bool)
0:12 Convert bool to int ( temp int)
0:12 'b' ( global bool)
0:13 add second child into first child ( temp int)
0:13 'r' ( temp int)
0:13 Convert bool to int ( temp int)
0:13 inclusive-or ( temp bool)
0:13 Convert bool to int ( temp int)
0:13 'a' ( global bool)
0:13 Convert bool to int ( temp int)
0:13 'b' ( global bool)
0:14 add second child into first child ( temp int)
0:14 'r' ( temp int)
0:14 Convert bool to int ( temp int)
0:14 exclusive-or ( temp bool)
0:14 Convert bool to int ( temp int)
0:14 'a' ( global bool)
0:14 Convert bool to int ( temp int)
0:14 'b' ( global bool)
0:16 add second child into first child ( temp int)
0:16 'r' ( temp int)
0:16 Convert bool to int ( temp int)
0:16 left-shift ( temp bool)
0:16 Convert bool to int ( temp int)
0:16 'a' ( global bool)
0:16 Convert bool to int ( temp int)
0:16 'b' ( global bool)
0:17 add second child into first child ( temp int)
0:17 'r' ( temp int)
0:17 Convert bool to int ( temp int)
0:17 right-shift ( temp bool)
0:17 Convert bool to int ( temp int)
0:17 'a' ( global bool)
0:17 Convert bool to int ( temp int)
0:17 'b' ( global bool)
0:19 Branch: Return with expression
0:19 Construct vec4 ( temp 4-component vector of float)
0:19 Convert int to float ( temp float)
0:19 'r' ( temp int)
0:3 Function Definition: main( ( temp void)
0:3 Function Parameters:
0:? Sequence
0:3 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' ( out 4-component vector of float Position)
0:3 Function Call: @main( ( temp 4-component vector of float)
0:? Linker Objects
0:? 'a' ( global bool)
0:? 'b' ( global bool)
0:? '@entryPointOutput' ( out 4-component vector of float Position)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 109
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 107
Source HLSL 500
Name 4 "main"
Name 9 "@main("
Name 13 "b"
Name 17 "r"
Name 19 "a"
Name 107 "@entryPointOutput"
Decorate 107(@entryPointOutput) BuiltIn Position
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypeFunction 7(fvec4)
11: TypeBool
12: TypePointer Private 11(bool)
13(b): 12(ptr) Variable Private
14: 11(bool) ConstantTrue
15: TypeInt 32 1
16: TypePointer Function 15(int)
18: 15(int) Constant 0
19(a): 12(ptr) Variable Private
21: 15(int) Constant 1
106: TypePointer Output 7(fvec4)
107(@entryPointOutput): 106(ptr) Variable Output
4(main): 2 Function None 3
5: Label
Store 13(b) 14
108: 7(fvec4) FunctionCall 9(@main()
Store 107(@entryPointOutput) 108
Return
FunctionEnd
9(@main(): 7(fvec4) Function None 8
10: Label
17(r): 16(ptr) Variable Function
Store 17(r) 18
20: 11(bool) Load 19(a)
22: 15(int) Select 20 21 18
23: 11(bool) Load 13(b)
24: 15(int) Select 23 21 18
25: 11(bool) IAdd 22 24
26: 15(int) Select 25 21 18
27: 15(int) Load 17(r)
28: 15(int) IAdd 27 26
Store 17(r) 28
29: 11(bool) Load 19(a)
30: 15(int) Select 29 21 18
31: 11(bool) Load 13(b)
32: 15(int) Select 31 21 18
33: 11(bool) ISub 30 32
34: 15(int) Select 33 21 18
35: 15(int) Load 17(r)
36: 15(int) IAdd 35 34
Store 17(r) 36
37: 11(bool) Load 19(a)
38: 15(int) Select 37 21 18
39: 11(bool) Load 13(b)
40: 15(int) Select 39 21 18
41: 11(bool) IMul 38 40
42: 15(int) Select 41 21 18
43: 15(int) Load 17(r)
44: 15(int) IAdd 43 42
Store 17(r) 44
45: 11(bool) Load 19(a)
46: 15(int) Select 45 21 18
47: 11(bool) Load 13(b)
48: 15(int) Select 47 21 18
49: 11(bool) SDiv 46 48
50: 15(int) Select 49 21 18
51: 15(int) Load 17(r)
52: 15(int) IAdd 51 50
Store 17(r) 52
53: 11(bool) Load 19(a)
54: 15(int) Select 53 21 18
55: 11(bool) Load 13(b)
56: 15(int) Select 55 21 18
57: 11(bool) SMod 54 56
58: 15(int) Select 57 21 18
59: 15(int) Load 17(r)
60: 15(int) IAdd 59 58
Store 17(r) 60
61: 11(bool) Load 19(a)
62: 15(int) Select 61 21 18
63: 11(bool) Load 13(b)
64: 15(int) Select 63 21 18
65: 11(bool) BitwiseAnd 62 64
66: 15(int) Select 65 21 18
67: 15(int) Load 17(r)
68: 15(int) IAdd 67 66
Store 17(r) 68
69: 11(bool) Load 19(a)
70: 15(int) Select 69 21 18
71: 11(bool) Load 13(b)
72: 15(int) Select 71 21 18
73: 11(bool) BitwiseOr 70 72
74: 15(int) Select 73 21 18
75: 15(int) Load 17(r)
76: 15(int) IAdd 75 74
Store 17(r) 76
77: 11(bool) Load 19(a)
78: 15(int) Select 77 21 18
79: 11(bool) Load 13(b)
80: 15(int) Select 79 21 18
81: 11(bool) BitwiseXor 78 80
82: 15(int) Select 81 21 18
83: 15(int) Load 17(r)
84: 15(int) IAdd 83 82
Store 17(r) 84
85: 11(bool) Load 19(a)
86: 15(int) Select 85 21 18
87: 11(bool) Load 13(b)
88: 15(int) Select 87 21 18
89: 11(bool) ShiftLeftLogical 86 88
90: 15(int) Select 89 21 18
91: 15(int) Load 17(r)
92: 15(int) IAdd 91 90
Store 17(r) 92
93: 11(bool) Load 19(a)
94: 15(int) Select 93 21 18
95: 11(bool) Load 13(b)
96: 15(int) Select 95 21 18
97: 11(bool) ShiftRightArithmetic 94 96
98: 15(int) Select 97 21 18
99: 15(int) Load 17(r)
100: 15(int) IAdd 99 98
Store 17(r) 100
101: 15(int) Load 17(r)
102: 6(float) ConvertSToF 101
103: 7(fvec4) CompositeConstruct 102 102 102 102
ReturnValue 103
FunctionEnd

View File

@@ -0,0 +1,233 @@
hlsl.charLit.vert
Shader version: 500
0:? Sequence
0:2 Function Definition: @main( ( temp 4-component vector of float)
0:2 Function Parameters:
0:? Sequence
0:3 Sequence
0:3 move second child to first child ( temp uint)
0:3 'a1' ( temp uint)
0:3 Constant:
0:3 65 (const uint)
0:4 Sequence
0:4 move second child to first child ( temp int)
0:4 'a2' ( temp int)
0:4 Constant:
0:4 48 (const int)
0:6 Sequence
0:6 move second child to first child ( temp int)
0:6 'a3' ( temp int)
0:6 Constant:
0:6 7 (const int)
0:7 add second child into first child ( temp int)
0:7 'a3' ( temp int)
0:7 Constant:
0:7 8 (const int)
0:8 add second child into first child ( temp int)
0:8 'a3' ( temp int)
0:8 Constant:
0:8 9 (const int)
0:9 add second child into first child ( temp int)
0:9 'a3' ( temp int)
0:9 Constant:
0:9 10 (const int)
0:10 add second child into first child ( temp int)
0:10 'a3' ( temp int)
0:10 Constant:
0:10 11 (const int)
0:11 add second child into first child ( temp int)
0:11 'a3' ( temp int)
0:11 Constant:
0:11 12 (const int)
0:12 add second child into first child ( temp int)
0:12 'a3' ( temp int)
0:12 Constant:
0:12 13 (const int)
0:14 Sequence
0:14 move second child to first child ( temp int)
0:14 'a10' ( temp int)
0:14 Constant:
0:14 99 (const int)
0:16 Branch: Return with expression
0:16 Construct vec4 ( temp 4-component vector of float)
0:16 Convert uint to float ( temp float)
0:16 add ( temp uint)
0:16 add ( temp uint)
0:16 add ( temp uint)
0:16 'a1' ( temp uint)
0:16 Convert int to uint ( temp uint)
0:16 'a2' ( temp int)
0:16 Convert int to uint ( temp uint)
0:16 'a3' ( temp int)
0:16 Convert int to uint ( temp uint)
0:16 'a10' ( temp int)
0:2 Function Definition: main( ( temp void)
0:2 Function Parameters:
0:? Sequence
0:2 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' ( out 4-component vector of float Position)
0:2 Function Call: @main( ( temp 4-component vector of float)
0:? Linker Objects
0:? '@entryPointOutput' ( out 4-component vector of float Position)
Linked vertex stage:
Shader version: 500
0:? Sequence
0:2 Function Definition: @main( ( temp 4-component vector of float)
0:2 Function Parameters:
0:? Sequence
0:3 Sequence
0:3 move second child to first child ( temp uint)
0:3 'a1' ( temp uint)
0:3 Constant:
0:3 65 (const uint)
0:4 Sequence
0:4 move second child to first child ( temp int)
0:4 'a2' ( temp int)
0:4 Constant:
0:4 48 (const int)
0:6 Sequence
0:6 move second child to first child ( temp int)
0:6 'a3' ( temp int)
0:6 Constant:
0:6 7 (const int)
0:7 add second child into first child ( temp int)
0:7 'a3' ( temp int)
0:7 Constant:
0:7 8 (const int)
0:8 add second child into first child ( temp int)
0:8 'a3' ( temp int)
0:8 Constant:
0:8 9 (const int)
0:9 add second child into first child ( temp int)
0:9 'a3' ( temp int)
0:9 Constant:
0:9 10 (const int)
0:10 add second child into first child ( temp int)
0:10 'a3' ( temp int)
0:10 Constant:
0:10 11 (const int)
0:11 add second child into first child ( temp int)
0:11 'a3' ( temp int)
0:11 Constant:
0:11 12 (const int)
0:12 add second child into first child ( temp int)
0:12 'a3' ( temp int)
0:12 Constant:
0:12 13 (const int)
0:14 Sequence
0:14 move second child to first child ( temp int)
0:14 'a10' ( temp int)
0:14 Constant:
0:14 99 (const int)
0:16 Branch: Return with expression
0:16 Construct vec4 ( temp 4-component vector of float)
0:16 Convert uint to float ( temp float)
0:16 add ( temp uint)
0:16 add ( temp uint)
0:16 add ( temp uint)
0:16 'a1' ( temp uint)
0:16 Convert int to uint ( temp uint)
0:16 'a2' ( temp int)
0:16 Convert int to uint ( temp uint)
0:16 'a3' ( temp int)
0:16 Convert int to uint ( temp uint)
0:16 'a10' ( temp int)
0:2 Function Definition: main( ( temp void)
0:2 Function Parameters:
0:? Sequence
0:2 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' ( out 4-component vector of float Position)
0:2 Function Call: @main( ( temp 4-component vector of float)
0:? Linker Objects
0:? '@entryPointOutput' ( out 4-component vector of float Position)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 58
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 56
Source HLSL 500
Name 4 "main"
Name 9 "@main("
Name 13 "a1"
Name 17 "a2"
Name 19 "a3"
Name 39 "a10"
Name 56 "@entryPointOutput"
Decorate 56(@entryPointOutput) BuiltIn Position
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypeFunction 7(fvec4)
11: TypeInt 32 0
12: TypePointer Function 11(int)
14: 11(int) Constant 65
15: TypeInt 32 1
16: TypePointer Function 15(int)
18: 15(int) Constant 48
20: 15(int) Constant 7
21: 15(int) Constant 8
24: 15(int) Constant 9
27: 15(int) Constant 10
30: 15(int) Constant 11
33: 15(int) Constant 12
36: 15(int) Constant 13
40: 15(int) Constant 99
55: TypePointer Output 7(fvec4)
56(@entryPointOutput): 55(ptr) Variable Output
4(main): 2 Function None 3
5: Label
57: 7(fvec4) FunctionCall 9(@main()
Store 56(@entryPointOutput) 57
Return
FunctionEnd
9(@main(): 7(fvec4) Function None 8
10: Label
13(a1): 12(ptr) Variable Function
17(a2): 16(ptr) Variable Function
19(a3): 16(ptr) Variable Function
39(a10): 16(ptr) Variable Function
Store 13(a1) 14
Store 17(a2) 18
Store 19(a3) 20
22: 15(int) Load 19(a3)
23: 15(int) IAdd 22 21
Store 19(a3) 23
25: 15(int) Load 19(a3)
26: 15(int) IAdd 25 24
Store 19(a3) 26
28: 15(int) Load 19(a3)
29: 15(int) IAdd 28 27
Store 19(a3) 29
31: 15(int) Load 19(a3)
32: 15(int) IAdd 31 30
Store 19(a3) 32
34: 15(int) Load 19(a3)
35: 15(int) IAdd 34 33
Store 19(a3) 35
37: 15(int) Load 19(a3)
38: 15(int) IAdd 37 36
Store 19(a3) 38
Store 39(a10) 40
41: 11(int) Load 13(a1)
42: 15(int) Load 17(a2)
43: 11(int) Bitcast 42
44: 11(int) IAdd 41 43
45: 15(int) Load 19(a3)
46: 11(int) Bitcast 45
47: 11(int) IAdd 44 46
48: 15(int) Load 39(a10)
49: 11(int) Bitcast 48
50: 11(int) IAdd 47 49
51: 6(float) ConvertUToF 50
52: 7(fvec4) CompositeConstruct 51 51 51 51
ReturnValue 52
FunctionEnd

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,172 @@
hlsl.inf.vert
Shader version: 500
0:? Sequence
0:2 Function Definition: @main( ( temp 4-component vector of float)
0:2 Function Parameters:
0:? Sequence
0:3 Sequence
0:3 move second child to first child ( temp float)
0:3 'f1' ( temp float)
0:3 Constant:
0:3 -1.#INF
0:4 Sequence
0:4 move second child to first child ( temp float)
0:4 'f2' ( temp float)
0:4 Constant:
0:4 +1.#INF
0:5 Sequence
0:5 move second child to first child ( temp float)
0:5 'f3' ( temp float)
0:5 Constant:
0:5 +1.#INF
0:6 Sequence
0:6 move second child to first child ( temp float)
0:6 'f4' ( temp float)
0:6 add ( temp float)
0:6 component-wise multiply ( temp float)
0:6 'f2' ( temp float)
0:6 Constant:
0:6 +1.#INF
0:6 Constant:
0:6 +1.#INF
0:10 Branch: Return with expression
0:10 Construct vec4 ( temp 4-component vector of float)
0:10 add ( temp float)
0:10 add ( temp float)
0:10 add ( temp float)
0:10 add ( temp float)
0:10 add ( temp float)
0:10 'f1' ( temp float)
0:10 'f2' ( temp float)
0:10 'f3' ( temp float)
0:10 'f4' ( temp float)
0:10 Constant:
0:10 -1.#INF
0:10 Constant:
0:10 1.#IND
0:2 Function Definition: main( ( temp void)
0:2 Function Parameters:
0:? Sequence
0:2 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' ( out 4-component vector of float Position)
0:2 Function Call: @main( ( temp 4-component vector of float)
0:? Linker Objects
0:? '@entryPointOutput' ( out 4-component vector of float Position)
Linked vertex stage:
Shader version: 500
0:? Sequence
0:2 Function Definition: @main( ( temp 4-component vector of float)
0:2 Function Parameters:
0:? Sequence
0:3 Sequence
0:3 move second child to first child ( temp float)
0:3 'f1' ( temp float)
0:3 Constant:
0:3 -1.#INF
0:4 Sequence
0:4 move second child to first child ( temp float)
0:4 'f2' ( temp float)
0:4 Constant:
0:4 +1.#INF
0:5 Sequence
0:5 move second child to first child ( temp float)
0:5 'f3' ( temp float)
0:5 Constant:
0:5 +1.#INF
0:6 Sequence
0:6 move second child to first child ( temp float)
0:6 'f4' ( temp float)
0:6 add ( temp float)
0:6 component-wise multiply ( temp float)
0:6 'f2' ( temp float)
0:6 Constant:
0:6 +1.#INF
0:6 Constant:
0:6 +1.#INF
0:10 Branch: Return with expression
0:10 Construct vec4 ( temp 4-component vector of float)
0:10 add ( temp float)
0:10 add ( temp float)
0:10 add ( temp float)
0:10 add ( temp float)
0:10 add ( temp float)
0:10 'f1' ( temp float)
0:10 'f2' ( temp float)
0:10 'f3' ( temp float)
0:10 'f4' ( temp float)
0:10 Constant:
0:10 -1.#INF
0:10 Constant:
0:10 1.#IND
0:2 Function Definition: main( ( temp void)
0:2 Function Parameters:
0:? Sequence
0:2 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' ( out 4-component vector of float Position)
0:2 Function Call: @main( ( temp 4-component vector of float)
0:? Linker Objects
0:? '@entryPointOutput' ( out 4-component vector of float Position)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 37
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Vertex 4 "main" 35
Source HLSL 500
Name 4 "main"
Name 9 "@main("
Name 12 "f1"
Name 14 "f2"
Name 16 "f3"
Name 17 "f4"
Name 35 "@entryPointOutput"
Decorate 35(@entryPointOutput) BuiltIn Position
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypeFunction 7(fvec4)
11: TypePointer Function 6(float)
13: 6(float) Constant 4286578688
15: 6(float) Constant 2139095040
29: 6(float) Constant 4290772992
34: TypePointer Output 7(fvec4)
35(@entryPointOutput): 34(ptr) Variable Output
4(main): 2 Function None 3
5: Label
36: 7(fvec4) FunctionCall 9(@main()
Store 35(@entryPointOutput) 36
Return
FunctionEnd
9(@main(): 7(fvec4) Function None 8
10: Label
12(f1): 11(ptr) Variable Function
14(f2): 11(ptr) Variable Function
16(f3): 11(ptr) Variable Function
17(f4): 11(ptr) Variable Function
Store 12(f1) 13
Store 14(f2) 15
Store 16(f3) 15
18: 6(float) Load 14(f2)
19: 6(float) FMul 18 15
20: 6(float) FAdd 19 15
Store 17(f4) 20
21: 6(float) Load 12(f1)
22: 6(float) Load 14(f2)
23: 6(float) FAdd 21 22
24: 6(float) Load 16(f3)
25: 6(float) FAdd 23 24
26: 6(float) Load 17(f4)
27: 6(float) FAdd 25 26
28: 6(float) FAdd 27 13
30: 6(float) FAdd 28 29
31: 7(fvec4) CompositeConstruct 30 30 30 30
ReturnValue 31
FunctionEnd

View File

@@ -2,37 +2,85 @@ hlsl.isfinite.frag
Shader version: 500
gl_FragCoord origin is upper left
0:? Sequence
0:5 Function Definition: @main( ( temp 4-component vector of float)
0:5 Function Parameters:
0:7 Function Definition: test1(f1; ( temp bool)
0:7 Function Parameters:
0:7 'v' ( in float)
0:? Sequence
0:6 Sequence
0:6 move second child to first child ( temp float)
0:6 '@finitetmp' ( temp float)
0:6 f: direct index for structure ( uniform float)
0:6 'anon@0' (layout( row_major std140) uniform block{ uniform float f})
0:6 Constant:
0:6 0 (const uint)
0:6 logical-and ( temp bool)
0:6 Negate conditional ( temp bool)
0:6 isnan ( temp bool)
0:6 '@finitetmp' ( temp float)
0:6 Negate conditional ( temp bool)
0:6 isinf ( temp bool)
0:6 '@finitetmp' ( temp float)
0:8 Branch: Return with expression
0:8 Constant:
0:8 0.000000
0:8 0.000000
0:8 0.000000
0:8 0.000000
0:5 Function Definition: main( ( temp void)
0:5 Function Parameters:
0:8 logical-and ( temp bool)
0:8 Negate conditional ( temp bool)
0:8 isnan ( temp bool)
0:8 'v' ( in float)
0:8 Sequence
0:8 move second child to first child ( temp float)
0:8 '@finitetmp' ( temp float)
0:8 'v' ( in float)
0:8 logical-and ( temp bool)
0:8 Negate conditional ( temp bool)
0:8 isnan ( temp bool)
0:8 '@finitetmp' ( temp float)
0:8 Negate conditional ( temp bool)
0:8 isinf ( temp bool)
0:8 '@finitetmp' ( temp float)
0:12 Function Definition: @main( ( temp 4-component vector of float)
0:12 Function Parameters:
0:? Sequence
0:5 move second child to first child ( temp 4-component vector of float)
0:13 Sequence
0:13 move second child to first child ( temp float)
0:13 '@finitetmp' ( temp float)
0:13 f: direct index for structure ( uniform float)
0:13 'anon@0' (layout( row_major std140) uniform block{ uniform float f, uniform 2-component vector of float f2, uniform 3-component vector of float f3})
0:13 Constant:
0:13 0 (const uint)
0:13 logical-and ( temp bool)
0:13 Negate conditional ( temp bool)
0:13 isnan ( temp bool)
0:13 '@finitetmp' ( temp float)
0:13 Negate conditional ( temp bool)
0:13 isinf ( temp bool)
0:13 '@finitetmp' ( temp float)
0:14 Sequence
0:14 move second child to first child ( temp 2-component vector of float)
0:14 '@finitetmp' ( temp 2-component vector of float)
0:14 f2: direct index for structure ( uniform 2-component vector of float)
0:14 'anon@0' (layout( row_major std140) uniform block{ uniform float f, uniform 2-component vector of float f2, uniform 3-component vector of float f3})
0:14 Constant:
0:14 1 (const uint)
0:14 logical-and ( temp 2-component vector of bool)
0:14 Negate conditional ( temp 2-component vector of bool)
0:14 isnan ( temp 2-component vector of bool)
0:14 '@finitetmp' ( temp 2-component vector of float)
0:14 Negate conditional ( temp 2-component vector of bool)
0:14 isinf ( temp 2-component vector of bool)
0:14 '@finitetmp' ( temp 2-component vector of float)
0:15 Sequence
0:15 move second child to first child ( temp 3-component vector of float)
0:15 '@finitetmp' ( temp 3-component vector of float)
0:15 f3: direct index for structure ( uniform 3-component vector of float)
0:15 'anon@0' (layout( row_major std140) uniform block{ uniform float f, uniform 2-component vector of float f2, uniform 3-component vector of float f3})
0:15 Constant:
0:15 2 (const uint)
0:15 logical-and ( temp 3-component vector of bool)
0:15 Negate conditional ( temp 3-component vector of bool)
0:15 isnan ( temp 3-component vector of bool)
0:15 '@finitetmp' ( temp 3-component vector of float)
0:15 Negate conditional ( temp 3-component vector of bool)
0:15 isinf ( temp 3-component vector of bool)
0:15 '@finitetmp' ( temp 3-component vector of float)
0:17 Branch: Return with expression
0:17 Constant:
0:17 0.000000
0:17 0.000000
0:17 0.000000
0:17 0.000000
0:12 Function Definition: main( ( temp void)
0:12 Function Parameters:
0:? Sequence
0:12 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:5 Function Call: @main( ( temp 4-component vector of float)
0:12 Function Call: @main( ( temp 4-component vector of float)
0:? Linker Objects
0:? 'anon@0' (layout( row_major std140) uniform block{ uniform float f})
0:? 'anon@0' (layout( row_major std140) uniform block{ uniform float f, uniform 2-component vector of float f2, uniform 3-component vector of float f3})
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
@@ -42,100 +90,229 @@ Linked fragment stage:
Shader version: 500
gl_FragCoord origin is upper left
0:? Sequence
0:5 Function Definition: @main( ( temp 4-component vector of float)
0:5 Function Parameters:
0:7 Function Definition: test1(f1; ( temp bool)
0:7 Function Parameters:
0:7 'v' ( in float)
0:? Sequence
0:6 Sequence
0:6 move second child to first child ( temp float)
0:6 '@finitetmp' ( temp float)
0:6 f: direct index for structure ( uniform float)
0:6 'anon@0' (layout( row_major std140) uniform block{ uniform float f})
0:6 Constant:
0:6 0 (const uint)
0:6 logical-and ( temp bool)
0:6 Negate conditional ( temp bool)
0:6 isnan ( temp bool)
0:6 '@finitetmp' ( temp float)
0:6 Negate conditional ( temp bool)
0:6 isinf ( temp bool)
0:6 '@finitetmp' ( temp float)
0:8 Branch: Return with expression
0:8 Constant:
0:8 0.000000
0:8 0.000000
0:8 0.000000
0:8 0.000000
0:5 Function Definition: main( ( temp void)
0:5 Function Parameters:
0:8 logical-and ( temp bool)
0:8 Negate conditional ( temp bool)
0:8 isnan ( temp bool)
0:8 'v' ( in float)
0:8 Sequence
0:8 move second child to first child ( temp float)
0:8 '@finitetmp' ( temp float)
0:8 'v' ( in float)
0:8 logical-and ( temp bool)
0:8 Negate conditional ( temp bool)
0:8 isnan ( temp bool)
0:8 '@finitetmp' ( temp float)
0:8 Negate conditional ( temp bool)
0:8 isinf ( temp bool)
0:8 '@finitetmp' ( temp float)
0:12 Function Definition: @main( ( temp 4-component vector of float)
0:12 Function Parameters:
0:? Sequence
0:5 move second child to first child ( temp 4-component vector of float)
0:13 Sequence
0:13 move second child to first child ( temp float)
0:13 '@finitetmp' ( temp float)
0:13 f: direct index for structure ( uniform float)
0:13 'anon@0' (layout( row_major std140) uniform block{ uniform float f, uniform 2-component vector of float f2, uniform 3-component vector of float f3})
0:13 Constant:
0:13 0 (const uint)
0:13 logical-and ( temp bool)
0:13 Negate conditional ( temp bool)
0:13 isnan ( temp bool)
0:13 '@finitetmp' ( temp float)
0:13 Negate conditional ( temp bool)
0:13 isinf ( temp bool)
0:13 '@finitetmp' ( temp float)
0:14 Sequence
0:14 move second child to first child ( temp 2-component vector of float)
0:14 '@finitetmp' ( temp 2-component vector of float)
0:14 f2: direct index for structure ( uniform 2-component vector of float)
0:14 'anon@0' (layout( row_major std140) uniform block{ uniform float f, uniform 2-component vector of float f2, uniform 3-component vector of float f3})
0:14 Constant:
0:14 1 (const uint)
0:14 logical-and ( temp 2-component vector of bool)
0:14 Negate conditional ( temp 2-component vector of bool)
0:14 isnan ( temp 2-component vector of bool)
0:14 '@finitetmp' ( temp 2-component vector of float)
0:14 Negate conditional ( temp 2-component vector of bool)
0:14 isinf ( temp 2-component vector of bool)
0:14 '@finitetmp' ( temp 2-component vector of float)
0:15 Sequence
0:15 move second child to first child ( temp 3-component vector of float)
0:15 '@finitetmp' ( temp 3-component vector of float)
0:15 f3: direct index for structure ( uniform 3-component vector of float)
0:15 'anon@0' (layout( row_major std140) uniform block{ uniform float f, uniform 2-component vector of float f2, uniform 3-component vector of float f3})
0:15 Constant:
0:15 2 (const uint)
0:15 logical-and ( temp 3-component vector of bool)
0:15 Negate conditional ( temp 3-component vector of bool)
0:15 isnan ( temp 3-component vector of bool)
0:15 '@finitetmp' ( temp 3-component vector of float)
0:15 Negate conditional ( temp 3-component vector of bool)
0:15 isinf ( temp 3-component vector of bool)
0:15 '@finitetmp' ( temp 3-component vector of float)
0:17 Branch: Return with expression
0:17 Constant:
0:17 0.000000
0:17 0.000000
0:17 0.000000
0:17 0.000000
0:12 Function Definition: main( ( temp void)
0:12 Function Parameters:
0:? Sequence
0:12 move second child to first child ( temp 4-component vector of float)
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
0:5 Function Call: @main( ( temp 4-component vector of float)
0:12 Function Call: @main( ( temp 4-component vector of float)
0:? Linker Objects
0:? 'anon@0' (layout( row_major std140) uniform block{ uniform float f})
0:? 'anon@0' (layout( row_major std140) uniform block{ uniform float f, uniform 2-component vector of float f2, uniform 3-component vector of float f3})
0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float)
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 38
// Id's are bound by 95
Capability Shader
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 36
EntryPoint Fragment 4 "main" 93
ExecutionMode 4 OriginUpperLeft
Source HLSL 500
Name 4 "main"
Name 9 "@main("
Name 12 "@finitetmp"
Name 13 "$Global"
MemberName 13($Global) 0 "f"
Name 15 ""
Name 36 "@entryPointOutput"
MemberDecorate 13($Global) 0 Offset 0
Decorate 13($Global) Block
Decorate 15 DescriptorSet 0
Decorate 36(@entryPointOutput) Location 0
Name 11 "test1(f1;"
Name 10 "v"
Name 15 "@main("
Name 22 "@finitetmp"
Name 36 "@finitetmp"
Name 39 "$Global"
MemberName 39($Global) 0 "f"
MemberName 39($Global) 1 "f2"
MemberName 39($Global) 2 "f3"
Name 41 ""
Name 57 "@finitetmp"
Name 73 "@finitetmp"
Name 93 "@entryPointOutput"
MemberDecorate 39($Global) 0 Offset 0
MemberDecorate 39($Global) 1 Offset 8
MemberDecorate 39($Global) 2 Offset 16
Decorate 39($Global) Block
Decorate 41 DescriptorSet 0
Decorate 93(@entryPointOutput) Location 0
2: TypeVoid
3: TypeFunction 2
6: TypeFloat 32
7: TypeVector 6(float) 4
8: TypeFunction 7(fvec4)
11: TypePointer Function 6(float)
13($Global): TypeStruct 6(float)
14: TypePointer Uniform 13($Global)
15: 14(ptr) Variable Uniform
16: TypeInt 32 1
17: 16(int) Constant 0
18: TypePointer Uniform 6(float)
21: TypeBool
31: 6(float) Constant 0
32: 7(fvec4) ConstantComposite 31 31 31 31
35: TypePointer Output 7(fvec4)
36(@entryPointOutput): 35(ptr) Variable Output
7: TypePointer Function 6(float)
8: TypeBool
9: TypeFunction 8(bool) 7(ptr)
13: TypeVector 6(float) 4
14: TypeFunction 13(fvec4)
37: TypeVector 6(float) 2
38: TypeVector 6(float) 3
39($Global): TypeStruct 6(float) 37(fvec2) 38(fvec3)
40: TypePointer Uniform 39($Global)
41: 40(ptr) Variable Uniform
42: TypeInt 32 1
43: 42(int) Constant 0
44: TypePointer Uniform 6(float)
56: TypePointer Function 37(fvec2)
58: 42(int) Constant 1
59: TypePointer Uniform 37(fvec2)
63: TypeVector 8(bool) 2
72: TypePointer Function 38(fvec3)
74: 42(int) Constant 2
75: TypePointer Uniform 38(fvec3)
79: TypeVector 8(bool) 3
88: 6(float) Constant 0
89: 13(fvec4) ConstantComposite 88 88 88 88
92: TypePointer Output 13(fvec4)
93(@entryPointOutput): 92(ptr) Variable Output
4(main): 2 Function None 3
5: Label
37: 7(fvec4) FunctionCall 9(@main()
Store 36(@entryPointOutput) 37
94: 13(fvec4) FunctionCall 15(@main()
Store 93(@entryPointOutput) 94
Return
FunctionEnd
9(@main(): 7(fvec4) Function None 8
10: Label
12(@finitetmp): 11(ptr) Variable Function
19: 18(ptr) AccessChain 15 17
20: 6(float) Load 19
Store 12(@finitetmp) 20
22: 6(float) Load 12(@finitetmp)
23: 21(bool) IsNan 22
24: 21(bool) LogicalNot 23
SelectionMerge 26 None
BranchConditional 24 25 26
25: Label
27: 6(float) Load 12(@finitetmp)
28: 21(bool) IsInf 27
29: 21(bool) LogicalNot 28
Branch 26
26: Label
30: 21(bool) Phi 24 10 29 25
ReturnValue 32
11(test1(f1;): 8(bool) Function None 9
10(v): 7(ptr) FunctionParameter
12: Label
22(@finitetmp): 7(ptr) Variable Function
17: 6(float) Load 10(v)
18: 8(bool) IsNan 17
19: 8(bool) LogicalNot 18
SelectionMerge 21 None
BranchConditional 19 20 21
20: Label
23: 6(float) Load 10(v)
Store 22(@finitetmp) 23
24: 6(float) Load 22(@finitetmp)
25: 8(bool) IsNan 24
26: 8(bool) LogicalNot 25
SelectionMerge 28 None
BranchConditional 26 27 28
27: Label
29: 6(float) Load 22(@finitetmp)
30: 8(bool) IsInf 29
31: 8(bool) LogicalNot 30
Branch 28
28: Label
32: 8(bool) Phi 26 20 31 27
Branch 21
21: Label
33: 8(bool) Phi 19 12 32 28
ReturnValue 33
FunctionEnd
15(@main(): 13(fvec4) Function None 14
16: Label
36(@finitetmp): 7(ptr) Variable Function
57(@finitetmp): 56(ptr) Variable Function
73(@finitetmp): 72(ptr) Variable Function
45: 44(ptr) AccessChain 41 43
46: 6(float) Load 45
Store 36(@finitetmp) 46
47: 6(float) Load 36(@finitetmp)
48: 8(bool) IsNan 47
49: 8(bool) LogicalNot 48
SelectionMerge 51 None
BranchConditional 49 50 51
50: Label
52: 6(float) Load 36(@finitetmp)
53: 8(bool) IsInf 52
54: 8(bool) LogicalNot 53
Branch 51
51: Label
55: 8(bool) Phi 49 16 54 50
60: 59(ptr) AccessChain 41 58
61: 37(fvec2) Load 60
Store 57(@finitetmp) 61
62: 37(fvec2) Load 57(@finitetmp)
64: 63(bvec2) IsNan 62
65: 63(bvec2) LogicalNot 64
SelectionMerge 67 None
BranchConditional 65 66 67
66: Label
68: 37(fvec2) Load 57(@finitetmp)
69: 63(bvec2) IsInf 68
70: 63(bvec2) LogicalNot 69
Branch 67
67: Label
71: 8(bool) Phi 65 51 70 66
76: 75(ptr) AccessChain 41 74
77: 38(fvec3) Load 76
Store 73(@finitetmp) 77
78: 38(fvec3) Load 73(@finitetmp)
80: 79(bvec3) IsNan 78
81: 79(bvec3) LogicalNot 80
SelectionMerge 83 None
BranchConditional 81 82 83
82: Label
84: 38(fvec3) Load 73(@finitetmp)
85: 79(bvec3) IsInf 84
86: 79(bvec3) LogicalNot 85
Branch 83
83: Label
87: 8(bool) Phi 81 67 86 82
ReturnValue 89
FunctionEnd

View File

@@ -108,8 +108,14 @@ gl_FragCoord origin is upper left
0:29 Construct vec3 ( temp 3-component vector of float)
0:29 Construct float ( temp float)
0:29 'f1' ( temp 1-component vector of float)
0:31 Branch: Return with expression
0:31 'input' ( in 4-component vector of float)
0:33 Branch: Return with expression
0:33 component-wise multiply ( temp 4-component vector of float)
0:33 'input' ( in 4-component vector of float)
0:33 Constant:
0:33 3.000000
0:33 3.000000
0:33 3.000000
0:33 3.000000
0:? Linker Objects
@@ -226,13 +232,19 @@ gl_FragCoord origin is upper left
0:29 Construct vec3 ( temp 3-component vector of float)
0:29 Construct float ( temp float)
0:29 'f1' ( temp 1-component vector of float)
0:31 Branch: Return with expression
0:31 'input' ( in 4-component vector of float)
0:33 Branch: Return with expression
0:33 component-wise multiply ( temp 4-component vector of float)
0:33 'input' ( in 4-component vector of float)
0:33 Constant:
0:33 3.000000
0:33 3.000000
0:33 3.000000
0:33 3.000000
0:? Linker Objects
// Module Version 10000
// Generated by (magic number): 80001
// Id's are bound by 85
// Id's are bound by 88
Capability Shader
1: ExtInstImport "GLSL.std.450"
@@ -282,6 +294,8 @@ gl_FragCoord origin is upper left
56: TypeInt 32 0
57: 56(int) Constant 0
62: TypeVector 41(bool) 4
83: 6(float) Constant 1077936128
84: 7(fvec4) ConstantComposite 83 83 83 83
4(main): 2 Function None 3
5: Label
Return
@@ -343,5 +357,6 @@ gl_FragCoord origin is upper left
80: 6(float) Load 70(f1)
81: 22(fvec3) CompositeConstruct 80 80 80
82: 7(fvec4) Load 11(input)
ReturnValue 82
85: 7(fvec4) FMul 82 84
ReturnValue 85
FunctionEnd

View File

@@ -11,7 +11,11 @@ Warning, version 450 is not yet complete; most version-specific features are pre
Capability Int64
Capability DerivativeControl
Capability InterpolationFunction
Capability StorageUniformBufferBlock16
Capability StorageUniform16
Capability StorageInputOutput16
Extension "SPV_AMD_gpu_shader_half_float"
Extension "SPV_KHR_16bit_storage"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint Fragment 4 "main" 465

View File

@@ -10,8 +10,11 @@ Warning, version 450 is not yet complete; most version-specific features are pre
Capability Float64
Capability Int64
Capability Groups
Capability StorageUniformBufferBlock16
Capability StorageUniform16
Extension "SPV_AMD_gpu_shader_half_float"
Extension "SPV_AMD_shader_ballot"
Extension "SPV_KHR_16bit_storage"
1: ExtInstImport "GLSL.std.450"
MemoryModel Logical GLSL450
EntryPoint GLCompute 4 "main"

20
3rdparty/glslang/Test/hlsl.boolConv.vert vendored Executable file
View File

@@ -0,0 +1,20 @@
static bool a, b = true;
float4 main() : SV_Position
{
int r = 0;
r += a + b;
r += a - b;
r += a * b;
r += a / b;
r += a % b;
r += a & b;
r += a | b;
r += a ^ b;
r += a << b;
r += a >> b;
return r;
}

View File

@@ -9,7 +9,7 @@ tbuffer {
cbuffer cbufName : register(b2, space10) {
float4 v3;
int i3 : packoffset(c1.y);
};
} // no semicolon is okay
tbuffer tbufName : register(b8) {
float4 v4 : packoffset(c1);
@@ -24,7 +24,7 @@ tbuffer tbufName : register(b8) {
row_major float3x4 m2;
column_major float3x4 m3;
float3x4 m4;
};
} // no semicolon is okay
float4 PixelShaderFunction(float4 input) : COLOR0
{

17
3rdparty/glslang/Test/hlsl.charLit.vert vendored Executable file
View File

@@ -0,0 +1,17 @@
float4 main() : SV_Position
{
uint a1 = 'A';
int a2 = '0';
int a3 = '\a';
a3 += '\b';
a3 += '\t';
a3 += '\n';
a3 += '\v';
a3 += '\f';
a3 += '\r';
int a10 = '\c';
return a1 + a2 + a3 + a10;
}

View File

@@ -1,3 +1,21 @@
float4 c4;
float4 t4;
float4 f4;
float t;
float f;
float4 vectorCond()
{
return (c4 ? t4 : f4) +
(c4 ? t : f ) +
(t4 < f4 ? t4 : f4);
}
float2 fbSelect(bool2 cnd, float2 src0, float2 src1)
{
return cnd ? src0 : src1;
}
float4 PixelShaderFunction(float4 input) : COLOR0
{
int a = 1 < 2 ? 3 < 4 ? 5 : 6 : 7;
@@ -12,5 +30,6 @@ float4 PixelShaderFunction(float4 input) : COLOR0
e = a = b ? c = d : 10, b = a ? d = c : 11;
float4 f;
f = ret.x < input.y ? c * input : d * input;
return e * ret + f;
return e * ret + f + vectorCond() +
float4(fbSelect(bool2(true, false), float2(1.0, 2.0), float2(3.0, 4.0)), 10.0, 10.0);
}

11
3rdparty/glslang/Test/hlsl.inf.vert vendored Executable file
View File

@@ -0,0 +1,11 @@
float4 main() : SV_Position
{
float f1 = -1.#INF;
float f2 = 1.#INF;
float f3 = +1.#INF;
float f4 = f2 * 1.#INF + 1.#INF;
const float f5 = -1.#INF;
const float f6 = f5 * 0.0f;
return (float4)(f1 + f2 + f3 + f4 + f5 + f6);
}

View File

@@ -1,9 +1,18 @@
uniform float f;
uniform float f;
uniform float2 f2;
uniform float3 f3;
bool test1(float v)
{
return !isnan(v) && isfinite(v);
}
float4 main() : SV_Target0
{
isfinite(f);
isfinite(f2);
isfinite(f3);
return 0;
}

View File

@@ -28,5 +28,7 @@ float4 PixelShaderFunction(float4 input, float f) : COLOR0
f1.x;
f1.xxx;
return input;
const float4 f4 = 3.0;
return input * f4;
}

View File

@@ -2,5 +2,5 @@
// For the version, it uses the latest git tag followed by the number of commits.
// For the date, it uses the current date (when then script is run).
#define GLSLANG_REVISION "Overload400-PrecQual.1985"
#define GLSLANG_DATE "07-Apr-2017"
#define GLSLANG_REVISION "Overload400-PrecQual.2000"
#define GLSLANG_DATE "12-Apr-2017"

View File

@@ -623,7 +623,10 @@ TIntermTyped* TIntermediate::addConversion(TOperator op, const TType& type, TInt
node->getType().getBasicType() == EbtUint64))
return node;
else
else if (source == EShSourceHlsl && node->getType().getBasicType() == EbtBool) {
promoteTo = type.getBasicType();
break;
} else
return nullptr;
default:
@@ -1271,7 +1274,8 @@ TIntermTyped* TIntermediate::addMethod(TIntermTyped* object, const TType& type,
//
// For "?:" test nodes. There are three children; a condition,
// a true path, and a false path. The two paths are specified
// as separate parameters.
// as separate parameters. For vector 'cond', the true and false
// are not paths, but vectors to mix.
//
// Specialization constant operations include
// - The ternary operator ( ? : )
@@ -1304,10 +1308,30 @@ TIntermTyped* TIntermediate::addSelection(TIntermTyped* cond, TIntermTyped* true
if (falseBlock->getType() != trueBlock->getType())
return nullptr;
//
// See if all the operands are constant, then fold it otherwise not.
//
// Handle a vector condition as a mix
if (!cond->getType().isScalarOrVec1()) {
TType targetVectorType(trueBlock->getType().getBasicType(), EvqTemporary,
cond->getType().getVectorSize());
// smear true/false operations if needed
if (trueBlock->getType().isScalarOrVec1())
trueBlock = addShapeConversion(EOpAssign, targetVectorType, trueBlock);
if (falseBlock->getType().isScalarOrVec1())
falseBlock = addShapeConversion(EOpAssign, targetVectorType, falseBlock);
// make the mix operation
TIntermAggregate* mix = makeAggregate(loc);
mix = growAggregate(mix, falseBlock);
mix = growAggregate(mix, trueBlock);
mix = growAggregate(mix, cond);
mix->setType(targetVectorType);
mix->setOp(EOpMix);
return mix;
}
// Now have a scalar condition...
// Eliminate the selection when the condition is a scalar and all operands are constant.
if (cond->getAsConstantUnion() && trueBlock->getAsConstantUnion() && falseBlock->getAsConstantUnion()) {
if (cond->getAsConstantUnion()->getConstArray()[0].getBConst())
return trueBlock;
@@ -1967,6 +1991,42 @@ bool TIntermediate::promoteBinary(TIntermBinary& node)
// We now have only scalars, vectors, and matrices to worry about.
//
// HLSL implicitly promotes bool -> int for numeric operations.
// (Implicit conversions to make the operands match each other's types were already done.)
if (getSource() == EShSourceHlsl &&
(left->getBasicType() == EbtBool || right->getBasicType() == EbtBool)) {
switch (op) {
case EOpLessThan:
case EOpGreaterThan:
case EOpLessThanEqual:
case EOpGreaterThanEqual:
case EOpRightShift:
case EOpLeftShift:
case EOpMod:
case EOpAnd:
case EOpInclusiveOr:
case EOpExclusiveOr:
case EOpAdd:
case EOpSub:
case EOpDiv:
case EOpMul:
left = addConversion(op, TType(EbtInt, EvqTemporary, left->getVectorSize()), left);
right = addConversion(op, TType(EbtInt, EvqTemporary, right->getVectorSize()), right);
if (left == nullptr || right == nullptr)
return false;
node.setLeft(left);
node.setRight(right);
break;
default:
break;
}
}
// Do general type checks against individual operands (comparing left and right is coming up, checking mixed shapes after that)
switch (op) {
case EOpLessThan:

View File

@@ -45,11 +45,31 @@
namespace {
bool is_positive_infinity(double x) {
bool IsInfinity(double x) {
#ifdef _MSC_VER
return _fpclass(x) == _FPCLASS_PINF;
switch (_fpclass(x)) {
case _FPCLASS_NINF:
case _FPCLASS_PINF:
return true;
default:
return false;
}
#else
return std::isinf(x) && (x >= 0);
return std::isinf(x);
#endif
}
bool IsNan(double x) {
#ifdef _MSC_VER
switch (_fpclass(x)) {
case _FPCLASS_SNAN:
case _FPCLASS_QNAN:
return true;
default:
return false;
}
#else
return std::isnan(x);
#endif
}
@@ -694,11 +714,14 @@ static void OutputConstantUnion(TInfoSink& out, const TIntermTyped* node, const
#endif
{
const double value = constUnion[i].getDConst();
// Print infinity in a portable way, for test stability.
// Other cases may be needed in the future: negative infinity,
// and NaNs.
if (is_positive_infinity(value))
out.debug << "inf\n";
// Print infinities and NaNs in a portable way.
if (IsInfinity(value)) {
if (value < 0)
out.debug << "-1.#INF\n";
else
out.debug << "+1.#INF\n";
} else if (IsNan(value))
out.debug << "1.#IND\n";
else {
const int maxSize = 300;
char buf[maxSize];

View File

@@ -776,8 +776,12 @@ int TPpContext::CPPversion(TPpToken* ppToken)
{
int token = scanToken(ppToken);
if (errorOnVersion || versionSeen)
parseContext.ppError(ppToken->loc, "must occur first in shader", "#version", "");
if (errorOnVersion || versionSeen) {
if (parseContext.isReadingHLSL())
parseContext.ppError(ppToken->loc, "invalid preprocessor command", "#version", "");
else
parseContext.ppError(ppToken->loc, "must occur first in shader", "#version", "");
}
versionSeen = true;
if (token == '\n') {

View File

@@ -92,7 +92,7 @@ namespace glslang {
class TPpToken {
public:
TPpToken() : space(false), ival(0), dval(0.0), i64val(0)
TPpToken() : space(false), i64val(0)
{
loc.init();
name[0] = 0;
@@ -108,10 +108,14 @@ public:
bool operator!=(const TPpToken& right) { return ! operator==(right); }
TSourceLoc loc;
bool space; // true if a space (for white space or a removed comment) should also be recognized, in front of the token returned
int ival;
double dval;
long long i64val;
bool space; // true if a space (for white space or a removed comment) should also be recognized, in front of the token returned
union {
int ival;
double dval;
long long i64val;
};
char name[MaxTokenLength + 1];
};
@@ -584,6 +588,7 @@ protected:
int ScanFromString(char* s);
void missingEndifCheck();
int lFloatConst(int len, int ch, TPpToken* ppToken);
int characterLiteral(TPpToken* ppToken);
void push_include(TShader::Includer::IncludeResult* result)
{

View File

@@ -124,6 +124,35 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
HasDecimalOrExponent = true;
saveName(ch);
ch = getChar();
// 1.#INF or -1.#INF
if (ch == '#') {
if ((len < 2) ||
(len == 2 && ppToken->name[0] != '1') ||
(len == 3 && ppToken->name[1] != '1' && !(ppToken->name[0] == '-' || ppToken->name[0] == '+')) ||
(len > 3))
parseContext.ppError(ppToken->loc, "unexpected use of", "#", "");
else {
// we have 1.# or -1.# or +1.#, check for 'INF'
if ((ch = getChar()) != 'I' ||
(ch = getChar()) != 'N' ||
(ch = getChar()) != 'F')
parseContext.ppError(ppToken->loc, "expected 'INF'", "#", "");
else {
// we have [+-].#INF, and we are targeting IEEE 754, so wrap it up:
saveName('I');
saveName('N');
saveName('F');
ppToken->name[len] = '\0';
if (ppToken->name[0] == '-')
ppToken->i64val = 0xfff0000000000000; // -Infinity
else
ppToken->i64val = 0x7ff0000000000000; // +Infinity
return PpAtomConstFloat;
}
}
}
while (ch >= '0' && ch <= '9') {
saveName(ch);
ch = getChar();
@@ -216,6 +245,82 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
return PpAtomConstFloat;
}
// Recognize a character literal.
//
// The first ' has already been accepted, read the rest, through the closing '.
//
// Always returns PpAtomConstInt.
//
int TPpContext::characterLiteral(TPpToken* ppToken)
{
ppToken->name[0] = 0;
ppToken->ival = 0;
if (parseContext.intermediate.getSource() != EShSourceHlsl) {
// illegal, except in macro definition, for which case we report the character
return '\'';
}
int ch = getChar();
switch (ch) {
case '\'':
// As empty sequence: ''
parseContext.ppError(ppToken->loc, "unexpected", "\'", "");
return PpAtomConstInt;
case '\\':
// As escape sequence: '\XXX'
switch (ch = getChar()) {
case 'a':
ppToken->ival = 7;
break;
case 'b':
ppToken->ival = 8;
break;
case 't':
ppToken->ival = 9;
break;
case 'n':
ppToken->ival = 10;
break;
case 'v':
ppToken->ival = 11;
break;
case 'f':
ppToken->ival = 12;
break;
case 'r':
ppToken->ival = 13;
break;
case 'x':
case '0':
parseContext.ppError(ppToken->loc, "octal and hex sequences not supported", "\\", "");
break;
default:
// This catches '\'', '\"', '\?', etc.
// Also, things like '\C' mean the same thing as 'C'
// (after the above cases are filtered out).
ppToken->ival = ch;
break;
}
break;
default:
ppToken->ival = ch;
break;
}
ppToken->name[0] = (char)ppToken->ival;
ppToken->name[1] = '\0';
ch = getChar();
if (ch != '\'') {
parseContext.ppError(ppToken->loc, "expected", "\'", "");
// Look ahead for a closing '
do {
ch = getChar();
} while (ch != '\'' && ch != EndOfInput && ch != '\n');
}
return PpAtomConstInt;
}
//
// Scanner used to tokenize source stream.
//
@@ -672,6 +777,8 @@ int TPpContext::tStringInput::scan(TPpToken* ppToken)
return '/';
}
break;
case '\'':
return pp->characterLiteral(ppToken);
case '"':
// TODO: If this gets enhanced to handle escape sequences, or
// anything that is different than what #include needs, then

View File

@@ -89,10 +89,12 @@ INSTANTIATE_TEST_CASE_P(
{"hlsl.attribute.expression.comp", "main"},
{"hlsl.basic.comp", "main"},
{"hlsl.basic.geom", "main"},
{"hlsl.boolConv.vert", "main"},
{"hlsl.buffer.frag", "PixelShaderFunction"},
{"hlsl.calculatelod.dx10.frag", "main"},
{"hlsl.calculatelodunclamped.dx10.frag", "main"},
{"hlsl.cast.frag", "PixelShaderFunction"},
{"hlsl.charLit.vert", "main"},
{"hlsl.clip.frag", "main"},
{"hlsl.comparison.vec.frag", "main"},
{"hlsl.conditional.frag", "PixelShaderFunction"},
@@ -134,6 +136,7 @@ INSTANTIATE_TEST_CASE_P(
{"hlsl.identifier.sample.frag", "main"},
{"hlsl.if.frag", "PixelShaderFunction"},
{"hlsl.implicitBool.frag", "main"},
{"hlsl.inf.vert", "main"},
{"hlsl.inoutquals.frag", "main"},
{"hlsl.init.frag", "ShaderFunction"},
{"hlsl.init2.frag", "main"},

View File

@@ -308,7 +308,7 @@ bool HlslGrammar::acceptSamplerDeclarationDX9(TType& /*type*/)
// declaration
// : sampler_declaration_dx9 post_decls SEMICOLON
// | fully_specified_type declarator_list SEMICOLON
// | fully_specified_type declarator_list SEMICOLON(optional for cbuffer/tbuffer)
// | fully_specified_type identifier function_parameters post_decls compound_statement // function definition
// | fully_specified_type identifier sampler_state post_decls compound_statement // sampler definition
// | typedef declaration
@@ -509,18 +509,22 @@ bool HlslGrammar::acceptDeclaration(TIntermNode*& nodeList)
else
nodeList = initializers;
// SEMICOLON
// SEMICOLON(optional for cbuffer/tbuffer)
if (! acceptTokenClass(EHTokSemicolon)) {
// This may have been a false detection of what appeared to be a declaration, but
// was actually an assignment such as "float = 4", where "float" is an identifier.
// We put the token back to let further parsing happen for cases where that may
// happen. This errors on the side of caution, and mostly triggers the error.
if (peek() == EHTokAssign || peek() == EHTokLeftBracket || peek() == EHTokDot || peek() == EHTokComma)
if (peek() == EHTokAssign || peek() == EHTokLeftBracket || peek() == EHTokDot || peek() == EHTokComma) {
// This may have been a false detection of what appeared to be a declaration, but
// was actually an assignment such as "float = 4", where "float" is an identifier.
// We put the token back to let further parsing happen for cases where that may
// happen. This errors on the side of caution, and mostly triggers the error.
recedeToken();
else
return false;
} else if (declaredType.getBasicType() == EbtBlock) {
// cbuffer, et. al. (but not struct) don't have an ending semicolon
return true;
} else {
expected(";");
return false;
return false;
}
}
return true;
@@ -601,7 +605,7 @@ bool HlslGrammar::acceptFullySpecifiedType(TType& type, TIntermNode*& nodeList)
// the type was a block, which set some parts of the qualifier
parseContext.mergeQualifiers(type.getQualifier(), qualifier);
// further, it can create an anonymous instance of the block
if (peekTokenClass(EHTokSemicolon))
if (peek() != EHTokIdentifier)
parseContext.declareBlock(loc, type);
} else {
// Some qualifiers are set when parsing the type. Merge those with
@@ -2532,7 +2536,7 @@ bool HlslGrammar::acceptConditionalExpression(TIntermTyped*& node)
if (! acceptTokenClass(EHTokQuestion))
return true;
node = parseContext.convertConditionalExpression(token.loc, node);
node = parseContext.convertConditionalExpression(token.loc, node, false);
if (node == nullptr)
return false;

View File

@@ -3907,25 +3907,27 @@ void HlslParseContext::decomposeIntrinsic(const TSourceLoc& loc, TIntermTyped*&
TIntermAggregate* compoundStatement = intermediate.makeAggregate(tmpArgAssign, loc);
const TType boolType(EbtBool, EvqTemporary, arg0->getVectorSize(), arg0->getMatrixCols(), arg0->getMatrixRows());
TIntermTyped* isnan = handleUnaryMath(loc, "isnan", EOpIsNan, intermediate.addSymbol(*tempArg, loc));
isnan->setType(TType(EbtBool));
isnan->setType(boolType);
TIntermTyped* notnan = handleUnaryMath(loc, "!", EOpLogicalNot, isnan);
notnan->setType(TType(EbtBool));
notnan->setType(boolType);
TIntermTyped* isinf = handleUnaryMath(loc, "isinf", EOpIsInf, intermediate.addSymbol(*tempArg, loc));
isinf->setType(TType(EbtBool));
isinf->setType(boolType);
TIntermTyped* notinf = handleUnaryMath(loc, "!", EOpLogicalNot, isinf);
notinf->setType(TType(EbtBool));
notinf->setType(boolType);
TIntermTyped* andNode = handleBinaryMath(loc, "and", EOpLogicalAnd, notnan, notinf);
andNode->setType(TType(EbtBool));
andNode->setType(boolType);
compoundStatement = intermediate.growAggregate(compoundStatement, andNode);
compoundStatement->setOperator(EOpSequence);
compoundStatement->setLoc(loc);
compoundStatement->setType(TType(EbtVoid));
compoundStatement->setType(boolType);
node = compoundStatement;
@@ -4527,14 +4529,14 @@ void HlslParseContext::handleRegister(const TSourceLoc& loc, TQualifier& qualifi
// Convert to a scalar boolean, or if not allowed by HLSL semantics,
// report an error and return nullptr.
TIntermTyped* HlslParseContext::convertConditionalExpression(const TSourceLoc& loc, TIntermTyped* condition)
TIntermTyped* HlslParseContext::convertConditionalExpression(const TSourceLoc& loc, TIntermTyped* condition, bool mustBeScalar)
{
if (!condition->getType().isScalarOrVec1()) {
if (mustBeScalar && !condition->getType().isScalarOrVec1()) {
error(loc, "requires a scalar", "conditional expression", "");
return nullptr;
}
return intermediate.addConversion(EOpConstructBool, TType(EbtBool), condition);
return intermediate.addConversion(EOpConstructBool, TType(EbtBool, EvqTemporary, condition->getVectorSize()), condition);
}
//
@@ -6436,7 +6438,10 @@ TIntermNode* HlslParseContext::executeInitializer(const TSourceLoc& loc, TInterm
// Compile-time tagging of the variable with its constant value...
initializer = intermediate.addConversion(EOpAssign, variable->getType(), initializer);
if (! initializer || ! initializer->getAsConstantUnion() || variable->getType() != initializer->getType()) {
if (initializer != nullptr && variable->getType() != initializer->getType())
initializer = intermediate.addShapeConversion(EOpAssign, variable->getType(), initializer);
if (initializer == nullptr || !initializer->getAsConstantUnion() ||
variable->getType() != initializer->getType()) {
error(loc, "non-matching or non-convertible constant type for const initializer",
variable->getType().getStorageQualifierString(), "");
variable->getWritableType().getQualifier().storage = EvqTemporary;

View File

@@ -102,7 +102,7 @@ public:
const glslang::TString* component);
void handleRegister(const TSourceLoc&, TQualifier&, const glslang::TString* profile, const glslang::TString& desc,
int subComponent, const glslang::TString*);
TIntermTyped* convertConditionalExpression(const TSourceLoc&, TIntermTyped*);
TIntermTyped* convertConditionalExpression(const TSourceLoc&, TIntermTyped*, bool mustBeScalar = true);
TIntermAggregate* handleSamplerTextureCombine(const TSourceLoc& loc, TIntermTyped* argTex, TIntermTyped* argSampler);
bool parseMatrixSwizzleSelector(const TSourceLoc&, const TString&, int cols, int rows, TSwizzleSelectors<TMatrixSelector>&);