From cf8a0d08b034dd59624a8657ab79f51b64708ab1 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Wed, 8 Jun 2016 03:46:19 +1000 Subject: GPU: make using the glsl basic-shader a flag This allows for it to be more easily tested. --- source/blender/gpu/GPU_basic_shader.h | 3 +++ source/blender/gpu/intern/gpu_basic_shader.c | 20 ++++++++++++++++++-- 2 files changed, 21 insertions(+), 2 deletions(-) (limited to 'source/blender/gpu') diff --git a/source/blender/gpu/GPU_basic_shader.h b/source/blender/gpu/GPU_basic_shader.h index df2da971845..11d87ce93a8 100644 --- a/source/blender/gpu/GPU_basic_shader.h +++ b/source/blender/gpu/GPU_basic_shader.h @@ -110,6 +110,9 @@ void GPU_basic_shader_stipple(GPUBasicShaderStipple stipple_id); void GPU_basic_shader_line_stipple(GLint stipple_factor, GLushort stipple_pattern); void GPU_basic_shader_line_width(float line_width); +bool GPU_basic_shader_use_glsl_get(void); +void GPU_basic_shader_use_glsl_set(bool enabled); + #ifdef __cplusplus } #endif diff --git a/source/blender/gpu/intern/gpu_basic_shader.c b/source/blender/gpu/intern/gpu_basic_shader.c index 088dac6f6cc..e4ec57d9cd3 100644 --- a/source/blender/gpu/intern/gpu_basic_shader.c +++ b/source/blender/gpu/intern/gpu_basic_shader.c @@ -51,8 +51,6 @@ /* State */ -static const bool USE_GLSL = false; - static struct { GPUShader *cached_shaders[GPU_SHADER_OPTION_COMBINATIONS]; bool failed_shaders[GPU_SHADER_OPTION_COMBINATIONS]; @@ -269,6 +267,24 @@ const GLubyte stipple_hexagon[128] = { 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22}; /* ********************************************* */ +/* GLSL State */ + +static bool USE_GLSL = false; + +/** + * \note this isn't part of the basic shader API, + * only set from the command line once on startup. + */ +void GPU_basic_shader_use_glsl_set(bool enabled) +{ + USE_GLSL = enabled; +} + +bool GPU_basic_shader_use_glsl_get(void) +{ + return USE_GLSL; +} + /* Init / exit */ void GPU_basic_shaders_init(void) -- cgit v1.2.3