SPIRVCompiler: Pad fragment output components for MSL

Fixes some Reshade shaders not compiling.
This commit is contained in:
Stenzek 2023-11-05 15:03:48 +10:00
parent 38bc2bd057
commit ea51d2a213
No known key found for this signature in database

View file

@ -176,6 +176,11 @@ std::optional<SPIRVCompiler::SPIRVCodeVector> SPIRVCompiler::CompileShader(GPUSh
std::optional<std::string> SPIRVCompiler::CompileSPIRVToMSL(std::span<const SPIRVCodeType> spv)
{
spirv_cross::CompilerMSL compiler(spv.data(), spv.size());
spirv_cross::CompilerMSL::Options options = compiler.get_msl_options();
options.pad_fragment_output_components = true;
compiler.set_msl_options(options);
std::string msl = compiler.compile();
return (msl.empty()) ? std::optional<std::string>() : std::optional<std::string>(std::move(msl));
}