Commit Graph

86 Commits

Author SHA1 Message Date
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
Giovanni Mascellani
7fb288819a vkd3d-shader/msl: Set the prefix to "unknown" for unhandled shader types in msl_generator_init().
Like we do for GLSL; there's no reason to abort compilation here. Note
that this also avoids leaking "gen->buffer" and "gen->string_buffers" on
the error path.
2025-04-09 16:08:15 +02:00
Giovanni Mascellani
10d8760134 vkd3d-shader/ir: Validate register id and index for RESOURCE registers. 2025-04-02 19:06:43 +02:00
Giovanni Mascellani
2377db33db vkd3d-shader: Represent descriptor information in the vsir program. 2025-03-18 15:38:01 +01:00
Henri Verbeet
ce4f2728ba vkd3d-shader/msl: Get rid of a stray vkd3d_string_buffer_printf() in the VEC4 UINT immediate constant handling.
Uncovered by the ininf() test in the next commit. This is why we insist
on test coverage; unfortunately this one slipped through in
fd1beedc07.
2025-01-16 19:18:08 +01:00
Giovanni Mascellani
64126a00c3 vkd3d-shader/ir: Give more meaningful names to I/O normalisation levels.
The previous names "not normalised" and "fully normalised" have meanings
which are likely to change with time. OTOH including a description of the
normalisation level in the enumerant seems excessive. Relating
normalisation levels to shader model versions might be a reasonable
compromise.
2024-12-12 17:21:49 +01:00
Feifan He
9d4bcc951d vkd3d-shader/msl: Implement VKD3DSIH_USHR. 2024-12-05 21:26:03 +01:00
Feifan He
138e7caa03 vkd3d-shader/msl: Implement VKD3DSIH_ISHR. 2024-12-05 21:26:03 +01:00
Feifan He
5d6ed0fa30 vkd3d-shader/msl: Implement VKD3DSIH_ISHL. 2024-12-05 21:26:03 +01:00
Feifan He
a425c242a4 vkd3d-shader/msl: Implement VKD3DSIH_MAD. 2024-12-05 21:26:03 +01:00
Feifan He
8e0de82c74 vkd3d-shader/msl: Implement support for VKD3DSPDM_SATURATE modifiers. 2024-12-05 21:26:03 +01:00
Feifan He
ebf5828542 vkd3d-shader/msl: Implement VKD3DSIH_ELSE. 2024-12-05 21:25:35 +01:00
Feifan He
bbe10dcf17 vkd3d-shader/msl: Implement VKD3DSIH_NOT. 2024-12-05 21:13:29 +01:00
Feifan He
a06e664730 vkd3d-shader/msl: Implement VKD3DSIH_RSQ. 2024-12-04 14:26:20 +01:00
Feifan He
bc67f2eb75 vkd3d-shader/msl: Implement VKD3DSIH_MIN. 2024-12-04 14:26:20 +01:00
Feifan He
ab2cb43e15 vkd3d-shader/msl: Implement VKD3DSIH_MAX. 2024-12-04 14:26:20 +01:00
Feifan He
64ea033c81 vkd3d-shader/msl: Implement VKD3DSIH_LOG. 2024-12-04 14:26:20 +01:00
Feifan He
b1e6dbe83f vkd3d-shader/msl: Handle SV_IS_FRONT_FACE inputs. 2024-12-04 14:26:20 +01:00
Feifan He
568296c88f vkd3d-shader/msl: Implement VKD3DSIH_ROUND_NE. 2024-12-04 14:26:20 +01:00
Feifan He
610a11ddf8 vkd3d-shader/msl: Implement VKD3DSIH_IF and VKD3DSIH_ENDIF. 2024-12-04 14:26:20 +01:00