On Mon, Mar 19, 2018 at 1:41 AM, Roderick Colenbrander thunderbird2k@gmail.com wrote:
Signed-off-by: Roderick Colenbrander thunderbird2k@gmail.com
dlls/winevulkan/vulkan.c | 74 +++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 70 insertions(+), 4 deletions(-)
diff --git a/dlls/winevulkan/vulkan.c b/dlls/winevulkan/vulkan.c index 9440000614..87c871d0f4 100644 --- a/dlls/winevulkan/vulkan.c +++ b/dlls/winevulkan/vulkan.c @@ -98,6 +98,64 @@ static struct VkQueue_T *wine_vk_device_alloc_queues(struct VkDevice_T *device, return queues; }
+/* Helper function to convert win32 VkDeviceCreateInfo to host compatible. */ +static VkResult wine_vk_device_convert_create_info(const VkDeviceCreateInfo *src,
VkDeviceCreateInfo *dst)
+{
- unsigned int i;
- dst->sType = src->sType;
- dst->flags = src->flags;
- /* Application and loader can pass in a chain of extensions through pNext.
* We can't blindly pass these through as often these contain callbacks or
* they can even be pass structures for loader / ICD internal use. For now
* we ignore everything in pNext chain, but we print FIXMEs.
*/
- if (src->pNext)
- {
const struct wine_vk_structure_header *header;
for (header = src->pNext; header; header = header->pNext)
{
switch (header->sType)
{
case VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO:
/* Used for loader to ICD communication. Ignore to not confuse
* host loader.
*/
break;
default:
FIXME("Application requested a linked structure of type %d\n", header->sType);
We tend to prefer %#x for enums.
}
}
- }
- /* For now don't support anything. */
- dst->pNext = NULL;
- dst->queueCreateInfoCount = src->queueCreateInfoCount;
- dst->pQueueCreateInfos = src->pQueueCreateInfos;
- /* Should be filtered out by loader as ICDs don't support layers. */
- dst->enabledLayerCount = 0;
- dst->ppEnabledLayerNames = NULL;
- /* TODO: convert win32 extensions here to host specific ones. */
All currently supported extensions are compatible. Extensions mapping will be only needed when we add support for an incompatible extension. I wonder if the TODO is useful.
- dst->ppEnabledExtensionNames = src->ppEnabledExtensionNames;
- dst->enabledExtensionCount = src->enabledExtensionCount;
- TRACE("Enabled extensions: %d\n", dst->enabledExtensionCount);
Please use %u for unsigned integers.
- for (i = 0; i < dst->enabledExtensionCount; i++)
- {
TRACE("Extension %d: %s\n", i, dst->ppEnabledExtensionNames[i]);
Please use %u and debugstr_a().
- }
- dst->pEnabledFeatures = src->pEnabledFeatures;
- return VK_SUCCESS;
+}
/* Helper function used for freeing a device structure. This function supports full
- and partial object cleanups and can thus be used for vkCreateDevice failures.
*/ @@ -470,6 +528,7 @@ VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice phys_dev, const VkAllocationCallbacks *allocator, VkDevice *device) { struct VkDevice_T *object = NULL;
- VkDeviceCreateInfo create_info_host; uint32_t max_queue_families; VkResult res; unsigned int i;
@@ -485,11 +544,18 @@ VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice phys_dev,
object->base.loader_magic = VULKAN_ICD_MAGIC_VALUE;
- res = wine_vk_device_convert_create_info(create_info, &create_info_host);
- if (res != VK_SUCCESS)
- {
ERR("Failed to convert device create info, res=%d\n", res);
goto err;
- }
- /* At least for now we can directly pass create_info through. All extensions we report * should be compatible. In addition the loader is supposed to sanitize values e.g. layers. */
The comment should be removed.
res = phys_dev->instance->funcs.p_vkCreateDevice(phys_dev->phys_dev,
create_info, NULL /* allocator */, &object->device);
if (res != VK_SUCCESS) { ERR("Failed to create device\n");&create_info_host, NULL /* allocator */, &object->device);
@@ -524,10 +590,10 @@ VkResult WINAPI wine_vkCreateDevice(VkPhysicalDevice phys_dev, goto err; }
- for (i = 0; i < create_info->queueCreateInfoCount; i++)
- for (i = 0; i < create_info_host.queueCreateInfoCount; i++) {
uint32_t family_index = create_info->pQueueCreateInfos[i].queueFamilyIndex;
uint32_t queue_count = create_info->pQueueCreateInfos[i].queueCount;
uint32_t family_index = create_info_host.pQueueCreateInfos[i].queueFamilyIndex;
uint32_t queue_count = create_info_host.pQueueCreateInfos[i].queueCount; TRACE("queueFamilyIndex %u, queueCount %u\n", family_index, queue_count);
-- 2.14.3