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(); }
TReflection::TMapIndexToReflection &ioItems =
input ? reflection.indexToPipeInput : reflection.indexToPipeOutput;
+
+ TReflection::TNameToIndex &ioMapper =
+ input ? reflection.pipeInNameToIndex : reflection.pipeOutNameToIndex;
+
if (reflection.options & EShReflectionUnwrapIOBlocks) {
bool anonymous = IsAnonymous(name);
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 {
// 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; }
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;
bool buildReflection(int opts = EShReflectionDefault);
unsigned getLocalSize(int dim) const; // return dim'th local size
int getReflectionIndex(const char *name) const;
+ int getReflectionPipeIOIndex(const char* name, const bool inOrOut) const;
int getNumUniformVariables() const;
const TObjectReflection& getUniform(int index) const;
int getNumUniformBlocks() const;
// can be used for glGetUniformIndices()
int getUniformIndex(const char *name) const { return getReflectionIndex(name); }
+ int getPipeIOIndex(const char *name, const bool inOrOut) const
+ { return getReflectionPipeIOIndex(name, inOrOut); }
+
// can be used for "name" part of glGetActiveUniform()
const char *getUniformName(int index) const { return getUniform(index).name.c_str(); }