mirror of
https://github.com/libretro/RetroArch
synced 2025-04-09 21:45:45 +00:00
(glslang_util_cxx.cpp) Use string_starts_with
This commit is contained in:
parent
c600fbc6ff
commit
fe8a191012
@ -43,9 +43,9 @@ static std::string build_stage_source(
|
||||
* there is nothing to be gained from trying to replace
|
||||
* this ostringstream with a C-based alternative
|
||||
* (would require a rewrite of deps/glslang/glslang.cpp) */
|
||||
size_t i;
|
||||
std::ostringstream str;
|
||||
bool active = true;
|
||||
size_t i;
|
||||
|
||||
if (!lines)
|
||||
return "";
|
||||
@ -61,6 +61,8 @@ static std::string build_stage_source(
|
||||
{
|
||||
const char *line = lines->elems[i].data;
|
||||
|
||||
if (string_starts_with(line, "#pragma"))
|
||||
{
|
||||
/* Identify 'stage' (fragment/vertex) */
|
||||
if (!strncmp("#pragma stage ", line, STRLEN_CONST("#pragma stage ")))
|
||||
{
|
||||
@ -77,13 +79,18 @@ static std::string build_stage_source(
|
||||
}
|
||||
}
|
||||
else if (
|
||||
!strncmp("#pragma name ", line, STRLEN_CONST("#pragma name ")) ||
|
||||
!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 */
|
||||
}
|
||||
else if (active)
|
||||
str << line;
|
||||
}
|
||||
else if (active)
|
||||
str << line;
|
||||
|
||||
str << '\n';
|
||||
}
|
||||
@ -104,6 +111,8 @@ bool glslang_parse_meta(const struct string_list *lines, glslang_meta *meta)
|
||||
{
|
||||
const char *line = lines->elems[i].data;
|
||||
|
||||
if (string_starts_with(line, "#pragma"))
|
||||
{
|
||||
/* Check for shader identifier */
|
||||
if (!strncmp("#pragma name ", line,
|
||||
STRLEN_CONST("#pragma name ")))
|
||||
@ -208,6 +217,7 @@ bool glslang_parse_meta(const struct string_list *lines, glslang_meta *meta)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user