winevulkan: Specify which structures to ignore in STRUCT_CHAIN_CONVERSIONS.

Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
Signed-off-by: Liam Middlebrook <lmiddlebrook@nvidia.com>
Signed-off-by: Georg Lehmann <dadschoorse@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Derek Lesho 2021-05-17 16:00:58 -04:00 committed by Alexandre Julliard
parent aa54278250
commit 0c74c809c7
2 changed files with 13 additions and 11 deletions

View File

@ -256,10 +256,11 @@ FUNCTION_OVERRIDES = {
"vkDebugMarkerSetObjectTagEXT" : {"dispatch": True, "driver" : False, "thunk" : ThunkType.PRIVATE}, "vkDebugMarkerSetObjectTagEXT" : {"dispatch": True, "driver" : False, "thunk" : ThunkType.PRIVATE},
} }
STRUCT_CHAIN_CONVERSIONS = [ STRUCT_CHAIN_CONVERSIONS = {
"VkDeviceCreateInfo", # Ignore to not confuse host loader.
"VkInstanceCreateInfo", "VkDeviceCreateInfo": ["VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO"],
] "VkInstanceCreateInfo": ["VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO"],
}
class Direction(Enum): class Direction(Enum):
@ -2417,9 +2418,10 @@ class FreeFunction(object):
class StructChainConversionFunction(object): class StructChainConversionFunction(object):
def __init__(self, direction, struct): def __init__(self, direction, struct, ignores):
self.direction = direction self.direction = direction
self.struct = struct self.struct = struct
self.ignores = ignores
self.type = struct.name self.type = struct.name
self.name = "convert_{0}_struct_chain".format(self.type) self.name = "convert_{0}_struct_chain".format(self.type)
@ -2444,9 +2446,8 @@ class StructChainConversionFunction(object):
body += " switch (in_header->sType)\n" body += " switch (in_header->sType)\n"
body += " {\n" body += " {\n"
# Ignore to not confuse host loader. for i in self.ignores:
body += " case VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO:\n" body += " case {0}:\n".format(i)
body += " case VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO:\n"
body += " break;\n\n" body += " break;\n\n"
for e in self.struct.struct_extensions: for e in self.struct.struct_extensions:
@ -2455,6 +2456,9 @@ class StructChainConversionFunction(object):
stype = next(x for x in e.members if x.name == "sType") stype = next(x for x in e.members if x.name == "sType")
if stype.values in self.ignores:
continue
body += " case {0}:\n".format(stype.values) body += " case {0}:\n".format(stype.values)
body += " {\n" body += " {\n"
@ -2604,7 +2608,7 @@ class VkGenerator(object):
for struct in self.registry.structs: for struct in self.registry.structs:
if struct.name in STRUCT_CHAIN_CONVERSIONS: if struct.name in STRUCT_CHAIN_CONVERSIONS:
self.struct_chain_conversions.append(StructChainConversionFunction(Direction.INPUT, struct)) self.struct_chain_conversions.append(StructChainConversionFunction(Direction.INPUT, struct, STRUCT_CHAIN_CONVERSIONS[struct.name]))
self.struct_chain_conversions.append(FreeStructChainFunction(struct)) self.struct_chain_conversions.append(FreeStructChainFunction(struct))
# Once we decide to support pNext chains conversion everywhere, move this under get_conversions # Once we decide to support pNext chains conversion everywhere, move this under get_conversions
for e in struct.struct_extensions: for e in struct.struct_extensions:

View File

@ -2641,7 +2641,6 @@ VkResult convert_VkDeviceCreateInfo_struct_chain(const void *pNext, VkDeviceCrea
switch (in_header->sType) switch (in_header->sType)
{ {
case VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO: case VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO:
case VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO:
break; break;
case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_FEATURES_NV: case VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_DEVICE_GENERATED_COMMANDS_FEATURES_NV:
@ -4264,7 +4263,6 @@ VkResult convert_VkInstanceCreateInfo_struct_chain(const void *pNext, VkInstance
{ {
switch (in_header->sType) switch (in_header->sType)
{ {
case VK_STRUCTURE_TYPE_LOADER_DEVICE_CREATE_INFO:
case VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO: case VK_STRUCTURE_TYPE_LOADER_INSTANCE_CREATE_INFO:
break; break;