diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-05-14 14:45:55 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-05-14 14:54:05 +0300 |
commit | bf45a46f814092cf8b03909ad2d30f4a17b62f10 (patch) | |
tree | cd10307f73680ba8bfe0a5648059b042af94b213 /source/blender/gpu/GPU_vertex_format.h | |
parent | 6bb7eb17065100a8ff6bb9eee2f3f7448e89e674 (diff) |
GPU: Fixup and add assert to GPU_VERT_ATTR_NAMES_BUF_LEN
Diffstat (limited to 'source/blender/gpu/GPU_vertex_format.h')
-rw-r--r-- | source/blender/gpu/GPU_vertex_format.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/source/blender/gpu/GPU_vertex_format.h b/source/blender/gpu/GPU_vertex_format.h index 74fad51f571..b0ff7c1820f 100644 --- a/source/blender/gpu/GPU_vertex_format.h +++ b/source/blender/gpu/GPU_vertex_format.h @@ -28,6 +28,7 @@ #include "GPU_common.h" #include "BLI_compiler_compat.h" +#include "BLI_assert.h" #define GPU_VERT_ATTR_MAX_LEN 16 #define GPU_VERT_ATTR_MAX_NAMES 4 @@ -70,6 +71,12 @@ typedef struct GPUVertAttr { uchar names[GPU_VERT_ATTR_MAX_NAMES]; } GPUVertAttr; +BLI_STATIC_ASSERT(GPU_VERT_ATTR_NAMES_BUF_LEN <= 256, + "We use uchar as index inside the name buffer " + "so GPU_VERT_ATTR_NAMES_BUF_LEN needs to be be " + "smaller than GPUVertFormat->name_offset and " + "GPUVertAttr->names maximum value"); + typedef struct GPUVertFormat { /** 0 to 16 (GPU_VERT_ATTR_MAX_LEN). */ uint attr_len : 5; |