Commit Graph

607 Commits

Author SHA1 Message Date
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
Elizabeth Figura
a4f69d4ae6 vkd3d-shader/d3dbc: Move TEXLD lowering to d3dbc_parse(). 2025-08-07 18:52:46 +02:00
Francisco Casas
6dc9ff1bd8 vkd3d-shader/ir: Use iterators in vsir_program_ensure_diffuse().
The change in vsir_program_iterator_next() is necessary to allow us to
introduce instructions before the iterator using:

    vsir_program_iterator_prev(&it);
    vsir_program_iterator_inset_after(&it, n);
    vsir_program_iterator_next(&it);

This since (it.idx == SIZE_MAX) is equivalent to the iterator being
before the beginning of the list.
2025-08-06 12:53:37 +02:00
Henri Verbeet
dbaecb3f36 vkd3d-shader/hlsl: Introduce hlsl_compile_effect().
The goal being to allow hlsl_compile_shader() to return a vsir program.
2025-07-29 13:14:30 +02:00
Giovanni Mascellani
247fbd869a vkd3d-shader/ir: Use iterators in vsir_program_ensure_ret(). 2025-07-29 13:12:58 +02:00
Henri Verbeet
eaebef4265 vkd3d-shader/hlsl: Emit vsir from hlsl_emit_bytecode(). 2025-07-28 16:10:15 +02:00
Henri Verbeet
a4c25b81c5 vkd3d-shader/hlsl: Get rid of the "hlsl" argument to hlsl_compile_shader(). 2025-07-23 17:25:19 +02:00
Henri Verbeet
795211141f vkd3d-shader/ir: Rename VKD3D_DATA_BOOL to VSIR_DATA_BOOL. 2025-07-23 17:19:28 +02:00
Henri Verbeet
aebe64ecac vkd3d-shader/ir: Rename VKD3D_DATA_UNUSED to VSIR_DATA_UNUSED. 2025-07-23 17:19:28 +02:00