Mesa (main): llvmpipe: Do not use _Atomic keyword that doesn't support by MSVC

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon May 16 19:25:56 UTC 2022


Module: Mesa
Branch: main
Commit: 9baaf055e2136697ebbffc3e1c1dd0782b96e272
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9baaf055e2136697ebbffc3e1c1dd0782b96e272

Author: Yonggang Luo <luoyonggang at gmail.com>
Date:   Wed May 11 07:33:41 2022 +0800

llvmpipe: Do not use _Atomic keyword that doesn't support by MSVC

Fixes: 3269d34b29a ("llvmpipe/fence: make the fence id counter atomic")

Fixes:
```
../mesa/src/gallium/drivers/llvmpipe/lp_fence.c
../mesa/src/gallium/drivers/llvmpipe/lp_fence.c(47): error C2143: syntax error: missing ';' before 'type'
```

fence_id initialized to 0

Signed-off-by: Yonggang Luo <luoyonggang at gmail.com>
Erik Faye-Lund <erik.faye-lund at collabora.com>

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16373>

---

 src/gallium/drivers/llvmpipe/lp_fence.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/llvmpipe/lp_fence.c b/src/gallium/drivers/llvmpipe/lp_fence.c
index 7fb24d39046..e103cf2a8bd 100644
--- a/src/gallium/drivers/llvmpipe/lp_fence.c
+++ b/src/gallium/drivers/llvmpipe/lp_fence.c
@@ -44,7 +44,7 @@
 struct lp_fence *
 lp_fence_create(unsigned rank)
 {
-   static _Atomic int fence_id;
+   static unsigned fence_id = 0;
    struct lp_fence *fence = CALLOC_STRUCT(lp_fence);
 
    if (!fence)
@@ -55,7 +55,7 @@ lp_fence_create(unsigned rank)
    (void) mtx_init(&fence->mutex, mtx_plain);
    cnd_init(&fence->signalled);
 
-   fence->id = fence_id++;
+   fence->id = p_atomic_inc_return(&fence_id) - 1;
    fence->rank = rank;
 
    if (LP_DEBUG & DEBUG_FENCE)



More information about the mesa-commit mailing list