mirror of
https://github.com/libretro/RetroArch
synced 2025-04-10 06:44:27 +00:00
better handling of existing #version directive in glsl shaders.
This commit is contained in:
parent
f060863d40
commit
1223309052
@ -261,22 +261,17 @@ static bool gl_glsl_compile_shader(glsl_shader_data_t *glsl,
|
|||||||
|
|
||||||
version[0] = '\0';
|
version[0] = '\0';
|
||||||
|
|
||||||
if(existing_version)
|
if (existing_version)
|
||||||
{
|
{
|
||||||
int len = 8;
|
unsigned version_no = strtoul(existing_version + 8, (char**)&program, 10);
|
||||||
while(existing_version[len] && isspace(existing_version[len]))
|
#ifdef HAVE_OPENGLES
|
||||||
len++;
|
if (version_no < 130)
|
||||||
while(existing_version[len] && !isspace(existing_version[len]))
|
version_no = 100;
|
||||||
len++;
|
else
|
||||||
|
version_no = 300;
|
||||||
program = existing_version + len;
|
#endif
|
||||||
|
snprintf(version, sizeof(version), "#version %u\n", version_no);
|
||||||
if(len > (sizeof(version) - 2))
|
RARCH_LOG("[GLSL]: Using GLSL version %u.\n", version_no);
|
||||||
len = sizeof(version) - 2;
|
|
||||||
|
|
||||||
strncpy(version, existing_version, len);
|
|
||||||
version[len] = '\n';
|
|
||||||
version[len + 1] = '\0';
|
|
||||||
}
|
}
|
||||||
else if (glsl_core)
|
else if (glsl_core)
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user