<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">No, this is all I had.<br>
Tables of tables formats are just in anv :
<a class="moz-txt-link-freetext" href="https://github.com/djdeath/mesa/commit/b40dd5245cdaa5d686b8494f0e8c784b2eea4211#diff-8d7721e9d80d390ff503d2c3b4e1adc5L274">https://github.com/djdeath/mesa/commit/b40dd5245cdaa5d686b8494f0e8c784b2eea4211#diff-8d7721e9d80d390ff503d2c3b4e1adc5L274</a><br>
<br>
On 18/09/17 15:48, Jason Ekstrand wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAOFGe97CHbCVG9KO4p8281Qjv8bPCgo_z1+THDifyX7SPJ27VA@mail.gmail.com">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<div dir="ltr">Did you have a patch to the enum generator to
actually generate the table of tables for the formats? I don't
see that in ithe series.<br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Mon, Sep 18, 2017 at 7:46 AM, Jason
Ekstrand <span dir="ltr"><<a
href="mailto:jason@jlekstrand.net" target="_blank"
moz-do-not-send="true">jason@jlekstrand.net</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">
<div class="gmail_extra">
<div class="gmail_quote">
<div>
<div class="h5">On Fri, Sep 15, 2017 at 7:10 AM,
Lionel Landwerlin <span dir="ltr"><<a
href="mailto:lionel.g.landwerlin@intel.com"
target="_blank" moz-do-not-send="true">lionel.g.landwerlin@intel.com</a><wbr>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0
0 .8ex;border-left:1px #ccc
solid;padding-left:1ex">New extensions can
introduce additional enums. Most of the new
enums<br>
will have disjoint numbers from the initial
enums. For example new<br>
formats introduced by VK_IMG_format_pvrtc :<br>
<br>
VK_FORMAT_ASTC_10x8_UNORM_BLOC<wbr>K = 177,<br>
VK_FORMAT_ASTC_10x8_SRGB_BLOCK = 178,<br>
VK_FORMAT_ASTC_10x10_UNORM_BLO<wbr>CK = 179,<br>
VK_FORMAT_ASTC_10x10_SRGB_BLOC<wbr>K = 180,<br>
VK_FORMAT_ASTC_12x10_UNORM_BLO<wbr>CK = 181,<br>
VK_FORMAT_ASTC_12x10_SRGB_BLOC<wbr>K = 182,<br>
VK_FORMAT_ASTC_12x12_UNORM_BLO<wbr>CK = 183,<br>
VK_FORMAT_ASTC_12x12_SRGB_BLOC<wbr>K = 184,<br>
VK_FORMAT_PVRTC1_2BPP_UNORM_BL<wbr>OCK_IMG =
1000054000,<br>
VK_FORMAT_PVRTC1_4BPP_UNORM_BL<wbr>OCK_IMG =
1000054001,<br>
VK_FORMAT_PVRTC2_2BPP_UNORM_BL<wbr>OCK_IMG =
1000054002,<br>
VK_FORMAT_PVRTC2_4BPP_UNORM_BL<wbr>OCK_IMG =
1000054003,<br>
VK_FORMAT_PVRTC1_2BPP_SRGB_BLO<wbr>CK_IMG =
1000054004,<br>
VK_FORMAT_PVRTC1_4BPP_SRGB_BLO<wbr>CK_IMG =
1000054005,<br>
VK_FORMAT_PVRTC2_2BPP_SRGB_BLO<wbr>CK_IMG =
1000054006,<br>
VK_FORMAT_PVRTC2_4BPP_SRGB_BLO<wbr>CK_IMG =
1000054007,<br>
<br>
It's obvious we can't have a single table for
handling those anymore.<br>
<br>
Fortunately the enum values actually contain the
number of the<br>
extension that introduced the new enums. So we
can build an<br>
indirection table off the extension number and
then index by<br>
subtracting the first enum of the the format
enum value.<br>
<br>
This change makes the extension number available
in the generated enum<br>
code.<br>
<br>
Signed-off-by: Lionel Landwerlin <<a
href="mailto:lionel.g.landwerlin@intel.com"
target="_blank" moz-do-not-send="true">lionel.g.landwerlin@intel.com</a><wbr>><br>
---<br>
src/vulkan/util/gen_enum_to_s<wbr>tr.py | 23
+++++++++++++++++++++--<br>
1 file changed, 21 insertions(+), 2
deletions(-)<br>
<br>
diff --git a/src/vulkan/util/gen_enum_to_<wbr>str.py
b/src/vulkan/util/gen_enum_to_<wbr>str.py<br>
index 28bfbfde235..06d625d9ac8 100644<br>
--- a/src/vulkan/util/gen_enum_to_<wbr>str.py<br>
+++ b/src/vulkan/util/gen_enum_to_<wbr>str.py<br>
@@ -91,6 +91,10 @@ H_TEMPLATE =
Template(textwrap.dedent(u"""\<br>
<br>
#include <vulkan/vulkan.h><br>
<br>
+ % for ext in extensions:<br>
+ #define _${<a href="http://ext.name"
rel="noreferrer" target="_blank"
moz-do-not-send="true">ext.name</a>}_number
(${ext.number})<br>
</blockquote>
<div><br>
</div>
</div>
</div>
<div>I was about to say that this is already in the
Vulkan headers but then I looked and it isn't. :-(<br>
</div>
<span class="">
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
+ % endfor<br>
+<br>
% for enum in enums:<br>
const char * vk_${<a href="http://enum.name"
rel="noreferrer" target="_blank"
moz-do-not-send="true">enum.name</a>[2:]}_to_str(${<a
href="http://enum.name" rel="noreferrer"
target="_blank" moz-do-not-send="true">e<wbr>num.name</a>}
input);<br>
% endfor<br>
@@ -113,6 +117,14 @@ class NamedFactory(object):<br>
return n<br>
<br>
<br>
+class VkExtension(object):<br>
+ """Simple struct-like class representing
extensions"""<br>
+<br>
+ def __init__(self, name, number):<br>
+ <a href="http://self.name"
rel="noreferrer" target="_blank"
moz-do-not-send="true">self.name</a> = name<br>
+ self.number = number<br>
+<br>
+<br>
class VkEnum(object):<br>
"""Simple struct-like class representing a
single Vulkan Enum."""<br>
<br>
@@ -121,6 +133,7 @@ class VkEnum(object):<br>
self.values = values or []<br>
<br>
<br>
+<br>
</blockquote>
<div><br>
</div>
</span>
<div>Extra newline. Other than, LGTM<br>
</div>
<div>
<div class="h5">
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0
0 .8ex;border-left:1px #ccc
solid;padding-left:1ex">
def xml_parser(filename):<br>
"""Parse the XML file and return parsed
data.<br>
<br>
@@ -128,6 +141,7 @@ def xml_parser(filename):<br>
of VkEnum objects.<br>
"""<br>
enum_factory = NamedFactory(VkEnum)<br>
+ ext_factory = NamedFactory(VkExtension)<br>
<br>
with open(filename, 'rb') as f:<br>
context = iter(et.iterparse(f,
events=('start', 'end')))<br>
@@ -144,6 +158,8 @@ def xml_parser(filename):<br>
enum =
enum_factory(elem.attrib['name<wbr>'])<br>
enum.values.extend([e.attrib[<wbr>'name'] for e
in elem<br>
if
e.tag == 'enum'])<br>
+ elif event == 'start' and elem.tag
== 'extension':<br>
+ ext_factory(elem.attrib['name'<wbr>],
int(elem.attrib['number']))<br>
elif event == 'end' and elem.tag ==
'extension':<br>
if elem.attrib['supported'] !=
'vulkan':<br>
continue<br>
@@ -153,7 +169,8 @@ def xml_parser(filename):<br>
<br>
root.clear()<br>
<br>
- return enum_factory.registry.values()<br>
+ return (enum_factory.registry.values(<wbr>),<br>
+ ext_factory.registry.values())<br>
<br>
<br>
def main():<br>
@@ -165,14 +182,16 @@ def main():<br>
<br>
args = parser.parse_args()<br>
<br>
- enums = xml_parser(args.xml)<br>
+ enums, extensions = xml_parser(args.xml)<br>
enums.sort(key=lambda e: <a
href="http://e.name" rel="noreferrer"
target="_blank" moz-do-not-send="true">e.name</a>)<br>
+ extensions.sort(key=lambda e: e.number)<br>
for template, file_ in [(C_TEMPLATE,
os.path.join(args.outdir, 'vk_enum_to_str.c')),<br>
(H_TEMPLATE,
os.path.join(args.outdir, 'vk_enum_to_str.h'))]:<br>
with open(file_, 'wb') as f:<br>
f.write(template.render(<br>
file=os.path.basename(__file_<wbr>_),<br>
enums=enums,<br>
+ extensions=extensions,<br>
copyright=COPYRIGHT))<br>
<span class="m_6447798381180325231HOEnZb"><font
color="#888888"><br>
<br>
--<br>
2.14.1<br>
<br>
______________________________<wbr>_________________<br>
mesa-dev mailing list<br>
<a
href="mailto:mesa-dev@lists.freedesktop.org"
target="_blank" moz-do-not-send="true">mesa-dev@lists.freedesktop.org</a><br>
<a
href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev"
rel="noreferrer" target="_blank"
moz-do-not-send="true">https://lists.freedesktop.org/<wbr>mailman/listinfo/mesa-dev</a><br>
</font></span></blockquote>
</div>
</div>
</div>
<br>
</div>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<p><br>
</p>
</body>
</html>