diff options
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/main/shaderobj.c | 6 | ||||
-rw-r--r-- | src/mesa/main/shaderobj.h | 13 |
2 files changed, 15 insertions, 4 deletions
diff --git a/src/mesa/main/shaderobj.c b/src/mesa/main/shaderobj.c index 81bd7829d36..02ccf450bf9 100644 --- a/src/mesa/main/shaderobj.c +++ b/src/mesa/main/shaderobj.c @@ -193,9 +193,9 @@ _mesa_lookup_shader_err(struct gl_context *ctx, GLuint name, const char *caller) * Then set ptr to point to shProg, incrementing its refcount. */ void -_mesa_reference_shader_program(struct gl_context *ctx, - struct gl_shader_program **ptr, - struct gl_shader_program *shProg) +_mesa_reference_shader_program_(struct gl_context *ctx, + struct gl_shader_program **ptr, + struct gl_shader_program *shProg) { assert(ptr); if (*ptr == shProg) { diff --git a/src/mesa/main/shaderobj.h b/src/mesa/main/shaderobj.h index 05ddfeb50f1..92f7a33eec2 100644 --- a/src/mesa/main/shaderobj.h +++ b/src/mesa/main/shaderobj.h @@ -62,9 +62,20 @@ _mesa_lookup_shader_err(struct gl_context *ctx, GLuint name, const char *caller) extern void -_mesa_reference_shader_program(struct gl_context *ctx, +_mesa_reference_shader_program_(struct gl_context *ctx, struct gl_shader_program **ptr, struct gl_shader_program *shProg); + +static inline void +_mesa_reference_shader_program(struct gl_context *ctx, + struct gl_shader_program **ptr, + struct gl_shader_program *shProg) +{ + if (*ptr != shProg) + _mesa_reference_shader_program_(ctx, ptr, shProg); +} + + extern void _mesa_init_shader(struct gl_context *ctx, struct gl_shader *shader); |