Web: Remove a few additional HLSL constructs with ENABLE_HLSL.
Saves about 3K.
This commit is contained in:
parent
13761069b5
commit
d4ed5158d1
6 changed files with 39 additions and 16 deletions
|
|
@ -996,8 +996,10 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||||
shader->setNanMinMaxClamp(NaNClamp);
|
shader->setNanMinMaxClamp(NaNClamp);
|
||||||
shader->setResourceSetBinding(baseResourceSetBinding[compUnit.stage]);
|
shader->setResourceSetBinding(baseResourceSetBinding[compUnit.stage]);
|
||||||
|
|
||||||
|
#ifdef ENABLE_HLSL
|
||||||
if (Options & EOptionHlslIoMapping)
|
if (Options & EOptionHlslIoMapping)
|
||||||
shader->setHlslIoMapping(true);
|
shader->setHlslIoMapping(true);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (Options & EOptionAutoMapBindings)
|
if (Options & EOptionAutoMapBindings)
|
||||||
shader->setAutoMapBindings(true);
|
shader->setAutoMapBindings(true);
|
||||||
|
|
@ -1023,8 +1025,10 @@ void CompileAndLinkShaderUnits(std::vector<ShaderCompUnit> compUnits)
|
||||||
compUnit.stage, Client, ClientInputSemanticsVersion);
|
compUnit.stage, Client, ClientInputSemanticsVersion);
|
||||||
shader->setEnvClient(Client, ClientVersion);
|
shader->setEnvClient(Client, ClientVersion);
|
||||||
shader->setEnvTarget(TargetLanguage, TargetVersion);
|
shader->setEnvTarget(TargetLanguage, TargetVersion);
|
||||||
|
#ifdef ENABLE_HLSL
|
||||||
if (targetHlslFunctionality1)
|
if (targetHlslFunctionality1)
|
||||||
shader->setEnvTargetHlslFunctionality1();
|
shader->setEnvTargetHlslFunctionality1();
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
shaders.push_back(shader);
|
shaders.push_back(shader);
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
1213440 ../build/install/bin/glslangValidator.exe
|
1210368 ../build/install/bin/glslangValidator.exe
|
||||||
|
|
|
||||||
|
|
@ -837,9 +837,10 @@ bool ProcessDeferred(
|
||||||
SpvVersion spvVersion;
|
SpvVersion spvVersion;
|
||||||
EShLanguage stage = compiler->getLanguage();
|
EShLanguage stage = compiler->getLanguage();
|
||||||
TranslateEnvironment(environment, messages, source, stage, spvVersion);
|
TranslateEnvironment(environment, messages, source, stage, spvVersion);
|
||||||
|
#ifdef ENABLE_HLSL
|
||||||
if (environment != nullptr && environment->target.hlslFunctionality1)
|
if (environment != nullptr && environment->target.hlslFunctionality1)
|
||||||
intermediate.setHlslFunctionality1();
|
intermediate.setHlslFunctionality1();
|
||||||
|
#endif
|
||||||
// First, without using the preprocessor or parser, find the #version, so we know what
|
// 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
|
// 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.
|
// outlined above, just the user shader, after the system and user preambles.
|
||||||
|
|
@ -887,8 +888,10 @@ bool ProcessDeferred(
|
||||||
RecordProcesses(intermediate, messages, sourceEntryPointName);
|
RecordProcesses(intermediate, messages, sourceEntryPointName);
|
||||||
if (spvVersion.vulkan > 0)
|
if (spvVersion.vulkan > 0)
|
||||||
intermediate.setOriginUpperLeft();
|
intermediate.setOriginUpperLeft();
|
||||||
|
#ifdef ENABLE_HLSL
|
||||||
if ((messages & EShMsgHlslOffsets) || source == EShSourceHlsl)
|
if ((messages & EShMsgHlslOffsets) || source == EShSourceHlsl)
|
||||||
intermediate.setHlslOffsets();
|
intermediate.setHlslOffsets();
|
||||||
|
#endif
|
||||||
if (messages & EShMsgDebugInfo) {
|
if (messages & EShMsgDebugInfo) {
|
||||||
intermediate.setSourceFile(names[numPre]);
|
intermediate.setSourceFile(names[numPre]);
|
||||||
for (int s = 0; s < numStrings; ++s) {
|
for (int s = 0; s < numStrings; ++s) {
|
||||||
|
|
@ -1788,7 +1791,9 @@ void TShader::setUniformLocationBase(int base)
|
||||||
intermediate->setUniformLocationBase(base);
|
intermediate->setUniformLocationBase(base);
|
||||||
}
|
}
|
||||||
// See comment above TDefaultHlslIoMapper in iomapper.cpp:
|
// See comment above TDefaultHlslIoMapper in iomapper.cpp:
|
||||||
|
#ifdef ENABLE_HLSL
|
||||||
void TShader::setHlslIoMapping(bool hlslIoMap) { intermediate->setHlslIoMapping(hlslIoMap); }
|
void TShader::setHlslIoMapping(bool hlslIoMap) { intermediate->setHlslIoMapping(hlslIoMap); }
|
||||||
|
#endif
|
||||||
void TShader::setFlattenUniformArrays(bool flatten) { intermediate->setFlattenUniformArrays(flatten); }
|
void TShader::setFlattenUniformArrays(bool flatten) { intermediate->setFlattenUniformArrays(flatten); }
|
||||||
void TShader::setNoStorageFormat(bool useUnknownFormat) { intermediate->setNoStorageFormat(useUnknownFormat); }
|
void TShader::setNoStorageFormat(bool useUnknownFormat) { intermediate->setNoStorageFormat(useUnknownFormat); }
|
||||||
void TShader::setNanMinMaxClamp(bool useNonNan) { intermediate->setNanMinMaxClamp(useNonNan); }
|
void TShader::setNanMinMaxClamp(bool useNonNan) { intermediate->setNanMinMaxClamp(useNonNan); }
|
||||||
|
|
|
||||||
|
|
@ -376,26 +376,12 @@ public:
|
||||||
processes.addProcess("no-storage-format");
|
processes.addProcess("no-storage-format");
|
||||||
}
|
}
|
||||||
bool getNoStorageFormat() const { return useUnknownFormat; }
|
bool getNoStorageFormat() const { return useUnknownFormat; }
|
||||||
void setHlslOffsets()
|
|
||||||
{
|
|
||||||
hlslOffsets = true;
|
|
||||||
if (hlslOffsets)
|
|
||||||
processes.addProcess("hlsl-offsets");
|
|
||||||
}
|
|
||||||
bool usingHlslOffsets() const { return hlslOffsets; }
|
|
||||||
void setUseStorageBuffer()
|
void setUseStorageBuffer()
|
||||||
{
|
{
|
||||||
useStorageBuffer = true;
|
useStorageBuffer = true;
|
||||||
processes.addProcess("use-storage-buffer");
|
processes.addProcess("use-storage-buffer");
|
||||||
}
|
}
|
||||||
bool usingStorageBuffer() const { return useStorageBuffer; }
|
bool usingStorageBuffer() const { return useStorageBuffer; }
|
||||||
void setHlslIoMapping(bool b)
|
|
||||||
{
|
|
||||||
hlslIoMapping = b;
|
|
||||||
if (hlslIoMapping)
|
|
||||||
processes.addProcess("hlsl-iomap");
|
|
||||||
}
|
|
||||||
bool usingHlslIoMapping() { return hlslIoMapping; }
|
|
||||||
void setUseVulkanMemoryModel()
|
void setUseVulkanMemoryModel()
|
||||||
{
|
{
|
||||||
useVulkanMemoryModel = true;
|
useVulkanMemoryModel = true;
|
||||||
|
|
@ -667,8 +653,28 @@ public:
|
||||||
void setDepthReplacing() { depthReplacing = true; }
|
void setDepthReplacing() { depthReplacing = true; }
|
||||||
bool isDepthReplacing() const { return depthReplacing; }
|
bool isDepthReplacing() const { return depthReplacing; }
|
||||||
|
|
||||||
|
#ifdef ENABLE_HLSL
|
||||||
void setHlslFunctionality1() { hlslFunctionality1 = true; }
|
void setHlslFunctionality1() { hlslFunctionality1 = true; }
|
||||||
bool getHlslFunctionality1() const { return hlslFunctionality1; }
|
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); }
|
void addBlendEquation(TBlendEquationShift b) { blendEquations |= (1 << b); }
|
||||||
unsigned int getBlendEquations() const { return blendEquations; }
|
unsigned int getBlendEquations() const { return blendEquations; }
|
||||||
|
|
|
||||||
|
|
@ -142,6 +142,7 @@ int TPpContext::lFloatConst(int len, int ch, TPpToken* ppToken)
|
||||||
ch = getChar();
|
ch = getChar();
|
||||||
int firstDecimal = len;
|
int firstDecimal = len;
|
||||||
|
|
||||||
|
#ifdef ENABLE_HLSL
|
||||||
// 1.#INF or -1.#INF
|
// 1.#INF or -1.#INF
|
||||||
if (ch == '#' && (ifdepth > 0 || parseContext.intermediate.getSource() == EShSourceHlsl)) {
|
if (ch == '#' && (ifdepth > 0 || parseContext.intermediate.getSource() == EShSourceHlsl)) {
|
||||||
if ((len < 2) ||
|
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
|
// Consume leading-zero digits after the decimal point
|
||||||
while (ch == '0') {
|
while (ch == '0') {
|
||||||
|
|
|
||||||
|
|
@ -432,7 +432,9 @@ public:
|
||||||
void addUniformLocationOverride(const char* name, int loc);
|
void addUniformLocationOverride(const char* name, int loc);
|
||||||
void setUniformLocationBase(int base);
|
void setUniformLocationBase(int base);
|
||||||
void setInvertY(bool invert);
|
void setInvertY(bool invert);
|
||||||
|
#ifdef ENABLE_HLSL
|
||||||
void setHlslIoMapping(bool hlslIoMap);
|
void setHlslIoMapping(bool hlslIoMap);
|
||||||
|
#endif
|
||||||
void setFlattenUniformArrays(bool flatten);
|
void setFlattenUniformArrays(bool flatten);
|
||||||
void setNoStorageFormat(bool useUnknownFormat);
|
void setNoStorageFormat(bool useUnknownFormat);
|
||||||
void setNanMinMaxClamp(bool nanMinMaxClamp);
|
void setNanMinMaxClamp(bool nanMinMaxClamp);
|
||||||
|
|
@ -459,8 +461,12 @@ public:
|
||||||
environment.target.language = lang;
|
environment.target.language = lang;
|
||||||
environment.target.version = version;
|
environment.target.version = version;
|
||||||
}
|
}
|
||||||
|
#ifdef ENABLE_HLSL
|
||||||
void setEnvTargetHlslFunctionality1() { environment.target.hlslFunctionality1 = true; }
|
void setEnvTargetHlslFunctionality1() { environment.target.hlslFunctionality1 = true; }
|
||||||
bool getEnvTargetHlslFunctionality1() const { return environment.target.hlslFunctionality1; }
|
bool getEnvTargetHlslFunctionality1() const { return environment.target.hlslFunctionality1; }
|
||||||
|
#else
|
||||||
|
bool getEnvTargetHlslFunctionality1() const { return false; }
|
||||||
|
#endif
|
||||||
|
|
||||||
// Interface to #include handlers.
|
// Interface to #include handlers.
|
||||||
//
|
//
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue