diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-08-31 19:39:17 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-09-01 01:30:36 +0300 |
commit | 052538edc1fba109d3427471047611888ed13bea (patch) | |
tree | 8d3bfbd0b1045d7e62647b8cff9f4e4aa28ef56d /source/blender/editors/interface/interface_icons.c | |
parent | 3e7feaff44b70972751c9a62b83bde50a9c09592 (diff) |
Cleanup: Use GPUBatch for icon and area drawing
This is in order to remove GPU_draw_primitive to streamline the drawing
abstraction.
Diffstat (limited to 'source/blender/editors/interface/interface_icons.c')
-rw-r--r-- | source/blender/editors/interface/interface_icons.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_icons.c b/source/blender/editors/interface/interface_icons.c index 887f149ee12..aae0d7c525f 100644 --- a/source/blender/editors/interface/interface_icons.c +++ b/source/blender/editors/interface/interface_icons.c @@ -28,6 +28,7 @@ #include "MEM_guardedalloc.h" #include "GPU_batch.h" +#include "GPU_batch_presets.h" #include "GPU_immediate.h" #include "GPU_matrix.h" #include "GPU_state.h" @@ -1573,7 +1574,9 @@ static void icon_draw_cache_texture_flush_ex(GPUTexture *texture, GPU_shader_uniform_vector( shader, data_loc, 4, ICON_DRAW_CACHE_SIZE * 3, (float *)texture_draw_calls->drawcall_cache); - GPU_draw_primitive(GPU_PRIM_TRIS, 6 * texture_draw_calls->calls); + GPUBatch *quad = GPU_batch_preset_quad(); + GPU_batch_set_shader(quad, shader); + GPU_batch_draw_instanced(quad, texture_draw_calls->calls); GPU_texture_unbind(texture); @@ -1721,7 +1724,9 @@ static void icon_draw_texture(float x, GPU_texture_bind(texture, img_binding); GPU_sampler_icon_bind(img_binding); - GPU_draw_primitive(GPU_PRIM_TRI_STRIP, 4); + GPUBatch *quad = GPU_batch_preset_quad(); + GPU_batch_set_shader(quad, shader); + GPU_batch_draw(quad); GPU_texture_unbind(texture); |