Commit Graph

6336 Commits

Author SHA1 Message Date
Giovanni Mascellani
c2ff59e80b vkd3d-shader/dxil: Allocate instructions directly in sm6_parser_emit_br(). 2025-12-03 15:15:59 +01:00
Giovanni Mascellani
2855f2d605 vkd3d-shader/dxil: Pass the function emission state to sm6_parser_emit_br(). 2025-12-03 15:15:59 +01:00
Giovanni Mascellani
83ebe58984 vkd3d-shader/dxil: Allocate instructions directly in sm6_parser_emit_binop(). 2025-12-03 15:15:59 +01:00
Giovanni Mascellani
5d51d89ef1 vkd3d-shader/dxil: Pass the function emission state to sm6_parser_emit_binop(). 2025-12-03 15:15:59 +01:00
Giovanni Mascellani
be31451ae9 vkd3d: Rename the struct vkd3d_device_descriptor_limits fields.
They do not represent the raw Vulkan resource limits, but the
emulated d3d12 limits depending on the Vulkan limits. Therefore
name them according to d3d12.
2025-12-03 15:14:16 +01:00
Giovanni Mascellani
443f4bc056 vkd3d: Remove unused field storage_buffer_max_descriptors from vkd3d_device_descriptor_limits. 2025-12-03 15:12:35 +01:00
Henri Verbeet
e0c23624f2 vkd3d-shader/ir: Lower VSIR_OP_LRP instructions. 2025-12-02 14:29:01 +01:00
Giovanni Mascellani
1e4764d555 vkd3d-shader/dxil: Parse the f32 denormalization mode. 2025-12-02 14:26:16 +01:00
Giovanni Mascellani
193cf51a59 vkd3d-shader/dxil: Set the attribute group count to zero if allocation fails. 2025-12-02 14:04:24 +01:00
Giovanni Mascellani
90a38d6c0e vkd3d-shader/dxil: Parse parameter attribute records. 2025-12-02 14:02:18 +01:00
Giovanni Mascellani
3058958d8b vkd3d-shader/dxil: Allocate instructions directly in sm6_parser_emit_atomicrmw(). 2025-12-02 13:39:44 +01:00
Giovanni Mascellani
eeb3592379 vkd3d-shader/dxil: Handle allocation failure in sm6_parser_emit_atomicrmw(). 2025-12-02 13:39:44 +01:00
Giovanni Mascellani
9457dc9c75 vkd3d-shader/dxil: Take the record from the function emission state in sm6_parser_emit_atomicrmw(). 2025-12-02 13:39:44 +01:00
Giovanni Mascellani
26f9644fb6 vkd3d-shader/dxil: Allocate instructions directly in sm6_parser_emit_alloca().
I think the main argument for preallocating instructions and
passing them to helpers is that this simplifies error handling.
However it seems that the simplification is close to negligible,
while the current solution makes it harder to use the iterator
abstraction layer for the instruction array, and it also makes
the code harder to read and check.
2025-12-02 13:39:44 +01:00
Giovanni Mascellani
3b9fbe3e4a vkd3d-shader/dxil: Pass function emission state to sm6_parser_emit_alloca(). 2025-12-02 13:39:44 +01:00
Giovanni Mascellani
6a3f360a2b vkd3d-shader/dxil: Move the function emission state outside the opcode switch. 2025-12-02 13:39:44 +01:00
Henri Verbeet
fdfb74b20b vkd3d-shader/ir: Lower VSIR_OP_NRM instructions. 2025-11-27 21:59:34 +01:00
Conor McCarthy
cb8da3125b vkd3d: Implement sampler min/max reduction filtering. 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
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
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
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