Merge pull request #1906 from ShchchowAMD/master
Reflection will crash when the VS input symbol defines the same name with FS output symbol
This commit is contained in:
commit
7bc047326e
4 changed files with 32 additions and 4 deletions
|
|
@ -2048,6 +2048,9 @@ bool TProgram::buildReflection(int opts)
|
|||
|
||||
unsigned TProgram::getLocalSize(int dim) const { return reflection->getLocalSize(dim); }
|
||||
int TProgram::getReflectionIndex(const char* name) const { return reflection->getIndex(name); }
|
||||
int TProgram::getReflectionPipeIOIndex(const char* name, const bool inOrOut) const
|
||||
{ return reflection->getPipeIOIndex(name, inOrOut); }
|
||||
|
||||
int TProgram::getNumUniformVariables() const { return reflection->getNumUniforms(); }
|
||||
const TObjectReflection& TProgram::getUniform(int index) const { return reflection->getUniform(index); }
|
||||
int TProgram::getNumUniformBlocks() const { return reflection->getNumUniformBlocks(); }
|
||||
|
|
|
|||
|
|
@ -112,6 +112,10 @@ public:
|
|||
TReflection::TMapIndexToReflection &ioItems =
|
||||
input ? reflection.indexToPipeInput : reflection.indexToPipeOutput;
|
||||
|
||||
|
||||
TReflection::TNameToIndex &ioMapper =
|
||||
input ? reflection.pipeInNameToIndex : reflection.pipeOutNameToIndex;
|
||||
|
||||
if (reflection.options & EShReflectionUnwrapIOBlocks) {
|
||||
bool anonymous = IsAnonymous(name);
|
||||
|
||||
|
|
@ -129,12 +133,13 @@ public:
|
|||
blowUpIOAggregate(input, baseName, type);
|
||||
}
|
||||
} else {
|
||||
TReflection::TNameToIndex::const_iterator it = reflection.nameToIndex.find(name.c_str());
|
||||
if (it == reflection.nameToIndex.end()) {
|
||||
reflection.nameToIndex[name.c_str()] = (int)ioItems.size();
|
||||
TReflection::TNameToIndex::const_iterator it = ioMapper.find(name.c_str());
|
||||
if (it == ioMapper.end()) {
|
||||
// seperate pipe i/o params from uniforms and blocks
|
||||
// in is only for input in first stage as out is only for last stage. check traverse in call stack.
|
||||
ioMapper[name.c_str()] = ioItems.size();
|
||||
ioItems.push_back(
|
||||
TObjectReflection(name.c_str(), type, 0, mapToGlType(type), mapToGlArraySize(type), 0));
|
||||
|
||||
EShLanguageMask& stages = ioItems.back().stages;
|
||||
stages = static_cast<EShLanguageMask>(stages | 1 << intermediate.getStage());
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -152,6 +152,20 @@ public:
|
|||
// see getIndex(const char*)
|
||||
int getIndex(const TString& name) const { return getIndex(name.c_str()); }
|
||||
|
||||
|
||||
// for mapping any name to its index (only pipe input/output names)
|
||||
int getPipeIOIndex(const char* name, const bool inOrOut) const
|
||||
{
|
||||
TNameToIndex::const_iterator it = inOrOut ? pipeInNameToIndex.find(name) : pipeOutNameToIndex.find(name);
|
||||
if (it == (inOrOut ? pipeInNameToIndex.end() : pipeOutNameToIndex.end()))
|
||||
return -1;
|
||||
else
|
||||
return it->second;
|
||||
}
|
||||
|
||||
// see gePipeIOIndex(const char*, const bool)
|
||||
int getPipeIOIndex(const TString& name, const bool inOrOut) const { return getPipeIOIndex(name.c_str(), inOrOut); }
|
||||
|
||||
// Thread local size
|
||||
unsigned getLocalSize(int dim) const { return dim <= 2 ? localSize[dim] : 0; }
|
||||
|
||||
|
|
@ -189,6 +203,8 @@ protected:
|
|||
|
||||
TObjectReflection badReflection; // return for queries of -1 or generally out of range; has expected descriptions with in it for this
|
||||
TNameToIndex nameToIndex; // maps names to indexes; can hold all types of data: uniform/buffer and which function names have been processed
|
||||
TNameToIndex pipeInNameToIndex; // maps pipe in names to indexes, this is a fix to seperate pipe I/O from uniforms and buffers.
|
||||
TNameToIndex pipeOutNameToIndex; // maps pipe out names to indexes, this is a fix to seperate pipe I/O from uniforms and buffers.
|
||||
TMapIndexToReflection indexToUniform;
|
||||
TMapIndexToReflection indexToUniformBlock;
|
||||
TMapIndexToReflection indexToBufferVariable;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue