diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-08-01 19:02:57 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-08-01 23:08:36 +0300 |
commit | c6f55fb0db126281309a2082abf2f480a4671dc5 (patch) | |
tree | a94ea36f8a773460dec69ffde3b22ad021765453 /source/blender/gpu/intern/gpu_uniformbuffer.c | |
parent | 86270b60dbeab29b4dc7dd9b596bcf0d533639d0 (diff) |
GPUUniformBuffer: Fix bad memcpy error catched by asan
We need to copy the size of the gputype not the padded type.
Diffstat (limited to 'source/blender/gpu/intern/gpu_uniformbuffer.c')
-rw-r--r-- | source/blender/gpu/intern/gpu_uniformbuffer.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/source/blender/gpu/intern/gpu_uniformbuffer.c b/source/blender/gpu/intern/gpu_uniformbuffer.c index 9b8441efd08..3f5706c1f7b 100644 --- a/source/blender/gpu/intern/gpu_uniformbuffer.c +++ b/source/blender/gpu/intern/gpu_uniformbuffer.c @@ -159,9 +159,8 @@ GPUUniformBuffer *GPU_uniformbuffer_dynamic_create(ListBase *inputs, char err_ou float *offset = ubo->data; for (LinkData *link = inputs->first; link; link = link->next) { GPUInput *input = link->data; - const GPUType gputype = get_padded_gpu_type(link); - memcpy(offset, input->dynamicvec, gputype * sizeof(float)); - offset += gputype; + memcpy(offset, input->dynamicvec, input->type * sizeof(float)); + offset += get_padded_gpu_type(link); } /* Note since we may create the UBOs in the CPU in a different thread than the main drawing one, |