Fall back to default shader in GLES2.

This commit is contained in:
Themaister 2012-09-15 15:37:08 +02:00
parent a55915b694
commit b9f605cc9d
2 changed files with 33 additions and 15 deletions

View File

@ -166,6 +166,18 @@ static inline bool load_gl_proc_win32(void)
#endif
////////////////// Shaders
#ifdef HAVE_OPENGLES2
static bool gl_shader_init(void) // We always need a shader alive in GLES2.
{
const char *shader_path = NULL;
if ((g_settings.video.shader_type == RARCH_SHADER_AUTO || g_settings.video.shader_type == RARCH_SHADER_BSNES)
&& *g_settings.video.bsnes_shader_path)
shader_path = g_settings.video.bsnes_shader_path;
return gl_glsl_init(shader_path);
}
#else
static bool gl_shader_init(void)
{
switch (g_settings.video.shader_type)
@ -203,6 +215,7 @@ static bool gl_shader_init(void)
return true;
}
#endif
void gl_shader_use(unsigned index)
{

View File

@ -981,23 +981,28 @@ bool gl_glsl_init(const char *path)
}
#endif
unsigned num_progs = 0;
struct shader_program progs[MAX_PROGRAMS] = {{0}};
#ifdef HAVE_XML
struct shader_program progs[MAX_PROGRAMS];
unsigned num_progs = get_xml_shaders(path, progs, MAX_PROGRAMS - 1);
if (path)
{
num_progs = get_xml_shaders(path, progs, MAX_PROGRAMS - 1);
if (num_progs == 0)
{
RARCH_ERR("Couldn't find any valid shaders in XML file.\n");
return false;
}
#else
RARCH_WARN("[GL]: HAVE_XML is not defined. Stock GLSL shaders will be used instead.\n");
unsigned num_progs = 1;
struct shader_program progs[1] = {{0}};
}
else
#endif
{
RARCH_WARN("[GL]: Stock GLSL shaders will be used.\n");
num_progs = 1;
progs[0].vertex = strdup(stock_vertex_modern);
progs[0].fragment = strdup(stock_fragment_modern);
glsl_modern = true;
#endif
}
struct shader_program stock_prog = {0};
stock_prog.vertex = strdup(glsl_modern ? stock_vertex_modern : stock_vertex_legacy);