Commit Graph

123 Commits

Author SHA1 Message Date
Antonio Caggiano 24f9ac81ba raytracing: Fix shader binding table record alignment
Raytracing shader binding table records are addressed through Vulkan
alignment rules that distinguish between the raw shader group handle size,
the per-record handle alignment, and the base alignment required for SBT
region addresses.

The previous layout treated the shader group handle size as the record
stride everywhere. This worked only on devices where the handle size
already satisfied all relevant alignment requirements. It broke down once
multiple ray generation shaders were placed in the same SBT: selecting a
non-zero raygen index advanced the raygen region address by the raw handle
size, which could produce an address that was not aligned to the required
shader group base alignment.

Separate the SBT layout into the appropriate strides:

- ray generation records use a base-aligned stride, since selecting a
  raygen shader changes the SBT region start address for the dispatch.
- miss and hit records use the handle-aligned shader group stride, since
  their regions start at a base-aligned address and individual records are
  selected through the region stride.

This keeps the CPU-side SBT population and the dispatch-time SBT regions
using the same layout, so shader group handles are written to the same
aligned slots that Vulkan later addresses.
2026-04-13 23:24:17 +02:00
Thaddeus Crews 4a9684b0ff Merge pull request #117537 from allenwp/remove-10-bit-vulkan-swapchain-formats
Remove unnecessary Vulkan swap chain formats.
2026-04-10 10:32:31 -05:00
Skyth 83d2b84a51 Refactor raytracing pipelines. 2026-04-10 14:21:02 +03:00
Thaddeus Crews cd32d9949f Merge pull request #118083 from allenwp/hdr-macos-vulkan
Add HDR output support to Vulkan on macOS.
2026-04-07 06:44:43 -05:00
Allen Pestaluky 0810756a9f Add HDR output support to Vulkan on macOS.
Co-authored-by: Josh Jones <kilauea.jones@gmail.com>
Co-authored-by: Stuart Carnie <stuart.carnie@gmail.com>
2026-04-06 11:11:18 -04:00
Skyth e16a299a86 Raytracing API adjustments. 2026-04-03 18:06:34 +03:00
Thaddeus Crews 7351e6909b Merge pull request #116962 from blueskythlikesclouds/blas-create-api-change
Refactor `blas_create` to accept multiple geometries.
2026-04-02 12:33:23 -05:00
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 98868393cc Style: Enforce #include validation hook 2026-03-18 10:41:59 +01:00
Allen Pestaluky bb61cc3f8e Remove unnecessary A2B10G10R10_UNORM and A2R10G10B10_UNORM Vulkan swap chain formats. 2026-03-17 17:07:18 -04:00
Rémi Verschelde 7795057e4b Misc includes or modernize fixes found via clangd-tidy 2026-03-16 21:38:26 +01:00
Thaddeus Crews 5d0a321575 Merge pull request #102987 from ArchercatNEO/wayland-hdr
[LinuxBSD] Add support for HDR output (Wayland)
2026-03-16 11:32:54 -05:00
Rémi Verschelde 0d7bd115da Remove unused includes in drivers with clangd-tidy 2026-03-14 22:38:02 +01:00
ArchercatNEO eee3384e20 HDR output for linuxbsd (wayland) 2026-03-13 16:48:58 +00:00
Skyth 1b7fcc3993 Refactor blas_create to accept multiple geometries. 2026-03-11 15:19:56 +03:00
David Snopek 4d218bdeb7 OpenXR: Allow using Vulkan subsampled images with foveated rendered 2026-03-05 11:00:37 -06:00
Rémi Verschelde 8c0f175c94 Decouple RenderingServer from as much of the codebase as possible
Notably decouples it from:
- AccessibilityServer
- DisplayServer
- Viewport
- Window
2026-03-03 12:48:07 +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
Stuart Carnie d5504ffc69 feat: Add EDR support to Metal and all Apple platforms 2026-02-27 05:23:56 +11:00
Skyth 8ed849e416 Optimize get_total_memory_used in D3D12 and Vulkan. 2026-02-16 17:13:06 +03: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
Lukas Tenbrink c5df0cb82b Don't right-align escaped newlines, e.g. for #define. This has previously led to long diffs in the commit history. 2026-02-04 19:31:28 +01: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 f714eaba0d Do not store SPIR-V in memory unless pipeline statistics are used. 2026-01-16 18:51:33 -03:00
Rémi Verschelde 0449f4bce1 Merge pull request #114657 from DarioSamo/immutable-sampler-descriptor-fix
Always add Vulkan descriptor count for immutable samplers to descriptor pool.
2026-01-08 17:15:33 +01:00
Dario bce41d08fe Always add Vulkan descriptor count for immutable samplers to descriptor pool. 2026-01-06 16:02:51 -03: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
Rémi Verschelde 7692a3d53b Merge pull request #114313 from blueskythlikesclouds/handle-descriptor-fragmentation
Create new pools when they become fragmented on Vulkan.
2026-01-01 10:19:54 +01:00
Skyth 3ef93dc19f Implement workaround for GPU driver crash on Adreno 5XX. 2025-12-29 15:14:04 +03:00
Skyth 3b23931eae Create new pools when they become fragmented on Vulkan. 2025-12-22 12:42:19 +03:00
Skyth 83af078761 Clear depth stencil textures on first use if the RDD requires it. 2025-12-15 18:34:43 +03:00
mxtherfxcker 8a23bec158 Update re-spirv to fix multiple regressions.
- Fix behavior regression from decoration change.
- Empty shader fix.
- Add image query ops.

Co-authored-by: DarioSamo <dariosamo@gmail.com>
2025-12-08 16:13:36 -03:00
Thaddeus Crews 666bcb2056 Merge pull request #111452 from DarioSamo/re-spirv
Use re-spirv in the Vulkan driver to optimize shaders.
2025-12-02 11:52:10 -06:00
Dario cf00643565 Use re-spirv in the Vulkan driver to optimize shaders.
Includes contributions by Rémi to unify usage of SPIR-V Headers across the dependencies.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2025-12-02 11:39:11 -03:00
Skyth ba556ebe03 Implement point size emulation in the forward shader for D3D12. 2025-12-02 17:36:31 +03:00
Rémi Verschelde 1cb4ada316 Merge pull request #112994 from dsnopek/openxr-meta-foveation-eye-tracked-on-meta
OpenXR: Fix Vulkan validation errors and get `XR_META_foveation_eye_tracked` working on Meta Quest devices
2025-11-27 09:55:45 +01:00
David Snopek fce47ac456 OpenXR: Fix Vulkan validation errors and get XR_META_foveation_eye_tracked working on Meta Quest devices 2025-11-26 05:02:22 -06: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
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
dhoverb 53e1ea184a Implement XR_META_foveation_eye_tracked 2025-11-18 14:58:11 +00: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
Skyth 613c9fb86f Improve rendering driver fallback on Windows. 2025-11-05 17:49:43 +03: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
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
Lukas Tenbrink 1db0a60dc0 Replace std::size usage with std_size to avoid <iterator> include. 2025-10-05 00:26:11 +02:00
Ben Rog-Wilhelm e5ab5acd95 Rename RDD::MemoryBarrier to avoid conflicts with the Windows headers. 2025-09-10 05:19:36 -05:00
Dario e137c882c0 Disable smolv and change the shader hash when SPIR-V debug info is enabled. 2025-08-28 14:17:58 -03:00
Dario b962b38e74 Check for Vulkan Memory Model support and make it a variant. 2025-07-25 09:24:58 -03:00