Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(304)

Unified Diff: src/gpu/vk/GrVkUniformHandler.cpp

Issue 2129953002: Correctly handle mat2x2 in Vulkan (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: nits Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/gpu/vk/GrVkPipelineStateDataManager.cpp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/gpu/vk/GrVkUniformHandler.cpp
diff --git a/src/gpu/vk/GrVkUniformHandler.cpp b/src/gpu/vk/GrVkUniformHandler.cpp
index 3451d6b3441d077d682a9e0953d3e85ec08175fa..ca61fc9a73a1f7bc37d3fd51d7cfc76f4dda9bdf 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;
« no previous file with comments | « src/gpu/vk/GrVkPipelineStateDataManager.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698