Commit Graph

1413 Commits

Author SHA1 Message Date
rdb 99b3888712 gobj: Fix Texture::clear_clear_color() 2025-01-30 11:38:00 +01:00
rdb 2a47826101 glgsg: Big refactoring of texture uploading, add async upload support 2025-01-27 19:35:59 +01:00
rdb 8f4d0c8a66 gobj: Make BufferContextChain thread-safe 2025-01-21 11:37:29 +01:00
rdb 26dd784153 gobj: Make BufferResidencyTracker::_residency a const field 2024-12-03 13:19:17 +01:00
rdb ac68b85d1f shader: Fix compilation warning 2024-11-26 16:42:45 +01:00
rdb 55fa0e9912 Merge branch 'release/1.10.x' 2024-10-31 13:13:00 +01:00
rdb 32ad388a51 gobj: Don't try to resolve empty alpha filename when writing bam 2024-10-31 13:07:02 +01:00
rdb 7560a1edd1 Merge branch 'release/1.10.x' 2024-10-30 13:42:21 +01:00
rdb 7c9c4cd435 gobj: devirtualize calls to GeomPatches::get_num_vertices_per_primitive() 2024-10-17 16:18:12 +02:00
rdb beff684af3 Further thread safety changes for Python 3.13 free threading
See #1683
2024-09-19 20:43:06 +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 40b824bdcc general: Consistently name all bam factory functions make_from_bam
See discussion in #1630
2024-03-18 02:38:41 +01:00
rdb 73360393df Switch use of Py_INCREF to new Py_NewRef function
This is more idiomatic, simplifies the code, makes it easier to port to eg. HPy later on, and makes it easier to use the limited ABI (where it can be optimized to a tail call) later on

A polyfill is provided for compatibility with Python versions 3.8 and 3.9
2024-01-29 17:57:53 +01:00
rdb 84ed141b2a Squash merge webgl-port branch into master
Adds support for emscripten as a build target / platform, and adds a WebGL renderer back-end
2024-01-25 15:37:38 +01:00
rdb 9517ffb320 Merge branch 'release/1.10.x' 2024-01-08 21:10:17 +01:00
kamgha fe63dee524 Assorted docstring fixes
Closes #1588
2024-01-08 19:53:46 +01:00
rdb 5685949588 shader: Fix regression fetching material shader inputs 2023-10-11 16:07:55 +02:00
rdb 93a75d8fe2 Merge branch 'release/1.10.x' 2023-10-09 17:43:02 +02:00
rdb a2fa54f385 gobj: fix `_contexts != nullptr` assert when prepare fails 2023-10-09 16:52:45 +02:00
rdb cb4597ebb8 shader: Pass built-in array shader input in one go
This applies to `p3d_TextureMatrix[]` and `p3d_ClipPlane[]`

This is more efficient and also works around Apple driver bugs (like #846)

Fixes #883
2023-09-17 19:18:40 +02:00
rdb ba388e2866 shader: More efficient state-based shader input fetching
Previously every input was fetched as a matrix.  Now, every input is fetched as a vector, with matrices taking up multiple vectors.  This saves a lot of copying and a lot of space in the cache.

Furthermore, integer state-based inputs can be defined (for future use)

Naming still needs to be revised, since it's called the "mat part cache" etc.
2023-09-17 17:54:17 +02:00
WMOkiishi ea84547805 general: Mark many constructors as `explicit`
Closes #1514
Fixes #1431
2023-08-02 08:18:43 +02:00
rdb 07f9f9d897 (multiview) texture preparation changes:
Multiview textures are now handled as a single texture context instead of as one texture context per view. This should be marginally more efficient, but more importantly, it paves the way for implementing multiview textures as subviews of an array texture down the line, which paves the way for hardware-accelerated stereo rendering (where the left and right views get rendered simultaneously to different layers of an array texture).

The difference between a multiview texture done this way and an array texture is that the views of a multiview texture will still be treated as individual textures from the shader's point of view, only the views will be sharing the same storage on the GPU.  This can be done by using a feature offered by graphics APIs that is (serendipitously) also called "texture views", where it's possible to create multiple texture objects that point to layer ranges of a bigger array texture.

That part has not yet been done as doing this in OpenGL will be a little tricky due to texture views being an optional feature (so both paths would need to be implemented), but texture views are native in Vulkan (and D3D10+ for that matter), so doing this now allows me to implement multiview textures natively on the Vulkan end right from the start, and OpenGL can follow later if desired.

Furthermore, this commit includes:
- OpenGL: Overhaul texture creation and binding
- OpenGL: Change how reloading a texture with mipmaps works
- OpenGL: Use DSA in a couple of places
- OpenGL ES: Add support for buffer textures
- OpenGL: Remove support for bindless textures for now; this was never implemented in a very useful way, not used to my knowledge, and it is better to re-implement it later after the new shader pipeline lands
- DirectX9: All views of a texture are uploaded at the same time
- TinyDisplay: Support multiview textures natively (consecutive storage in memory)
- General: Per-page texture update tracking is working properly now for multiview textures
2023-06-13 13:51:19 +02:00
rdb c3e9f1738e Merge branch 'release/1.10.x' 2023-06-13 13:45:51 +02:00
rdb d2e93cc185 gobj: Fix post_load_store_cache field being uninitialized on cycle
This is randomly causing textures to be downloaded, which can be a significant performance drain
2023-05-25 13:55:22 +02:00
rdb eefb51f510 dtoolutil: Add small_vector implementation and use it
This vector implementation does is optimized for the case of having only a small number of elements, which are stored directly on the vector object rather than being allocated from the heap.  If the capacity exceeds this small number, then a heap allocation is done.

This should improve performance in a couple of cases where vectors typically store 1 element and rarely more than that.
2023-02-22 16:48:11 +01:00
rdb 17242e9a0a gobj: Fix compiler warnings in TexturePool 2023-02-20 20:54:16 +01:00
rdb 5e26aae1ff cleanup: Fix assorted issues uncovered by clang-tidy 2023-02-12 18:17:03 +01:00
rdb 1c37522026 Merge branch 'release/1.10.x' into master 2023-02-12 14:07:49 +01:00
rdb aaabb6a652 Fix assorted issues uncovered by clang-tidy 2023-02-12 13:55:59 +01:00
Disyer af4a1bc7a9 python: Use public PyErr_Occurred API instead of private macro
The _PyErr_OCCURRED macro was removed in Python 3.10, so we shouldn't keep any compat code left around for it
2023-02-12 02:36:57 +02:00
Timothy Paustian 4fa90bd754 gobj: Fix TexturePool sharing texture objects when loaded with different properties
Fixes #1047
Closes #1105

Co-authored-by: rdb <git@rdb.name>
2023-02-07 12:23:30 +01:00
rdb b09a8a84ec Merge branch 'release/1.10.x' 2023-02-03 14:52:39 +01:00
rdb 52c7d6bddb shader: Add missing handling for 1D array textures in Cg shaders 2023-01-31 17:37:18 +01:00
rdb 51d0a55264 general: Fix silly new clang warning about unprefixed `std::move()` 2023-01-31 15:38:02 +01:00
rdb 614502d183 gobj: Add note to API doc about maximum stride value 2023-01-31 15:36:43 +01:00
rdb b282e8920d Merge branch 'release/1.10.x' 2023-01-13 22:32:35 +01:00
rdb 709555577f ShaderGenerator: Add support for perspective points
Fixes #1440
2023-01-13 19:12:01 +01:00
rdb 10f4c6bb21 shader: Add texconst_i shader input for Cg shaders to access TexGen constant 2023-01-13 17:02:15 +01:00
rdb b526286d40 pstats: Add collectors for texture/image reading/writing 2023-01-13 11:42:26 +01:00
Frang 275fe32079
create PY_EXTENSION and friends (#1415) 2023-01-04 20:54:53 +01:00
rdb 0747f46055 event: Improve interface for adding tasks from C++
The order of arguments is now the same as in Python (with the callable first), sort and priority arguments have been added, and new tasks can be added directly to a chain
2022-12-26 19:10:01 +01:00
Cary Sandvig 3247903d7b add more HAVE_PYTHON
Also add some more #endif comments.
2022-12-23 13:38:46 -05:00
rdb 92185bcb28 Merge branch 'release/1.10.x' 2022-12-19 16:42:29 +01:00
rdb 896346b99f gobj: Implement `copy.deepcopy()` for Texture class
Actually ensures that the underlying RAM images are really fully unique.
2022-12-19 16:22:33 +01:00
rdb 0ace26a938 gobj: Fix double-precision colors not being clamped in GeomVertexWriter 2022-12-19 15:18:04 +01:00
rdb 7f916eeb74 gobj: Don't wastefully compute bounds for Geom with custom bounds
This was done by `get_nested_vertices()`, which now won't call the expensive `compute_internal_bounds()` if there was a custom bounding volume set.
2022-12-16 20:18:57 +01:00
rdb 833c3d37f7 gobj: Compute nested vertices separate from internal bounds in Geom
This prevents having to recalculate the internal bounds (which may be quite slow to compute, but not actually necessary if there are user bounds present) to get the nested vertices
2022-12-16 20:13:41 +01:00