Commit Graph

8492 Commits

Author SHA1 Message Date
Giovanni Mascellani
54aa285b30 ci: Set the macOS runner timeout to ten minutes.
This looks more than enough even for MRs with ten commits.
2025-11-26 16:08:38 +01:00
Conor McCarthy
cb8da3125b vkd3d: Implement sampler min/max reduction filtering. 2025-11-26 16:06:24 +01:00
Henri Verbeet
dc7cdec9a5 tests/hlsl: Add a sampler min/max reduction filtering test.
The Metal runner could in principle support this feature using
MTLSamplerDescriptor.reductionMode, but that requires macOS 26.0/Tahoe,
which is newer than my current setup.
2025-11-26 16:06:24 +01:00
Henri Verbeet
1007ba40b5 vkd3d-shader: Introduce vkd3d_shader_string_from_message_context().
It's main advantage over vkd3d_shader_message_context_copy_messages() is
that it can't fail. The original issue this addresses is that
vkd3d_shader_compile() should free its output when
vkd3d_shader_message_context_copy_messages() fails, as spotted by
Giovanni; that likely would have applied to a number of the other uses
of vkd3d_shader_message_context_copy_messages() as well.
2025-11-26 16:05:42 +01:00
Evan Tang
96872b941e tests/d3d12: Add some missing UAV barriers after UAV clears.
Much like e.g. commits a686fa7750 and
93d2bb2d5d.

Direct3D 12 doesn't guarantee any implicit barriers after UAV clears,
but unfortunately missing these is often easy to go unnoticed.
2025-11-25 20:33:52 +01:00
Elizabeth Figura
647482b6f4 vkd3d-shader/hlsl: Avoid creating "index-val" synthetic temps if we can detect the variable was unmodified. 2025-11-25 20:23:19 +01:00
Elizabeth Figura
26a6272073 vkd3d-shader/hlsl: Handle HLSL_CLASS_VECTOR in hlsl_regset_index_from_deref().
Loads of components of vectors (i.e. functionally a subset of SWIZZLE
instructions, but expressed using LOAD) are legal, and generated elsewhere.
Due to circumstances they never reach this point currently, but we shouldn't use
vkd3d_unreachable() here.
2025-11-25 20:23:19 +01:00
Elizabeth Figura
73c8529e6e vkd3d-shader/hlsl: Calculate the bind count from the vector width.
Scalars have a reg_size of 4 on sm1. In the case of a deref of a vector or
matrix resulting in a scalar, however, this yields a required_bind_count that is
one higher than it should be. reg_size is the wrong thing to be using here,
since it describes the size of a type in isolation, but this is conceptually an
embedded type that doesn't include any padding. Since we're only dealing with
scalars and vectors here, just use their width.
2025-11-25 20:23:19 +01:00
Giovanni Mascellani
8a0e578f64 tests/d3d12: Avoid a warning about passing a pointer to a const uninitialized object.
I've seen this with clang version 21.1.5.
2025-11-25 20:22:08 +01:00
Giovanni Mascellani
2215117d72 tests/shader_runner_vulkan: Support explicit descriptor mapping. 2025-11-25 20:19:54 +01:00
Francisco Casas
7b1b52df02 vkd3d-shader/spirv: Remove the unused "array_element_mask field" from struct vkd3d_shader_output_info. 2025-11-25 19:58:45 +01:00
Francisco Casas
41c593ef46 tests/hlsl: Test clip/cull distance semantics as arrays.
Arrays are allowed for clip/cull distance semantics. Their maximum size
is 2 since that's the maximum amount of registers allowed for clip/cull
distances.

Indirect addressing of these arrays is allowed on shader model 6.

These tests are introduced after the transformation of clip/cull
input/outputs into arrays in vsir since otherwise they segfault.
2025-11-25 19:58:24 +01:00
Henri Verbeet
60fc072877 vkd3d-shader/ir: Move "has_descriptor_info" and "has_no_modifiers" to struct vsir_normalisation_flags. 2025-11-25 19:49:28 +01:00
Francisco Casas
0dabfdee63 vkd3d-shader/ir: Transform clip/cull inputs/outputs into arrays.
Takes care of transforming clip/cull system values from the Direct3D
convention of 2 4-component registers, into the SPIR-V/GLSL convention
of 8-element scalar float arrays.

This fixes SPIR-V validation errors in clip-cull-distance.shader_test,
as well as segfaults on Mesa 25.1.1-arch1.2 if those shaders are
executed regardless.

We create indexable temporaries of the appropriate size, and replace
accesses to clip/cull I/O signature elements with accesses to those
temporaries. The existing clip/cull signature elements are then replaced
with new scalar signature element arrays, and we copy the contents of
those I/O signature elements to/from the corresponding temporaries at
the start/end of the vsir program.

It is worth pointing out that the current implementation assumes that
every instance of the control point phase of a hull shader only writes
to the output registers of its control point, given by
vOutputControlPointID, and not to other control points. Shader
compilation will fail if that constraint is violated.
2025-11-25 19:49:11 +01:00
Francisco Casas
85b7b9c6b4 vkd3d-shader/ir: Introduce vsir_signature_element_is_array(). 2025-11-25 19:45:19 +01:00
Francisco Casas
1307659e74 vkd3d-shader/ir: Assign new register indexes to clip plane signature elements. 2025-11-25 17:24:29 +01:00
Francisco Casas
e00bc4b91b vkd3d-shader/ir: Introduce vsir_opcode_is_control_point_phase(). 2025-11-25 17:01:59 +01:00
Francisco Casas
59ba079ebb vkd3d-shader/ir: Introduce vsir_opcode_is_fork_or_join_phase(). 2025-11-25 17:01:12 +01:00
Francisco Casas
e23b3c84f6 tests/hlsl: Test clip distance semantic indexes above the 0-1 range. 2025-11-25 15:54:40 +01:00
Francisco Casas
583016e550 tests/hlsl: Test clip/cull distance inputs. 2025-11-25 15:50:51 +01:00
Giovanni Mascellani
e9d08df010 vkd3d-shader/dxil: Check the fields of well-known structure types.
The main reason is to avoid making false assumptions in the code.
I don't know how that could be used, say, to introduce a security
bug, but I think validating untrusted input should be done by
default.

Conveniently this also acts as documentation for who needs to know
what fields we indeed expect to find in a well-known structure.
2025-11-24 19:03:29 +01:00
Henri Verbeet
3431c006ae tests/hlsl: Avoid sampling on texel edges in ps1-projection.shader_test.
In the projected case, (1.2, 0.5) divided by 2.0 results in (0.6, 0.25) as
effective coordinates. The 0.25 y-coordinate is well within the second row of
texels; that's fine. On the other hand, the 0.6 x-coordinate falls right
between the third and fourth column of texels. The test expects the fourth
column to be selected, but that's very fragile: neither 1.2 nor 0.6 can be
exactly represented as a 32-bit floating-point value, and it only takes a
single ulp to push things to the other side of the edge.
2025-11-24 18:54:54 +01:00
Evan Tang
a5ac959cf5 vkd3d: Add barriers between render passes to the same image. 2025-11-24 18:01:00 +01:00
Giovanni Mascellani
f47f712164 tests/hlsl: Test SM6.6 dynamic resources. 2025-11-24 17:38:14 +01:00
Giovanni Mascellani
d380bc196f tests/shader_runner: Use SHADER_MODEL_MAX to represent the maxium supported shader model. 2025-11-24 17:14:24 +01:00