소스 검색

shader: Fix parameter duplication

rdb 1 년 전
부모
커밋
2884e5fdb2
1개의 변경된 파일3개의 추가작업 그리고 3개의 파일을 삭제
  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 &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
         // that it has the same type and location.
         Parameter &other = it->second;
@@ -490,8 +492,6 @@ link() {
           continue;
         }
       }
-
-      parameters.push_back(&(it->second));
     }
 
     for (const ShaderModule::SpecializationConstant &spec_const : module->_spec_constants) {