diff options
author | Ethan Nicholas <ethannicholas@google.com> | 2018-07-17 15:38:03 -0400 |
---|---|---|
committer | Skia Commit-Bot <skia-commit-bot@chromium.org> | 2018-07-17 21:23:12 +0000 |
commit | 4a341975ed8bd6b826a2a4d58b5085e8ef74f69b (patch) | |
tree | bec74e1781a9825cb47037b0742abfc9cc8d6a16 /src/sksl | |
parent | bb1ccdbc33d704afb7cbd19beb22dc6972e58b5f (diff) |
fixed SPIR-V memory layout
Bug: skia:
Change-Id: Ib503e24e4cfcb3e064a9e34a4d9ca3230c989372
Reviewed-on: https://skia-review.googlesource.com/141838
Reviewed-by: Greg Daniel <egdaniel@google.com>
Commit-Queue: Ethan Nicholas <ethannicholas@google.com>
Diffstat (limited to 'src/sksl')
-rw-r--r-- | src/sksl/SkSLMemoryLayout.h | 13 |
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"); } |