From edf4b7d448627a311f69418c4ead8a9acb432c43 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 22 Oct 2023 12:23:53 +0200 Subject: [PATCH 01/11] tests: Also skip Cg unit tests on arm64 reporting as aarch64 [skip ci] --- tests/display/test_cg_shader.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/display/test_cg_shader.py b/tests/display/test_cg_shader.py index 2597b39971..d118f08637 100644 --- a/tests/display/test_cg_shader.py +++ b/tests/display/test_cg_shader.py @@ -18,14 +18,14 @@ def run_cg_compile_check(gsg, shader_path, expect_fail=False): assert shader is not None -@pytest.mark.skipif(platform.machine().lower() == 'arm64', reason="Cg not supported on arm64") +@pytest.mark.skipif(platform.machine().lower() in ('arm64', 'aarch64'), reason="Cg not supported on arm64") def test_cg_compile_error(gsg): """Test getting compile errors from bad Cg shaders""" shader_path = core.Filename(SHADERS_DIR, 'cg_bad.sha') run_cg_compile_check(gsg, shader_path, expect_fail=True) -@pytest.mark.skipif(platform.machine().lower() == 'arm64', reason="Cg not supported on arm64") +@pytest.mark.skipif(platform.machine().lower() in ('arm64', 'aarch64'), reason="Cg not supported on arm64") def test_cg_from_file(gsg): """Test compiling Cg shaders from files""" shader_path = core.Filename(SHADERS_DIR, 'cg_simple.sha') From f9a86bced64c711a9b4ab1da7d608a2d6a58b261 Mon Sep 17 00:00:00 2001 From: git2323 <44967298+git2323@users.noreply.github.com> Date: Sat, 18 Nov 2023 11:49:53 +0100 Subject: [PATCH 02/11] device: fix small typo, fixes 1571 (#1572) --- panda/src/device/inputDeviceNode.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/panda/src/device/inputDeviceNode.cxx b/panda/src/device/inputDeviceNode.cxx index b5e749b2d6..286dd93c08 100644 --- a/panda/src/device/inputDeviceNode.cxx +++ b/panda/src/device/inputDeviceNode.cxx @@ -69,7 +69,7 @@ do_transmit_data(DataGraphTraverser *, const DataNodeTransmit &, const ButtonEvent &event = bel->get_event(i); if (event._type == ButtonEvent::T_down) { _button_states[event._button] = true; - } else if (event._type == ButtonEvent::T_down) { + } else if (event._type == ButtonEvent::T_up) { _button_states[event._button] = false; } } From 3097d2637c277c8a94662e394aaea1b813c12cca Mon Sep 17 00:00:00 2001 From: Dakota Smith Date: Sat, 18 Nov 2023 16:37:34 -0500 Subject: [PATCH 03/11] bullet: Fix deadlock when contact added callback accesses certain data or executes bullet methods --- panda/src/bullet/bulletContactCallbacks.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/panda/src/bullet/bulletContactCallbacks.h b/panda/src/bullet/bulletContactCallbacks.h index b2027ddff6..d82d277074 100644 --- a/panda/src/bullet/bulletContactCallbacks.h +++ b/panda/src/bullet/bulletContactCallbacks.h @@ -88,7 +88,12 @@ contact_added_callback(btManifoldPoint &cp, BulletManifoldPoint mp(cp); BulletContactCallbackData cbdata(mp, node0, node1, id0, id1, index0, index1); + // Release the world mutex object so that bullet methods can be called from the callback. + LightMutex &mutex = BulletWorld::get_global_lock(); + + mutex.release(); bullet_contact_added_callback->do_callback(&cbdata); + mutex.acquire(); } } From 89701270dd160a8a4cdced98526320175514f8b4 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 9 Dec 2023 21:06:44 +0100 Subject: [PATCH 04/11] gles2gsg: Fix image load/store support in OpenGL ES 3.1 This does require gl-immutable-texture-storage to be on, so it is not enabled by default unless that variable is set. That is not a breaking change since before this change, support was never enabled to begin with --- .../glstuff/glGraphicsStateGuardian_src.cxx | 2 +- panda/src/glstuff/glShaderContext_src.cxx | 44 +++++++++++++++++-- panda/src/glstuff/glShaderContext_src.h | 4 +- 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index 0a8b769bf6..e6217ed4c9 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -3098,7 +3098,7 @@ reset() { _max_image_units = 0; #ifndef OPENGLES_1 #ifdef OPENGLES - if (is_at_least_gl_version(3, 1)) { + if (is_at_least_gles_version(3, 1) && gl_immutable_texture_storage) { #else if (is_at_least_gl_version(4, 2) || has_extension("GL_ARB_shader_image_load_store")) { #endif diff --git a/panda/src/glstuff/glShaderContext_src.cxx b/panda/src/glstuff/glShaderContext_src.cxx index aa6af13edf..f3c9a106c7 100644 --- a/panda/src/glstuff/glShaderContext_src.cxx +++ b/panda/src/glstuff/glShaderContext_src.cxx @@ -1744,13 +1744,35 @@ reflect_uniform(int i, char *name_buffer, GLsizei name_buflen) { #endif // This won't really change at runtime, so we might as well bind once // and then forget about it. - _glgsg->_glUniform1i(p, _glsl_img_inputs.size()); { +#ifdef OPENGLES + // In OpenGL ES, we can't choose our own binding, but we can ask the + // driver what it assigned (or what the shader specified). + GLint binding = 0; + glGetUniformiv(_glsl_program, p, &binding); + if (GLCAT.is_debug()) { + GLCAT.debug() + << "Active uniform " << param_name + << " is bound to image unit " << binding << "\n"; + } + + if (binding >= _glsl_img_inputs.size()) { + _glsl_img_inputs.resize(binding + 1); + } + + ImageInput &input = _glsl_img_inputs[binding]; + input._name = InternalName::make(param_name); +#else + if (GLCAT.is_debug()) { + GLCAT.debug() + << "Binding image uniform " << param_name + << " to image unit " << _glsl_img_inputs.size() << "\n"; + } + _glgsg->_glUniform1i(p, _glsl_img_inputs.size()); ImageInput input; input._name = InternalName::make(param_name); - input._writable = false; - input._gtc = nullptr; - _glsl_img_inputs.push_back(input); + _glsl_img_inputs.push_back(std::move(input)); +#endif } return; default: @@ -2749,6 +2771,10 @@ update_shader_texture_bindings(ShaderContext *prev) { const ParamTextureImage *param = nullptr; Texture *tex; + if (input._name == nullptr) { + continue; + } + const ShaderInput &sinp = _glgsg->_target_shader->get_shader_input(input._name); switch (sinp.get_value_type()) { case ShaderInput::M_texture_image: @@ -2800,6 +2826,16 @@ update_shader_texture_bindings(ShaderContext *prev) { // TODO: automatically convert to sized type instead of plain GL_RGBA // If a base type is used, it will crash. GLenum internal_format = gtc->_internal_format; +#ifdef OPENGLES + if (!gtc->_immutable) { + static bool error_shown = false; + if (!error_shown) { + error_shown = true; + GLCAT.error() + << "Enable gl-immutable-texture-storage to use image textures in OpenGL ES.\n"; + } + } +#endif if (internal_format == GL_RGBA || internal_format == GL_RGB) { GLCAT.error() << "Texture " << tex->get_name() << " has an unsized format. Textures bound " diff --git a/panda/src/glstuff/glShaderContext_src.h b/panda/src/glstuff/glShaderContext_src.h index 0ccb99fe90..52c9f6f853 100644 --- a/panda/src/glstuff/glShaderContext_src.h +++ b/panda/src/glstuff/glShaderContext_src.h @@ -109,8 +109,8 @@ private: struct ImageInput { CPT(InternalName) _name; - CLP(TextureContext) *_gtc; - bool _writable; + CLP(TextureContext) *_gtc = nullptr; + bool _writable = false; }; pvector _glsl_img_inputs; From 0cc3f8fbf666be5a1f612f3c8f696dc61fdb73c0 Mon Sep 17 00:00:00 2001 From: rdb Date: Sat, 9 Dec 2023 23:52:52 +0100 Subject: [PATCH 05/11] dist: Fix error when using bam_model_extensions with bdist_apps --- direct/src/dist/commands.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/direct/src/dist/commands.py b/direct/src/dist/commands.py index e402b3c016..9cc7ce455f 100644 --- a/direct/src/dist/commands.py +++ b/direct/src/dist/commands.py @@ -457,8 +457,10 @@ class build_apps(setuptools.Command): if self.bam_model_extensions: for ext in self.bam_model_extensions: ext = '.' + ext.lstrip('.') - assert ext not in self.file_handlers, \ - 'Extension {} occurs in both file_handlers and bam_model_extensions!'.format(ext) + handler = self.file_handlers.get(ext) + if handler != _model_to_bam: + assert handler is None, \ + 'Extension {} occurs in both file_handlers and bam_model_extensions!'.format(ext) self.file_handlers[ext] = _model_to_bam tmp = self.default_file_handlers.copy() From 4f37d97cf6cf0814ad3e17e13122f14e3962656d Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 10 Dec 2023 13:18:23 +0100 Subject: [PATCH 06/11] glgsg: Show internal format in debug output --- panda/src/glstuff/glGraphicsStateGuardian_src.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index e6217ed4c9..1d92309a65 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -13287,7 +13287,8 @@ upload_texture(CLP(TextureContext) *gtc, bool force, bool uses_mipmaps) { GLCAT.debug() << "allocating storage for texture " << tex->get_name() << ", " << width << " x " << height << " x " << depth << ", mipmaps " << num_levels - << ", uses_mipmaps = " << uses_mipmaps << "\n"; + << ", uses_mipmaps = " << uses_mipmaps << ", internal_format = 0x" + << std::hex << internal_format << std::dec << "\n"; } switch (texture_type) { From be958c409f452108e49de7e30220ec5d50aaed62 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 10 Dec 2023 13:18:47 +0100 Subject: [PATCH 07/11] recorder: Fix error reading multiple recorders from .bam file Modified version of #1564 without changing ABI Fixes #1561 --- panda/src/recorder/mouseRecorder.cxx | 6 ++---- panda/src/recorder/socketStreamRecorder.cxx | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/panda/src/recorder/mouseRecorder.cxx b/panda/src/recorder/mouseRecorder.cxx index 37a5a2a440..a851d26125 100644 --- a/panda/src/recorder/mouseRecorder.cxx +++ b/panda/src/recorder/mouseRecorder.cxx @@ -228,11 +228,9 @@ make_from_bam(const FactoryParams ¶ms) { RecorderBase *MouseRecorder:: make_recorder(const FactoryParams ¶ms) { MouseRecorder *node = new MouseRecorder(""); - DatagramIterator scan; - BamReader *manager; + BamReaderParam *param = DCAST(BamReaderParam, params.get_param(0)); - parse_params(params, scan, manager); - node->fillin_recorder(scan, manager); + node->fillin_recorder((DatagramIterator &)param->get_iterator(), param->get_manager()); return node; } diff --git a/panda/src/recorder/socketStreamRecorder.cxx b/panda/src/recorder/socketStreamRecorder.cxx index 8418485b20..6499805e4d 100644 --- a/panda/src/recorder/socketStreamRecorder.cxx +++ b/panda/src/recorder/socketStreamRecorder.cxx @@ -113,11 +113,9 @@ write_recorder(BamWriter *manager, Datagram &dg) { RecorderBase *SocketStreamRecorder:: make_recorder(const FactoryParams ¶ms) { SocketStreamRecorder *node = new SocketStreamRecorder; - DatagramIterator scan; - BamReader *manager; + BamReaderParam *param = DCAST(BamReaderParam, params.get_param(0)); - parse_params(params, scan, manager); - node->fillin_recorder(scan, manager); + node->fillin_recorder((DatagramIterator &)param->get_iterator(), param->get_manager()); return node; } From 1c4a91858b528746c602df434c96754f26a55598 Mon Sep 17 00:00:00 2001 From: "Ian Eborn (Thaumaturge)" <36933600+ArsThaumaturgis@users.noreply.github.com> Date: Tue, 14 Nov 2023 14:34:28 +0200 Subject: [PATCH 08/11] grutil: Change docstring for MeshDrawer link_segment method In short, this adds notes regarding the manner in which the method makes use of the "frame" and "color" parameters. Fixes #1560 Closes #1569 --- panda/src/grutil/meshDrawer.cxx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/panda/src/grutil/meshDrawer.cxx b/panda/src/grutil/meshDrawer.cxx index b87380d3b8..b52a1249cd 100644 --- a/panda/src/grutil/meshDrawer.cxx +++ b/panda/src/grutil/meshDrawer.cxx @@ -416,6 +416,11 @@ void MeshDrawer::geometry(NodePath draw_node) { /** * Stars or continues linked segment. Control position, frame, thickness and * color with parameters. Frame contains u,v,u-size,v-size quadruple. + * Note that for the first two calls to this method, the "frame" parameter is + * ignored; it first takes effect as of the third call. + * Similarly, note that in the second call to this method, the "color" parameter + * is ignored; it only has effect in the first call and calls from the third + * onwards. */ void MeshDrawer:: link_segment(const LVector3 &pos, const LVector4 &frame, From 7277199d6e671595c776c74f8704e3ab083899bb Mon Sep 17 00:00:00 2001 From: jb Date: Sun, 10 Dec 2023 13:24:31 +0100 Subject: [PATCH 09/11] windisplay: fix handling of invalid devices, replaced 0 with nullptr Fixes #1559 Closes #1563 --- panda/src/windisplay/winGraphicsWindow.cxx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/panda/src/windisplay/winGraphicsWindow.cxx b/panda/src/windisplay/winGraphicsWindow.cxx index 7878484a79..eea2a3a7e4 100644 --- a/panda/src/windisplay/winGraphicsWindow.cxx +++ b/panda/src/windisplay/winGraphicsWindow.cxx @@ -660,18 +660,18 @@ initialize_input_devices() { _input = device; // Get the number of devices. - if (GetRawInputDeviceList(nullptr, &nInputDevices, sizeof(RAWINPUTDEVICELIST)) != 0) { + if ((int)GetRawInputDeviceList(nullptr, &nInputDevices, sizeof(RAWINPUTDEVICELIST)) != 0) { return; } // Allocate the array to hold the DeviceList pRawInputDeviceList = (PRAWINPUTDEVICELIST)alloca(sizeof(RAWINPUTDEVICELIST) * nInputDevices); - if (pRawInputDeviceList==0) { + if (pRawInputDeviceList == nullptr) { return; } // Fill the Array - if (GetRawInputDeviceList(pRawInputDeviceList, &nInputDevices, sizeof(RAWINPUTDEVICELIST)) == -1) { + if ((int)GetRawInputDeviceList(pRawInputDeviceList, &nInputDevices, sizeof(RAWINPUTDEVICELIST)) == -1) { return; } @@ -680,13 +680,13 @@ initialize_input_devices() { if (pRawInputDeviceList[i].dwType == RIM_TYPEMOUSE) { // Fetch information about specified mouse device. UINT nSize; - if (GetRawInputDeviceInfoA(pRawInputDeviceList[i].hDevice, RIDI_DEVICENAME, (LPVOID)0, &nSize) != 0) { - return; + if ((int)GetRawInputDeviceInfoA(pRawInputDeviceList[i].hDevice, RIDI_DEVICENAME, (LPVOID)nullptr, &nSize) != 0) { + continue; } char *psName = (char*)alloca(sizeof(TCHAR) * nSize); - if (psName == 0) return; - if (GetRawInputDeviceInfoA(pRawInputDeviceList[i].hDevice, RIDI_DEVICENAME, (LPVOID)psName, &nSize) < 0) { - return; + if (psName == nullptr) continue; + if ((int)GetRawInputDeviceInfoA(pRawInputDeviceList[i].hDevice, RIDI_DEVICENAME, (LPVOID)psName, &nSize) < 0) { + continue; } // If it's not an RDP mouse, add it to the list of raw mice. From 25b85041d5982c4fad8bff75c998240b7df5e74c Mon Sep 17 00:00:00 2001 From: kamgha Date: Wed, 3 Jan 2024 04:30:48 +0100 Subject: [PATCH 10/11] egg-palettize: fix writing Magfilter Fixes a typo that applied the value from the Minfilter to the entry of the Magfilter. Closes #1585 --- pandatool/src/egg-palettize/txaFileFilter.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pandatool/src/egg-palettize/txaFileFilter.cxx b/pandatool/src/egg-palettize/txaFileFilter.cxx index f8c20cfb0c..ebbf6127c5 100644 --- a/pandatool/src/egg-palettize/txaFileFilter.cxx +++ b/pandatool/src/egg-palettize/txaFileFilter.cxx @@ -93,7 +93,7 @@ post_load(Texture *tex) { egg_tex->set_alpha_mode(tex_image.get_alpha_mode()); egg_tex->set_format(props._format); egg_tex->set_minfilter(props._minfilter); - egg_tex->set_minfilter(props._magfilter); + egg_tex->set_magfilter(props._magfilter); egg_tex->set_anisotropic_degree(props._anisotropic_degree); tex->set_aux_data("egg", egg_tex); From 6b3dfc7e16554a47be44084d0de422278aa3187f Mon Sep 17 00:00:00 2001 From: rdb Date: Thu, 4 Jan 2024 16:20:03 +0100 Subject: [PATCH 11/11] pgraph: add note to LensNode::is_in_view docstring about CS Closes panda3d/panda3d-docs#143 --- panda/src/pgraph/lensNode.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/panda/src/pgraph/lensNode.cxx b/panda/src/pgraph/lensNode.cxx index 1b428d9e98..ae90f61c4b 100644 --- a/panda/src/pgraph/lensNode.cxx +++ b/panda/src/pgraph/lensNode.cxx @@ -119,7 +119,8 @@ set_lens_active(int index, bool flag) { /** * Returns true if the given point is within the bounds of the lens of the - * LensNode (i.e. if the camera can see the point). + * LensNode (i.e. if the camera can see the point). The point is assumed to + * be relative to the LensNode itself. */ bool LensNode:: is_in_view(int index, const LPoint3 &pos) {