mirror of
https://github.com/MobileGL-Dev/MobileGlues.git
synced 2025-09-22 18:53:35 -04:00
[Fix] (glsl_for_es.cpp): make sure define always after #version
This commit is contained in:
parent
d4dfb56423
commit
f4e957d3c0
@ -525,18 +525,19 @@ vec4 GI_TemporalFilter() {
|
|||||||
glsl.insert(main_loc, "\n" + GI_TemporalFilter + "\n");
|
glsl.insert(main_loc, "\n" + GI_TemporalFilter + "\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
void inject_mg_macro_definition(std::string& glslCode) {
|
#define xstr(s) str(s)
|
||||||
std::stringstream macro_stream;
|
#define str(s) #s
|
||||||
macro_stream << "\n#define MG_MOBILEGLUES\n"
|
|
||||||
<< "#define MG_MOBILEGLUES_VERSION "
|
|
||||||
<< MAJOR << MINOR << REVISION << PATCH << "\n";
|
|
||||||
std::string macro_definitions = macro_stream.str();
|
|
||||||
|
|
||||||
size_t lastExtensionPos = glslCode.rfind("#extension");
|
void inject_mg_macro_definition(std::string& glslCode) {
|
||||||
|
std::string macro_definitions =
|
||||||
|
"\n#define MG_MOBILEGLUES\n"
|
||||||
|
"#define MG_MOBILEGLUES_VERSION " xstr(MAJOR) xstr(MINOR) xstr(REVISION) xstr(PATCH) "\n";
|
||||||
|
|
||||||
|
size_t versionPos = glslCode.rfind("#version");
|
||||||
size_t insertionPos = 0;
|
size_t insertionPos = 0;
|
||||||
|
|
||||||
if (lastExtensionPos != std::string::npos) {
|
if (versionPos != std::string::npos) {
|
||||||
size_t nextNewline = glslCode.find('\n', lastExtensionPos);
|
size_t nextNewline = glslCode.find('\n', versionPos);
|
||||||
insertionPos = (nextNewline != std::string::npos) ? nextNewline + 1 : glslCode.length();
|
insertionPos = (nextNewline != std::string::npos) ? nextNewline + 1 : glslCode.length();
|
||||||
} else {
|
} else {
|
||||||
size_t firstNewline = glslCode.find('\n');
|
size_t firstNewline = glslCode.find('\n');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user