DRW: Always unbind texture after drawing
This fix issues with the image editor
This commit is contained in:
parent
b2dcff4c21
commit
96eab08755
Notes:
blender-bot
2023-02-14 00:13:36 +01:00
Referenced by issue #77296, Image viewer shows colour banding when the denoise node is used.
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue