Commit f90940da authored by Roderick Colenbrander's avatar Roderick Colenbrander Committed by Alexandre Julliard

winevulkan: Implement vkQueueBindSparse and vkQueueWaitIdle.

parent fc0af22d
...@@ -394,14 +394,6 @@ class VkFunction(object): ...@@ -394,14 +394,6 @@ class VkFunction(object):
def needs_dispatch(self): def needs_dispatch(self):
return self.dispatch return self.dispatch
def needs_stub(self):
""" Temporary function to limit script hacks until more code is implemented. """
if self.params[0].type in ["VkQueue"]:
return True
return False
def needs_thunk(self): def needs_thunk(self):
return self.thunk_needed return self.thunk_needed
...@@ -1692,10 +1684,6 @@ class VkGenerator(object): ...@@ -1692,10 +1684,6 @@ class VkGenerator(object):
if not func.is_required(): if not func.is_required():
continue continue
# Temporary filter.
if func.needs_stub():
continue
if not func.needs_conversion(): if not func.needs_conversion():
continue continue
...@@ -1745,11 +1733,7 @@ class VkGenerator(object): ...@@ -1745,11 +1733,7 @@ class VkGenerator(object):
if not vk_func.needs_thunk(): if not vk_func.needs_thunk():
continue continue
# Temporary filter. f.write("static " + vk_func.thunk(prefix=prefix, call_conv="WINAPI"))
if vk_func.needs_stub():
f.write("static " + vk_func.stub(prefix=prefix, call_conv="WINAPI"))
else:
f.write("static " + vk_func.thunk(prefix=prefix, call_conv="WINAPI"))
f.write("static const struct vulkan_func vk_device_dispatch_table[] =\n{\n") f.write("static const struct vulkan_func vk_device_dispatch_table[] =\n{\n")
for vk_func in self.registry.device_funcs: for vk_func in self.registry.device_funcs:
...@@ -1863,9 +1847,7 @@ class VkGenerator(object): ...@@ -1863,9 +1847,7 @@ class VkGenerator(object):
LOGGER.debug("skipping {0} in vulkan_device_funcs".format(vk_func.name)) LOGGER.debug("skipping {0} in vulkan_device_funcs".format(vk_func.name))
continue continue
# Temporary filter out functions, which need conversion, but for which if vk_func.needs_conversion():
# we are only implemented stubs at this point.
if not vk_func.needs_stub() and vk_func.needs_conversion():
f.write("#if defined(USE_STRUCT_CONVERSION)\n") f.write("#if defined(USE_STRUCT_CONVERSION)\n")
f.write(" {0};\n".format(vk_func.pfn(conv=True))) f.write(" {0};\n".format(vk_func.pfn(conv=True)))
f.write("#else\n") f.write("#else\n")
......
...@@ -600,6 +600,196 @@ static inline void convert_VkPhysicalDeviceProperties_host_to_win(const VkPhysic ...@@ -600,6 +600,196 @@ static inline void convert_VkPhysicalDeviceProperties_host_to_win(const VkPhysic
out->sparseProperties = in->sparseProperties; out->sparseProperties = in->sparseProperties;
} }
static inline VkSparseMemoryBind_host *convert_VkSparseMemoryBind_array_win_to_host(const VkSparseMemoryBind *in, uint32_t count)
{
VkSparseMemoryBind_host *out;
unsigned int i;
if (!in) return NULL;
out = heap_alloc(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].resourceOffset = in[i].resourceOffset;
out[i].size = in[i].size;
out[i].memory = in[i].memory;
out[i].memoryOffset = in[i].memoryOffset;
out[i].flags = in[i].flags;
}
return out;
}
static inline void free_VkSparseMemoryBind_array(VkSparseMemoryBind_host *in, uint32_t count)
{
if (!in) return;
heap_free(in);
}
static inline VkSparseBufferMemoryBindInfo_host *convert_VkSparseBufferMemoryBindInfo_array_win_to_host(const VkSparseBufferMemoryBindInfo *in, uint32_t count)
{
VkSparseBufferMemoryBindInfo_host *out;
unsigned int i;
if (!in) return NULL;
out = heap_alloc(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].buffer = in[i].buffer;
out[i].bindCount = in[i].bindCount;
out[i].pBinds = convert_VkSparseMemoryBind_array_win_to_host(in[i].pBinds, in[i].bindCount);
}
return out;
}
static inline void free_VkSparseBufferMemoryBindInfo_array(VkSparseBufferMemoryBindInfo_host *in, uint32_t count)
{
unsigned int i;
if (!in) return;
for (i = 0; i < count; i++)
{
free_VkSparseMemoryBind_array((VkSparseMemoryBind_host *)in[i].pBinds, in[i].bindCount);
}
heap_free(in);
}
static inline VkSparseImageOpaqueMemoryBindInfo_host *convert_VkSparseImageOpaqueMemoryBindInfo_array_win_to_host(const VkSparseImageOpaqueMemoryBindInfo *in, uint32_t count)
{
VkSparseImageOpaqueMemoryBindInfo_host *out;
unsigned int i;
if (!in) return NULL;
out = heap_alloc(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].image = in[i].image;
out[i].bindCount = in[i].bindCount;
out[i].pBinds = convert_VkSparseMemoryBind_array_win_to_host(in[i].pBinds, in[i].bindCount);
}
return out;
}
static inline void free_VkSparseImageOpaqueMemoryBindInfo_array(VkSparseImageOpaqueMemoryBindInfo_host *in, uint32_t count)
{
unsigned int i;
if (!in) return;
for (i = 0; i < count; i++)
{
free_VkSparseMemoryBind_array((VkSparseMemoryBind_host *)in[i].pBinds, in[i].bindCount);
}
heap_free(in);
}
static inline VkSparseImageMemoryBind_host *convert_VkSparseImageMemoryBind_array_win_to_host(const VkSparseImageMemoryBind *in, uint32_t count)
{
VkSparseImageMemoryBind_host *out;
unsigned int i;
if (!in) return NULL;
out = heap_alloc(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].subresource = in[i].subresource;
out[i].offset = in[i].offset;
out[i].extent = in[i].extent;
out[i].memory = in[i].memory;
out[i].memoryOffset = in[i].memoryOffset;
out[i].flags = in[i].flags;
}
return out;
}
static inline void free_VkSparseImageMemoryBind_array(VkSparseImageMemoryBind_host *in, uint32_t count)
{
if (!in) return;
heap_free(in);
}
static inline VkSparseImageMemoryBindInfo_host *convert_VkSparseImageMemoryBindInfo_array_win_to_host(const VkSparseImageMemoryBindInfo *in, uint32_t count)
{
VkSparseImageMemoryBindInfo_host *out;
unsigned int i;
if (!in) return NULL;
out = heap_alloc(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].image = in[i].image;
out[i].bindCount = in[i].bindCount;
out[i].pBinds = convert_VkSparseImageMemoryBind_array_win_to_host(in[i].pBinds, in[i].bindCount);
}
return out;
}
static inline void free_VkSparseImageMemoryBindInfo_array(VkSparseImageMemoryBindInfo_host *in, uint32_t count)
{
unsigned int i;
if (!in) return;
for (i = 0; i < count; i++)
{
free_VkSparseImageMemoryBind_array((VkSparseImageMemoryBind_host *)in[i].pBinds, in[i].bindCount);
}
heap_free(in);
}
static inline VkBindSparseInfo_host *convert_VkBindSparseInfo_array_win_to_host(const VkBindSparseInfo *in, uint32_t count)
{
VkBindSparseInfo_host *out;
unsigned int i;
if (!in) return NULL;
out = heap_alloc(count * sizeof(*out));
for (i = 0; i < count; i++)
{
out[i].sType = in[i].sType;
out[i].pNext = in[i].pNext;
out[i].waitSemaphoreCount = in[i].waitSemaphoreCount;
out[i].pWaitSemaphores = in[i].pWaitSemaphores;
out[i].bufferBindCount = in[i].bufferBindCount;
out[i].pBufferBinds = convert_VkSparseBufferMemoryBindInfo_array_win_to_host(in[i].pBufferBinds, in[i].bufferBindCount);
out[i].imageOpaqueBindCount = in[i].imageOpaqueBindCount;
out[i].pImageOpaqueBinds = convert_VkSparseImageOpaqueMemoryBindInfo_array_win_to_host(in[i].pImageOpaqueBinds, in[i].imageOpaqueBindCount);
out[i].imageBindCount = in[i].imageBindCount;
out[i].pImageBinds = convert_VkSparseImageMemoryBindInfo_array_win_to_host(in[i].pImageBinds, in[i].imageBindCount);
out[i].signalSemaphoreCount = in[i].signalSemaphoreCount;
out[i].pSignalSemaphores = in[i].pSignalSemaphores;
}
return out;
}
static inline void free_VkBindSparseInfo_array(VkBindSparseInfo_host *in, uint32_t count)
{
unsigned int i;
if (!in) return;
for (i = 0; i < count; i++)
{
free_VkSparseBufferMemoryBindInfo_array((VkSparseBufferMemoryBindInfo_host *)in[i].pBufferBinds, in[i].bufferBindCount);
free_VkSparseImageOpaqueMemoryBindInfo_array((VkSparseImageOpaqueMemoryBindInfo_host *)in[i].pImageOpaqueBinds, in[i].imageOpaqueBindCount);
free_VkSparseImageMemoryBindInfo_array((VkSparseImageMemoryBindInfo_host *)in[i].pImageBinds, in[i].imageBindCount);
}
heap_free(in);
}
static inline VkDescriptorImageInfo_host *convert_VkDescriptorImageInfo_array_win_to_host(const VkDescriptorImageInfo *in, uint32_t count) static inline VkDescriptorImageInfo_host *convert_VkDescriptorImageInfo_array_win_to_host(const VkDescriptorImageInfo *in, uint32_t count)
{ {
VkDescriptorImageInfo_host *out; VkDescriptorImageInfo_host *out;
...@@ -1637,14 +1827,26 @@ static VkResult WINAPI wine_vkMergePipelineCaches(VkDevice device, VkPipelineCac ...@@ -1637,14 +1827,26 @@ static VkResult WINAPI wine_vkMergePipelineCaches(VkDevice device, VkPipelineCac
static VkResult WINAPI wine_vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo *pBindInfo, VkFence fence) static VkResult WINAPI wine_vkQueueBindSparse(VkQueue queue, uint32_t bindInfoCount, const VkBindSparseInfo *pBindInfo, VkFence fence)
{ {
FIXME("stub: %p, %u, %p, 0x%s\n", queue, bindInfoCount, pBindInfo, wine_dbgstr_longlong(fence)); #if defined(USE_STRUCT_CONVERSION)
return VK_ERROR_OUT_OF_HOST_MEMORY; VkResult result;
VkBindSparseInfo_host *pBindInfo_host;
TRACE("%p, %u, %p, 0x%s\n", queue, bindInfoCount, pBindInfo, wine_dbgstr_longlong(fence));
pBindInfo_host = convert_VkBindSparseInfo_array_win_to_host(pBindInfo, bindInfoCount);
result = queue->device->funcs.p_vkQueueBindSparse(queue->queue, bindInfoCount, pBindInfo_host, fence);
free_VkBindSparseInfo_array(pBindInfo_host, bindInfoCount);
return result;
#else
TRACE("%p, %u, %p, 0x%s\n", queue, bindInfoCount, pBindInfo, wine_dbgstr_longlong(fence));
return queue->device->funcs.p_vkQueueBindSparse(queue->queue, bindInfoCount, pBindInfo, fence);
#endif
} }
static VkResult WINAPI wine_vkQueueWaitIdle(VkQueue queue) static VkResult WINAPI wine_vkQueueWaitIdle(VkQueue queue)
{ {
FIXME("stub: %p\n", queue); TRACE("%p\n", queue);
return VK_ERROR_OUT_OF_HOST_MEMORY; return queue->device->funcs.p_vkQueueWaitIdle(queue->queue);
} }
static VkResult WINAPI wine_vkResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags) static VkResult WINAPI wine_vkResetCommandBuffer(VkCommandBuffer commandBuffer, VkCommandBufferResetFlags flags)
......
...@@ -426,6 +426,62 @@ typedef struct VkPhysicalDeviceProperties_host ...@@ -426,6 +426,62 @@ typedef struct VkPhysicalDeviceProperties_host
VkPhysicalDeviceSparseProperties sparseProperties; VkPhysicalDeviceSparseProperties sparseProperties;
} VkPhysicalDeviceProperties_host; } VkPhysicalDeviceProperties_host;
typedef struct VkSparseMemoryBind_host
{
VkDeviceSize resourceOffset;
VkDeviceSize size;
VkDeviceMemory memory;
VkDeviceSize memoryOffset;
VkSparseMemoryBindFlags flags;
} VkSparseMemoryBind_host;
typedef struct VkSparseBufferMemoryBindInfo_host
{
VkBuffer buffer;
uint32_t bindCount;
const VkSparseMemoryBind_host *pBinds;
} VkSparseBufferMemoryBindInfo_host;
typedef struct VkSparseImageOpaqueMemoryBindInfo_host
{
VkImage image;
uint32_t bindCount;
const VkSparseMemoryBind_host *pBinds;
} VkSparseImageOpaqueMemoryBindInfo_host;
typedef struct VkSparseImageMemoryBind_host
{
VkImageSubresource subresource;
VkOffset3D offset;
VkExtent3D extent;
VkDeviceMemory memory;
VkDeviceSize memoryOffset;
VkSparseMemoryBindFlags flags;
} VkSparseImageMemoryBind_host;
typedef struct VkSparseImageMemoryBindInfo_host
{
VkImage image;
uint32_t bindCount;
const VkSparseImageMemoryBind_host *pBinds;
} VkSparseImageMemoryBindInfo_host;
typedef struct VkBindSparseInfo_host
{
VkStructureType sType;
const void *pNext;
uint32_t waitSemaphoreCount;
const VkSemaphore *pWaitSemaphores;
uint32_t bufferBindCount;
const VkSparseBufferMemoryBindInfo_host *pBufferBinds;
uint32_t imageOpaqueBindCount;
const VkSparseImageOpaqueMemoryBindInfo_host *pImageOpaqueBinds;
uint32_t imageBindCount;
const VkSparseImageMemoryBindInfo_host *pImageBinds;
uint32_t signalSemaphoreCount;
const VkSemaphore *pSignalSemaphores;
} VkBindSparseInfo_host;
typedef struct VkDescriptorImageInfo_host typedef struct VkDescriptorImageInfo_host
{ {
VkSampler sampler; VkSampler sampler;
...@@ -663,7 +719,11 @@ struct vulkan_device_funcs ...@@ -663,7 +719,11 @@ struct vulkan_device_funcs
#endif #endif
VkResult (*p_vkMapMemory)(VkDevice, VkDeviceMemory, VkDeviceSize, VkDeviceSize, VkMemoryMapFlags, void **); VkResult (*p_vkMapMemory)(VkDevice, VkDeviceMemory, VkDeviceSize, VkDeviceSize, VkMemoryMapFlags, void **);
VkResult (*p_vkMergePipelineCaches)(VkDevice, VkPipelineCache, uint32_t, const VkPipelineCache *); VkResult (*p_vkMergePipelineCaches)(VkDevice, VkPipelineCache, uint32_t, const VkPipelineCache *);
#if defined(USE_STRUCT_CONVERSION)
VkResult (*p_vkQueueBindSparse)(VkQueue, uint32_t, const VkBindSparseInfo_host *, VkFence);
#else
VkResult (*p_vkQueueBindSparse)(VkQueue, uint32_t, const VkBindSparseInfo *, VkFence); VkResult (*p_vkQueueBindSparse)(VkQueue, uint32_t, const VkBindSparseInfo *, VkFence);
#endif
VkResult (*p_vkQueueSubmit)(VkQueue, uint32_t, const VkSubmitInfo *, VkFence); VkResult (*p_vkQueueSubmit)(VkQueue, uint32_t, const VkSubmitInfo *, VkFence);
VkResult (*p_vkQueueWaitIdle)(VkQueue); VkResult (*p_vkQueueWaitIdle)(VkQueue);
VkResult (*p_vkResetCommandBuffer)(VkCommandBuffer, VkCommandBufferResetFlags); VkResult (*p_vkResetCommandBuffer)(VkCommandBuffer, VkCommandBufferResetFlags);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment