mirror of
https://github.com/RPCS3/glslang.git
synced 2024-12-05 01:37:07 +00:00
Merge pull request #1794 from jeffbolznv/pre_legalization
Use spvValidatorOptionsSetBeforeHlslLegalization for pre-legalized HLSL
This commit is contained in:
commit
60e774b22f
@ -8090,11 +8090,14 @@ void GlslangToSpv(const TIntermediate& intermediate, std::vector<unsigned int>&
|
||||
#if ENABLE_OPT
|
||||
// If from HLSL, run spirv-opt to "legalize" the SPIR-V for Vulkan
|
||||
// eg. forward and remove memory writes of opaque types.
|
||||
if ((intermediate.getSource() == EShSourceHlsl || options->optimizeSize) && !options->disableOptimizer)
|
||||
bool prelegalization = intermediate.getSource() == EShSourceHlsl;
|
||||
if ((intermediate.getSource() == EShSourceHlsl || options->optimizeSize) && !options->disableOptimizer) {
|
||||
SpirvToolsLegalize(intermediate, spirv, logger, options);
|
||||
prelegalization = false;
|
||||
}
|
||||
|
||||
if (options->validate)
|
||||
SpirvToolsValidate(intermediate, spirv, logger);
|
||||
SpirvToolsValidate(intermediate, spirv, logger, prelegalization);
|
||||
|
||||
if (options->disassemble)
|
||||
SpirvToolsDisassemble(std::cout, spirv);
|
||||
|
@ -103,7 +103,7 @@ void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& s
|
||||
|
||||
// Apply the SPIRV-Tools validator to generated SPIR-V.
|
||||
void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,
|
||||
spv::SpvBuildLogger* logger)
|
||||
spv::SpvBuildLogger* logger, bool prelegalization)
|
||||
{
|
||||
// validate
|
||||
spv_context context = spvContextCreate(MapToSpirvToolsEnv(intermediate.getSpv(), logger));
|
||||
@ -111,6 +111,7 @@ void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector<
|
||||
spv_diagnostic diagnostic = nullptr;
|
||||
spv_validator_options options = spvValidatorOptionsCreate();
|
||||
spvValidatorOptionsSetRelaxBlockLayout(options, intermediate.usingHlslOffsets());
|
||||
spvValidatorOptionsSetBeforeHlslLegalization(options, prelegalization);
|
||||
spvValidateWithOptions(context, options, &binary, &diagnostic);
|
||||
|
||||
// report
|
||||
|
@ -66,7 +66,7 @@ void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& s
|
||||
|
||||
// Apply the SPIRV-Tools validator to generated SPIR-V.
|
||||
void SpirvToolsValidate(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv,
|
||||
spv::SpvBuildLogger*);
|
||||
spv::SpvBuildLogger*, bool prelegalization);
|
||||
|
||||
// Apply the SPIRV-Tools optimizer to generated SPIR-V, for the purpose of
|
||||
// legalizing HLSL SPIR-V.
|
||||
|
@ -135,7 +135,6 @@ local_size = (256, 1, 1)
|
||||
0:? 'g_output' (layout( binding=1 rg32ui) uniform uimageBuffer)
|
||||
0:? 'dispatchId' ( in 3-component vector of uint GlobalInvocationID)
|
||||
|
||||
Validation failed
|
||||
// Module Version 10000
|
||||
// Generated by (magic number): 80007
|
||||
// Id's are bound by 63
|
||||
|
Loading…
Reference in New Issue
Block a user