Mesa (master): radv: avoid casting warnings on 32bit

Bas Nieuwenhuizen bnieuwenhuizen at kemper.freedesktop.org
Sun Mar 5 23:12:43 UTC 2017


Module: Mesa
Branch: master
Commit: 5458b02305720b6f2acdf14429ae815a2feee3c3
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=5458b02305720b6f2acdf14429ae815a2feee3c3

Author: Grazvydas Ignotas <notasas at gmail.com>
Date:   Sun Mar  5 23:04:50 2017 +0200

radv: avoid casting warnings on 32bit

Use the same helpers as for other handle<->pointer conversions.

Signed-off-by: Grazvydas Ignotas <notasas at gmail.com>
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>

---

 src/amd/vulkan/radv_device.c  | 5 ++---
 src/amd/vulkan/radv_private.h | 3 +++
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/src/amd/vulkan/radv_device.c b/src/amd/vulkan/radv_device.c
index 760b6b0..58f37c6 100644
--- a/src/amd/vulkan/radv_device.c
+++ b/src/amd/vulkan/radv_device.c
@@ -2029,7 +2029,7 @@ VkResult radv_CreateSemaphore(
 	if (!sem)
 		return VK_ERROR_OUT_OF_HOST_MEMORY;
 
-	*pSemaphore = (VkSemaphore)sem;
+	*pSemaphore = radeon_winsys_sem_to_handle(sem);
 	return VK_SUCCESS;
 }
 
@@ -2039,11 +2039,10 @@ void radv_DestroySemaphore(
 	const VkAllocationCallbacks*                pAllocator)
 {
 	RADV_FROM_HANDLE(radv_device, device, _device);
-	struct radeon_winsys_sem *sem;
+	RADV_FROM_HANDLE(radeon_winsys_sem, sem, _semaphore);
 	if (!_semaphore)
 		return;
 
-	sem = (struct radeon_winsys_sem *)_semaphore;
 	device->ws->destroy_sem(sem);
 }
 
diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h
index 7eb1051..0e629fc 100644
--- a/src/amd/vulkan/radv_private.h
+++ b/src/amd/vulkan/radv_private.h
@@ -1316,6 +1316,8 @@ struct radv_fence {
 	bool signalled;
 };
 
+struct radeon_winsys_sem;
+
 #define RADV_DEFINE_HANDLE_CASTS(__radv_type, __VkType)		\
 								\
 	static inline struct __radv_type *			\
@@ -1372,5 +1374,6 @@ RADV_DEFINE_NONDISP_HANDLE_CASTS(radv_query_pool, VkQueryPool)
 RADV_DEFINE_NONDISP_HANDLE_CASTS(radv_render_pass, VkRenderPass)
 RADV_DEFINE_NONDISP_HANDLE_CASTS(radv_sampler, VkSampler)
 RADV_DEFINE_NONDISP_HANDLE_CASTS(radv_shader_module, VkShaderModule)
+RADV_DEFINE_NONDISP_HANDLE_CASTS(radeon_winsys_sem, VkSemaphore)
 
 #endif /* RADV_PRIVATE_H */




More information about the mesa-commit mailing list