Commit Graph

4191 Commits

Author SHA1 Message Date
Francisco Casas
b5f2e7daeb vkd3d-shader/hlsl: Parse function call syntax on state blocks. 2024-07-09 20:36:28 +02:00
Francisco Casas
7bd53cf6d9 vkd3d-shader/hlsl: Free array sizes on function parameters (Valgrind). 2024-07-09 20:32:25 +02:00
Francisco Casas
b92baa40ec vkd3d-shader/d3dbc: Don't write inconsequential MOVs.
CASTs from floats to integers are implemented as mere MOVs. These often,
but not always, end up moving the value from one register to the same
register.

This patch avoids writing the MOV instructions if they have no effect.
2024-07-09 20:32:25 +02:00
Francisco Casas
daa13934a4 vkd3d-shader/d3dbc: Use vsir_program I/O signatures to write dcls.
Instead of relying on ctx->extern vars, semantics are now stored in the
vsir_program signatures, and then read to write the declarations.
2024-07-09 20:31:14 +02:00
Francisco Casas
704ce03561 vkd3d-shader/d3dbc: Don't require a hlsl_semantic to get register and usage. 2024-07-09 20:12:47 +02:00
Francisco Casas
003f4c7600 vkd3d-shader/d3dbc: Use program->shader_version instead of ctx->profile. 2024-07-09 20:06:23 +02:00
Francisco Casas
a333090288 vkd3d-shader/d3dbc: Introduce struct d3dbc_compiler. 2024-07-09 19:44:03 +02:00
Francisco Casas
dd8aa2ec91 vkd3d-shader/hlsl: Generate CTAB outside d3dbc_compile().
There is no way to store this information from the vsir_program alone,
so we make d3dbc_compile() expect the CTAB blob.
2024-07-09 18:59:54 +02:00
Francisco Casas
130b3335cb vkd3d-shader/d3dbc: Split hlsl_sm1_write().
The idea is to start splitting the

    HLSL IR -> d3dbc

translation into

    HLSL IR -> vsir -> d3dbc

So hlsl_sm1_write is split into two functions, sm1_generate_vsir()
which should handle the first part and d3dbc_compile() which should
handle the second part.

This translation should be completed once the hlsl_ctx and entry_func
are no longer used in d3dbc_compile().
2024-07-09 18:38:00 +02:00
Zebediah Figura
6db2bc3eff vkd3d-shader/d3dbc: Use enum vkd3d_shader_register_type in struct sm1_instruction. 2024-07-09 16:59:02 +02:00
Nikolay Sivov
3dc43e8945 vkd3d-shader: Disallow object structure fields for fx profiles.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:49:28 +02:00
Giovanni Mascellani
7958babb39 vkd3d: Do not synchronize with the tessellation shader stages if they're not enabled.
Similarly to a54187f3c9, this fixes some validation
errors on devices that do not support tessellation; the Adreno 540 on my OnePlus 5
phone in my specific case.
2024-07-08 18:49:28 +02:00
Nikolay Sivov
937a80ead6 vkd3d-shader/fx: Write annotations for fx_4+ profiles.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:49:28 +02:00
Nikolay Sivov
0f7ac0a054 vkd3d-shader/hlsl: Set default values for annotations variables.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:49:06 +02:00
Nikolay Sivov
4d2ce385a7 vkd3d-shader/hlsl: Do not crash on initialization of a redefined variable.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:24:46 +02:00
Nikolay Sivov
0a344bd3c9 vkd3d-shader/fx: Add missing fields for structure types on fx_5_0.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:24:46 +02:00
Nikolay Sivov
8738e4662e vkd3d-shader/fx: Preserve parsing order of initializer components.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:24:46 +02:00
Nikolay Sivov
c97c652ff0 vkd3d-shader/fx: Fix packed size for fx_4+ types.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:24:46 +02:00
Nikolay Sivov
856686b2a2 vkd3d-shader/fx: Write default numeric values.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:24:46 +02:00
Nikolay Sivov
aea36be94c vkd3d-shader/fx: Fix structure type data written for fx_4.
Strings and field types are written to the same unstructured area
as structure type itself, so it has to be done in two passes.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:24:46 +02:00
Nikolay Sivov
2176294df8 vkd3d-shader/hlsl: Implement tex*grad() functions.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:23:38 +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
Elizabeth Figura
4cd2dd50f9 vkd3d-shader/hlsl: Separate an "array" rule. 2024-07-08 18:22:39 +02:00
Nikolay Sivov
94130c2394 vkd3d-shader/fx: Add support for writing RasterizerState objects.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:12:03 +02:00
Nikolay Sivov
f03cb7e911 vkd3d-shader/hlsl: Add RasterizerState type.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:12:03 +02:00
Nikolay Sivov
12947aa50d vkd3d-shader/fx: Add support for writing DepthStencilState objects.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:12:03 +02:00
Nikolay Sivov
1008c49ce6 vkd3d-shader/fx: Cast state block field values to target type.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:12:03 +02:00
Francisco Casas
597e55691a vkd3d-shader/hlsl: Only error out on bind_count register reservation overlaps for SM1.
While on SM1 a register reservation reserves the whole size in
registers of the variable's data type, overlapping conflicts are only
checked up to the bind_count (used size) for each variable.
2024-07-08 18:12:03 +02:00
Nikolay Sivov
48ff7de8ef vkd3d-shader/hlsl: Add support for ConstantBuffer<> type.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-07-08 18:12:03 +02:00
Victor Chiletto
abbcf0461f vkd3d-shader/hlsl: Reserve register slots for unused buffers. 2024-07-03 17:09:16 -03:00
Victor Chiletto
da36a447b8 vkd3d-shader/hlsl: Validate cbuffer register allocations. 2024-07-03 17:09:16 -03:00
Victor Chiletto
27414ef928 vkd3d-shader/hlsl: Do not immediately fail parsing for malformed 'b' register reservations.
This is a fxc quirk. In most cases, this throws an error, but for global
variables it's completely ignored.
2024-07-03 17:09:16 -03:00
Victor Chiletto
b5b3c8b9ff vkd3d-shader/hlsl: Ignore bracket offsets for 'b' register types prior to SM 5.1.
This is a fxc quirk that was fixed for SM >= 5.1 only.
2024-07-03 14:34:45 -03:00
Victor Chiletto
8fb3b604bf vkd3d-shader/hlsl: Pass a pointer to struct hlsl_reg_reservation in parse_reservation_index.
Instead of passing the struct components individually.
2024-07-03 14:05:58 -03:00
Victor Chiletto
e13eb64d4c vkd3d-shader/hlsl: Support expressions as register offsets. 2024-07-03 14:05:58 -03:00
Yuxuan Shui
ccb6150aab vkd3d-shader/hlsl: Implement storing to a swizzled matrix. 2024-06-20 12:39:46 +02:00
Elizabeth Figura
acc9d79fbb vkd3d-shader/hlsl: Only allocate the aligned size for uniforms. 2024-06-18 13:19:44 -05:00
Elizabeth Figura
7fe581203b vkd3d-shader/hlsl: Respect the coords writemask in write_sm1_resource_load().
Spotted by Francisco Casas.
2024-06-18 13:19:44 -05:00
Henri Verbeet
90f26759b5 vkd3d: Always use UINT views to clear UAVs with integer formats.
We would previously try to use float pipelines for SINT formats.
2024-06-13 23:26:35 +02:00
Giovanni Mascellani
a54187f3c9 vkd3d: Do not synchronize with the geometry shader stage if it's not enabled. 2024-06-13 23:24:22 +02:00
Giovanni Mascellani
a1a07de8ca vkd3d: Enable VK_KHR_portability_subset if available.
We don't check it, but at least the validation layer does not complain
when using MoltenVK.
2024-06-13 23:24:22 +02:00
Giovanni Mascellani
3254eff328 vkd3d: Do not request VK_EXT_debug_marker if debug is disabled.
Because it requires VK_EXT_debug_report.
2024-06-13 23:24:22 +02:00
Nikolay Sivov
222c52380b vkd3d-shader/fx: Fix variable buffer offset value.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-06-12 19:02:20 +02:00
Nikolay Sivov
402dc94259 vkd3d-shader/fx: Set EXPLICIT_BIND_POINT flag for packoffset() reservations as well.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-06-12 19:02:20 +02:00
Elizabeth Figura
2f88442d7d vkd3d-shader/hlsl: Always initialize $$ when parsing modifiers from an arbitrary string.
This avoids spurious errors like "row_major and column_major are mutually
exclusive" when an invalid modifier is used.

Fixes: cf7c05f431
2024-06-11 15:54:10 +02:00
Nikolay Sivov
72ddea6030 vkd3d-shader/fx: Use original full semantic name.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-06-11 15:53:19 +02:00
Nikolay Sivov
1124ea46ee vkd3d-shader/hlsl: Store original semantic name.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-06-11 15:53:19 +02:00
Conor McCarthy
47d077e5ce vkd3d: Interpret a null vertex buffer 'views' pointer as a null buffer. 2024-06-11 15:52:28 +02:00
Conor McCarthy
589ed1e358 vkd3d: Allow block compressed textures to have unaligned width and height. 2024-06-11 15:51:34 +02:00
Nikolay Sivov
ba18035260 vkd3d-shader/d3dbc: Write load instruction for tex2Dbias().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-06-11 15:50:34 +02:00