diff --git a/Source/Core/ShaderConductor.cpp b/Source/Core/ShaderConductor.cpp index 247547a6..7b851453 100644 --- a/Source/Core/ShaderConductor.cpp +++ b/Source/Core/ShaderConductor.cpp @@ -396,7 +396,7 @@ namespace } Compiler::ResultDesc CompileToBinary(const Compiler::SourceDesc& source, const Compiler::Options& options, - ShadingLanguage targetLanguage, bool asModule) + ShadingLanguage targetLanguage, bool asModule, bool glFriendlyLayout) { assert((targetLanguage == ShadingLanguage::Dxil) || (targetLanguage == ShadingLanguage::SpirV)); @@ -550,6 +550,11 @@ namespace llvm_unreachable("Invalid shading language."); } + if (glFriendlyLayout) + { + dxcArgStrings.push_back(L"-fvk-use-gl-layout"); + } + std::vector dxcArgs; dxcArgs.reserve(dxcArgStrings.size()); for (const auto& arg : dxcArgStrings) @@ -898,6 +903,7 @@ namespace ShaderConductor bool hasDxil = false; bool hasDxilModule = false; bool hasSpirV = false; + bool hasGL = false; for (uint32_t i = 0; i < numTargets; ++i) { if (targets[i].language == ShadingLanguage::Dxil) @@ -912,24 +918,29 @@ namespace ShaderConductor { hasSpirV = true; } + + if (targets[i].language == ShadingLanguage::Glsl || targets[i].language == ShadingLanguage::Essl) + { + hasGL = true; + } } ResultDesc dxilBinaryResult{}; if (hasDxil) { - dxilBinaryResult = CompileToBinary(sourceOverride, options, ShadingLanguage::Dxil, false); + dxilBinaryResult = CompileToBinary(sourceOverride, options, ShadingLanguage::Dxil, false, false); } ResultDesc dxilModuleBinaryResult{}; if (hasDxilModule) { - dxilModuleBinaryResult = CompileToBinary(sourceOverride, options, ShadingLanguage::Dxil, true); + dxilModuleBinaryResult = CompileToBinary(sourceOverride, options, ShadingLanguage::Dxil, true, false); } ResultDesc spirvBinaryResult{}; if (hasSpirV) { - spirvBinaryResult = CompileToBinary(sourceOverride, options, ShadingLanguage::SpirV, false); + spirvBinaryResult = CompileToBinary(sourceOverride, options, ShadingLanguage::SpirV, false, hasGL); } for (uint32_t i = 0; i < numTargets; ++i)