GPU: double uniform names buffer size

Adding a constant yields quadratic time complexity which can
have quite a big impact on some scenes.

I used the file from T64901 for testing.
In the test file, the time it took to execute `wm_draw_update`
changed from `0.60s` to `0.51s`.

Reviewers: brecht

Differential Revision: https://developer.blender.org/D4916
This commit is contained in:
Jacques Lucke 2019-05-21 17:14:38 +02:00
parent 03ad013c0a
commit 6f893d6f05
2 changed files with 1 additions and 2 deletions

View File

@ -45,7 +45,6 @@
#define DRW_DEBUG_USE_UNIFORM_NAME 0
#define DRW_UNIFORM_BUFFER_NAME 64
#define DRW_UNIFORM_BUFFER_NAME_INC 1024
/* ------------ Profiling --------------- */

View File

@ -142,7 +142,7 @@ static void drw_shgroup_uniform(DRWShadingGroup *shgroup,
size_t len = strlen(name) + 1;
if (len >= max_len) {
DST.uniform_names.buffer_len += DRW_UNIFORM_BUFFER_NAME_INC;
DST.uniform_names.buffer_len += MAX2(DST.uniform_names.buffer_len, len);
DST.uniform_names.buffer = MEM_reallocN(DST.uniform_names.buffer,
DST.uniform_names.buffer_len);
}