SPV reflection: Add OpModuleProcessed for compile options.

This commit is contained in:
John Kessenich 2017-07-20 20:00:36 -06:00
parent 3d1b709676
commit 2a27116cae
11 changed files with 336 additions and 40 deletions

View file

@ -675,6 +675,22 @@ void TranslateEnvironment(const TEnvironment* environment, EShMessages& messages
}
}
// Most processes are recorded when set in the intermediate representation,
// These are the few that are not.
void RecordProcesses(TIntermediate& intermediate, EShMessages messages, const std::string& sourceEntryPointName)
{
if ((messages & EShMsgRelaxedErrors) != 0)
intermediate.addProcess("relaxed-errors");
if ((messages & EShMsgSuppressWarnings) != 0)
intermediate.addProcess("suppress-warnings");
if ((messages & EShMsgKeepUncalled) != 0)
intermediate.addProcess("keep-uncalled");
if (sourceEntryPointName.size() > 0) {
intermediate.addProcess("source-entrypoint");
intermediate.addProcessArgument(sourceEntryPointName);
}
}
// This is the common setup and cleanup code for PreprocessDeferred and
// CompileDeferred.
// It takes any callable with a signature of
@ -798,6 +814,7 @@ bool ProcessDeferred(
intermediate.setVersion(version);
intermediate.setProfile(profile);
intermediate.setSpv(spvVersion);
RecordProcesses(intermediate, messages, sourceEntryPointName);
if (spvVersion.vulkan >= 100)
intermediate.setOriginUpperLeft();
if ((messages & EShMsgHlslOffsets) || source == EShSourceHlsl)
@ -1641,6 +1658,11 @@ void TShader::setSourceEntryPoint(const char* name)
sourceEntryPointName = name;
}
void TShader::addProcesses(const std::vector<std::string>& p)
{
intermediate->addProcesses(p);
}
// Set binding base for sampler types
void TShader::setShiftSamplerBinding(unsigned int base) { intermediate->setShiftSamplerBinding(base); }
// Set binding base for texture types (SRV)
@ -1658,7 +1680,7 @@ void TShader::setShiftSsboBinding(unsigned int base) { intermediate->setShift
// Enables binding automapping using TIoMapper
void TShader::setAutoMapBindings(bool map) { intermediate->setAutoMapBindings(map); }
// Fragile: currently within one stage: simple auto-assignment of location
void TShader::setAutoMapLocations(bool map) { intermediate->setAutoMapLocations(map); }
void TShader::setAutoMapLocations(bool map) { intermediate->setAutoMapLocations(map); }
// See comment above TDefaultHlslIoMapper in iomapper.cpp:
void TShader::setHlslIoMapping(bool hlslIoMap) { intermediate->setHlslIoMapping(hlslIoMap); }
void TShader::setFlattenUniformArrays(bool flatten) { intermediate->setFlattenUniformArrays(flatten); }