[Bf-blender-cvs] [96eab087559] master: DRW: Always unbind texture after drawing
Clément Foucault
noreply at git.blender.org
Wed Jun 3 16:24:14 CEST 2020
Commit: 96eab0875597bad3e0470f67cb2ba8269cd06b03
Author: Clément Foucault
Date: Wed Jun 3 16:23:13 2020 +0200
Branches: master
https://developer.blender.org/rB96eab0875597bad3e0470f67cb2ba8269cd06b03
DRW: Always unbind texture after drawing
This fix issues with the image editor
===================================================================
M source/blender/draw/intern/draw_manager_exec.c
M source/blender/gpu/intern/gpu_texture.c
===================================================================
diff --git a/source/blender/draw/intern/draw_manager_exec.c b/source/blender/draw/intern/draw_manager_exec.c
index 9cb4ffc99b0..144ce573460 100644
--- a/source/blender/draw/intern/draw_manager_exec.c
+++ b/source/blender/draw/intern/draw_manager_exec.c
@@ -1109,7 +1109,11 @@ static void draw_shgroup(DRWShadingGroup *shgroup, DRWState pass_state)
if (shader_changed) {
if (DST.shader) {
GPU_shader_unbind();
- GPU_texture_unbind_all();
+
+ /* Unbinding can be costly. Skip in normal condition. */
+ if (G.debug & G_DEBUG_GPU) {
+ GPU_texture_unbind_all();
+ }
}
GPU_shader_bind(shgroup->shader);
DST.shader = shgroup->shader;
diff --git a/source/blender/gpu/intern/gpu_texture.c b/source/blender/gpu/intern/gpu_texture.c
index 1e5f7d753b2..1d870ed2fdc 100644
--- a/source/blender/gpu/intern/gpu_texture.c
+++ b/source/blender/gpu/intern/gpu_texture.c
@@ -1771,22 +1771,19 @@ void GPU_texture_unbind(GPUTexture *tex)
void GPU_texture_unbind_all(void)
{
- /* Unbinding can be costly. Skip in normal condition. */
- if (G.debug & G_DEBUG_GPU) {
- for (int i = 0; i < GPU_max_textures(); i++) {
- glActiveTexture(GL_TEXTURE0 + i);
- glBindTexture(GL_TEXTURE_2D, 0);
- glBindTexture(GL_TEXTURE_2D_ARRAY, 0);
- glBindTexture(GL_TEXTURE_1D, 0);
- glBindTexture(GL_TEXTURE_1D_ARRAY, 0);
- glBindTexture(GL_TEXTURE_3D, 0);
- glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
- glBindTexture(GL_TEXTURE_BUFFER, 0);
- if (GPU_arb_texture_cube_map_array_is_supported()) {
- glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY_ARB, 0);
- }
- glBindSampler(i, 0);
+ for (int i = 0; i < GPU_max_textures(); i++) {
+ glActiveTexture(GL_TEXTURE0 + i);
+ glBindTexture(GL_TEXTURE_2D, 0);
+ glBindTexture(GL_TEXTURE_2D_ARRAY, 0);
+ glBindTexture(GL_TEXTURE_1D, 0);
+ glBindTexture(GL_TEXTURE_1D_ARRAY, 0);
+ glBindTexture(GL_TEXTURE_3D, 0);
+ glBindTexture(GL_TEXTURE_CUBE_MAP, 0);
+ glBindTexture(GL_TEXTURE_BUFFER, 0);
+ if (GPU_arb_texture_cube_map_array_is_supported()) {
+ glBindTexture(GL_TEXTURE_CUBE_MAP_ARRAY_ARB, 0);
}
+ glBindSampler(i, 0);
}
}
More information about the Bf-blender-cvs
mailing list