Index: src/sksl/ir/SkSLType.h |
diff --git a/src/sksl/ir/SkSLType.h b/src/sksl/ir/SkSLType.h |
index 81ec13ab442b771b547a4c4732e545224f6aceb6..a4632061ae68c7de85fc8a1f3ed67da9dbd6c12d 100644 |
--- a/src/sksl/ir/SkSLType.h |
+++ b/src/sksl/ir/SkSLType.h |
@@ -238,87 +238,6 @@ public: |
return fIsSampled; |
} |
- static size_t vector_alignment(size_t componentSize, int columns) { |
- return componentSize * (columns + columns % 2); |
- } |
- |
- /** |
- * Returns the type's required alignment (when putting this type into a struct, the offset must |
- * be a multiple of the alignment). |
- */ |
- size_t alignment() const { |
- // See OpenGL Spec 7.6.2.2 Standard Uniform Block Layout |
- switch (fTypeKind) { |
- case kScalar_Kind: |
- return this->size(); |
- case kVector_Kind: |
- return vector_alignment(fComponentType->size(), fColumns); |
- case kMatrix_Kind: |
- return (vector_alignment(fComponentType->size(), fRows) + 15) & ~15; |
- case kArray_Kind: |
- // round up to next multiple of 16 |
- return (fComponentType->alignment() + 15) & ~15; |
- case kStruct_Kind: { |
- size_t result = 16; |
- for (size_t i = 0; i < fFields.size(); i++) { |
- size_t alignment = fFields[i].fType->alignment(); |
- if (alignment > result) { |
- result = alignment; |
- } |
- } |
- } |
- default: |
- ABORT(("cannot determine size of type " + fName).c_str()); |
- } |
- } |
- |
- /** |
- * For matrices and arrays, returns the number of bytes from the start of one entry (row, in |
- * the case of matrices) to the start of the next. |
- */ |
- size_t stride() const { |
- switch (fTypeKind) { |
- case kMatrix_Kind: // fall through |
- case kArray_Kind: |
- return this->alignment(); |
- default: |
- ABORT("type does not have a stride"); |
- } |
- } |
- |
- /** |
- * Returns the size of this type in bytes. |
- */ |
- size_t size() const { |
- switch (fTypeKind) { |
- case kScalar_Kind: |
- // FIXME need to take precision into account, once we figure out how we want to |
- // handle it... |
- return 4; |
- case kVector_Kind: |
- return fColumns * fComponentType->size(); |
- case kMatrix_Kind: |
- return vector_alignment(fComponentType->size(), fRows) * fColumns; |
- case kArray_Kind: |
- return fColumns * this->stride(); |
- case kStruct_Kind: { |
- size_t total = 0; |
- for (size_t i = 0; i < fFields.size(); i++) { |
- size_t alignment = fFields[i].fType->alignment(); |
- if (total % alignment != 0) { |
- total += alignment - total % alignment; |
- } |
- ASSERT(false); |
- ASSERT(total % alignment == 0); |
- total += fFields[i].fType->size(); |
- } |
- return total; |
- } |
- default: |
- ABORT(("cannot determine size of type " + fName).c_str()); |
- } |
- } |
- |
/** |
* Returns the corresponding vector or matrix type with the specified number of columns and |
* rows. |