Commit graph

211 commits

Author SHA1 Message Date
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
Danni
bf6629a005 D3D12: Fix shader model check, initialization error handling 2025-07-28 20:35:45 -04:00
Dario
4af0734a77 Compute texture alignment for transfers using the LCM instead. 2025-07-24 14:08:45 -03:00
LuoZhihao
8ad3072a6a RenderingDevice: Add uniform_type check to avoid crash 2025-07-13 10:27:16 +08: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
Lukas Tenbrink
2b36c79f7b Use Span<uint8_t> in RenderingDevice allocation APIs to avoid intermediary arrays on calls. 2025-06-18 12:31:48 +02:00
NetroScript
66d68707d3
Fix the VRS attachment being incorrectly added to color_attachments 2025-06-12 13:38:18 +02:00
clayjohn
cc9aedd898 Avoid crash when texture layers is greater than 1 and format is not an ARRAY type 2025-06-05 10:21:19 -07:00
Thaddeus Crews
de37627404
Merge pull request #102552 from DarioSamo/shader-baker
Add shader baker to project exporter.
2025-05-28 17:09:38 -05:00
Thaddeus Crews
90c75d02dd
Merge pull request #106732 from stuartcarnie/rd_reduce_allocations
Renderer: Eliminate `String` allocations for all labels in the renderer
2025-05-28 09:47:43 -05:00
Stuart Carnie
7d93119353 Renderer: Eliminates String allocations for all labels in the renderer
Uses `Span<char>` to avoid additional allocations in the graph.
2025-05-28 06:01:35 +10: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
Lukas Tenbrink
4cb8a0c77e Add resize_initialized and resize_uninitialized to Vector. These functions serve as replacements for resize, to make sure the caller understands whether elements need to be initialized 'by hand' after the call. 2025-05-26 18:35:41 +02:00
Sander
6ae50cad17 RenderingDevice: introduce parameter 'mipmaps' for texture_create_from_extension() 2025-05-07 15:15:55 +03:00
lawnjelly
f8f350a32a Add GLOBAL_GET cached macros.
GLOBAL_GET is an expensive operation which should not be used each frame / tick.
This PR adds macros which do a cheaper revision check, and only call the expensive GLOBAL_GET when project settings have changed.

Co-authored-by: Lukas Tenbrink <lukas.tenbrink@gmail.com>
2025-04-30 15:08:50 +01:00
Lukas Tenbrink
bfdb0f0ecf Fix various sanitizer issues. 2025-04-28 15:23:35 +02:00
Yyf2333
1a70a06a43 Change RID_Owner::get_owned_list. 2025-04-21 01:04:27 +08:00
Thaddeus Crews
b743eb96e3
Merge pull request #98760 from ze2j/optimize_texture_create_shared_from_slice
Optimize shared texture creations
2025-04-18 12:21:25 -05:00
Thaddeus Crews
98aced4e65
Merge pull request #99768 from dsnopek/openxr-vulkan-foveated-rendering
OpenXR: Use the `XR_FB_foveation_vulkan` extension to get the density map for VRS
2025-04-17 09:14:23 -05:00
Thaddeus Crews
0d267e7b1e
Core: Add dedicated BitField template 2025-04-11 11:53:26 -05:00
A Thousand Ships
889410dcda
Add String::replace_char(s) methods for performance and convenience 2025-04-10 13:08:45 +02:00
Yufeng Ying
4f4031a675 Replace size() == 0 with is_empty(). 2025-04-02 19:18:43 +08:00
David Snopek
79f5a4d9fe OpenXR: Use the XR_FB_foveation_vulkan extension to get the density map for VRS 2025-03-31 07:21:58 -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
Dario
76d709be74 Implement support for fragment density maps.
Co-Authored-By: Bastiaan Olij <mux213@gmail.com>
2025-03-24 11:50:04 -05:00
Rémi Verschelde
92fb04c6cc
Merge pull request #103941 from stuartcarnie/metal_fx_features
Renderer: Expose and document `Features` enum for MetalFX
2025-03-21 13:03:19 +01:00
Stuart Carnie
e2066298d9 Renderer: Fix Metal handling of cube textures; assert equal dimensions 2025-03-19 11:52:59 +11:00
clayjohn
16b9667c62 Error when draw list is not active in draw_list_switch_to_next_pass
This fixes a mistake made when refactoring the draw list
2025-03-14 18:04:47 -07:00
Stuart Carnie
052fe9158d Renderer: Expose and document Features enum for METAL_FX 2025-03-11 12:35:58 +11:00
clayjohn
4cf9d58dce Clean up more dynamic allocations in the RD renderers with a focus on 2D. 2025-03-10 13:16:12 -07:00
ze2j
6413a8a94b Optimize shared texture creation
Texture::slice_trackers is now a pointer and is allocated on demand only when a shared texture is created.
This makes copying Texture significantly faster.
2025-03-10 20:16:50 +01:00
Thaddeus Crews
bf6031890e
Merge pull request #103814 from darksylinc/matias-update_perf_report-speedup
RenderingDevice: Delay expensive operations to `get_perf_report`
2025-03-09 09:05:24 -05:00
Matias N. Goldberg
21133425cc Delay expensive operations to get_perf_report
The function update_perf_report() is expensive and is called every
frame.
Most of it is not necessary unless the user calls get_perf_report

Affects #102173
2025-03-08 11:25:46 -03:00
clayjohn
5efcd64b23 Reduce per-frame memory allocations from the heap in the Mobile renderer. 2025-03-07 22:01:24 -08: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
LuoZhihao
808c9fbcc5 RenderingDevice: Validate pre-raster (vertex) shader in render_pipeline_create 2025-03-03 05:19:55 +08:00
Matias N. Goldberg
fcd785ace2 Add ASTC HDR format variants 2025-02-13 11:45:42 -03:00
Thaddeus Crews
1939e87db1
Merge pull request #101561 from darksylinc/matias-device-address-api
Change how device address is requested to avoid future API breakage
2025-02-12 12:56:25 -06:00
Matias N. Goldberg
af900a5825 Change how device address is requested to avoid future API breakage
PR #100062 introduced BUFFER_USAGE_DEVICE_ADDRESS_BIT.

However it did so by adding a boolean to uniform_buffer_create(), called
"bool p_enable_device_address".

This makes maintaining backwards compatibility harder because I am
working on another feature that would require introducing yet another
bit flag.

This would save us the need to add fallback routines when the feature I
am working on makes it to Godot 4.5.

Even if my feature doesn't make it to 4.5 either, this PR makes the
routine more future-proof.

This PR also moves STORAGE_BUFFER_USAGE_DEVICE_ADDRESS into
BUFFER_CREATION_DEVICE_ADDRESS_BIT, since it's an option available to
both storage and uniforms.

This PR also moves the boolean use_as_storage into
BUFFER_CREATION_AS_STORAGE.
2025-02-11 20:00:18 -03:00
Dario
1bba9dbce9 Fix erroneous logic when flushes are involved on RD async methods. 2025-02-05 09:49:15 -03:00
thimenesup
3d92f406b2 Implement Buffer Device Address for Rendering Device Vulkan and DirectX12 2025-01-13 22:43:29 -08:00
Rémi Verschelde
62ea2f76b4
Merge pull request #101069 from DarioSamo/rd-thread-safety-comment
Remove TODO from RenderingDevice regarding thread safety.
2025-01-06 22:48:28 +01:00