From b5b5f918c6b72d7cf2ee73641cc6c6ddb211ca70 Mon Sep 17 00:00:00 2001 From: John Kessenich Date: Fri, 2 Mar 2018 18:17:42 -0700 Subject: [PATCH] Non-functional: Make the vulkan version number meaning be only 0 or not 0. --- glslang/MachineIndependent/Initialize.cpp | 10 +++++----- glslang/MachineIndependent/Scan.cpp | 4 ++-- glslang/MachineIndependent/ShaderLang.cpp | 6 +++--- glslang/MachineIndependent/Versions.cpp | 2 +- glslang/MachineIndependent/Versions.h | 2 +- glslang/MachineIndependent/localintermediate.h | 2 +- 6 files changed, 13 insertions(+), 13 deletions(-) diff --git a/glslang/MachineIndependent/Initialize.cpp b/glslang/MachineIndependent/Initialize.cpp index 872a2cf2..66f824f4 100644 --- a/glslang/MachineIndependent/Initialize.cpp +++ b/glslang/MachineIndependent/Initialize.cpp @@ -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);" @@ -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;" @@ -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;" @@ -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); @@ -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); } diff --git a/glslang/MachineIndependent/Scan.cpp b/glslang/MachineIndependent/Scan.cpp index 6de6f547..db1642f9 100644 --- a/glslang/MachineIndependent/Scan.cpp +++ b/glslang/MachineIndependent/Scan.cpp @@ -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(); @@ -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(); diff --git a/glslang/MachineIndependent/ShaderLang.cpp b/glslang/MachineIndependent/ShaderLang.cpp index 21004fed..91137607 100644 --- a/glslang/MachineIndependent/ShaderLang.cpp +++ b/glslang/MachineIndependent/ShaderLang.cpp @@ -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; @@ -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; @@ -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(); diff --git a/glslang/MachineIndependent/Versions.cpp b/glslang/MachineIndependent/Versions.cpp index e0872a75..c67b3789 100644 --- a/glslang/MachineIndependent/Versions.cpp +++ b/glslang/MachineIndependent/Versions.cpp @@ -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, ""); } diff --git a/glslang/MachineIndependent/Versions.h b/glslang/MachineIndependent/Versions.h index 9f916ff9..ae96ec23 100644 --- a/glslang/MachineIndependent/Versions.h +++ b/glslang/MachineIndependent/Versions.h @@ -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" }; diff --git a/glslang/MachineIndependent/localintermediate.h b/glslang/MachineIndependent/localintermediate.h index 26c75322..b84b1106 100644 --- a/glslang/MachineIndependent/localintermediate.h +++ b/glslang/MachineIndependent/localintermediate.h @@ -378,7 +378,7 @@ public: 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");