winevulkan: Unwrap object for VK_EXT_private_data when needed.

Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Signed-off-by: Liam Middlebrook <lmiddlebrook@nvidia.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Georg Lehmann 2020-07-08 15:43:22 +02:00 committed by Alexandre Julliard
parent 61dbb53fef
commit 380b7f2825
4 changed files with 46 additions and 12 deletions

View File

@ -217,6 +217,10 @@ FUNCTION_OVERRIDES = {
# VK_KHR_device_group # VK_KHR_device_group
"vkGetDeviceGroupSurfacePresentModesKHR" : {"dispatch" : True, "driver" : True, "thunk" : True}, "vkGetDeviceGroupSurfacePresentModesKHR" : {"dispatch" : True, "driver" : True, "thunk" : True},
"vkGetPhysicalDevicePresentRectanglesKHR" : {"dispatch" : True, "driver" : True, "thunk" : True}, "vkGetPhysicalDevicePresentRectanglesKHR" : {"dispatch" : True, "driver" : True, "thunk" : True},
# VK_EXT_private_data
"vkGetPrivateDataEXT" : {"dispatch": True, "driver" : False, "thunk" : False},
"vkSetPrivateDataEXT" : {"dispatch": True, "driver" : False, "thunk" : False},
} }
STRUCT_CHAIN_CONVERSIONS = [ STRUCT_CHAIN_CONVERSIONS = [
@ -919,6 +923,9 @@ class VkHandle(object):
def native_handle(self, name): def native_handle(self, name):
""" Provide access to the native handle of a wrapped object. """ """ Provide access to the native handle of a wrapped object. """
# Remember to add any new native handle whose parent is VkDevice
# to unwrap_object_handle() in vulkan.c
if self.name == "VkCommandPool": if self.name == "VkCommandPool":
return "wine_cmd_pool_from_handle({0})->command_pool".format(name) return "wine_cmd_pool_from_handle({0})->command_pool".format(name)

View File

@ -1372,6 +1372,43 @@ void WINAPI wine_vkGetPhysicalDeviceExternalSemaphorePropertiesKHR(VkPhysicalDev
properties->externalSemaphoreFeatures = 0; properties->externalSemaphoreFeatures = 0;
} }
static uint64_t unwrap_object_handle(VkObjectType type, uint64_t handle)
{
switch (type)
{
case VK_OBJECT_TYPE_DEVICE:
return (uint64_t) (uintptr_t) ((VkDevice) (uintptr_t) handle)->device;
case VK_OBJECT_TYPE_QUEUE:
return (uint64_t) (uintptr_t) ((VkQueue) (uintptr_t) handle)->queue;
case VK_OBJECT_TYPE_COMMAND_BUFFER:
return (uint64_t) (uintptr_t) ((VkCommandBuffer) (uintptr_t) handle)->command_buffer;
case VK_OBJECT_TYPE_COMMAND_POOL:
return (uint64_t) wine_cmd_pool_from_handle(handle)->command_pool;
default:
return handle;
}
}
VkResult WINAPI wine_vkSetPrivateDataEXT(VkDevice device, VkObjectType object_type, uint64_t object_handle,
VkPrivateDataSlotEXT private_data_slot, uint64_t data)
{
TRACE("%p, %#x, 0x%s, 0x%s, 0x%s\n", device, object_type, wine_dbgstr_longlong(object_handle),
wine_dbgstr_longlong(private_data_slot), wine_dbgstr_longlong(data));
object_handle = unwrap_object_handle(object_type, object_handle);
return device->funcs.p_vkSetPrivateDataEXT(device->device, object_type, object_handle, private_data_slot, data);
}
void WINAPI wine_vkGetPrivateDataEXT(VkDevice device, VkObjectType object_type, uint64_t object_handle,
VkPrivateDataSlotEXT private_data_slot, uint64_t *data)
{
TRACE("%p, %#x, 0x%s, 0x%s, %p\n", device, object_type, wine_dbgstr_longlong(object_handle),
wine_dbgstr_longlong(private_data_slot), data);
object_handle = unwrap_object_handle(object_type, object_handle);
device->funcs.p_vkGetPrivateDataEXT(device->device, object_type, object_handle, private_data_slot, data);
}
BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, void *reserved) BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, void *reserved)
{ {
TRACE("%p, %u, %p\n", hinst, reason, reserved); TRACE("%p, %u, %p\n", hinst, reason, reserved);

View File

@ -5066,12 +5066,6 @@ static VkResult WINAPI wine_vkGetPipelineExecutableStatisticsKHR(VkDevice device
#endif #endif
} }
static void WINAPI wine_vkGetPrivateDataEXT(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlotEXT privateDataSlot, uint64_t *pData)
{
TRACE("%p, %#x, 0x%s, 0x%s, %p\n", device, objectType, wine_dbgstr_longlong(objectHandle), wine_dbgstr_longlong(privateDataSlot), pData);
device->funcs.p_vkGetPrivateDataEXT(device->device, objectType, objectHandle, privateDataSlot, pData);
}
VkResult WINAPI wine_vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void *pData, VkDeviceSize stride, VkQueryResultFlags flags) VkResult WINAPI wine_vkGetQueryPoolResults(VkDevice device, VkQueryPool queryPool, uint32_t firstQuery, uint32_t queryCount, size_t dataSize, void *pData, VkDeviceSize stride, VkQueryResultFlags flags)
{ {
TRACE("%p, 0x%s, %u, %u, 0x%s, %p, 0x%s, %#x\n", device, wine_dbgstr_longlong(queryPool), firstQuery, queryCount, wine_dbgstr_longlong(dataSize), pData, wine_dbgstr_longlong(stride), flags); TRACE("%p, 0x%s, %u, %u, 0x%s, %p, 0x%s, %#x\n", device, wine_dbgstr_longlong(queryPool), firstQuery, queryCount, wine_dbgstr_longlong(dataSize), pData, wine_dbgstr_longlong(stride), flags);
@ -5264,12 +5258,6 @@ VkResult WINAPI wine_vkSetEvent(VkDevice device, VkEvent event)
return device->funcs.p_vkSetEvent(device->device, event); return device->funcs.p_vkSetEvent(device->device, event);
} }
static VkResult WINAPI wine_vkSetPrivateDataEXT(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlotEXT privateDataSlot, uint64_t data)
{
TRACE("%p, %#x, 0x%s, 0x%s, 0x%s\n", device, objectType, wine_dbgstr_longlong(objectHandle), wine_dbgstr_longlong(privateDataSlot), wine_dbgstr_longlong(data));
return device->funcs.p_vkSetPrivateDataEXT(device->device, objectType, objectHandle, privateDataSlot, data);
}
VkResult WINAPI wine_vkSignalSemaphore(VkDevice device, const VkSemaphoreSignalInfo *pSignalInfo) VkResult WINAPI wine_vkSignalSemaphore(VkDevice device, const VkSemaphoreSignalInfo *pSignalInfo)
{ {
#if defined(USE_STRUCT_CONVERSION) #if defined(USE_STRUCT_CONVERSION)

View File

@ -40,7 +40,9 @@ VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice
VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) DECLSPEC_HIDDEN; VkResult WINAPI wine_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) DECLSPEC_HIDDEN;
void WINAPI wine_vkGetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2 *pProperties); void WINAPI wine_vkGetPhysicalDeviceProperties2(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2 *pProperties);
void WINAPI wine_vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2 *pProperties) DECLSPEC_HIDDEN; void WINAPI wine_vkGetPhysicalDeviceProperties2KHR(VkPhysicalDevice physicalDevice, VkPhysicalDeviceProperties2 *pProperties) DECLSPEC_HIDDEN;
void WINAPI wine_vkGetPrivateDataEXT(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlotEXT privateDataSlot, uint64_t *pData) DECLSPEC_HIDDEN;
VkResult WINAPI wine_vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence); VkResult WINAPI wine_vkQueueSubmit(VkQueue queue, uint32_t submitCount, const VkSubmitInfo *pSubmits, VkFence fence);
VkResult WINAPI wine_vkSetPrivateDataEXT(VkDevice device, VkObjectType objectType, uint64_t objectHandle, VkPrivateDataSlotEXT privateDataSlot, uint64_t data) DECLSPEC_HIDDEN;
/* Private thunks */ /* Private thunks */
VkResult thunk_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) DECLSPEC_HIDDEN; VkResult thunk_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice physicalDevice, const VkPhysicalDeviceImageFormatInfo2 *pImageFormatInfo, VkImageFormatProperties2 *pImageFormatProperties) DECLSPEC_HIDDEN;