Browse Source

shader: Fix parameter duplication

rdb 1 year ago
parent
commit
2884e5fdb2
1 changed files with 3 additions and 3 deletions
  1. 3 3
      panda/src/gobj/shader.cxx

+ 3 - 3
panda/src/gobj/shader.cxx

@@ -472,7 +472,9 @@ link() {
       auto result = parameters_by_name.insert({var.name, param});
       auto result = parameters_by_name.insert({var.name, param});
       auto &it = result.first;
       auto &it = result.first;
 
 
-      if (!result.second) {
+      if (result.second) {
+        parameters.push_back(&(it->second));
+      } else {
         // A variable by this name was already added by another stage.  Check
         // A variable by this name was already added by another stage.  Check
         // that it has the same type and location.
         // that it has the same type and location.
         Parameter &other = it->second;
         Parameter &other = it->second;
@@ -490,8 +492,6 @@ link() {
           continue;
           continue;
         }
         }
       }
       }
-
-      parameters.push_back(&(it->second));
     }
     }
 
 
     for (const ShaderModule::SpecializationConstant &spec_const : module->_spec_constants) {
     for (const ShaderModule::SpecializationConstant &spec_const : module->_spec_constants) {