summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorErik Faye-Lund <[email protected]>2019-07-10 14:11:56 +0200
committerErik Faye-Lund <[email protected]>2019-10-28 08:51:45 +0000
commitdbf67e8a20219bfe08f30c1da94760ac706fa2e2 (patch)
treeb2ec4a1f021ccdb6f968e172148109354e849498
parent4c5ade8ca6114435cfc1244675e825d913d85c38 (diff)
zink: refactor fence destruction
Acked-by: Jordan Justen <[email protected]>
-rw-r--r--src/gallium/drivers/zink/zink_fence.c16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/gallium/drivers/zink/zink_fence.c b/src/gallium/drivers/zink/zink_fence.c
index 6df13b9eca8..ac761e667a3 100644
--- a/src/gallium/drivers/zink/zink_fence.c
+++ b/src/gallium/drivers/zink/zink_fence.c
@@ -27,6 +27,14 @@
#include "util/u_memory.h"
+static void
+destroy_fence(struct zink_screen *screen, struct zink_fence *fence)
+{
+ if (fence->fence)
+ vkDestroyFence(screen->dev, fence->fence, NULL);
+ FREE(fence);
+}
+
struct zink_fence *
zink_create_fence(struct pipe_screen *pscreen)
{
@@ -50,7 +58,7 @@ zink_create_fence(struct pipe_screen *pscreen)
return ret;
fail:
- FREE(ret);
+ destroy_fence(screen, ret);
return NULL;
}
@@ -59,10 +67,8 @@ zink_fence_reference(struct zink_screen *screen,
struct zink_fence **ptr,
struct zink_fence *fence)
{
- if (pipe_reference(&(*ptr)->reference, &fence->reference)) {
- vkDestroyFence(screen->dev, (*ptr)->fence, NULL);
- free(*ptr);
- }
+ if (pipe_reference(&(*ptr)->reference, &fence->reference))
+ destroy_fence(screen, *ptr);
*ptr = fence;
}