diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-11-13 17:59:23 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-11-13 17:59:23 +0300 |
commit | 67dfb6170042b8935f958dec3f1e542ddb6f9b71 (patch) | |
tree | cb44dea72ee0ec8dd34a2c6c5ba14345ea4e4126 | |
parent | d0f05ba9158ddc4549e56a554d76863f22b62725 (diff) |
DRW: Wrappers: Avoid default vector length of 0 if sizeof(T) is large
This increases the default size to some reasonable value (>512bytes) and
allocate at least 1 element.
-rw-r--r-- | source/blender/draw/intern/DRW_gpu_wrapper.hh | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/source/blender/draw/intern/DRW_gpu_wrapper.hh b/source/blender/draw/intern/DRW_gpu_wrapper.hh index 3be50d471e2..8bcfec41c36 100644 --- a/source/blender/draw/intern/DRW_gpu_wrapper.hh +++ b/source/blender/draw/intern/DRW_gpu_wrapper.hh @@ -318,7 +318,7 @@ template< /** Type of the values stored in this uniform buffer. */ typename T, /** The number of values that can be stored in this storage buffer at creation. */ - int64_t len = 16u / sizeof(T), + int64_t len = max_ii(1u, 512u / sizeof(T)), /** True if created on device and no memory host memory is allocated. */ bool device_only = false> class StorageArrayBuffer : public detail::StorageCommon<T, len, device_only> { @@ -372,7 +372,7 @@ template< /** Type of the values stored in this uniform buffer. */ typename T, /** The number of values that can be stored in this storage buffer at creation. */ - int64_t len = 16u / sizeof(T)> + int64_t len = max_ii(1u, 512u / sizeof(T))> class StorageVectorBuffer : public StorageArrayBuffer<T, len, false> { private: /* Number of items, not the allocated length. */ |