Commit Graph

2334 Commits

Author SHA1 Message Date
Conor McCarthy
e1dddc01b7 vkd3d-shader/ir: Flatten IF/ELSE/ENDIF control flow instructions. 2024-01-17 22:28:34 +01:00
Conor McCarthy
f3d464de0e vkd3d-shader/spirv: Handle RETP in spirv_compiler_handle_instruction(). 2024-01-17 22:28:33 +01:00
Conor McCarthy
bc1b5e7132 vkd3d-shader/spirv: Handle DISCARD and TEXKILL in spirv_compiler_handle_instruction(). 2024-01-17 22:28:31 +01:00
Conor McCarthy
db0d51675c vkd3d-shader/spirv: Emit descriptor offset loads in the function entry block.
Ensures they are loaded only once per function independent of the
control flow graph.
2024-01-17 22:28:29 +01:00
Henri Verbeet
68b898fcb6 vkd3d-shader/tpf: Store the "precise" mask as a uint32_t in shader_sm4_read_instruction(). 2024-01-15 19:58:22 +01:00
Henri Verbeet
ad2af68d2a vkd3d-shader/tpf: Store the "recognized_bits" mask as a uint32_t in shader_sm4_read_instruction_modifier(). 2024-01-15 19:58:21 +01:00
Henri Verbeet
b8903f5526 vkd3d-shader/tpf: Store the current token as a uint32_t in shader_sm4_read_dst_param(). 2024-01-15 19:58:20 +01:00
Henri Verbeet
fd854bc0c0 vkd3d-shader/tpf: Store the current token as a uint32_t in shader_sm4_read_src_param(). 2024-01-15 19:58:19 +01:00
Henri Verbeet
c5facd4e03 vkd3d-shader/tpf: Store the "addressing" token as a uint32_t in shader_sm4_read_param(). 2024-01-15 19:58:18 +01:00
Henri Verbeet
b1c538e0fe vkd3d-shader/tpf: Store the "components" token as a uint32_t in shader_sm4_read_dcl_resource(). 2024-01-15 19:58:17 +01:00
Henri Verbeet
9896394220 vkd3d-shader/tpf: Pass a uint32_t modifier token to shader_sm4_read_instruction_modifier(). 2024-01-15 19:58:15 +01:00
Nikolay Sivov
1a036ddff6 vkd3d-shader/fx: Do not write the same string twice. 2024-01-15 19:57:43 +01:00
Nikolay Sivov
e7d65d39ba vkd3d-shader/fx: Initial support for fx_5_0 output. 2024-01-15 19:57:42 +01:00
Nikolay Sivov
8014c11e88 vkd3d-shader/fx: Write empty passes blocks.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-15 19:57:41 +01:00
Nikolay Sivov
e1dca9b27a vkd3d-shader/hlsl: Add a scope for technique variables.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-15 19:57:39 +01:00
Nikolay Sivov
0a6d842ed1 vkd3d-shader/hlsl: Rename the rule for an optional name.
Names are optional for both techniques and passes.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-15 19:57:37 +01:00
Francisco Casas
43ff28b00b vkd3d-shader/hlsl: Emit fixmes on non-constant vector addressing.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=56162

Storing to a vector component using a non-constant index is not allowed
on profiles lower than 6.0. Unless this happens inside a loop that can be
unrolled, which we are not doing yet.

For this reason, a validate_nonconstant_vector_store_derefs pass is
added to detect these cases.

Ideally we would want to emit an hlsl_error on this pass, but before
implementing loop unrolling, we could reach this point on valid HLSL.

Also, as pointed out by Nikolay in the mentioned bug, currently
new_offset_from_path_index() fails an assertion when this happens,
because it expects an hlsl_ir_constant, so a check is added.
It also felt correct to emit an hlsl_fixme there, despite the
redundancy.
2024-01-15 19:57:12 +01:00
Giovanni Mascellani
b0c8a47f9d vkd3d-shader/ir: Check that SSA registers are used validly.
Specifically, they are assigned only once and only assigned components
are used.

Right now we don't check that the assignment dominates all usages.
2024-01-15 19:57:01 +01:00
Giovanni Mascellani
26bebe8f91 vkd3d-shader/ir: Check that SSA registers have consistent dimensions. 2024-01-15 19:57:00 +01:00
Giovanni Mascellani
7503429555 vkd3d-shader/ir: Check that TEMP registers have consistent dimensions. 2024-01-15 19:56:59 +01:00
Giovanni Mascellani
fbd77486de vkd3d-shader/ir: Use vkd3d_free() instead of free(). 2024-01-15 19:56:58 +01:00
Giovanni Mascellani
26c6a87268 vkd3d-shader/ir: Simplify control flow in vsir_validate_register(). 2024-01-15 19:56:56 +01:00
Conor McCarthy
52902b042f vkd3d-shader/spirv: Support vector source param for FIRSTBIT_HI and FIRSTBIT_SHI instructions. 2024-01-15 19:56:35 +01:00
Henri Verbeet
3e2ace8d33 vkd3d-shader/dxbc: Use sizeof(uint32_t) instead of sizeof(DWORD) in calls to require_space(). 2024-01-11 23:05:56 +01:00
Henri Verbeet
69350e1ff0 vkd3d-shader/dxbc: Pass an unsigned int count to shader_parse_root_parameters1(). 2024-01-11 23:05:54 +01:00
Henri Verbeet
04acc52496 vkd3d-shader/dxbc: Pass a size_t offset to shader_get_string(). 2024-01-11 23:05:52 +01:00
Conor McCarthy
ac9b14599f vkd3d-shader/dxil: Avoid null dereference on failure to find function pointer type.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=55684
2024-01-11 23:05:17 +01:00
Giovanni Mascellani
78d95889bd vkd3d-shader: Make *src and *dst mutable in vkd3d_shader_instruction.
They were originally made const because no optimization/normalization
pass existed. Now having to cast away const all the time is becoming
more and more burdening.
2024-01-11 23:05:11 +01:00
Henri Verbeet
fd8a0d7fb6 vkd3d-shader/spirv: Pass a uint32_t write mask to spirv_compiler_emit_neg(). 2024-01-11 23:05:03 +01:00
Henri Verbeet
b4da553d28 vkd3d-shader/spirv: Pass a uint32_t write mask to spirv_compiler_emit_abs(). 2024-01-11 23:05:02 +01:00
Henri Verbeet
97acca715e vkd3d-shader/spirv: Pass a uin32_t write mask to spirv_compiler_emit_load_src(). 2024-01-11 23:05:01 +01:00
Henri Verbeet
5c2d0f42b5 vkd3d-shader/spirv: Pass a uint32_t write mask to vkd3d_symbol_set_register_info(). 2024-01-11 23:05:00 +01:00
Henri Verbeet
9dd5b2840f vkd3d-shader: Recognise DESCRIPTORS_STATIC_KEEPING_BUFFER_BOUNDS_CHECKS in shader_validate_descriptor_range1(). 2024-01-11 23:04:54 +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
9494b72224 vkd3d-shader: Add separate binary target type for effects.
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
Nikolay Sivov
f7a02a5da2 vkd3d-shader/hlsl: Add variables for techniques.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-11 23:04:45 +01:00
Nikolay Sivov
8494342fa0 vkd3d-shader/hlsl: Rename rule for top-level techniques.
Only technique10 and technique11 types could be nested in groups.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-11 23:04:43 +01:00
Nikolay Sivov
c3af1f9989 vkd3d-shader/hlsl: Add 'fxgroup' token.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2024-01-11 23:04:42 +01:00
Giovanni Mascellani
017f86aaaf vkd3d-shader/d3d-asm: Guess a sensible data type for literals.
When the typing information is not reliable.
2024-01-11 23:04:34 +01:00
Henri Verbeet
3344c4e93d vkd3d-shader/hlsl: Store modifier flags as a uint32_t. 2024-01-08 21:45:26 +01:00
Henri Verbeet
fafe2a1dba vkd3d-shader/hlsl: Store swizzles as a uint32_t. 2024-01-08 21:45:24 +01:00
Giovanni Mascellani
7f9803620f vkd3d-shader/spirv: Specify behavior for bit field instructions.
Bit field instructions in SPIR-V do not specify what happens when
offset + count exceeds the type bit width. After this commit we
refine the emitted code's behavior to match TPF.

This fixes a few failures on MoltenVK.
2024-01-08 21:44:52 +01:00
Henri Verbeet
5b9a0dfaea vkd3d-shader/ir: Store destination parameter shifts as an unsigned int. 2024-01-04 22:23:54 +01:00
Henri Verbeet
4b5d3a078b vkd3d-shader/ir: Store destination parameter modifier flags as a uint32_t. 2024-01-04 22:23:52 +01:00
Henri Verbeet
60842b7181 vkd3d-shader/ir: Store source parameter swizzles as a uint32_t. 2024-01-04 22:23:51 +01:00
Henri Verbeet
9f4ca3bc9c vkd3d-shader/ir: Store instruction flags as a uint32_t. 2024-01-04 22:23:49 +01:00
Giovanni Mascellani
bd9118cac4 vkd3d-shader/ir: Validate destination write masks depending on the dimension. 2024-01-04 22:23:25 +01:00
Giovanni Mascellani
15e7711786 vkd3d-shader/ir: Validate source swizzles depending on the dimension. 2024-01-04 22:23:24 +01:00
Giovanni Mascellani
e91da41dea vkd3d-shader/ir: Validate SSA registers. 2024-01-04 22:23:23 +01:00