Commit Graph

335 Commits

Author SHA1 Message Date
Francisco Casas
4f60c7167e vkd3d-shader/hlsl: Run constant passes in a separate function. 2024-05-15 21:17:49 +02:00
Francisco Casas
573d511344 vkd3d-shader/hlsl: Track bind count according to usage for uniforms.
Where bind count means the number of registers required to include all
dereferences to the variable within the shader as in
hlsl_ir_var.bind_count[].
2024-05-13 22:26:07 +02:00
Nikolay Sivov
0053cc52b7 vkd3d-shader/fx: Initial support for writing sample state objects.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-05-08 21:08:05 +02:00
Zebediah Figura
c2eb563e50 vkd3d-shader/fx: Skip uniform copy logic for global variables. 2024-05-08 21:07:58 +02:00
Francisco Casas
68483d070f vkd3d-shader/hlsl: Turn hlsl_state_block_entry arguments into hlsl_src.
This allows to apply passes that replace instructions in
hlsl_state_block_entry.instrs.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-05-08 21:07:57 +02:00
Zebediah Figura
2480eec98b vkd3d-shader/hlsl: Move the "base_type" member to the class-specific union. 2024-05-06 22:12:41 +02:00
Zebediah Figura
d9f7a88329 vkd3d-shader/hlsl: Make HLSL_TYPE_PIXELSHADER into a separate class. 2024-05-06 22:12:37 +02:00
Zebediah Figura
874937dab4 vkd3d-shader/hlsl: Make HLSL_TYPE_VERTEXSHADER into a separate class. 2024-05-06 22:12:34 +02:00
Francisco Casas
b14f935d0f vkd3d-shader/hlsl: Fold x + 0 identities. 2024-04-30 16:31:02 +02:00
Zebediah Figura
d7da278693 vkd3d-shader/hlsl: Make HLSL_TYPE_RENDERTARGETVIEW into a separate class. 2024-04-23 22:37:09 +02:00
Zebediah Figura
ee2bde3aba vkd3d-shader/hlsl: Make HLSL_TYPE_DEPTHSTENCILVIEW into a separate class. 2024-04-23 22:37:06 +02:00
Zebediah Figura
76971d811e vkd3d-shader/hlsl: Make HLSL_TYPE_TECHNIQUE into a separate class. 2024-04-23 22:36:51 +02:00
Zebediah Figura
3c8c7426df vkd3d-shader/hlsl: Make HLSL_TYPE_PASS into a separate class. 2024-04-23 22:36:38 +02:00
Zebediah Figura
24d3a352a6 vkd3d-shader/hlsl: Make HLSL_TYPE_EFFECT_GROUP into a separate class. 2024-04-23 22:36:32 +02:00
Zebediah Figura
833c897aac vkd3d-shader/hlsl: Parse register space reservations. 2024-04-22 23:13:15 +02:00
Zebediah Figura
171e097268 vkd3d-shader/hlsl: Make HLSL_TYPE_UAV into a separate class. 2024-04-19 22:23:20 +02:00
Zebediah Figura
93d7cd1785 vkd3d-shader/hlsl: Make HLSL_TYPE_TEXTURE into a separate class. 2024-04-19 22:23:19 +02:00
Zebediah Figura
220362cbad vkd3d-shader/hlsl: Make HLSL_TYPE_SAMPLER into a separate class. 2024-04-19 22:23:18 +02:00
Zebediah Figura
f57db442b0 vkd3d-shader/hlsl: Make HLSL_TYPE_STRING into a separate class. 2024-04-19 22:23:16 +02:00
Zebediah Figura
cdcf2da2eb vkd3d-shader/hlsl: Make HLSL_TYPE_VOID into a separate class. 2024-04-19 22:23:14 +02:00
Francisco Casas
ef9ae22ed0 vkd3d-shader/hlsl: Store state block on pass variables. 2024-04-10 08:54:23 -05:00
Francisco Casas
a99bcb1196 vkd3d-shader/hlsl: Parse list of state blocks. 2024-04-10 08:54:23 -05:00
Francisco Casas
80320f6129 vkd3d-shader/hlsl: Introduce hlsl_ir_stateblock_constant. 2024-04-10 08:54:23 -05:00
Francisco Casas
ee0d439a1b vkd3d-shader/hlsl: Parse and store state blocks on variables. 2024-04-10 08:54:23 -05:00
Zebediah Figura
5fbd2708c0 vkd3d-shader/hlsl: Move shader version helpers to hlsl.h. 2024-04-09 12:27:43 -05:00
Francisco Casas
3a0a4b625f vkd3d-shader/hlsl: Merge HLSL_OP3_MOVC into HLSL_OP3_TERNARY. 2024-04-09 12:27:02 -05:00
Francisco Casas
19fd43214b vkd3d-shader/hlsl: Ensure that TERNARY condition is always bool.
Also, properly casting it to float in lower_ternary() for SM1
avoids creating ABS and NEG on bool types.
2024-04-09 12:26:59 -05:00
Nikolay Sivov
4b0a328a2b vkd3d-shader/hlsl: Allow 'export' modifier on functions.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-04-03 22:24:15 +02:00
Nikolay Sivov
e1e6367210 vkd3d-shader/fx: Add an option to include empty buffers in the effect binary.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-04-02 23:10:42 +02:00
Nikolay Sivov
c509c85f63 vkd3d-shader/hlsl: Allow annotations on constant buffers.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-04-02 23:10:40 +02:00
Zebediah Figura
6b6e4bc212 vkd3d-shader: Add a compile option to control whether implicit truncation warnings are printed.
d3dcompiler and d3dx9 versions before 42 don't emit this error; this will be
necessary to emulate that behaviour.

Other warnings exist that are introduced in different d3dcompiler versions,
although there are not very many distinct HLSL warnings to begin with.

We could of course group all these together under a single compiler option, but
I find that using separate top-level options is unilaterally friendlier to an
API consumer, and simpler to implement as well. It also in some sense maps
conceptually to e.g. "-Wno-implicit-conversion".
2024-03-27 22:37:34 +01:00
Nikolay Sivov
4fc15d4b4a vkd3d-shader/fx: Add initial support for writing fx_2_0 parameters.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-18 23:07:30 +01:00
Francisco Casas
5c986b9cde vkd3d-shader/hlsl: Lower SLT instructions for pixel shaders.
Properly passing the inverse-trig.shader_test tests whose qualifiers
have been removed requires making spirv.c capable of handling ABS.
The same happens for the ps_3_0 equality test in
float-comparison.shader_test.
2024-03-14 22:49:29 +01:00
Francisco Casas
7b883eef53 vkd3d-shader/d3dbc: Check profiles before writing SLT and CMP. 2024-03-14 22:48:56 +01:00
Nikolay Sivov
e0ef45c0a3 vkd3d-shader: Parse a 'single' modifier.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-12 22:14:50 +01:00
Nikolay Sivov
13227f3852 vkd3d-shader: Add an option to enable child effects compilation.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-12 22:14:41 +01:00
Nikolay Sivov
75c019074a vkd3d-shader/hlsl: Allow modifiers on buffer declarations.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-08 23:35:40 +01:00
Nikolay Sivov
937d76507d vkd3d-shader/hlsl: Implement ternary operator for older vertex profiles.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56333
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-03-06 23:03:59 +01:00
Nikolay Sivov
371be3b60a vkd3d-shader/hlsl: Add DepthStencilView object type. 2024-02-22 22:45:26 +01:00
Nikolay Sivov
c2b1714c5c vkd3d-shader/hlsl: Add RenderTargetView object type.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-02-22 22:45:21 +01:00
Henri Verbeet
d4223a03c8 vkd3d-shader/hlsl: Replace HLSL_MODIFIER_RASTERIZER_ORDERED with a hlsl_type.e.resource flag. 2024-02-21 23:23:08 +01:00
Henri Verbeet
49d14613a5 vkd3d-shader/hlsl: Introduce hlsl_type.e.resource. 2024-02-21 23:23:06 +01:00
Francisco Casas
8df34fce62 vkd3d-shader/hlsl: Emit fixme on non-direct resource stores.
Co-authored-by: Giovanni Mascellani <gmascellani@codeweavers.com>

These may happen when storing to structured buffers, and we are not
handling them properly yet. The included test reaches unreacheable code
before this patch.

Storing to buffers is complicated since we need to split the index
chain in two paths:
- The path within the variable where the resource is.
- The subpath to the part of the resource element that is being stored
  to.

For now, we will emit a fixme when the index chain in the lhs is not a
direct resource access.
2024-02-19 21:12:14 +01:00
Nikolay Sivov
c107ec03b8 vkd3d-shader/fx: Add initial support for writing buffers descriptions.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-02-19 21:12:08 +01:00
Francisco Casas
e1c759e1c9 vkd3d-shader/hlsl: Record valid methods in object_methods[].
Also, call hlsl_sampler_dim_count() and hlsl_offset_dim_count() after
type checking, to avoid reaching unreacheable cases.
2024-02-19 21:11:46 +01:00
Evan Tang
ee867bd470 vkd3d-shader/hlsl: Parse rasteriser-ordered view types. 2024-02-15 23:29:46 +01:00
Nikolay Sivov
e72f8f9a30 vkd3d-shader/hlsl: Add passes variables to the techniques.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-23 20:26:16 +01:00
Nikolay Sivov
fe8881747b vkd3d-shader/hlsl: Add initial support for parsing annotations.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-23 20:26:15 +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
Nikolay Sivov
e527d7c1e7 vkd3d-shader/hlsl: Handle effect group statement.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-11 23:04:46 +01:00