aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/sksl/SkSLMemoryLayout.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/sksl/SkSLMemoryLayout.h')
-rw-r--r--src/sksl/SkSLMemoryLayout.h13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/sksl/SkSLMemoryLayout.h b/src/sksl/SkSLMemoryLayout.h
index c009773b62..210769c8d7 100644
--- a/src/sksl/SkSLMemoryLayout.h
+++ b/src/sksl/SkSLMemoryLayout.h
@@ -75,9 +75,16 @@ public:
*/
size_t stride(const Type& type) const {
switch (type.kind()) {
- case Type::kMatrix_Kind: // fall through
- case Type::kArray_Kind:
- return this->alignment(type);
+ case Type::kMatrix_Kind: {
+ size_t base = vector_alignment(this->size(type.componentType()), type.rows());
+ return this->roundUpIfNeeded(base);
+ }
+ case Type::kArray_Kind: {
+ int align = this->alignment(type.componentType());
+ int stride = this->size(type.componentType()) + align - 1;
+ stride -= stride % align;
+ return this->roundUpIfNeeded(stride);
+ }
default:
ABORT("type does not have a stride");
}