Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions Source/Core/ShaderConductor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));

Expand Down Expand Up @@ -550,6 +550,11 @@ namespace
llvm_unreachable("Invalid shading language.");
}

if (glFriendlyLayout)
{
dxcArgStrings.push_back(L"-fvk-use-gl-layout");
}

std::vector<const wchar_t*> dxcArgs;
dxcArgs.reserve(dxcArgStrings.size());
for (const auto& arg : dxcArgStrings)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand Down