GPUUniformBuffer: Fix bad memcpy error catched by asan

We need to copy the size of the gputype not the padded type.
This commit is contained in:
Clément Foucault 2018-08-01 18:02:57 +02:00
parent 86270b60db
commit c6f55fb0db
1 changed files with 2 additions and 3 deletions

View File

@ -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,