mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-09-12 06:08:30 +09:00
[Fix]: save order of uniform names, and apply it at linking and buffer mapping
This commit is contained in:
@@ -324,9 +324,11 @@ namespace MG_Util::Program {
|
||||
}
|
||||
|
||||
void GenerateDefaultUBOForGLSL_Multi(
|
||||
MG_Global::unordered_map<GLuint, std::string> &shaderSources) {
|
||||
MG_Global::unordered_map<GLuint, std::string> &shaderSources, std::vector<std::string>& outUniformBufferNames) {
|
||||
if (shaderSources.empty()) return;
|
||||
|
||||
outUniformBufferNames.clear();
|
||||
|
||||
std::unordered_map<GLuint, std::vector<bool>> commentMasks;
|
||||
for (auto const& [id, source] : shaderSources) {
|
||||
commentMasks[id] = buildCommentMask(source);
|
||||
@@ -405,6 +407,8 @@ namespace MG_Util::Program {
|
||||
if (allUniformNames.find(varName) == allUniformNames.end()) {
|
||||
mergedUniforms.push_back(declaration);
|
||||
allUniformNames.insert(varName);
|
||||
// save the uniform names in order
|
||||
outUniformBufferNames.emplace_back(varName);
|
||||
}
|
||||
|
||||
size_t removeStart = declStart;
|
||||
|
||||
@@ -181,7 +181,7 @@ namespace MG_Util::Program {
|
||||
std::pair<std::string, std::string> GenerateDefaultUBOForGLSL(const std::pair<std::string,
|
||||
std::string>& glslSources);
|
||||
void GenerateDefaultUBOForGLSL_Multi(
|
||||
MG_Global::unordered_map<GLuint, std::string> &shaderSources);
|
||||
MG_Global::unordered_map<GLuint, std::string> &shaderSources, std::vector<std::string>& outUniformBufferNames);
|
||||
}
|
||||
|
||||
#endif //MOBILEGL_GLSLTOOL_H
|
||||
|
||||
Reference in New Issue
Block a user