This commit is contained in:
twinaphex 2020-03-03 10:58:04 +01:00
parent d1ebb58580
commit d5f7839d12

View File

@ -73,11 +73,12 @@ static std::string build_stage_source(
strlcpy(expected, "#pragma stage ", sizeof(expected)); strlcpy(expected, "#pragma stage ", sizeof(expected));
strlcat(expected, stage, sizeof(expected)); strlcat(expected, stage, sizeof(expected));
active = strcmp(expected, line) == 0; active = string_is_equal(expected, line);
} }
} }
else if (!strncmp("#pragma name ", line, STRLEN_CONST("#pragma name ")) || else if (
!strncmp("#pragma format ", line, STRLEN_CONST("#pragma format "))) !strncmp("#pragma name ", line, STRLEN_CONST("#pragma name ")) ||
!strncmp("#pragma format ", line, STRLEN_CONST("#pragma format ")))
{ {
/* Ignore */ /* Ignore */
} }
@ -104,7 +105,8 @@ bool glslang_parse_meta(const struct string_list *lines, glslang_meta *meta)
const char *line = lines->elems[i].data; const char *line = lines->elems[i].data;
/* Check for shader identifier */ /* Check for shader identifier */
if (!strncmp("#pragma name ", line, STRLEN_CONST("#pragma name "))) if (!strncmp("#pragma name ", line,
STRLEN_CONST("#pragma name ")))
{ {
const char *str = NULL; const char *str = NULL;
@ -121,7 +123,8 @@ bool glslang_parse_meta(const struct string_list *lines, glslang_meta *meta)
meta->name = str; meta->name = str;
} }
/* Check for shader parameters */ /* Check for shader parameters */
else if (!strncmp("#pragma parameter ", line, STRLEN_CONST("#pragma parameter "))) else if (!strncmp("#pragma parameter ", line,
STRLEN_CONST("#pragma parameter ")))
{ {
float initial, minimum, maximum, step; float initial, minimum, maximum, step;
int ret = sscanf( int ret = sscanf(
@ -175,12 +178,14 @@ bool glslang_parse_meta(const struct string_list *lines, glslang_meta *meta)
} }
else else
{ {
RARCH_ERR("[slang]: Invalid #pragma parameter line: \"%s\".\n", line); RARCH_ERR("[slang]: Invalid #pragma parameter line: \"%s\".\n",
line);
return false; return false;
} }
} }
/* Check for framebuffer format */ /* Check for framebuffer format */
else if (!strncmp("#pragma format ", line, STRLEN_CONST("#pragma format "))) else if (!strncmp("#pragma format ", line,
STRLEN_CONST("#pragma format ")))
{ {
const char *str = NULL; const char *str = NULL;
@ -246,9 +251,7 @@ bool glslang_compile_shader(const char *shader_path, glslang_output *output)
return true; return true;
error: error:
string_list_free(lines);
if (lines)
string_list_free(lines);
#endif #endif
return false; return false;