Proper block size computations
Interface blocks can now properly return their size from
TType::getElementSize() or TType::elementRegisterCount().
Change-Id: Ief69163088839784cf347160bb49fd64f1a2a395
Reviewed-on: https://swiftshader-review.googlesource.com/3584
Tested-by: Alexis Hétu <sugoi@google.com>
Reviewed-by: Nicolas Capens <capn@google.com>
diff --git a/src/OpenGL/compiler/Types.h b/src/OpenGL/compiler/Types.h
index 833706b..0457627 100644
--- a/src/OpenGL/compiler/Types.h
+++ b/src/OpenGL/compiler/Types.h
@@ -295,6 +295,10 @@
{
return getStructSize();
}
+ else if(isInterfaceBlock())
+ {
+ return interfaceBlock->objectSize();
+ }
else if(isMatrix())
{
return primarySize * secondarySize;
@@ -307,11 +311,11 @@
int elementRegisterCount() const
{
- if(structure)
+ if(structure || isInterfaceBlock())
{
int registerCount = 0;
- const TFieldList& fields = getStruct()->fields();
+ const TFieldList& fields = isInterfaceBlock() ? interfaceBlock->fields() : structure->fields();
for(size_t i = 0; i < fields.size(); i++)
{
registerCount += fields[i]->type()->totalRegisterCount();