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(); diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index df510abf69..eb9c534b44 100644 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -888,7 +888,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->cp_add_mat_spec(bind); } return; diff --git a/panda/src/gobj/shader.cxx b/panda/src/gobj/shader.cxx index a4b6881518..a1067e9c9e 100644 --- a/panda/src/gobj/shader.cxx +++ b/panda/src/gobj/shader.cxx @@ -2514,9 +2514,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; @@ -2606,9 +2607,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;