Giovanni Mascellani
9c678532a7
vkd3d-shader/ir: Dump the domination relationship.
2024-02-22 22:45:16 +01:00
Nikolay Sivov
656c068b32
vkd3d-shader/fx: Do not align strings for fx_4/fx_5 profiles.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-02-19 21:12:07 +01:00
Conor McCarthy
625e289574
vkd3d-shader/dxil: Handle hyperbolic trigonometric functions in sm6_parser_emit_dx_unary().
2024-02-07 22:59:23 +01:00
Conor McCarthy
19d23fa696
vkd3d-shader/dxil: Handle inverse trigonometric functions in sm6_parser_emit_dx_unary().
2024-02-06 23:09:53 +01:00
Conor McCarthy
ebec0aa434
vkd3d-shader/dxil: Implement DX intrinsic TextureLoad.
2024-02-01 22:25:02 +01:00
Henri Verbeet
d38221bd68
vkd3d-shader/ir: Pass a struct vsir_program to shader_parser_get_src_params().
2024-02-01 00:08:23 +01:00
Henri Verbeet
47ec24ebad
vkd3d-shader/ir: Pass a struct vsir_program to shader_parser_get_dst_params().
2024-02-01 00:08:22 +01:00
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
Giovanni Mascellani
2b93aae069
vkd3d-shader: Convert write masks between 32 and 64 bit by cases.
...
There are only three cases, and while the code is longer it is also
hopefully easier to read. Moreover, an error message is casted if
we're doing something unexpected.
2024-01-29 22:33:30 +01:00
Giovanni Mascellani
378109051c
vkd3d-shader/ir: Lower monolithic switches to selection ladders.
...
PHI nodes must be fixed up after this pass, because the block references
might have become broken. For simplicitly this is not handled yet.
The goal for this pass is to make the CFG structurizer simpler, because
only conditional and unconditional branches must be supported.
Eventually this limitation might be lifted if there is advantage in
doing so.
2024-01-29 22:33:15 +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
8ae69c745b
vkd3d-shader/spirv: Handle thread group UAV barriers.
2024-01-25 22:24:23 +01:00
Conor McCarthy
adfbecef3c
vkd3d-shader/spirv: Handle globally coherent UAVs.
2024-01-25 22:24:20 +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
Francisco Casas
b92f6c448a
vkd3d-shader/ir: Lower texkill instructions to discard_nz.
2024-01-24 22:37:41 +01:00
Henri Verbeet
bf628f0c74
vkd3d-shader/ir: Store block names in struct vsir_program.
2024-01-23 20:27:35 +01:00
Henri Verbeet
f3c7d2d05c
vkd3d-shader/ir: Store the block count in struct vsir_program.
2024-01-23 20:27:34 +01:00
Henri Verbeet
98c6e85b33
vkd3d-shader/ir: Store control point counts in struct vsir_program.
2024-01-23 20:27:32 +01:00
Henri Verbeet
adc02eada8
vkd3d-shader/ir: Store the temporary register count in struct vsir_program.
2024-01-22 22:18:53 +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
7b85cd6a31
vkd3d-shader/ir: Store the "use_vocp" field in struct vsir_program.
2024-01-22 22:18:51 +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
89d1ef83f4
vkd3d-shader/dxil: Load typed SRV descriptors.
2024-01-22 22:18:18 +01:00
Giovanni Mascellani
17f4afc2b5
vkd3d-shader/ir: Validate that structured CF does not appear in block-based shaders.
2024-01-18 23:15:53 +01:00
Giovanni Mascellani
38fdf24002
vkd3d-shader: Make relative address sources mutable too.
...
They were forgotten in 78d95889bd
.
Fixes: 78d95889bd
2024-01-18 23:15:35 +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
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
Conor McCarthy
37d9dba512
vkd3d-shader/ir: Store code block names in struct vkd3d_shader_desc.
2024-01-17 22:28:38 +01:00
Conor McCarthy
ffc65215ba
vkd3d-shader/ir: Flatten SWITCH/CASE/DEFAULT/ENDSWITCH control flow instructions.
2024-01-17 22:28:36 +01:00
Conor McCarthy
e1dddc01b7
vkd3d-shader/ir: Flatten IF/ELSE/ENDIF control flow instructions.
2024-01-17 22:28:34 +01:00
Giovanni Mascellani
b0c8a47f9d
vkd3d-shader/ir: Check that SSA registers are used validly.
...
Specifically, they are assigned only once and only assigned components
are used.
Right now we don't check that the assignment dominates all usages.
2024-01-15 19:57:01 +01:00
Giovanni Mascellani
7503429555
vkd3d-shader/ir: Check that TEMP registers have consistent dimensions.
2024-01-15 19:56:59 +01:00
Giovanni Mascellani
78d95889bd
vkd3d-shader: Make *src and *dst mutable in vkd3d_shader_instruction.
...
They were originally made const because no optimization/normalization
pass existed. Now having to cast away const all the time is becoming
more and more burdening.
2024-01-11 23:05:11 +01:00
Nikolay Sivov
a0207436f2
vkd3d-shader/tpf: Add initial support for writing fx_4_0/fx_4_1 binaries.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-11 23:04:48 +01:00
Henri Verbeet
5b9a0dfaea
vkd3d-shader/ir: Store destination parameter shifts as an unsigned int.
2024-01-04 22:23:54 +01:00
Henri Verbeet
4b5d3a078b
vkd3d-shader/ir: Store destination parameter modifier flags as a uint32_t.
2024-01-04 22:23:52 +01:00
Henri Verbeet
60842b7181
vkd3d-shader/ir: Store source parameter swizzles as a uint32_t.
2024-01-04 22:23:51 +01:00
Henri Verbeet
9f4ca3bc9c
vkd3d-shader/ir: Store instruction flags as a uint32_t.
2024-01-04 22:23:49 +01:00
Zebediah Figura
1ce7e3d8b1
vkd3d-shader/d3dbc: Assign unique register indices for VKD3DSPR_RASTOUT.
2024-01-04 22:23:09 +01:00
Zebediah Figura
3f52fda8ad
vkd3d-shader: Lower shader model 1/2 inter-stage I/O to a flat array.
...
An alternative is that we stash the reg_type in the signature, but this seems
far simpler for the backend to deal with.
2024-01-04 22:23:07 +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
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
13459a55f1
vkd3d-shader/spirv: Introduce a UINT64 component type.
2024-01-02 23:03:04 +01:00
Conor McCarthy
fe44873979
vkd3d-shader/spirv: Introduce a data_type_is_64_bit() helper function.
2024-01-02 23:03:03 +01:00
Henri Verbeet
f96a791807
vkd3d-shader/ir: Pass a uint32_t swizzle to vkd3d_swizzle_get_component64().
2023-12-14 23:19:51 +01:00
Henri Verbeet
8a1de71fb1
vkd3d-shader/ir: Pass a uint32_t swizzle to vkd3d_swizzle_get_component().
2023-12-14 23:19:49 +01:00
Henri Verbeet
21491d1bbb
vkd3d-shader/ir: Pass a uint32_t write mask to vkd3d_write_mask_32_from_64().
2023-12-13 22:33:07 +01:00
Henri Verbeet
3759186193
vkd3d-shader/ir: Pass a uint32_t write mask to vkd3d_write_mask_64_from_32().
2023-12-13 22:33:06 +01:00
Henri Verbeet
713adaa56a
vkd3d-shader/ir: Pass a uint32_t write mask to vkd3d_write_mask_component_count().
2023-12-13 22:33:04 +01:00
Henri Verbeet
e1aa12f94b
vkd3d-shader/ir: Pass a uint32_t write mask to vkd3d_write_mask_get_component_idx().
2023-12-13 22:33:03 +01:00
Giovanni Mascellani
ec4986e9e2
vkd3d-shader/spirv: Honor force_validation after emitting SPIR-V code.
2023-12-13 22:32:25 +01:00
Giovanni Mascellani
1015cc952e
vkd3d-shader/d3d-asm: Add an "internal" mode for the ASM dumper.
...
The new mode exposes more details about what's going on inside the VSIR
code and it's meant to ease development and debugging.
2023-12-12 23:16:26 +01:00
Conor McCarthy
0610867334
vkd3d-shader/spirv: Emit an error if 64-bit integers are used.
2023-12-12 22:50:48 +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
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
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
Conor McCarthy
9fcc904834
vkd3d-shader/spirv: Always emit clip/cull builtins as an array.
...
Clip/cull distance can appear as input in pixel shaders, and the
array size must not be forced to zero.
2023-12-06 15:31:20 +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
920657e7ee
vkd3d-shader: Delete unused struct list from struct vkd3d_shader_indexable_temp.
2023-11-22 22:07:52 +01:00
Henri Verbeet
01dad41862
vkd3d-shader/ir: Skip recording combined resource/sampler information for dynamically indexed descriptor arrays.
...
And output a warning instead.
2023-11-21 22:41:57 +01:00
Henri Verbeet
215a2c4ede
vkd3d-shader/ir: Introduce vsir_register_is_descriptor().
2023-11-13 23:19:10 +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
c7a7d9a18c
vkd3d-shader/ir: Normalize all I/O registers to INPUT/OUTPUT/PATCHCONST.
...
Specifically, map COLOROUT to OUTPUT, and map INCONTROLPOINT to INPUT for domain
shaders as well as hull shaders.
Obscure the non-existent differences from the view of the backend.
2023-11-09 21:14:52 +01:00
Conor McCarthy
58ffb5d181
vkd3d-shader/spirv: Introduce integer width cast instructions.
...
ITOI and UTOU may cast from a bool to a 32-bit integer. Cast to a 64-bit
integer from a smaller type will be added later.
2023-11-09 21:14:32 +01:00
Conor McCarthy
7de4ac2e48
vkd3d-shader/spirv: Support bool cast in spirv_compiler_emit_alu_instruction().
2023-11-09 21:14:30 +01:00
Conor McCarthy
5b87d6419a
vkd3d-shader/spirv: Support bool logic ops in spirv_compiler_emit_alu_instruction().
2023-11-09 21:14:27 +01:00
Zebediah Figura
12240efa79
vkd3d-shader/spirv: Use register counts from the signature and shader desc.
2023-11-07 22:26:49 +01:00
Zebediah Figura
0058764f01
vkd3d-shader: Store the control point counts in struct vkd3d_shader_desc.
2023-11-07 22:26:49 +01:00
Giovanni Mascellani
2f7d52dba4
vkd3d-shader/ir: Check that IF blocks are correctly nested.
2023-11-07 22:26:01 +01:00
Conor McCarthy
749df8dec2
vkd3d-shader/dxil: Implement the DXIL BINOP instruction.
2023-11-06 23:09:03 +01:00
Conor McCarthy
acbc80cba2
vkd3d-shader/spirv: Introduce an IDIV instruction.
2023-11-06 23:09:00 +01:00
Conor McCarthy
c8d3515d8b
vkd3d-shader/spirv: Introduce an FREM instruction.
2023-11-06 23:08:58 +01:00
Zebediah Figura
fa23165cc0
vkd3d-shader/spirv: Remove handling of VKD3DSPR_OUTCONTROLPOINT.
...
I/O normalization removes this register type.
2023-11-06 23:07:58 +01:00
Zebediah Figura
b73d2c978d
vkd3d-shader/ir: Check for vocp usage during IR normalization.
...
The hull shader barrier used for this was broken by I/O normalization, since
vocp is no longer exposed to the spirv backend.
Restore this barrier by checking for vocp during normalization instead.
2023-11-06 23:07:56 +01:00
Giovanni Mascellani
af72466db1
vkd3d-shader/ir: Validate the index of a TEMP register.
2023-11-02 18:22:52 +01:00
Giovanni Mascellani
4140b87499
vkd3d-shader/ir: Validate the DCL_TEMPS instruction.
2023-11-02 18:22:50 +01:00
Giovanni Mascellani
79fa5fd8bb
vkd3d-shader/ir: Validate the register index count.
2023-11-02 18:22:49 +01:00
Giovanni Mascellani
26e4191d4b
vkd3d-shader/ir: Validate the register dimension.
2023-11-02 18:22:47 +01:00
Giovanni Mascellani
f3a20be35a
vkd3d-shader/ir: Validate the register data type.
2023-11-02 18:22:38 +01:00
Giovanni Mascellani
72d0f765f2
vkd3d-shader/ir: Validate the register precision.
2023-11-02 18:22:37 +01:00
Giovanni Mascellani
2ba8c5771c
vkd3d-shader: Deduplicate profile version comparison functions.
2023-11-02 18:22:35 +01:00
Giovanni Mascellani
dd96fe50e2
vkd3d-shader: Dump shaders as soon as possible.
...
So that they are dumped even if parsing fails, which is a circumstance
in which one likely wants to see the problematic shader.
The downside of that is that for shader types other than HLSL
the profile is not written any more in the filename. This should
not be a big problem, because in those cases the shader describes
its own type.
When dumping an HLSL shader, the id is brought in front of the profile
in the file name, in order to make it more tab-friendly: when dealing
with a directory full of shaders it's likely that the id determines
the profile, but the other way around.
2023-11-02 18:22:26 +01:00
Giovanni Mascellani
ab09c0b45b
vkd3d-shader: Expose the whole profile when dumping an HLSL shader.
...
The profile cannot be reliably devised by analyzing the HLSL code,
so it's useful to have it included in the file name.
2023-11-02 18:22:24 +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
Zebediah Figura
15b69721de
vkd3d-shader/tpf: Set the interpolation mode for signature elements.
2023-10-31 21:59:38 +01:00
Nikolay Sivov
9a6e4a0c58
vkd3d-shader/hlsl: Check for duplicate case statements.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-10-31 21:58:59 +01:00
Conor McCarthy
f7525bf0c6
vkd3d-shader/dxil: Validate the descriptor list metadata nodes.
2023-10-19 23:07:42 +02:00