diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2019-01-16 06:41:27 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2019-01-17 21:44:01 +0300 |
commit | 4c9589909807f346e23966379f240dd57d057a1d (patch) | |
tree | 40bad4807d5b5cdd5e632f00562477bf7bb7754c /source/blender/editors/interface | |
parent | 938b08b33654f6bc3419519fc364021115d19dba (diff) |
GPU: Rename GPU_shader_get_uniform to GPU_shader_get_uniform_ensure
This is in order to make the API more multithread friendly inside the
draw manager.
GPU_shader_get_uniform will only serve to query the shader interface and
not do any GL call, making it threadsafe.
For now it only print a warning if the uniform was not queried before.
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface_icons.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index f3bb61cdd3d..bc265ae6e34 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -1373,8 +1373,8 @@ static void icon_draw_cache_flush_ex(void) GPUShader *shader = GPU_shader_get_builtin_shader(GPU_SHADER_2D_IMAGE_MULTI_RECT_COLOR); GPU_shader_bind(shader); - int img_loc = GPU_shader_get_uniform(shader, "image"); - int data_loc = GPU_shader_get_uniform(shader, "calls_data[0]"); + int img_loc = GPU_shader_get_uniform_ensure(shader, "image"); + int data_loc = GPU_shader_get_uniform_ensure(shader, "calls_data[0]"); glUniform1i(img_loc, 0); glUniform4fv(data_loc, ICON_DRAW_CACHE_SIZE * 3, (float *)g_icon_draw_cache.drawcall_cache); @@ -1462,9 +1462,9 @@ static void icon_draw_texture( if (rgb) glUniform4f(GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_COLOR), rgb[0], rgb[1], rgb[2], alpha); else glUniform4f(GPU_shader_get_builtin_uniform(shader, GPU_UNIFORM_COLOR), alpha, alpha, alpha, alpha); - glUniform1i(GPU_shader_get_uniform(shader, "image"), 0); - glUniform4f(GPU_shader_get_uniform(shader, "rect_icon"), x1, y1, x2, y2); - glUniform4f(GPU_shader_get_uniform(shader, "rect_geom"), x, y, x + w, y + h); + glUniform1i(GPU_shader_get_uniform_ensure(shader, "image"), 0); + glUniform4f(GPU_shader_get_uniform_ensure(shader, "rect_icon"), x1, y1, x2, y2); + glUniform4f(GPU_shader_get_uniform_ensure(shader, "rect_geom"), x, y, x + w, y + h); GPU_draw_primitive(GPU_PRIM_TRI_STRIP, 4); |