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