Giovanni Mascellani
1f536238a8
vkd3d-shader: Use 64 bit swizzles for 64 bit data types in VSIR.
...
The handling of write masks and swizzles for 64 bit data types is
currently irregular: write masks are always 64 bit, while swizzles
are usually 32 bit, except for SSA registers with are 64 bit.
With this change we always use 64 bit swizzles, in order to make
the situation less surprising and make it easier to convert
registers between SSA and TEMP.
64 bit swizzles are always required to have X in their last two
components.
2024-01-29 22:33:33 +01:00
Conor McCarthy
3bbe374ca8
vkd3d-shader/dxil: Implement DX intrinsic Tertiary.
...
IBFE and UBFE are not emitted for HLSL sources which perform bitfield
extractions, e.g. loading a value from a struct containing bitfields, or
the equivalent done with bit shifts. These instructions are probably
only emitted by the TPF -> DXIL converter, which makes them hard to test.
2024-01-29 22:33:20 +01:00
Conor McCarthy
e08c0cfc4f
vkd3d-shader/dxil: Implement DX intrinsic RawBufferLoad.
2024-01-29 22:33:10 +01:00
Conor McCarthy
1bab93843d
vkd3d-shader/dxil: Load raw/structured buffer SRV/UAV descriptors.
2024-01-29 22:33:09 +01:00
Conor McCarthy
93d7c30395
vkd3d-shader/dxil: Handle DX intrinsic Tan in sm6_parser_emit_dx_unary().
2024-01-25 22:24:43 +01:00
Conor McCarthy
2a260b8d56
vkd3d-shader/dxil: Implement DX intrinsics Cos and Sin.
2024-01-25 22:24:41 +01:00
Conor McCarthy
41cce4cbf1
vkd3d-shader/dxil: Handle floating point special value comparisons in sm6_parser_emit_dx_unary().
2024-01-24 22:37:59 +01:00
Henri Verbeet
f3c7d2d05c
vkd3d-shader/ir: Store the block count in struct vsir_program.
2024-01-23 20:27:34 +01:00
Conor McCarthy
367a06d748
vkd3d-shader/dxil: Use strcmp() to find the handle type.
...
We use strcmp() on the same type name elsewhere, and case-insensitive
matching does not seem necessary.
2024-01-23 20:26:53 +01:00
Conor McCarthy
1cca18a228
vkd3d-shader/dxil: Use strcmp() to find function names.
...
Function names are case-sensitive.
2024-01-23 20:26:52 +01:00
Conor McCarthy
4dec25cbde
vkd3d-shader/dxil: Use strcmp() to check the entry point name.
...
Function names are case-sensitive.
2024-01-23 20:26:50 +01:00
Conor McCarthy
b3903636f7
vkd3d-shader/dxil: Implement DX intrinsic Binary.
2024-01-23 20:26:29 +01:00
Conor McCarthy
6c71cd5a72
vkd3d-shader/dxil: Add an operand type code for the return type.
2024-01-23 20:26:28 +01:00
Henri Verbeet
94ca46916a
vkd3d-shader/ir: Store the SSA register count in struct vsir_program.
2024-01-22 22:18:52 +01:00
Henri Verbeet
23dcd4f22b
vkd3d-shader/ir: Store the shader version in struct vsir_program.
2024-01-22 22:18:50 +01:00
Henri Verbeet
fc9043be3c
vkd3d-shader/ir: Introduce struct vsir_program.
2024-01-22 22:18:48 +01:00
Conor McCarthy
55c7cd5c22
vkd3d-shader/dxil: Handle semantic kind ISFRONTFACE.
2024-01-22 22:18:33 +01:00
Conor McCarthy
9f409b67d7
vkd3d-shader/dxil: Handle semantic kind VERTEXID.
2024-01-22 22:18:32 +01:00
Conor McCarthy
bfdc8b31a3
vkd3d-shader/dxil: Implement DX intrinsic BufferLoad for typed buffers.
2024-01-22 22:18:21 +01:00
Conor McCarthy
85052ba93e
vkd3d-shader/dxil: Load typed UAV descriptors.
2024-01-22 22:18:19 +01:00
Conor McCarthy
89d1ef83f4
vkd3d-shader/dxil: Load typed SRV descriptors.
2024-01-22 22:18:18 +01:00
Conor McCarthy
80d7ea2924
vkd3d-shader/dxil: Pass the code block and instruction in a struct to intrinsic handlers.
...
Simplifies handling of intrinsics which need to emit more than one
instruction.
2024-01-22 22:18:16 +01:00
Conor McCarthy
efe800f7f0
vkd3d-shader/dxil: Handle the DXIL SWITCH instruction.
2024-01-18 23:15:14 +01:00
Conor McCarthy
ba1ee27b4b
vkd3d-shader/dxil: Handle the DXIL PHI instruction.
2024-01-18 23:15:12 +01:00
Conor McCarthy
8a5804eb43
vkd3d-shader/dxil: Handle the DXIL BR instruction conditional variant.
2024-01-18 23:15:10 +01:00
Conor McCarthy
c9493884ef
vkd3d-shader/dxil: Handle the DXIL BR instruction unconditional variant.
2024-01-18 23:15:03 +01:00
Conor McCarthy
9e964fa0c7
vkd3d-shader/dxil: Introduce a code block terminator struct.
2024-01-18 23:15:01 +01:00
Conor McCarthy
559d9d4ee0
vkd3d-shader/ir: Include an initial label instruction in the first control flow block.
2024-01-17 22:28:41 +01:00
Conor McCarthy
b4b2b0d3ac
vkd3d-shader/spirv: Declare indexable temps as Private unless function scope is specified.
2024-01-17 22:28:39 +01:00
Giovanni Mascellani
7503429555
vkd3d-shader/ir: Check that TEMP registers have consistent dimensions.
2024-01-15 19:56:59 +01:00
Conor McCarthy
ac9b14599f
vkd3d-shader/dxil: Avoid null dereference on failure to find function pointer type.
...
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55684
2024-01-11 23:05:17 +01:00
Giovanni Mascellani
e29ae1550c
vkd3d-shader/dxil: Create constant buffer registers with dimension vec4.
2024-01-04 22:23:21 +01:00
Giovanni Mascellani
3bafee344d
vkd3d-shader/dxil: Use vkd3d_shader_parser_error() for error reporting when available.
2024-01-03 22:38:26 +01:00
Giovanni Mascellani
a02cd1cf64
vkd3d-shader/dxil: Do not use the parser before it is initialized.
2024-01-03 22:38:24 +01:00
Conor McCarthy
111818eabb
vkd3d-shader/dxil: Pre-allocate instruction space for globals in sm6_parser_globals_init().
...
For simplicity, declaration handlers assume instruction allocation will
not fail.
2024-01-03 22:38:21 +01:00
Conor McCarthy
8aa6e2228e
vkd3d-shader/dxil: Count global variables in dxil_block_compute_module_decl_count().
2024-01-03 22:38:19 +01:00
Henri Verbeet
ed4f3f3272
vkd3d-shader/ir: Rename the "immconst_double" field of struct vkd3d_shader_register to "immconst_f64".
2024-01-03 22:37:49 +01:00
Henri Verbeet
7f94fda05c
vkd3d-shader/ir: Rename the "immconst_uint64" field of struct vkd3d_shader_register to "immconst_u64".
2024-01-03 22:37:43 +01:00
Henri Verbeet
05a542ba00
vkd3d-shader/ir: Rename the "immconst_float" field of struct vkd3d_shader_register to "immconst_f32".
2024-01-03 22:37:41 +01:00
Henri Verbeet
e33d3b3954
vkd3d-shader/ir: Rename the "immconst_uint" field of struct vkd3d_shader_register to "immconst_u32".
...
For consistency with the rest of vkd3d-shader; e.g. put_u32() and
read_u32().
2024-01-03 22:37:39 +01:00
Conor McCarthy
1929432559
vkd3d-shader: Introduce an instruction flag to suppress masking of bitwise shift counts.
...
DXIL does not use implicit masking of shift counts.
2023-12-12 22:50:46 +01:00
Fabian Maurer
9cb4372378
vkd3d-shader/dxil: Check null pointer before it is dereferenced (Coverity).
2023-12-11 23:18:58 +01:00
Conor McCarthy
3db7c2a62d
vkd3d-shader/dxil: Implement the DXIL STORE instruction.
2023-12-11 23:18:51 +01:00
Conor McCarthy
2d5f2bf7a4
vkd3d-shader/dxil: Implement the DXIL ALLOCA instruction.
2023-12-11 23:18:50 +01:00
Zebediah Figura
d49bccea9a
vkd3d-shader/dxil: No longer synthesize DCL instructions.
2023-12-11 23:18:45 +01:00
Zebediah Figura
75348dff12
vkd3d-shader/dxil: Map SEMANTIC_KIND_TARGET to VKD3D_SHADER_SV_TARGET.
2023-12-11 23:18:43 +01:00
Conor McCarthy
a4a1b4c557
vkd3d-shader/dxil: Set the result register data type for nop casts.
...
Casts from minimum precision types are emitted as nop, but the result
value type must be set to the cast result type.
2023-12-07 21:57:08 +01:00
Conor McCarthy
1630fd9a3c
vkd3d-shader/dxil: Apply metadata attachments to instructions.
...
These are apparently only used for 'dx.op' intrinsics, because the
instructions based on native LLVM ones have their own way to apply
attributes.
2023-12-07 21:57:00 +01:00
Conor McCarthy
a33a9127ca
vkd3d-shader/dxil: Implement DX intrinsic Unary.
2023-12-07 21:56:53 +01:00
Conor McCarthy
cc5e703802
vkd3d-shader/dxil: Emit constant global arrays as immediate constant buffers.
2023-12-07 21:56:47 +01:00
Conor McCarthy
cb88844a3d
vkd3d-shader: Add a register index to struct vkd3d_shader_immediate_constant_buffer.
2023-12-07 21:56:47 +01:00
Conor McCarthy
ffae57eb8d
vkd3d-shader/dxil: Support null constant arrays.
2023-12-07 21:56:43 +01:00
Giovanni Mascellani
a52604da8c
vkd3d-shader/dxil: Declare IO registers as VEC4.
...
Otherwise, for instance, their write masks and swizzles are not written
in the D3D ASM dump.
2023-11-28 21:49:18 +01:00
Jacek Caban
1edbc05745
vkd3d-shader: Use unsigned int type for tags passed to sm6_metadata_get_uint_value.
2023-11-28 00:09:29 +01:00
Conor McCarthy
eb05e434ff
vkd3d-shader/dxil: Implement the DXIL LOAD instruction.
2023-11-22 22:07:59 +01:00
Conor McCarthy
59730ecfd8
vkd3d-shader/dxil: Implement the DXIL GEP instruction.
2023-11-22 22:07:58 +01:00
Conor McCarthy
a0f5d70792
vkd3d-shader/dxil: Support global variable initialisers.
2023-11-22 22:07:57 +01:00
Conor McCarthy
f2a656b876
vkd3d-shader/dxil: Introduce a value type for immediate constant buffers.
2023-11-22 22:07:56 +01:00
Conor McCarthy
85d5f83fb7
vkd3d-shader/dxil: Implement default address space global variables.
2023-11-22 22:07:54 +01:00
Conor McCarthy
3c4631a4d4
vkd3d-shader/dxil: Implement the DXIL VSELECT instruction.
2023-11-15 21:48:35 +01:00
Conor McCarthy
408f67c69c
vkd3d-shader/dxil: Handle missing flags as zero for CMP2.
...
The flag operand is omitted if IEEE strictness is specified.
2023-11-14 23:06:43 +01:00
Conor McCarthy
f1e9f40061
vkd3d-shader/dxil: Handle missing flags as zero for BINOP.
...
The flag operand is omitted if IEEE strictness is specified.
2023-11-14 23:06:41 +01:00
Nikolay Sivov
d190fdf8c5
vkd3d-shader/dxil: Fully initialize instruction data in sm6_parser_emit_extractval().
...
Noticed after test runner started crashing when tracing is enabled.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-11-13 23:19:18 +01:00
Nikolay Sivov
3203485a7c
vkd3d-shader: Fix some spelling mistakes.
2023-11-13 23:19:15 +01:00
Conor McCarthy
22960753e9
vkd3d-shader/spirv: Introduce orderedness to comparison instructions.
2023-11-10 20:23:51 +01:00
Conor McCarthy
d3b90cc877
vkd3d-shader/dxil: Implement the DXIL CMP2 instruction.
2023-11-10 20:23:50 +01:00
Zebediah Figura
133e313800
vkd3d-shader/dxil: Do not use COLOROUT for PS outputs.
...
sm4 does not use this; only sm1 does. In following patches we will normalize it
to OUTPUT.
2023-11-09 21:14:49 +01:00
Conor McCarthy
90d178bf12
vkd3d-shader/dxil: Implement the DXIL CAST instruction.
2023-11-09 21:14:42 +01:00
Conor McCarthy
749df8dec2
vkd3d-shader/dxil: Implement the DXIL BINOP instruction.
2023-11-06 23:09:03 +01:00
Giovanni Mascellani
0d4aebd2e7
vkd3d-shader: Explicitly cast vkd3d_shader_global_flags to uint64_t.
...
On macOS vkd3d_shader_global_flags has underlying type unsigned long,
while uint64_t is defined as unsigned long long. This difference
causes a few warnings to be raised.
2023-11-06 23:08:37 +01:00
Conor McCarthy
7419f4e31d
vkd3d-shader/dxil: Allow empty struct types.
2023-11-02 18:23:12 +01:00
Conor McCarthy
7ca6a5452a
vkd3d-shader/dxil: Always apply the signature element start column to used_mask.
...
The used_mask value loaded from an additional tag/value pair is relative
to the start column.
2023-11-02 18:22:59 +01:00
Giovanni Mascellani
f3c1a15a6f
vkd3d-shader/dxil: Use vsir_register_init() to initialize registers.
2023-11-02 18:22:35 +01:00
Conor McCarthy
589670180a
vkd3d-shader/dxil: Implement the DXIL EXTRACTVAL instruction.
2023-11-01 21:47:34 +01:00
Conor McCarthy
43b5d73870
vkd3d-shader/dxil: Implement DX instruction CBufferLoadLegacy.
2023-11-01 21:47:32 +01:00
Conor McCarthy
3b1bbe2b0a
vkd3d-shader/dxil: Implement DX instruction CreateHandle.
2023-11-01 21:47:30 +01:00
Conor McCarthy
f57d65361a
vkd3d-shader/dxil: Replace register_address_init() with register_index_address_init().
...
Makes it much clearer which register index is being written.
2023-11-01 21:47:29 +01:00
Conor McCarthy
b7b128595e
vkd3d-shader/dxil: Read CBV descriptors.
2023-10-19 23:07:45 +02:00
Conor McCarthy
f7525bf0c6
vkd3d-shader/dxil: Validate the descriptor list metadata nodes.
2023-10-19 23:07:42 +02:00
Conor McCarthy
85c165ff39
vkd3d-shader/dxil: Read DXIL compute shader thread group dimensions.
2023-10-17 22:18:26 +02:00
Conor McCarthy
4b7ca0c294
vkd3d-shader/dxil: Read DXIL global flags.
2023-10-17 22:18:25 +02:00
Conor McCarthy
e0d0a04b79
vkd3d-shader/dxil: Handle multi-row signature elements.
2023-10-16 22:36:38 +02:00
Conor McCarthy
7113064a19
vkd3d-shader/dxil: Handle signature element additional tag/value pairs.
2023-10-16 22:36:36 +02:00
Conor McCarthy
8648ca0e77
vkd3d-shader/dxil: Read the DXIL input and output signatures.
...
These can differ from the DXBC signatures by having multiple rows, and
load/store instructions reference them by id instead of register index.
2023-10-16 22:36:29 +02:00
Conor McCarthy
62badbff7a
vkd3d-shader/dxil: Validate the entry point info.
2023-10-16 22:36:28 +02:00
Conor McCarthy
6034f4a976
vkd3d-shader/dxil: Read DXIL metadata named nodes.
2023-10-12 18:23:33 +02:00
Conor McCarthy
4ac201788d
vkd3d-shader/dxil: Read DXIL metadata kinds.
2023-10-12 18:23:32 +02:00
Conor McCarthy
cba3e18c45
vkd3d-shader/dxil: Read DXIL metadata values.
2023-10-12 18:23:31 +02:00
Conor McCarthy
5817fabc30
vkd3d-shader/dxil: Read DXIL metadata nodes.
2023-10-12 18:23:30 +02:00
Conor McCarthy
a62343f544
vkd3d-shader/dxil: Read DXIL metadata strings.
2023-10-12 18:23:29 +02:00
Conor McCarthy
05d516bb00
vkd3d-shader/dxil: Emit an error on allocation failure in dxil_record_to_string().
2023-10-11 22:21:22 +02:00
Conor McCarthy
52dc6f252c
vkd3d-shader/dxil: Read global constants in sm6_parser_globals_init().
...
These are needed for reading metadata.
2023-10-11 22:21:20 +02:00
Conor McCarthy
df4e1b7393
vkd3d-shader/dxil: Read immediate constant arrays.
2023-10-11 22:21:19 +02:00
Conor McCarthy
f61c853f61
vkd3d-shader/dxil: Convert into an error the warning for an unhandled instrinsic.
2023-09-26 22:07:51 +02:00
Conor McCarthy
b30b95e824
vkd3d-shader/dxil: Do not access null code blocks on failure.
2023-09-26 22:07:50 +02:00
Francisco Casas
e904660497
vkd3d-shader: Turn vkd3d_shader_register.immconst_type into vkd3d_shader_register.dimension.
2023-09-26 22:07:04 +02:00
Francisco Casas
5d6899888d
vkd3d-shader: Rename shader_register_init() to vsir_register_init().
2023-09-26 22:06:50 +02:00
Conor McCarthy
6ec5e5bf54
vkd3d-shader/dxil: Implement DX instruction LoadInput.
2023-09-25 22:07:09 +02:00
Conor McCarthy
644a06dcca
vkd3d-shader/dxil: Declare shader inputs.
2023-09-25 22:07:08 +02:00
Giovanni Mascellani
c052cd8998
vkd3d-shader/ir: Introduce a boilerplate to validate the generated IR.
...
For the moment the validator is trivial, it never fails. Checks will
be added incrementally.
2023-09-22 11:06:13 +02:00