Skip to content

Commit

Permalink
Non-functional: Make the vulkan version number meaning be only 0 or n…
Browse files Browse the repository at this point in the history
…ot 0.
  • Loading branch information
johnkslang committed Mar 3, 2018
1 parent e58d58b commit b5b5f91
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 13 deletions.
10 changes: 5 additions & 5 deletions glslang/MachineIndependent/Initialize.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3195,7 +3195,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
}

// GL_AMD_shader_fragment_mask
if (profile != EEsProfile && version >= 450 && spvVersion.vulkan >= 100) {
if (profile != EEsProfile && version >= 450 && spvVersion.vulkan > 0) {
stageBuiltins[EShLangFragment].append(
"uint fragmentMaskFetchAMD(subpassInputMS);"
"uint fragmentMaskFetchAMD(isubpassInputMS);"
Expand Down Expand Up @@ -3494,7 +3494,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
stageBuiltins[EShLangVertex].append(
"int gl_InstanceID;" // needs qualifier fixed later
);
if (spvVersion.vulkan >= 100 && version >= 140)
if (spvVersion.vulkan > 0 && version >= 140)
stageBuiltins[EShLangVertex].append(
"in int gl_VertexIndex;"
"in int gl_InstanceIndex;"
Expand Down Expand Up @@ -3544,7 +3544,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
"in highp int gl_VertexID;" // needs qualifier fixed later
"in highp int gl_InstanceID;" // needs qualifier fixed later
);
if (spvVersion.vulkan >= 100)
if (spvVersion.vulkan > 0)
stageBuiltins[EShLangVertex].append(
"in highp int gl_VertexIndex;"
"in highp int gl_InstanceIndex;"
Expand Down Expand Up @@ -5569,7 +5569,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable);
BuiltInVariable("gl_SubGroupLtMaskARB", EbvSubGroupLtMask, symbolTable);

if (spvVersion.vulkan >= 100)
if (spvVersion.vulkan > 0)
// Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan
SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable);

Expand Down Expand Up @@ -5670,7 +5670,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
SpecialQualifier("gl_InstanceID", EvqInstanceId, EbvInstanceId, symbolTable);
}

if (spvVersion.vulkan >= 100) {
if (spvVersion.vulkan > 0) {
BuiltInVariable("gl_VertexIndex", EbvVertexIndex, symbolTable);
BuiltInVariable("gl_InstanceIndex", EbvInstanceIndex, symbolTable);
}
Expand Down
4 changes: 2 additions & 2 deletions glslang/MachineIndependent/Scan.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1244,7 +1244,7 @@ int TScanContext::tokenizeIdentifier()
case TEXTURE1DARRAY:
case SAMPLER:
case SAMPLERSHADOW:
if (parseContext.spvVersion.vulkan >= 100)
if (parseContext.spvVersion.vulkan > 0)
return keyword;
else
return identifierOrType();
Expand All @@ -1255,7 +1255,7 @@ int TScanContext::tokenizeIdentifier()
case ISUBPASSINPUTMS:
case USUBPASSINPUT:
case USUBPASSINPUTMS:
if (parseContext.spvVersion.vulkan >= 100)
if (parseContext.spvVersion.vulkan > 0)
return keyword;
else
return identifierOrType();
Expand Down
6 changes: 3 additions & 3 deletions glslang/MachineIndependent/ShaderLang.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
if (spvVersion.spv != 0) {
switch (profile) {
case EEsProfile:
if (spvVersion.vulkan >= 100 && version < 310) {
if (spvVersion.vulkan > 0 && version < 310) {
correct = false;
infoSink.info.message(EPrefixError, "#version: ES shaders for Vulkan SPIR-V require version 310 or higher");
version = 310;
Expand All @@ -593,7 +593,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
infoSink.info.message(EPrefixError, "#version: compilation for SPIR-V does not support the compatibility profile");
break;
default:
if (spvVersion.vulkan >= 100 && version < 140) {
if (spvVersion.vulkan > 0 && version < 140) {
correct = false;
infoSink.info.message(EPrefixError, "#version: Desktop shaders for Vulkan SPIR-V require version 140 or higher");
version = 140;
Expand Down Expand Up @@ -814,7 +814,7 @@ bool ProcessDeferred(
intermediate.setProfile(profile);
intermediate.setSpv(spvVersion);
RecordProcesses(intermediate, messages, sourceEntryPointName);
if (spvVersion.vulkan >= 100)
if (spvVersion.vulkan > 0)
intermediate.setOriginUpperLeft();
if ((messages & EShMsgHlslOffsets) || source == EShSourceHlsl)
intermediate.setHlslOffsets();
Expand Down
2 changes: 1 addition & 1 deletion glslang/MachineIndependent/Versions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -802,7 +802,7 @@ void TParseVersions::spvRemoved(const TSourceLoc& loc, const char* op)
// Call for any operation removed because Vulkan SPIR-V is being generated.
void TParseVersions::vulkanRemoved(const TSourceLoc& loc, const char* op)
{
if (spvVersion.vulkan >= 100)
if (spvVersion.vulkan > 0)
error(loc, "not allowed when using GLSL for Vulkan", op, "");
}

Expand Down
2 changes: 1 addition & 1 deletion glslang/MachineIndependent/Versions.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ struct SpvVersion {
SpvVersion() : spv(0), vulkanGlsl(0), vulkan(0), openGl(0) {}
unsigned int spv; // the version of SPIR-V to target, as defined by "word 1" of the SPIR-V binary header
int vulkanGlsl; // the version of GLSL semantics for Vulkan, from GL_KHR_vulkan_glsl, for "#define VULKAN XXX"
int vulkan; // the version of Vulkan, for which SPIR-V execution environment rules to use (100 means 1.0)
int vulkan; // the version of Vulkan, for which SPIR-V execution environment rules to use
int openGl; // the version of GLSL semantics for OpenGL, from GL_ARB_gl_spirv, for "#define GL_SPIRV XXX"
};

Expand Down
2 changes: 1 addition & 1 deletion glslang/MachineIndependent/localintermediate.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ class TIntermediate {
processes.addProcess("client opengl100");

// target-environment processes
if (spvVersion.vulkan == 100)
if (spvVersion.vulkan > 0)
processes.addProcess("target-env vulkan1.0");
else if (spvVersion.vulkan > 0)
processes.addProcess("target-env vulkanUnknown");
Expand Down

0 comments on commit b5b5f91

Please sign in to comment.