diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2020-09-02 01:27:41 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2020-09-05 18:49:14 +0300 |
commit | f72c1c4547e5fab769c22652d9872192029ad7fe (patch) | |
tree | 4b89ee42810e0505ed386b76bf5f76f5d4107a1c /source/blender/blenfont | |
parent | c598e939ad25dfc3b4eb1c92b16de401bde0d88a (diff) |
GPUTexture: Remove bind to edit calls
This is going to be unecessary after the GPU opengl texture backend refactor.
For now add a save/restore mechanism to leave the state untouched.
Also remove some calls where the caller would bind to particular binding
point and set the shader uniform.
Diffstat (limited to 'source/blender/blenfont')
-rw-r--r-- | source/blender/blenfont/intern/blf_font.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/source/blender/blenfont/intern/blf_font.c b/source/blender/blenfont/intern/blf_font.c index 5724d844089..1b27b6dd4c1 100644 --- a/source/blender/blenfont/intern/blf_font.c +++ b/source/blender/blenfont/intern/blf_font.c @@ -187,8 +187,6 @@ static GPUTexture *blf_batch_cache_texture_load(void) int offset_x = bitmap_len_landed % tex_width; int offset_y = bitmap_len_landed / tex_width; - GPU_texture_bind(gc->texture, 0); - /* TODO(germano): Update more than one row in a single call. */ while (remain) { int remain_row = tex_width - offset_x; @@ -229,16 +227,17 @@ void blf_batch_draw(void) #endif GPUTexture *texture = blf_batch_cache_texture_load(); - GPU_texture_bind(texture, 0); GPU_vertbuf_data_len_set(g_batch.verts, g_batch.glyph_len); GPU_vertbuf_use(g_batch.verts); /* send data */ GPU_batch_program_set_builtin(g_batch.batch, GPU_SHADER_TEXT); - GPU_batch_uniform_1i(g_batch.batch, "glyph", 0); + GPU_batch_texture_bind(g_batch.batch, "glyph", texture); GPU_batch_draw(g_batch.batch); GPU_blend(GPU_BLEND_NONE); + GPU_texture_unbind(texture); + /* restart to 1st vertex data pointers */ GPU_vertbuf_attr_get_raw_data(g_batch.verts, g_batch.pos_loc, &g_batch.pos_step); GPU_vertbuf_attr_get_raw_data(g_batch.verts, g_batch.col_loc, &g_batch.col_step); |