Skip to content

Commit 8c1f64e

Browse files
committed
Fix for 1.9: fix errors when Cg-style matrix inputs are mat3
1 parent 5832ab8 commit 8c1f64e

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

doc/ReleaseNotes

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ This issue fixes several bugs that were still found in 1.9.2.
4747
* Fix compilation errors with Bullet 2.84
4848
* Fix exception when trying to pickle NodePathCollection objects
4949
* Fix error when trying to raise vectors to a power
50+
* GLSL: fix error when legacy matrix generator inputs are mat3
5051

5152
------------------------ RELEASE 1.9.2 ------------------------
5253

panda/src/glstuff/glShaderContext_src.cxx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ TypeHandle CLP(ShaderContext)::_type_handle;
5151
// actually picked up and the appropriate ShaderMatSpec pushed onto _mat_spec.
5252
////////////////////////////////////////////////////////////////////
5353
bool CLP(ShaderContext)::
54-
parse_and_set_short_hand_shader_vars(Shader::ShaderArgId &arg_id, Shader *objShader) {
54+
parse_and_set_short_hand_shader_vars(Shader::ShaderArgId &arg_id, GLenum param_type, Shader *objShader) {
5555
Shader::ShaderArgInfo p;
5656
p._id = arg_id;
5757
p._cat = GLCAT;
@@ -167,6 +167,14 @@ parse_and_set_short_hand_shader_vars(Shader::ShaderArgId &arg_id, Shader *objSha
167167
else if (pieces[0] == "col2") bind._piece = Shader::SMP_col2;
168168
else if (pieces[0] == "col3") bind._piece = Shader::SMP_col3;
169169

170+
if (param_type == GL_FLOAT_MAT3) {
171+
if (bind._piece == Shader::SMP_whole) {
172+
bind._piece = Shader::SMP_upper3x3;
173+
} else if (bind._piece == Shader::SMP_transpose) {
174+
bind._piece = Shader::SMP_transpose3x3;
175+
}
176+
}
177+
170178
if (!objShader->cp_parse_coord_sys(p, pieces, next, bind, true)) {
171179
return false;
172180
}
@@ -614,7 +622,7 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext
614622
}
615623

616624
//Tries to parse shorthand notations like mspos_XXX and trans_model_to_clip_of_XXX
617-
if (parse_and_set_short_hand_shader_vars(arg_id, s)) {
625+
if (parse_and_set_short_hand_shader_vars(arg_id, param_type, s)) {
618626
continue;
619627
}
620628

panda/src/glstuff/glShaderContext_src.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ class EXPCL_GL CLP(ShaderContext) : public ShaderContext {
8787
void glsl_report_program_errors(GLuint program, bool fatal);
8888
bool glsl_compile_shader(Shader::ShaderType type);
8989
bool glsl_compile_and_link();
90-
bool parse_and_set_short_hand_shader_vars(Shader::ShaderArgId &arg_id, Shader *s);
90+
bool parse_and_set_short_hand_shader_vars(Shader::ShaderArgId &arg_id, GLenum param_type, Shader *s);
9191
void release_resources();
9292

9393
public:

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