diff options
author | Hans Goudey <h.goudey@me.com> | 2020-11-04 00:26:23 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2020-11-04 00:26:23 +0300 |
commit | db7cf3652cd39c281da3524278122d39722f1b09 (patch) | |
tree | bd5c331d32ed4b4433e4cdcad2871737e91fce78 /source | |
parent | cabec082532f38115b66125f4d28214fa030ab71 (diff) |
Fix for previous cleanup commit
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/draw/intern/draw_instance_data.c | 35 | ||||
-rw-r--r-- | source/blender/draw/intern/draw_instance_data.h | 2 |
2 files changed, 20 insertions, 17 deletions
diff --git a/source/blender/draw/intern/draw_instance_data.c b/source/blender/draw/intern/draw_instance_data.c index fd0a0b61503..f1598ea2fff 100644 --- a/source/blender/draw/intern/draw_instance_data.c +++ b/source/blender/draw/intern/draw_instance_data.c @@ -555,27 +555,28 @@ void DRW_sparse_uniform_buffer_unbind(DRWSparseUniformBuf *buffer, int chunk) } /** Returns a pointer to the given item of the given chunk, allocating memory if necessary. */ -void *DRW_sparse_uniform_buffer_ensure_item(DRWSparseUniformBuf *pool, int chunk, int item) +void *DRW_sparse_uniform_buffer_ensure_item(DRWSparseUniformBuf *buffer, int chunk, int item) { - if (chunk >= pool->num_chunks) { - pool->num_chunks = (chunk + CHUNK_LIST_STEP) & ~(CHUNK_LIST_STEP - 1); - pool->chunk_buffers = MEM_recallocN(pool->chunk_buffers, pool->num_chunks * sizeof(void *)); - pool->chunk_ubos = MEM_recallocN(pool->chunk_ubos, pool->num_chunks * sizeof(void *)); - BLI_BITMAP_RESIZE(pool->chunk_used, pool->num_chunks); + if (chunk >= buffer->num_chunks) { + buffer->num_chunks = (chunk + CHUNK_LIST_STEP) & ~(CHUNK_LIST_STEP - 1); + buffer->chunk_buffers = MEM_recallocN(buffer->chunk_buffers, + buffer->num_chunks * sizeof(void *)); + buffer->chunk_ubos = MEM_recallocN(buffer->chunk_ubos, buffer->num_chunks * sizeof(void *)); + BLI_BITMAP_RESIZE(buffer->chunk_used, buffer->num_chunks); } - char *buffer = pool->chunk_buffers[chunk]; + char *chunk_buffer = buffer->chunk_buffers[chunk]; - if (buffer == NULL) { - pool->chunk_buffers[chunk] = buffer = MEM_callocN(pool->chunk_bytes, __func__); + if (chunk_buffer == NULL) { + buffer->chunk_buffers[chunk] = chunk_buffer = MEM_callocN(buffer->chunk_bytes, __func__); } - else if (!BLI_BITMAP_TEST(pool->chunk_used, chunk)) { - memset(buffer, 0, pool->chunk_bytes); + else if (!BLI_BITMAP_TEST(buffer->chunk_used, chunk)) { + memset(chunk_buffer, 0, buffer->chunk_bytes); } - BLI_BITMAP_ENABLE(pool->chunk_used, chunk); + BLI_BITMAP_ENABLE(buffer->chunk_used, chunk); - return buffer + pool->item_size * item; + return chunk_buffer + buffer->item_size * item; } /** \} */ @@ -652,9 +653,11 @@ static bool drw_uniform_property_lookup(ID *id, const char *name, float r_data[4 return true; } - copy_v4_fl4(r_data, 0, 0, 0, 1); - RNA_property_float_get_array(&ptr, prop, r_data); - return true; + if (type == PROP_FLOAT && arraylen <= 4) { + copy_v4_fl4(r_data, 0, 0, 0, 1); + RNA_property_float_get_array(&ptr, prop, r_data); + return true; + } return false; } diff --git a/source/blender/draw/intern/draw_instance_data.h b/source/blender/draw/intern/draw_instance_data.h index affb784a043..c959a9e19d6 100644 --- a/source/blender/draw/intern/draw_instance_data.h +++ b/source/blender/draw/intern/draw_instance_data.h @@ -68,7 +68,7 @@ void DRW_sparse_uniform_buffer_free(DRWSparseUniformBuf *buffer); bool DRW_sparse_uniform_buffer_is_empty(DRWSparseUniformBuf *buffer); void DRW_sparse_uniform_buffer_bind(DRWSparseUniformBuf *buffer, int chunk, int location); void DRW_sparse_uniform_buffer_unbind(DRWSparseUniformBuf *buffer, int chunk); -void *DRW_sparse_uniform_buffer_ensure_item(DRWSparseUniformBuf *pool, int chunk, int item); +void *DRW_sparse_uniform_buffer_ensure_item(DRWSparseUniformBuf *buffer, int chunk, int item); /* Uniform attribute UBO management. */ struct GHash *DRW_uniform_attrs_pool_new(void); |