Commit Graph

105 Commits

Author SHA1 Message Date
Henri Verbeet
d881356ab2 vkd3d-shader/msl: Implement VKD3DSIH_IGE. 2025-06-09 16:20:53 +02:00
Henri Verbeet
3673b65485 vkd3d-shader/msl: Implement VKD3DSIH_IADD. 2025-06-09 16:20:53 +02:00
Henri Verbeet
cc33439f19 vkd3d-shader/msl: Implement VKD3DSIH_EQO. 2025-06-09 16:20:53 +02:00
Henri Verbeet
fc6249a228 vkd3d-shader/msl: Implement support for VKD3DSPR_SAMPLEMASK registers. 2025-06-09 16:20:53 +02:00
Henri Verbeet
ea5cf883fa vkd3d-shader/msl: Implement support for VKD3DSPR_IDXTEMP registers. 2025-06-09 16:20:53 +02:00
Henri Verbeet
5ea697b8eb vkd3d-shader/msl: Handle SV_SAMPLE_INDEX inputs. 2025-06-05 15:58:44 +02:00
Henri Verbeet
1cdfed919a vkd3d-shader/msl: Simplify SV_DEPTH handling. 2025-06-05 15:58:44 +02:00
Henri Verbeet
cf312e14a9 vkd3d-shader/msl: Handle SV_VERTEX_ID inputs. 2025-06-05 15:58:44 +02:00
Henri Verbeet
e948098ae3 vkd3d-shader/msl: Handle SV_POSITION inputs. 2025-06-05 15:58:44 +02:00
Henri Verbeet
f14a0dfe07 vkd3d-shader/msl: Implement support for indirect constant buffer addressing. 2025-06-05 15:58:01 +02:00
Henri Verbeet
0b829db149 vkd3d-shader/msl: Continue when the SRV descriptor binding isn't specified in msl_ld().
Mostly to aid debugging.
2025-06-05 15:55:01 +02:00
Henri Verbeet
fadcbf3eeb vkd3d-shader/msl: Slightly improve the error messages for unspecified descriptor bindings.
This also makes them consistent with the ones used by the GLSL backend.
2025-06-05 15:55:01 +02:00
Henri Verbeet
6a93c503cd vkd3d-shader/msl: Get rid of the "lod" field of struct msl_resource_type_info.
1D read() is specified to support a level/lod parameter. The MSL
specification claims it needs to be 0 because "mipmaps are not supported
for 1D textures", but that restriction isn't documented for the
"mipmapLevelCount" property of MTLTextureDescriptor. Other APIs do
supported mipmapped 1D textures. Multi-sample textures aren't supported
by msl_ld(), so we don't need to worry about them.
2025-06-05 15:55:01 +02:00
Henri Verbeet
02d7d6038d vkd3d-shader/msl: Reject cube and multi-sample texel fetches in msl_ld().
The cube variants are simply disallowed in Direct3D, and currently
mishandled by msl_ld(). It's less clear whether multi-sample fetches
should be allowed, and how they're supposed to behave if they are,
although typically the "ld2dms" instruction would be used for those.
They're not supported on the MSL side either way.
2025-06-05 15:55:01 +02:00
Henri Verbeet
671fbfea7d vkd3d-shader/msl: Ensure we have a non-NULL "resource_type_info" pointer in msl_ld().
Since we're going to dereference it.
2025-06-05 15:55:01 +02:00
Giovanni Mascellani
9f0185f304 vkd3d-shader/msl: Support the ABSNEG source modifier. 2025-06-02 20:36:42 +02:00
Giovanni Mascellani
10be58a74f vkd3d-shader/msl: Ignore the PARTIALPRECISION destination modifier. 2025-06-02 20:33:01 +02:00
Giovanni Mascellani
df8b611334 vkd3d-shader/msl: Accept and ignore the REFACTORING_ALLOWED global flag. 2025-06-02 20:32:36 +02:00
Henri Verbeet
618d8e6a4a vkd3d-shader/msl: Make the generated main function static.
We only need to export the entry point.
2025-06-02 20:11:08 +02:00
Giovanni Mascellani
50ca4a2101 vkd3d-shader/msl: Use the standard helper to print bitcasts. 2025-04-30 16:23:35 +02:00
Giovanni Mascellani
bb78c06193 vkd3d-shader/msl: Introduce msl_print_bitcast(). 2025-04-30 16:22:48 +02:00
Giovanni Mascellani
a1f48d2575 vkd3d-shader/msl: Introduce msl_print_src(). 2025-04-30 16:17:50 +02:00
Giovanni Mascellani
24e61cf74e vkd3d-shader: Represent resource data types as vkd3d_data_type in struct vkd3d_shader_descriptor_info1. 2025-04-14 21:55:26 +02:00
Feifan He
ba7a9a0b29 vkd3d-shader/msl: Implement VKD3DSIH_LD.
Co-authored-by: Giovanni Mascellani <gmascellani@codeweavers.com>
2025-04-14 15:27:02 +02:00
Giovanni Mascellani
3493688a4d vkd3d-shader/msl: Access descriptors with a type-erased array.
Currently a descriptor set is represented with a structure
whose fields are the various descriptors that the shader is
going to use, each of them qualified with its type. This model
doesn't match very well what happens with D3D12 and with Vulkan
and descriptor indexing and mutable descriptors, where many
descriptor of different types can overlap, and only at shader
runtime it is decided which of them must be used.

Therefore with this patch a descriptor is represented as a
structure whose fields carry no intrinsic typing information,
but are reinterpreted according to the shader behavior on
each access. For the moment there is just one field, but more
will be added to account for fancier descriptor types and
to workaround Metal limitations.

When completed, this design will be similar in spirit to what
the Metal shader converter does, with little technical
differences.

This choice has a couple of drawbacks:

 1. shader debugging with Xcode is less comfortable, because
    the shader doesn't carry static descriptor typing
    information and Xcode is therefore less able to provide
    useful context;

 2. it requires tier 2 argument buffer support and macOS
    version >= 13, which includes guarantees on the runtime
    layout for descriptors.

Supporting descriptor indexing and mutable descriptors is
considered to be worthy of those drawbacks, though, is
effectively required by many applications and appears to be
the first goal we should aim for. If needed, in the future
we might also add support for older hardware, at least for
shaders that do not make use of advanced features.
2025-04-14 14:45:14 +02:00