Fix #119247: Curves: Extra point in evaluated spline of Curves geometry
In bf17fc8d79 after extending buffer to multiple of 4 there appeared trailing
space in buffer not covered by shader's `for` loop.
Pull Request: https://projects.blender.org/blender/blender/pulls/119346
This commit is contained in:
committed by
Clément Foucault
parent
986577f4ce
commit
aa3ffca8dc
@@ -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;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user