Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClément Foucault <foucault.clem@gmail.com>2020-06-03 17:23:13 +0300
committerClément Foucault <foucault.clem@gmail.com>2020-06-03 17:24:04 +0300
commit96eab0875597bad3e0470f67cb2ba8269cd06b03 (patch)
tree63961a8ff78779575b42718df3c22b4251634167
parentb2dcff4c21a645fa16ca39484d206a38944168d2 (diff)
DRW: Always unbind texture after drawing
This fix issues with the image editor
-rw-r--r--source/blender/draw/intern/draw_manager_exec.c6
-rw-r--r--source/blender/gpu/intern/gpu_texture.c27
2 files changed, 17 insertions, 16 deletions
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);
}
}