From cd8d2e94521065b18322f6414221a52f3a4456ca Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Branimir=20Karad=C5=BEi=C4=87?= Date: Fri, 14 Apr 2017 21:17:34 -0700 Subject: [PATCH] Updated glslang. --- 3rdparty/glslang/SPIRV/GLSL.ext.KHR.h | 1 + 3rdparty/glslang/SPIRV/GlslangToSpv.cpp | 18 + 3rdparty/glslang/SPIRV/doc.cpp | 5 + .../Test/baseResults/constFold.frag.out | 2 +- .../Test/baseResults/hlsl.boolConv.vert.out | 363 +++++++ .../Test/baseResults/hlsl.charLit.vert.out | 233 ++++ .../baseResults/hlsl.conditional.frag.out | 993 +++++++++++------- .../Test/baseResults/hlsl.inf.vert.out | 172 +++ .../Test/baseResults/hlsl.isfinite.frag.out | 375 +++++-- .../Test/baseResults/hlsl.shapeConv.frag.out | 27 +- .../Test/baseResults/spv.float16.frag.out | 4 + .../baseResults/spv.shaderBallotAMD.comp.out | 3 + 3rdparty/glslang/Test/hlsl.boolConv.vert | 20 + 3rdparty/glslang/Test/hlsl.buffer.frag | 4 +- 3rdparty/glslang/Test/hlsl.charLit.vert | 17 + 3rdparty/glslang/Test/hlsl.conditional.frag | 21 +- 3rdparty/glslang/Test/hlsl.inf.vert | 11 + 3rdparty/glslang/Test/hlsl.isfinite.frag | 11 +- 3rdparty/glslang/Test/hlsl.shapeConv.frag | 4 +- 3rdparty/glslang/glslang/Include/revision.h | 4 +- .../MachineIndependent/Intermediate.cpp | 70 +- .../glslang/MachineIndependent/intermOut.cpp | 39 +- .../MachineIndependent/preprocessor/Pp.cpp | 8 +- .../preprocessor/PpContext.h | 15 +- .../preprocessor/PpScanner.cpp | 107 ++ 3rdparty/glslang/gtests/Hlsl.FromFile.cpp | 3 + 3rdparty/glslang/hlsl/hlslGrammar.cpp | 28 +- 3rdparty/glslang/hlsl/hlslParseHelper.cpp | 25 +- 3rdparty/glslang/hlsl/hlslParseHelper.h | 2 +- 29 files changed, 2071 insertions(+), 514 deletions(-) create mode 100755 3rdparty/glslang/Test/baseResults/hlsl.boolConv.vert.out create mode 100755 3rdparty/glslang/Test/baseResults/hlsl.charLit.vert.out create mode 100755 3rdparty/glslang/Test/baseResults/hlsl.inf.vert.out create mode 100755 3rdparty/glslang/Test/hlsl.boolConv.vert create mode 100755 3rdparty/glslang/Test/hlsl.charLit.vert create mode 100755 3rdparty/glslang/Test/hlsl.inf.vert diff --git a/3rdparty/glslang/SPIRV/GLSL.ext.KHR.h b/3rdparty/glslang/SPIRV/GLSL.ext.KHR.h index a8f20c351..4c3a57176 100644 --- a/3rdparty/glslang/SPIRV/GLSL.ext.KHR.h +++ b/3rdparty/glslang/SPIRV/GLSL.ext.KHR.h @@ -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 diff --git a/3rdparty/glslang/SPIRV/GlslangToSpv.cpp b/3rdparty/glslang/SPIRV/GlslangToSpv.cpp index ebb723008..4a16f6af3 100755 --- a/3rdparty/glslang/SPIRV/GlslangToSpv.cpp +++ b/3rdparty/glslang/SPIRV/GlslangToSpv.cpp @@ -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 = ""; diff --git a/3rdparty/glslang/SPIRV/doc.cpp b/3rdparty/glslang/SPIRV/doc.cpp index 903421c68..b84458496 100755 --- a/3rdparty/glslang/SPIRV/doc.cpp +++ b/3rdparty/glslang/SPIRV/doc.cpp @@ -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"; diff --git a/3rdparty/glslang/Test/baseResults/constFold.frag.out b/3rdparty/glslang/Test/baseResults/constFold.frag.out index 8c0146843..965c6dbc5 100644 --- a/3rdparty/glslang/Test/baseResults/constFold.frag.out +++ b/3rdparty/glslang/Test/baseResults/constFold.frag.out @@ -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) diff --git a/3rdparty/glslang/Test/baseResults/hlsl.boolConv.vert.out b/3rdparty/glslang/Test/baseResults/hlsl.boolConv.vert.out new file mode 100755 index 000000000..32c6eb2c4 --- /dev/null +++ b/3rdparty/glslang/Test/baseResults/hlsl.boolConv.vert.out @@ -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 diff --git a/3rdparty/glslang/Test/baseResults/hlsl.charLit.vert.out b/3rdparty/glslang/Test/baseResults/hlsl.charLit.vert.out new file mode 100755 index 000000000..cc8388a23 --- /dev/null +++ b/3rdparty/glslang/Test/baseResults/hlsl.charLit.vert.out @@ -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 diff --git a/3rdparty/glslang/Test/baseResults/hlsl.conditional.frag.out b/3rdparty/glslang/Test/baseResults/hlsl.conditional.frag.out index 4028cad40..6e6f76afa 100755 --- a/3rdparty/glslang/Test/baseResults/hlsl.conditional.frag.out +++ b/3rdparty/glslang/Test/baseResults/hlsl.conditional.frag.out @@ -2,122 +2,206 @@ hlsl.conditional.frag Shader version: 500 gl_FragCoord origin is upper left 0:? Sequence -0:2 Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float) -0:2 Function Parameters: -0:2 'input' ( in 4-component vector of float) +0:8 Function Definition: vectorCond( ( temp 4-component vector of float) +0:8 Function Parameters: 0:? Sequence -0:3 Sequence -0:3 move second child to first child ( temp int) -0:3 'a' ( temp int) -0:3 Constant: -0:3 5 (const int) -0:4 Sequence -0:4 move second child to first child ( temp int) -0:4 'b' ( temp int) -0:4 Constant: -0:4 6 (const int) -0:5 Sequence -0:5 move second child to first child ( temp int) -0:5 'c' ( temp int) -0:5 Constant: -0:5 7 (const int) -0:6 Sequence -0:6 move second child to first child ( temp int) -0:6 'd' ( temp int) -0:6 Constant: -0:6 7 (const int) -0:7 Sequence -0:7 move second child to first child ( temp 4-component vector of float) -0:7 'ret' ( temp 4-component vector of float) +0:11 Branch: Return with expression +0:10 add ( temp 4-component vector of float) 0:9 add ( temp 4-component vector of float) -0:8 add ( temp 4-component vector of float) -0:7 add ( temp 4-component vector of float) -0:7 vector-scale ( temp 4-component vector of float) -0:7 Convert int to float ( temp float) -0:7 'a' ( temp int) -0:7 'input' ( in 4-component vector of float) -0:8 vector-scale ( temp 4-component vector of float) -0:8 Convert int to float ( temp float) -0:8 'b' ( temp int) -0:8 'input' ( in 4-component vector of float) -0:9 vector-scale ( temp 4-component vector of float) -0:9 Convert int to float ( temp float) -0:9 'c' ( temp int) -0:9 'input' ( in 4-component vector of float) -0:10 vector-scale ( temp 4-component vector of float) -0:10 Convert int to float ( temp float) -0:10 'd' ( temp int) -0:10 'input' ( in 4-component vector of float) -0:12 Comma ( temp int) -0:12 move second child to first child ( temp int) -0:12 'e' ( temp int) -0:12 move second child to first child ( temp int) -0:12 'a' ( temp int) -0:12 Test condition and select ( temp int) -0:12 Condition -0:12 Convert int to bool ( temp bool) -0:12 'b' ( temp int) -0:12 true case -0:12 move second child to first child ( temp int) -0:12 'c' ( temp int) -0:12 'd' ( temp int) -0:12 false case -0:12 Constant: -0:12 10 (const int) -0:12 move second child to first child ( temp int) -0:12 'b' ( temp int) -0:12 Test condition and select ( temp int) -0:12 Condition -0:12 Convert int to bool ( temp bool) -0:12 'a' ( temp int) -0:12 true case -0:12 move second child to first child ( temp int) -0:12 'd' ( temp int) -0:12 'c' ( temp int) -0:12 false case -0:12 Constant: -0:12 11 (const int) -0:14 move second child to first child ( temp 4-component vector of float) -0:14 'f' ( temp 4-component vector of float) -0:14 Test condition and select ( temp 4-component vector of float) -0:14 Condition -0:14 Compare Less Than ( temp bool) -0:14 direct index ( temp float) -0:14 'ret' ( temp 4-component vector of float) -0:14 Constant: -0:14 0 (const int) -0:14 direct index ( temp float) -0:14 'input' ( in 4-component vector of float) -0:14 Constant: -0:14 1 (const int) -0:14 true case -0:14 vector-scale ( temp 4-component vector of float) -0:14 Convert int to float ( temp float) -0:14 'c' ( temp int) -0:14 'input' ( in 4-component vector of float) -0:14 false case -0:14 vector-scale ( temp 4-component vector of float) -0:14 Convert int to float ( temp float) -0:14 'd' ( temp int) -0:14 'input' ( in 4-component vector of float) -0:15 Branch: Return with expression -0:15 add ( temp 4-component vector of float) -0:15 vector-scale ( temp 4-component vector of float) -0:15 Convert int to float ( temp float) -0:15 'e' ( temp int) -0:15 'ret' ( temp 4-component vector of float) -0:15 'f' ( temp 4-component vector of float) -0:2 Function Definition: PixelShaderFunction( ( temp void) -0:2 Function Parameters: +0:9 mix ( temp 4-component vector of float) +0:9 f4: direct index for structure ( uniform 4-component vector of float) +0:9 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f}) +0:9 Constant: +0:9 2 (const uint) +0:9 t4: direct index for structure ( uniform 4-component vector of float) +0:9 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f}) +0:9 Constant: +0:9 1 (const uint) +0:9 Convert float to bool ( temp 4-component vector of bool) +0:9 c4: direct index for structure ( uniform 4-component vector of float) +0:9 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f}) +0:9 Constant: +0:9 0 (const uint) +0:10 mix ( temp 4-component vector of float) +0:10 Construct vec4 ( temp 4-component vector of float) +0:10 f: direct index for structure ( uniform float) +0:10 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f}) +0:10 Constant: +0:10 4 (const uint) +0:10 Construct vec4 ( temp 4-component vector of float) +0:10 t: direct index for structure ( uniform float) +0:10 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f}) +0:10 Constant: +0:10 3 (const uint) +0:10 Convert float to bool ( temp 4-component vector of bool) +0:10 c4: direct index for structure ( uniform 4-component vector of float) +0:10 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f}) +0:10 Constant: +0:10 0 (const uint) +0:11 mix ( temp 4-component vector of float) +0:11 f4: direct index for structure ( uniform 4-component vector of float) +0:11 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f}) +0:11 Constant: +0:11 2 (const uint) +0:11 t4: direct index for structure ( uniform 4-component vector of float) +0:11 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f}) +0:11 Constant: +0:11 1 (const uint) +0:11 Compare Less Than ( temp 4-component vector of bool) +0:11 t4: direct index for structure ( uniform 4-component vector of float) +0:11 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f}) +0:11 Constant: +0:11 1 (const uint) +0:11 f4: direct index for structure ( uniform 4-component vector of float) +0:11 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f}) +0:11 Constant: +0:11 2 (const uint) +0:15 Function Definition: fbSelect(vb2;vf2;vf2; ( temp 2-component vector of float) +0:15 Function Parameters: +0:15 'cnd' ( in 2-component vector of bool) +0:15 'src0' ( in 2-component vector of float) +0:15 'src1' ( in 2-component vector of float) 0:? Sequence -0:2 move second child to first child ( temp 4-component vector of float) +0:16 Branch: Return with expression +0:16 mix ( temp 2-component vector of float) +0:16 'src1' ( in 2-component vector of float) +0:16 'src0' ( in 2-component vector of float) +0:16 'cnd' ( in 2-component vector of bool) +0:20 Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float) +0:20 Function Parameters: +0:20 'input' ( in 4-component vector of float) +0:? Sequence +0:21 Sequence +0:21 move second child to first child ( temp int) +0:21 'a' ( temp int) +0:21 Constant: +0:21 5 (const int) +0:22 Sequence +0:22 move second child to first child ( temp int) +0:22 'b' ( temp int) +0:22 Constant: +0:22 6 (const int) +0:23 Sequence +0:23 move second child to first child ( temp int) +0:23 'c' ( temp int) +0:23 Constant: +0:23 7 (const int) +0:24 Sequence +0:24 move second child to first child ( temp int) +0:24 'd' ( temp int) +0:24 Constant: +0:24 7 (const int) +0:25 Sequence +0:25 move second child to first child ( temp 4-component vector of float) +0:25 'ret' ( temp 4-component vector of float) +0:27 add ( temp 4-component vector of float) +0:26 add ( temp 4-component vector of float) +0:25 add ( temp 4-component vector of float) +0:25 vector-scale ( temp 4-component vector of float) +0:25 Convert int to float ( temp float) +0:25 'a' ( temp int) +0:25 'input' ( in 4-component vector of float) +0:26 vector-scale ( temp 4-component vector of float) +0:26 Convert int to float ( temp float) +0:26 'b' ( temp int) +0:26 'input' ( in 4-component vector of float) +0:27 vector-scale ( temp 4-component vector of float) +0:27 Convert int to float ( temp float) +0:27 'c' ( temp int) +0:27 'input' ( in 4-component vector of float) +0:28 vector-scale ( temp 4-component vector of float) +0:28 Convert int to float ( temp float) +0:28 'd' ( temp int) +0:28 'input' ( in 4-component vector of float) +0:30 Comma ( temp int) +0:30 move second child to first child ( temp int) +0:30 'e' ( temp int) +0:30 move second child to first child ( temp int) +0:30 'a' ( temp int) +0:30 Test condition and select ( temp int) +0:30 Condition +0:30 Convert int to bool ( temp bool) +0:30 'b' ( temp int) +0:30 true case +0:30 move second child to first child ( temp int) +0:30 'c' ( temp int) +0:30 'd' ( temp int) +0:30 false case +0:30 Constant: +0:30 10 (const int) +0:30 move second child to first child ( temp int) +0:30 'b' ( temp int) +0:30 Test condition and select ( temp int) +0:30 Condition +0:30 Convert int to bool ( temp bool) +0:30 'a' ( temp int) +0:30 true case +0:30 move second child to first child ( temp int) +0:30 'd' ( temp int) +0:30 'c' ( temp int) +0:30 false case +0:30 Constant: +0:30 11 (const int) +0:32 move second child to first child ( temp 4-component vector of float) +0:32 'f' ( temp 4-component vector of float) +0:32 Test condition and select ( temp 4-component vector of float) +0:32 Condition +0:32 Compare Less Than ( temp bool) +0:32 direct index ( temp float) +0:32 'ret' ( temp 4-component vector of float) +0:32 Constant: +0:32 0 (const int) +0:32 direct index ( temp float) +0:32 'input' ( in 4-component vector of float) +0:32 Constant: +0:32 1 (const int) +0:32 true case +0:32 vector-scale ( temp 4-component vector of float) +0:32 Convert int to float ( temp float) +0:32 'c' ( temp int) +0:32 'input' ( in 4-component vector of float) +0:32 false case +0:32 vector-scale ( temp 4-component vector of float) +0:32 Convert int to float ( temp float) +0:32 'd' ( temp int) +0:32 'input' ( in 4-component vector of float) +0:34 Branch: Return with expression +0:33 add ( temp 4-component vector of float) +0:33 add ( temp 4-component vector of float) +0:33 add ( temp 4-component vector of float) +0:33 vector-scale ( temp 4-component vector of float) +0:33 Convert int to float ( temp float) +0:33 'e' ( temp int) +0:33 'ret' ( temp 4-component vector of float) +0:33 'f' ( temp 4-component vector of float) +0:33 Function Call: vectorCond( ( temp 4-component vector of float) +0:? Construct vec4 ( temp 4-component vector of float) +0:34 Function Call: fbSelect(vb2;vf2;vf2; ( temp 2-component vector of float) +0:? Constant: +0:? true (const bool) +0:? false (const bool) +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:? Constant: +0:? 3.000000 +0:? 4.000000 +0:34 Constant: +0:34 10.000000 +0:34 Constant: +0:34 10.000000 +0:20 Function Definition: PixelShaderFunction( ( temp void) +0:20 Function Parameters: +0:? Sequence +0:20 move second child to first child ( temp 4-component vector of float) 0:? 'input' ( temp 4-component vector of float) 0:? 'input' (layout( location=0) in 4-component vector of float) -0:2 move second child to first child ( temp 4-component vector of float) +0:20 move second child to first child ( temp 4-component vector of float) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) -0:2 Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float) +0:20 Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float) 0:? 'input' ( temp 4-component vector of float) 0:? Linker Objects +0:? 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f}) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? 'input' (layout( location=0) in 4-component vector of float) @@ -128,282 +212,475 @@ Linked fragment stage: Shader version: 500 gl_FragCoord origin is upper left 0:? Sequence -0:2 Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float) -0:2 Function Parameters: -0:2 'input' ( in 4-component vector of float) +0:8 Function Definition: vectorCond( ( temp 4-component vector of float) +0:8 Function Parameters: 0:? Sequence -0:3 Sequence -0:3 move second child to first child ( temp int) -0:3 'a' ( temp int) -0:3 Constant: -0:3 5 (const int) -0:4 Sequence -0:4 move second child to first child ( temp int) -0:4 'b' ( temp int) -0:4 Constant: -0:4 6 (const int) -0:5 Sequence -0:5 move second child to first child ( temp int) -0:5 'c' ( temp int) -0:5 Constant: -0:5 7 (const int) -0:6 Sequence -0:6 move second child to first child ( temp int) -0:6 'd' ( temp int) -0:6 Constant: -0:6 7 (const int) -0:7 Sequence -0:7 move second child to first child ( temp 4-component vector of float) -0:7 'ret' ( temp 4-component vector of float) +0:11 Branch: Return with expression +0:10 add ( temp 4-component vector of float) 0:9 add ( temp 4-component vector of float) -0:8 add ( temp 4-component vector of float) -0:7 add ( temp 4-component vector of float) -0:7 vector-scale ( temp 4-component vector of float) -0:7 Convert int to float ( temp float) -0:7 'a' ( temp int) -0:7 'input' ( in 4-component vector of float) -0:8 vector-scale ( temp 4-component vector of float) -0:8 Convert int to float ( temp float) -0:8 'b' ( temp int) -0:8 'input' ( in 4-component vector of float) -0:9 vector-scale ( temp 4-component vector of float) -0:9 Convert int to float ( temp float) -0:9 'c' ( temp int) -0:9 'input' ( in 4-component vector of float) -0:10 vector-scale ( temp 4-component vector of float) -0:10 Convert int to float ( temp float) -0:10 'd' ( temp int) -0:10 'input' ( in 4-component vector of float) -0:12 Comma ( temp int) -0:12 move second child to first child ( temp int) -0:12 'e' ( temp int) -0:12 move second child to first child ( temp int) -0:12 'a' ( temp int) -0:12 Test condition and select ( temp int) -0:12 Condition -0:12 Convert int to bool ( temp bool) -0:12 'b' ( temp int) -0:12 true case -0:12 move second child to first child ( temp int) -0:12 'c' ( temp int) -0:12 'd' ( temp int) -0:12 false case -0:12 Constant: -0:12 10 (const int) -0:12 move second child to first child ( temp int) -0:12 'b' ( temp int) -0:12 Test condition and select ( temp int) -0:12 Condition -0:12 Convert int to bool ( temp bool) -0:12 'a' ( temp int) -0:12 true case -0:12 move second child to first child ( temp int) -0:12 'd' ( temp int) -0:12 'c' ( temp int) -0:12 false case -0:12 Constant: -0:12 11 (const int) -0:14 move second child to first child ( temp 4-component vector of float) -0:14 'f' ( temp 4-component vector of float) -0:14 Test condition and select ( temp 4-component vector of float) -0:14 Condition -0:14 Compare Less Than ( temp bool) -0:14 direct index ( temp float) -0:14 'ret' ( temp 4-component vector of float) -0:14 Constant: -0:14 0 (const int) -0:14 direct index ( temp float) -0:14 'input' ( in 4-component vector of float) -0:14 Constant: -0:14 1 (const int) -0:14 true case -0:14 vector-scale ( temp 4-component vector of float) -0:14 Convert int to float ( temp float) -0:14 'c' ( temp int) -0:14 'input' ( in 4-component vector of float) -0:14 false case -0:14 vector-scale ( temp 4-component vector of float) -0:14 Convert int to float ( temp float) -0:14 'd' ( temp int) -0:14 'input' ( in 4-component vector of float) -0:15 Branch: Return with expression -0:15 add ( temp 4-component vector of float) -0:15 vector-scale ( temp 4-component vector of float) -0:15 Convert int to float ( temp float) -0:15 'e' ( temp int) -0:15 'ret' ( temp 4-component vector of float) -0:15 'f' ( temp 4-component vector of float) -0:2 Function Definition: PixelShaderFunction( ( temp void) -0:2 Function Parameters: +0:9 mix ( temp 4-component vector of float) +0:9 f4: direct index for structure ( uniform 4-component vector of float) +0:9 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f}) +0:9 Constant: +0:9 2 (const uint) +0:9 t4: direct index for structure ( uniform 4-component vector of float) +0:9 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f}) +0:9 Constant: +0:9 1 (const uint) +0:9 Convert float to bool ( temp 4-component vector of bool) +0:9 c4: direct index for structure ( uniform 4-component vector of float) +0:9 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f}) +0:9 Constant: +0:9 0 (const uint) +0:10 mix ( temp 4-component vector of float) +0:10 Construct vec4 ( temp 4-component vector of float) +0:10 f: direct index for structure ( uniform float) +0:10 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f}) +0:10 Constant: +0:10 4 (const uint) +0:10 Construct vec4 ( temp 4-component vector of float) +0:10 t: direct index for structure ( uniform float) +0:10 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f}) +0:10 Constant: +0:10 3 (const uint) +0:10 Convert float to bool ( temp 4-component vector of bool) +0:10 c4: direct index for structure ( uniform 4-component vector of float) +0:10 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f}) +0:10 Constant: +0:10 0 (const uint) +0:11 mix ( temp 4-component vector of float) +0:11 f4: direct index for structure ( uniform 4-component vector of float) +0:11 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f}) +0:11 Constant: +0:11 2 (const uint) +0:11 t4: direct index for structure ( uniform 4-component vector of float) +0:11 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f}) +0:11 Constant: +0:11 1 (const uint) +0:11 Compare Less Than ( temp 4-component vector of bool) +0:11 t4: direct index for structure ( uniform 4-component vector of float) +0:11 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f}) +0:11 Constant: +0:11 1 (const uint) +0:11 f4: direct index for structure ( uniform 4-component vector of float) +0:11 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f}) +0:11 Constant: +0:11 2 (const uint) +0:15 Function Definition: fbSelect(vb2;vf2;vf2; ( temp 2-component vector of float) +0:15 Function Parameters: +0:15 'cnd' ( in 2-component vector of bool) +0:15 'src0' ( in 2-component vector of float) +0:15 'src1' ( in 2-component vector of float) 0:? Sequence -0:2 move second child to first child ( temp 4-component vector of float) +0:16 Branch: Return with expression +0:16 mix ( temp 2-component vector of float) +0:16 'src1' ( in 2-component vector of float) +0:16 'src0' ( in 2-component vector of float) +0:16 'cnd' ( in 2-component vector of bool) +0:20 Function Definition: @PixelShaderFunction(vf4; ( temp 4-component vector of float) +0:20 Function Parameters: +0:20 'input' ( in 4-component vector of float) +0:? Sequence +0:21 Sequence +0:21 move second child to first child ( temp int) +0:21 'a' ( temp int) +0:21 Constant: +0:21 5 (const int) +0:22 Sequence +0:22 move second child to first child ( temp int) +0:22 'b' ( temp int) +0:22 Constant: +0:22 6 (const int) +0:23 Sequence +0:23 move second child to first child ( temp int) +0:23 'c' ( temp int) +0:23 Constant: +0:23 7 (const int) +0:24 Sequence +0:24 move second child to first child ( temp int) +0:24 'd' ( temp int) +0:24 Constant: +0:24 7 (const int) +0:25 Sequence +0:25 move second child to first child ( temp 4-component vector of float) +0:25 'ret' ( temp 4-component vector of float) +0:27 add ( temp 4-component vector of float) +0:26 add ( temp 4-component vector of float) +0:25 add ( temp 4-component vector of float) +0:25 vector-scale ( temp 4-component vector of float) +0:25 Convert int to float ( temp float) +0:25 'a' ( temp int) +0:25 'input' ( in 4-component vector of float) +0:26 vector-scale ( temp 4-component vector of float) +0:26 Convert int to float ( temp float) +0:26 'b' ( temp int) +0:26 'input' ( in 4-component vector of float) +0:27 vector-scale ( temp 4-component vector of float) +0:27 Convert int to float ( temp float) +0:27 'c' ( temp int) +0:27 'input' ( in 4-component vector of float) +0:28 vector-scale ( temp 4-component vector of float) +0:28 Convert int to float ( temp float) +0:28 'd' ( temp int) +0:28 'input' ( in 4-component vector of float) +0:30 Comma ( temp int) +0:30 move second child to first child ( temp int) +0:30 'e' ( temp int) +0:30 move second child to first child ( temp int) +0:30 'a' ( temp int) +0:30 Test condition and select ( temp int) +0:30 Condition +0:30 Convert int to bool ( temp bool) +0:30 'b' ( temp int) +0:30 true case +0:30 move second child to first child ( temp int) +0:30 'c' ( temp int) +0:30 'd' ( temp int) +0:30 false case +0:30 Constant: +0:30 10 (const int) +0:30 move second child to first child ( temp int) +0:30 'b' ( temp int) +0:30 Test condition and select ( temp int) +0:30 Condition +0:30 Convert int to bool ( temp bool) +0:30 'a' ( temp int) +0:30 true case +0:30 move second child to first child ( temp int) +0:30 'd' ( temp int) +0:30 'c' ( temp int) +0:30 false case +0:30 Constant: +0:30 11 (const int) +0:32 move second child to first child ( temp 4-component vector of float) +0:32 'f' ( temp 4-component vector of float) +0:32 Test condition and select ( temp 4-component vector of float) +0:32 Condition +0:32 Compare Less Than ( temp bool) +0:32 direct index ( temp float) +0:32 'ret' ( temp 4-component vector of float) +0:32 Constant: +0:32 0 (const int) +0:32 direct index ( temp float) +0:32 'input' ( in 4-component vector of float) +0:32 Constant: +0:32 1 (const int) +0:32 true case +0:32 vector-scale ( temp 4-component vector of float) +0:32 Convert int to float ( temp float) +0:32 'c' ( temp int) +0:32 'input' ( in 4-component vector of float) +0:32 false case +0:32 vector-scale ( temp 4-component vector of float) +0:32 Convert int to float ( temp float) +0:32 'd' ( temp int) +0:32 'input' ( in 4-component vector of float) +0:34 Branch: Return with expression +0:33 add ( temp 4-component vector of float) +0:33 add ( temp 4-component vector of float) +0:33 add ( temp 4-component vector of float) +0:33 vector-scale ( temp 4-component vector of float) +0:33 Convert int to float ( temp float) +0:33 'e' ( temp int) +0:33 'ret' ( temp 4-component vector of float) +0:33 'f' ( temp 4-component vector of float) +0:33 Function Call: vectorCond( ( temp 4-component vector of float) +0:? Construct vec4 ( temp 4-component vector of float) +0:34 Function Call: fbSelect(vb2;vf2;vf2; ( temp 2-component vector of float) +0:? Constant: +0:? true (const bool) +0:? false (const bool) +0:? Constant: +0:? 1.000000 +0:? 2.000000 +0:? Constant: +0:? 3.000000 +0:? 4.000000 +0:34 Constant: +0:34 10.000000 +0:34 Constant: +0:34 10.000000 +0:20 Function Definition: PixelShaderFunction( ( temp void) +0:20 Function Parameters: +0:? Sequence +0:20 move second child to first child ( temp 4-component vector of float) 0:? 'input' ( temp 4-component vector of float) 0:? 'input' (layout( location=0) in 4-component vector of float) -0:2 move second child to first child ( temp 4-component vector of float) +0:20 move second child to first child ( temp 4-component vector of float) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) -0:2 Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float) +0:20 Function Call: @PixelShaderFunction(vf4; ( temp 4-component vector of float) 0:? 'input' ( temp 4-component vector of float) 0:? Linker Objects +0:? 'anon@0' (layout( row_major std140) uniform block{ uniform 4-component vector of float c4, uniform 4-component vector of float t4, uniform 4-component vector of float f4, uniform float t, uniform float f}) 0:? '@entryPointOutput' (layout( location=0) out 4-component vector of float) 0:? 'input' (layout( location=0) in 4-component vector of float) // Module Version 10000 // Generated by (magic number): 80001 -// Id's are bound by 102 +// Id's are bound by 186 Capability Shader 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 - EntryPoint Fragment 4 "PixelShaderFunction" 95 98 + EntryPoint Fragment 4 "PixelShaderFunction" 179 182 ExecutionMode 4 OriginUpperLeft Source HLSL 500 Name 4 "PixelShaderFunction" - Name 11 "@PixelShaderFunction(vf4;" - Name 10 "input" - Name 15 "a" - Name 17 "b" - Name 19 "c" - Name 21 "d" - Name 22 "ret" - Name 42 "e" - Name 64 "f" - Name 93 "input" - Name 95 "input" - Name 98 "@entryPointOutput" - Name 99 "param" - Decorate 95(input) Location 0 - Decorate 98(@entryPointOutput) Location 0 + Name 9 "vectorCond(" + Name 20 "fbSelect(vb2;vf2;vf2;" + Name 17 "cnd" + Name 18 "src0" + Name 19 "src1" + Name 25 "@PixelShaderFunction(vf4;" + Name 24 "input" + Name 27 "$Global" + MemberName 27($Global) 0 "c4" + MemberName 27($Global) 1 "t4" + MemberName 27($Global) 2 "f4" + MemberName 27($Global) 3 "t" + MemberName 27($Global) 4 "f" + Name 29 "" + Name 80 "a" + Name 82 "b" + Name 84 "c" + Name 86 "d" + Name 87 "ret" + Name 107 "e" + Name 128 "f" + Name 166 "param" + Name 167 "param" + Name 168 "param" + Name 177 "input" + Name 179 "input" + Name 182 "@entryPointOutput" + Name 183 "param" + MemberDecorate 27($Global) 0 Offset 0 + MemberDecorate 27($Global) 1 Offset 16 + MemberDecorate 27($Global) 2 Offset 32 + MemberDecorate 27($Global) 3 Offset 48 + MemberDecorate 27($Global) 4 Offset 52 + Decorate 27($Global) Block + Decorate 29 DescriptorSet 0 + Decorate 179(input) Location 0 + Decorate 182(@entryPointOutput) Location 0 2: TypeVoid 3: TypeFunction 2 6: TypeFloat 32 7: TypeVector 6(float) 4 - 8: TypePointer Function 7(fvec4) - 9: TypeFunction 7(fvec4) 8(ptr) - 13: TypeInt 32 1 - 14: TypePointer Function 13(int) - 16: 13(int) Constant 5 - 18: 13(int) Constant 6 - 20: 13(int) Constant 7 - 45: TypeBool - 46: TypeInt 32 0 - 47: 46(int) Constant 0 - 53: 13(int) Constant 10 - 62: 13(int) Constant 11 - 66: TypePointer Function 6(float) - 69: 46(int) Constant 1 - 94: TypePointer Input 7(fvec4) - 95(input): 94(ptr) Variable Input - 97: TypePointer Output 7(fvec4) -98(@entryPointOutput): 97(ptr) Variable Output + 8: TypeFunction 7(fvec4) + 11: TypeBool + 12: TypeVector 11(bool) 2 + 13: TypePointer Function 12(bvec2) + 14: TypeVector 6(float) 2 + 15: TypePointer Function 14(fvec2) + 16: TypeFunction 14(fvec2) 13(ptr) 15(ptr) 15(ptr) + 22: TypePointer Function 7(fvec4) + 23: TypeFunction 7(fvec4) 22(ptr) + 27($Global): TypeStruct 7(fvec4) 7(fvec4) 7(fvec4) 6(float) 6(float) + 28: TypePointer Uniform 27($Global) + 29: 28(ptr) Variable Uniform + 30: TypeInt 32 1 + 31: 30(int) Constant 2 + 32: TypePointer Uniform 7(fvec4) + 35: 30(int) Constant 1 + 38: 30(int) Constant 0 + 41: TypeVector 11(bool) 4 + 42: 6(float) Constant 0 + 43: 7(fvec4) ConstantComposite 42 42 42 42 + 46: 30(int) Constant 4 + 47: TypePointer Uniform 6(float) + 51: 30(int) Constant 3 + 79: TypePointer Function 30(int) + 81: 30(int) Constant 5 + 83: 30(int) Constant 6 + 85: 30(int) Constant 7 + 110: TypeInt 32 0 + 111: 110(int) Constant 0 + 117: 30(int) Constant 10 + 126: 30(int) Constant 11 + 130: TypePointer Function 6(float) + 133: 110(int) Constant 1 + 157: 11(bool) ConstantTrue + 158: 11(bool) ConstantFalse + 159: 12(bvec2) ConstantComposite 157 158 + 160: 6(float) Constant 1065353216 + 161: 6(float) Constant 1073741824 + 162: 14(fvec2) ConstantComposite 160 161 + 163: 6(float) Constant 1077936128 + 164: 6(float) Constant 1082130432 + 165: 14(fvec2) ConstantComposite 163 164 + 170: 6(float) Constant 1092616192 + 178: TypePointer Input 7(fvec4) + 179(input): 178(ptr) Variable Input + 181: TypePointer Output 7(fvec4) +182(@entryPointOutput): 181(ptr) Variable Output 4(PixelShaderFunction): 2 Function None 3 5: Label - 93(input): 8(ptr) Variable Function - 99(param): 8(ptr) Variable Function - 96: 7(fvec4) Load 95(input) - Store 93(input) 96 - 100: 7(fvec4) Load 93(input) - Store 99(param) 100 - 101: 7(fvec4) FunctionCall 11(@PixelShaderFunction(vf4;) 99(param) - Store 98(@entryPointOutput) 101 + 177(input): 22(ptr) Variable Function + 183(param): 22(ptr) Variable Function + 180: 7(fvec4) Load 179(input) + Store 177(input) 180 + 184: 7(fvec4) Load 177(input) + Store 183(param) 184 + 185: 7(fvec4) FunctionCall 25(@PixelShaderFunction(vf4;) 183(param) + Store 182(@entryPointOutput) 185 Return FunctionEnd -11(@PixelShaderFunction(vf4;): 7(fvec4) Function None 9 - 10(input): 8(ptr) FunctionParameter - 12: Label - 15(a): 14(ptr) Variable Function - 17(b): 14(ptr) Variable Function - 19(c): 14(ptr) Variable Function - 21(d): 14(ptr) Variable Function - 22(ret): 8(ptr) Variable Function - 42(e): 14(ptr) Variable Function - 43: 14(ptr) Variable Function - 55: 14(ptr) Variable Function - 64(f): 8(ptr) Variable Function - 65: 8(ptr) Variable Function - Store 15(a) 16 - Store 17(b) 18 - Store 19(c) 20 - Store 21(d) 20 - 23: 13(int) Load 15(a) - 24: 6(float) ConvertSToF 23 - 25: 7(fvec4) Load 10(input) - 26: 7(fvec4) VectorTimesScalar 25 24 - 27: 13(int) Load 17(b) - 28: 6(float) ConvertSToF 27 - 29: 7(fvec4) Load 10(input) - 30: 7(fvec4) VectorTimesScalar 29 28 - 31: 7(fvec4) FAdd 26 30 - 32: 13(int) Load 19(c) - 33: 6(float) ConvertSToF 32 - 34: 7(fvec4) Load 10(input) - 35: 7(fvec4) VectorTimesScalar 34 33 - 36: 7(fvec4) FAdd 31 35 - 37: 13(int) Load 21(d) - 38: 6(float) ConvertSToF 37 - 39: 7(fvec4) Load 10(input) - 40: 7(fvec4) VectorTimesScalar 39 38 - 41: 7(fvec4) FAdd 36 40 - Store 22(ret) 41 - 44: 13(int) Load 17(b) - 48: 45(bool) INotEqual 44 47 - SelectionMerge 50 None - BranchConditional 48 49 52 - 49: Label - 51: 13(int) Load 21(d) - Store 19(c) 51 - Store 43 51 - Branch 50 - 52: Label - Store 43 53 - Branch 50 - 50: Label - 54: 13(int) Load 43 - Store 15(a) 54 - Store 42(e) 54 - 56: 13(int) Load 15(a) - 57: 45(bool) INotEqual 56 47 - SelectionMerge 59 None - BranchConditional 57 58 61 - 58: Label - 60: 13(int) Load 19(c) - Store 21(d) 60 - Store 55 60 - Branch 59 - 61: Label - Store 55 62 - Branch 59 - 59: Label - 63: 13(int) Load 55 - Store 17(b) 63 - 67: 66(ptr) AccessChain 22(ret) 47 - 68: 6(float) Load 67 - 70: 66(ptr) AccessChain 10(input) 69 - 71: 6(float) Load 70 - 72: 45(bool) FOrdLessThan 68 71 - SelectionMerge 74 None - BranchConditional 72 73 79 - 73: Label - 75: 13(int) Load 19(c) - 76: 6(float) ConvertSToF 75 - 77: 7(fvec4) Load 10(input) - 78: 7(fvec4) VectorTimesScalar 77 76 - Store 65 78 - Branch 74 - 79: Label - 80: 13(int) Load 21(d) - 81: 6(float) ConvertSToF 80 - 82: 7(fvec4) Load 10(input) - 83: 7(fvec4) VectorTimesScalar 82 81 - Store 65 83 - Branch 74 - 74: Label - 84: 7(fvec4) Load 65 - Store 64(f) 84 - 85: 13(int) Load 42(e) - 86: 6(float) ConvertSToF 85 - 87: 7(fvec4) Load 22(ret) - 88: 7(fvec4) VectorTimesScalar 87 86 - 89: 7(fvec4) Load 64(f) - 90: 7(fvec4) FAdd 88 89 - ReturnValue 90 + 9(vectorCond(): 7(fvec4) Function None 8 + 10: Label + 33: 32(ptr) AccessChain 29 31 + 34: 7(fvec4) Load 33 + 36: 32(ptr) AccessChain 29 35 + 37: 7(fvec4) Load 36 + 39: 32(ptr) AccessChain 29 38 + 40: 7(fvec4) Load 39 + 44: 41(bvec4) FOrdNotEqual 40 43 + 45: 7(fvec4) Select 44 37 34 + 48: 47(ptr) AccessChain 29 46 + 49: 6(float) Load 48 + 50: 7(fvec4) CompositeConstruct 49 49 49 49 + 52: 47(ptr) AccessChain 29 51 + 53: 6(float) Load 52 + 54: 7(fvec4) CompositeConstruct 53 53 53 53 + 55: 32(ptr) AccessChain 29 38 + 56: 7(fvec4) Load 55 + 57: 41(bvec4) FOrdNotEqual 56 43 + 58: 7(fvec4) Select 57 54 50 + 59: 7(fvec4) FAdd 45 58 + 60: 32(ptr) AccessChain 29 31 + 61: 7(fvec4) Load 60 + 62: 32(ptr) AccessChain 29 35 + 63: 7(fvec4) Load 62 + 64: 32(ptr) AccessChain 29 35 + 65: 7(fvec4) Load 64 + 66: 32(ptr) AccessChain 29 31 + 67: 7(fvec4) Load 66 + 68: 41(bvec4) FOrdLessThan 65 67 + 69: 7(fvec4) Select 68 63 61 + 70: 7(fvec4) FAdd 59 69 + ReturnValue 70 + FunctionEnd +20(fbSelect(vb2;vf2;vf2;): 14(fvec2) Function None 16 + 17(cnd): 13(ptr) FunctionParameter + 18(src0): 15(ptr) FunctionParameter + 19(src1): 15(ptr) FunctionParameter + 21: Label + 73: 14(fvec2) Load 19(src1) + 74: 14(fvec2) Load 18(src0) + 75: 12(bvec2) Load 17(cnd) + 76: 14(fvec2) Select 75 74 73 + ReturnValue 76 + FunctionEnd +25(@PixelShaderFunction(vf4;): 7(fvec4) Function None 23 + 24(input): 22(ptr) FunctionParameter + 26: Label + 80(a): 79(ptr) Variable Function + 82(b): 79(ptr) Variable Function + 84(c): 79(ptr) Variable Function + 86(d): 79(ptr) Variable Function + 87(ret): 22(ptr) Variable Function + 107(e): 79(ptr) Variable Function + 108: 79(ptr) Variable Function + 119: 79(ptr) Variable Function + 128(f): 22(ptr) Variable Function + 129: 22(ptr) Variable Function + 166(param): 13(ptr) Variable Function + 167(param): 15(ptr) Variable Function + 168(param): 15(ptr) Variable Function + Store 80(a) 81 + Store 82(b) 83 + Store 84(c) 85 + Store 86(d) 85 + 88: 30(int) Load 80(a) + 89: 6(float) ConvertSToF 88 + 90: 7(fvec4) Load 24(input) + 91: 7(fvec4) VectorTimesScalar 90 89 + 92: 30(int) Load 82(b) + 93: 6(float) ConvertSToF 92 + 94: 7(fvec4) Load 24(input) + 95: 7(fvec4) VectorTimesScalar 94 93 + 96: 7(fvec4) FAdd 91 95 + 97: 30(int) Load 84(c) + 98: 6(float) ConvertSToF 97 + 99: 7(fvec4) Load 24(input) + 100: 7(fvec4) VectorTimesScalar 99 98 + 101: 7(fvec4) FAdd 96 100 + 102: 30(int) Load 86(d) + 103: 6(float) ConvertSToF 102 + 104: 7(fvec4) Load 24(input) + 105: 7(fvec4) VectorTimesScalar 104 103 + 106: 7(fvec4) FAdd 101 105 + Store 87(ret) 106 + 109: 30(int) Load 82(b) + 112: 11(bool) INotEqual 109 111 + SelectionMerge 114 None + BranchConditional 112 113 116 + 113: Label + 115: 30(int) Load 86(d) + Store 84(c) 115 + Store 108 115 + Branch 114 + 116: Label + Store 108 117 + Branch 114 + 114: Label + 118: 30(int) Load 108 + Store 80(a) 118 + Store 107(e) 118 + 120: 30(int) Load 80(a) + 121: 11(bool) INotEqual 120 111 + SelectionMerge 123 None + BranchConditional 121 122 125 + 122: Label + 124: 30(int) Load 84(c) + Store 86(d) 124 + Store 119 124 + Branch 123 + 125: Label + Store 119 126 + Branch 123 + 123: Label + 127: 30(int) Load 119 + Store 82(b) 127 + 131: 130(ptr) AccessChain 87(ret) 111 + 132: 6(float) Load 131 + 134: 130(ptr) AccessChain 24(input) 133 + 135: 6(float) Load 134 + 136: 11(bool) FOrdLessThan 132 135 + SelectionMerge 138 None + BranchConditional 136 137 143 + 137: Label + 139: 30(int) Load 84(c) + 140: 6(float) ConvertSToF 139 + 141: 7(fvec4) Load 24(input) + 142: 7(fvec4) VectorTimesScalar 141 140 + Store 129 142 + Branch 138 + 143: Label + 144: 30(int) Load 86(d) + 145: 6(float) ConvertSToF 144 + 146: 7(fvec4) Load 24(input) + 147: 7(fvec4) VectorTimesScalar 146 145 + Store 129 147 + Branch 138 + 138: Label + 148: 7(fvec4) Load 129 + Store 128(f) 148 + 149: 30(int) Load 107(e) + 150: 6(float) ConvertSToF 149 + 151: 7(fvec4) Load 87(ret) + 152: 7(fvec4) VectorTimesScalar 151 150 + 153: 7(fvec4) Load 128(f) + 154: 7(fvec4) FAdd 152 153 + 155: 7(fvec4) FunctionCall 9(vectorCond() + 156: 7(fvec4) FAdd 154 155 + Store 166(param) 159 + Store 167(param) 162 + Store 168(param) 165 + 169: 14(fvec2) FunctionCall 20(fbSelect(vb2;vf2;vf2;) 166(param) 167(param) 168(param) + 171: 6(float) CompositeExtract 169 0 + 172: 6(float) CompositeExtract 169 1 + 173: 7(fvec4) CompositeConstruct 171 172 170 170 + 174: 7(fvec4) FAdd 156 173 + ReturnValue 174 FunctionEnd diff --git a/3rdparty/glslang/Test/baseResults/hlsl.inf.vert.out b/3rdparty/glslang/Test/baseResults/hlsl.inf.vert.out new file mode 100755 index 000000000..ef551e7f3 --- /dev/null +++ b/3rdparty/glslang/Test/baseResults/hlsl.inf.vert.out @@ -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 diff --git a/3rdparty/glslang/Test/baseResults/hlsl.isfinite.frag.out b/3rdparty/glslang/Test/baseResults/hlsl.isfinite.frag.out index 0687c0d9e..3ac6ac269 100644 --- a/3rdparty/glslang/Test/baseResults/hlsl.isfinite.frag.out +++ b/3rdparty/glslang/Test/baseResults/hlsl.isfinite.frag.out @@ -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 diff --git a/3rdparty/glslang/Test/baseResults/hlsl.shapeConv.frag.out b/3rdparty/glslang/Test/baseResults/hlsl.shapeConv.frag.out index 775549f13..a26b81927 100755 --- a/3rdparty/glslang/Test/baseResults/hlsl.shapeConv.frag.out +++ b/3rdparty/glslang/Test/baseResults/hlsl.shapeConv.frag.out @@ -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 diff --git a/3rdparty/glslang/Test/baseResults/spv.float16.frag.out b/3rdparty/glslang/Test/baseResults/spv.float16.frag.out index 78156e40b..7c2b3c05f 100644 --- a/3rdparty/glslang/Test/baseResults/spv.float16.frag.out +++ b/3rdparty/glslang/Test/baseResults/spv.float16.frag.out @@ -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 diff --git a/3rdparty/glslang/Test/baseResults/spv.shaderBallotAMD.comp.out b/3rdparty/glslang/Test/baseResults/spv.shaderBallotAMD.comp.out index bb7f8c162..8011fb664 100644 --- a/3rdparty/glslang/Test/baseResults/spv.shaderBallotAMD.comp.out +++ b/3rdparty/glslang/Test/baseResults/spv.shaderBallotAMD.comp.out @@ -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" diff --git a/3rdparty/glslang/Test/hlsl.boolConv.vert b/3rdparty/glslang/Test/hlsl.boolConv.vert new file mode 100755 index 000000000..7efe20b0a --- /dev/null +++ b/3rdparty/glslang/Test/hlsl.boolConv.vert @@ -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; +} \ No newline at end of file diff --git a/3rdparty/glslang/Test/hlsl.buffer.frag b/3rdparty/glslang/Test/hlsl.buffer.frag index b93dcd312..1604ea4ea 100644 --- a/3rdparty/glslang/Test/hlsl.buffer.frag +++ b/3rdparty/glslang/Test/hlsl.buffer.frag @@ -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 { diff --git a/3rdparty/glslang/Test/hlsl.charLit.vert b/3rdparty/glslang/Test/hlsl.charLit.vert new file mode 100755 index 000000000..36c4a1e5e --- /dev/null +++ b/3rdparty/glslang/Test/hlsl.charLit.vert @@ -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; +} diff --git a/3rdparty/glslang/Test/hlsl.conditional.frag b/3rdparty/glslang/Test/hlsl.conditional.frag index 128c5931a..8176d01ff 100644 --- a/3rdparty/glslang/Test/hlsl.conditional.frag +++ b/3rdparty/glslang/Test/hlsl.conditional.frag @@ -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); } diff --git a/3rdparty/glslang/Test/hlsl.inf.vert b/3rdparty/glslang/Test/hlsl.inf.vert new file mode 100755 index 000000000..d57b83793 --- /dev/null +++ b/3rdparty/glslang/Test/hlsl.inf.vert @@ -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); +} \ No newline at end of file diff --git a/3rdparty/glslang/Test/hlsl.isfinite.frag b/3rdparty/glslang/Test/hlsl.isfinite.frag index a788bedf9..6e40f6a8e 100644 --- a/3rdparty/glslang/Test/hlsl.isfinite.frag +++ b/3rdparty/glslang/Test/hlsl.isfinite.frag @@ -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; } diff --git a/3rdparty/glslang/Test/hlsl.shapeConv.frag b/3rdparty/glslang/Test/hlsl.shapeConv.frag index adb170eab..16a204574 100644 --- a/3rdparty/glslang/Test/hlsl.shapeConv.frag +++ b/3rdparty/glslang/Test/hlsl.shapeConv.frag @@ -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; } diff --git a/3rdparty/glslang/glslang/Include/revision.h b/3rdparty/glslang/glslang/Include/revision.h index 31b5fee48..218f8b67f 100644 --- a/3rdparty/glslang/glslang/Include/revision.h +++ b/3rdparty/glslang/glslang/Include/revision.h @@ -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" diff --git a/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp b/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp index 85c0151de..399902222 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/Intermediate.cpp @@ -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: diff --git a/3rdparty/glslang/glslang/MachineIndependent/intermOut.cpp b/3rdparty/glslang/glslang/MachineIndependent/intermOut.cpp index c0c60c57b..e5b555bb0 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/intermOut.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/intermOut.cpp @@ -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]; diff --git a/3rdparty/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp b/3rdparty/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp index 590290bbd..e71e79c4c 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/preprocessor/Pp.cpp @@ -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') { diff --git a/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.h b/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.h index f1c41abd3..a459d9a2a 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.h +++ b/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpContext.h @@ -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) { diff --git a/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp b/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp index dd1626932..e72efc048 100644 --- a/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp +++ b/3rdparty/glslang/glslang/MachineIndependent/preprocessor/PpScanner.cpp @@ -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 diff --git a/3rdparty/glslang/gtests/Hlsl.FromFile.cpp b/3rdparty/glslang/gtests/Hlsl.FromFile.cpp index 6bbc16b9b..c616dfdfd 100644 --- a/3rdparty/glslang/gtests/Hlsl.FromFile.cpp +++ b/3rdparty/glslang/gtests/Hlsl.FromFile.cpp @@ -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"}, diff --git a/3rdparty/glslang/hlsl/hlslGrammar.cpp b/3rdparty/glslang/hlsl/hlslGrammar.cpp index b8932cea3..f58f74204 100755 --- a/3rdparty/glslang/hlsl/hlslGrammar.cpp +++ b/3rdparty/glslang/hlsl/hlslGrammar.cpp @@ -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; diff --git a/3rdparty/glslang/hlsl/hlslParseHelper.cpp b/3rdparty/glslang/hlsl/hlslParseHelper.cpp index 745ee4005..a2a490ca7 100755 --- a/3rdparty/glslang/hlsl/hlslParseHelper.cpp +++ b/3rdparty/glslang/hlsl/hlslParseHelper.cpp @@ -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; diff --git a/3rdparty/glslang/hlsl/hlslParseHelper.h b/3rdparty/glslang/hlsl/hlslParseHelper.h index 14c9809ea..947fef771 100755 --- a/3rdparty/glslang/hlsl/hlslParseHelper.h +++ b/3rdparty/glslang/hlsl/hlslParseHelper.h @@ -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&);