Browse Source

shaderpipeline: Fix assorted compiler issues with GCC

rdb 1 year ago
parent
commit
b572d98f4d

+ 4 - 2
panda/src/shaderpipeline/spirVHoistStructResourcesPass.cxx

@@ -191,6 +191,9 @@ transform_definition_op(Instruction op) {
       }
       }
     }
     }
     break;
     break;
+
+  default:
+    return SpirVTransformPass::transform_definition_op(op);
   }
   }
 
 
   return true;
   return true;
@@ -332,7 +335,7 @@ transform_function_op(Instruction op, uint32_t function_id) {
             }
             }
 
 
             const MemberDefinition &member_def = def._members[index];
             const MemberDefinition &member_def = def._members[index];
-            if (member_def._new_index != index) {
+            if (member_def._new_index != (int)index) {
               new_args.push_back(define_int_constant(member_def._new_index));
               new_args.push_back(define_int_constant(member_def._new_index));
               access_chain.append(member_def._new_index);
               access_chain.append(member_def._new_index);
             } else {
             } else {
@@ -404,7 +407,6 @@ transform_function_op(Instruction op, uint32_t function_id) {
 
 
           // Passing a struct with non-opaque types to a function.  That means
           // Passing a struct with non-opaque types to a function.  That means
           // adding additional parameters for the hoisted variables.
           // adding additional parameters for the hoisted variables.
-          size_t j = i;
           for (auto &pair : ait->second) {
           for (auto &pair : ait->second) {
             AccessChain access_chain(pair.second);
             AccessChain access_chain(pair.second);
             access_chain._var_id = arg;
             access_chain._var_id = arg;

+ 5 - 2
panda/src/shaderpipeline/spirVTransformPass.cxx

@@ -253,6 +253,9 @@ transform_definition_op(Instruction op) {
       }
       }
     }
     }
     break;
     break;
+
+  default:
+    break;
   }
   }
   return true;
   return true;
 }
 }
@@ -436,7 +439,7 @@ delete_id(uint32_t id) {
 
 
   auto it = _new_annotations.begin();
   auto it = _new_annotations.begin();
   while (it != _new_annotations.end()) {
   while (it != _new_annotations.end()) {
-    spv::Op opcode = (spv::Op)(*it & spv::OpCodeMask);
+    //spv::Op opcode = (spv::Op)(*it & spv::OpCodeMask);
     uint32_t wcount = *it >> spv::WordCountShift;
     uint32_t wcount = *it >> spv::WordCountShift;
     nassertd(wcount > 0) break;
     nassertd(wcount > 0) break;
 
 
@@ -810,7 +813,7 @@ define_int_constant(int32_t constant) {
   for (uint32_t id = 0; id < get_id_bound(); ++id) {
   for (uint32_t id = 0; id < get_id_bound(); ++id) {
     const Definition &def = _db.get_definition(id);
     const Definition &def = _db.get_definition(id);
     if (def.is_constant() &&
     if (def.is_constant() &&
-        def._constant == constant &&
+        def._constant == (uint32_t)constant &&
         (def._type == ShaderType::int_type || (constant >= 0 && def._type == ShaderType::uint_type))) {
         (def._type == ShaderType::int_type || (constant >= 0 && def._type == ShaderType::uint_type))) {
       if (is_defined(id)) {
       if (is_defined(id)) {
         return id;
         return id;

+ 8 - 0
panda/src/shaderpipeline/spirVTransformer.I

@@ -11,6 +11,14 @@
  * @date 2024-10-08
  * @date 2024-10-08
  */
  */
 
 
+/**
+ *
+ */
+INLINE void SpirVTransformer::
+run(SpirVTransformPass &&pass) {
+  run(pass);
+}
+
 /**
 /**
  * Returns the number of ids allocated.
  * Returns the number of ids allocated.
  */
  */

+ 1 - 1
panda/src/shaderpipeline/spirVTransformer.cxx

@@ -113,7 +113,7 @@ run(SpirVTransformPass &pass) {
     for (size_t i = 0; i < def._members.size();) {
     for (size_t i = 0; i < def._members.size();) {
       if (pair.second.count(i)) {
       if (pair.second.count(i)) {
         def._members.erase(def._members.begin() + i);
         def._members.erase(def._members.begin() + i);
-        nassertd(def._members[i]._new_index == i) continue;
+        nassertd(def._members[i]._new_index == (int)i) continue;
       }
       }
       ++i;
       ++i;
     }
     }

+ 1 - 0
panda/src/shaderpipeline/spirVTransformer.h

@@ -35,6 +35,7 @@ public:
   SpirVTransformer(InstructionStream &stream);
   SpirVTransformer(InstructionStream &stream);
 
 
   void run(SpirVTransformPass &pass);
   void run(SpirVTransformPass &pass);
+  INLINE void run(SpirVTransformPass &&pass);
 
 
   InstructionStream get_result() const;
   InstructionStream get_result() const;