Commit Graph

6654 Commits

Author SHA1 Message Date
Henri Verbeet
df86a2842a vkd3d-shader/msl: Implement VKD3DSIH_DCL_OUTPUT. 2024-11-20 14:40:10 +01:00
Feifan He
9e3b8ec98a vkd3d-shader/msl: Output the generated shader code. 2024-11-20 14:40:10 +01:00
Henri Verbeet
2669ae16ea vkd3d-shader/msl: Implement VKD3DSIH_DCL_OUTPUT_SIV. 2024-11-20 14:40:10 +01:00
Henri Verbeet
e6acf3090d vkd3d-shader/msl: Implement VKD3DSIH_DCL_INPUT. 2024-11-20 14:40:10 +01:00
Feifan He
40cccaccea tests/shader_runner_metal: Implement graphics shader compilation. 2024-11-20 14:40:10 +01:00
Feifan He
7a1d36ba05 vkd3d-shader/msl: Use pointers for constant buffer descriptors.
[[id]] attributes can not be applied to union references.
2024-11-20 14:40:10 +01:00
Feifan He
b29f1e6cdc vkd3d-shader/msl: Add the missing output register index in msl_generate_entrypoint_epilogue(). 2024-11-20 14:40:10 +01:00
Henri Verbeet
c246c8db79 tests/shader_runner_metal: Get rid of some stray semicolons. 2024-11-20 14:40:10 +01:00
Elizabeth Figura
0dc07f5cce vkd3d-shader: Silence a spurious -Wmaybe-uninitialized in vsir_program_insert_alpha_test(). 2024-11-14 14:12:13 +01:00
Elizabeth Figura
683e11aece vkd3d-shader/hlsl: Silence a spurious -Wmaybe-uninitialized in sm4_generate_vsir_instr_dcl_semantic(). 2024-11-14 14:12:13 +01:00
Giovanni Mascellani
72394d9ae3 vkd3d: Use WARN rather than ERR in vkd3d_instance_init().
ERR is used to indicate internal inconsistencies in vkd3d. Here that's
not the case, we simply have to forward the error condition to the
caller.

This fixes failures on the CI with llvmpipe, because the build we use is
compiled without support for VK_KHR_surface and related extensions.
2024-11-14 14:09:04 +01:00
Giovanni Mascellani
c010fb63a1 ci: Update Mesa to version 24.2.4.
This fixes a number of CI failures with llvmpipe.
2024-11-13 16:23:45 +01:00
Giovanni Mascellani
4c9821e5d5 tests: Mark a conditional rendering test as buggy on llvmpipe.
Similarly to RADV, this is a kind of perverted situation: in
principle Vulkan doesn't allow vkCmdResolveImage() to be
executed conditionally (i.e., it is unaffected by conditional
execution), which means that vkd3d cannot implement conditional
rendering for ResolveSubresource(), hence the todo. However,
like RADV, llvmpipe apparently violates the specification and
still executes the image resolution command conditionally. So
that's a llvmpipe bug, even if one that helps us doing the right
thing.
2024-11-13 16:19:06 +01:00
Henri Verbeet
92fa68cb07 tests/shader_runner: Slightly simplify dxc handling. 2024-11-13 16:18:36 +01:00
Conor McCarthy
2996ad6bd2 vkd3d-shader/dxil: Implement DX intrinsic SampleIndex. 2024-11-13 16:18:13 +01:00
Nikolay Sivov
21681489ed vkd3d-shader/fx: Implement parsing states objects.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-11-13 16:15:09 +01:00
Conor McCarthy
3d53d90d4b vkd3d-shader/ir: Add a secondary sort by sysval for signature element register merges.
Fixes output signature normalisation failures in Silent Hill 2 caused by
failure of shader_signature_find_element_for_reg().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=57359
2024-11-13 13:32:32 +01:00
Giovanni Mascellani
7412e66064 vkd3d-shader/spirv: Get rid of the "offset_component_count" field of struct vkd3d_spirv_resource_type.
The number of components needed for texel offsets is the number of
components needed to address a single image/layer of an array. I.e.,
"coordinate_component_count - 1" for array textures, and
"coordinate_component_count" for non-array textures.

This change will also fix sampling of cube textures with explicit
gradients. Because texel offsets are unsupported for cube textures,
"offset_component_count" is currently 0 for cube textures. However, the
SAMPLE_GRAD handler also uses "offset_component_count" to determine the
number of components needed for the explicit gradients, and SAMPLE_GRAD
is supposed to work with cube textures.

This commit fixes the compilation of shaders in Star Wars Jedi:
Survivor.
2024-11-12 19:12:47 +01:00
Giovanni Mascellani
c34dc81753 tests: Remove some todo markings on MoltenVK in interface-packing.shader_test.
I have to admit I'm not even sure of why most of those got marked
as todo in the first place. Running again now tests on commit
dff7c0e7b8 doesn't show all those
failures.
2024-11-11 15:55:11 +01:00
Giovanni Mascellani
a89ceb6590 tests/shader_runner_vulkan: Avoid using ok() for shader compilation failues in create_graphics_pipeline().
Using ok() may result in todo's succeeding when create_shader_stage()
succeeds, but vkCreateGraphicsPipelines() fails. There's not much point
in using ok() here in the first place though, because ultimately the
draw operation is going to fail when shader compilation failed.
2024-11-11 15:54:21 +01:00
Giovanni Mascellani
94900131a8 tests: Mark a couple of tests in register-reservations-numeric.shader_test as todo with MSL. 2024-11-11 15:25:02 +01:00
Henri Verbeet
756b98f093 vkd3d-shader/glsl: Implement VKD3DSIH_LD2DMS. 2024-11-06 22:57:12 +01:00
Henri Verbeet
ca42adbf6b vkd3d-shader/glsl: Handle SV_SAMPLE_INDEX inputs. 2024-11-06 22:56:02 +01:00
Henri Verbeet
3dbaf11f8c vkd3d-shader/glsl: Implement support for static texel offsets in shader_glsl_sample(). 2024-11-06 22:55:36 +01:00
Henri Verbeet
6ae4da02c9 vkd3d-shader/glsl: Implement VKD3DSIH_GATHER4_PO. 2024-11-06 22:53:55 +01:00
Henri Verbeet
466d849c72 vkd3d-shader/glsl: Implement support for VKD3D_SHADER_COMPONENT_INT outputs. 2024-11-06 22:53:31 +01:00
Francisco Casas
5df836c513 vkd3d-shader/hlsl: Store SM4 MOD in the vsir program. 2024-11-06 22:49:12 +01:00
Francisco Casas
30bc6965a2 vkd3d-shader/hlsl: Store SM4 DOT in the vsir program. 2024-11-06 22:48:13 +01:00
Francisco Casas
e8b373e3ff vkd3d-shader/hlsl: Store SM4 DIV in the vsir program. 2024-11-06 22:47:42 +01:00
Francisco Casas
24f4308982 vkd3d-shader/hlsl: Store SM4 MUL in the vsir program. 2024-11-06 22:45:46 +01:00
Francisco Casas
e4d36bd855 vkd3d-shader/hlsl: Store SM4 SAT in the vsir program. 2024-11-06 22:45:23 +01:00
Francisco Casas
2e3f4a01bf vkd3d-shader/hlsl: Store SM4 RCP in the vsir program. 2024-11-06 22:40:50 +01:00
Francisco Casas
3c4889add3 vkd3d-shader/hlsl: Store SM4 SIN and COS in the vsir program. 2024-11-06 22:38:04 +01:00
Francisco Casas
befba8e813 vkd3d-shader/hlsl: Store SM4 casts in the vsir program. 2024-11-06 22:27:49 +01:00
Giovanni Mascellani
026624a266 tests: Work around a Metal bug in switch.shader_test.
The Metal bug was reported to Apple as FB15617433. Since we don't
care specifically about that bug, I'm just tweaking the test so that
it doesn't hit that bad path any more.
2024-11-06 22:15:09 +01:00
Giovanni Mascellani
7450c4a368 tests: Mark some tests in wave-reconvergence.shader_test as buggy on MoltenVK. 2024-11-06 22:15:09 +01:00
Giovanni Mascellani
ba5c3b576e tests: Use the appropriate RTV format in f32tof16.shader_test. 2024-11-06 22:15:09 +01:00
Giovanni Mascellani
5639b54c1b tests: Mark fog.shader_test as todo with MSL. 2024-11-06 22:15:09 +01:00
Nikolay Sivov
9af17d4a9d vkd3d-shader/fx: Implement parsing the remaining fx_5_0 object types.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-11-06 22:14:03 +01:00
Nikolay Sivov
e5ba79b4f1 vkd3d-shader/hlsl: Implement the ByteAddressBuffer.Load*() methods.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-11-06 22:09:23 +01:00
Nikolay Sivov
1a28e7d9c6 vkd3d-shader/hlsl: Add parser support for the ByteAddressBuffer type.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-11-06 21:56:27 +01:00
Nikolay Sivov
8438aacc3b vkd3d-shader/spriv: Only lookup resource symbols for UAVs in the ld_raw/ld_structured handler.
We don't need them for SRVs. Worse, if we're using a combined
resource/sampler pair for the SRV, a separate resource symbol may not
even exist.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-11-06 21:47:08 +01:00
Conor McCarthy
76fd1388d8 vkd3d: Check the IASetVertexBuffers() view count against the device limits.
For example, current MoltenVK only supports 31 vertex buffers.
2024-11-06 21:43:32 +01:00
Elizabeth Figura
fb8660c196 vkd3d-shader/ir: Add an is_pre_rasterization_shader() helper. 2024-11-05 20:00:27 +01:00
Elizabeth Figura
4290d85397 vkd3d-shader/hlsl: Write all writemask components for PSIZE and FOG outputs.
Matching fxc/d3dcompiler.
2024-11-05 19:58:49 +01:00
Elizabeth Figura
a10ee075ff vkd3d-shader/ir: Force fog and point size to 1 component when normalizing I/O. 2024-11-05 19:57:41 +01:00
Elizabeth Figura
5a513ffcec vkd3d-shader/hlsl: Enforce FOG component count for sm1 VS output. 2024-11-05 19:53:24 +01:00
Elizabeth Figura
f50b20ddd6 vkd3d-shader/hlsl: Enforce PSIZE component count for sm1 VS output. 2024-11-05 19:53:24 +01:00
Elizabeth Figura
aa1ce9e295 tests: Add some tests for FOG and PSIZE writemask restrictions. 2024-11-05 19:53:24 +01:00
Francisco Casas
90a07ada8e vkd3d-shader/tpf: Use SCALAR swizzle dimension for RASTERIZER registers.
While we currently output instructions like this:

    sampleinfo_uint r0.x, rasterizer.xxxx

    > SAMPLE_INFO (111)
    0  0000100[len:4]  0000000000001[1]  00001101111[opcode:111]
    └─ 0  000[d3i:0]  000[d2i:0]  000[d1i:0]  01[idxs:1]  00000000[type:0]  0000[0]  0001[wmask:1]  00[swtype:0]  10[dim:2]
       └─ 00000000000000000000000000000000[0|0.0]
    └─ 0  000[d3i:0]  000[d2i:0]  000[d1i:0]  00[idxs:0]  00001110[type:14]  00000000[sw:0]  01[swtype:1]  10[dim:2]

FXC/d3dcompiler outputs instructions like this:

    sampleinfo o0.x, rasterizer.x

    > SAMPLE_INFO (111)
    0  0000100[len:4]  0000000000000[0]  00001101111[opcode:111]
    └─ 0  000[d3i:0]  000[d2i:0]  000[d1i:0]  01[idxs:1]  00000010[type:2]  0000[0]  0001[wmask:1]  00[swtype:0]  10[dim:2]
       └─ 00000000000000000000000000000000[0|0.0]
    └─ 0  000[d3i:0]  000[d2i:0]  000[d1i:0]  00[idxs:0]  00001110[type:14]  000000[0]  00[swcomp:0]  10[swtype:2]  10[dim:2]

Note the difference in swtype of the rasterizer src register.
2024-11-05 19:50:55 +01:00