diff --git a/SPIRV/GlslangToSpv.cpp b/SPIRV/GlslangToSpv.cpp index 08526cbf606017ca42f88df57407ca28f0d44f92..3ddc7b2e6871e37e9751fcaf36195d39b9fdf448 100644 --- a/SPIRV/GlslangToSpv.cpp +++ b/SPIRV/GlslangToSpv.cpp @@ -130,6 +130,21 @@ protected: // Helper functions for translating glslang representations to SPIR-V enumerants. // +// Translate glslang profile to SPIR-V source language. +spv::SourceLanguage TranslateSourceLanguage(EProfile profile) +{ + switch (profile) { + case ENoProfile: + case ECoreProfile: + case ECompatibilityProfile: + return spv::SourceLanguageGLSL; + case EEsProfile: + return spv::SourceLanguageESSL; + default: + return spv::SourceLanguageUnknown; + } +} + // Translate glslang language (stage) to SPIR-V execution model. spv::ExecutionModel TranslateExecutionModel(EShLanguage stage) { @@ -339,7 +354,7 @@ TGlslangToSpvTraverser::TGlslangToSpvTraverser(const glslang::TIntermediate* gls spv::ExecutionModel executionModel = TranslateExecutionModel(glslangIntermediate->getStage()); builder.clearAccessChain(); - builder.setSource(spv::SourceLanguageGLSL, glslangIntermediate->getVersion()); + builder.setSource(TranslateSourceLanguage(glslangIntermediate->getProfile()), glslangIntermediate->getVersion()); stdBuiltins = builder.import("GLSL.std.450"); builder.setMemoryModel(spv::AddressingModelLogical, spv::MemoryModelGLSL450); shaderEntry = builder.makeMain(); diff --git a/Test/baseResults/spv.100ops.frag.out b/Test/baseResults/spv.100ops.frag.out index d000faab6088d323bf9dff649129205dc2237638..f07782c6f7bc9d8231727ae53ceb92015a01acd5 100644 --- a/Test/baseResults/spv.100ops.frag.out +++ b/Test/baseResults/spv.100ops.frag.out @@ -10,7 +10,7 @@ Linked fragment stage: // Generated by (magic number): 51a00bb // Id's are bound by 48 - Source GLSL 100 + Source ESSL 100 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 EntryPoint Fragment 4 diff --git a/Test/baseResults/spv.300BuiltIns.vert.out b/Test/baseResults/spv.300BuiltIns.vert.out index 9ec134f3cbd3e428d095715cd976c8aeabd4a1f7..13edf06b25a3f10b275da2293532fc725fcd37c6 100644 --- a/Test/baseResults/spv.300BuiltIns.vert.out +++ b/Test/baseResults/spv.300BuiltIns.vert.out @@ -10,7 +10,7 @@ Linked vertex stage: // Generated by (magic number): 51a00bb // Id's are bound by 41 - Source GLSL 300 + Source ESSL 300 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 EntryPoint Vertex 4 diff --git a/Test/baseResults/spv.300layout.frag.out b/Test/baseResults/spv.300layout.frag.out index d81baf1be57b43fd4f38169280d67a86f000502d..5e2f69950fe7445a04b5d98e4862971b829083ad 100644 --- a/Test/baseResults/spv.300layout.frag.out +++ b/Test/baseResults/spv.300layout.frag.out @@ -10,7 +10,7 @@ Linked fragment stage: // Generated by (magic number): 51a00bb // Id's are bound by 38 - Source GLSL 300 + Source ESSL 300 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 EntryPoint Fragment 4 diff --git a/Test/baseResults/spv.300layoutp.vert.out b/Test/baseResults/spv.300layoutp.vert.out index 6c8697b884fddcf7236cffe7d66f159b0cb3bf8e..c7d9882f5dffc097cb31d0aa6329e963a0bffe9b 100644 --- a/Test/baseResults/spv.300layoutp.vert.out +++ b/Test/baseResults/spv.300layoutp.vert.out @@ -10,7 +10,7 @@ Linked vertex stage: // Generated by (magic number): 51a00bb // Id's are bound by 112 - Source GLSL 300 + Source ESSL 300 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 EntryPoint Vertex 4 diff --git a/Test/baseResults/spv.do-simple.vert.out b/Test/baseResults/spv.do-simple.vert.out index 668d4c4e2de589ea8105703f33b6c7caf2684227..e376b822606c2e7750e9e1f135cbb1499d7f7662 100644 --- a/Test/baseResults/spv.do-simple.vert.out +++ b/Test/baseResults/spv.do-simple.vert.out @@ -10,7 +10,7 @@ Linked vertex stage: // Generated by (magic number): 51a00bb // Id's are bound by 26 - Source GLSL 300 + Source ESSL 300 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 EntryPoint Vertex 4 diff --git a/Test/baseResults/spv.do-while-continue-break.vert.out b/Test/baseResults/spv.do-while-continue-break.vert.out index e6c6ef15204bdcf26a40356befaac8b36a5a0ed4..e9d45265f43f3d195546efa09d67c9beb4740295 100644 --- a/Test/baseResults/spv.do-while-continue-break.vert.out +++ b/Test/baseResults/spv.do-while-continue-break.vert.out @@ -10,7 +10,7 @@ Linked vertex stage: // Generated by (magic number): 51a00bb // Id's are bound by 48 - Source GLSL 300 + Source ESSL 300 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 EntryPoint Vertex 4 diff --git a/Test/baseResults/spv.for-continue-break.vert.out b/Test/baseResults/spv.for-continue-break.vert.out index 60b147cf6bbf8daba292db4c932cc66b95eb5a65..8df0a08238cf378ab1d07b28b54f8c257940f342 100644 --- a/Test/baseResults/spv.for-continue-break.vert.out +++ b/Test/baseResults/spv.for-continue-break.vert.out @@ -10,7 +10,7 @@ Linked vertex stage: // Generated by (magic number): 51a00bb // Id's are bound by 49 - Source GLSL 300 + Source ESSL 300 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 EntryPoint Vertex 4 diff --git a/Test/baseResults/spv.for-simple.vert.out b/Test/baseResults/spv.for-simple.vert.out index 6dc182472beb478259bd825c49a5035c7ccc01b5..180805a74a06e2f45daf5d8aa71091cf5fd58cfd 100644 --- a/Test/baseResults/spv.for-simple.vert.out +++ b/Test/baseResults/spv.for-simple.vert.out @@ -10,7 +10,7 @@ Linked vertex stage: // Generated by (magic number): 51a00bb // Id's are bound by 26 - Source GLSL 300 + Source ESSL 300 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 EntryPoint Vertex 4 diff --git a/Test/baseResults/spv.forwardFun.frag.out b/Test/baseResults/spv.forwardFun.frag.out index 23f8e53ba2d7469109c0891b6a6454b6d7991ec1..2be58e199b22fee68e1757b03db48533851004da 100644 --- a/Test/baseResults/spv.forwardFun.frag.out +++ b/Test/baseResults/spv.forwardFun.frag.out @@ -10,7 +10,7 @@ Linked fragment stage: // Generated by (magic number): 51a00bb // Id's are bound by 59 - Source GLSL 100 + Source ESSL 100 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 EntryPoint Fragment 4 diff --git a/Test/baseResults/spv.precision.frag.out b/Test/baseResults/spv.precision.frag.out index 71abeeb1b0506c50be64db81c15bd185612ee5bb..5ba1a5f7524d34bda7baf075dc61b191606e0d8b 100644 --- a/Test/baseResults/spv.precision.frag.out +++ b/Test/baseResults/spv.precision.frag.out @@ -10,7 +10,7 @@ Linked fragment stage: // Generated by (magic number): 51a00bb // Id's are bound by 111 - Source GLSL 300 + Source ESSL 300 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 EntryPoint Fragment 4 diff --git a/Test/baseResults/spv.switch.frag.out b/Test/baseResults/spv.switch.frag.out index 68a102fe158ed37bbb2677b2f501c94bb44559c7..10a7705c0f0003e5347b6a074bd6655d805a7553 100644 --- a/Test/baseResults/spv.switch.frag.out +++ b/Test/baseResults/spv.switch.frag.out @@ -11,7 +11,7 @@ Linked fragment stage: // Generated by (magic number): 51a00bb // Id's are bound by 249 - Source GLSL 300 + Source ESSL 300 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 EntryPoint Fragment 4 diff --git a/Test/baseResults/spv.uint.frag.out b/Test/baseResults/spv.uint.frag.out index 751294daa1b78360759f9fe992cece0cc3b6f5c6..eb7f4adbb776c034cd41531d6f1c2700802a1e52 100644 --- a/Test/baseResults/spv.uint.frag.out +++ b/Test/baseResults/spv.uint.frag.out @@ -10,7 +10,7 @@ Linked fragment stage: // Generated by (magic number): 51a00bb // Id's are bound by 206 - Source GLSL 300 + Source ESSL 300 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 EntryPoint Fragment 4 diff --git a/Test/baseResults/spv.while-continue-break.vert.out b/Test/baseResults/spv.while-continue-break.vert.out index f072ab7c864b76b5c8c94a82a6b723f74f2eeb75..9d4d3bb04661728403ce1a332fa53fffe14d2c62 100644 --- a/Test/baseResults/spv.while-continue-break.vert.out +++ b/Test/baseResults/spv.while-continue-break.vert.out @@ -10,7 +10,7 @@ Linked vertex stage: // Generated by (magic number): 51a00bb // Id's are bound by 43 - Source GLSL 300 + Source ESSL 300 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 EntryPoint Vertex 4 diff --git a/Test/baseResults/spv.while-simple.vert.out b/Test/baseResults/spv.while-simple.vert.out index 584afab4305cf87b794540615612438d1ae07517..8f35aa1ab775f6a032e08162a086edba5c24d022 100644 --- a/Test/baseResults/spv.while-simple.vert.out +++ b/Test/baseResults/spv.while-simple.vert.out @@ -10,7 +10,7 @@ Linked vertex stage: // Generated by (magic number): 51a00bb // Id's are bound by 24 - Source GLSL 300 + Source ESSL 300 1: ExtInstImport "GLSL.std.450" MemoryModel Logical GLSL450 EntryPoint Vertex 4