85 Commits

Author SHA1 Message Date
3ac14dfe01 Revert "SCons: Add CPPEXTPATH for external includes"
(cherry picked from commit b17aa3343a)
2025-10-08 02:04:05 +02:00
c834443ef1 Metal: Fix Metal compiler version inspection
(cherry picked from commit d93fe9038d)
2025-09-30 11:36:49 -05:00
b7aac81366 Metal: Ensure baking to binary sets minimum target OS
Co-authored-by: Travis Lange <travislange12@gmail.com>
2025-09-08 08:16:53 +10:00
1b64bcb98d Metal: Reduce baked version to MSL 3.1; validate minimum version
Validate the MSL version of the baked shader is <= the current version
supported by the OS, and return an error so it is recompiled.

Closes #109846
2025-08-29 05:48:51 +10:00
5cd785d3a8 SCons: Use gnu++20 in metal driver 2025-08-20 09:56:38 -05:00
b962b38e74 Check for Vulkan Memory Model support and make it a variant. 2025-07-25 09:24:58 -03:00
338816236b Metal: Remove invalid assumption for image atomic operations
Fix image atomic checks, which require minimum OS version too.

Closes #108445
2025-07-10 06:51:27 +10: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
bdbc97ecbb Metal: Use correct environment variable to generate labels 2025-07-01 05:28:42 +10:00
46277836a6 Optimize Mobile renderer by using FP16 explicitly. 2025-06-09 14:39:35 -03:00
de37627404 Merge pull request #102552 from DarioSamo/shader-baker
Add shader baker to project exporter.
2025-05-28 17:09:38 -05:00
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
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
32043fc682 Metal: Fix crash when clearing render buffers 2025-05-22 07:25:48 +10:00
4201db6f01 Metal: Ensure stencil-only rendering is supported
Closes #106652
2025-05-21 08:45:30 +10:00
47971c0a27 Introduce 'visionos' platform derived from 'apple_embedded' 2025-05-19 15:47:01 -07:00
457299449d Introduce 'drivers/apple_embedded' abstract platform for code reuse 2025-05-19 15:37:13 -07:00
3bf400ffae Move bisect to Span and deduplicate code.
Co-authored-by: Lukas Tenbrink <lukas.tenbrink@gmail.com>
2025-05-14 18:19:09 +08:00
6ae50cad17 RenderingDevice: introduce parameter 'mipmaps' for texture_create_from_extension() 2025-05-07 15:15:55 +03:00
dd5460c32a Style: Declare inline macros as attributes 2025-04-18 12:04:40 -05:00
0d267e7b1e Core: Add dedicated BitField template 2025-04-11 11:53:26 -05:00
cade15a163 Merge pull request #92475 from AThousandShips/string_replace_char
Add `String::replace_char(s)` methods for performance and convenience
2025-04-10 10:18:16 -05:00
889410dcda Add String::replace_char(s) methods for performance and convenience 2025-04-10 13:08:45 +02:00
8c8d6de3e7 Apple: Add pthread implementation of Thread class
This allows Apple platforms to override the default stack size of
a thread in the WorkerThreadPool, which is 512KiB by default.

This must be increased, as SPIRV-Cross, used by the Metal driver, can
use deeply nested stacks, as can debug builds.
2025-04-10 09:35:40 +10:00
207a2b6472 Core: Integrate warning suppression macro helpers 2025-04-03 10:13:46 -05:00
f25fc34439 SCons: Add CPPEXTPATH for external includes 2025-04-02 07:29:08 -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
76d709be74 Implement support for fragment density maps.
Co-Authored-By: Bastiaan Olij <mux213@gmail.com>
2025-03-24 11:50:04 -05:00
e2066298d9 Renderer: Fix Metal handling of cube textures; assert equal dimensions 2025-03-19 11:52:59 +11:00
2123368dca Metal: Use reference, so we're not copying every frame 2025-03-13 07:15:59 +11:00
713a1ba554 Style: Standardize Obj-C #import syntax 2025-03-08 09:28:34 -06:00
324512e11c Style: Replace header guards with #pragma once 2025-03-07 17:33:47 -06:00
ec5e096388 Merge pull request #103645 from stuartcarnie/fix_101696_pt_2
Metal: Use `p_set_index` when binding uniforms, to use correct data
2025-03-06 16:36:12 -06:00
4bafafaeb3 Merge pull request #102777 from darksylinc/matias-astc-hdr
Add ASTC HDR format variants
2025-03-06 16:36:06 -06:00
a4fb68f43e Metal: Use p_set_index when binding uniforms, to use correct data 2025-03-06 06:29:49 +11:00
59d75a704e Merge pull request #103613 from stuartcarnie/fix_101696
Metal: Use uniform set index passed by `RenderingDevice`
2025-03-05 12:08:11 -06:00
aef8ed2901 Merge pull request #87388 from clayjohn/Vulkan-limit-add
Implement `LIMIT_MAX_COMPUTE_SHARED_MEMORY_SIZE` to `limit_get` in the Vulkan backend
2025-03-05 12:08:00 -06:00
76e2e9f81f [Metal] Add missing stage info to shader description. 2025-03-05 09:06:06 +02:00
2b8cb36434 Metal: Use uniform set index passed by RenderingDevice
This does not resolve the errors noted in #101696, as the project is
incorrectly binding incompatible uniform set descriptors, as set 0
and set 1 have a single `readonly` image and set 2 has a single
`writeonly` texture. The `RenderingDevice` is reporting the errors with
Metal, as it uses a different `_reflect_spirv`, which correctly
determines the read / write attribute. A separate PR will be required
to fix the shared `_reflect_spirv`

Helps #101696
2025-03-05 17:52:52 +11: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
5312811c4d Metal: Fix SPIR-V → MSL compilation on iOS targets 2025-02-27 10:22:39 +11:00
818afcb327 Metal: Compile MTLLibrary on demand when pipeline is created
This changes the default shader loading strategy, implemented in the
Metal driver, to compile the `MTLLibrary` on demand when the pipeline
is created, which reduces cold startup time on IPHONE target OSs.

Normally, the `MTLLibrary` is compiled from Metal source asynchronously
when Godot calls
`RenderingDeviceDriverMetal::shader_create_from_bytecode`; however, this
changes this behaviour on mobile platforms to do it on demand when the
pipeline is created, as noted in #96052, Godot will ask to create
many more shaders from bytecode than are initially required. Mobile
OSs like iOS are limited to compiling to shader libraries concurrently,
which results in a significant bottleneck.

This is not the default for macOS, as it can concurrently compile many
shaders at once, resulting in faster startup times for the Godot editor.
2025-02-25 05:32:38 +11: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
01b4fd3522 Metal: enable GPU buffer address support 2025-01-16 06:10:50 +11:00
3d92f406b2 Implement Buffer Device Address for Rendering Device Vulkan and DirectX12 2025-01-13 22:43:29 -08:00
9fc39ae321 Metal: Use retained references; shared pixel format code
Most important is a fix for an occasional crash due to a use-after-free
bug.

A number of API availability declarations were updated to include tvOS.

The code is now simplified and generic for all platforms, which makes
way for future tvOS support.

Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
2025-01-12 07:11:22 +11:00
03c83cea1e Style: Enable clang-format's InsertBraces config
This was part of our style guide since we started using clang-format
but the feature was only added in clang-format 15, and we hadn't
noticed it yet.
2025-01-09 16:46:51 +01:00
f134769506 Fix various typos
* Add TODO notes for typos that should be fixed for 5.0

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2025-01-08 14:47:42 +02:00
11dc4f2e5e Metal: Add MetalFX upscaling support
Co-authored-by: Hugo Locurcio <hugo.locurcio@hugo.pro>
2025-01-06 06:03:18 -07:00