diff --git a/SPIRV/SpvTools.cpp b/SPIRV/SpvTools.cpp index 6360ab4987..12f94b8392 100644 --- a/SPIRV/SpvTools.cpp +++ b/SPIRV/SpvTools.cpp @@ -82,6 +82,11 @@ spv_target_env MapToSpirvToolsEnv(const SpvVersion& spvVersion, spv::SpvBuildLog return spv_target_env::SPV_ENV_UNIVERSAL_1_0; } +spv_target_env MapToSpirvToolsEnv(const glslang::TIntermediate& intermediate, spv::SpvBuildLogger* logger) +{ + return MapToSpirvToolsEnv(intermediate.getSpv(), logger); +} + // Callback passed to spvtools::Optimizer::SetMessageConsumer void OptimizerMesssageConsumer(spv_message_level_t level, const char *source, const spv_position_t &position, const char *message) diff --git a/SPIRV/SpvTools.h b/SPIRV/SpvTools.h index a238427033..455857235f 100644 --- a/SPIRV/SpvTools.h +++ b/SPIRV/SpvTools.h @@ -61,6 +61,7 @@ class TIntermediate; // Translate glslang's view of target versioning to what SPIRV-Tools uses. GLSLANG_EXPORT spv_target_env MapToSpirvToolsEnv(const SpvVersion& spvVersion, spv::SpvBuildLogger* logger); +GLSLANG_EXPORT spv_target_env MapToSpirvToolsEnv(const glslang::TIntermediate& intermediate, spv::SpvBuildLogger* logger); // Use the SPIRV-Tools disassembler to print SPIR-V using a SPV_ENV_UNIVERSAL_1_3 environment. GLSLANG_EXPORT void SpirvToolsDisassemble(std::ostream& out, const std::vector& spirv); diff --git a/glslang/Include/Types.h b/glslang/Include/Types.h index 2326228546..ec6b1db8bd 100644 --- a/glslang/Include/Types.h +++ b/glslang/Include/Types.h @@ -307,21 +307,6 @@ typedef TVector TTypeList; typedef TVector TIdentifierList; -// -// Following are a series of helper enums for managing layouts and qualifiers, -// used for TPublicType, TType, others. -// - -enum TLayoutPacking { - ElpNone, - ElpShared, // default, but different than saying nothing - ElpStd140, - ElpStd430, - ElpPacked, - ElpScalar, - ElpCount // If expanding, see bitfield width below -}; - enum TLayoutMatrix { ElmNone, ElmRowMajor, diff --git a/glslang/MachineIndependent/iomapper.h b/glslang/MachineIndependent/iomapper.h index 86c9e87b08..ef513d9a60 100644 --- a/glslang/MachineIndependent/iomapper.h +++ b/glslang/MachineIndependent/iomapper.h @@ -196,10 +196,11 @@ class TGlslIoMapper : public TIoMapper { virtual ~TGlslIoMapper(); // If set, the uniform block with the given name will be changed to be backed by // push_constant if it's size is <= maxSize - void setAutoPushConstantBlock(const char* name, unsigned int maxSize, TLayoutPacking packing) { + bool setAutoPushConstantBlock(const char* name, unsigned int maxSize, TLayoutPacking packing) override { autoPushConstantBlockName = name; autoPushConstantMaxSize = maxSize; autoPushConstantBlockPacking = packing; + return true; } // grow the reflection stage by stage bool addStage(EShLanguage, TIntermediate&, TInfoSink&, TIoMapResolver*) override; diff --git a/glslang/Public/ShaderLang.h b/glslang/Public/ShaderLang.h index 5e3ab581bd..b105b5c999 100644 --- a/glslang/Public/ShaderLang.h +++ b/glslang/Public/ShaderLang.h @@ -173,6 +173,21 @@ typedef enum { LAST_ELEMENT_MARKER(EShTargetLanguageVersionCount = 7), } EShTargetLanguageVersion; +// +// Following are a series of helper enums for managing layouts and qualifiers, +// used for TPublicType, TType, others. +// + +enum TLayoutPacking { + ElpNone, + ElpShared, // default, but different than saying nothing + ElpStd140, + ElpStd430, + ElpPacked, + ElpScalar, + ElpCount // If expanding, see bitfield width below +}; + struct TInputLanguage { EShSource languageFamily; // redundant information with other input, this one overrides when not EShSourceNone EShLanguage stage; // redundant information with other input, this one overrides when not EShSourceNone @@ -847,6 +862,7 @@ class TIoMapper { // grow the reflection stage by stage bool virtual addStage(EShLanguage, TIntermediate&, TInfoSink&, TIoMapResolver*); bool virtual doMap(TIoMapResolver*, TInfoSink&) { return true; } + bool virtual setAutoPushConstantBlock(const char*, unsigned int, TLayoutPacking) { return false; } }; // Get the default GLSL IO mapper