Explorar el Código

shader: fix warnings

rdb hace 5 años
padre
commit
55a017df5a

+ 2 - 2
panda/src/glstuff/glShaderContext_src.cxx

@@ -3173,11 +3173,11 @@ report_shader_errors(const Module &module, bool fatal) {
     return;
     return;
   }
   }
 
 
-  const ShaderModuleGlsl *glsl_module = DCAST(ShaderModuleGlsl, module._module);
-  if (glsl_module == nullptr) {
+  if (!module._module->is_of_type(ShaderModuleGlsl::get_class_type())) {
     GLCAT.error(false) << info_log;
     GLCAT.error(false) << info_log;
     return;
     return;
   }
   }
+  const ShaderModuleGlsl *glsl_module = (const ShaderModuleGlsl *)module._module;
 
 
   // Parse the errors so that we can substitute in actual file locations
   // Parse the errors so that we can substitute in actual file locations
   // instead of source indices.
   // instead of source indices.

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

@@ -125,7 +125,7 @@ expect_float_matrix(const InternalName *name, const ::ShaderType *type, int lo,
     scalar_type = matrix->get_scalar_type();
     scalar_type = matrix->get_scalar_type();
   }
   }
   if (scalar_type != ScalarType::ST_float || num_rows != num_columns ||
   if (scalar_type != ScalarType::ST_float || num_rows != num_columns ||
-      num_rows < lo || num_rows > hi) {
+      (int)num_rows < lo || (int)num_rows > hi) {
 
 
     std::string msg = "expected square floating-point matrix of ";
     std::string msg = "expected square floating-point matrix of ";
     if (lo < hi) {
     if (lo < hi) {
@@ -2278,7 +2278,7 @@ bind_parameter(CPT_InternalName name, const ::ShaderType *type, int location) {
           bind._id._name = fqname->get_name();
           bind._id._name = fqname->get_name();
           bind._part = STO_light_i_shadow_map;
           bind._part = STO_light_i_shadow_map;
           bind._desired_type = Texture::TT_2d_texture;
           bind._desired_type = Texture::TT_2d_texture;
-          for (bind._stage = 0; bind._stage < array->get_num_elements(); ++bind._stage) {
+          for (bind._stage = 0; bind._stage < (int)array->get_num_elements(); ++bind._stage) {
             _tex_spec.push_back(bind);
             _tex_spec.push_back(bind);
             bind._id._seqno += num_members;
             bind._id._seqno += num_members;
           }
           }
@@ -2342,7 +2342,7 @@ bind_parameter(CPT_InternalName name, const ::ShaderType *type, int location) {
             bind._part[1] = SMO_identity;
             bind._part[1] = SMO_identity;
             bind._arg[1] = nullptr;
             bind._arg[1] = nullptr;
           }
           }
-          for (bind._index = 0; bind._index < array->get_num_elements(); ++bind._index) {
+          for (bind._index = 0; bind._index < (int)array->get_num_elements(); ++bind._index) {
             cp_add_mat_spec(bind);
             cp_add_mat_spec(bind);
             bind._id._seqno += num_members;
             bind._id._seqno += num_members;
           }
           }

+ 3 - 3
panda/src/shaderpipeline/shaderModuleSpirV.I

@@ -161,7 +161,7 @@ insert(iterator &it, spv::Op opcode, const uint32_t *args, uint16_t nargs) {
   ptrdiff_t offset = it._words - &_words[0];
   ptrdiff_t offset = it._words - &_words[0];
 
 
   // If this triggers, you used an invalid iterator.
   // If this triggers, you used an invalid iterator.
-  assert(offset >= 0 && offset <= _words.size());
+  assert(offset >= 0 && (size_t)offset <= _words.size());
 
 
   _words.insert(_words.begin() + offset, ((nargs + 1) << spv::WordCountShift) | opcode);
   _words.insert(_words.begin() + offset, ((nargs + 1) << spv::WordCountShift) | opcode);
   _words.insert(_words.begin() + offset + 1, args, args + nargs);
   _words.insert(_words.begin() + offset + 1, args, args + nargs);
@@ -178,7 +178,7 @@ erase(iterator &it) {
   ptrdiff_t offset = it._words - &_words[0];
   ptrdiff_t offset = it._words - &_words[0];
 
 
   // If this triggers, you used an invalid iterator.
   // If this triggers, you used an invalid iterator.
-  assert(offset >= 0 && offset <= _words.size());
+  assert(offset >= 0 && (size_t)offset <= _words.size());
 
 
   uint16_t wcount = _words[offset] >> spv::WordCountShift;
   uint16_t wcount = _words[offset] >> spv::WordCountShift;
   _words.erase(_words.begin() + offset, _words.begin() + offset + wcount);
   _words.erase(_words.begin() + offset, _words.begin() + offset + wcount);
@@ -194,7 +194,7 @@ erase_arg(iterator &it, uint16_t arg) {
   ptrdiff_t offset = it._words - &_words[0];
   ptrdiff_t offset = it._words - &_words[0];
 
 
   // If this triggers, you used an invalid iterator.
   // If this triggers, you used an invalid iterator.
-  assert(offset >= 0 && offset <= _words.size());
+  assert(offset >= 0 && (size_t)offset <= _words.size());
 
 
   uint16_t wcount = _words[offset] >> spv::WordCountShift;
   uint16_t wcount = _words[offset] >> spv::WordCountShift;
   nassertr(arg < wcount - 1, it);
   nassertr(arg < wcount - 1, it);