Commit Graph

566 Commits

Author SHA1 Message Date
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
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
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
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
53e1ea184a Implement XR_META_foveation_eye_tracked 2025-11-18 14:58:11 +00:00
21ffbecfa9 Resolve depth buffer in pass if supported by driver 2025-11-17 17:29:38 +11:00
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
613c9fb86f Improve rendering driver fallback on Windows. 2025-11-05 17:49:43 +03:00
97c17aedc7 Metal: Stable argument buffers; GPU rendering crashes; visionOS exports
Supersedes #110683
2025-10-28 08:45:26 +11:00
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
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
b17aa3343a Revert "SCons: Add CPPEXTPATH for external includes" 2025-10-06 13:09:22 -05:00
1db0a60dc0 Replace std::size usage with std_size to avoid <iterator> include. 2025-10-05 00:26:11 +02:00
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
aa294bb3c8 Merge pull request #110360 from zorbathut/pr/memorybarrierrename
Rename RDD::MemoryBarrier to avoid conflicts with the Windows headers.
2025-09-17 11:34:15 -05:00
4dec6af2c8 Merge pull request #108613 from Repiteo/scons/fix-defines
SCons: Ensure `CPPDEFINES` is properly utilized
2025-09-16 11:44:45 -05:00
e5ab5acd95 Rename RDD::MemoryBarrier to avoid conflicts with the Windows headers. 2025-09-10 05:19:36 -05:00
e137c882c0 Disable smolv and change the shader hash when SPIR-V debug info is enabled. 2025-08-28 14:17:58 -03:00
b962b38e74 Check for Vulkan Memory Model support and make it a variant. 2025-07-25 09:24:58 -03:00
61956f2e06 SCons: Ensure CPPDEFINES is properly utilized 2025-07-14 13:07:53 -05:00
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
46277836a6 Optimize Mobile renderer by using FP16 explicitly. 2025-06-09 14:39:35 -03:00
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
ad22f65489 Rework semaphores for presentation to be created per swap chain image to fix validation error. 2025-05-14 15:27:51 -03:00
6ae50cad17 RenderingDevice: introduce parameter 'mipmaps' for texture_create_from_extension() 2025-05-07 15:15:55 +03:00
01fc9aee6c Core: Modernize C headers with C++ equivalents 2025-05-02 08:23:01 -05:00
0d267e7b1e Core: Add dedicated BitField template 2025-04-11 11:53:26 -05:00
f25fc34439 SCons: Add CPPEXTPATH for external includes 2025-04-02 07:29:08 -05:00
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
408d07109b Merge pull request #99551 from DarioSamo/fragment-density-map
Implement Fragment density map support.
2025-03-28 14:31:19 +01:00
ffa6ef220b Use append_ instead of parse_ for String methods. 2025-03-27 17:51:02 +01:00
76d709be74 Implement support for fragment density maps.
Co-Authored-By: Bastiaan Olij <mux213@gmail.com>
2025-03-24 11:50:04 -05:00
97ee05e9b7 Rename version defines to GODOT_VERSION_* to match GDExtension godot-cpp 2025-03-12 11:11:38 -07:00
324512e11c Style: Replace header guards with #pragma once 2025-03-07 17:33:47 -06:00
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
6ab1472fc7 Merge pull request #103730 from darksylinc/matias-vma-regression
Fix incorrect parameters passed to VMA
2025-03-07 12:06:27 -06:00
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
4bafafaeb3 Merge pull request #102777 from darksylinc/matias-astc-hdr
Add ASTC HDR format variants
2025-03-06 16:36:06 -06:00
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
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
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
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
fcd785ace2 Add ASTC HDR format variants 2025-02-13 11:45:42 -03:00
e34f1f504c Use std::size instead of sizeof(a) / sizeof(a[0]) pattern throughout the codebase. 2025-02-07 14:57:48 +01:00
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
3d92f406b2 Implement Buffer Device Address for Rendering Device Vulkan and DirectX12 2025-01-13 22:43:29 -08:00
ffe53cba3c Merge pull request #100374 from hpvb/fix-rendering-ubsan
Fix ubsan reported errors in rendering
2024-12-14 18:25:46 +01:00
f2c8f17906 Merge pull request #100325 from hpvb/fix-rendering-alignment
Fix several ubsan reported misaligned accesses
2024-12-13 16:19:20 -06:00
062d74bb9c Fix ubsan reported errors in rendering
This allows the TPS demo to run without an ubsan reports from any of the
rendering code.
2024-12-13 21:27:37 +01:00
e674379764 Fix several ubsan reported misaligned accesses
These misaligned accesses are shown in all of our CI hooks. It turned
out to not be difficult to fix.

It is likely that this will improve performance for aarch64.
2024-12-13 15:32:35 +01:00