Add utility methods for determining register count.

TRAC #22293 Signed-off-by: Daniel Koch Signed-off-by: Shannon Woods Author: Nicolas Capens git-svn-id: https://angleproject.googlecode.com/svn/branches/dx11proto@1621 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent 8803b85f
...@@ -136,6 +136,43 @@ public: ...@@ -136,6 +136,43 @@ public:
return totalSize; return totalSize;
} }
int elementRegisterCount() const
{
TTypeList *structure = getStruct();
if (structure)
{
int registerCount = 0;
for (size_t i = 0; i < structure->size(); i++)
{
registerCount += (*structure)[i].type->totalRegisterCount();
}
return registerCount;
}
else if (isMatrix())
{
return getNominalSize();
}
else
{
return 1;
}
}
int totalRegisterCount() const
{
if (array)
{
return arraySize * elementRegisterCount();
}
else
{
return elementRegisterCount();
}
}
bool isMatrix() const { return matrix ? true : false; } bool isMatrix() const { return matrix ? true : false; }
void setMatrix(bool m) { matrix = m; } void setMatrix(bool m) { matrix = m; }
......
...@@ -259,6 +259,10 @@ public: ...@@ -259,6 +259,10 @@ public:
const char* getQualifierString() const { return type.getQualifierString(); } const char* getQualifierString() const { return type.getQualifierString(); }
TString getCompleteString() const { return type.getCompleteString(); } TString getCompleteString() const { return type.getCompleteString(); }
int totalRegisterCount() const { return type.totalRegisterCount(); }
int elementRegisterCount() const { return type.elementRegisterCount(); }
int getArraySize() const { return type.getArraySize(); }
protected: protected:
TType type; TType type;
}; };
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment