Non-functional: Make the vulkan version number meaning be only 0 or not 0.

This commit is contained in:
John Kessenich 2018-03-02 18:17:42 -07:00
parent e58d58b782
commit b5b5f918c6
6 changed files with 13 additions and 13 deletions

View file

@ -3195,7 +3195,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
} }
// GL_AMD_shader_fragment_mask // GL_AMD_shader_fragment_mask
if (profile != EEsProfile && version >= 450 && spvVersion.vulkan >= 100) { if (profile != EEsProfile && version >= 450 && spvVersion.vulkan > 0) {
stageBuiltins[EShLangFragment].append( stageBuiltins[EShLangFragment].append(
"uint fragmentMaskFetchAMD(subpassInputMS);" "uint fragmentMaskFetchAMD(subpassInputMS);"
"uint fragmentMaskFetchAMD(isubpassInputMS);" "uint fragmentMaskFetchAMD(isubpassInputMS);"
@ -3494,7 +3494,7 @@ void TBuiltIns::initialize(int version, EProfile profile, const SpvVersion& spvV
stageBuiltins[EShLangVertex].append( stageBuiltins[EShLangVertex].append(
"int gl_InstanceID;" // needs qualifier fixed later "int gl_InstanceID;" // needs qualifier fixed later
); );
if (spvVersion.vulkan >= 100 && version >= 140) if (spvVersion.vulkan > 0 && version >= 140)
stageBuiltins[EShLangVertex].append( stageBuiltins[EShLangVertex].append(
"in int gl_VertexIndex;" "in int gl_VertexIndex;"
"in int gl_InstanceIndex;" "in int gl_InstanceIndex;"
@ -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_VertexID;" // needs qualifier fixed later
"in highp int gl_InstanceID;" // needs qualifier fixed later "in highp int gl_InstanceID;" // needs qualifier fixed later
); );
if (spvVersion.vulkan >= 100) if (spvVersion.vulkan > 0)
stageBuiltins[EShLangVertex].append( stageBuiltins[EShLangVertex].append(
"in highp int gl_VertexIndex;" "in highp int gl_VertexIndex;"
"in highp int gl_InstanceIndex;" "in highp int gl_InstanceIndex;"
@ -5569,7 +5569,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable); BuiltInVariable("gl_SubGroupLeMaskARB", EbvSubGroupLeMask, symbolTable);
BuiltInVariable("gl_SubGroupLtMaskARB", EbvSubGroupLtMask, 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 // Treat "gl_SubGroupSizeARB" as shader input instead of uniform for Vulkan
SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable); SpecialQualifier("gl_SubGroupSizeARB", EvqVaryingIn, EbvSubGroupSize, symbolTable);
@ -5670,7 +5670,7 @@ void TBuiltIns::identifyBuiltIns(int version, EProfile profile, const SpvVersion
SpecialQualifier("gl_InstanceID", EvqInstanceId, EbvInstanceId, symbolTable); SpecialQualifier("gl_InstanceID", EvqInstanceId, EbvInstanceId, symbolTable);
} }
if (spvVersion.vulkan >= 100) { if (spvVersion.vulkan > 0) {
BuiltInVariable("gl_VertexIndex", EbvVertexIndex, symbolTable); BuiltInVariable("gl_VertexIndex", EbvVertexIndex, symbolTable);
BuiltInVariable("gl_InstanceIndex", EbvInstanceIndex, symbolTable); BuiltInVariable("gl_InstanceIndex", EbvInstanceIndex, symbolTable);
} }

View file

@ -1244,7 +1244,7 @@ int TScanContext::tokenizeIdentifier()
case TEXTURE1DARRAY: case TEXTURE1DARRAY:
case SAMPLER: case SAMPLER:
case SAMPLERSHADOW: case SAMPLERSHADOW:
if (parseContext.spvVersion.vulkan >= 100) if (parseContext.spvVersion.vulkan > 0)
return keyword; return keyword;
else else
return identifierOrType(); return identifierOrType();
@ -1255,7 +1255,7 @@ int TScanContext::tokenizeIdentifier()
case ISUBPASSINPUTMS: case ISUBPASSINPUTMS:
case USUBPASSINPUT: case USUBPASSINPUT:
case USUBPASSINPUTMS: case USUBPASSINPUTMS:
if (parseContext.spvVersion.vulkan >= 100) if (parseContext.spvVersion.vulkan > 0)
return keyword; return keyword;
else else
return identifierOrType(); return identifierOrType();

View file

@ -578,7 +578,7 @@ bool DeduceVersionProfile(TInfoSink& infoSink, EShLanguage stage, bool versionNo
if (spvVersion.spv != 0) { if (spvVersion.spv != 0) {
switch (profile) { switch (profile) {
case EEsProfile: case EEsProfile:
if (spvVersion.vulkan >= 100 && version < 310) { if (spvVersion.vulkan > 0 && version < 310) {
correct = false; correct = false;
infoSink.info.message(EPrefixError, "#version: ES shaders for Vulkan SPIR-V require version 310 or higher"); infoSink.info.message(EPrefixError, "#version: ES shaders for Vulkan SPIR-V require version 310 or higher");
version = 310; version = 310;
@ -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"); infoSink.info.message(EPrefixError, "#version: compilation for SPIR-V does not support the compatibility profile");
break; break;
default: default:
if (spvVersion.vulkan >= 100 && version < 140) { if (spvVersion.vulkan > 0 && version < 140) {
correct = false; correct = false;
infoSink.info.message(EPrefixError, "#version: Desktop shaders for Vulkan SPIR-V require version 140 or higher"); infoSink.info.message(EPrefixError, "#version: Desktop shaders for Vulkan SPIR-V require version 140 or higher");
version = 140; version = 140;
@ -814,7 +814,7 @@ bool ProcessDeferred(
intermediate.setProfile(profile); intermediate.setProfile(profile);
intermediate.setSpv(spvVersion); intermediate.setSpv(spvVersion);
RecordProcesses(intermediate, messages, sourceEntryPointName); RecordProcesses(intermediate, messages, sourceEntryPointName);
if (spvVersion.vulkan >= 100) if (spvVersion.vulkan > 0)
intermediate.setOriginUpperLeft(); intermediate.setOriginUpperLeft();
if ((messages & EShMsgHlslOffsets) || source == EShSourceHlsl) if ((messages & EShMsgHlslOffsets) || source == EShSourceHlsl)
intermediate.setHlslOffsets(); intermediate.setHlslOffsets();

View file

@ -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. // Call for any operation removed because Vulkan SPIR-V is being generated.
void TParseVersions::vulkanRemoved(const TSourceLoc& loc, const char* op) 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, ""); error(loc, "not allowed when using GLSL for Vulkan", op, "");
} }

View file

@ -83,7 +83,7 @@ struct SpvVersion {
SpvVersion() : spv(0), vulkanGlsl(0), vulkan(0), openGl(0) {} 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 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 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" int openGl; // the version of GLSL semantics for OpenGL, from GL_ARB_gl_spirv, for "#define GL_SPIRV XXX"
}; };

View file

@ -378,7 +378,7 @@ public:
processes.addProcess("client opengl100"); processes.addProcess("client opengl100");
// target-environment processes // target-environment processes
if (spvVersion.vulkan == 100) if (spvVersion.vulkan > 0)
processes.addProcess("target-env vulkan1.0"); processes.addProcess("target-env vulkan1.0");
else if (spvVersion.vulkan > 0) else if (spvVersion.vulkan > 0)
processes.addProcess("target-env vulkanUnknown"); processes.addProcess("target-env vulkanUnknown");