WIP: HLSL: add refection queries for structuredbuffer counter blocks
This adds TProgram::getUniformBlockCounterIndex(int index), which returns the index the block of the counter buffer associated with the block of the passed in index, if any, or -1 if none.
This commit is contained in:
parent
12bc9aa9ce
commit
350b94856a
6 changed files with 32 additions and 6 deletions
|
|
@ -57,11 +57,16 @@ class TObjectReflection {
|
|||
public:
|
||||
TObjectReflection(const TString& pName, const TType& pType, int pOffset, int pGLDefineType, int pSize, int pIndex) :
|
||||
name(pName), offset(pOffset),
|
||||
glDefineType(pGLDefineType), size(pSize), index(pIndex), type(pType.clone()) { }
|
||||
glDefineType(pGLDefineType), size(pSize), index(pIndex), counterIndex(-1), type(pType.clone()) { }
|
||||
|
||||
void dump() const {
|
||||
printf("%s: offset %d, type %x, size %d, index %d, binding %d\n",
|
||||
printf("%s: offset %d, type %x, size %d, index %d, binding %d",
|
||||
name.c_str(), offset, glDefineType, size, index, getBinding() );
|
||||
|
||||
if (counterIndex != -1)
|
||||
printf(", counter %d", counterIndex);
|
||||
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
const TType* const getType() const { return type; }
|
||||
|
|
@ -71,6 +76,7 @@ public:
|
|||
int glDefineType;
|
||||
int size; // data size in bytes for a block, array size for a (non-block) object that's an array
|
||||
int index;
|
||||
int counterIndex;
|
||||
|
||||
static TObjectReflection badReflection() { return TObjectReflection(); }
|
||||
|
||||
|
|
@ -140,6 +146,9 @@ public:
|
|||
return it->second;
|
||||
}
|
||||
|
||||
// see getIndex(const char*)
|
||||
int getIndex(const TString& name) const { return getIndex(name.c_str()); }
|
||||
|
||||
// Thread local size
|
||||
unsigned getLocalSize(int dim) const { return dim <= 2 ? localSize[dim] : 0; }
|
||||
|
||||
|
|
@ -148,6 +157,7 @@ public:
|
|||
protected:
|
||||
friend class glslang::TReflectionTraverser;
|
||||
|
||||
void buildCounterIndices();
|
||||
void buildAttributeReflection(EShLanguage, const TIntermediate&);
|
||||
|
||||
// Need a TString hash: typedef std::unordered_map<TString, int> TNameToIndex;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue