Commit Graph

3843 Commits

Author SHA1 Message Date
Bill Hollings
b093d271c5
Merge pull request #2248 from billhollings/msl-fix-discrete-runtime-arrays-of-buffers
MSL: Ensure discrete runtime arrays of buffers have known length.
2024-01-03 15:34:29 -05:00
Bill Hollings
d47183c0db MSL: Ensure discrete runtime arrays of buffers have known length.
An entry-point array of buffers, that is not part of a Metal argument
buffer, requires a known length, so it can be emitted as discrete buffers.
For runtime arrays of resources, this can be retrieved from the resource
binding information added via add_msl_resource_binding().

- Redefine get_resource_array_size() to consolidate array sizing using both var
  type, and runtime array sizing from resource bindings, if not found in type.
- Use get_resource_array_size() to fix issue for runtime arrays of buffers.
- Update runtime arrays of images and samplers to use get_resource_array_size().
- Add .DS_Store to .gitignore (unrelated).
2023-12-22 09:12:44 -05:00
Hans-Kristian Arntzen
f349c91274
Merge pull request #2240 from KhronosGroup/fix-2239
MSL: Remove special case for threadgroup array wrapper.
2023-12-07 14:50:19 +01:00
Hans-Kristian Arntzen
2603fbe520 MSL: Remove special case for threadgroup array wrapper.
I cannot find any evidence that this does not actually work.
The original case here was from Epic's PR series in 2019, but I cannot see why it doesn't work.
It might have been a bug in a very old compiler at some point.
2023-12-07 14:41:42 +01:00
Hans-Kristian Arntzen
13aab7f07e
Merge pull request #2243 from KhronosGroup/pr-2238
Land PR 2238
2023-12-07 14:37:24 +01:00
Hans-Kristian Arntzen
833c5936b0 Various nit fixes and improvements from review. 2023-12-07 14:31:36 +01:00
Hans-Kristian Arntzen
e3d1b9afbb Merge branch 'spirtype-refactor' of https://github.com/Hugobros3/SPIRV-Cross into pr-2238 2023-12-07 12:05:48 +01:00
Hans-Kristian Arntzen
e6b013a492
Merge pull request #2214 from KhronosGroup/fix-2206
MSL: Use powr instead of pow.
2023-12-07 11:39:26 +01:00
Hugo Devillers
5065781b15 fix more spirtype::op instances 2023-12-06 18:04:59 +01:00
Hugo Devillers
d019358ce0 fix unintialised struct in SPIRType 2023-12-06 17:54:34 +01:00
Hans-Kristian Arntzen
9da5f7ce45
Merge pull request #2242 from KhronosGroup/fix-2221
MSL: Improve PtrAccessChain handling.
2023-12-06 17:17:21 +01:00
Hans-Kristian Arntzen
ffab994ab0 MSL: Wrap dereferenced ptr-chain expressions. 2023-12-06 17:09:25 +01:00
Hans-Kristian Arntzen
4e3f66b5d5 MSL: Add test for vector-to-scalar variable pointer. 2023-12-06 17:09:25 +01:00
Hans-Kristian Arntzen
6dbec321d2 MSL: Defererence pointer expressions before traversing access chain.
Exception is struct which does -> for us.
2023-12-06 17:09:25 +01:00
Hans-Kristian Arntzen
0836c81e73 MSL: Only do address-of expression when needed. 2023-12-06 16:18:58 +01:00
Hans-Kristian Arntzen
ed7ba43062 MSL: Use LHS expression to determine whether or not to do array copy.
Makes a difference when using variable pointers.
2023-12-06 16:18:58 +01:00
Hans-Kristian Arntzen
e2886f0946 MSL: Consider PtrAccessChain on array types. 2023-12-06 16:18:58 +01:00
Hans-Kristian Arntzen
766a74dbaf
Merge pull request #2241 from Try/msl-ray-cullmask
MSL: add ray-cull mask
2023-12-06 14:26:25 +01:00
Try
22d6e2e6b6 + missing tests 2023-12-05 21:35:26 +01:00
Try
8f58b84761 MSL: add ray-cull mask 2023-12-05 20:56:48 +01:00
Hans-Kristian Arntzen
7c335edc66
Merge pull request #2237 from cdavis5e/raw-tese-input-patch-vertices
MSL: Fix patch vertex count with raw buffer tese input.
2023-12-05 14:03:29 +01:00
Chip Davis
c0760eb91f MSL: Fix patch vertex count with raw buffer tese input.
We can no longer rely on the `patch_control_point<>` array being
present, so the best we can do is use the value given us at compile
time.

This was an oversight on my part when I initially implemented the
raw-buffer tessellation evaluation input mode. The lack of tests for the
`PatchVertices` built-in almost certainly contributed, so I fixed that
in this patch.

Fixes the test
`dEQP-VK.tessellation.shader_input_output.patch_vertices_in_tes`. This
is the last failing test under `dEQP-VK.tessellation`.
2023-12-04 14:24:16 -08:00
Hugo Devillers
55e08aff31 use 'op' as the ground truth in is_array and is_pointer 2023-12-04 18:49:46 +01:00
Hugo Devillers
7c7b6e600f msl: look at the pointee type in emit_tessellation_access_chain 2023-12-04 18:49:22 +01:00
Hugo Devillers
8632f67109 msl: look at the actual variable element type in to_member_reference 2023-12-04 18:36:39 +01:00
Hugo Devillers
5b1881041e msl: make build_extended_vector_type deal with compound types better 2023-12-04 18:33:53 +01:00
Hugo Devillers
2c3734df75 msl: fix many instances of SPIRType.self being incorrectly set 2023-12-04 18:33:27 +01:00
Hugo Devillers
ee7aaaf662 msl: fix two more instances of the wrong op in SPIRType 2023-12-04 18:32:56 +01:00
Hugo Devillers
738bfd49e3 msl: fix test regressions with samplemask 2023-12-04 12:47:15 +01:00
Hugo Devillers
af92037acb fix a bunch of case where SPIRType::op is wrong/corrupted 2023-11-30 15:42:46 +01:00
Hugo Devillers
950cad5913 Added an Op field to SPIRType
This field allows telling what the 'head' of the type is, without having to look at parent types.
2023-11-30 12:28:50 +01:00
Hans-Kristian Arntzen
a3da0e87fa
Merge pull request #2235 from KhronosGroup/fix-2212
MSL: Implement MSL 3.1 image atomics natively
2023-11-29 14:48:20 +01:00
Hans-Kristian Arntzen
f3573b9f1e MSL: Throw on emulated image array atomics. 2023-11-29 14:17:57 +01:00
Hans-Kristian Arntzen
a326b3ea3b MSL: Support using the offline Metal Windows toolchain for validation. 2023-11-29 13:53:23 +01:00
Hans-Kristian Arntzen
e33670e794 MSL: Add some image atomic tests for 3.1. 2023-11-29 13:53:23 +01:00
Hans-Kristian Arntzen
2ff08b31c0 MSL: Update test scripts for MSL 3.1 testing. 2023-11-29 13:53:23 +01:00
Hans-Kristian Arntzen
9c054b1f34 MSL: Implement Metal 3.1 image atomics natively.
The check_discard code was too annoying to deal with,
and there is no requirement to return anything meaningful.
Vulkan specs state that values returned by atomic instructions are undefined.
2023-11-29 13:53:23 +01:00
Hans-Kristian Arntzen
50e90dd74e
Merge pull request #2233 from cdavis5e/agx-cube-grad-fixup
MSL: Work around broken cube texture gradients on Apple Silicon.
2023-11-28 12:05:55 +01:00
Chip Davis
18976c4307 Add missing new MSL options to the C API and the CLI. 2023-11-27 15:03:58 -08:00
Chip Davis
7ef52b04c3 MSL: Work around broken cube texture gradients on Apple Silicon.
To date, all released Apple Silicon GPUs incorrectly interpret the
gradient vectors when sampling a cube texture. Specifically, they ignore
one of the three partial derivatives in each gradient depending on the
selected major axis, and they expect the remaining derivatives to be
partially transformed.

h/t @lexaknyazev for the code used in the `spvGradientCube()` function.

Fixes 8 tests under `dEQP-VK.glsl.texture_functions.texturegrad.*`.
2023-11-27 15:03:26 -08:00
Hans-Kristian Arntzen
3717660e14
Merge pull request #2234 from KhronosGroup/fix-2226
MSL: Support std140 half matrices and arrays.
2023-11-27 17:17:13 +01:00
Hans-Kristian Arntzen
2e022dbff5 MSL: Move test files to packing/. 2023-11-27 16:54:27 +01:00
Hans-Kristian Arntzen
3872dcd68f MSL: Don't use swizzle if we have wrapper. 2023-11-27 16:52:32 +01:00
Hans-Kristian Arntzen
61bbcb2705
Merge pull request #2232 from KhronosGroup/fix-2228
MSL: Add divide to reserved function names.
2023-11-27 16:31:01 +01:00
Hans-Kristian Arntzen
81c047c3ed MSL: Use more appropriate padded types. 2023-11-27 16:30:24 +01:00
Hans-Kristian Arntzen
57dbfa0400 MSL: Support std140 half matrices and arrays.
Super awkward since there is no clean way to express this.
2023-11-27 15:28:20 +01:00
Hans-Kristian Arntzen
dddabb9c11 MSL: Add divide to reserved function names. 2023-11-27 12:14:30 +01:00
Hans-Kristian Arntzen
42299f92ef
Merge pull request #2230 from chirsz-ever/chirsz/custom-float-formater
Allow to customize float literals in output
2023-11-24 12:47:51 +01:00
Hans-Kristian Arntzen
3e8e761e49
Apply suggestions from code review 2023-11-24 12:46:50 +01:00
Hans-Kristian Arntzen
94f4c48faf
Apply suggestions from code review 2023-11-24 12:46:28 +01:00