diff --git a/source/blender/gpu/intern/gpu_index_buffer.cc b/source/blender/gpu/intern/gpu_index_buffer.cc index a57c17d5cd3..2b8070770df 100644 --- a/source/blender/gpu/intern/gpu_index_buffer.cc +++ b/source/blender/gpu/intern/gpu_index_buffer.cc @@ -270,12 +270,7 @@ GPUIndexBuf *GPU_indexbuf_build_curves_on_device(GPUPrimType prim_type, tris ? GPU_SHADER_INDEXBUF_TRIS : (lines ? GPU_SHADER_INDEXBUF_LINES : GPU_SHADER_INDEXBUF_POINTS)); GPU_shader_bind(shader); - int index_len = curves_num * dispatch_x_dim; - /* Buffer's size in bytes is required to be multiple of 16. - * Here is made an assumption that buffer's index_type is GPU_INDEX_U32. - * This will make buffer size multiple of 16 after multiplying by sizeof(uint32_t). */ - int multiple_of_4 = ceil_to_multiple_u(index_len, 4); - GPUIndexBuf *ibo = GPU_indexbuf_build_on_device(multiple_of_4); + GPUIndexBuf *ibo = GPU_indexbuf_build_on_device(curves_num * dispatch_x_dim); int resolution; if (tris) { resolution = 6; diff --git a/source/blender/gpu/metal/mtl_index_buffer.mm b/source/blender/gpu/metal/mtl_index_buffer.mm index bb09086d93f..93b25e7a071 100644 --- a/source/blender/gpu/metal/mtl_index_buffer.mm +++ b/source/blender/gpu/metal/mtl_index_buffer.mm @@ -55,7 +55,9 @@ void MTLIndexBuf::bind_as_ssbo(uint32_t binding) /* Create MTLStorageBuffer to wrap this resource and use conventional binding. */ if (ssbo_wrapper_ == nullptr) { - ssbo_wrapper_ = new MTLStorageBuf(this, alloc_size_); + /* Buffer's size in bytes is required to be multiple of 16. */ + int multiple_of_16 = ceil_to_multiple_u(alloc_size_, 16); + ssbo_wrapper_ = new MTLStorageBuf(this, multiple_of_16); } ssbo_wrapper_->bind(binding); }