From 0300ac8d3b2aebb8f75465cc237436c86917d67f Mon Sep 17 00:00:00 2001 From: rdb Date: Wed, 22 Jan 2020 15:43:26 +0100 Subject: [PATCH 1/3] glgsg: hack fix for p3d_TextureMatrix[] error on macOS (#846) --- panda/src/glstuff/glShaderContext_src.cxx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index 618b228754..9dd82c1cdf 100644 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -890,7 +890,17 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) { // Add it once for each index. for (bind._index = 0; bind._index < param_size; ++bind._index) { + // It was discovered in #846, that GLSL 4.10 and lower don't seem to + // guarantee that matrices occupy successive locations, and on macOS + // they indeed occupy four locations per element. + // As a big fat hack, we multiply by four on macOS, because this is + // hard to fix on the 1.10 branch. We'll have a proper fix on the + // master branch. +#ifdef __APPLE__ + bind._id._seqno = p + bind._index * 4; +#else bind._id._seqno = p + bind._index; +#endif _shader->_mat_spec.push_back(bind); } _shader->_mat_deps |= bind._dep[0]; From dbb65549ea3659070574a66becdb999539663099 Mon Sep 17 00:00:00 2001 From: CYBERDEViLNL Date: Mon, 27 Jan 2020 23:36:45 +0000 Subject: [PATCH 2/3] bullet: Fix BulletHeightfieldShape::fillin Closes #860 --- panda/src/bullet/bulletHeightfieldShape.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/bullet/bulletHeightfieldShape.cxx b/panda/src/bullet/bulletHeightfieldShape.cxx index 08f91bd036..55ed86d16e 100644 --- a/panda/src/bullet/bulletHeightfieldShape.cxx +++ b/panda/src/bullet/bulletHeightfieldShape.cxx @@ -200,7 +200,7 @@ fillin(DatagramIterator &scan, BamReader *manager) { size_t size = (size_t)_num_rows * (size_t)_num_cols; delete [] _data; - _data = new float[size]; + _data = new btScalar[size]; for (size_t i = 0; i < size; ++i) { _data[i] = scan.get_stdfloat(); From e13e9851f260ecf5d9b4402f21a577b2c340c5aa Mon Sep 17 00:00:00 2001 From: rdb Date: Fri, 31 Jan 2020 11:01:44 +0100 Subject: [PATCH 3/3] shader: //Cg profile should only affect the current shader Fixes #863 --- panda/src/gobj/shader.cxx | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/panda/src/gobj/shader.cxx b/panda/src/gobj/shader.cxx index a60a7e169b..ee26438d4c 100644 --- a/panda/src/gobj/shader.cxx +++ b/panda/src/gobj/shader.cxx @@ -2461,9 +2461,10 @@ read(const ShaderFile &sfile, BamCacheRecord *record) { // Determine which language the shader is written in. if (_language == SL_Cg) { #ifdef HAVE_CG - cg_get_profile_from_header(_default_caps); + ShaderCaps caps = _default_caps; + cg_get_profile_from_header(caps); - if (!cg_analyze_shader(_default_caps)) { + if (!cg_analyze_shader(caps)) { shader_cat.error() << "Shader encountered an error.\n"; return false; @@ -2551,9 +2552,10 @@ load(const ShaderFile &sbody, BamCacheRecord *record) { // Determine which language the shader is written in. if (_language == SL_Cg) { #ifdef HAVE_CG - cg_get_profile_from_header(_default_caps); + ShaderCaps caps = _default_caps; + cg_get_profile_from_header(caps); - if (!cg_analyze_shader(_default_caps)) { + if (!cg_analyze_shader(caps)) { shader_cat.error() << "Shader encountered an error.\n"; return false;