Commit Graph

144 Commits

Author SHA1 Message Date
Hans-Kristian Arntzen ea088ceecf vkd3d: Use UINT64* instead of uint64_t* in 64-bit CAS.
Avoids alignment warnings on 32-bit.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-02-16 16:14:14 +00:00
Joshua Ashton 9b2841b50f tests: Fix -Wsign-compare warnings
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-02-15 17:54:54 +01:00
Georg Lehmann eaab2388b1 vkd3d: Fix warning with vkd3d_atomic_ptr*.
Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
2021-02-15 15:47:17 +01:00
Philip Rebohle 7549d70fbf vkd3d: Fix compiler errors when using vkd3d_atomic_ptr_store_explicit.
Atomic stores do not return anything, so we cannot cast to void* here.

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2021-02-11 15:15:59 +00:00
Joshua Ashton fccbd3b5e2 vkd3d: Eliminate wchar_size, use UTF-16 string literals
Achieves this with C standard stuff alone, and no compiler hacks.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2021-02-09 11:26:28 +01:00
Hans-Kristian Arntzen 13af141e84 common: Add truncated wide export strcmp.
Needed for GetShaderStackSize().

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-02-05 10:05:07 +01:00
Hans-Kristian Arntzen 86da5d9bad common: Add string utilities for dealing with entry point conventions.
Used across both vkd3d-shader and vkd3d, so makes sense to move this to
common code.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2021-02-05 10:05:07 +01:00
Hans-Kristian Arntzen 6b363e53d2 vkd3d: Actually compare against hashmap entry and not against itself.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-12-05 15:09:39 +01:00
Hans-Kristian Arntzen f67f55827e vkd3d: Parse patch version of PACKAGE_NAME as well.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-12-03 15:05:13 +01:00
Hans-Kristian Arntzen adf0be5bf1 vkd3d: Lower contention when spinlocking writers.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-12-02 13:12:56 +01:00
Hans-Kristian Arntzen b3024365d0 vkd3d: Add a reader-writer spinlock.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-12-02 13:12:56 +01:00
Hans-Kristian Arntzen c2c674194d vkd3d: Add Add/Sub/And atomic u32 intrinsics.
Will be used for reader-writer spinlocks.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-12-02 13:12:56 +01:00
Hans-Kristian Arntzen f96e60b6ac vkd3d: Make hashmap compatible with reader-writer locks.
Yield insertion when there is a match.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-12-02 13:12:56 +01:00
Georg Lehmann 24100cac07 vkd3d: Add Win32 PTHREAD_MUTEX_INITIALIZER.
Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
2020-11-18 18:29:48 +00:00
Philip Rebohle 1563b80852 include: Fix various issues with atomic CAS.
- fail/success memory orders exist for a reason, we can't
  e.g. do release on fail since it's a read-only operation
- silence some warnings about pointer->integer casts
- fix linker errors on mingw by marking functions as static

Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-11-18 12:39:14 +01:00
Joshua Ashton 4d95cafe10 vkd3d: Implement compare exchange atomics
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-11-16 09:33:26 +01:00
Joshua Ashton 1e810e8f9e vkd3d: Use consistent comment style in atomic header
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-11-16 09:33:26 +01:00
Joshua Ashton 093f0eb053 vkd3d: Implement 64-bit and pointer atomics
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-11-16 09:33:26 +01:00
Joshua Ashton 8dea487861 meta: Add missing newlines to end of files
Remove trailing whitespace also

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-11-05 17:16:57 +01:00
Hans-Kristian Arntzen 572ea9da7f common: Enable popcount and clz paths based on compiler.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-11-04 19:05:28 +01:00
Joshua Ashton 7325a49bd6 vkd3d: Include correct memory header in hashmap
Fixes warnings about implicit declaration of these functions
when building demos/programs which could be very bad on x64 if used.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-11-03 09:35:44 +01:00
Hans-Kristian Arntzen f991dea51a tests: Report successful TODOs separately from failures.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-30 08:16:16 +01:00
Philip Rebohle c53a0d6365 include: Fix hashmap constness issues.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-29 15:39:40 +01:00
Hans-Kristian Arntzen cd9c1fb9f3 vkd3d: Add an INFO debug level.
Useful for cases where we want to communicate important information to
the log by default, but not consider it an error.

Requested information which would only be logged when explicitly asked
for should also be considered INFO.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-28 17:03:54 +01:00
Hans-Kristian Arntzen 4d961f96ea vkd3d: Fix some nits with declaration-after-statement.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-28 11:04:06 +01:00
Philip Rebohle 36bdc02a05 include: Introduce void_ptr_offset.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-10-28 10:30:12 +01:00
Hans-Kristian Arntzen 3f1132ee8c vkd3d: Add support for InterlockedIncrement64.
To be used for cookies. Works on 32-bit as well, compiler emits 8b CAS loop
for us.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-10-12 12:46:07 +02:00
Joshua Ashton be2c0c1f1e include: Remove DECLSPEC_HIDDEN from headers
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-10-05 10:44:10 +02:00
Hans-Kristian Arntzen 250357c998 debug: Integrate automatic RenderDoc capturing.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-09-22 12:44:18 +02:00
Hans-Kristian Arntzen b93963b6ce debug: Log thread ID as well.
For multi-threaded apps, this is vital to make any sense of the log.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-09-08 15:03:41 +02:00
Philip Rebohle c06e2bdc83 vkd3d: Introduce vkd3d_wcslen.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-09-08 12:31:32 +02:00
Hans-Kristian Arntzen 254868a326 vkd3d: Enable pthread workaround paths on MinGW as well.
winpthread is slow on Wine as it requires OS synchronization
objects, which involves wineserver.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-09-08 09:34:26 +02:00
Hans-Kristian Arntzen 7d8ab2fb06 vkd3d: Replace CS with SRW.
On Wine, this is more efficient as it can use futex paths.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-09-08 09:34:26 +02:00
Hans-Kristian Arntzen 01a7ec6310 tests: Use fflush()
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-08-25 11:48:41 +02:00
Philip Rebohle 0303c396bc vkd3d: Add float_bits_to_uint32.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-08-19 12:54:56 +02:00
Philip Rebohle 50eb972c15 include: Add hash map implementation.
Signed-off-by: Philip Rebohle <philip.rebohle@tu-dortmund.de>
2020-08-19 12:54:56 +02:00
Hans-Kristian Arntzen e3c1b66aed common: Add a simple profiling module.
Works by mapping a memory block on disk, and then we simply increment
u64s. The caller code only needs to use VKD3D_REGION_{DECL,BEGIN,END}
macros.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-20 16:39:15 +02:00
Hans-Kristian Arntzen c8bbed15d7 vkd3d: Implement 32-bit bitmask iteration.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen 66b252e08f vkd3d: Remove reliance on HAVE_BUILTIN_CTZLL.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen 1f2499f64a vkd3d: Add 32-bit bitmask iteration with scanning.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-14 14:29:34 +02:00
Hans-Kristian Arntzen 8743577ca5 vkd3d: Add MSVC path for pthread_once_t.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-10 16:09:00 +02:00
Hans-Kristian Arntzen 7bccab7427 debug: Re-introduce different debug channels.
vkd3d-shader is currently kinda buggy and crashes when you try to trace
DXBC. This used to never be run since it was guarded by
VKD3D_SHADER_DEBUG, but with the move to a static build we merged all
debug logging under VKD3D_DEBUG. Reintroduce different debug channels in
a way that is compatible with a statically linked vkd3d.

Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-10 14:18:15 +02:00
Hans-Kristian Arntzen 0c59c30e08 vkd3d: Fix tzcnt64 on MSVC 32-bit and 64-bit.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no>
2020-07-07 16:31:29 +01:00
Joshua Ashton d709fd3306 vkd3d: Add vkd3d_atomic_uint32_{dec, inc}rement helper
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-24 21:13:35 +02:00
Joshua Ashton 45d4296a54 vkd3d: Rename vkd3d_uint32_atomic to vkd3d_atomic_uint32
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-24 21:13:35 +02:00
Joshua Ashton 033f76e3ae vkd3d: Define our own memory orders
We shouldn't potentially override stuff in the std library and this allows us to map directly to __ATOMIC_* memory orders which is more correct.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-24 21:13:35 +02:00
Joshua Ashton 25f6e1d0a9 vkd3d: Use __atomic builtins instead of stdatomic
Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-24 21:13:35 +02:00
Joshua Ashton 26c9dc90f4 vkd3d: Implement sequential consistency on MSVC
Also optimize and reduce unnecessary barriers.

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-24 21:13:35 +02:00
Joshua Ashton 4c819baad3 vkd3d: Use pthread reimplementation only on MSVC
We can use pthreads properly under MinGW
2020-06-24 15:27:22 +02:00
Joshua Ashton fb02f28c41 vkd3d: Don't redefine InterlockedIncrement under MinGW
Fixes compiler warnings

Signed-off-by: Joshua Ashton <joshua@froggi.es>
2020-06-24 15:27:22 +02:00