Commit Graph

252 Commits

Author SHA1 Message Date
Rémi Verschelde 7958080d65 Merge pull request #116220 from dsnopek/foveated-rendering-vulkan-subsampled-image
OpenXR: Allow using Vulkan subsampled images with foveated rendering
2026-03-23 22:34:11 +01:00
Rémi Verschelde e33e98a26f Style: Apply clang-format grouping rules 2026-03-17 20:11:01 +01:00
Rémi Verschelde 7795057e4b Misc includes or modernize fixes found via clangd-tidy 2026-03-16 21:38:26 +01:00
David Snopek 4d218bdeb7 OpenXR: Allow using Vulkan subsampled images with foveated rendered 2026-03-05 11:00:37 -06:00
Rémi Verschelde 765362b033 Explicitly include core/config/engine.h where used 2026-03-04 10:17:10 +01:00
Rémi Verschelde f332faf46b Explicitly include core/os/os.h where used 2026-03-04 09:54:10 +01:00
Rémi Verschelde a447ac95ec Move DisplayServer enums and typedefs to DisplayServerEnums
This will allow decoupling `display_server.h` from a number of headers in the
codebase which only require those enums and not all the DisplayServer API.
2026-03-03 12:44:02 +01:00
DDarby-Lewis bf326793ba Editor additions for MipMaps and rd_textures 2026-02-27 08:38:13 -06:00
Thaddeus Crews e380a41752 Style: Add class_db.h includes explicitly 2026-02-26 15:50:28 -06:00
Lukas Tenbrink 0ea5ece984 Move binary math functions to Math namespace in math_funcs_binary header. 2026-02-17 12:24:35 +01:00
Antonio Caggiano ba71e30579 Tie scratch buffers to acceleration structures
The scratch buffer is never exposed to the user, it is only used
internally and it is managed by the acceleration structure itself.
2026-02-16 11:00:28 +01:00
Thaddeus Crews 2d5b30c476 Merge pull request #115963 from blueskythlikesclouds/reduce-includes-to-rd
Reduce includes to rendering device.
2026-02-12 08:19:16 -06:00
Josh Jones b8389cc76b Support output to HDR monitors
Co-authored-by: Alvin Wong <alvinhochun@gmail.com>
Co-authored-by: Allen Pestaluky <allenpestaluky@gmail.com>
2026-02-11 22:13:26 -07:00
Skyth 8fbf2f1e14 Reduce includes to rendering device.
Co-authored-by: Lukas Tenbrink <lukas.tenbrink@gmail.com>
2026-02-10 16:58:50 +03:00
Skyth de7fcfaf3b Fix transfer worker race condition. 2026-02-04 16:15:41 +03:00
Thaddeus Crews 04a2ae7ed4 Merge pull request #99119 from Fahien/fahien/raytracing-base
Vulkan raytracing plumbing
2026-01-27 15:18:24 -06:00
Antonio Caggiano 27e4f24800 raytracing: Initial Vulkan support
- Vulkan implementations in `RenderingDeviceDriverVulkan`.
- Raytracing instruction list in `RenderingDeviceGraph`.
- Functions to create acceleration structures and raytracing pipelines
  in `RenderingDevice`.
- Raygen, Miss, and ClosestHit shader stages support.
- GDScript bindings.
- Update classes documentation.
- Unimplemented placeholders for Metal and D3D12.
- Build acceleration structure command.
- Expose a shader preprocessor define.
- Align build scratch address.
- Create STB after creating the pipeline.
- Separate acceleration structure barriers.
- Use transforms in TLAS instances.
- AnyHit and Intersection stages.
- Optionally set acceleration structure build input buffer usage.
- Introduce instances buffer.
- Move scratch buffers to RenderingDevice.
- Rename AccelerationStructureGeometryBits.
- Use regular buffer creation and free routines for scratch buffer.
- Store trackers in acceleration structures.
- Bump Shader SPIR-V version to 1.4
- Add Position attribute location in blas_create.
- Encapsulate MoltenVK check in preprocessor macro.
- Split SUPPORTS_RAYTRACING for pipeline and query.
2026-01-27 16:17:45 +01:00
Dario c2b068d08c Fix stale reference bug in FramebufferCache. 2026-01-23 10:43:09 -03:00
Rémi Verschelde 7d807ec22d Merge pull request #114476 from blueskythlikesclouds/create-separate-graphics-queue-for-transfer
Create separate graphics queue instead of reusing the main queue when transfer queue family is unsupported.
2026-01-06 18:25:50 +01:00
Rémi Verschelde bc6f6a6358 Merge pull request #113842 from blueskythlikesclouds/rd-depth-clear-on-first-use
Clear depth stencil textures on first use if the RDD requires it.
2026-01-06 10:59:42 +01:00
Skyth 2bc63ddf08 Create separate graphics queue instead of reusing the main queue when transfer queue family is unsupported. 2025-12-31 16:46:34 +03:00
Fredia Huya-Kouadio be24804e1a Trigger save of the RD pipeline cache on application pause 2025-12-30 19:25:29 -08:00
Rémi Verschelde adb7774a61 RenderingDevice: Add null checks when retrieving uniform sets
This may mitigate a crash seen in the wild in Rift Riff on Android, most
likely trading it for a single-frame rendering bug (which is better than
crashing on user devices).

It doesn't solve the underlying issue which seems to be a race condition
where a uniform set RID gets has been freed while still being reported as
owned by the RID_Owner.
2025-12-16 10:15:02 +01:00
Skyth 83af078761 Clear depth stencil textures on first use if the RDD requires it. 2025-12-15 18:34:43 +03:00
Skyth ba556ebe03 Implement point size emulation in the forward shader for D3D12. 2025-12-02 17:36:31 +03:00
Skyth bfdf86370f Check for pending clears in every RD texture function. 2025-11-27 17:26:26 +03:00
Rémi Verschelde b1de0364bf Merge pull request #111954 from blueskythlikesclouds/copy-api-refactor
Refactor rendering driver copy APIs to fix D3D12 issues.
2025-11-27 09:55:31 +01:00
Alexander Hartmann d97496a99e Fix SHADER_UNIFORM_NAMES 2025-11-26 16:02:38 +01:00
Skyth 56db3aed47 Refactor rendering driver copy APIs to fix D3D12 issues.
Co-authored-by: Stuart Carnie <stuart.carnie@gmail.com>
2025-11-26 12:00:02 +03:00
Dario d17ea061bc Move D3D12's automatic texture clears to RenderingDevice. 2025-11-25 09:34:38 -03:00
Thaddeus Crews 9a8b9e5c24 Merge pull request #113010 from blueskythlikesclouds/persistent-map-staging-buffers
Persistently map staging buffers.
2025-11-24 16:00:04 -06:00
Thaddeus Crews 2edc43df8e Merge pull request #78598 from BastiaanOlij/resolve_depth_buffer_mobile
Resolve depth buffer in mobile renderer when required
2025-11-20 11:10:48 -06:00
Skyth f5bbd71dfc Persistently map staging buffers. 2025-11-20 14:32:55 +03:00
Pāvels Nadtočajevs 90f2026c0f Fix D3D12 renderer crash on Wine. 2025-11-18 12:38:22 +02:00
Bastiaan Olij 21ffbecfa9 Resolve depth buffer in pass if supported by driver 2025-11-17 17:29:38 +11:00
Stuart Carnie 90c0e6acca 2D: Switch to VBOs for instance data
- Add support for vertex bindings and UMA vertex buffers in D3D12.
- Simplify 2D instance params and move more into per-batch data to save
  bandwidth

Co-authored-by: Skyth <19259897+blueskythlikesclouds@users.noreply.github.com>
Co-authored-by: Clay John <claynjohn@gmail.com>
Co-authored-by: A Thousand Ships <96648715+athousandships@users.noreply.github.com>
2025-11-15 06:25:49 +11:00
Lukas Tenbrink c3747884da Add some important profiling hooks. 2025-11-08 00:08:48 +01:00
Thaddeus Crews edbfb7a6ec Merge pull request #111183 from stuartcarnie/matias-uma-pc-pr
Add Persistent Buffers utilizing UMA
2025-10-24 11:23:11 -05:00
Stuart Carnie 230adb7511 Add Persistent Buffers
This work is a heavily refactored and rewritten from TheForge's initial
code.

TheForge's original code had too many race conditions and was
fundamentally flawed as it was too easy to incur into those data races
by accident.

However they identified the proper places that needed changes, and the
idea was sound. I used their work as a blueprint to design this work.

This PR implements:

 - Introduction of UMA buffers used by a few buffers
(most notably the ones filled by _fill_instance_data).

Ironically this change seems to positively affect PC more than it does
on Mobile.

Updates D3D12 Memory Allocator to get GPU_UPLOAD heap support.

Metal implementation by Stuart Carnie.

Co-authored-by: Stuart Carnie <stuart.carnie@gmail.com>
Co-authored-by: TheForge team
2025-10-24 08:16:19 +11:00
Clay John bad8f531a8 Sync final frame after finalizing RD to ensure that nothing is in use on the GPU when we free the RD 2025-10-23 08:20:54 -07:00
Erik Ritschl 44451e6988 Fix incorrect failure code in screen_get_framebuffer_format
RenderingDevice::screen_get_framebuffer_format should return a value of
type RenderingDevice::FramebufferFormatID which is an alias of int64_t
but it returns Error::FAILED with a value of 1. The compiler does not
complain because both types are integers but 1 corresponds to a valid
FramebufferFormatID, meaning a certain failure condition is missed.

This commit changes it to the correct value, INVALID_ID.
2025-10-21 15:26:26 +02:00
Dario af584b1ba8 Do not begin a new frame during RenderingDevice's shutdown. 2025-10-16 13:47:18 -03:00
Stuart Carnie a281e91c5a Metal: Fix texture_get_data other linear formats
Introduce a specialised `texture_get_data` for `RenderDeviceDriver`,
which can retrieve the texture data from the GPU driver for shared
textures (`TEXTURE_USAGE_CPU_READ_BIT`).

Closes #108115
2025-10-16 06:46:51 +11:00
chocola-mint ead282ff13 Remove file_access.h and script_backtrace.h includes from logger.h. 2025-10-05 17:49:23 +09:00
Stuart Carnie 3ffcae66a8 Renderer: Fix missing shader_name; use forward declarations
* Moving over to RenderingShaderContainer, missed setting shader_name
* Use forward declaration reduces compile time when modifying
  rendering_shader_container.h from over 950s to about 10-15
2025-10-02 10:02:18 +10:00
Thaddeus Crews 4594de69fd Merge pull request #111013 from stuartcarnie/shader_container_ext
Renderer: Move `reflect_spirv` to `RenderingShaderContainer`
2025-10-01 17:54:09 -05:00
Aaron Franke 9fbf5808a0 Rename server "free" functions to "free_rid" to match exposed API 2025-09-30 16:52:25 -07:00
Stuart Carnie 65e8b0951b Renderer: Move reflect_spirv to RenderingShaderContainer
This change introduces a new protected type, `ReflectedShaderStage` to
`RenderingShaderContainer` that derived types use to access SPIR-V and
the reflected module, `SpvReflectShaderModule` allowing implementations
to use the reflection information to compile their platform-specific
module.

* Fixes memory leak in `reflect_spirv` that would not deallocate the
  `SpvReflectShaderModule` if an error occurred.
* Removes unnecessary allocation when creating `SpvReflectShaderModule`
  by passing `NO_COPY` flag to `spvReflectCreateShaderModule2`
  constructor function.
* Replaces `VectorView` with `Span` for consistency
* Fixes unnecessary allocations in D3D12 shader container in
  `_convert_spirv_to_nir` and `_convert_spirv_to_dxil` which implicitly
  converted the old `VectorView` to a `Vector`
2025-09-30 06:40:14 +10:00
Dario 8c4180adf4 Add GENERAL resource usage to the render graph. Fixes texture initialization in D3D12. 2025-09-02 15:18:47 -03:00
Thaddeus Crews 87bb5ab681 Merge pull request #108919 from KeyboardDanni/d3d12_init_shader_model_check
D3D12: Fix shader model check, initialization error handling
2025-08-01 11:45:19 -05:00