Commit Graph

11794 Commits

Author SHA1 Message Date
rdb dae147ec0c Merge branch 'release/1.10.x' 2022-03-02 10:51:23 +01:00
rdb 930e5da438 texture: Fix get_ram_image_as() with 3D and multiview textures
Fixes #1277
2022-03-02 10:42:45 +01:00
rdb 46c1b887ea Fix heap alignment with SSE2 on 32-bit Windows by inheriting MemoryBase
Fixes #510
2022-03-02 09:57:44 +01:00
rdb 370b635534 dtoolbase: Fix missing __stdcall when compiling for 32-bit Windows 2022-03-02 09:57:24 +01:00
rdb a0be50c769 general: Fix assorted compiler warnings 2022-03-01 16:09:07 +01:00
rdb 21377c8de5 Use secure versions of CRT getenv etc. when compiling with MSVC 2022-03-01 16:09:07 +01:00
rdb 5cfd8db95c glxdisplay: Update panda_glxext.h 2022-03-01 16:09:07 +01:00
rdb ac3aa64d33 express: Add docstring to DatagramIterator about Datagram lifetime
Related to #1262

[skip ci]
2022-03-01 15:14:01 +01:00
rdb 583c9f1857 pipeline: Fix issues with calling convention on 32-bit Windows 2022-03-01 12:19:13 +01:00
rdb 7ccf38a948 pgraph: Remove obsolete PandaNodeChain class
Obsoleted by 6bc22d1822
2022-02-24 14:13:11 +01:00
rdb 6bc22d1822 pgraph: Rewrite inefficient prev_transform tracking mechanism
The previous system was causing a lot of lock contention when transforms are modified in the Cull thread.

The new implementation doesn't use a linked list or lock at all, but a simple atomically incrementing integer that indicates that the prev transforms have changed.  set_transform() reads this and backs up the prev transform the first time a transform is modified after reset_all_prev_transforms() is called.
2022-02-24 11:42:04 +01:00
rdb ba4173b32c pgraph: Add constexpr to CacheStats constructor 2022-02-23 23:20:53 +01:00
rdb c2d088f232 pipeline: Don't use Sleep(1) to yield on Windows
Use Sleep(0) instead.  Sleep(0) is not guaranteed to yield, which is a problem, but Sleep(1) can easily take up to 16 ms, which is really unacceptable except in very low-priority thread.  But really, you shouldn't be relying on force_yield() for anything except with the SIMPLE_THREADS model.

There is also SwitchToThread(), but in fact it is even weaker than Sleep(0).
2022-02-23 23:20:53 +01:00
rdb cb8563acac event: Update AsyncFuture to use new atomics implementation
With explicit barriers, and the non-timeout version of wait() is now significantly more efficient by using the new futexes if available
2022-02-23 23:20:49 +01:00
rdb 70c49a6416 pipeline: Add Thread::relax() for more efficient busy waiting
Equivalent to cpu_relax() or the pause instruction on x86
2022-02-23 23:20:30 +01:00
rdb 5196719f29 device: Fix XInput compile error compiling for newer Windows versions 2022-02-23 21:46:15 +01:00
rdb fd033e66f1 pstats: Add support for profiling thread context switches
Disabled by default, enable with `pstats-thread-profiling true` in Config.prc
2022-02-22 18:02:39 +01:00
rdb b4d51c24e9 event: Remove FunctionAsyncTask
To create a task from a lambda, it is more efficient to use the new AsyncTaskManager::add() short-hand which creates an AsyncTask subclass in-place.
2022-02-22 18:02:34 +01:00
rdb 7baeaf3809 event: New C++ AsyncTaskManager::add() no longer uses std::function
std::function has unnecessary overhead, better to just create an AsyncTask subclass in-place storing the closure

This obsoletes FunctionAsyncTask, it will be removed in a future commit
2022-02-22 17:02:42 +01:00
rdb 72c891c0df display: Fix issues with PStats GPU timing:
- Leaking queries by never reusing / releasing them
- Clock synchronization was way off when driver waited on GPU during sync point
2022-02-22 17:00:47 +01:00
rdb 759115fbc7 pstats: Fix crash when frame has only level data and no time data 2022-02-22 15:25:04 +01:00
rdb 0a3733ccb9 pstats: GPU timing improvements; use same frame numbering everywhere
Timer queries are significantly more efficient, are synchronized to CPU time, and the synchronized frame numbering makes it possible to correlate stuff in the Timeline view
2022-02-20 17:33:40 +01:00
rdb 65cd882cb2 display: PStats collector reorganisation
Remove *:do_frame (which adds another stack frame with very little value), remove unused App:Delete collector, merge Flip Begin/End collectors
2022-02-20 16:23:14 +01:00
rdb c0c5eeb27e display: Don't start/stop collectors for empty window list 2022-02-18 17:24:43 +01:00
rdb d7bbcfb0b7 pstats: Some collector reorganisation:
- "App:Show code:General" is gone, it was causing too much trouble
- Replace odd "Client::GuiObjects" with "Nodes:GUI"
- Regroup "Dirty PipelineCyclers" underneath "PipelineCyclers"
2022-02-17 12:48:36 +01:00
rdb 93b7ebffaa pstats: PStatClient.connect() should wait for UDP connection to be established
This makes the behavior of PStats more predictable, reducing missed frames at the beginning
2022-02-17 12:48:36 +01:00
rdb cf9574b412 pstats: Add convenience method for ticking current thread only 2022-02-17 12:48:36 +01:00
rdb aea2d6ef45 display: Release lock before notifying render thread in GraphicsEngine
Otherwise the render thread will wake up only to be blocked by the mutex right away.
2022-02-17 12:48:36 +01:00
rdb 355cd5b4cd pstats: Remove unused field from PStatClient::InternalThread 2022-02-07 17:03:58 +01:00
rdb 77b0d2d6a7 pstats: Switch from AtomicAdjust to C++11-style atomics 2022-02-07 17:02:30 +01:00
rdb e27162df0b Merge branch 'release/1.10.x' 2022-02-06 15:32:24 +01:00
rdb 287b0d5a74 mathutil: Add proper `__repr__` for LPlane class
Fixes #1248
2022-02-06 15:29:25 +01:00
rdb 94570f20aa pgraph: Remove need for grabbing lock in RenderState destructor 2022-02-05 22:25:51 +01:00
rdb 46a1ad3544 pipeline: Improve performance of Thread::get_current_thread() substantially
Speedup is realised by using thread-local variables.  Note that on Windows we can't inline get_current_thread, but it's still faster this way than calling TlsGetValue.

In theory the cache line alignment should help avoid false sharing but I have not profiled that extensively.
2022-02-04 23:49:39 +01:00
rdb f6322d8c93 pipeline: De-inline ConditionVarDummyImpl methods
This is the only ConditionVar implementation to import thread.h directly
2022-01-30 02:03:18 +01:00
rdb c66ca2ece1 pstats: Report PStats overhead more honestly
Half the overhead was being missed due to the unfortunate collector placement
2022-01-30 02:03:18 +01:00
rdb c7c1c683da pstats: Disable "App:Show code:General" collector for now
It is generating negative values, needs further investigation - maybe we need to restructure the whole hierarchy
2022-01-30 02:03:18 +01:00
rdb 36edb22fd1 pstats: Include client pid with hello message
Useful for uniquely identifying the process in a situation where multiple clients on the same host connect with the same server.

New version bump is not necessary, as old servers should just ignore the extra field in the datagram.
2022-01-30 02:03:18 +01:00
rdb 8034cb5a92 dtoolbase: Introduce patomic<> as replacement for AtomicAdjust
This typedefs to std::atomic<> when building with true threading, and uses a dummy implementation without.

This lets us use the full range of atomic operations offered by C++11, including explicit specification of memory fences.  Using barriers lets the compiler generate more optimal code since currently we are using the quite strict sequential-consistent memory ordering for all operations.  ReferenceCount has been changed to use the correct barriers (I hope).  This may especially make a difference on weak ordering systems such as ARM.

Over time we should gradually replace the use of AtomicAdjust with the new patomic file.
2022-01-30 01:53:36 +01:00
rdb 692221cacb cocoadisplay: Invert direction of horizontal scroll
Now behaves consistent with other applications (tested with Logitech MX Master 3 for Mac on macOS 10.13 in unnatural scrolling configuration).

Set `cocoa-invert-wheel-x true` to revert to old behaviour.
2022-01-22 15:56:53 +01:00
rdb eaa182f310 Merge commit '38bea01dab8f4dedd5fce9f8b9e82cebbf663189' into release/1.10.x 2022-01-22 15:46:52 +01:00
rdb 38bea01dab device: Do not enumerate keyboard/mouse devices on macOS by default
This causes an annoying "this app would like to receive keystrokes from any application" alert to be shown

Enable iokit-scan-mouse-devices or iokit-scan-keyboard-devices to restore the old behavior
2022-01-22 15:45:00 +01:00
rdb a56ee57422 Merge branch 'release/1.10.x' 2022-01-14 10:50:10 +01:00
rdb be2f6a7c61 glgsg: Fix missing GR_adjacency geom rendering flag
I don't think this flag being missing currently affects any functionality, but it is meant to be set when geometry shaders (with adjacency) are supported.
2022-01-14 10:25:01 +01:00
rdb b518da99a6 windisplay: fix origin not respected when switching to windowed mode 2022-01-12 10:23:19 +01:00
rdb 440b2c48b8 egg2pg: Slight cleanup
[skip ci]
2022-01-10 15:40:06 +01:00
rdb 6fe21fd8bd egg2pg: Add support for texture matrices to bam2egg 2022-01-10 13:22:57 +01:00
rdb 992cbb0840 pgraph: optimizations for analyze() 2022-01-10 13:22:34 +01:00
rdb a1538b4f7c pnmimage: Add offset parameters to PNMImage::perlin_noise_fill() 2022-01-10 13:21:51 +01:00
rdb 6777f19162 pnmimage: Add an additive PNMPainter brush 2022-01-10 13:21:46 +01:00