From 8c1f64e086e3dd12be80a97b2e35ce3cffbff6d2 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 14 Nov 2016 19:40:46 +0100 Subject: [PATCH 1/3] Fix for 1.9: fix errors when Cg-style matrix inputs are mat3 --- doc/ReleaseNotes | 1 + panda/src/glstuff/glShaderContext_src.cxx | 12 ++++++++++-- panda/src/glstuff/glShaderContext_src.h | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/ReleaseNotes b/doc/ReleaseNotes index 157a20b2bf..b7462a97d6 100644 --- a/doc/ReleaseNotes +++ b/doc/ReleaseNotes @@ -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 ------------------------ diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index df8ea97655..5ce322bfac 100644 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -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; } diff --git a/panda/src/glstuff/glShaderContext_src.h b/panda/src/glstuff/glShaderContext_src.h index 62d54ed675..51376e44f4 100644 --- a/panda/src/glstuff/glShaderContext_src.h +++ b/panda/src/glstuff/glShaderContext_src.h @@ -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: From cf389276da45f564c9fcd6b0d8886096fa39d759 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 27 Nov 2016 13:04:54 +0100 Subject: [PATCH 2/3] Backport b02e352 to 1.9: rdb: Fix wrong GL texture being bound to image slot after being recreated --- panda/src/glstuff/glShaderContext_src.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index 5ce322bfac..6c68aeb4a6 100644 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -1684,8 +1684,8 @@ update_shader_texture_bindings(ShaderContext *prev) { if (gtc != (TextureContext*)NULL) { _glsl_img_textures[i] = gtc; - gl_tex = gtc->_index; _glgsg->update_texture(gtc, true); + gl_tex = gtc->_index; if (gtc->needs_barrier(GL_SHADER_IMAGE_ACCESS_BARRIER_BIT)) { barriers |= GL_SHADER_IMAGE_ACCESS_BARRIER_BIT; From 80af51477a8c03df06f1f16a848866613045f7e3 Mon Sep 17 00:00:00 2001 From: rdb Date: Tue, 29 Nov 2016 22:59:51 +0100 Subject: [PATCH 3/3] Backport ability to create a pdb zipfile to 1.9 --- makepanda/makepanda.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 17778946f2..4adcb96d5e 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -6459,6 +6459,26 @@ def MakeInstallerNSIS(file, title, installdir): oscmd(cmd) os.rename("nsis-output.exe", file) +def MakeDebugSymbolArchive(zipname, dirname): + import zipfile + zip = zipfile.ZipFile(zipname, 'w', zipfile.ZIP_DEFLATED) + + for fn in glob.glob(os.path.join(GetOutputDir(), 'bin', '*.pdb')): + zip.write(fn, dirname + '/bin/' + os.path.basename(fn)) + + for fn in glob.glob(os.path.join(GetOutputDir(), 'panda3d', '*.pdb')): + zip.write(fn, dirname + '/panda3d/' + os.path.basename(fn)) + + for fn in glob.glob(os.path.join(GetOutputDir(), 'plugins', '*.pdb')): + zip.write(fn, dirname + '/plugins/' + os.path.basename(fn)) + + for fn in glob.glob(os.path.join(GetOutputDir(), 'python', '*.pdb')): + zip.write(fn, dirname + '/python/' + os.path.basename(fn)) + + for fn in glob.glob(os.path.join(GetOutputDir(), 'python', 'DLLs', '*.pdb')): + zip.write(fn, dirname + '/python/DLLs/' + os.path.basename(fn)) + + zip.close() INSTALLER_DEB_FILE=""" Package: panda3dMAJOR @@ -7012,11 +7032,13 @@ try: MakeInstallerNSIS("Panda3D-Runtime-"+VERSION+dbg+"-x64.exe", "Panda3D "+VERSION, "C:\\Panda3D-"+VERSION+"-x64") else: MakeInstallerNSIS("Panda3D-"+VERSION+dbg+"-x64.exe", "Panda3D SDK "+VERSION, "C:\\Panda3D-"+VERSION+"-x64") + MakeDebugSymbolArchive("Panda3D-"+VERSION+dbg+"-x64-pdb.zip", "Panda3D-"+VERSION+"-x64") else: if (RUNTIME): MakeInstallerNSIS("Panda3D-Runtime-"+VERSION+dbg+".exe", "Panda3D "+VERSION, "C:\\Panda3D-"+VERSION) else: MakeInstallerNSIS("Panda3D-"+VERSION+dbg+".exe", "Panda3D SDK "+VERSION, "C:\\Panda3D-"+VERSION) + MakeDebugSymbolArchive("Panda3D-"+VERSION+dbg+"-pdb.zip", "Panda3D-"+VERSION) elif (target == 'linux'): MakeInstallerLinux() elif (target == 'darwin'):