Skip to content

Commit 4a9f088

Browse files
mbechardarcady-lunarg
authored andcommitted
a few more tweaks for KhronosGroup#3681
expose TIoMapper::setAutoPushConstantBlock() add overload for MapToSpirvToolsEnv() that takes TIntermediate instead of SpvVersion.
1 parent 96899e0 commit 4a9f088

File tree

5 files changed

+24
-16
lines changed

5 files changed

+24
-16
lines changed

SPIRV/SpvTools.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,11 @@ spv_target_env MapToSpirvToolsEnv(const SpvVersion& spvVersion, spv::SpvBuildLog
8282
return spv_target_env::SPV_ENV_UNIVERSAL_1_0;
8383
}
8484

85+
spv_target_env MapToSpirvToolsEnv(const glslang::TIntermediate& intermediate, spv::SpvBuildLogger* logger)
86+
{
87+
return MapToSpirvToolsEnv(intermediate.getSpv(), logger);
88+
}
89+
8590
// Callback passed to spvtools::Optimizer::SetMessageConsumer
8691
void OptimizerMesssageConsumer(spv_message_level_t level, const char *source,
8792
const spv_position_t &position, const char *message)

SPIRV/SpvTools.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ class TIntermediate;
6161

6262
// Translate glslang's view of target versioning to what SPIRV-Tools uses.
6363
GLSLANG_EXPORT spv_target_env MapToSpirvToolsEnv(const SpvVersion& spvVersion, spv::SpvBuildLogger* logger);
64+
GLSLANG_EXPORT spv_target_env MapToSpirvToolsEnv(const glslang::TIntermediate& intermediate, spv::SpvBuildLogger* logger);
6465

6566
// Use the SPIRV-Tools disassembler to print SPIR-V using a SPV_ENV_UNIVERSAL_1_3 environment.
6667
GLSLANG_EXPORT void SpirvToolsDisassemble(std::ostream& out, const std::vector<unsigned int>& spirv);

glslang/Include/Types.h

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -307,21 +307,6 @@ typedef TVector<TTypeLoc> TTypeList;
307307

308308
typedef TVector<TString*> TIdentifierList;
309309

310-
//
311-
// Following are a series of helper enums for managing layouts and qualifiers,
312-
// used for TPublicType, TType, others.
313-
//
314-
315-
enum TLayoutPacking {
316-
ElpNone,
317-
ElpShared, // default, but different than saying nothing
318-
ElpStd140,
319-
ElpStd430,
320-
ElpPacked,
321-
ElpScalar,
322-
ElpCount // If expanding, see bitfield width below
323-
};
324-
325310
enum TLayoutMatrix {
326311
ElmNone,
327312
ElmRowMajor,

glslang/MachineIndependent/iomapper.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,11 @@ class TGlslIoMapper : public TIoMapper {
196196
virtual ~TGlslIoMapper();
197197
// If set, the uniform block with the given name will be changed to be backed by
198198
// push_constant if it's size is <= maxSize
199-
void setAutoPushConstantBlock(const char* name, unsigned int maxSize, TLayoutPacking packing) {
199+
bool setAutoPushConstantBlock(const char* name, unsigned int maxSize, TLayoutPacking packing) override {
200200
autoPushConstantBlockName = name;
201201
autoPushConstantMaxSize = maxSize;
202202
autoPushConstantBlockPacking = packing;
203+
return true;
203204
}
204205
// grow the reflection stage by stage
205206
bool addStage(EShLanguage, TIntermediate&, TInfoSink&, TIoMapResolver*) override;

glslang/Public/ShaderLang.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,21 @@ typedef enum {
173173
LAST_ELEMENT_MARKER(EShTargetLanguageVersionCount = 7),
174174
} EShTargetLanguageVersion;
175175

176+
//
177+
// Following are a series of helper enums for managing layouts and qualifiers,
178+
// used for TPublicType, TType, others.
179+
//
180+
181+
enum TLayoutPacking {
182+
ElpNone,
183+
ElpShared, // default, but different than saying nothing
184+
ElpStd140,
185+
ElpStd430,
186+
ElpPacked,
187+
ElpScalar,
188+
ElpCount // If expanding, see bitfield width below
189+
};
190+
176191
struct TInputLanguage {
177192
EShSource languageFamily; // redundant information with other input, this one overrides when not EShSourceNone
178193
EShLanguage stage; // redundant information with other input, this one overrides when not EShSourceNone
@@ -847,6 +862,7 @@ class TIoMapper {
847862
// grow the reflection stage by stage
848863
bool virtual addStage(EShLanguage, TIntermediate&, TInfoSink&, TIoMapResolver*);
849864
bool virtual doMap(TIoMapResolver*, TInfoSink&) { return true; }
865+
bool virtual setAutoPushConstantBlock(const char*, unsigned int, TLayoutPacking) { return false; }
850866
};
851867

852868
// Get the default GLSL IO mapper

0 commit comments

Comments
 (0)