Commit Graph

102 Commits

Author SHA1 Message Date
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
Stuart Carnie
5230f6c60c Apple: Use image atomic operations on supported Apple hardware
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2025-07-05 05:59:00 +10:00
Dario
46277836a6 Optimize Mobile renderer by using FP16 explicitly. 2025-06-09 14:39:35 -03:00
Dario
5a30a7e7cd Add shader baker to project exporter.
Metal Support contributed by Migeran (https://migeran.com) and Stuart Carnie.

Co-authored-by: Stuart Carnie <stuart.carnie@gmail.com>
Co-authored-by: Gergely Kis <gergely.kis@migeran.com>
2025-05-27 12:45:27 -03:00
Dario
ad22f65489 Rework semaphores for presentation to be created per swap chain image to fix validation error. 2025-05-14 15:27:51 -03:00
Sander
6ae50cad17 RenderingDevice: introduce parameter 'mipmaps' for texture_create_from_extension() 2025-05-07 15:15:55 +03:00
Thaddeus Crews
0d267e7b1e Core: Add dedicated BitField template 2025-04-11 11:53:26 -05:00
Thaddeus Crews
780cf03051 Merge pull request #104556 from Ivorforce/string-extend-instead-of-parse
Use `append_` instead of `parse_` for `String` methods.
2025-03-29 10:16:33 -05:00
Rémi Verschelde
408d07109b Merge pull request #99551 from DarioSamo/fragment-density-map
Implement Fragment density map support.
2025-03-28 14:31:19 +01:00
Lukas Tenbrink
ffa6ef220b Use append_ instead of parse_ for String methods. 2025-03-27 17:51:02 +01:00
Dario
76d709be74 Implement support for fragment density maps.
Co-Authored-By: Bastiaan Olij <mux213@gmail.com>
2025-03-24 11:50:04 -05:00
Thaddeus Crews
c937b6d180 Merge pull request #102419 from Ivorforce/std-size
Use `std::size` instead of `sizeof(a) / sizeof(a[0])` pattern throughout the codebase.
2025-03-07 15:12:25 -06:00
Thaddeus Crews
6ab1472fc7 Merge pull request #103730 from darksylinc/matias-vma-regression
Fix incorrect parameters passed to VMA
2025-03-07 12:06:27 -06:00
Matias N. Goldberg
c543c5615c Fix incorrect parameters passed to VMA
If the allocation is small enough that it enters the

if (p_size <= SMALL_ALLOCATION_MAX_SIZE) {} block, Godot would call
vmaFindMemoryTypeIndexForBufferInfo with the wrong parameters.

This can cause vmaFindMemoryTypeIndexForBufferInfo to potentially
misbehave on some cards or drivers.

Fixes regression introduced in #102830
Might potentially reopen #101850 (I doubt it, but it's possible)

Must be backported to 4.4
2025-03-06 19:56:52 -03:00
Thaddeus Crews
4bafafaeb3 Merge pull request #102777 from darksylinc/matias-astc-hdr
Add ASTC HDR format variants
2025-03-06 16:36:06 -06:00
clayjohn
338c12fc9a Implement LIMIT_MAX_COMPUTE_SHARED_MEMORY_SIZE to limit_get in all Rendering backends.
Also add a more helpful warning that is only displayed in dev builds to
match the D3D12 backend
2025-03-03 21:43:12 -08:00
Rémi Verschelde
cd72d26518 Merge pull request #102830 from clayjohn/vma-memory-fix
Restore using VMA to create buffers and images
2025-02-17 09:47:47 +01:00
clayjohn
d93ac5ee0c Restore using VMA to create buffers and images when we don't need to extra gpu memory tracking.
VMA handles memory allocation on certain devices better than our custom VK code, so we might as well use it

Co-authored-by: Matias N. Goldberg <dark_sylinc@yahoo.com.ar>
2025-02-13 17:40:42 -08:00
clayjohn
35100396e4 Validate varying count when compiling shaders
This avoids crashing on devices when a number of varyings greater than the device limit is used.

For now this accurately prints an error when compiling the shader, but the error text only pops up in the editor if the number of user varyings is above the limit.
2025-02-13 15:07:15 -08:00
Matias N. Goldberg
fcd785ace2 Add ASTC HDR format variants 2025-02-13 11:45:42 -03:00
Lukas Tenbrink
e34f1f504c Use std::size instead of sizeof(a) / sizeof(a[0]) pattern throughout the codebase. 2025-02-07 14:57:48 +01:00
Matias N. Goldberg
c30eff5986 Fix performance regression introduced in #90993
PR #90993 needed to get rid of VMA_MEMORY_USAGE_AUTO_PREFER_HOST because
we no longer used vmaCreateBuffer so we could specify the allocation
callbacks.

This however resulted in the wrong memory pool being chosen, causing
signficant performance slowdown.

Indicate additional preferred flags to help VMA select the proper pool.

Fixes #101905
2025-01-24 00:08:29 -03:00