Commit Graph

638 Commits

Author SHA1 Message Date
4448d114ad vkd3d-shader/hlsl: Detect overlaps in cbuffer offsets. 2023-04-04 21:59:43 +02:00
7777c32cac vkd3d-shader/hlsl: Support packoffset(). 2023-04-04 21:59:42 +02:00
9b70971696 vkd3d-shader/hlsl: Rename struct hlsl_reg_reservation fields. 2023-04-04 21:59:39 +02:00
eb71c5f20d vkd3d-shader/hlsl: Handle round() for SM1. 2023-04-03 18:00:03 +02:00
7a9e393ea0 vkd3d-shader/hlsl: Rename the "type" field of struct hlsl_type to "class".
To be consistent with enum hlsl_type_class and HLSL_CLASS_*.
2023-04-03 17:59:24 +02:00
4110f1e547 vkd3d-shader: Fix a few typos in the comments. 2023-03-15 20:13:27 +01:00
f8338ef089 vkd3d-shader/hlsl: Allocate register reservations in a separate pass.
This refactoring is required for improving the allocation strategy so it
works with multiple-register variables.
2023-02-22 18:28:19 +01:00
75359e6dbd vkd3d-shader/hlsl: Respect object reservations even if the object is unused. 2023-02-22 18:28:19 +01:00
c5384b38ee vkd3d-shader/hlsl: Allocate objects according to register set. 2023-02-22 18:28:19 +01:00
e0031d2a1f vkd3d-shader/hlsl: Keep an hlsl_reg for each register set in hlsl_ir_var. 2023-02-22 18:28:19 +01:00
d07247249a vkd3d-shader/hlsl: Store the type's register size for each register set. 2023-02-22 18:28:19 +01:00
315966dc21 vkd3d-shader/hlsl: Leave offset empty for array and struct derefs. 2023-02-22 18:28:19 +01:00
d86db8bcbe vkd3d-shader/hlsl: Support lit() intrinsic. 2023-02-21 21:09:52 +01:00
2142d31f13 vkd3d-shader/hlsl: Fix number of components when creating a swizzle in copy-prop.
Otherwise we may create nodes of different dimensions than the ones we
are replacing.

"count" is the number of components of the source deref (without
considering the swizzle), while "instr_component_count" is the actual
number of components of the instruction to be replaced.
2023-02-20 21:59:31 +01:00
38964214cd vkd3d-shader/hlsl: Handle early return after a CF block only if there was actually a return somewhere in the CF block. 2023-02-13 22:16:55 +01:00
4b944517b7 vkd3d-shader/hlsl: Inline function calls. 2023-02-13 22:16:53 +01:00
8bdee6681b vkd3d-shader/hlsl: Lower return statements. 2023-02-13 22:16:51 +01:00
240b2f966f vkd3d-shader/hlsl: Support abs() for SM1. 2023-02-09 18:03:19 +01:00
b84f560bdf vkd3d-shader/hlsl: Set writemasks correctly for SM1 scalar and vector types.
Because of the change introduced in

f21693b2 vkd3d-shader/hlsl: Use reg_size as component count when allocating a single register.

SM1 scalars and vectors were not longer getting the correct writemask
when they are allocated.

This happened because they have to reserve the whole register even if
they only use some of its components, so their reg_size may differ from
the number of components.

This commit fixes that.
2023-02-08 22:09:39 +01:00
6b4a4c4c6d vkd3d-shader/hlsl: Expect component count in allocate_register().
This in order to set the correct writemasks for SM1 registers.
2023-02-08 22:09:38 +01:00
0ecac994d0 vkd3d-shader/hlsl: Rename 'component_count' arguments to 'reg_size'.
component_count will be used in the next patch for the actual number of
components of the type and not its register size.
2023-02-08 22:09:36 +01:00
8755a92196 vkd3d-shader/hlsl: Add a hlsl_cleanup_semantic() helper. 2023-02-07 22:15:06 +01:00
cb2c89a589 vkd3d-shader/hlsl: Store function parameters in an array. 2023-02-07 22:15:06 +01:00
06f300ec59 vkd3d-shader/hlsl: Support dot() for SM1. 2023-02-02 20:51:12 +01:00
d2f8a576a8 vkd3d-shader/hlsl: Avoid infinite loop and invalid derefs in copy-prop.
Co-authored-by: Francisco Casas <fcasas@codeweavers.com>
Co-authored-by: Zebediah Figura <zfigura@codeweavers.com>

Because copy_propagation_transform_object_load() replaces a deref
instead of an instruction, it is currently prone to two problems:

1- It can replace a deref with the same deref, returning true every
time and getting the compilation stuck in an endless loop of
copy-propagation iterations.

2- When performed multiple times in the same deref, the second time it
can replace the deref with a deref from a temp that is only valid in
another point of the program execution, resulting in an incorrect value.

This patch preempts this by avoiding replacing derefs when the new deref
doesn't point to a uniform variable. Because, uniform variables cannot
be written to.
2023-01-26 21:52:07 +01:00