diff options
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; |