diff options
author | Campbell Barton <ideasman42@gmail.com> | 2016-06-07 21:03:25 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2016-06-07 21:13:21 +0300 |
commit | f3d33a1a0f1dd4092d35760027f495bc21d1e4be (patch) | |
tree | 404db0cfdc9a1ac70622567077014cb299a9d916 /source/blender/gpu/GPU_basic_shader.h | |
parent | cf8a0d08b034dd59624a8657ab79f51b64708ab1 (diff) |
GPU: Fix for glDrawPixels drawing w/ glsl shader
The basic shader needs to be temporarily disabled in this case.
Add macros for temp store/restoring the state.
Diffstat (limited to 'source/blender/gpu/GPU_basic_shader.h')
-rw-r--r-- | source/blender/gpu/GPU_basic_shader.h | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/gpu/GPU_basic_shader.h b/source/blender/gpu/GPU_basic_shader.h index 11d87ce93a8..f30b40c37f1 100644 --- a/source/blender/gpu/GPU_basic_shader.h +++ b/source/blender/gpu/GPU_basic_shader.h @@ -76,6 +76,22 @@ void GPU_basic_shaders_exit(void); void GPU_basic_shader_bind(int options); int GPU_basic_shader_bound_options(void); +/* Only use for small blocks of code that don't support glsl shader. */ +#define GPU_BASIC_SHADER_DISABLE_AND_STORE(bound_options) \ +if (GPU_basic_shader_use_glsl_get()) { \ + if ((bound_options = GPU_basic_shader_bound_options())) { \ + GPU_basic_shader_bind(0); \ + } \ +} \ +else { bound_options = 0; } ((void)0) +#define GPU_BASIC_SHADER_ENABLE_AND_RESTORE(bound_options) \ +if (GPU_basic_shader_use_glsl_get()) { \ + if (bound_options) { \ + GPU_basic_shader_bind(bound_options); \ + } \ +} ((void)0) + + void GPU_basic_shader_colors(const float diffuse[3], const float specular[3], int shininess, float alpha); |