Commit 26dce248 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winevulkan: Always use params to return Unix thunks result.

parent 6b1f0515
......@@ -257,7 +257,6 @@ VkResult WINAPI vkCreateInstance(const VkInstanceCreateInfo *create_info,
struct vkCreateInstance_params params;
struct VkInstance_T *instance;
uint32_t phys_dev_count = 8, i;
VkResult result;
TRACE("create_info %p, allocator %p, instance %p\n", create_info, allocator, ret);
......@@ -276,7 +275,7 @@ VkResult WINAPI vkCreateInstance(const VkInstanceCreateInfo *create_info,
params.pAllocator = allocator;
params.pInstance = ret;
params.client_ptr = instance;
result = vk_unix_call(unix_vkCreateInstance, &params);
vk_unix_call(unix_vkCreateInstance, &params);
if (instance->phys_dev_count <= phys_dev_count)
break;
phys_dev_count = instance->phys_dev_count;
......@@ -285,7 +284,7 @@ VkResult WINAPI vkCreateInstance(const VkInstanceCreateInfo *create_info,
if (!instance->base.unix_handle)
free(instance);
return result;
return params.result;
}
void WINAPI vkDestroyInstance(VkInstance instance, const VkAllocationCallbacks *pAllocator)
......@@ -319,7 +318,8 @@ VkResult WINAPI vkEnumerateInstanceExtensionProperties(const char *layer_name,
params.pLayerName = layer_name;
params.pPropertyCount = count;
params.pProperties = properties;
return vk_unix_call(unix_vkEnumerateInstanceExtensionProperties, &params);
vk_unix_call(unix_vkEnumerateInstanceExtensionProperties, &params);
return params.result;
}
VkResult WINAPI vkEnumerateInstanceVersion(uint32_t *version)
......@@ -335,7 +335,8 @@ VkResult WINAPI vkEnumerateInstanceVersion(uint32_t *version)
}
params.pApiVersion = version;
return vk_unix_call(unix_vkEnumerateInstanceVersion, &params);
vk_unix_call(unix_vkEnumerateInstanceVersion, &params);
return params.result;
}
static HANDLE get_display_device_init_mutex(void)
......@@ -461,7 +462,6 @@ VkResult WINAPI vkCreateDevice(VkPhysicalDevice phys_dev, const VkDeviceCreateIn
struct vkCreateDevice_params params;
uint32_t queue_count = 0, i;
VkDevice device;
VkResult result;
for (i = 0; i < create_info->queueCreateInfoCount; i++)
queue_count += create_info->pQueueCreateInfos[i].queueCount;
......@@ -475,10 +475,10 @@ VkResult WINAPI vkCreateDevice(VkPhysicalDevice phys_dev, const VkDeviceCreateIn
params.pAllocator = allocator;
params.pDevice = ret;
params.client_ptr = device;
result = vk_unix_call(unix_vkCreateDevice, &params);
vk_unix_call(unix_vkCreateDevice, &params);
if (!device->base.unix_handle)
free(device);
return result;
return params.result;
}
void WINAPI vkDestroyDevice(VkDevice device, const VkAllocationCallbacks *allocator)
......@@ -496,7 +496,6 @@ VkResult WINAPI vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateIn
{
struct vkCreateCommandPool_params params;
struct vk_command_pool *cmd_pool;
VkResult result;
if (!(cmd_pool = malloc(sizeof(*cmd_pool))))
return VK_ERROR_OUT_OF_HOST_MEMORY;
......@@ -508,10 +507,10 @@ VkResult WINAPI vkCreateCommandPool(VkDevice device, const VkCommandPoolCreateIn
params.pAllocator = allocator;
params.pCommandPool = ret;
params.client_ptr = cmd_pool;
result = vk_unix_call(unix_vkCreateCommandPool, &params);
vk_unix_call(unix_vkCreateCommandPool, &params);
if (!cmd_pool->unix_handle)
free(cmd_pool);
return result;
return params.result;
}
void WINAPI vkDestroyCommandPool(VkDevice device, VkCommandPool handle, const VkAllocationCallbacks *allocator)
......@@ -545,7 +544,6 @@ VkResult WINAPI vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferA
struct vk_command_pool *pool = command_pool_from_handle(allocate_info->commandPool);
struct vkAllocateCommandBuffers_params params;
uint32_t i;
VkResult result;
for (i = 0; i < allocate_info->commandBufferCount; i++)
buffers[i] = alloc_vk_object(sizeof(*buffers[i]));
......@@ -553,8 +551,8 @@ VkResult WINAPI vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferA
params.device = device;
params.pAllocateInfo = allocate_info;
params.pCommandBuffers = buffers;
result = vk_unix_call(unix_vkAllocateCommandBuffers, &params);
if (result == VK_SUCCESS)
vk_unix_call(unix_vkAllocateCommandBuffers, &params);
if (params.result == VK_SUCCESS)
{
for (i = 0; i < allocate_info->commandBufferCount; i++)
list_add_tail(&pool->command_buffers, &buffers[i]->pool_link);
......@@ -567,7 +565,7 @@ VkResult WINAPI vkAllocateCommandBuffers(VkDevice device, const VkCommandBufferA
buffers[i] = NULL;
}
}
return result;
return params.result;
}
void WINAPI vkFreeCommandBuffers(VkDevice device, VkCommandPool cmd_pool, uint32_t count,
......
......@@ -764,24 +764,18 @@ class VkFunction(object):
body += " ";
# Call the Unix function.
if self.type != "void" and not self.returns_longlong():
body += "return "
if self.needs_direct_call():
body += "p_vk_direct_unix_call(unix_handle, unix_{0}, &params);\n".format(self.name)
else:
body += "vk_unix_call(unix_{0}, &params);\n".format(self.name)
if self.returns_longlong():
if self.type != "void":
body += " return params.result;\n"
return body
def body(self, conv, unwrap=True, params_prefix=""):
body = ""
result_prefix = ""
# Declare a variable to hold the result for non-void functions.
if self.returns_longlong():
result_prefix = "params->"
elif self.type != "void":
if params_prefix == "" and self.type != "void":
body += " {0} result;\n".format(self.type)
# Declare any tmp parameters for conversion.
......@@ -820,7 +814,7 @@ class VkFunction(object):
if self.type == "void":
body += " {0}{1}({2});\n".format(func_prefix, self.name, params)
else:
body += " {0}result = {1}{2}({3});\n".format(result_prefix, func_prefix, self.name, params)
body += " {0}result = {1}{2}({3});\n".format(params_prefix, func_prefix, self.name, params)
# Call any host_to_win conversion calls.
if conv and unwrap:
......@@ -836,10 +830,10 @@ class VkFunction(object):
body += p.free(prefix=params_prefix)
# Finally return the result.
if self.type != "void" and not self.returns_longlong():
body += " return result;\n"
else:
if params_prefix != "":
body += " return STATUS_SUCCESS;\n"
elif self.type != "void":
body += " return result;\n"
return body
......@@ -3060,7 +3054,7 @@ class VkGenerator(object):
f.write(" {0};\n".format(p.definition(is_member=True)))
if vk_func.extra_param:
f.write(" void *{0};\n".format(vk_func.extra_param))
if vk_func.returns_longlong():
if vk_func.type != "void":
f.write(" {0} result;\n".format(vk_func.type))
f.write("};\n\n");
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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