Commit ef25dd24 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

winevulkan: Get rid of *_host types.

Use WINE_VK_HOST instead.
parent 0b503549
...@@ -673,7 +673,7 @@ class VkFunction(object): ...@@ -673,7 +673,7 @@ class VkFunction(object):
return True return True
return self.name in DIRECT_CALL_FUNCTIONS return self.name in DIRECT_CALL_FUNCTIONS
def pfn(self, prefix="p", call_conv=None, conv=False): def pfn(self, prefix="p", call_conv=None):
""" Create function pointer. """ """ Create function pointer. """
if call_conv: if call_conv:
...@@ -686,8 +686,6 @@ class VkFunction(object): ...@@ -686,8 +686,6 @@ class VkFunction(object):
pfn += param.const + " " pfn += param.const + " "
pfn += param.type pfn += param.type
if conv and param.needs_host_type():
pfn += "_host"
if param.is_pointer(): if param.is_pointer():
pfn += " " + param.pointer pfn += " " + param.pointer
...@@ -720,7 +718,7 @@ class VkFunction(object): ...@@ -720,7 +718,7 @@ class VkFunction(object):
proto += " {0}(".format(self.name) proto += " {0}(".format(self.name)
# Add all the parameters. # Add all the parameters.
proto += ", ".join([p.definition(is_thunk=is_thunk) for p in self.params]) proto += ", ".join([p.definition() for p in self.params])
if is_thunk and self.extra_param: if is_thunk and self.extra_param:
proto += ", void *" + self.extra_param proto += ", void *" + self.extra_param
...@@ -756,15 +754,14 @@ class VkFunction(object): ...@@ -756,15 +754,14 @@ class VkFunction(object):
# Declare any tmp parameters for conversion. # Declare any tmp parameters for conversion.
for p in self.params: for p in self.params:
if p.needs_variable(conv, unwrap): if p.needs_variable(conv, unwrap):
host_type = p.type + "_host" if conv and p.needs_host_type() else p.type
if p.is_dynamic_array(): if p.is_dynamic_array():
body += " {2}{0} *{1}_host;\n".format( body += " {2}{0} *{1}_host;\n".format(
host_type, p.name, "const " if p.is_const() else "") p.type, p.name, "const " if p.is_const() else "")
elif p.optional: elif p.optional:
body += " {0} *{1}_host = NULL;\n".format(host_type, p.name) body += " {0} *{1}_host = NULL;\n".format(p.type, p.name)
needs_alloc = True needs_alloc = True
else: else:
body += " {0} {1}_host;\n".format(host_type, p.name) body += " {0} {1}_host;\n".format(p.type, p.name)
if p.needs_alloc(conv, unwrap): if p.needs_alloc(conv, unwrap):
needs_alloc = True needs_alloc = True
...@@ -864,7 +861,7 @@ class VkFunction(object): ...@@ -864,7 +861,7 @@ class VkFunction(object):
thunk += " struct\n" thunk += " struct\n"
thunk += " {\n" thunk += " {\n"
for p in self.params: for p in self.params:
thunk += " {0};\n".format(p.definition(is_thunk=True, is_member=True)) thunk += " {0};\n".format(p.definition(conv=True, is_member=True))
if self.extra_param: if self.extra_param:
thunk += " void *{0};\n".format(self.extra_param) thunk += " void *{0};\n".format(self.extra_param)
if self.type != "void": if self.type != "void":
...@@ -1386,7 +1383,7 @@ class VkMember(VkVariable): ...@@ -1386,7 +1383,7 @@ class VkMember(VkVariable):
else: else:
return "{0}{1} = {2}{1};\n".format(output, self.name, input) return "{0}{1} = {2}{1};\n".format(output, self.name, input)
def definition(self, align=False, conv=False, postfix=""): def definition(self, align=False, conv=False):
""" Generate prototype for given function. """ Generate prototype for given function.
Args: Args:
...@@ -1404,8 +1401,6 @@ class VkMember(VkVariable): ...@@ -1404,8 +1401,6 @@ class VkMember(VkVariable):
text += self.type text += self.type
if conv and self.needs_host_type(): if conv and self.needs_host_type():
text += "32" text += "32"
elif postfix and self.needs_host_type():
text += postfix
if self.is_pointer(): if self.is_pointer():
text += " {0}{1}".format(self.pointer, self.name) text += " {0}{1}".format(self.pointer, self.name)
...@@ -1606,7 +1601,7 @@ class VkParam(VkVariable): ...@@ -1606,7 +1601,7 @@ class VkParam(VkVariable):
return " convert_{0}_host_to_{3}({4}{2}_host, {1}{2});\n".format( return " convert_{0}_host_to_{3}({4}{2}_host, {1}{2});\n".format(
self.type, prefix, self.name, win_type, ref_part) self.type, prefix, self.name, win_type, ref_part)
def definition(self, postfix=None, is_member=False, is_thunk=False): def definition(self, postfix=None, is_member=False, conv=False):
""" Return prototype for the parameter. E.g. 'const char *foo' """ """ Return prototype for the parameter. E.g. 'const char *foo' """
proto = "" proto = ""
...@@ -1615,8 +1610,8 @@ class VkParam(VkVariable): ...@@ -1615,8 +1610,8 @@ class VkParam(VkVariable):
proto += self.type proto += self.type
name = self.name name = self.name
if is_thunk and self.needs_host_type(): if conv and self.needs_host_type():
proto += "32" if is_member else "_host" proto += "32"
if is_member and self.needs_alignment(): if is_member and self.needs_alignment():
proto += " DECLSPEC_ALIGN(8)" proto += " DECLSPEC_ALIGN(8)"
...@@ -1866,7 +1861,7 @@ class VkStruct(Sequence): ...@@ -1866,7 +1861,7 @@ class VkStruct(Sequence):
return decoupled_structs return decoupled_structs
def definition(self, align=False, conv=False, postfix=None): def definition(self, align=False, conv=False):
""" Convert structure to textual definition. """ Convert structure to textual definition.
Args: Args:
...@@ -1878,13 +1873,7 @@ class VkStruct(Sequence): ...@@ -1878,13 +1873,7 @@ class VkStruct(Sequence):
if self.is_alias(): if self.is_alias():
return "" return ""
if postfix: suffix = "32" if conv else ""
suffix = postfix
elif conv:
suffix = "32"
else:
suffix = ""
if self.union: if self.union:
text = "typedef union {0}".format(self.name) text = "typedef union {0}".format(self.name)
else: else:
...@@ -1895,9 +1884,9 @@ class VkStruct(Sequence): ...@@ -1895,9 +1884,9 @@ class VkStruct(Sequence):
for m in self: for m in self:
if align and m.needs_alignment(): if align and m.needs_alignment():
text += " {0};\n".format(m.definition(align=align, conv=conv, postfix=postfix)) text += " {0};\n".format(m.definition(align=align, conv=conv))
else: else:
text += " {0};\n".format(m.definition(conv=conv, postfix=postfix)) text += " {0};\n".format(m.definition(conv=conv))
text += "}} {0}{1};\n".format(self.name, suffix) text += "}} {0}{1};\n".format(self.name, suffix)
...@@ -2119,7 +2108,6 @@ class StructConversionFunction(object): ...@@ -2119,7 +2108,6 @@ class StructConversionFunction(object):
body += "#if !defined(USE_STRUCT_CONVERSION)\n" body += "#if !defined(USE_STRUCT_CONVERSION)\n"
needs_alloc = self.direction != Direction.OUTPUT and self.operand.needs_alloc(self.conv, self.unwrap) needs_alloc = self.direction != Direction.OUTPUT and self.operand.needs_alloc(self.conv, self.unwrap)
host_type = self.type + "_host" if self.operand.needs_host_type() else self.type
win_type = self.type win_type = self.type
if self.conv and self.operand.needs_host_type(): if self.conv and self.operand.needs_host_type():
win_type += "32" win_type += "32"
...@@ -2130,9 +2118,9 @@ class StructConversionFunction(object): ...@@ -2130,9 +2118,9 @@ class StructConversionFunction(object):
body += "static inline void {0}(".format(self.name) body += "static inline void {0}(".format(self.name)
if self.direction == Direction.OUTPUT: if self.direction == Direction.OUTPUT:
params = ["const {0} *in".format(host_type), "{0} *out".format(win_type)] params = ["const {0} *in".format(self.type), "{0} *out".format(win_type)]
else: else:
params = ["const {0} *in".format(win_type), "{0} *out".format(host_type)] params = ["const {0} *in".format(win_type), "{0} *out".format(self.type)]
# Generate parameter list # Generate parameter list
if needs_alloc: if needs_alloc:
...@@ -2190,13 +2178,12 @@ class StructConversionFunction(object): ...@@ -2190,13 +2178,12 @@ class StructConversionFunction(object):
continue continue
stype = next(x for x in ext.members if x.name == "sType").values stype = next(x for x in ext.members if x.name == "sType").values
host_type = ext.name + "_host" if self.conv and ext.needs_host_type() else ext.name
win_type = ext.name + "32" if self.conv and ext.needs_host_type() else ext.name win_type = ext.name + "32" if self.conv and ext.needs_host_type() else ext.name
if self.direction == Direction.INPUT: if self.direction == Direction.INPUT:
in_type = "const " + win_type in_type = "const " + win_type
out_type = host_type out_type = ext.name
else: else:
in_type = "const " + host_type in_type = "const " + ext.name
out_type = win_type out_type = win_type
body += " case {0}:\n".format(stype) body += " case {0}:\n".format(stype)
...@@ -2288,10 +2275,6 @@ class ArrayConversionFunction(object): ...@@ -2288,10 +2275,6 @@ class ArrayConversionFunction(object):
needs_alloc = self.direction != Direction.OUTPUT and self.array.needs_alloc(self.conv, self.unwrap) needs_alloc = self.direction != Direction.OUTPUT and self.array.needs_alloc(self.conv, self.unwrap)
if self.conv and self.array.is_struct() and self.array.struct.needs_host_type():
host_type = "{0}_host".format(self.type)
else:
host_type = self.type
win_type = self.type win_type = self.type
if self.conv and self.array.needs_host_type(): if self.conv and self.array.needs_host_type():
win_type += "32" win_type += "32"
...@@ -2300,12 +2283,12 @@ class ArrayConversionFunction(object): ...@@ -2300,12 +2283,12 @@ class ArrayConversionFunction(object):
pointer_part = self.array.pointer if self.array.pointer else "*" pointer_part = self.array.pointer if self.array.pointer else "*"
if self.direction == Direction.OUTPUT: if self.direction == Direction.OUTPUT:
params = ["const {0} {1}in".format(host_type, pointer_part), params = ["const {0} {1}in".format(self.type, pointer_part),
"{0} {1}out".format(win_type, pointer_part), "uint32_t count"] "{0} {1}out".format(win_type, pointer_part), "uint32_t count"]
return_type = None return_type = None
else: else:
params = ["const {0} {1}in".format(win_type, pointer_part), "uint32_t count"] params = ["const {0} {1}in".format(win_type, pointer_part), "uint32_t count"]
return_type = host_type return_type = self.type
needs_copy = not self.array.is_struct() or self.direction != Direction.INPUT or \ needs_copy = not self.array.is_struct() or self.direction != Direction.INPUT or \
not self.array.struct.returnedonly or "pNext" in self.array.struct not self.array.struct.returnedonly or "pNext" in self.array.struct
...@@ -2595,18 +2578,6 @@ class VkGenerator(object): ...@@ -2595,18 +2578,6 @@ class VkGenerator(object):
f.write("#define WINE_VK_VERSION VK_API_VERSION_{0}_{1}\n\n".format(WINE_VK_VERSION[0], WINE_VK_VERSION[1])) f.write("#define WINE_VK_VERSION VK_API_VERSION_{0}_{1}\n\n".format(WINE_VK_VERSION[0], WINE_VK_VERSION[1]))
for struct in self.host_structs:
if struct.is_alias():
continue
f.write("#if defined(USE_STRUCT_CONVERSION)\n")
f.write(struct.definition(align=False, postfix="_host"))
f.write("#else\n")
f.write("typedef {0} {0}_host;\n".format(struct.name))
for aliasee in struct.aliased_by:
f.write("typedef {0}_host {1}_host;\n".format(struct.name, aliasee.name))
f.write("#endif\n\n")
f.write("\n")
# Generate prototypes for device and instance functions requiring a custom implementation. # Generate prototypes for device and instance functions requiring a custom implementation.
f.write("/* Functions for which we have custom implementations outside of the thunks. */\n") f.write("/* Functions for which we have custom implementations outside of the thunks. */\n")
for vk_func in self.registry.funcs.values(): for vk_func in self.registry.funcs.values():
...@@ -2626,7 +2597,7 @@ class VkGenerator(object): ...@@ -2626,7 +2597,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
f.write(" {0};\n".format(vk_func.pfn(conv=True))) f.write(" {0};\n".format(vk_func.pfn()))
f.write("};\n\n") f.write("};\n\n")
f.write("/* For use by vkInstance and children */\n") f.write("/* For use by vkInstance and children */\n")
...@@ -2639,7 +2610,7 @@ class VkGenerator(object): ...@@ -2639,7 +2610,7 @@ class VkGenerator(object):
LOGGER.debug("skipping {0} in vulkan_instance_funcs".format(vk_func.name)) LOGGER.debug("skipping {0} in vulkan_instance_funcs".format(vk_func.name))
continue continue
f.write(" {0};\n".format(vk_func.pfn(conv=True))) f.write(" {0};\n".format(vk_func.pfn()))
f.write("};\n\n") f.write("};\n\n")
f.write("#define ALL_VK_DEVICE_FUNCS() \\\n") f.write("#define ALL_VK_DEVICE_FUNCS() \\\n")
......
...@@ -97,7 +97,7 @@ static uint64_t wine_vk_get_wrapper(struct wine_instance *instance, uint64_t nat ...@@ -97,7 +97,7 @@ static uint64_t wine_vk_get_wrapper(struct wine_instance *instance, uint64_t nat
static VkBool32 debug_utils_callback_conversion(VkDebugUtilsMessageSeverityFlagBitsEXT severity, static VkBool32 debug_utils_callback_conversion(VkDebugUtilsMessageSeverityFlagBitsEXT severity,
VkDebugUtilsMessageTypeFlagsEXT message_types, VkDebugUtilsMessageTypeFlagsEXT message_types,
const VkDebugUtilsMessengerCallbackDataEXT_host *callback_data, const VkDebugUtilsMessengerCallbackDataEXT *callback_data,
void *user_data) void *user_data)
{ {
struct wine_vk_debug_utils_params params; struct wine_vk_debug_utils_params params;
...@@ -609,7 +609,7 @@ static void wine_vk_instance_free(struct wine_instance *instance) ...@@ -609,7 +609,7 @@ static void wine_vk_instance_free(struct wine_instance *instance)
free(instance); free(instance);
} }
VkResult wine_vkAllocateCommandBuffers(VkDevice handle, const VkCommandBufferAllocateInfo_host *allocate_info, VkResult wine_vkAllocateCommandBuffers(VkDevice handle, const VkCommandBufferAllocateInfo *allocate_info,
VkCommandBuffer *buffers ) VkCommandBuffer *buffers )
{ {
struct wine_device *device = wine_device_from_handle(handle); struct wine_device *device = wine_device_from_handle(handle);
...@@ -622,7 +622,7 @@ VkResult wine_vkAllocateCommandBuffers(VkDevice handle, const VkCommandBufferAll ...@@ -622,7 +622,7 @@ VkResult wine_vkAllocateCommandBuffers(VkDevice handle, const VkCommandBufferAll
for (i = 0; i < allocate_info->commandBufferCount; i++) for (i = 0; i < allocate_info->commandBufferCount; i++)
{ {
VkCommandBufferAllocateInfo_host allocate_info_host; VkCommandBufferAllocateInfo allocate_info_host;
/* TODO: future extensions (none yet) may require pNext conversion. */ /* TODO: future extensions (none yet) may require pNext conversion. */
allocate_info_host.pNext = allocate_info->pNext; allocate_info_host.pNext = allocate_info->pNext;
...@@ -679,7 +679,7 @@ VkResult wine_vkCreateDevice(VkPhysicalDevice phys_dev_handle, const VkDeviceCre ...@@ -679,7 +679,7 @@ VkResult wine_vkCreateDevice(VkPhysicalDevice phys_dev_handle, const VkDeviceCre
if (TRACE_ON(vulkan)) if (TRACE_ON(vulkan))
{ {
VkPhysicalDeviceProperties_host properties; VkPhysicalDeviceProperties properties;
phys_dev->instance->funcs.p_vkGetPhysicalDeviceProperties(phys_dev->phys_dev, &properties); phys_dev->instance->funcs.p_vkGetPhysicalDeviceProperties(phys_dev->phys_dev, &properties);
...@@ -1163,7 +1163,7 @@ void wine_vkGetPhysicalDeviceExternalBufferPropertiesKHR(VkPhysicalDevice phys_d ...@@ -1163,7 +1163,7 @@ void wine_vkGetPhysicalDeviceExternalBufferPropertiesKHR(VkPhysicalDevice phys_d
VkResult wine_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice phys_dev_handle, VkResult wine_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice phys_dev_handle,
const VkPhysicalDeviceImageFormatInfo2 *format_info, const VkPhysicalDeviceImageFormatInfo2 *format_info,
VkImageFormatProperties2_host *properties) VkImageFormatProperties2 *properties)
{ {
struct wine_phys_dev *phys_dev = wine_phys_dev_from_handle(phys_dev_handle); struct wine_phys_dev *phys_dev = wine_phys_dev_from_handle(phys_dev_handle);
VkExternalImageFormatProperties *external_image_properties; VkExternalImageFormatProperties *external_image_properties;
...@@ -1186,7 +1186,7 @@ VkResult wine_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice phys_de ...@@ -1186,7 +1186,7 @@ VkResult wine_vkGetPhysicalDeviceImageFormatProperties2(VkPhysicalDevice phys_de
VkResult wine_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice phys_dev_handle, VkResult wine_vkGetPhysicalDeviceImageFormatProperties2KHR(VkPhysicalDevice phys_dev_handle,
const VkPhysicalDeviceImageFormatInfo2 *format_info, const VkPhysicalDeviceImageFormatInfo2 *format_info,
VkImageFormatProperties2_host *properties) VkImageFormatProperties2 *properties)
{ {
struct wine_phys_dev *phys_dev = wine_phys_dev_from_handle(phys_dev_handle); struct wine_phys_dev *phys_dev = wine_phys_dev_from_handle(phys_dev_handle);
VkExternalImageFormatProperties *external_image_properties; VkExternalImageFormatProperties *external_image_properties;
...@@ -1454,12 +1454,12 @@ VkResult wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice handle, ...@@ -1454,12 +1454,12 @@ VkResult wine_vkGetPhysicalDeviceSurfaceCapabilitiesKHR(VkPhysicalDevice handle,
} }
VkResult wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice handle, VkResult wine_vkGetPhysicalDeviceSurfaceCapabilities2KHR(VkPhysicalDevice handle,
const VkPhysicalDeviceSurfaceInfo2KHR_host *surface_info, const VkPhysicalDeviceSurfaceInfo2KHR *surface_info,
VkSurfaceCapabilities2KHR *capabilities) VkSurfaceCapabilities2KHR *capabilities)
{ {
struct wine_phys_dev *phys_dev = wine_phys_dev_from_handle(handle); struct wine_phys_dev *phys_dev = wine_phys_dev_from_handle(handle);
struct wine_surface *surface = wine_surface_from_handle(surface_info->surface); struct wine_surface *surface = wine_surface_from_handle(surface_info->surface);
VkPhysicalDeviceSurfaceInfo2KHR_host host_info; VkPhysicalDeviceSurfaceInfo2KHR host_info;
VkResult res; VkResult res;
host_info.sType = surface_info->sType; host_info.sType = surface_info->sType;
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#if defined(__i386__) #if defined(__i386__)
#define USE_STRUCT_CONVERSION #define USE_STRUCT_CONVERSION
#endif #endif
#define WINE_VK_HOST
#define VK_NO_PROTOTYPES #define VK_NO_PROTOTYPES
#include <pthread.h> #include <pthread.h>
......
This source diff could not be displayed because it is too large. You can view the blob instead.
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