Commit Graph

6329 Commits

Author SHA1 Message Date
Giovanni Mascellani
a0db928473 vkd3d-shader/msl: Pass a descriptor to msl_get_uav_binding(). 2025-10-29 13:35:45 +01:00
Giovanni Mascellani
6915388289 vkd3d-shader/msl: Pass a descriptor to msl_get_sampler_binding(). 2025-10-29 13:32:47 +01:00
Giovanni Mascellani
53a349b46c vkd3d-shader/msl: Pass a descriptor to msl_get_srv_binding(). 2025-10-29 13:31:33 +01:00
Giovanni Mascellani
13d105c104 vkd3d-shader/msl: Pass a descriptor to msl_get_cbv_binding(). 2025-10-29 13:28:53 +01:00
Henri Verbeet
fce89133e7 vkd3d-shader/ir: Remove VSIR_OP_DCL_IMMEDIATE_CONSTANT_BUFFER instructions. 2025-10-29 13:27:33 +01:00
Henri Verbeet
9c6f8c8bd5 vkd3d-shader/dxil: Only add declared ICBs to the vsir program.
The input DXIL can sometimes contain constant arrays not referenced by the
resulting vsir program. It doesn't hurt much to generate ICBs for those
anyway, but it's a little pointless.
2025-10-29 13:27:33 +01:00
Francisco Casas
f616e6c118 vkd3d-shader/ir: Validate I/O destination write masks on normalised vsir. 2025-10-29 13:23:29 +01:00
Francisco Casas
32b622d7a5 vkd3d-shader/dxil: Also map destination write masks for system values.
Currently, on what we consider normalized vsir, destination write masks
are not relative to the signature element's mask, even though source
swizzles are. Also for most instructions, the source swizzles are masked
by the destination write mask, as given by vsir_src_is_masked().

The DXIL parser however, is not derelativizing the destination write
masks for system value signature elements, so we fix that to make it
consistent with how other front-ends are handled.

For instance, when the test introduced in commit
ca5bc63e5e is compiled to DXIL using DXC,
and then parsed using vkd3d-compiler, we get the following store
instructions:

    vs_6_0
    .input
    .param POSITION.xyzw, v0.xyzw, float
    .output
    .param SV_Position.xyzw, o0.xyzw, float, POS
    .param SV_CullDistance.x, o1.x, float, CULLDST
    .param SV_ClipDistance.y, o1.y, float, CLIPDST
    .descriptors
    .text
    label l1
        ...
        mov o1.x <v4:f32>, sr1 <s:f32>
        mov o2.x <v4:f32>, sr2 <s:f32> // Note the .x write mask!
        ret

whereas, when compiling using FXC and parsing the TPF using
vkd3d-compiler we get:

    vs_4_0
    .input
    .param POSITION.xyzw, v0.xyzw, float
    .output
    .param SV_POSITION.xyzw, o0.xyzw, float, POS
    .param SV_CULLDISTANCE.x, o1.x, float, CULLDST
    .param SV_CLIPDISTANCE.y, o1.y, float, CLIPDST
    .descriptors
    .text
    label l1
        mov o0.xyzw <v4:f32>, v0.xyzw <v4:f32>
        mov o1.x <v4:f32>, v0.x <v4:f32>
        mov o2.y <v4:f32>, v0.y <v4:f32> // Note the .y write mask.
        ret

This only really matters for cases where we have a system value semantic
whose mask doesn't start at .x, which is very rare. For instance, it
requires the clip/cull distance combo, which share registers, so one of
them pushes the other to start on another component.

According to the tests, the only thing relying on this behaviour is the
handling of private variables for system value semantics on the SPIR-V
backend, which expects destination write masks as if the element started
at .x even though it might not. This is modified then.
2025-10-29 13:14:54 +01:00
Giovanni Mascellani
b3f5bfdb7e vkd3d-shader/msl: Retrieve the CBV register space from the descriptor information. 2025-10-28 16:46:33 +01:00
Giovanni Mascellani
957c6728f1 vkd3d-shader/msl: Return a raw index from msl_get_binding().
In the future that will involve some computation, and it will not
necessarily correspond to a struct vkd3d_shader_descriptor_binding
object.
2025-10-28 16:42:14 +01:00
Giovanni Mascellani
491fecc6a3 vkd3d-shader/msl: Introduce msl_get_binding(). 2025-10-28 16:36:33 +01:00
Elizabeth Figura
94c9595196 vkd3d-shader/hlsl: Use replace_ir() for fold_conditional_identities(). 2025-10-28 16:30:49 +01:00
Elizabeth Figura
1f40222a0d vkd3d-shader/hlsl: Use replace_ir() for hlsl_fold_constant_exprs(). 2025-10-28 16:30:49 +01:00
Elizabeth Figura
6e8eeb8f7a vkd3d-shader/hlsl: Use replace_ir() for hlsl_fold_constant_identities(). 2025-10-28 16:30:49 +01:00
Elizabeth Figura
bdb31a4983 vkd3d-shader/hlsl: Use replace_ir() for hlsl_fold_constant_swizzles(). 2025-10-28 16:30:49 +01:00
Elizabeth Figura
deb7a67d67 vkd3d-shader/hlsl: Introduce hlsl_block_add_constant(). 2025-10-28 16:30:49 +01:00
Giovanni Mascellani
6654b88407 vkd3d-shader/ir: Check that no modifier is added to a vsir program after lowering. 2025-10-27 18:48:33 +01:00
Giovanni Mascellani
b41e99c036 vkd3d-shader/ir: Use VSIR_OP_SATURATE in insert_fragment_fog_before_ret(). 2025-10-27 18:43:33 +01:00
Giovanni Mascellani
d503fbfd79 vkd3d-shader/ir: Use VSIR_OP_SATURATE in vsir_program_normalise_ps1_output(). 2025-10-27 18:43:33 +01:00
Giovanni Mascellani
617ebb9826 vkd3d-shader/ir: Explicitly assert that vsir_program_normalise_ps1_output() runs before I/O normalization. 2025-10-27 18:43:33 +01:00
Giovanni Mascellani
c1991ba785 vkd3d-shader/ir: Use VSIR_OP_SATURATE in vsir_program_lower_texcoord(). 2025-10-27 18:43:33 +01:00
Elizabeth Figura
98ca1ecbda vkd3d-shader: Lower TEXBEML instructions. 2025-10-27 18:23:20 +01:00
Elizabeth Figura
02b0a754bd vkd3d-shader: Lower TEXBEM instructions. 2025-10-27 18:14:13 +01:00
Elizabeth Figura
5363730e17 vkd3d-shader: Lower BEM instructions.
This requires an interface to specify bump mapping constants.
2025-10-27 18:06:26 +01:00
Elizabeth Figura
24d84e2ee2 vkd3d-shader/spirv: Allow swizzling parameters.
This was previously not a concern, since all of our parameter usage involved
trivial swizzles and write masks, but bump parameters will not.
2025-10-27 17:35:14 +01:00