OSDN Git Service

Proper block size computations
authorAlexis Hetu <sugoi@google.com>
Mon, 29 Jun 2015 17:51:16 +0000 (13:51 -0400)
committerAlexis Hétu <sugoi@google.com>
Fri, 3 Jul 2015 16:57:04 +0000 (16:57 +0000)
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>
src/OpenGL/compiler/Types.h

index 833706b..0457627 100644 (file)
@@ -295,6 +295,10 @@ public:
                {
                        return getStructSize();
                }
+               else if(isInterfaceBlock())
+               {
+                       return interfaceBlock->objectSize();
+               }
                else if(isMatrix())
                {
                        return primarySize * secondarySize;
@@ -307,11 +311,11 @@ public:
 
        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();