Commit Graph

615 Commits

Author SHA1 Message Date
Elizabeth Figura
322c91e3f8 vkd3d-shader/ir: Introduce a vsir DCE pass. 2025-10-06 14:38:32 +02:00
Conor McCarthy
2d508a2fa6 vkd3d-shader: Set the program block count to the maximum for any function.
The block count is intended to be used for allocation of block info.
2025-10-03 00:22:03 +02:00
Francisco Casas
da4d5ef339 vkd3d-shader/dxil: Get rid of sm6_parser_require_space().
It's not obvious what this last remaining use of
sm6_parser_require_space() is preallocating space for, and that's as
good of a reason as any to get rid of it.
2025-10-03 00:10:06 +02:00
Francisco Casas
1512c6c809 vkd3d-shader/dxil: Set the parser status to VKD3D_ERROR_NOT_IMPLEMENTED on missing functionality. 2025-10-02 23:47:50 +02:00
Francisco Casas
aa943c51ea vkd3d-shader/dxil: Handle sm6_parser_add_instruction() returning NULL.
Only calls to sm6_parser_add_instruction() where we are using the
returned vkd3d_shader_instruction are checked for, since these return
values might cause NULL dereferences if unchecked.

Other calls to sm6_parser_add_instruction() can be left alone since the
error is still recorded via sm6->p.status.
2025-10-02 23:40:56 +02:00
Francisco Casas
bdba25d028 vkd3d-shader: Store a vkd3d_result in struct vkd3d_shader_parser. 2025-10-02 23:40:51 +02:00
Francisco Casas
27dffc9f4e vkd3d-shader/ir: Use a vkd3d_shader_instruction_array in struct cf_flattener. 2025-09-29 12:30:22 +02:00
Francisco Casas
e935e06e23 vkd3d-shader/ir: Introduce shader_instruction_array_append(). 2025-09-29 11:58:59 +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
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
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
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
Henri Verbeet
81f229146c vkd3d-shader/ir: Handle all component types in vsir_data_type_from_component_type(). 2025-09-10 11:42:21 +02:00
Henri Verbeet
db704d2980 vkd3d-shader/spirv: Handle i64 component types. 2025-09-10 11:42:21 +02:00
Francisco Casas
434d9dd117 vkd3d-shader/ir: Use iterators in flattener_flatten_phases(). 2025-09-09 14:24:06 +02:00
Henri Verbeet
bceb4d17ed vkd3d-shader/ir: Move the instruction array helpers to ir.c. 2025-09-09 14:17:51 +02:00
Henri Verbeet
6607b94ad7 vkd3d-shader/ir: Map 16-bit vsir types to 16-bit component types in vkd3d_component_type_from_data_type().
Mapping these to 32-bit types if needed is supposed to happen in the
frontends now.
2025-09-08 12:34:16 +02:00
Henri Verbeet
2aefcf5d99 vkd3d-shader/dxil: Use vkd3d_shader_parser_error() to report errors in vsir_data_type_from_dxil(). 2025-09-03 13:04:21 +02:00
Henri Verbeet
9f2e122239 vkd3d-shader/ir: Introduce vsir_data_type_get_name(). 2025-09-02 11:35:33 +02:00
Francisco Casas
9e72d8acb8 vkd3d-shader/ir: Introduce vsir_program_iterator_insert_before_and_move(). 2025-08-29 14:22:39 +02:00
Henri Verbeet
3b41d99fa9 vkd3d-shader/tpf: Store a pointer to the vsir program in struct vkd3d_shader_sm4_parser. 2025-08-21 16:28:28 +02:00
Henri Verbeet
9336b4647c vkd3d-shader/d3d-asm: Resolve SSA values when outputting SM<6 assembly.
In particular, since commit eaebef4265 we
may receive vsir generated from HLSL sources, which typically contains
SSA values.
2025-08-13 15:55:31 +02:00
Henri Verbeet
8334386d99 vkd3d-shader/spirv: Avoid emitting duplicate built-in inputs in spirv_compiler_emit_input().
This works around an issue introduced by commit
66cb2815f0. SV_PRIMITIVE_ID inputs in
geometry shaders use VKD3DSPR_PRIMID registers, and we create the
corresponding SPIR-V inputs using spirv_compiler_emit_io_register().
Unfortunately we also have an input signature element for the same
input, and simply creating another PrimitiveId input would run into
VUID-StandaloneSpirv-OpEntryPoint-09658.

Before the commit mentioned above, we'd use DCL_INPUT instructions to
emit input declarations, and these would help to distinguish whether
VKD3DSPR_INPUT or VKD3DSPR_PRIMID registers were used for primitive ID
inputs. Note that we can't simply ignore input signature element with
SIGNATURE_TARGET_LOCATION_UNUSED; the DXIL parser emits SV_SAMPLE_INDEX
inputs with that target location, but does require them to use a
VKD3DSPR_INPUT register.
2025-08-13 15:54:12 +02:00
Henri Verbeet
f95fc28851 vkd3d-shader/hlsl: Return a vsir program from hlsl_compile_shader().
This largely brings the HLSL frontend in line with the other frontends.
2025-08-07 20:40:01 +02:00
Henri Verbeet
7c37fc6a8b vkd3d-shader: Introduce struct vkd3d_shader_source_list. 2025-08-07 20:33:24 +02:00