mirror of
https://github.com/libretro/RetroArch
synced 2025-02-04 03:40:03 +00:00
Fall back to default shader in GLES2.
This commit is contained in:
parent
a55915b694
commit
b9f605cc9d
17
gfx/gl.c
17
gfx/gl.c
@ -166,6 +166,18 @@ static inline bool load_gl_proc_win32(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
////////////////// Shaders
|
////////////////// 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)
|
static bool gl_shader_init(void)
|
||||||
{
|
{
|
||||||
switch (g_settings.video.shader_type)
|
switch (g_settings.video.shader_type)
|
||||||
@ -203,6 +215,7 @@ static bool gl_shader_init(void)
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void gl_shader_use(unsigned index)
|
void gl_shader_use(unsigned index)
|
||||||
{
|
{
|
||||||
@ -1316,8 +1329,8 @@ static void *gl_init(const video_info_t *video, const input_driver_t **input, vo
|
|||||||
gl->tex_filter = video->smooth ? GL_LINEAR : GL_NEAREST;
|
gl->tex_filter = video->smooth ? GL_LINEAR : GL_NEAREST;
|
||||||
|
|
||||||
gl->texture_type = RARCH_GL_TEXTURE_TYPE;
|
gl->texture_type = RARCH_GL_TEXTURE_TYPE;
|
||||||
gl->texture_fmt = video->rgb32 ? RARCH_GL_FORMAT32 : RARCH_GL_FORMAT16;
|
gl->texture_fmt = video->rgb32 ? RARCH_GL_FORMAT32 : RARCH_GL_FORMAT16;
|
||||||
gl->base_size = video->rgb32 ? sizeof(uint32_t) : sizeof(uint16_t);
|
gl->base_size = video->rgb32 ? sizeof(uint32_t) : sizeof(uint16_t);
|
||||||
|
|
||||||
#ifndef HAVE_OPENGLES
|
#ifndef HAVE_OPENGLES
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
|
@ -981,23 +981,28 @@ bool gl_glsl_init(const char *path)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
unsigned num_progs = 0;
|
||||||
|
struct shader_program progs[MAX_PROGRAMS] = {{0}};
|
||||||
#ifdef HAVE_XML
|
#ifdef HAVE_XML
|
||||||
struct shader_program progs[MAX_PROGRAMS];
|
if (path)
|
||||||
unsigned 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");
|
num_progs = get_xml_shaders(path, progs, MAX_PROGRAMS - 1);
|
||||||
return false;
|
|
||||||
|
if (num_progs == 0)
|
||||||
|
{
|
||||||
|
RARCH_ERR("Couldn't find any valid shaders in XML file.\n");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#else
|
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}};
|
|
||||||
progs[0].vertex = strdup(stock_vertex_modern);
|
|
||||||
progs[0].fragment = strdup(stock_fragment_modern);
|
|
||||||
glsl_modern = true;
|
|
||||||
#endif
|
#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;
|
||||||
|
}
|
||||||
|
|
||||||
struct shader_program stock_prog = {0};
|
struct shader_program stock_prog = {0};
|
||||||
stock_prog.vertex = strdup(glsl_modern ? stock_vertex_modern : stock_vertex_legacy);
|
stock_prog.vertex = strdup(glsl_modern ? stock_vertex_modern : stock_vertex_legacy);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user