Commit Graph

452 Commits

Author SHA1 Message Date
052df4d693 vkd3d-shader/ir: Split handling loops when emitting a structured program. 2024-04-15 21:33:16 +02:00
5e42f6779a vkd3d-shader/ir: Split handling blocks when emitting a structured program. 2024-04-15 21:33:15 +02:00
b4cfc24f67 vkd3d-shader/ir: Refactor declaration emission outside of the CFG structure.
This is in preparation of handling more than one function (as
it happens for Hull Shaders), which will require having a single
row of declarations, but handling more than one CFG.
2024-04-15 21:33:14 +02:00
27801e5612 vkd3d-shader/ir: Split undominated SSA materialization. 2024-04-15 21:33:13 +02:00
d891ac5017 vkd3d-shader/ir: Split program structurization. 2024-04-15 21:33:12 +02:00
eb15f97083 vkd3d-shader/ir: Move breaks out of selections again after having optimized loops. 2024-04-15 21:33:08 +02:00
be7eec75dc vkd3d-shader/ir: Append code to the non-breaking branch if there is breaking one. 2024-04-15 21:33:07 +02:00
a2c6b5450b vkd3d-shader/ir: Prepare for changing the destination list in vsir_cfg_optimize_recurse(). 2024-04-15 21:33:05 +02:00
aad040af05 vkd3d-shader/ir: Remove loops that terminate with a `break'. 2024-04-11 09:22:14 -05:00
105ccc4769 vkd3d-shader/ir: Count how many jumps target each loop. 2024-04-11 09:22:13 -05:00
f5d1b5d263 vkd3d-shader/ir: Move `break's out of selection constructs when possible. 2024-04-11 09:22:11 -05:00
7d5e3713f9 vkd3d-shader/ir: Materialise SSAs to temps before lowering switch instructions. 2024-04-09 12:27:20 -05:00
cfcd57209b vkd3d-shader/ir: Convert SSAs to temps only if the block of origin does not dominate all uses. 2024-04-09 12:27:19 -05:00
7bfc7410f2 vkd3d-shader/ir: Materialise phis to temps in the incoming blocks.
RADV converts temps to phi instructions, so converting phis to MOVC in
VSIR just translates back to phis feeding into a MOVC. This commit
eliminates the MOVC.
2024-04-09 12:27:15 -05:00
2621fc9572 vkd3d-shader/ir: Add missing src swizzle in vsir_program_lower_texkills(). 2024-04-09 12:27:06 -05:00
a278f32d3f vkd3d-shader/ir: Synthesize selection constructs from conditional jumps. 2024-04-04 22:19:19 +02:00
0d13b6afe9 vkd3d-shader/ir: Remove trailing `continue's. 2024-04-04 22:19:18 +02:00
d8414302e8 vkd3d-shader/ir: Move `continue's to the false branch when possible. 2024-04-04 22:19:16 +02:00
e6c20361ea vkd3d-shader/ir: Drop a useless helper. 2024-04-03 22:23:08 +02:00
9aff65c6d2 vkd3d-shader/ir: Open a loop when visiting the loop header.
Not when making the loop header available, which is too early and
might lead to open too many loops at once.
2024-04-03 22:23:06 +02:00
d10031911d vkd3d-shader/ir: Move vsir_program_normalise() to the end of the file.
vsir_program_normalise() has function calls to basically everything in
ir.c, so it's useful to have it in an easily reachable place to
quickly jump to wherever you need using your favorite code editor's
features.
2024-04-02 23:10:07 +02:00
5de5f241a6 vkd3d-shader/ir: Pass a struct vsir_program to vkd3d_shader_normalise(). 2024-03-19 22:57:56 +01:00
e5f486edd3 vkd3d-shader/ir: Use type "unused" for labels.
The label itself is certainly an unsigned integer, but the register
has no meaningful data type. It cannot be evaluated to anything.
The goal of this is to reduce cluttering in the internal ASM dumps.
2024-03-18 23:07:45 +01:00
8c15377ffc vkd3d-shader/ir: Emit multilevel jumps in the structured program.
The new structurizer therefore reaches feature parity with the
older simple one, except for a couple of points:

 * the old structurizer accepts any CFG, without requiring reducibility;
   however, the DXIL specification requires the CFG to be reducible
   anyway, so we're not really losing anything;

 * the new structurizer additionally requires that no block has two
   incoming back arrows; AFAIK this is condition that can happen,
   but in practice it seems to be rare; also, it's not hard to add
   support for it, as soon as it is decided it is useful.

On the other hand, the new structurizer makes use of the merging
information that are reconstructed from the CFG, which is important
for downstream optimization and fundamental for correctly emitting
tangled instructions.

Taking these considerations into account, the old structurizer is
considered superseded and is therefore removed.
2024-03-18 23:07:17 +01:00
c2aa01de6e vkd3d-shader/ir: Emit the reconstructed structured program.
Multilevel jumps are not supported yet, and trigger a fallback to the
simple structurizer.
2024-03-18 23:07:15 +01:00