public inbox for git-commits@fedoraproject.org
help / color / mirror / Atom feed
* [rpms/vkroots] rawhide: Fix for new Vulkan 1.4.341+ XML format; add parsing for both old and new format.
@ 2026-06-25 13:33 Simone Caronni
  0 siblings, 0 replies; only message in thread
From: Simone Caronni @ 2026-06-25 13:33 UTC (permalink / raw)
  To: git-commits

A new commit has been pushed.

Repo   : rpms/vkroots
Branch : rawhide
Commit : b3ca603d6748e2c218e0f433389fa8f7b522a4de
Author : Simone Caronni <negativo17@gmail.com>
Date   : 2026-06-25T15:33:09+02:00
Stats  : +98/-1 in 2 file(s)
URL    : https://src.fedoraproject.org/rpms/vkroots/c/b3ca603d6748e2c218e0f433389fa8f7b522a4de?branch=rawhide

Log:
Fix for new Vulkan 1.4.341+ XML format; add parsing for both old and new format.

---
diff --git a/vkroots-fix-funcpointer-xml-format.patch b/vkroots-fix-funcpointer-xml-format.patch
new file mode 100644
index 0000000..98a8bf8
--- /dev/null
+++ b/vkroots-fix-funcpointer-xml-format.patch
@@ -0,0 +1,96 @@
+--- a/gen/vulkan_helpers.py	2026-05-07 22:00:10.000000000 +0200
++++ b/gen/vulkan_helpers.py	2026-06-25 15:23:53.756076567 +0200
+@@ -462,38 +462,51 @@
+             return None
+ 
+         members = []
+-        begin = None
++        proto = funcpointer.find("proto")
+ 
+-        for t in funcpointer.findall("type"):
+-            # General form:
+-            # <type>void</type>*       pUserData,
+-            # Parsing of the tail (anything past </type>) is tricky since there
+-            # can be other data on the next line like: const <type>int</type>..
+-
+-            const = True if begin and "const" in begin else False
+-            _type = t.text
+-            lines = t.tail.split(",\n")
+-            if lines[0][0] == "*":
+-                pointer = "*"
+-                name = lines[0][1:].strip()
+-            else:
+-                pointer = None
+-                name = lines[0].strip()
++        if proto is not None:
++            # New XML format (vulkan-headers 1.4.341+):
++            # <proto><type>void</type> <name>PFN_foo</name></proto>
++            # <param><type>typeA</type>* <name>parmA</name></param>
++            proto_type_elem = proto.find("type")
++            ret_type = proto_type_elem.text
++            ret_ptr = "*" if proto_type_elem.tail and "*" in proto_type_elem.tail else ""
++            _type = "typedef {}{} (VKAPI_PTR *".format(ret_type, ret_ptr)
++            name = proto.find("name").text
++
++            for param in funcpointer.findall("param"):
++                member = VkMember.from_xml(param, False, None)
++                if member:
++                    members.append(member)
++        else:
++            # Old XML format:
++            # typedef void (VKAPI_PTR *<name>PFN_foo</name>)(
++            #     <type>typeA</type>* parmA,
++            begin = None
++            for t in funcpointer.findall("type"):
++                const = True if begin and "const" in begin else False
++                param_type = t.text
++                lines = t.tail.split(",\n")
++                if lines[0][0] == "*":
++                    pointer = "*"
++                    param_name = lines[0][1:].strip()
++                else:
++                    pointer = None
++                    param_name = lines[0].strip()
+ 
+-            # Filter out ); if it is contained.
+-            name = name.partition(");")[0]
++                # Filter out ); if it is contained.
++                param_name = param_name.partition(");")[0]
++
++                try:
++                    begin = lines[1].strip()
++                except IndexError:
++                    begin = None
+ 
+-            # If tail encompasses multiple lines, assign the second line to begin
+-            # for the next line.
+-            try:
+-                begin = lines[1].strip()
+-            except IndexError:
+-                begin = None
++                members.append(VkMember(const=const, _type=param_type, pointer=pointer, name=param_name))
+ 
+-            members.append(VkMember(const=const, _type=_type, pointer=pointer, name=name))
++            _type = funcpointer.text
++            name = funcpointer.find("name").text
+ 
+-        _type = funcpointer.text
+-        name = funcpointer.find("name").text
+         if "requires" in funcpointer.attrib:
+             forward_decls = funcpointer.attrib.get("requires").split(",")
+         else:
+@@ -2069,10 +2082,13 @@
+                     continue
+ 
+             # Name is in general within a name tag else it is an optional
+-            # attribute on the type tag.
++            # attribute on the type tag. For the new funcpointer format,
++            # the name is nested inside <proto><name>...</name></proto>.
+             name_elem = t.find("name")
+             if name_elem is not None:
+                 type_info["name"] = name_elem.text
++            elif t.find("proto/name") is not None:
++                type_info["name"] = t.find("proto/name").text
+             else:
+                 type_info["name"] = t.attrib.get("name", None)
+ 

diff --git a/vkroots.spec b/vkroots.spec
index 2db1f0c..861a097 100644
--- a/vkroots.spec
+++ b/vkroots.spec
@@ -12,7 +12,8 @@ URL:            https://github.com/Joshua-Ashton/vkroots
 BuildArch:      noarch
 
 Source:         %{url}/archive/%{commit}/%{name}-%{shortcommit}.tar.gz
-Patch:          https://patch-diff.githubusercontent.com/raw/misyltoad/vkroots/pull/12.patch
+Patch0:         https://patch-diff.githubusercontent.com/raw/misyltoad/vkroots/pull/12.patch
+Patch1:         vkroots-fix-funcpointer-xml-format.patch
 
 BuildRequires:  meson >= 0.58.0
 BuildRequires:  gcc

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2026-06-25 13:33 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-06-25 13:33 [rpms/vkroots] rawhide: Fix for new Vulkan 1.4.341+ XML format; add parsing for both old and new format Simone Caronni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox