1
0
Fork 0
Commit Graph

570 Commits

Author SHA1 Message Date
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 97c17aedc7 Metal: Stable argument buffers; GPU rendering crashes; visionOS exports
Supersedes #110683
2025-10-28 08:45:26 +11: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
Thaddeus Crews b17aa3343a
Revert "SCons: Add `CPPEXTPATH` for external includes" 2025-10-06 13:09:22 -05:00
Lukas Tenbrink 1db0a60dc0 Replace `std::size` usage with `std_size` to avoid `<iterator>` include. 2025-10-05 00:26:11 +02: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
Thaddeus Crews 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
Thaddeus Crews 4dec6af2c8
Merge pull request #108613 from Repiteo/scons/fix-defines
SCons: Ensure `CPPDEFINES` is properly utilized
2025-09-16 11:44:45 -05: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
Thaddeus Crews 61956f2e06
SCons: Ensure `CPPDEFINES` is properly utilized 2025-07-14 13:07:53 -05: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 01fc9aee6c
Core: Modernize C headers with C++ equivalents 2025-05-02 08:23:01 -05:00
Thaddeus Crews 0d267e7b1e
Core: Add dedicated `BitField` template 2025-04-11 11:53:26 -05:00
Thaddeus Crews f25fc34439
SCons: Add `CPPEXTPATH` for external includes 2025-04-02 07:29:08 -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
Aaron Franke 97ee05e9b7
Rename version defines to GODOT_VERSION_* to match GDExtension godot-cpp 2025-03-12 11:11:38 -07:00
Thaddeus Crews 324512e11c
Style: Replace header guards with `#pragma once` 2025-03-07 17:33:47 -06: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
thimenesup 3d92f406b2 Implement Buffer Device Address for Rendering Device Vulkan and DirectX12 2025-01-13 22:43:29 -08:00