[PATCH vkd3d 2/2] vkd3d: Replace atomic_add_fetch() by InterlockedAdd().

Henri Verbeet hverbeet at gmail.com
Fri Jan 28 09:29:20 CST 2022


On Fri, 28 Jan 2022 at 16:10, Alexandre Julliard <julliard at winehq.org> wrote:
> @@ -410,7 +410,7 @@ static void *vkd3d_fence_worker_main(void *arg)
>      {
>          vkd3d_wait_for_gpu_fences(worker);
>
> -        if (!worker->fence_count || atomic_add_fetch(&worker->enqueued_fence_count, 0))
> +        if (!worker->fence_count || InterlockedAdd(&worker->enqueued_fence_count, 0))
>          {
Unfortunately this introduces build warnings for the non-PE builds:

    <vkd3d>/libs/vkd3d/command.c: In function ‘vkd3d_fence_worker_main’:
    <vkd3d>/libs/vkd3d/command.c:413:52: warning: pointer targets in
passing argument 1 of ‘InterlockedAdd’ differ in signedness
[-Wpointer-sign]
             if (!worker->fence_count ||
InterlockedAdd(&worker->enqueued_fence_count, 0))

^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    In file included from <vkd3d>/libs/vkd3d/vkd3d_private.h:26,
                     from <vkd3d>/libs/vkd3d/command.c:21:
    <vkd3d>/include/private/vkd3d_common.h:204:20: note: expected
‘volatile LONG *’ {aka ‘volatile int  ’} but argument is of type
‘size_t *’ {aka ‘unsigned int *’}
     static inline LONG InterlockedAdd(LONG volatile *x, LONG val)
                        ^~~~~~~~~~~~~~



More information about the wine-devel mailing list