Commit: 3dca5e22df94547e11271eab994013527585c13d
Author: Campbell Barton
Date: Wed Jun 8 03:46:19 2016 +1000
Branches: compositor-2016
https://developer.blender.org/rB3dca5e22df94547e11271eab994013527585c13d
GPU: make using the glsl basic-shader a flag
This allows for it to be more easily tested.
===================================================================
M source/blender/gpu/GPU_basic_shader.h
M source/blender/gpu/intern/gpu_basic_shader.c
M source/creator/creator_args.c
===================================================================
diff --git a/source/blender/gpu/GPU_basic_shader.h
b/source/blender/gpu/GPU_basic_shader.h
index df2da97..11d87ce 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 088dac6..e4ec57d 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)
diff --git a/source/creator/creator_args.c b/source/creator/creator_args.c
index 3b27ad6..c89cdea 100644
--- a/source/creator/creator_args.c
+++ b/source/creator/creator_args.c
@@ -72,6 +72,7 @@
#include "WM_api.h"
+#include "GPU_basic_shader.h"
#include "GPU_draw.h"
#include "GPU_extensions.h"
@@ -591,6 +592,7 @@ static int arg_handle_print_help(int UNUSED(argc), const
char **UNUSED(argv), vo
printf("\n");
printf("Experimental Features:\n");
BLI_argsPrintArgDoc(ba, "--enable-new-depsgraph");
+ BLI_argsPrintArgDoc(ba, "--enable-new-basic-shader-glsl");
printf("\n");
printf("Argument Parsing:\n");
@@ -1172,6 +1174,16 @@ static int arg_handle_depsgraph_use_new(int
UNUSED(argc), const char **UNUSED(ar
return 0;
}
+static const char arg_handle_basic_shader_glsl_use_new_doc[] =
+"\n\tUse new GLSL basic shader"
+;
+static int arg_handle_basic_shader_glsl_use_new(int UNUSED(argc), const char
**UNUSED(argv), void *UNUSED(data))
+{
+ printf("Using new GLSL basic shader.\n");
+ GPU_basic_shader_use_glsl_set(true);
+ return 0;
+}
+
static const char arg_handle_verbosity_set_doc[] =
"<verbose>\n"
"\tSet logging verbosity level."
@@ -1807,6 +1819,7 @@ void main_args_setup(bContext *C, bArgs *ba,
SYS_SystemHandle *syshandle)
CB_EX(arg_handle_debug_mode_generic_set, gpumem), (void
*)G_DEBUG_GPU_MEM);
BLI_argsAdd(ba, 1, NULL, "--enable-new-depsgraph",
CB(arg_handle_depsgraph_use_new), NULL);
+ BLI_argsAdd(ba, 1, NULL, "--enable-new-basic-shader-glsl",
CB(arg_handle_basic_shader_glsl_use_new), NULL);
BLI_argsAdd(ba, 1, NULL, "--verbose", CB(arg_handle_verbosity_set),
NULL);
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
https://lists.blender.org/mailman/listinfo/bf-blender-cvs