Web: Remove a few additional HLSL constructs with ENABLE_HLSL.

Saves about 3K.
This commit is contained in:
John Kessenich 2019-07-27 05:22:30 -06:00
parent 13761069b5
commit d4ed5158d1
6 changed files with 39 additions and 16 deletions

View File

@ -996,8 +996,10 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
shader->setNanMinMaxClamp(NaNClamp);
shader->setResourceSetBinding(baseResourceSetBinding[compUnit.stage]);
#ifdef ENABLE_HLSL
if (Options & EOptionHlslIoMapping)
shader->setHlslIoMapping(true);
#endif
if (Options & EOptionAutoMapBindings)
shader->setAutoMapBindings(true);
@ -1023,8 +1025,10 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
compUnit.stage, Client, ClientInputSemanticsVersion);
shader->setEnvClient(Client, ClientVersion);
shader->setEnvTarget(TargetLanguage, TargetVersion);
#ifdef ENABLE_HLSL
if (targetHlslFunctionality1)
shader->setEnvTargetHlslFunctionality1();
#endif
}
shaders.push_back(shader);

View File

@ -1 +1 @@
1213440 ../build/install/bin/glslangValidator.exe
1210368 ../build/install/bin/glslangValidator.exe

View File

@ -837,9 +837,10 @@ bool ProcessDeferred(
SpvVersion spvVersion;
EShLanguage stage = compiler->getLanguage();
TranslateEnvironment(environment, messages, source, stage, spvVersion);
#ifdef ENABLE_HLSL
if (environment != nullptr && environment->target.hlslFunctionality1)
intermediate.setHlslFunctionality1();
#endif
// First, without using the preprocessor or parser, find the #version, so we know what
// symbol tables, processing rules, etc. to set up. This does not need the extra strings
// outlined above, just the user shader, after the system and user preambles.
@ -887,8 +888,10 @@ bool ProcessDeferred(
RecordProcesses(intermediate, messages, sourceEntryPointName);
if (spvVersion.vulkan > 0)
intermediate.setOriginUpperLeft();
#ifdef ENABLE_HLSL
if ((messages & EShMsgHlslOffsets) || source == EShSourceHlsl)
intermediate.setHlslOffsets();
#endif
if (messages & EShMsgDebugInfo) {
intermediate.setSourceFile(names[numPre]);
for (int s = 0; s < numStrings; ++s) {
@ -1788,7 +1791,9 @@ void TShader::setUniformLocationBase(int base)
intermediate->setUniformLocationBase(base);
}
// See comment above TDefaultHlslIoMapper in iomapper.cpp:
#ifdef ENABLE_HLSL
void TShader::setHlslIoMapping(bool hlslIoMap) { intermediate->setHlslIoMapping(hlslIoMap); }
#endif
void TShader::setFlattenUniformArrays(bool flatten) { intermediate->setFlattenUniformArrays(flatten); }
void TShader::setNoStorageFormat(bool useUnknownFormat) { intermediate->setNoStorageFormat(useUnknownFormat); }
void TShader::setNanMinMaxClamp(bool useNonNan) { intermediate->setNanMinMaxClamp(useNonNan); }

View File

@ -376,26 +376,12 @@ public:
processes.addProcess("no-storage-format");
}
bool getNoStorageFormat() const { return useUnknownFormat; }
void setHlslOffsets()
{
hlslOffsets = true;
if (hlslOffsets)
processes.addProcess("hlsl-offsets");
}
bool usingHlslOffsets() const { return hlslOffsets; }
void setUseStorageBuffer()
{
useStorageBuffer = true;
processes.addProcess("use-storage-buffer");
}
bool usingStorageBuffer() const { return useStorageBuffer; }
void setHlslIoMapping(bool b)
{
hlslIoMapping = b;
if (hlslIoMapping)
processes.addProcess("hlsl-iomap");
}
bool usingHlslIoMapping() { return hlslIoMapping; }
void setUseVulkanMemoryModel()
{
useVulkanMemoryModel = true;
@ -667,8 +653,28 @@ public:
void setDepthReplacing() { depthReplacing = true; }
bool isDepthReplacing() const { return depthReplacing; }
#ifdef ENABLE_HLSL
void setHlslFunctionality1() { hlslFunctionality1 = true; }
bool getHlslFunctionality1() const { return hlslFunctionality1; }
void setHlslOffsets()
{
hlslOffsets = true;
if (hlslOffsets)
processes.addProcess("hlsl-offsets");
}
bool usingHlslOffsets() const { return hlslOffsets; }
void setHlslIoMapping(bool b)
{
hlslIoMapping = b;
if (hlslIoMapping)
processes.addProcess("hlsl-iomap");
}
bool usingHlslIoMapping() { return hlslIoMapping; }
#else
bool getHlslFunctionality1() const { return false; }
bool usingHlslOffsets() const { return false; }
bool usingHlslIoMapping() { return false; }
#endif
void addBlendEquation(TBlendEquationShift b) { blendEquations |= (1 << b); }
unsigned int getBlendEquations() const { return blendEquations; }

View File

@ -142,6 +142,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
ch = getChar();
int firstDecimal = len;
#ifdef ENABLE_HLSL
// 1.#INF or -1.#INF
if (ch == '#' && (ifdepth > 0 || parseContext.intermediate.getSource() == EShSourceHlsl)) {
if ((len < 2) ||
@ -169,6 +170,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
}
}
}
#endif
// Consume leading-zero digits after the decimal point
while (ch == '0') {

View File

@ -432,7 +432,9 @@ public:
void addUniformLocationOverride(const char* name, int loc);
void setUniformLocationBase(int base);
void setInvertY(bool invert);
#ifdef ENABLE_HLSL
void setHlslIoMapping(bool hlslIoMap);
#endif
void setFlattenUniformArrays(bool flatten);
void setNoStorageFormat(bool useUnknownFormat);
void setNanMinMaxClamp(bool nanMinMaxClamp);
@ -459,8 +461,12 @@ public:
environment.target.language = lang;
environment.target.version = version;
}
#ifdef ENABLE_HLSL
void setEnvTargetHlslFunctionality1() { environment.target.hlslFunctionality1 = true; }
bool getEnvTargetHlslFunctionality1() const { return environment.target.hlslFunctionality1; }
#else
bool getEnvTargetHlslFunctionality1() const { return false; }
#endif
// Interface to #include handlers.
//