[Bf-blender-cvs] [81ecd3f938e] blender2.8: Fix OCIO shader being attmepted to be unbound twice
Sergey Sharybin
noreply at git.blender.org
Mon May 8 15:59:20 CEST 2017
Commit: 81ecd3f938ee0e0d02d71f6c6c21a5c0246055d4
Author: Sergey Sharybin
Date: Mon May 8 15:59:00 2017 +0200
Branches: blender2.8
https://developer.blender.org/rB81ecd3f938ee0e0d02d71f6c6c21a5c0246055d4
Fix OCIO shader being attmepted to be unbound twice
===================================================================
M source/blender/editors/include/BIF_glutil.h
M source/blender/editors/screen/glutil.c
===================================================================
diff --git a/source/blender/editors/include/BIF_glutil.h b/source/blender/editors/include/BIF_glutil.h
index 1477d20f7f1..3184ebee4d9 100644
--- a/source/blender/editors/include/BIF_glutil.h
+++ b/source/blender/editors/include/BIF_glutil.h
@@ -71,6 +71,7 @@ typedef struct IMMDrawPixelsTexState {
struct GPUShader *shader;
unsigned int pos;
unsigned int texco;
+ bool do_shader_unbind;
} IMMDrawPixelsTexState;
/* To be used before calling immDrawPixelsTex
diff --git a/source/blender/editors/screen/glutil.c b/source/blender/editors/screen/glutil.c
index 8bf269f74fa..b284800d510 100644
--- a/source/blender/editors/screen/glutil.c
+++ b/source/blender/editors/screen/glutil.c
@@ -159,6 +159,7 @@ IMMDrawPixelsTexState immDrawPixelsTexSetup(int builtin)
/* Shader will be unbind by immUnbindProgram in immDrawPixelsTexScaled_clipping */
immBindBuiltinProgram(builtin);
immUniform1i("image", 0);
+ state.do_shader_unbind = true;
return state;
}
@@ -318,7 +319,9 @@ void immDrawPixelsTexScaled_clipping(IMMDrawPixelsTexState *state,
}
}
- immUnbindProgram();
+ if (state->do_shader_unbind) {
+ immUnbindProgram();
+ }
glBindTexture(GL_TEXTURE_2D, 0);
glPixelStorei(GL_UNPACK_ROW_LENGTH, unpack_row_length);
@@ -571,6 +574,8 @@ void glaDrawImBuf_glsl_clipping(ImBuf *ibuf, float x, float y, int zoomfilter,
int ok;
IMMDrawPixelsTexState state = {0};
+ /* We want GLSL state to be fully handled by OCIO. */
+ state.do_shader_unbind = false;
immDrawPixelsTexSetupAttributes(&state);
if (ibuf->rect_float) {
More information about the Bf-blender-cvs
mailing list