Commit Graph

736 Commits

Author SHA1 Message Date
Elizabeth Figura
d4cb6bf52d vkd3d-shader/ir: Validate BEM. 2025-09-22 11:33:35 +02:00
Elizabeth Figura
162578f505 vkd3d-shader/ir: Validate TEXTURE registers. 2025-09-22 11:32:32 +02:00
Giovanni Mascellani
52b9aa416b vkd3d-shader/ir: Fix r0 allocation for PS 1.x shaders.
In order to allocate it properly we have to ensure it is the first
register to be processed. The current algorithm fails to do so, so
a more explicit approach is introduced.
2025-09-19 12:48:50 +02:00
Henri Verbeet
21b5a2be8c vkd3d-shader/ir: Return early for shader model < 4 in vsir_update_dcl_temps(). 2025-09-19 12:48:08 +02:00
Henri Verbeet
72071fcf08 vkd3d-shader/ir: Avoid memset() in vsir_instruction_init().
Primarily to avoid -Warray-bounds warnings from newer gcc, specifically
for the first vsir_instruction_init() call in vsir_update_dcl_temps().
This seems to be a false positive created by the interaction between
vsir_program_iterator_insert_after() and vsir_program_iterator_next()
error handling; it may be possible to avoid that by rearranging things,
but it doesn't seem worth it.
2025-09-19 12:46:54 +02:00
Henri Verbeet
47f2ec1a08 vkd3d-shader/ir: Require default swizzles on vec4 immediate constants.
The SPIR-V, GLSL and MSL backends implicitly handle swizzles on
immediate constants, but the TPF and d3d-asm backends assume a default
swizzle. In principle there's no reason those couldn't support swizzles
on immediate constants, but they're a little pointless.
2025-09-18 11:35:05 +02:00
Henri Verbeet
a1451f8113 vkd3d-shader/ir: Require signed operands for IMIN instructions. 2025-09-18 11:30:20 +02:00
Henri Verbeet
8eebc71c13 vkd3d-shader/ir: Require signed operands for IMAX instructions. 2025-09-18 11:30:19 +02:00
Henri Verbeet
6e8192e198 vkd3d-shader/ir: Require signed source operands for signed integer comparison instructions. 2025-09-18 11:30:19 +02:00
Henri Verbeet
1912f50f52 vkd3d-shader/ir: Validate USHR instructions. 2025-09-18 11:30:18 +02:00
Henri Verbeet
31eb152917 vkd3d-shader/ir: Require signed operands for ISHR instructions. 2025-09-18 11:26:52 +02:00
Francisco Casas
d2d22c7af6 vkd3d-shader/ir: Move the source and destination operand allocators to struct vsir_program. 2025-09-17 12:31:49 +02:00
Francisco Casas
6ed78a0211 vkd3d-shader/ir: Store a pointer to the vsir program in struct control_point_normaliser.
We will move the dst_params and src_params fields from struct
vkd3d_shader_instruction_array to the vsir program next, so we need to
widen the scope of this pointer to the whole vsir program.
2025-09-17 12:19:56 +02:00
Francisco Casas
5278b8461f vkd3d-shader/ir: Store a pointer to the instruction array in struct control_point_normaliser.
We stop storing a shallow copy of the vsir_program.instructions on
control_point_normaliser.instructions since
vkd3d_shader_instruction_array is not meant to be copied by value, which
is evidenced by the fact that the struct has to always be copied back to
program->instructions before returning.
2025-09-17 12:19:56 +02:00
Francisco Casas
9323dc429c vkd3d-shader/ir: Move the outpointid_param field out of struct vkd3d_shader_instruction_array.
It is worth noting that previously, the case of
vsir_program_create_outpointid_param() failing on
sm6_parser_init_signature() wasn't properly handled.
2025-09-17 12:19:55 +02:00
Henri Verbeet
84b89f0675 vkd3d-shader/ir: Remove some unused fields from struct io_normaliser. 2025-09-17 12:18:28 +02:00
Francisco Casas
5a563ce05d vkd3d-shader/ir: Move icbs from struct vkd3d_shader_instruction_array to struct vsir_program. 2025-09-17 11:48:19 +02:00
Elizabeth Figura
32e64cafa5 vkd3d-shader/d3dbc: Lower TEXCOORD instructions. 2025-09-17 11:37:49 +02:00
Elizabeth Figura
5706834b37 vkd3d-shader/d3dbc: Lower TEX instructions. 2025-09-17 11:28:48 +02:00
Elizabeth Figura
b09a17ddde vkd3d-shader/d3dbc: Lower TEXTURE to TEMP registers when written. 2025-09-17 11:22:23 +02:00
Elizabeth Figura
2cf883d1dd vkd3d-shader/d3dbc: Move the error for unhandled d3dbc instructions to vsir_program_lower_d3dbc_instructions(). 2025-09-17 11:10:55 +02:00
Giovanni Mascellani
dddc92ccfd vkd3d-shader/ir: Use a faster TEMP allocation algorithm. 2025-09-16 16:14:23 +02:00
Giovanni Mascellani
92ac3b592b vkd3d-shader/ir: Introduce temp_allocator_compute_allocation_map().
This isolates computing the allocation map from modifying the program
itself, to make it easier to change the allocation algorithm.
2025-09-16 15:52:09 +02:00
Henri Verbeet
89641d3d42 vkd3d-shader/ir: Require signed source operands for ITOF instructions. 2025-09-16 15:46:23 +02:00
Henri Verbeet
8700e3a5bd vkd3d-shader/dxil: Allow returning signed types from vsir_data_type_from_dxil().
We have a number of vsir operations which should take a signed type, but
which the DXIL parser currently emits unsigned types for. For example,
ISHR.

In the SPIR-V backend, we translate ISHR to OpShiftRightArithmetic,
which is specified as filling the most-significant bits of the result
with the sign bit of the "Base" operand. For an unsigned type, that
would technically be 0. In practice, implementations like radv/Mesa seem
to fill with the most-significant bit of the "Base" operand for unsigned
types, but arguably that could be considered a bug. Alternatively, the
wording in the specification is just unfortunate; SPIR-V does generally
take the position that signedness of operands should be irrelevant for
almost all operations. Either way, it seems best to avoid using
OpShiftRightArithmetic with unsigned types.

For a target like MSL, allowing ISHR to take an unsigned source operand
is just inconvenient; we'd have to introduce bitcasts to achieve the
desired behaviour, instead of simply using msl_binop().
2025-09-16 15:46:23 +02:00