]> git.tdb.fi Git - libs/gl.git/commitdiff
Compute correct size for SPIR-V structs if the last member is an array
authorMikko Rasa <tdb@tdb.fi>
Sun, 7 Nov 2021 17:15:14 +0000 (19:15 +0200)
committerMikko Rasa <tdb@tdb.fi>
Sun, 7 Nov 2021 17:15:14 +0000 (19:15 +0200)
source/core/module.cpp

index b542f77e9c6ebcee0638b69fd76c94aff9ad3998..6d0122c055583d0bafa40f70d6bae08128322514 100644 (file)
@@ -191,7 +191,10 @@ void SpirVModule::reflect()
                        last_member = lm;
                }
                
-               s.size = last_offset+get_type_size(last_member->type);
+               unsigned last_size = get_type_size(last_member->type); 
+               if(last_member->array_size)
+                       last_size += last_member->array_stride*(last_member->array_size-1);
+               s.size = last_offset+last_size;
                s.size = (s.size+15)&~15;
        }