Giovanni Mascellani
7b9a1bf6df
vkd3d-shader/ir: Run validation after materializing undominated SSAs to TEMPs.
2024-09-05 16:29:47 +02:00
Giovanni Mascellani
08c1f4d45e
vkd3d-shader/ir: Run validation after flattening control flow constructs.
2024-09-05 16:29:17 +02:00
Giovanni Mascellani
455c826a6a
vkd3d-shader/ir: Run validation after structurization.
2024-09-05 16:29:11 +02:00
Giovanni Mascellani
e935dcb88d
vkd3d-shader/ir: Run validation after lowering switches to selection ladders.
2024-09-05 16:29:02 +02:00
Giovanni Mascellani
4a28433ef5
vkd3d-shader/ir: Run validation after materializing PHI SSAs to TEMPs.
2024-09-05 16:26:52 +02:00
Giovanni Mascellani
fade5dd54c
vkd3d-shader/ir: Run validation after lowering instructions.
2024-09-05 16:25:33 +02:00
Giovanni Mascellani
ffb7284fb6
vkd3d-shader/ir: Do not decide the control flow type on NOPs.
2024-09-05 16:20:39 +02:00
Giovanni Mascellani
829e6f5cd0
vkd3d-shader/ir: Emit a warning instead of an error on validation failures.
2024-09-05 16:20:39 +02:00
Francisco Casas
9a564872c5
vkd3d-shader/hlsl: Store SM1 constant dcls on the vsir_program.
2024-09-04 17:44:46 +02:00
Elizabeth Figura
eb71a1722a
vkd3d-shader: Use an extended version of vkd3d_shader_immediate_constant in vkd3d_shader_parameter1.
...
This is a proposed API change in 946, which won't make it into this release.
The intent is to allow slightly larger constants to be specified in the updated
vkd3d_shader_parameter1 structure. In particular, this is large enough to pass
4-dimensional integer or float vectors inline, which the proposed clip plane
implementation will use, as well as other Direct3D FFP parameters.
We could also simply add vkd3d_shader_immediate_constant1 as a separate union
member in vkd3d_shader_parameter1, but this API is a bit cleaner and simpler.
2024-08-28 12:08:37 +02:00
Nikolay Sivov
d1b8a7e745
vkd3d: Fix a few typos in the comments.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-08-19 14:17:41 +02:00
Anna (navi) Figueiredo Gomes
80b2a2eb55
vkd3d-shader/ir: Periodically flush buffers when tracing blocks.
...
Avoids overflowing the output buffer for the trace in cases where the
output is too long, which raises an exception.
2024-08-12 14:19:13 +02:00
Giovanni Mascellani
4a04324ecc
vkd3d-shader: Replace assert() with VKD3D_ASSERT() in ir.c.
2024-08-05 15:57:56 +02:00
Henri Verbeet
c7589d8f19
vkd3d-shader/ir: Remove VKD3DSIH_DCL_SAMPLER instructions.
2024-07-30 16:31:44 +02:00
Henri Verbeet
fffe521b80
vkd3d-shader/ir: Remove VKD3DSIH_DCL instructions.
2024-07-30 16:31:44 +02:00
Elizabeth Figura
ae5cd6573f
vkd3d-shader: Allow controlling d3d color shade mode through vkd3d-shader parameters.
2024-07-24 16:08:10 +02:00
Elizabeth Figura
97cd941710
vkd3d-shader: Do not make the alpha test ref parameter VSIR_DIMENSION_VEC4.
2024-07-23 21:12:28 +02:00
Elizabeth Figura
f6dd6d52b3
vkd3d-shader: Factor out a vsir_program_get_parameter() helper.
2024-07-23 21:10:00 +02:00
Shaun Ren
b3a11a9ec4
vkd3d-shader/ir: Lower SM1 SINCOS to SM4 SINCOS.
2024-07-16 15:24:58 +02:00
Elizabeth Figura
806363b765
vkd3d-shader: Allow controlling alpha test through vkd3d-shader parameters.
2024-07-11 17:02:11 +02:00
Elizabeth Figura
98def3214b
vkd3d-shader: Introduce struct vkd3d_shader_parameter_info and struct vkd3d_shader_parameter1.
...
As the newly added documentation describes, this reroll serves two purposes:
* to allow shader parameters to be used for any target type (which allows using
parameters for things like Direct3D 8-9 alpha test),
* to allow the union in struct vkd3d_shader_parameter to contain types larger
than 32 bits (by specifying them indirectly through a pointer).
2024-07-11 16:48:09 +02:00
Nikolay Sivov
4ff288bd32
vkd3d-shader: Implement tex*() functions variants with gradient arguments.
...
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:23:38 +02:00
Henri Verbeet
1fe7a6581b
vkd3d-shader/ir: Rename the "handler_idx" field of struct vkd3d_shader_instruction to "opcode".
2024-05-30 19:57:01 +02:00
Nikolay Sivov
308d735923
vkd3d-shader/ir: Set texture register dimension as VEC4 when normalising combined samplers.
...
Thanks, Giovanni.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-05-27 21:07:51 +02:00
Henri Verbeet
19b552ce1b
vkd3d-shader/ir: Pass an initialised vsir_program structure to vkd3d_shader_parser_init().
2024-05-16 21:49:36 +02:00
Conor McCarthy
98f73ca2e5
vkd3d-shader/ir: Allow all DCL instructions to occur outside hull shader phases.
2024-05-13 22:27:13 +02:00
Conor McCarthy
cc49f26af1
vkd3d-shader/ir: Validate geometry shader properties.
2024-05-08 21:08:15 +02:00
Conor McCarthy
075979fa21
vkd3d-shader/ir: Always check for undominated SSA use in register relative addresses.
2024-04-24 23:48:13 +02:00
Francisco Casas
d2427ea1bd
vkd3d-shader/ir: Lower IFC instructions to IF instructions.
2024-04-24 23:48:05 +02:00
Henri Verbeet
46fca3f9f4
vkd3d-common: Introduce VKD3D_BITMAP_SIZE.
2024-04-23 22:41:25 +02:00
Conor McCarthy
e3dde09bb9
vkd3d-shader/ir: Accept undefined PHI incomings as valid.
...
An incoming can be undefined if the PHI result is not used if the
incoming's path was taken, or if the undefined value is consumed by
an instruction (dxc will compile such code without errors).
2024-04-23 22:37:33 +02:00
Giovanni Mascellani
6b841486d4
vkd3d-shader/ir: Materialize SSAs in each function of a hull shader.
2024-04-23 22:36:17 +02:00
Giovanni Mascellani
c8af142bb0
vkd3d-shader/ir: Structurize each function of a hull shader.
2024-04-23 22:36:16 +02:00
Giovanni Mascellani
d8e4b19cdc
vkd3d-shader/ir: Skip invalid blocks when materializing undominated SSAs.
2024-04-23 22:36:14 +02:00
Conor McCarthy
4457181b2a
vkd3d-shader/dxil: Support patch constant functions and signatures.
2024-04-22 23:13:26 +02:00
Henri Verbeet
e17e481130
vkd3d-shader/glsl: Call vkd3d_shader_normalise().
2024-04-17 22:52:20 +02:00
Henri Verbeet
1d6c3eae78
vkd3d-shader/ir: Remove VKD3DSIH_DCL_CONSTANT_BUFFER instructions.
2024-04-16 22:18:52 +02:00
Giovanni Mascellani
a359c42795
vkd3d-shader/ir: Only emit launchers when needed.
2024-04-16 22:18:33 +02:00
Giovanni Mascellani
df4731dc17
vkd3d-shader/ir: Only emit trampolines when needed.
2024-04-16 22:18:26 +02:00
Giovanni Mascellani
d6ba8b88fa
vkd3d-shader/ir: Swap selection branches if the if branch is empty.
2024-04-16 22:18:25 +02:00
Conor McCarthy
0515482e82
vkd3d-shader/ir: Validate tessellation declarations.
2024-04-16 22:18:18 +02:00
Conor McCarthy
23db066922
vkd3d-shader/ir: Implement MAD in two operations if flagged as precise.
...
With some changes by Giovanni Mascellani.
2024-04-15 21:33:35 +02:00
Giovanni Mascellani
9112a5be58
vkd3d-shader/ir: Move DCL_TEMPS removal to the generic instruction lowering pass.
2024-04-15 21:33:34 +02:00
Giovanni Mascellani
8a17a5a08b
vkd3d-shader/ir: Introduce vsir_program_lower_instructions().
...
It is meant as generic pass to host all program changes to single
instructions that do not require keeping a global state, intstead
of having to loop through the whole program many times.
2024-04-15 21:33:32 +02:00
Giovanni Mascellani
a7dc6dcce2
vkd3d-shader/ir: Split handling jumps when emitting a structured program.
2024-04-15 21:33:28 +02:00
Giovanni Mascellani
1a8a4c7787
vkd3d-shader/ir: Split handling selections when emitting a structured program.
2024-04-15 21:33:26 +02:00
Giovanni Mascellani
052df4d693
vkd3d-shader/ir: Split handling loops when emitting a structured program.
2024-04-15 21:33:16 +02:00
Giovanni Mascellani
5e42f6779a
vkd3d-shader/ir: Split handling blocks when emitting a structured program.
2024-04-15 21:33:15 +02:00
Giovanni Mascellani
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
Giovanni Mascellani
27801e5612
vkd3d-shader/ir: Split undominated SSA materialization.
2024-04-15 21:33:13 +02:00
Giovanni Mascellani
d891ac5017
vkd3d-shader/ir: Split program structurization.
2024-04-15 21:33:12 +02:00
Giovanni Mascellani
eb15f97083
vkd3d-shader/ir: Move breaks out of selections again after having optimized loops.
2024-04-15 21:33:08 +02:00
Giovanni Mascellani
be7eec75dc
vkd3d-shader/ir: Append code to the non-breaking branch if there is breaking one.
2024-04-15 21:33:07 +02:00
Giovanni Mascellani
a2c6b5450b
vkd3d-shader/ir: Prepare for changing the destination list in vsir_cfg_optimize_recurse().
2024-04-15 21:33:05 +02:00
Giovanni Mascellani
aad040af05
vkd3d-shader/ir: Remove loops that terminate with a `break'.
2024-04-11 09:22:14 -05:00
Giovanni Mascellani
105ccc4769
vkd3d-shader/ir: Count how many jumps target each loop.
2024-04-11 09:22:13 -05:00
Giovanni Mascellani
f5d1b5d263
vkd3d-shader/ir: Move `break's out of selection constructs when possible.
2024-04-11 09:22:11 -05:00
Conor McCarthy
7d5e3713f9
vkd3d-shader/ir: Materialise SSAs to temps before lowering switch instructions.
2024-04-09 12:27:20 -05:00
Conor McCarthy
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
Conor McCarthy
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
Francisco Casas
2621fc9572
vkd3d-shader/ir: Add missing src swizzle in vsir_program_lower_texkills().
2024-04-09 12:27:06 -05:00
Giovanni Mascellani
a278f32d3f
vkd3d-shader/ir: Synthesize selection constructs from conditional jumps.
2024-04-04 22:19:19 +02:00
Giovanni Mascellani
0d13b6afe9
vkd3d-shader/ir: Remove trailing `continue's.
2024-04-04 22:19:18 +02:00
Giovanni Mascellani
d8414302e8
vkd3d-shader/ir: Move `continue's to the false branch when possible.
2024-04-04 22:19:16 +02:00
Giovanni Mascellani
e6c20361ea
vkd3d-shader/ir: Drop a useless helper.
2024-04-03 22:23:08 +02:00
Giovanni Mascellani
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
Giovanni Mascellani
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
Henri Verbeet
5de5f241a6
vkd3d-shader/ir: Pass a struct vsir_program to vkd3d_shader_normalise().
2024-03-19 22:57:56 +01:00
Giovanni Mascellani
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
Giovanni Mascellani
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
Giovanni Mascellani
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
Henri Verbeet
abf76372e0
vkd3d-shader/ir: Pass a struct vsir_program to vsir_validate().
2024-03-14 23:24:29 +01:00
Henri Verbeet
7af3e9300f
vkd3d-shader/ir: Pass a struct vsir_program to flatten_control_flow_constructs().
2024-03-14 23:24:28 +01:00
Henri Verbeet
268989f5b9
vkd3d-shader/ir: Pass a struct vsir_program to normalise_combined_samplers().
2024-03-14 23:24:27 +01:00
Henri Verbeet
674bebe9c9
vkd3d-shader/ir: Pass a struct vsir_program to shader_normalise_io_registers().
2024-03-14 23:24:24 +01:00
Giovanni Mascellani
d75dc76011
vkd3d-shader/ir: Dump the reconstructed structured program.
2024-03-14 22:48:53 +01:00
Giovanni Mascellani
2b3e21caeb
vkd3d-shader/ir: Add jumps to the structured programs.
2024-03-14 22:48:52 +01:00
Giovanni Mascellani
c25e4c47c3
vkd3d-shader/ir: Reconstruct a structured program.
...
For simplicity jumps are not currently processed.
2024-03-14 22:48:50 +01:00
Henri Verbeet
5f1f7ababb
vkd3d-shader/ir: Pass a struct vsir_program to remap_output_signature().
2024-03-13 22:00:42 +01:00
Henri Verbeet
0edf6d25f3
vkd3d-shader/ir: Pass a struct vsir_program to simple_structurizer_run().
2024-03-13 22:00:41 +01:00
Henri Verbeet
c3f3cb5ef9
vkd3d-shader/ir: Pass a struct vsir_program to materialize_ssas_to_temps().
2024-03-13 22:00:40 +01:00
Henri Verbeet
76791913d0
vkd3d-shader/ir: Pass a struct vsir_program to materialize_ssas_to_temps_process_reg().
2024-03-13 22:00:39 +01:00
Henri Verbeet
343a365c97
vkd3d-shader/ir: Pass a struct vsir_program to instruction_array_lower_texkills().
2024-03-13 22:00:37 +01:00
Giovanni Mascellani
f2b2040ff6
vkd3d-shader/ir: Sort loop intervals.
2024-03-12 22:14:47 +01:00
Giovanni Mascellani
070c4af8b3
vkd3d-shader/ir: Generate synthetic intervals for forward edges.
2024-03-12 22:14:46 +01:00
Giovanni Mascellani
1d60612340
vkd3d-shader/ir: Compute loop as intervals of the block order.
2024-03-12 22:14:45 +01:00
Giovanni Mascellani
204c8afb9c
vkd3d-shader/dxbc: Remove flag is_dxil.
...
The full shader profile is already available in vsir_program.
2024-03-11 22:09:31 +01:00
Giovanni Mascellani
470d83a9da
vkd3d-shader: Move shader signatures to vsir_program.
2024-03-11 22:09:31 +01:00
Giovanni Mascellani
b940d79aa8
vkd3d-shader/ir: Keep loops contiguous in the topological sort.
2024-03-08 23:35:48 +01:00
Giovanni Mascellani
cf9a023566
vkd3d-shader/ir: Dump the topological order of the control flow graph.
2024-03-08 23:35:47 +01:00
Giovanni Mascellani
ed40646c8a
vkd3d-shader/ir: Topologically sort the control flow graph.
2024-03-08 23:35:46 +01:00
Giovanni Mascellani
880d781b57
vkd3d-shader/ir: Allow adding to a block list without checking for duplicates.
2024-03-08 23:35:45 +01:00
Giovanni Mascellani
8723b5d266
vkd3d-shader/ir: Sort each loop by block label.
2024-03-07 23:08:36 +01:00
Giovanni Mascellani
3d4092d9dc
vkd3d-shader/ir: Dump the loops in the control flow graph.
2024-03-07 23:08:35 +01:00
Giovanni Mascellani
8241ca2b67
vkd3d-shader/ir: Keep track of loops by header block.
2024-03-07 23:08:34 +01:00
Giovanni Mascellani
088a6c49a2
vkd3d-shader/ir: Keep a reference to the message context inside struct vsir_cfg.
2024-03-07 23:08:33 +01:00
Giovanni Mascellani
9ac842b36b
vkd3d-shader/ir: Compute the loops in the control flow graph.
2024-03-07 23:08:32 +01:00
Giovanni Mascellani
de15f55477
vkd3d-shader/ir: Introduce a helper to express block domination.
2024-03-07 23:08:31 +01:00
Giovanni Mascellani
c3657c4799
vkd3d-shader/ir: Add a debug buffer to struct vsir_cfg.
2024-03-07 23:08:30 +01:00
Giovanni Mascellani
c5893288d9
vkd3d-shader/ir: Properly handle function-local indexable temps when flattening control flow.
...
They have to be considered code rather than declarations, as required
for instance by the SPIR-V backend.
2024-03-07 23:08:28 +01:00