Commit Graph

114 Commits

Author SHA1 Message Date
Conor McCarthy
571d807dd8 vkd3d-shader/dxil: Read the type table. 2023-07-11 22:43:48 +02:00
Alistair Leslie-Hughes
d5a0b3afc4 include: Avoid including unnecessary Windows headers.
We only require a few types and declarations.
2023-06-28 21:41:14 +02:00
Conor McCarthy
d3e6a3a78f include: Introduce a function to detect the DXBC source type. 2023-06-28 21:40:36 +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
Zebediah Figura
6783524613 vkd3d-common: Make some global string variables const. 2023-04-06 17:52:08 +02:00
Zebediah Figura
dfa4bfdd03 include: Make test context information nestable.
Based on Wine.
2023-04-04 21:59:58 +02:00
Zebediah Figura
1bf5050d3d tests: Factor out vkd3d_test_printf(). 2023-04-04 21:59:58 +02:00
Zebediah Figura
8bdee6681b vkd3d-shader/hlsl: Lower return statements. 2023-02-13 22:16:51 +01:00
Brendan Shanks
963ea98a52 vkd3d-common: Add a Windows implementation of vkd3d_set_thread_name(). 2022-10-25 21:25:38 +02:00
Zebediah Figura
303ce66cef include: Use __MINGW_PRINTF_FORMAT when compiling with MinGW.
The default for MinGW is always ms_printf rather than gnu_printf, but if we are
using ucrtbase or ANSI stdio, we want gnu_printf.
2022-10-17 17:57:56 +02:00
Giovanni Mascellani
d5fd309ef8 vkd3d: Add a macro to mark unreachable code.
This should silence warnings about some branches non returning any value
without requiring additional "return 0" statement or similar.

Also, in theory this might enable to compiler to optimize the program
a little bit more, though that's unlikely to have any measurable effect.
2022-09-27 20:14:27 +02:00
Zebediah Figura
a2996c2d59 include: Add list_move_after() and list_move_before().
Signed-off-by: Francisco Casas <fcasas@codeweavers.com>
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
2022-08-10 21:33:33 +02:00
Zebediah Figura
174172887b vkd3d-shader: Allow writing log output via a custom callback.
When using PE vkd3d through Wine, debug output may be swallowed by writing to
Win32 stderr. Avoid this by providing a way to hook up vkd3d log output to Wine
output.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-06-07 19:38:49 +02:00
Zebediah Figura
d087b9ea5b include: Implement vkd3d_dl*() wrappers for Win32 platforms.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-20 16:41:39 +02:00
Zebediah Figura
a58e713314 include: Move vkd3d_dl*() helpers to vkd3d_common.h.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-04-20 16:41:37 +02:00
Conor McCarthy
2b71ea406f vkd3d: Back descriptor heaps with Vulkan descriptor sets if descriptor indexing is available.
The existing implementation using virtual descriptor heaps, where Vk
descriptor sets are created for the bindings in the root descriptor tables,
is inefficient when multiple command lists are used with large descriptor
heaps. It also cannot support updating a descriptor set after it is bound.

This patch creates Vk sets for each D3D12 heap. Because D3D12 heaps
can contain CBV, SRV and UAV descriptors in the same heap, multiple Vk sets
are needed for each heap, however the total number of populated descriptors
is never more than (heap size + UAV counter count).

A new 'virtual_heaps' config option is introduced to make the old
implementation available when needed. It's not always possible to determine
if this is necessary when the device is created.

Up to nine Vk descriptor sets may be used. It's theoretically possible to
reduce this to eight by placing immutable samplers in the push descriptor
set layout, but contradictions in earlier versions of the Vulkan spec made
driver support inconsistent. The documentation was corrected in version
1.2.203.

This patch also adds support for UAV counter descriptor arrays. It's not
practical to add this in a separate patch due to complications with
combining the old UAV counter implementation with the new descriptor heap
implementation.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47713
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=47154
Signed-off-by: Conor McCarthy <cmccarthy@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-18 12:38:53 +01:00
Henri Verbeet
4728cf1286 include: Introduce a common macro for defining tags.
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-03-01 22:31:33 +01:00
Henri Verbeet
790ab754d5 vkd3d-shader/hlsl: Properly compare integers in compare_param_hlsl_types().
As pointed out by Giovanni Mascellani, modular subtraction doesn't produce a
total order; in particular, it's not transitive. The nature of the types being
compared here makes it unlikely this will be an issue in practice, but it's
both fragile and setting a poor example.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-02-28 22:23:24 +01:00
Alexandre Julliard
beafa0914e vkd3d: Replace atomic_add_fetch() by InterlockedAdd().
By analogy with InterlockedIncrement. It avoids the need for a
configure check on Windows platforms.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
2022-01-28 17:48:32 +01:00
Alexandre Julliard
ab3aa96e1f vkd3d: Always use _BitScanReverse on Windows.
Use ULONG instead of unsigned long for non-Mingw msvcrt builds.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
2022-01-28 17:48:30 +01:00
Zebediah Figura
85d61f0c64 tests: Move HLSL shader compilation to a new d3d12 shader runner backend.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-27 18:00:34 +01:00
Zebediah Figura
d0e539aec9 include: Avoid using a field reference as a truth value.
Ported from 5d01ebab89cee8a3499ee00729c048068d5b719d from Wine.

Despite the commit message there, even GCC 11.1 chokes on this.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2022-01-06 11:32:22 +01:00
Zebediah Figura
7c534f4a77 tests: Return a failure code if unable to parse a shader_test file.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Giovanni Mascellani <gmascellani@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-11-09 19:56:28 +01:00
Henri Verbeet
f7662f9878 vkd3d-shader/sm1: Introduce a parser for the legacy D3D byte-code format.
This is largely derived from the parser in Wine/wined3d, as of wine-6.18.

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-10-06 18:35:44 +02:00
Matteo Bruni
54bef05070 include: Print failed allocation size.
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-27 21:20:28 +02:00
Zebediah Figura
464dae2c46 vkd3d-shader/hlsl: Write SM4 signatures.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-23 20:50:55 +02:00
Zebediah Figura
ed7cdb3940 vkd3d-shader: Introduce vkd3d_make_u{16, 32}() helpers.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-11 20:58:24 +02:00
Zebediah Figura
d27fee64ab build: Make the default symbol visibility "hidden".
We tag far fewer symbols this way.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-08-09 21:43:22 +02:00
Zebediah Figura
bcf272aa0b vkd3d: Introduce a vkd3d_bound_range() helper.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-07-27 13:55:40 +02:00
Zebediah Figura
86cb863bc2 vkd3d-shader: Implement basic support for #if and #endif.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2021-01-04 21:01:04 +01:00
Zebediah Figura
ffa7bd39f3 tests: Add some C HLSL preprocessor tests.
That is, tests in C, for features of the HLSL preprocessor which are difficult
to test using the shader_runner framework.

Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-11-24 22:28:11 +01:00
Zebediah Figura
ce58af9df8 vkd3d: Move hresult_from_vkd3d_result to vkd3d-common.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-29 18:34:06 +02:00
Zebediah Figura
e5fea6ade0 vkd3d: Move the ID3DBlob implementation to vkd3d-common.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-09-24 19:11:39 +02:00
Zebediah Figura
04598b1316 include: Correct the case of rbtree macros.
Signed-off-by: Zebediah Figura <zfigura@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2020-08-01 11:31:57 +02:00
Hans-Kristian Arntzen
f180e95e2f vkd3d: Add MSVC path for atomic_add_fetch.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-01 19:16:20 +02:00
Hans-Kristian Arntzen
50bd2db618 vkd3d: Fix use of non-standard vararg macros.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-01 19:15:39 +02:00
Hans-Kristian Arntzen
69660ca5c9 vkd3d: Add MSVC path for vkd3d_log2i.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-01 19:14:59 +02:00
Hans-Kristian Arntzen
1e5ebae339 vkd3d: Add MSVC path for popcount.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-10-01 19:14:20 +02:00
Józef Kucia
b71120d78d tests: Introduce VKD3D_TEST_FILTER.
Useful for running a subset of tests.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-07-31 09:37:57 +02:00
Józef Kucia
eb340126b6 vkd3d-common: Move vkd3d_write_mask_is_contiguous() from vkd3d-shader.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-07-05 17:52:04 +02:00
Józef Kucia
f723a791d5 tests: Add test for parsing version.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-18 16:40:46 +02:00
Józef Kucia
0baf0302d1 vkd3d: Avoid holding mutex while waiting for fences.
We maintain separate arrays for enqueued fences and fences owned by the
fence worker thread.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-13 20:56:35 +02:00
Józef Kucia
285a19408f vkd3d: Introduce FIXME_ONCE().
The debug log level is demoted to WARN after the FIXME is printed once.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-06-12 22:37:44 +02:00
Józef Kucia
51b930192a vkd3d: Handle lists in debug env vars consistently.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-17 20:41:09 +02:00
Józef Kucia
6f960f2096 tests: Add VKD3D_TEST_BUG env var to control bug_if() conditions.
Run tests with VKD3D_TEST_BUG=0 to disable bug_if() conditions.

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-09 08:21:08 -05:00
Józef Kucia
9babc0fb44 include: Define TRACE_ON() for VKD3D_NO_TRACE_MESSAGES.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-06 15:29:54 -05:00
Józef Kucia
e7b94e0337 vkd3d: Enable Vulkan debug extensions independently of debug log level.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-01 22:54:23 +02:00
Józef Kucia
df72746729 vkd3d-shader: Use locale-insensitive string comparison.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-05-01 22:54:20 +02:00
Józef Kucia
1172e66f6d include: Use "do { } while (0)" when VKD3D_NO_{TRACE, DEBUG}_MESSAGES is defined.
In order to handle the following construct correctly:

  if (...) TRACE(...);

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-26 16:37:10 +02:00
Józef Kucia
0abbf5ed76 include: Introduce VKD3D_NO_TRACE_MESSAGES and VKD3D_NO_DEBUG_MESSAGES.
Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
2019-04-04 17:25:34 +02:00