Fix initialization of arrays in TGlslIoMapper

The inVarMaps, outVarMaps, uniformVarMap, and intermediates arrays were
being memset with a size 1 bigger than their actual size. They are now
initialized correctly, which also allows making inVarMaps, outVarMaps,
and uniformVarMap into private members.
This commit is contained in:
Arcady Goldmints-Orlov 2024-08-02 18:19:50 -06:00 committed by arcady-lunarg
parent b618604e77
commit 015cb4ce5c
2 changed files with 6 additions and 6 deletions

View file

@ -1601,10 +1601,10 @@ bool TIoMapper::addStage(EShLanguage stage, TIntermediate& intermediate, TInfoSi
}
TGlslIoMapper::TGlslIoMapper() {
memset(inVarMaps, 0, sizeof(TVarLiveMap*) * (EShLangCount + 1));
memset(outVarMaps, 0, sizeof(TVarLiveMap*) * (EShLangCount + 1));
memset(uniformVarMap, 0, sizeof(TVarLiveMap*) * (EShLangCount + 1));
memset(intermediates, 0, sizeof(TIntermediate*) * (EShLangCount + 1));
memset(inVarMaps, 0, sizeof(TVarLiveMap*) * EShLangCount);
memset(outVarMaps, 0, sizeof(TVarLiveMap*) * EShLangCount);
memset(uniformVarMap, 0, sizeof(TVarLiveMap*) * EShLangCount);
memset(intermediates, 0, sizeof(TIntermediate*) * EShLangCount);
profile = ENoProfile;
version = 0;
autoPushConstantMaxSize = 128;

View file

@ -214,8 +214,6 @@ public:
// grow the reflection stage by stage
bool addStage(EShLanguage, TIntermediate&, TInfoSink&, TIoMapResolver*) override;
bool doMap(TIoMapResolver*, TInfoSink&) override;
TVarLiveMap *inVarMaps[EShLangCount], *outVarMaps[EShLangCount],
*uniformVarMap[EShLangCount];
TIntermediate* intermediates[EShLangCount];
bool hadError = false;
EProfile profile;
@ -225,6 +223,8 @@ private:
TString autoPushConstantBlockName;
unsigned int autoPushConstantMaxSize;
TLayoutPacking autoPushConstantBlockPacking;
TVarLiveMap *inVarMaps[EShLangCount], *outVarMaps[EShLangCount],
*uniformVarMap[EShLangCount];
};
} // end namespace glslang