Browse Source

Don't error if passing an oversized matrix array to a mat4[1] shader parameter

rdb 9 years ago
parent
commit
5aa8618572
1 changed files with 3 additions and 2 deletions
  1. 3 2
      panda/src/pgraph/shaderAttrib.cxx

+ 3 - 2
panda/src/pgraph/shaderAttrib.cxx

@@ -501,7 +501,8 @@ get_shader_input_matrix(const InternalName *id, LMatrix4 &matrix) const {
       nassertr(!np.is_empty(), LMatrix4::ident_mat());
       return np.get_transform()->get_mat();
 
-    } else if (p->get_value_type() == ShaderInput::M_numeric && p->get_ptr()._size == 16) {
+    } else if (p->get_value_type() == ShaderInput::M_numeric &&
+               p->get_ptr()._size >= 16 && (p->get_ptr()._size & 15) == 0) {
       const Shader::ShaderPtrData &ptr = p->get_ptr();
 
       switch (ptr._type) {
@@ -527,7 +528,7 @@ get_shader_input_matrix(const InternalName *id, LMatrix4 &matrix) const {
     }
 
     ostringstream strm;
-    strm << "Shader input " << id->get_name() << " is not a NodePath or LMatrix4.\n";
+    strm << "Shader input " << id->get_name() << " is not a NodePath, LMatrix4 or PTA_LMatrix4.\n";
     nassert_raise(strm.str());
     return LMatrix4::ident_mat();
   }