aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/gpu/vk/GrVkUniformHandler.cpp
diff options
context:
space:
mode:
authorGravatar egdaniel <egdaniel@google.com>2016-07-07 08:04:08 -0700
committerGravatar Commit bot <commit-bot@chromium.org>2016-07-07 08:04:08 -0700
commit75d2bfceaec7216414a7eb527807f2acac5cfd08 (patch)
tree689a262046dd81acfe93a95c040235acdbac1f57 /src/gpu/vk/GrVkUniformHandler.cpp
parent11bf8b2eae7d1780cb969146422a2ab3b933047a (diff)
Correctly handle mat2x2 in Vulkan
Diffstat (limited to 'src/gpu/vk/GrVkUniformHandler.cpp')
-rw-r--r--src/gpu/vk/GrVkUniformHandler.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/gpu/vk/GrVkUniformHandler.cpp b/src/gpu/vk/GrVkUniformHandler.cpp
index 3451d6b344..ca61fc9a73 100644
--- a/src/gpu/vk/GrVkUniformHandler.cpp
+++ b/src/gpu/vk/GrVkUniformHandler.cpp
@@ -53,10 +53,10 @@ uint32_t grsltype_to_alignment_mask(GrSLType type) {
}
/** Returns the size in bytes taken up in vulkanbuffers for floating point GrSLTypes.
- For non floating point type returns 0 */
+ For non floating point type returns 0. Currently this reflects the std140 alignment
+ so a mat22 takes up 8 floats. */
static inline uint32_t grsltype_to_vk_size(GrSLType type) {
SkASSERT(GrSLTypeIsFloatType(type));
- SkASSERT(kMat22f_GrSLType != type); // TODO: handle mat2 differences between std140 and std430.
static const uint32_t kSizes[] = {
0, // kVoid_GrSLType
sizeof(float), // kFloat_GrSLType
@@ -104,8 +104,7 @@ void get_ubo_aligned_offset(uint32_t* uniformOffset,
int arrayCount) {
uint32_t alignmentMask = grsltype_to_alignment_mask(type);
// We want to use the std140 layout here, so we must make arrays align to 16 bytes.
- SkASSERT(type != kMat22f_GrSLType); // TODO: support mat2.
- if (arrayCount) {
+ if (arrayCount || type == kMat22f_GrSLType) {
alignmentMask = 0xF;
}
uint32_t offsetDiff = *currentOffset & alignmentMask;