From 490cf966f9baf48ea4498798cac43e623f85011e Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Tue, 6 Jul 2021 11:53:17 +0900 Subject: [PATCH] [vulkan] Fix compiling on 32-bit systems Casting between ints and pointers can be awkward. --- include/QF/Vulkan/debug.h | 2 +- libs/video/renderer/vulkan/test/test-staging.c | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/include/QF/Vulkan/debug.h b/include/QF/Vulkan/debug.h index 1e25930d0..482680eb7 100644 --- a/include/QF/Vulkan/debug.h +++ b/include/QF/Vulkan/debug.h @@ -1,7 +1,7 @@ #ifndef __QF_Vulkan_debug_h #define __QF_Vulkan_debug_h -#if defined(_WIN32) && !defined(_WIN64) +#if (defined(_WIN32) && !defined(_WIN64)) || (__WORDSIZE < 64) #define QFV_duCmdBeginLabel(device, cmd, name...) #define QFV_duCmdEndLabel(device, cmd) #define QFV_duCmdInsertLabel(device, cmd, name...) diff --git a/libs/video/renderer/vulkan/test/test-staging.c b/libs/video/renderer/vulkan/test/test-staging.c index df0b7e282..4eb5b8f58 100644 --- a/libs/video/renderer/vulkan/test/test-staging.c +++ b/libs/video/renderer/vulkan/test/test-staging.c @@ -77,7 +77,7 @@ vkWaitForFences (VkDevice device, uint32_t fenceCount, const VkFence *fences, VkBool32 waitAll, uint64_t timeout) { for (uint32_t i = 0; i < fenceCount; i++) { - int *f = (int *)fences[i]; + int *f = (int *) (intptr_t) fences[i]; if (*f) { wait_count++; } @@ -90,7 +90,7 @@ static VkResult vkResetFences (VkDevice device, uint32_t fenceCount, const VkFence *fences) { for (uint32_t i = 0; i < fenceCount; i++) { - int *f = (int *)fences[i]; + int *f = (int *) (intptr_t) fences[i]; *f = 0; } return VK_SUCCESS; @@ -99,7 +99,7 @@ vkResetFences (VkDevice device, uint32_t fenceCount, const VkFence *fences) static VkResult vkGetFenceStatus (VkDevice device, VkFence fence) { - int *f = (int *)fence; + int *f = (int *) (intptr_t) fence; return *f ? VK_SUCCESS : VK_NOT_READY; } @@ -133,7 +133,7 @@ static VkResult vkQueueSubmit (VkQueue queue, uint32_t count, const VkSubmitInfo *submits, VkFence fence) { - int *f = (int *)fence; + int *f = (int *) (intptr_t) fence; *f = 1; return VK_SUCCESS; }