Commit Graph

3672 Commits

Author SHA1 Message Date
Nikolay Sivov
4b3707aeb4 vkd3d-shader/hlsl: Partially implement trunc().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-04-28 21:04:11 +02:00
Conor McCarthy
5366ca7001 vkd3d: Synchronise concurrent descriptor heap binding by multiple command lists.
It is possible for multiple command lists to use the same heap, and
submit it simultaneously to multiple d3d12 queues.
2023-04-28 21:04:02 +02:00
Conor McCarthy
fa63da6030 vkd3d: Track all descriptor heaps bound during command list recording and flush their writes.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54895
2023-04-28 21:04:02 +02:00
Ethan Lee
d3876e49bc tests: Add tests for ddx(), ddy() intrinsics.
Thanks to Giovanni for the second set of tests! Note that the
tolerance for the final pixel was set much higher than the others;
this test seems to be an issue for some devices (in my case, a 7900
XTX running RADV).

Co-authored-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Ethan Lee <flibitijibibo@gmail.com>
2023-04-28 21:03:43 +02:00
Ethan Lee
138c32ce88 vkd3d-shader/hlsl: Add support for ddx(), ddy() intrinsics.
SPIR-V already handled DSX/DSY, so only D3DBC/TPF needed new case blocks.

Signed-off-by: Ethan Lee <flibitijibibo@gmail.com>
2023-04-28 21:03:40 +02:00
Nikolay Sivov
af4bb03795 vkd3d-shader/hlsl: Implement SampleBias() method.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-04-26 22:46:55 +02:00
Nikolay Sivov
c166ab9727 vkd3d-shader/hlsl: Add separate helpers to generate object methods.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-04-26 22:46:53 +02:00
Nikolay Sivov
4fe4784e8a tests: Add a simple test for "discard".
Signed-off-by: Ethan Lee <flibitijibibo@gmail.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-04-26 22:46:52 +02:00
Ethan Lee
e541e71532 tests: Remove rtv clears in Vulkan runner.
Signed-off-by: Ethan Lee <flibitijibibo@gmail.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-04-26 22:46:52 +02:00
Nikolay Sivov
c74d148cbe tests: Remove rtv clears in d3d12 runner.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-04-26 22:46:52 +02:00
Nikolay Sivov
59c63ec584 vkd3d-shader/hlsl: Handle discard statement.
Signed-off-by: Ethan Lee <flibitijibibo@gmail.com>
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-04-26 22:46:50 +02:00
Nikolay Sivov
6da7d16d4c vkd3d-shader/trace: Add separate id for discard.
Signed-off-by: Ethan Lee <flibitijibibo@gmail.com>
2023-04-26 22:46:49 +02:00
Conor McCarthy
06cc2e1aee vkd3d: Collect multiple descriptor writes in a buffer and update in one call.
Reduces the cost of calling vkUpdateDescriptorSets() via winevulkan
and its thunks. The performance gain can be as high as 20%.
2023-04-25 22:20:17 +02:00
Conor McCarthy
f50e53e7c9 vkd3d: Use atomic exchange for descriptor writes.
The descriptor component of struct d3d12_desc is replaced with a union
containing a pointer which can be swapped out using
InterlockedExchangePointer(). To make it safe to increment the refcount
of such an object it is necessary to cache freed objects. Elimination
of the descriptor mutexes on games which use multithreaded descriptor
writes nearly doubles framerate on recent hardware.
2023-04-25 22:20:15 +02:00
Conor McCarthy
e63201a7a3 vkd3d: Delay writing Vulkan descriptors until submitted to a queue.
Eliminates vk_sets_mutex. Performance on average may be lower until
the descriptor mutexes are replaced and Vulkan writes are buffered
to reduce thunk calls.
2023-04-25 22:20:09 +02:00
Conor McCarthy
505c8c5a2f vkd3d: Ensure descriptors are pointer aligned.
The descriptor structure contains pointer and size types.
2023-04-25 22:20:06 +02:00
Zebediah Figura
b46df551eb vkd3d-shader/tpf: Return unsigned int from hlsl_sm4_register_from_semantic().
Fix a compile warning:

../vkd3d/libs/vkd3d-shader/hlsl_codegen.c: In function 'allocate_semantic_register':
../vkd3d/libs/vkd3d-shader/hlsl_codegen.c:2947:85: error: passing argument 4 of 'hlsl_sm4_register_from_semantic' from incompatible pointer type [-Werror=incompatible-pointer-types]
 2947 |         if ((builtin = hlsl_sm4_register_from_semantic(ctx, &var->semantic, output, &type, NULL, &has_idx)))
      |                                                                                     ^~~~~
      |                                                                                     |
      |                                                                                     unsigned int *
In file included from ../vkd3d/libs/vkd3d-shader/hlsl_codegen.c:21:
../vkd3d/libs/vkd3d-shader/hlsl.h:1171:52: note: expected 'enum vkd3d_sm4_register_type *' but argument is of type 'unsigned int *'
 1171 |         bool output, enum vkd3d_sm4_register_type *type, enum vkd3d_sm4_swizzle_type *swizzle_type, bool *has_idx);
      |                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
2023-04-21 20:55:56 +02:00
Nikolay Sivov
317b8aa039 vkd3d-shader/hlsl: Ignore "unroll" attribute for loops. 2023-04-21 20:55:48 +02:00
Henri Verbeet
8e0df3f720 vkd3d-shader/sm1: Merge hlsl_sm1.c into d3dbc.c. 2023-04-20 22:54:32 +02:00
Henri Verbeet
99bc07ccf5 vkd3d-shader/sm4: Merge sm4.h into tpf.c. 2023-04-20 22:54:31 +02:00
Henri Verbeet
7800c7b40f vkd3d-shader/sm4: Rename hlsl_sm4.c to tpf.c. 2023-04-20 22:54:30 +02:00
Henri Verbeet
804e315b68 vkd3d-shader/sm4: Move the TPF parser from dxbc.c to hlsl_sm4.c. 2023-04-20 22:54:28 +02:00
Zebediah Figura
e34bdcab3a tests/shader_runner: Remove a redundant vkd3d_test_pop_context().
We already popped the context here.

Move the break inside the previous if to make control flow a little clearer.
2023-04-20 22:54:23 +02:00
Zebediah Figura
0959c6663f vkd3d-shader/hlsl: Remove an unused local variable from create_loop(). 2023-04-20 22:54:13 +02:00
Zebediah Figura
39a03cfd22 vkd3d-shader/hlsl: Return an hlsl_ir_node pointer from hlsl_new_load_component(). 2023-04-20 22:54:12 +02:00
Zebediah Figura
a98686ed78 vkd3d-shader/hlsl: Return an hlsl_ir_node pointer from add_load_component(). 2023-04-20 22:54:11 +02:00
Zebediah Figura
e5ec431784 vkd3d-shader/hlsl: Return an hlsl_ir_node pointer from hlsl_new_jump(). 2023-04-20 22:54:10 +02:00
Zebediah Figura
dfe056596a vkd3d-shader/hlsl: Return an hlsl_ir_node pointer from hlsl_new_int_constant(). 2023-04-20 22:54:09 +02:00
Conor McCarthy
a4a95aa950 vkd3d: Treat negative viewport widths as invalid.
Negative widths are not supported in Vulkan.
2023-04-20 22:53:48 +02:00
Conor McCarthy
5d724abc96 vkd3d: Do not skip all viewports if one is invalid.
Fixes blank screen in Assassin's Creed: Valhalla.
2023-04-20 22:53:46 +02:00
Ethan Lee
81cc077b53 tests: Add tests for any() intrinsic.
Currently only tests float and bool, scalar and vector.

Signed-off-by: Ethan Lee <flibitijibibo@gmail.com>
2023-04-19 20:46:53 +02:00
Ethan Lee
0668d32631 vkd3d-shader/hlsl: Add support for any() intrinsic.
For now, this is limited to float and bool, scalar and vector. All other types are unsupported.

Signed-off-by: Ethan Lee <flibitijibibo@gmail.com>
2023-04-19 20:46:53 +02:00
Francisco Casas
3f9cd58f5b vkd3d-shader/hlsl: Fix missing extern resource names. 2023-04-19 20:46:53 +02:00
Giovanni Mascellani
625155bd3c tests: Pop the shader runner context after processing the current section.
This way failures produced while compiling or preprocessing a shader
are shown with the appropriate context.
2023-04-19 20:46:53 +02:00
Conor McCarthy
db7359f36a tests: Test index buffer location zero in test_draw_indexed_instanced().
Only verify it doesn't crash.
2023-04-19 20:46:53 +02:00
Conor McCarthy
333fdf7c74 vkd3d: Check for index buffer location zero.
VK_EXT_robustness2 does not support null index buffers so we only
warn and return immediately.
2023-04-19 20:46:53 +02:00
Conor McCarthy
5244fa572f tests: Test null addresses in test_update_root_descriptors(). 2023-04-19 20:46:00 +02:00
Conor McCarthy
0526f232cd vkd3d: Support null address for SRV/UAV root descriptors. 2023-04-19 20:46:00 +02:00
Conor McCarthy
963e5e26dc vkd3d: Support null address for CBV root descriptors. 2023-04-19 20:46:00 +02:00
Nikolay Sivov
827a359b45 vkd3d-shader/hlsl: Handle uppercase regset names in packoffset().
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
2023-04-19 20:45:50 +02:00
Nikolay Sivov
0cea4d352e vkd3d-shader/hlsl: Handle uppercase regset names in register(). 2023-04-19 20:45:48 +02:00
Zebediah Figura
d8ef0c69a8 vkd3d-shader/spirv: Do not declare resources as multisampled if the sample count is 1.
It is illegal to match a SPIR-V multisampled resource to a Vulkan resource which
is not multisampled. Vulkan considers a resource to be multisampled if its
sample count is greater than 1 (and SPIR-V does not care about the sample count).

This fixes validation errors in the case where the sample count does actually
match the resource. In order to provide correct behaviour when there is a
mismatch, or when the sample count is missing, we will need yet another
additional interface. In the absence of that it seems best to provide a best
guess.

This fixes a validation error with the not-yet-committed merge request 135, when
the d3d11 runner is run through Wine with the Vulkan backend.
2023-04-19 20:45:39 +02:00
Nikolay Sivov
dfe923ea1d vkd3d-shader: Consistently pass location structure by pointer. 2023-04-19 20:45:31 +02:00
Conor McCarthy
0ce55e8b8e vkd3d: Support 1D SRV. 2023-04-18 22:00:17 +02:00
Conor McCarthy
6db9ed14dc vkd3d: Support 1D UAV. 2023-04-18 22:00:17 +02:00
Conor McCarthy
7d0aaea4f8 tests: Test 1D UAV clear. 2023-04-18 22:00:01 +02:00
Zebediah Figura
7ee66351c8 vkd3d-shader/hlsl: Return an hlsl_ir_node pointer from hlsl_new_if(). 2023-04-18 21:59:49 +02:00
Zebediah Figura
50f0ae1b21 vkd3d-shader/hlsl: Pass hlsl_block pointers to hlsl_new_if(). 2023-04-18 21:59:45 +02:00
Zebediah Figura
5a3fe1609b vkd3d-shader/hlsl: Initialize the block in clone_block(). 2023-04-18 21:59:44 +02:00
Zebediah Figura
733141720a vkd3d-shader/hlsl: Introduce a hlsl_block_cleanup() helper. 2023-04-18 21:59:42 +02:00