mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +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';
|
||||
|
||||
if(existing_version)
|
||||
if (existing_version)
|
||||
{
|
||||
int len = 8;
|
||||
while(existing_version[len] && isspace(existing_version[len]))
|
||||
len++;
|
||||
while(existing_version[len] && !isspace(existing_version[len]))
|
||||
len++;
|
||||
|
||||
program = existing_version + len;
|
||||
|
||||
if(len > (sizeof(version) - 2))
|
||||
len = sizeof(version) - 2;
|
||||
|
||||
strncpy(version, existing_version, len);
|
||||
version[len] = '\n';
|
||||
version[len + 1] = '\0';
|
||||
unsigned version_no = strtoul(existing_version + 8, (char**)&program, 10);
|
||||
#ifdef HAVE_OPENGLES
|
||||
if (version_no < 130)
|
||||
version_no = 100;
|
||||
else
|
||||
version_no = 300;
|
||||
#endif
|
||||
snprintf(version, sizeof(version), "#version %u\n", version_no);
|
||||
RARCH_LOG("[GLSL]: Using GLSL version %u.\n", version_no);
|
||||
}
|
||||
else if (glsl_core)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user