mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2025-01-28 13:05:02 -08:00
vkd3d-common: Get rid of InterlockedIncrement().
This commit is contained in:
parent
51f13391e6
commit
c64921e79b
Notes:
Alexandre Julliard
2024-02-06 23:42:38 +01:00
Approved-by: Giovanni Mascellani (@giomasce) Approved-by: Alexandre Julliard (@julliard) Merge-Request: https://gitlab.winehq.org/wine/vkd3d/-/merge_requests/633
@ -305,11 +305,6 @@ static inline uint32_t vkd3d_atomic_increment_u32(uint32_t volatile *x)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef _WIN32
|
#ifndef _WIN32
|
||||||
static inline LONG InterlockedIncrement(LONG volatile *x)
|
|
||||||
{
|
|
||||||
return vkd3d_atomic_increment_u32((uint32_t *)x);
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline LONG InterlockedDecrement(LONG volatile *x)
|
static inline LONG InterlockedDecrement(LONG volatile *x)
|
||||||
{
|
{
|
||||||
return vkd3d_atomic_decrement_u32((uint32_t *)x);
|
return vkd3d_atomic_decrement_u32((uint32_t *)x);
|
||||||
|
@ -101,12 +101,12 @@ static void vkd3d_test_end_todo(void);
|
|||||||
|
|
||||||
struct vkd3d_test_state
|
struct vkd3d_test_state
|
||||||
{
|
{
|
||||||
LONG success_count;
|
unsigned int success_count;
|
||||||
LONG failure_count;
|
unsigned int failure_count;
|
||||||
LONG skip_count;
|
unsigned int skip_count;
|
||||||
LONG todo_count;
|
unsigned int todo_count;
|
||||||
LONG todo_success_count;
|
unsigned int todo_success_count;
|
||||||
LONG bug_count;
|
unsigned int bug_count;
|
||||||
|
|
||||||
unsigned int debug_level;
|
unsigned int debug_level;
|
||||||
|
|
||||||
@ -150,13 +150,13 @@ vkd3d_test_check_assert_that(unsigned int line, bool result, const char *fmt, va
|
|||||||
{
|
{
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
InterlockedIncrement(&vkd3d_test_state.success_count);
|
vkd3d_atomic_increment_u32(&vkd3d_test_state.success_count);
|
||||||
if (vkd3d_test_state.debug_level > 1)
|
if (vkd3d_test_state.debug_level > 1)
|
||||||
vkd3d_test_printf(line, "Test succeeded.\n");
|
vkd3d_test_printf(line, "Test succeeded.\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
InterlockedIncrement(&vkd3d_test_state.failure_count);
|
vkd3d_atomic_increment_u32(&vkd3d_test_state.failure_count);
|
||||||
vkd3d_test_printf(line, "Test failed: ");
|
vkd3d_test_printf(line, "Test failed: ");
|
||||||
vprintf(fmt, args);
|
vprintf(fmt, args);
|
||||||
}
|
}
|
||||||
@ -180,7 +180,7 @@ vkd3d_test_check_ok(unsigned int line, bool result, const char *fmt, va_list arg
|
|||||||
|
|
||||||
if (is_bug && vkd3d_test_state.bug_enabled)
|
if (is_bug && vkd3d_test_state.bug_enabled)
|
||||||
{
|
{
|
||||||
InterlockedIncrement(&vkd3d_test_state.bug_count);
|
vkd3d_atomic_increment_u32(&vkd3d_test_state.bug_count);
|
||||||
if (is_todo)
|
if (is_todo)
|
||||||
result = !result;
|
result = !result;
|
||||||
if (result)
|
if (result)
|
||||||
@ -193,12 +193,12 @@ vkd3d_test_check_ok(unsigned int line, bool result, const char *fmt, va_list arg
|
|||||||
{
|
{
|
||||||
if (result)
|
if (result)
|
||||||
{
|
{
|
||||||
InterlockedIncrement(&vkd3d_test_state.todo_success_count);
|
vkd3d_atomic_increment_u32(&vkd3d_test_state.todo_success_count);
|
||||||
vkd3d_test_printf(line, "Todo succeeded: ");
|
vkd3d_test_printf(line, "Todo succeeded: ");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
InterlockedIncrement(&vkd3d_test_state.todo_count);
|
vkd3d_atomic_increment_u32(&vkd3d_test_state.todo_count);
|
||||||
vkd3d_test_printf(line, "Todo: ");
|
vkd3d_test_printf(line, "Todo: ");
|
||||||
}
|
}
|
||||||
vprintf(fmt, args);
|
vprintf(fmt, args);
|
||||||
@ -227,7 +227,7 @@ vkd3d_test_skip(unsigned int line, const char *fmt, ...)
|
|||||||
vkd3d_test_printf(line, "Test skipped: ");
|
vkd3d_test_printf(line, "Test skipped: ");
|
||||||
vprintf(fmt, args);
|
vprintf(fmt, args);
|
||||||
va_end(args);
|
va_end(args);
|
||||||
InterlockedIncrement(&vkd3d_test_state.skip_count);
|
vkd3d_atomic_increment_u32(&vkd3d_test_state.skip_count);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void VKD3D_PRINTF_FUNC(2, 3) VKD3D_UNUSED
|
static void VKD3D_PRINTF_FUNC(2, 3) VKD3D_UNUSED
|
||||||
@ -293,16 +293,14 @@ int main(int argc, char **argv)
|
|||||||
|
|
||||||
vkd3d_test_main(argc, argv);
|
vkd3d_test_main(argc, argv);
|
||||||
|
|
||||||
printf("%s: %lu tests executed (%lu failures, %lu skipped, %lu todo, %lu bugs).\n",
|
printf("%s: %u tests executed (%u failures, %u skipped, %u todo, %u bugs).\n",
|
||||||
vkd3d_test_name,
|
vkd3d_test_name,
|
||||||
(unsigned long)(vkd3d_test_state.success_count
|
vkd3d_test_state.success_count + vkd3d_test_state.failure_count
|
||||||
+ vkd3d_test_state.failure_count + vkd3d_test_state.todo_count
|
+ vkd3d_test_state.todo_count + vkd3d_test_state.todo_success_count,
|
||||||
+ vkd3d_test_state.todo_success_count),
|
vkd3d_test_state.failure_count + vkd3d_test_state.todo_success_count,
|
||||||
(unsigned long)(vkd3d_test_state.failure_count
|
vkd3d_test_state.skip_count,
|
||||||
+ vkd3d_test_state.todo_success_count),
|
vkd3d_test_state.todo_count,
|
||||||
(unsigned long)vkd3d_test_state.skip_count,
|
vkd3d_test_state.bug_count);
|
||||||
(unsigned long)vkd3d_test_state.todo_count,
|
|
||||||
(unsigned long)vkd3d_test_state.bug_count);
|
|
||||||
|
|
||||||
if (test_platform)
|
if (test_platform)
|
||||||
free(test_platform);
|
free(test_platform);
|
||||||
|
@ -625,7 +625,7 @@ static void test_adapter_luid(void)
|
|||||||
struct parent
|
struct parent
|
||||||
{
|
{
|
||||||
IUnknown IUnknown_iface;
|
IUnknown IUnknown_iface;
|
||||||
LONG refcount;
|
unsigned int refcount;
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct parent *parent_from_IUnknown(IUnknown *iface)
|
static struct parent *parent_from_IUnknown(IUnknown *iface)
|
||||||
@ -651,14 +651,14 @@ static ULONG STDMETHODCALLTYPE parent_AddRef(IUnknown *iface)
|
|||||||
{
|
{
|
||||||
struct parent *parent = parent_from_IUnknown(iface);
|
struct parent *parent = parent_from_IUnknown(iface);
|
||||||
|
|
||||||
return InterlockedIncrement(&parent->refcount);
|
return vkd3d_atomic_increment_u32(&parent->refcount);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG STDMETHODCALLTYPE parent_Release(IUnknown *iface)
|
static ULONG STDMETHODCALLTYPE parent_Release(IUnknown *iface)
|
||||||
{
|
{
|
||||||
struct parent *parent = parent_from_IUnknown(iface);
|
struct parent *parent = parent_from_IUnknown(iface);
|
||||||
|
|
||||||
return InterlockedDecrement(&parent->refcount);
|
return InterlockedDecrement((LONG *)&parent->refcount);
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct IUnknownVtbl parent_vtbl =
|
static const struct IUnknownVtbl parent_vtbl =
|
||||||
|
Loading…
x
Reference in New Issue
Block a user