Makes future changes to VkEnumValue easier by deduplicating creation logic.
Signed-off-by: Georg Lehmann dadschoorse@gmail.com --- dlls/winevulkan/make_vulkan | 49 ++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 20 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 1243f211b5e..d3bf8906efc 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -357,9 +357,9 @@ class VkDefine(object):
class VkEnum(object): - def __init__(self, name, values, alias=None): + def __init__(self, name, alias=None): self.name = name - self.values = values + self.values = [] if alias == None else alias.values self.required = False self.alias = alias self.aliased_by = [] @@ -367,7 +367,7 @@ class VkEnum(object): @staticmethod def from_alias(enum, alias): name = enum.attrib.get("name") - aliasee = VkEnum(name, alias.values, alias=alias) + aliasee = VkEnum(name, alias=alias)
alias.add_aliased_by(aliasee) return aliasee @@ -375,34 +375,43 @@ class VkEnum(object): @staticmethod def from_xml(enum): name = enum.attrib.get("name") - values = [] + result = VkEnum(name)
for v in enum.findall("enum"): + value_name = v.attrib.get("name") # Value is either a value or a bitpos, only one can exist. value = v.attrib.get("value") alias_name = v.attrib.get("alias") if alias_name: - alias = next(x for x in values if x.name == alias_name) - values.append(VkEnumValue(v.attrib.get("name"), value=alias.value, hex=alias.hex)) + result.create_alias(value_name, alias_name) elif value: - # Some values are in hex form. We want to preserve the hex representation - # at least when we convert back to a string. Internally we want to use int. - if "0x" in value: - values.append(VkEnumValue(v.attrib.get("name"), value=int(value, 0), hex=True)) - else: - values.append(VkEnumValue(v.attrib.get("name"), value=int(value, 0))) + result.create_value(value_name, value) else: # bitmask - value = 1 << int(v.attrib.get("bitpos")) - values.append(VkEnumValue(v.attrib.get("name"), value=value, hex=True)) + result.create_bitpos(value_name, int(v.attrib.get("bitpos")))
# vulkan.h contains a *_MAX_ENUM value set to 32-bit at the time of writing, # which is to prepare for extensions as they can add values and hence affect # the size definition. max_name = re.sub(r'([0-9a-z_])([A-Z0-9])',r'\1_\2', name).upper() + "_MAX_ENUM" - values.append(VkEnumValue(max_name, value=0x7fffffff, hex=True)) + result.create_value(max_name, "0x7fffffff") + + return result + + def create_alias(self, name, alias_name): + """ Create an aliased value for this enum """ + self.add(VkEnumValue(name, alias=alias_name)) + + def create_value(self, name, value): + """ Create a new value for this enum """ + # Some values are in hex form. We want to preserve the hex representation + # at least when we convert back to a string. Internally we want to use int. + hex = "0x" in value + self.add(VkEnumValue(name, value=int(value, 0), hex=hex))
- return VkEnum(name, values) + def create_bitpos(self, name, pos): + """ Create a new bitmask value for this enum """ + self.add(VkEnumValue(name, value=(1 << pos), hex=True))
def add(self, value): """ Add a value to enum. """ @@ -2874,7 +2883,7 @@ class VkRegistry(object): if "bitpos" in enum_elem.keys(): # We need to add an extra value to an existing enum type. # E.g. VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG to VkFormatFeatureFlagBits. - enum.add(VkEnumValue(enum_elem.attrib["name"], value=(1 << int(enum_elem.attrib["bitpos"])), hex=True)) + enum.create_bitpos(enum_elem.attrib["name"], int(enum_elem.attrib["bitpos"]))
elif "offset" in enum_elem.keys(): # Extensions promoted to Core, have the extension number as part @@ -2891,12 +2900,12 @@ class VkRegistry(object): if direction is not None: value = -value
- enum.add(VkEnumValue(enum_elem.attrib["name"], value=value)) + enum.create_value(enum_elem.attrib["name"], str(value))
elif "value" in enum_elem.keys(): - enum.add(VkEnumValue(enum_elem.attrib["name"], value=int(enum_elem.attrib["value"]))) + enum.create_value(enum_elem.attrib["name"], enum_elem.attrib["value"]) elif "alias" in enum_elem.keys(): - enum.add(VkEnumValue(enum_elem.attrib["name"], alias=enum_elem.attrib["alias"])) + enum.create_alias(enum_elem.attrib["name"], enum_elem.attrib["alias"])
elif "value" in enum_elem.keys(): # Constants are not aliased, no need to add them here, they'll get added later on.
Fixes one of the issue related to the changes for VK_KHR_synchronization2.
Signed-off-by: Georg Lehmann dadschoorse@gmail.com --- dlls/winevulkan/make_vulkan | 55 +++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 20 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index d3bf8906efc..1d739c12cae 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -357,8 +357,11 @@ class VkDefine(object):
class VkEnum(object): - def __init__(self, name, alias=None): + def __init__(self, name, bitwidth, alias=None): + if not bitwidth in [32, 64]: + LOGGER.error("unknown bitwidth {0} for {1}".format(bitwidth, name)) self.name = name + self.bitwidth = bitwidth self.values = [] if alias == None else alias.values self.required = False self.alias = alias @@ -367,7 +370,7 @@ class VkEnum(object): @staticmethod def from_alias(enum, alias): name = enum.attrib.get("name") - aliasee = VkEnum(name, alias=alias) + aliasee = VkEnum(name, alias.bitwidth, alias=alias)
alias.add_aliased_by(aliasee) return aliasee @@ -375,7 +378,8 @@ class VkEnum(object): @staticmethod def from_xml(enum): name = enum.attrib.get("name") - result = VkEnum(name) + bitwidth = int(enum.attrib.get("bitwidth", "32")) + result = VkEnum(name, bitwidth)
for v in enum.findall("enum"): value_name = v.attrib.get("name") @@ -390,28 +394,29 @@ class VkEnum(object): # bitmask result.create_bitpos(value_name, int(v.attrib.get("bitpos")))
- # vulkan.h contains a *_MAX_ENUM value set to 32-bit at the time of writing, - # which is to prepare for extensions as they can add values and hence affect - # the size definition. - max_name = re.sub(r'([0-9a-z_])([A-Z0-9])',r'\1_\2', name).upper() + "_MAX_ENUM" - result.create_value(max_name, "0x7fffffff") + if bitwidth == 32: + # vulkan.h contains a *_MAX_ENUM value set to 32-bit at the time of writing, + # which is to prepare for extensions as they can add values and hence affect + # the size definition. + max_name = re.sub(r'([0-9a-z_])([A-Z0-9])',r'\1_\2', name).upper() + "_MAX_ENUM" + result.create_value(max_name, "0x7fffffff")
return result
def create_alias(self, name, alias_name): """ Create an aliased value for this enum """ - self.add(VkEnumValue(name, alias=alias_name)) + self.add(VkEnumValue(name, self.bitwidth, alias=alias_name))
def create_value(self, name, value): """ Create a new value for this enum """ # Some values are in hex form. We want to preserve the hex representation # at least when we convert back to a string. Internally we want to use int. hex = "0x" in value - self.add(VkEnumValue(name, value=int(value, 0), hex=hex)) + self.add(VkEnumValue(name, self.bitwidth, value=int(value, 0), hex=hex))
def create_bitpos(self, name, pos): """ Create a new bitmask value for this enum """ - self.add(VkEnumValue(name, value=(1 << pos), hex=True)) + self.add(VkEnumValue(name, self.bitwidth, value=(1 << pos), hex=True))
def add(self, value): """ Add a value to enum. """ @@ -432,13 +437,20 @@ class VkEnum(object): if self.is_alias(): return ""
- text = "typedef enum {0}\n{{\n".format(self.name) + default_value = 0x7ffffffe if self.bitwidth == 32 else 0xfffffffffffffffe
# Print values sorted, values can have been added in a random order. - values = sorted(self.values, key=lambda value: value.value if value.value is not None else 0x7ffffffe) - for value in values: - text += " {0},\n".format(value.definition()) - text += "}} {0};\n".format(self.name) + values = sorted(self.values, key=lambda value: value.value if value.value is not None else default_value) + + if self.bitwidth == 32: + text = "typedef enum {0}\n{{\n".format(self.name) + for value in values: + text += " {0},\n".format(value.definition()) + text += "}} {0};\n".format(self.name) + elif self.bitwidth == 64: + text = "typedef VkFlags64 {0};\n\n".format(self.name) + for value in values: + text += "static const {0} {1};\n".format(self.name, value.definition())
for aliasee in self.aliased_by: text += "typedef {0} {1};\n".format(self.name, aliasee.name) @@ -454,28 +466,31 @@ class VkEnum(object):
class VkEnumValue(object): - def __init__(self, name, value=None, hex=False, alias=None): + def __init__(self, name, bitwidth, value=None, hex=False, alias=None): self.name = name + self.bitwidth = bitwidth self.value = value self.hex = hex self.alias = alias
def __repr__(self): + postfix = "ull" if self.bitwidth == 64 else "" if self.is_alias(): return "{0}={1}".format(self.name, self.alias) - return "{0}={1}".format(self.name, self.value) + return "{0}={1}{2}".format(self.name, self.value, postfix)
def definition(self): """ Convert to text definition e.g. VK_FOO = 1 """ + postfix = "ull" if self.bitwidth == 64 else "" if self.is_alias(): return "{0} = {1}".format(self.name, self.alias)
# Hex is commonly used for FlagBits and sometimes within # a non-FlagBits enum for a bitmask value as well. if self.hex: - return "{0} = 0x{1:08x}".format(self.name, self.value) + return "{0} = 0x{1:08x}{2}".format(self.name, self.value, postfix) else: - return "{0} = {1}".format(self.name, self.value) + return "{0} = {1}{2}".format(self.name, self.value, postfix)
def is_alias(self): return self.alias is not None
Signed-off-by: Liam Middlebrook lmiddlebrook@nvidia.com
On 3/5/21 5:32 AM, Georg Lehmann wrote:
Fixes one of the issue related to the changes for VK_KHR_synchronization2.
Signed-off-by: Georg Lehmann dadschoorse@gmail.com
dlls/winevulkan/make_vulkan | 55 +++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 20 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index d3bf8906efc..1d739c12cae 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -357,8 +357,11 @@ class VkDefine(object):
class VkEnum(object):
- def __init__(self, name, alias=None):
- def __init__(self, name, bitwidth, alias=None):
if not bitwidth in [32, 64]:
LOGGER.error("unknown bitwidth {0} for {1}".format(bitwidth, name)) self.name = name
self.bitwidth = bitwidth self.values = [] if alias == None else alias.values self.required = False self.alias = alias
@@ -367,7 +370,7 @@ class VkEnum(object): @staticmethod def from_alias(enum, alias): name = enum.attrib.get("name")
aliasee = VkEnum(name, alias=alias)
aliasee = VkEnum(name, alias.bitwidth, alias=alias) alias.add_aliased_by(aliasee) return aliasee
@@ -375,7 +378,8 @@ class VkEnum(object): @staticmethod def from_xml(enum): name = enum.attrib.get("name")
result = VkEnum(name)
bitwidth = int(enum.attrib.get("bitwidth", "32"))
result = VkEnum(name, bitwidth) for v in enum.findall("enum"): value_name = v.attrib.get("name")
@@ -390,28 +394,29 @@ class VkEnum(object): # bitmask result.create_bitpos(value_name, int(v.attrib.get("bitpos")))
# vulkan.h contains a *_MAX_ENUM value set to 32-bit at the time of writing,
# which is to prepare for extensions as they can add values and hence affect
# the size definition.
max_name = re.sub(r'([0-9a-z_])([A-Z0-9])',r'\1_\2', name).upper() + "_MAX_ENUM"
result.create_value(max_name, "0x7fffffff")
if bitwidth == 32:
# vulkan.h contains a *_MAX_ENUM value set to 32-bit at the time of writing,
# which is to prepare for extensions as they can add values and hence affect
# the size definition.
max_name = re.sub(r'([0-9a-z_])([A-Z0-9])',r'\1_\2', name).upper() + "_MAX_ENUM"
result.create_value(max_name, "0x7fffffff") return result def create_alias(self, name, alias_name): """ Create an aliased value for this enum """
self.add(VkEnumValue(name, alias=alias_name))
self.add(VkEnumValue(name, self.bitwidth, alias=alias_name)) def create_value(self, name, value): """ Create a new value for this enum """ # Some values are in hex form. We want to preserve the hex representation # at least when we convert back to a string. Internally we want to use int. hex = "0x" in value
self.add(VkEnumValue(name, value=int(value, 0), hex=hex))
self.add(VkEnumValue(name, self.bitwidth, value=int(value, 0), hex=hex)) def create_bitpos(self, name, pos): """ Create a new bitmask value for this enum """
self.add(VkEnumValue(name, value=(1 << pos), hex=True))
self.add(VkEnumValue(name, self.bitwidth, value=(1 << pos), hex=True)) def add(self, value): """ Add a value to enum. """
@@ -432,13 +437,20 @@ class VkEnum(object): if self.is_alias(): return ""
text = "typedef enum {0}\n{{\n".format(self.name)
default_value = 0x7ffffffe if self.bitwidth == 32 else 0xfffffffffffffffe # Print values sorted, values can have been added in a random order.
values = sorted(self.values, key=lambda value: value.value if value.value is not None else 0x7ffffffe)
for value in values:
text += " {0},\n".format(value.definition())
text += "}} {0};\n".format(self.name)
values = sorted(self.values, key=lambda value: value.value if value.value is not None else default_value)
if self.bitwidth == 32:
text = "typedef enum {0}\n{{\n".format(self.name)
for value in values:
text += " {0},\n".format(value.definition())
text += "}} {0};\n".format(self.name)
elif self.bitwidth == 64:
text = "typedef VkFlags64 {0};\n\n".format(self.name)
for value in values:
text += "static const {0} {1};\n".format(self.name, value.definition()) for aliasee in self.aliased_by: text += "typedef {0} {1};\n".format(self.name, aliasee.name)
@@ -454,28 +466,31 @@ class VkEnum(object):
class VkEnumValue(object):
- def __init__(self, name, value=None, hex=False, alias=None):
def __init__(self, name, bitwidth, value=None, hex=False, alias=None): self.name = name
self.bitwidth = bitwidth self.value = value self.hex = hex self.alias = alias def __repr__(self):
postfix = "ull" if self.bitwidth == 64 else "" if self.is_alias(): return "{0}={1}".format(self.name, self.alias)
return "{0}={1}".format(self.name, self.value)
return "{0}={1}{2}".format(self.name, self.value, postfix) def definition(self): """ Convert to text definition e.g. VK_FOO = 1 """
postfix = "ull" if self.bitwidth == 64 else "" if self.is_alias(): return "{0} = {1}".format(self.name, self.alias) # Hex is commonly used for FlagBits and sometimes within # a non-FlagBits enum for a bitmask value as well. if self.hex:
return "{0} = 0x{1:08x}".format(self.name, self.value)
return "{0} = 0x{1:08x}{2}".format(self.name, self.value, postfix) else:
return "{0} = {1}".format(self.name, self.value)
return "{0} = {1}{2}".format(self.name, self.value, postfix) def is_alias(self): return self.alias is not None
Georg Lehmann dadschoorse@gmail.com writes:
Fixes one of the issue related to the changes for VK_KHR_synchronization2.
Signed-off-by: Georg Lehmann dadschoorse@gmail.com
dlls/winevulkan/make_vulkan | 55 +++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 20 deletions(-)
I committed this but I forgot to regenerate the files. Now I tried to, and it turns out it doesn't build with an older gcc:
gcc-4.8 -m64 -c -o dlls/vulkan-1/tests/vulkan.o ../wine/dlls/vulkan-1/tests/vulkan.c -Idlls/vulkan-1/tests \ -I../wine/dlls/vulkan-1/tests -Iinclude -I../wine/include -I../wine/include/msvcrt -D__WINESRC__ \ -D_MSVCR_VER=0 -D_REENTRANT -fPIC -fasynchronous-unwind-tables -fno-builtin -fshort-wchar -mabi=ms \ -Wall -pipe -fno-stack-protector -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body \ -Wignored-qualifiers -Wstrict-prototypes -Wtype-limits -Wunused-but-set-parameter -Wvla \ -Wwrite-strings -Wpointer-arith -Wlogical-op -gdwarf-2 -gstrict-dwarf -g -O2 -fno-diagnostics-show-caret In file included from ../wine/dlls/vulkan-1/tests/vulkan.c:21:0: ../wine/include/wine/vulkan.h:750:1: error: initializer element is not constant In file included from ../wine/dlls/vulkan-1/tests/vulkan.c:21:0: ../wine/include/wine/vulkan.h:751:1: error: initializer element is not constant ../wine/include/wine/vulkan.h:752:1: error: initializer element is not constant ../wine/include/wine/vulkan.h:2413:1: error: initializer element is not constant ../wine/include/wine/vulkan.h:2414:1: error: initializer element is not constant ../wine/include/wine/vulkan.h:2415:1: error: initializer element is not constant ../wine/include/wine/vulkan.h:2416:1: error: initializer element is not constant make: *** [Makefile:155459: dlls/vulkan-1/tests/vulkan.o] Error 1
On 11.03.21 13:13, Alexandre Julliard wrote:
Georg Lehmann dadschoorse@gmail.com writes:
Fixes one of the issue related to the changes for VK_KHR_synchronization2.
Signed-off-by: Georg Lehmann dadschoorse@gmail.com
dlls/winevulkan/make_vulkan | 55 +++++++++++++++++++++++-------------- 1 file changed, 35 insertions(+), 20 deletions(-)
I committed this but I forgot to regenerate the files. Now I tried to, and it turns out it doesn't build with an older gcc:
gcc-4.8 -m64 -c -o dlls/vulkan-1/tests/vulkan.o ../wine/dlls/vulkan-1/tests/vulkan.c -Idlls/vulkan-1/tests \ -I../wine/dlls/vulkan-1/tests -Iinclude -I../wine/include -I../wine/include/msvcrt -D__WINESRC__ \ -D_MSVCR_VER=0 -D_REENTRANT -fPIC -fasynchronous-unwind-tables -fno-builtin -fshort-wchar -mabi=ms \ -Wall -pipe -fno-stack-protector -fno-strict-aliasing -Wdeclaration-after-statement -Wempty-body \ -Wignored-qualifiers -Wstrict-prototypes -Wtype-limits -Wunused-but-set-parameter -Wvla \ -Wwrite-strings -Wpointer-arith -Wlogical-op -gdwarf-2 -gstrict-dwarf -g -O2 -fno-diagnostics-show-caret In file included from ../wine/dlls/vulkan-1/tests/vulkan.c:21:0: ../wine/include/wine/vulkan.h:750:1: error: initializer element is not constant In file included from ../wine/dlls/vulkan-1/tests/vulkan.c:21:0: ../wine/include/wine/vulkan.h:751:1: error: initializer element is not constant ../wine/include/wine/vulkan.h:752:1: error: initializer element is not constant ../wine/include/wine/vulkan.h:2413:1: error: initializer element is not constant ../wine/include/wine/vulkan.h:2414:1: error: initializer element is not constant ../wine/include/wine/vulkan.h:2415:1: error: initializer element is not constant ../wine/include/wine/vulkan.h:2416:1: error: initializer element is not constant make: *** [Makefile:155459: dlls/vulkan-1/tests/vulkan.o] Error 1
I'm inclined to say that this is a compiler bug, but anyway, I've send a fix.
Thanks
Georg Lehmann
On Fri, 5 Mar 2021, Georg Lehmann wrote:
Fixes one of the issue related to the changes for VK_KHR_synchronization2.
So I guess the unspecified issue is that in C98 and older it's not possible to specify 64-bit literals in an enum? So the workaround is to declare these as 'static const' variables instead?
The trouble is that using const variables as initializers is questionable. For instance it fails with i686-w64-mingw32-gcc 6.3.0:
i686-w64-mingw32-gcc -c -o dlls/vulkan-1/tests/vulkan.cross.o ../wine/dlls/vulkan-1/tests/vulkan.c -Idlls/vulkan-1/tests \ -I../wine/dlls/vulkan-1/tests -Iinclude -I../wine/include -I../wine/include/msvcrt -D__WINESRC__ \ -D_MSVCR_VER=0 -DWINE_CROSS_PE -Wall -fno-strict-aliasing -Wdeclaration-after-statement \ -Wempty-body -Wignored-qualifiers -Wshift-overflow=2 -Wstrict-prototypes -Wtype-limits \ -Wunused-but-set-parameter -Wvla -Wwrite-strings -Wpointer-arith -Wlogical-op \ -fno-omit-frame-pointer -gdwarf-2 -gstrict-dwarf -g -O2 tools/winebuild/winebuild -b i686-w64-mingw32 -w --implib -o dlls/vulkan-1/libvulkan-1.cross.a --export \ ../wine/dlls/vulkan-1/vulkan-1.spec In file included from ../wine/dlls/vulkan-1/tests/vulkan.c:21:0: ../wine/include/wine/vulkan.h:750:80: error: initializer element is not constant static const VkAccessFlagBits2KHR VK_ACCESS_2_SHADING_RATE_IMAGE_READ_BIT_NV = VK_ACCESS_2_FRAGMENT_SHADING_RATE_ATTACHMENT_READ_BIT_KHR;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [...]
I'll grant you that MinGW 6.3.0 is somewhat old (20170516, Debian 9) and MinGW 8.3-win32 (from Debian 10) allows it. But do we really have to rely on this?
Currently this impacts the TestBot's build VM: https://testbot.winehq.org/JobDetails.pl?Key=86814
By the way, why was this patch committed without also refreshing include/wine/vulkan.h? I guess that's a good thing as this avoids completely breaking the TestBot. But this still does not feel right.
On 11.03.21 17:20, Francois Gouget wrote:
On Fri, 5 Mar 2021, Georg Lehmann wrote:
Fixes one of the issue related to the changes for VK_KHR_synchronization2.
So I guess the unspecified issue is that in C98 and older it's not possible to specify 64-bit literals in an enum?
Yes, that's the issue.
So the workaround is to declare these as 'static const' variables instead?
The trouble is that using const variables as initializers is questionable. For instance it fails with i686-w64-mingw32-gcc 6.3.0:
i686-w64-mingw32-gcc -c -o dlls/vulkan-1/tests/vulkan.cross.o ../wine/dlls/vulkan-1/tests/vulkan.c -Idlls/vulkan-1/tests \ -I../wine/dlls/vulkan-1/tests -Iinclude -I../wine/include -I../wine/include/msvcrt -D__WINESRC__ \ -D_MSVCR_VER=0 -DWINE_CROSS_PE -Wall -fno-strict-aliasing -Wdeclaration-after-statement \ -Wempty-body -Wignored-qualifiers -Wshift-overflow=2 -Wstrict-prototypes -Wtype-limits \ -Wunused-but-set-parameter -Wvla -Wwrite-strings -Wpointer-arith -Wlogical-op \ -fno-omit-frame-pointer -gdwarf-2 -gstrict-dwarf -g -O2 tools/winebuild/winebuild -b i686-w64-mingw32 -w --implib -o dlls/vulkan-1/libvulkan-1.cross.a --export \ ../wine/dlls/vulkan-1/vulkan-1.spec In file included from ../wine/dlls/vulkan-1/tests/vulkan.c:21:0: ../wine/include/wine/vulkan.h:750:80: error: initializer element is not constant static const VkAccessFlagBits2KHR VK_ACCESS_2_SHADING_RATE_IMAGE_READ_BIT_NV = VK_ACCESS_2_FRAGMENT_SHADING_RATE_ATTACHMENT_READ_BIT_KHR;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [...]
I'll grant you that MinGW 6.3.0 is somewhat old (20170516, Debian 9) and MinGW 8.3-win32 (from Debian 10) allows it. But do we really have to rely on this?
Currently this impacts the TestBot's build VM: https://testbot.winehq.org/JobDetails.pl?Key=86814
By the way, why was this patch committed without also refreshing include/wine/vulkan.h? I guess that's a good thing as this avoids completely breaking the TestBot. But this still does not feel right.
I've informed Alexandre Julliard about the missing changes to the generated files yesterday and he found the same issue on gcc4.8. I've already send out a patch [1] that should fix the issue. Sorry for the trouble.
Thanks,
Georg Lehmann
On Thu, 11 Mar 2021, Georg Lehmann wrote: [...]
Currently this impacts the TestBot's build VM: https://testbot.winehq.org/JobDetails.pl?Key=86814
By the way, why was this patch committed without also refreshing include/wine/vulkan.h? I guess that's a good thing as this avoids completely breaking the TestBot. But this still does not feel right.
I've informed Alexandre Julliard about the missing changes to the generated files yesterday and he found the same issue on gcc4.8. I've already send out a patch [1] that should fix the issue. Sorry for the trouble.
That works for me. Thanks for fixing the issue.
Maybe I should systematically run the build on the build machine; that is even if the TestBot does not need to build any test executable for the Windows VMs. That or update the build VM (Debian 9.*) to match the current Wine VMs (Debian Testing).
Signed-off-by: Liam Middlebrook lmiddlebrook@nvidia.com
On 3/5/21 5:32 AM, Georg Lehmann wrote:
Makes future changes to VkEnumValue easier by deduplicating creation logic.
Signed-off-by: Georg Lehmann dadschoorse@gmail.com
dlls/winevulkan/make_vulkan | 49 ++++++++++++++++++++++--------------- 1 file changed, 29 insertions(+), 20 deletions(-)
diff --git a/dlls/winevulkan/make_vulkan b/dlls/winevulkan/make_vulkan index 1243f211b5e..d3bf8906efc 100755 --- a/dlls/winevulkan/make_vulkan +++ b/dlls/winevulkan/make_vulkan @@ -357,9 +357,9 @@ class VkDefine(object):
class VkEnum(object):
- def __init__(self, name, values, alias=None):
- def __init__(self, name, alias=None): self.name = name
self.values = values
self.values = [] if alias == None else alias.values self.required = False self.alias = alias self.aliased_by = []
@@ -367,7 +367,7 @@ class VkEnum(object): @staticmethod def from_alias(enum, alias): name = enum.attrib.get("name")
aliasee = VkEnum(name, alias.values, alias=alias)
aliasee = VkEnum(name, alias=alias) alias.add_aliased_by(aliasee) return aliasee
@@ -375,34 +375,43 @@ class VkEnum(object): @staticmethod def from_xml(enum): name = enum.attrib.get("name")
values = []
result = VkEnum(name) for v in enum.findall("enum"):
value_name = v.attrib.get("name") # Value is either a value or a bitpos, only one can exist. value = v.attrib.get("value") alias_name = v.attrib.get("alias") if alias_name:
alias = next(x for x in values if x.name == alias_name)
values.append(VkEnumValue(v.attrib.get("name"), value=alias.value, hex=alias.hex))
result.create_alias(value_name, alias_name) elif value:
# Some values are in hex form. We want to preserve the hex representation
# at least when we convert back to a string. Internally we want to use int.
if "0x" in value:
values.append(VkEnumValue(v.attrib.get("name"), value=int(value, 0), hex=True))
else:
values.append(VkEnumValue(v.attrib.get("name"), value=int(value, 0)))
result.create_value(value_name, value) else: # bitmask
value = 1 << int(v.attrib.get("bitpos"))
values.append(VkEnumValue(v.attrib.get("name"), value=value, hex=True))
result.create_bitpos(value_name, int(v.attrib.get("bitpos"))) # vulkan.h contains a *_MAX_ENUM value set to 32-bit at the time of writing, # which is to prepare for extensions as they can add values and hence affect # the size definition. max_name = re.sub(r'([0-9a-z_])([A-Z0-9])',r'\1_\2', name).upper() + "_MAX_ENUM"
values.append(VkEnumValue(max_name, value=0x7fffffff, hex=True))
result.create_value(max_name, "0x7fffffff")
return result
- def create_alias(self, name, alias_name):
""" Create an aliased value for this enum """
self.add(VkEnumValue(name, alias=alias_name))
- def create_value(self, name, value):
""" Create a new value for this enum """
# Some values are in hex form. We want to preserve the hex representation
# at least when we convert back to a string. Internally we want to use int.
hex = "0x" in value
self.add(VkEnumValue(name, value=int(value, 0), hex=hex))
return VkEnum(name, values)
def create_bitpos(self, name, pos):
""" Create a new bitmask value for this enum """
self.add(VkEnumValue(name, value=(1 << pos), hex=True)) def add(self, value): """ Add a value to enum. """
@@ -2874,7 +2883,7 @@ class VkRegistry(object): if "bitpos" in enum_elem.keys(): # We need to add an extra value to an existing enum type. # E.g. VK_FORMAT_FEATURE_SAMPLED_IMAGE_FILTER_CUBIC_BIT_IMG to VkFormatFeatureFlagBits.
enum.add(VkEnumValue(enum_elem.attrib["name"], value=(1 << int(enum_elem.attrib["bitpos"])), hex=True))
enum.create_bitpos(enum_elem.attrib["name"], int(enum_elem.attrib["bitpos"])) elif "offset" in enum_elem.keys(): # Extensions promoted to Core, have the extension number as part
@@ -2891,12 +2900,12 @@ class VkRegistry(object): if direction is not None: value = -value
enum.add(VkEnumValue(enum_elem.attrib["name"], value=value))
enum.create_value(enum_elem.attrib["name"], str(value)) elif "value" in enum_elem.keys():
enum.add(VkEnumValue(enum_elem.attrib["name"], value=int(enum_elem.attrib["value"])))
enum.create_value(enum_elem.attrib["name"], enum_elem.attrib["value"]) elif "alias" in enum_elem.keys():
enum.add(VkEnumValue(enum_elem.attrib["name"], alias=enum_elem.attrib["alias"]))
enum.create_alias(enum_elem.attrib["name"], enum_elem.attrib["alias"]) elif "value" in enum_elem.keys(): # Constants are not aliased, no need to add them here, they'll get added later on.