From f3ca37cb2bcd57690666dc0123b638e6c9801563 Mon Sep 17 00:00:00 2001 From: Themaister Date: Sun, 7 Apr 2013 13:08:09 +0200 Subject: [PATCH] Always use NULL shader is shader_enable is false. RARCH_CONSOLE sets true as default. Update the config if shader_enable is false. --- config.def.h | 4 ++++ gfx/gl.c | 12 +++++------- gfx/shader_parse.c | 3 +++ 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/config.def.h b/config.def.h index bc5dc9c0e6..0a52fcaae7 100644 --- a/config.def.h +++ b/config.def.h @@ -249,7 +249,11 @@ static const bool video_smooth = true; static const bool force_aspect = true; // Enable use of shaders. +#ifdef RARCH_CONSOLE +static const bool shader_enable = true; +#else static const bool shader_enable = false; +#endif // Only scale in integer steps. // The base size depends on system-reported geometry and aspect ratio. diff --git a/gfx/gl.c b/gfx/gl.c index 2f889bf48a..b507e8bf63 100644 --- a/gfx/gl.c +++ b/gfx/gl.c @@ -250,18 +250,16 @@ static bool gl_shader_init(void *data) gl_t *gl = (gl_t*)data; const gl_shader_backend_t *backend = NULL; - if (DEFAULT_SHADER_TYPE == RARCH_SHADER_NONE && !g_settings.video.shader_enable) + const char *shader_path = (g_settings.video.shader_enable && *g_settings.video.shader_path) ? + g_settings.video.shader_path : NULL; + enum rarch_shader_type type = gfx_shader_parse_type(shader_path, DEFAULT_SHADER_TYPE); + + if (type == RARCH_SHADER_NONE) { RARCH_LOG("[GL]: Not loading any shader.\n"); return true; } - const char *shader_path = *g_settings.video.shader_path ? g_settings.video.shader_path : NULL; - enum rarch_shader_type type = gfx_shader_parse_type(g_settings.video.shader_path, DEFAULT_SHADER_TYPE); - - if (type == RARCH_SHADER_NONE) - return true; - switch (type) { #ifdef HAVE_CG diff --git a/gfx/shader_parse.c b/gfx/shader_parse.c index 48afcd0222..e52fd7b1ac 100644 --- a/gfx/shader_parse.c +++ b/gfx/shader_parse.c @@ -1060,6 +1060,9 @@ void gfx_shader_write_conf_cgp(config_file_t *conf, const struct gfx_shader *sha enum rarch_shader_type gfx_shader_parse_type(const char *path, enum rarch_shader_type fallback) { + if (!path) + return fallback; + const char *ext = path_get_extension(path); if (strcmp(ext, "cg") == 0 || strcmp(ext, "cgp") == 0)