Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2022-06-11 14:09:04 +0300
committerClément Foucault <foucault.clem@gmail.com>2022-06-28 19:48:39 +0300
commite127182065a073235bac4158db6b6af1f36651c5 (patch)
tree01fb5e6efceb11f5e529f171ab260e931a5c788b /source/blender/draw/intern/draw_shader_shared.h
parent75ad435ceb63559a1443b618045e99b6ea90883f (diff)
DRW: Curve: Fix wrong UBO alignment
This was preventing correct attribute rendering with multiple attributes. Since the `CurveInfos` struct is used for data sharing between C++ and GLSL and inside a UBO it needs to obey the `std140` alignment rules which states that arrays of scalars are padded to the size of `vec4` for each array entry.
Diffstat (limited to 'source/blender/draw/intern/draw_shader_shared.h')
-rw-r--r--source/blender/draw/intern/draw_shader_shared.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/source/blender/draw/intern/draw_shader_shared.h b/source/blender/draw/intern/draw_shader_shared.h
index 94c0c53dab7..e8944442607 100644
--- a/source/blender/draw/intern/draw_shader_shared.h
+++ b/source/blender/draw/intern/draw_shader_shared.h
@@ -87,9 +87,9 @@ BLI_STATIC_ASSERT_ALIGN(VolumeInfos, 16)
struct CurvesInfos {
/* Per attribute scope, follows loading order.
- * NOTE: uint as bool in GLSL is 4 bytes. */
- uint is_point_attribute[DRW_ATTRIBUTE_PER_CURVES_MAX];
- int _pad;
+ * NOTE: uint as bool in GLSL is 4 bytes.
+ * NOTE: GLSL pad arrays of scalar to 16 bytes (std140). */
+ uint4 is_point_attribute[DRW_ATTRIBUTE_PER_CURVES_MAX];
};
BLI_STATIC_ASSERT_ALIGN(CurvesInfos, 16)