Skip to content

Commit 5aa8618

Browse files
committed
Don't error if passing an oversized matrix array to a mat4[1] shader parameter
1 parent 637767f commit 5aa8618

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

panda/src/pgraph/shaderAttrib.cxx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -501,7 +501,8 @@ get_shader_input_matrix(const InternalName *id, LMatrix4 &matrix) const {
501501
nassertr(!np.is_empty(), LMatrix4::ident_mat());
502502
return np.get_transform()->get_mat();
503503

504-
} else if (p->get_value_type() == ShaderInput::M_numeric && p->get_ptr()._size == 16) {
504+
} else if (p->get_value_type() == ShaderInput::M_numeric &&
505+
p->get_ptr()._size >= 16 && (p->get_ptr()._size & 15) == 0) {
505506
const Shader::ShaderPtrData &ptr = p->get_ptr();
506507

507508
switch (ptr._type) {
@@ -527,7 +528,7 @@ get_shader_input_matrix(const InternalName *id, LMatrix4 &matrix) const {
527528
}
528529

529530
ostringstream strm;
530-
strm << "Shader input " << id->get_name() << " is not a NodePath or LMatrix4.\n";
531+
strm << "Shader input " << id->get_name() << " is not a NodePath, LMatrix4 or PTA_LMatrix4.\n";
531532
nassert_raise(strm.str());
532533
return LMatrix4::ident_mat();
533534
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy