Commit Graph

12191 Commits

Author SHA1 Message Date
rdb b337f2a3da pipeline: Use a high-precision timer for Thread::sleep() on Win32
This is mainly used for clock mode M_limited, which is currently suffering from terrible imprecision on Windows.  This fixes that, making it possible to lower the value of sleep-precision down to 1ms.
2024-09-16 21:43:42 +02:00
rdb bb5e4454fe putil: Add debug for oversleeping/undersleeping with M_limited clock 2024-09-16 21:41:52 +02:00
John C. Allwein e3f580763a
pview: add shift+r keyboard bind to reload all textures (#1678) 2024-09-16 16:02:45 +02:00
rdb f5401b19fa Merge branch 'release/1.10.x' 2024-09-16 13:54:22 +02:00
rdb e2fb2d1241 cocoa: Prevent eating keyUp when switching to FS from macOS' FS 2024-09-16 13:39:16 +02:00
rdb c7bcec1ff5 cocoa: Exit macOS' fullscreen mode when switching fullscreen
Prevents black screen when switching to fullscreen
2024-09-16 13:39:16 +02:00
rdb 82b9a1266c cocoa: Fix error when switching to FS while macOS' FS is active 2024-09-16 13:39:16 +02:00
John C. Allwein e7604cb163 event: fix result refcount leak when awaiting AsyncFuture
Raising the StopIteration exception left the underlying
result with an elevated refcount which prevented it from
being cleaned up.
2024-09-14 15:59:05 -06:00
John C. Allwein cfe3885c0e
event: use the persistent python wrapper when appending task object (#1681) 2024-09-14 20:25:08 +02:00
rdb fc394e4c59 glgsg: Pass in osg_FrameNumber input via ShaderMatSpec mechanism 2024-08-23 21:08:50 +02:00
rdb cd68287b6a shader: Get all aggregate shader inputs (eg. lights) in one go
This means that p3d_LightSource[n] will be fetched once off the LightAttrib, written to the matrix cache, and then indexed into by the various ShaderMatSpec. This should be significantly more efficient, but the main aim is to prepare for a new binding system in the new shader pipeline

User structs are still an exception as of now
2024-08-23 16:29:46 +02:00
rdb 99225dfaef shader: Unify ShaderPtrSpec and ShaderMatSpec mechanisms 2024-08-23 16:29:42 +02:00
rdb 99f4034701 shader: Don't store on ShaderMatSpec, use scratch matrix instead 2024-08-23 16:29:38 +02:00
rdb 2c5cebe7e0 display: Fix shader gen regression for more than 2 lights 2024-08-23 14:20:20 +02:00
rdb 76ffef38d1 display: Allow passing whole state into dispatch_compute()
This is mainly useful for unit testing
2024-08-23 12:34:57 +02:00
rdb babd3a070d display: Fix docstring formatting 2024-08-22 15:52:48 +02:00
rdb 9e87af9dd7 linmath: Fix compiler warning with gcc 14 2024-08-14 19:09:20 +02:00
rdb 8d1524b675 distort: Fix unprotected debug output 2024-08-14 19:09:08 +02:00
rdb 712300c9f1 Fix prebuilt bison cxx files includes to work with CMake build
Change makepanda to generate without the .yxx extension so that the include name is generated properly
2024-08-13 00:01:35 +02:00
rdb 4ca495d828 CMake: Add separate BUILD_TOOLS option to build binaries
This is separate from BUILD_PANDATOOL, which builds the pandatool tree
2024-08-12 16:39:20 +02:00
John C. Allwein 21b39da65d pythonTask: fix refcount leak of non-panda Future::done
A missing Py_DECREF on the future's "done" method
caused both the bound method and the underlying
self instance of the future to be leaked when
awaiting non-panda futures (such as _asyncio.Future).

This change includes a simple new test addition
to catch this in the future.
2024-08-08 21:51:03 -06:00
rdb 23124dac07 x11: Fix missing _net_wm_name field due to bad merge 2024-08-07 23:39:20 +02:00
rdb ad57762e9f Merge branch 'release/1.10.x' 2024-08-07 22:34:08 +02:00
rdb 8c8cbeea98 linmath: For repr, use as much precision as needed for roundtrip
Will use as few digits as is necessary to ensure that round-tripping the same number with pstrtod will result in the same vector.  This prevents eg. 3.3 formatting as 3.29999995 while still ensuring that two floats that are not equal (other than nan) are guaranteed to have a different string representation.

Uses a hacky pftoa function that can be abandoned as soon as we adopt C++17, which has to_chars that does what we need

Fixes #1671
2024-08-07 17:24:11 +02:00
rdb 122453811d glgsg: Fix clear of offscreen buffer if back buffers requested 2024-06-30 11:53:17 +02:00
rdb a655784d8d x11: attempt to fix UTF-8 window titles (see #209) 2024-05-16 20:30:27 +02:00
rdb adb9242885 glgsg: Fix faulty auto-merge 2024-05-14 23:19:46 +02:00
rdb b6515c881c Merge branch 'release/1.10.x' 2024-05-14 22:47:08 +02:00
rdb 2436a06527 glgsg: Better error when invalid ShaderPtrSpec type is encountered 2024-05-14 22:45:01 +02:00
Wizzerinus 3ffcce2cc2 add getPlayMode() for actor and anim interface 2024-05-14 11:06:06 +02:00
Disyer a9206041d9 ffmpeg: Use ch_layout in favor of removed channel_layout and channels
Closes #1641
2024-04-08 13:32:51 +02:00
rdb 5da013e2e9 text: Properly handle surrogate pairs in text on Windows
Fixes #1629
2024-04-08 12:12:00 +02:00
rdb 2adc167f26 windisplay: Fix regression related to fullscreen switching
Fixes #1594
2024-04-08 11:29:43 +02:00
rdb e5bd00f91f task: Implement garbage collector support for PythonTask
This adds persistent wrapper support (introduced by the previous commit) to PythonTask, which makes it possible for reference cycles involving tasks to be found and destroyed.

The major caveat is that it always creates a reference cycle.  This can be broken automatically if there is no more Python reference to it by the time the last C++ reference is dropped, but the other way around requires the garbage collector.

For tasks, I think this it is generally the case that the last reference is in C++, since tasks are usually created and then handed off to the C++ task manager, and for applications that don't want to rely on the GC, it is easy to work around.  If this turns out to be a problem, though, we can add a special garbage collection pass to the task manager.
2024-03-29 20:51:45 +01:00
rdb 38692dd525 interrogate: Support subclassing C++ objects from Python
This change enables persistent Python wrapper objects for Python subclasses of typed, reference counted C++ objects.  That means that these objects will store a reference to `self` on the C++ object, and interrogate will always return that instead of making a new Python wrapper every time it is returned from C++.

Practically, this means that you could subclass eg. PandaNode, Event, Fog, what have you, and store these in the scene graph - the Python data in the subclass will be retained and Panda will return your subclass when you ask for the object back rather than creating a new wrapper object without your original data.

To do this, Interrogate generates a proxy class inheriting from the C++ type with additional room to store a `self` pointer and a TypeHandle (which is returned by an overridden `get_type()`).  This TypeHandle is automatically created by registering the Python subclass with the typing system.  The proxy class is only used when the constructor detects that it's constructing for a subtype, so that regular uses of the C++ type are not affected by this mechanism.

(The registration with the typing system could use some improvement.  There's no regard for namespacing right now, in particular.  Furthermore, we could move the registration to an `__init_subclass__()` method, with parameters to specify an existing TypeHandle or to customize the type name.)

This creates a reference cycle, which must be cleared somehow.  One way this happens is by overriding `unref()` in the proxy, which checks that if the Python and C++ reference counts are both 1, this must be the circular reference, and then it breaks the cycle.  Note that this will _only_ work if all other Python references have been cleared before the last C++ reference goes away.  For the other case, we need to rely on Python's garbage collector, so these classes also implement tp_traverse and tp_clear.

This commit also therefore re-enables Python garbage collector support (ie. defining `__traverse__()`), which was previously disabled due to the problems caused by multiple Python wrappers referring to the same C++ object.  To avoid these problems, Panda will only cooperate with Python's GC if the C++ reference count is 1, in which case we can trivially prove that the last reference must be from the Python wrapper.  Note that this explains why we need persistent wrappers for traversal to work--if there are multiple Python wrappers pointing to the C++ object, and they are all participating in a reference cycle, the reference count cannot be 1, and cycle detection does not work.  By default, the GC is only enabled for Python subclasses, but a class may define `__traverse__()` in order to opt-in, keeping the previous limitation in mind.

There is a second mechanism introduced by this commit: classes may define a public `__self__` member of type `PyObject *` if they want to use persistent objects even if they aren't being subclassed.  This allows these classes to participate in Python's GC and avoid the situation above.

The cycle detection is implemented for PandaNode's Python tags, but this is very incomplete, since the traversal doesn't recurse into children and it won't work if there is more than one wrapper object that is part of a cycle, since PandaNode by default doesn't use persistent wrappers.  This problem may need more attention later.

Fixes #1410
2024-03-29 20:51:34 +01:00
rdb 33cef0aca3 pgraph: Disable non-working `__traverse__()` on NodePath 2024-03-29 17:15:43 +01:00
rdb 1213d95560 Merge branch 'release/1.10.x' 2024-03-28 01:17:52 +01:00
rdb 0e2a706ec8 audio: Fix changing sound time not working on macOS
Fixes #1607
2024-03-27 12:02:12 +01:00
rdb 237d27dfd9 text: Error instead of crash when glyph does not fit into page
Fixes #1626
2024-03-27 10:59:52 +01:00
rdb 8ea2301d16 pgui: Fix PGEntry::get_cursor_Y()
It returned the Y position, which is always 0.0, instead of the Z position.

Fixes #1633
2024-03-27 10:22:54 +01:00
rdb 06e72b5d7d text: Add docstring for `set_text_color()`
Fixes #1621
2024-03-27 10:06:39 +01:00
rdb 6f6cbf318e Merge branch 'release/1.10.x' 2024-03-26 17:08:52 +01:00
rdb 655aa49d81 putil: Remove outdated TypedWritable template files
See #1630
2024-03-18 02:39:51 +01:00
rdb 40b824bdcc general: Consistently name all bam factory functions make_from_bam
See discussion in #1630
2024-03-18 02:38:41 +01:00
rdb d4a3b9bfcd glgsg: Fix docstring typo 2024-03-15 12:47:21 +01:00
rdb f7cca55e14 pnmimagetypes: Fix double return statement in bmp.h
Fixes #1628

[skip ci]
2024-03-12 17:28:05 +01:00
rdb af27a9523c Merge branch 'release/1.10.x' 2024-03-12 15:39:16 +01:00
rdb c4adc17d55 display: Fix assorted unreachable code warnings 2024-03-12 15:30:32 +01:00
rdb bfe1c95d29 pgraph: Python wrappers for TransformState getters no longer return reference to temporary
Fixes #1625
2024-03-12 15:29:54 +01:00
rdb 92db1840f9 net: Prepare to split these classes out into panda3d.net module
See #1466 - these classes are still part of panda3d.core as of 1.11, but they should really be imported from panda3d.net (they can be imported from either place in 1.11).  A future release will remove them from panda3d.core entirely.
2024-03-02 13:41:23 +01:00