From: Rémi Bernon <rbernon@codeweavers.com> --- dlls/winevulkan/make_vulkan | 59 ++++++------------- dlls/winevulkan/vulkan_thunks.c | 66 ++++++++++----------- include/wine/vulkan.h | 100 +++++++++++++++++--------------- 3 files changed, 104 insertions(+), 121 deletions(-) diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index eeb770e3672..d12468ed646 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -458,7 +458,8 @@ class Type(object): @staticmethod def all(klass, which=lambda t: True, sort=True, by_name=False): - types = filter(lambda t: type(t) is klass and which(t), Type.types.values()) + klass = [klass] if type(klass) not in (list, tuple) else klass + types = filter(lambda t: type(t) in klass and which(t), Type.types.values()) return sorted(types, key=lambda type: (0 if by_name else -type.order, type.name)) if sort else types @@ -646,14 +647,15 @@ class Function(Type): return Function(alias.type, func_name, alias.params) @staticmethod - def from_xml(command): + def from_xml(command, pointer=False): proto = command.find("proto") func_name = proto.find("name").text - func_type = proto.find("type").text + func_type = innertext(proto).replace(func_name, "").replace('\n', '').strip() params = filter(is_api_supported, command.findall("param")) params = [Parameter.from_xml(param) for param in params] - return Function(func_type, func_name, params) + klass = FunctionPointer if pointer else Function + return klass(func_type, func_name, params) def is_core(self): return not self.extensions or any(ext.is_core for ext in self.extensions) @@ -730,10 +732,11 @@ class Function(Type): return self.name in PERF_CRITICAL_FUNCTIONS def gen_params(self): - return ", ".join(p.as_param() for p in self.params) + return ", ".join(p.as_param() for p in self.params) if len(self.params) else "void" def gen_pointer(self): - return f"typedef {self.type} (VKAPI_PTR *PFN_{self.name})({self.gen_params()});\n" + name = self.name[4:] if self.name.startswith('PFN_') else self.name + return f"typedef {self.type} (VKAPI_PTR *PFN_{name})({self.gen_params()});\n" def gen_prototype(self): return f"{self.type} VKAPI_CALL {self.name}({self.gen_params()});\n" @@ -934,30 +937,16 @@ class Function(Type): return f"{cast}thunk{bitness}_{self.name}" -class FunctionPointer(Type): - def __init__(self, name, value): - Type.__init__(self, name) - self.value = value +class FunctionPointer(Function): + def __init__(self, type, name, params): + Function.__init__(self, type, name, params) @staticmethod - def from_xml(xml): - proto = xml.find("proto") - name = proto.find("name").text - return_type = " ".join(innertext(proto).replace(name, "").split()) - - params = [" ".join(innertext(p).split()) for p in xml.findall("param")] - - value = "typedef {} (VKAPI_PTR *{})(".format(return_type, name) - if params: - value += ", ".join(params) - else: - value += "void" - value += ");" - - return FunctionPointer(name, value) + def from_xml(command): + return Function.from_xml(command, pointer=True) def definition(self): - return self.value + '\n' + return self.gen_pointer() + '\n' class Handle(Type): @@ -2641,21 +2630,9 @@ class Generator(object): if enum.is_required(): f.write(enum.definition()) - f.write("typedef struct VkDebugUtilsMessengerCallbackDataEXT VkDebugUtilsMessengerCallbackDataEXT;\n") - - for fp in Type.all(FunctionPointer, by_name=True): - if fp.is_required(): - f.write(fp.definition()) - f.write("\n") - - # This generates both structures and unions. Since structures - # may depend on other structures/unions, we need a list of - # decoupled structs. - # Note: unions are stored in structs for dependency reasons, - # see comment in parsing section. - for struct in Type.all(Record): - if struct.is_required() and struct.name != "SECURITY_ATTRIBUTES": - f.write(struct.definition()) + for type in Type.all((Record, FunctionPointer)): + if type.is_required() and type.name != "SECURITY_ATTRIBUTES": + f.write(type.definition()) for func in Type.all(Function, Function.is_required): f.write(func.gen_pointer()) diff --git a/dlls/winevulkan/vulkan_thunks.c b/dlls/winevulkan/vulkan_thunks.c index 3b2ad5f933f..4eb91f44b7d 100644 --- a/dlls/winevulkan/vulkan_thunks.c +++ b/dlls/winevulkan/vulkan_thunks.c @@ -163,6 +163,23 @@ typedef struct VkClusterAccelerationStructureTriangleClusterInputNV32 uint32_t minPositionTruncateBitCount; } VkClusterAccelerationStructureTriangleClusterInputNV32; +typedef struct VkDebugUtilsLabelEXT32 +{ + VkStructureType sType; + PTR32 pNext; + PTR32 pLabelName; + float color[4]; +} VkDebugUtilsLabelEXT32; + +typedef struct VkDebugUtilsObjectNameInfoEXT32 +{ + VkStructureType sType; + PTR32 pNext; + VkObjectType objectType; + uint64_t DECLSPEC_ALIGN(8) objectHandle; + PTR32 pObjectName; +} VkDebugUtilsObjectNameInfoEXT32; + typedef struct VkDescriptorMappingSourceConstantOffsetEXT32 { uint32_t heapOffset; @@ -492,6 +509,22 @@ typedef union VkClusterAccelerationStructureOpInputNV32 PTR32 pMoveObjects; } VkClusterAccelerationStructureOpInputNV32; +typedef struct VkDebugUtilsMessengerCallbackDataEXT32 +{ + VkStructureType sType; + PTR32 pNext; + VkDebugUtilsMessengerCallbackDataFlagsEXT flags; + PTR32 pMessageIdName; + int32_t messageIdNumber; + PTR32 pMessage; + uint32_t queueLabelCount; + PTR32 pQueueLabels; + uint32_t cmdBufLabelCount; + PTR32 pCmdBufLabels; + uint32_t objectCount; + PTR32 pObjects; +} VkDebugUtilsMessengerCallbackDataEXT32; + typedef struct VkDescriptorAddressInfoEXT32 { VkStructureType sType; @@ -1033,23 +1066,6 @@ typedef struct VkDataGraphPipelineResourceInfoARM32 uint32_t arrayElement; } VkDataGraphPipelineResourceInfoARM32; -typedef struct VkDebugUtilsLabelEXT32 -{ - VkStructureType sType; - PTR32 pNext; - PTR32 pLabelName; - float color[4]; -} VkDebugUtilsLabelEXT32; - -typedef struct VkDebugUtilsObjectNameInfoEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkObjectType objectType; - uint64_t DECLSPEC_ALIGN(8) objectHandle; - PTR32 pObjectName; -} VkDebugUtilsObjectNameInfoEXT32; - typedef struct VkDecompressMemoryRegionEXT32 { VkDeviceAddress DECLSPEC_ALIGN(8) srcAddress; @@ -2915,22 +2931,6 @@ typedef struct VkDebugReportCallbackCreateInfoEXT32 PTR32 pUserData; } VkDebugReportCallbackCreateInfoEXT32; -typedef struct VkDebugUtilsMessengerCallbackDataEXT32 -{ - VkStructureType sType; - PTR32 pNext; - VkDebugUtilsMessengerCallbackDataFlagsEXT flags; - PTR32 pMessageIdName; - int32_t messageIdNumber; - PTR32 pMessage; - uint32_t queueLabelCount; - PTR32 pQueueLabels; - uint32_t cmdBufLabelCount; - PTR32 pCmdBufLabels; - uint32_t objectCount; - PTR32 pObjects; -} VkDebugUtilsMessengerCallbackDataEXT32; - typedef struct VkDebugUtilsMessengerCreateInfoEXT32 { VkStructureType sType; diff --git a/include/wine/vulkan.h b/include/wine/vulkan.h index b1b4e6dca2d..b040682563f 100644 --- a/include/wine/vulkan.h +++ b/include/wine/vulkan.h @@ -1114,6 +1114,8 @@ typedef VkFlags VkShaderStageFlags; typedef VkFlags VkImageViewCreateFlags; typedef VkFlags VkSampleCountFlags; typedef VkFlags VkColorComponentFlags; +typedef VkFlags VkDebugUtilsMessengerCallbackDataFlagsEXT; +typedef VkFlags VkDeviceMemoryReportFlagsEXT; typedef VkFlags VkGeometryFlagsKHR; typedef VkGeometryFlagsKHR VkGeometryFlagsNV; typedef VkFlags VkGeometryInstanceFlagsKHR; @@ -1140,6 +1142,8 @@ typedef VkFlags VkBuildAccelerationStructureFlagsKHR; typedef VkBuildAccelerationStructureFlagsKHR VkBuildAccelerationStructureFlagsNV; typedef VkFlags VkCompositeAlphaFlagsKHR; typedef VkFlags VkCullModeFlags; +typedef VkFlags VkDebugReportFlagsEXT; +typedef VkFlags VkDebugUtilsMessageTypeFlagsEXT; typedef VkFlags VkDependencyFlags; typedef VkFlags VkDeviceQueueCreateFlags; typedef VkFlags VkDirectDriverLoadingFlagsLUNARG; @@ -1195,10 +1199,7 @@ typedef VkFlags VkCommandPoolCreateFlags; typedef VkFlags VkConditionalRenderingFlagsEXT; typedef VkFlags64 VkDataGraphPipelineDispatchFlagsARM; typedef VkFlags64 VkDataGraphPipelineSessionCreateFlagsARM; -typedef VkFlags VkDebugReportFlagsEXT; typedef VkFlags VkDebugUtilsMessageSeverityFlagsEXT; -typedef VkFlags VkDebugUtilsMessageTypeFlagsEXT; -typedef VkFlags VkDebugUtilsMessengerCallbackDataFlagsEXT; typedef VkFlags VkDebugUtilsMessengerCreateFlagsEXT; typedef VkFlags VkDescriptorBindingFlags; typedef VkDescriptorBindingFlags VkDescriptorBindingFlagsEXT; @@ -1210,7 +1211,6 @@ typedef VkFlags VkDeviceAddressBindingFlagsEXT; typedef VkFlags VkDeviceCreateFlags; typedef VkFlags VkDeviceDiagnosticsConfigFlagsNV; typedef VkFlags VkDeviceGroupPresentModeFlagsKHR; -typedef VkFlags VkDeviceMemoryReportFlagsEXT; typedef VkFlags VkDirectFBSurfaceCreateFlagsEXT; typedef VkFlags VkDisplayModeCreateFlagsKHR; typedef VkFlags VkDisplaySurfaceCreateFlagsKHR; @@ -7278,16 +7278,6 @@ typedef enum VkViewportCoordinateSwizzleNV VK_VIEWPORT_COORDINATE_SWIZZLE_NV_MAX_ENUM = 0x7fffffff, } VkViewportCoordinateSwizzleNV; -typedef struct VkDebugUtilsMessengerCallbackDataEXT VkDebugUtilsMessengerCallbackDataEXT; -typedef void* (VKAPI_PTR *PFN_vkAllocationFunction)(void* pUserData, size_t size, size_t alignment, VkSystemAllocationScope allocationScope); -typedef VkBool32 (VKAPI_PTR *PFN_vkDebugReportCallbackEXT)(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage, void* pUserData); -typedef VkBool32 (VKAPI_PTR *PFN_vkDebugUtilsMessengerCallbackEXT)(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageTypes, const VkDebugUtilsMessengerCallbackDataEXT* pCallbackData, void* pUserData); -typedef void (VKAPI_PTR *PFN_vkFreeFunction)(void* pUserData, void* pMemory); -typedef void (VKAPI_PTR *PFN_vkInternalAllocationNotification)(void* pUserData, size_t size, VkInternalAllocationType allocationType, VkSystemAllocationScope allocationScope); -typedef void (VKAPI_PTR *PFN_vkInternalFreeNotification)(void* pUserData, size_t size, VkInternalAllocationType allocationType, VkSystemAllocationScope allocationScope); -typedef void* (VKAPI_PTR *PFN_vkReallocationFunction)(void* pUserData, void* pOriginal, size_t size, size_t alignment, VkSystemAllocationScope allocationScope); -typedef void (VKAPI_PTR *PFN_vkVoidFunction)(void); - typedef struct StdVideoH265HrdFlags { uint32_t nal_hrd_parameters_present_flag:1; @@ -7497,6 +7487,8 @@ typedef struct VkSpecializationMapEntry size_t size; } VkSpecializationMapEntry; +typedef void (VKAPI_PTR *PFN_vkVoidFunction)(void); + typedef struct StdVideoAV1ColorConfigFlags { uint32_t mono_chrome:1; @@ -7940,6 +7932,23 @@ typedef struct VkClusterAccelerationStructureTriangleClusterInputNV uint32_t minPositionTruncateBitCount; } VkClusterAccelerationStructureTriangleClusterInputNV; +typedef struct VkDebugUtilsLabelEXT +{ + VkStructureType sType; + const void *pNext; + const char *pLabelName; + float color[4]; +} VkDebugUtilsLabelEXT; + +typedef struct VkDebugUtilsObjectNameInfoEXT +{ + VkStructureType sType; + const void *pNext; + VkObjectType objectType; + uint64_t WINE_VK_ALIGN(8) objectHandle; + const char *pObjectName; +} VkDebugUtilsObjectNameInfoEXT; + typedef struct VkDescriptorMappingSourceConstantOffsetEXT { uint32_t heapOffset; @@ -8918,6 +8927,22 @@ typedef struct VkCoarseSampleLocationNV uint32_t sample; } VkCoarseSampleLocationNV; +typedef struct VkDebugUtilsMessengerCallbackDataEXT +{ + VkStructureType sType; + const void *pNext; + VkDebugUtilsMessengerCallbackDataFlagsEXT flags; + const char *pMessageIdName; + int32_t messageIdNumber; + const char *pMessage; + uint32_t queueLabelCount; + const VkDebugUtilsLabelEXT *pQueueLabels; + uint32_t cmdBufLabelCount; + const VkDebugUtilsLabelEXT *pCmdBufLabels; + uint32_t objectCount; + const VkDebugUtilsObjectNameInfoEXT *pObjects; +} VkDebugUtilsMessengerCallbackDataEXT; + typedef struct VkDescriptorAddressInfoEXT { VkStructureType sType; @@ -9218,6 +9243,20 @@ typedef struct VkViewport float maxDepth; } VkViewport; +typedef void* (VKAPI_PTR *PFN_vkAllocationFunction)(void *pUserData, size_t size, size_t alignment, VkSystemAllocationScope allocationScope); + +typedef VkBool32 (VKAPI_PTR *PFN_vkDebugReportCallbackEXT)(VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char *pLayerPrefix, const char *pMessage, void *pUserData); + +typedef VkBool32 (VKAPI_PTR *PFN_vkDebugUtilsMessengerCallbackEXT)(VkDebugUtilsMessageSeverityFlagBitsEXT messageSeverity, VkDebugUtilsMessageTypeFlagsEXT messageTypes, const VkDebugUtilsMessengerCallbackDataEXT *pCallbackData, void *pUserData); + +typedef void (VKAPI_PTR *PFN_vkFreeFunction)(void *pUserData, void *pMemory); + +typedef void (VKAPI_PTR *PFN_vkInternalAllocationNotification)(void *pUserData, size_t size, VkInternalAllocationType allocationType, VkSystemAllocationScope allocationScope); + +typedef void (VKAPI_PTR *PFN_vkInternalFreeNotification)(void *pUserData, size_t size, VkInternalAllocationType allocationType, VkSystemAllocationScope allocationScope); + +typedef void* (VKAPI_PTR *PFN_vkReallocationFunction)(void *pUserData, void *pOriginal, size_t size, size_t alignment, VkSystemAllocationScope allocationScope); + typedef struct StdVideoAV1SequenceHeader { StdVideoAV1SequenceHeaderFlags flags; @@ -9660,23 +9699,6 @@ typedef struct VkDataGraphPipelineResourceInfoARM uint32_t arrayElement; } VkDataGraphPipelineResourceInfoARM; -typedef struct VkDebugUtilsLabelEXT -{ - VkStructureType sType; - const void *pNext; - const char *pLabelName; - float color[4]; -} VkDebugUtilsLabelEXT; - -typedef struct VkDebugUtilsObjectNameInfoEXT -{ - VkStructureType sType; - const void *pNext; - VkObjectType objectType; - uint64_t WINE_VK_ALIGN(8) objectHandle; - const char *pObjectName; -} VkDebugUtilsObjectNameInfoEXT; - typedef struct VkDecompressMemoryRegionEXT { VkDeviceAddress WINE_VK_ALIGN(8) srcAddress; @@ -12026,22 +12048,6 @@ typedef struct VkDebugReportCallbackCreateInfoEXT void *pUserData; } VkDebugReportCallbackCreateInfoEXT; -typedef struct VkDebugUtilsMessengerCallbackDataEXT -{ - VkStructureType sType; - const void *pNext; - VkDebugUtilsMessengerCallbackDataFlagsEXT flags; - const char *pMessageIdName; - int32_t messageIdNumber; - const char *pMessage; - uint32_t queueLabelCount; - const VkDebugUtilsLabelEXT *pQueueLabels; - uint32_t cmdBufLabelCount; - const VkDebugUtilsLabelEXT *pCmdBufLabels; - uint32_t objectCount; - const VkDebugUtilsObjectNameInfoEXT *pObjects; -} VkDebugUtilsMessengerCallbackDataEXT; - typedef struct VkDebugUtilsMessengerCreateInfoEXT { VkStructureType sType; -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/9990