Commit Graph

95 Commits

Author SHA1 Message Date
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
ef853bbc06 Merge pull request #111347 from Ivorforce/no-algorithm
Add `max()` to `Span`, replacing `<algorithm>` include from `rendering_device_commons.h`
2025-10-07 17:15:09 -05:00
1fa332cad4 Add max() to Span.
Remove `<algorithm>` include from `rendering_device_commons.h`, using `Span` instead.
2025-10-07 22:26:32 +02:00
b17aa3343a Revert "SCons: Add CPPEXTPATH for external includes" 2025-10-06 13:09:22 -05:00
686b56fae9 Merge pull request #106434 from Ivorforce/invert-hashfuncs
Reduce cross project includes by rewriting `HashMapHasherDefault`.
2025-10-06 09:06:37 -05:00
ead282ff13 Remove file_access.h and script_backtrace.h includes from logger.h. 2025-10-05 17:49:23 +09:00
ad600125df Rewrite HashMapHasherDefault based on type traits - it is now possible to declare a default hashing function for any type.
Remove cross-project includes from `hashfuncs.h`.
Improve hashing function for `Color` (based on values instead of `String`).
Move `Variant` comparison from `hash_map.h` to `dictionary.cpp` (`VariantComparatorDictionary`), where it's used.
Remove now unnecessary `HashableHasher`.
2025-10-05 01:49:11 +02:00
4594de69fd Merge pull request #111013 from stuartcarnie/shader_container_ext
Renderer: Move `reflect_spirv` to `RenderingShaderContainer`
2025-10-01 17:54:09 -05: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
d93fe9038d Metal: Fix Metal compiler version inspection 2025-09-25 06:35:31 +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
e5ab5acd95 Rename RDD::MemoryBarrier to avoid conflicts with the Windows headers. 2025-09-10 05:19:36 -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