Fix for 1.9: fix errors when Cg-style matrix inputs are mat3

This commit is contained in:
rdb 2016-11-14 19:40:46 +01:00
parent 5832ab8099
commit 8c1f64e086
3 changed files with 12 additions and 3 deletions

View File

@ -47,6 +47,7 @@ This issue fixes several bugs that were still found in 1.9.2.
* Fix compilation errors with Bullet 2.84
* Fix exception when trying to pickle NodePathCollection objects
* Fix error when trying to raise vectors to a power
* GLSL: fix error when legacy matrix generator inputs are mat3
------------------------ RELEASE 1.9.2 ------------------------

View File

@ -51,7 +51,7 @@ TypeHandle CLP(ShaderContext)::_type_handle;
// actually picked up and the appropriate ShaderMatSpec pushed onto _mat_spec.
////////////////////////////////////////////////////////////////////
bool CLP(ShaderContext)::
parse_and_set_short_hand_shader_vars(Shader::ShaderArgId &arg_id, Shader *objShader) {
parse_and_set_short_hand_shader_vars(Shader::ShaderArgId &arg_id, GLenum param_type, Shader *objShader) {
Shader::ShaderArgInfo p;
p._id = arg_id;
p._cat = GLCAT;
@ -167,6 +167,14 @@ parse_and_set_short_hand_shader_vars(Shader::ShaderArgId &arg_id, Shader *objSha
else if (pieces[0] == "col2") bind._piece = Shader::SMP_col2;
else if (pieces[0] == "col3") bind._piece = Shader::SMP_col3;
if (param_type == GL_FLOAT_MAT3) {
if (bind._piece == Shader::SMP_whole) {
bind._piece = Shader::SMP_upper3x3;
} else if (bind._piece == Shader::SMP_transpose) {
bind._piece = Shader::SMP_transpose3x3;
}
}
if (!objShader->cp_parse_coord_sys(p, pieces, next, bind, true)) {
return false;
}
@ -614,7 +622,7 @@ CLP(ShaderContext)(CLP(GraphicsStateGuardian) *glgsg, Shader *s) : ShaderContext
}
//Tries to parse shorthand notations like mspos_XXX and trans_model_to_clip_of_XXX
if (parse_and_set_short_hand_shader_vars(arg_id, s)) {
if (parse_and_set_short_hand_shader_vars(arg_id, param_type, s)) {
continue;
}

View File

@ -87,7 +87,7 @@ private:
void glsl_report_program_errors(GLuint program, bool fatal);
bool glsl_compile_shader(Shader::ShaderType type);
bool glsl_compile_and_link();
bool parse_and_set_short_hand_shader_vars(Shader::ShaderArgId &arg_id, Shader *s);
bool parse_and_set_short_hand_shader_vars(Shader::ShaderArgId &arg_id, GLenum param_type, Shader *s);
void release_resources();
public: