QtBase  v6.3.1
qvkgen.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2017 The Qt Company Ltd.
4 ** Contact: https://www.qt.io/licensing/
5 **
6 ** This file is part of the tools applications of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:GPL-EXCEPT$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and The Qt Company. For licensing terms
14 ** and conditions see https://www.qt.io/terms-conditions. For further
15 ** information use the contact form at https://www.qt.io/contact-us.
16 **
17 ** GNU General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU
19 ** General Public License version 3 as published by the Free Software
20 ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
21 ** included in the packaging of this file. Please review the following
22 ** information to ensure the GNU General Public License requirements will
23 ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
24 **
25 ** $QT_END_LICENSE$
26 **
27 ****************************************************************************/
28 
29 #include <QtCore/qcoreapplication.h>
30 #include <QtCore/qfile.h>
31 #include <QtCore/qfileinfo.h>
32 #include <QtCore/qlist.h>
33 #include <QtCore/qxmlstream.h>
34 
35 // generate wrappers for core functions from the following versions
36 static const QStringList VERSIONS = {
37  QStringLiteral("VK_VERSION_1_0"), // must be the first and always present
38  QStringLiteral("VK_VERSION_1_1"),
39  QStringLiteral("VK_VERSION_1_2")
40 };
41 
43 {
44 public:
45  bool parse();
46 
47  struct TypedName {
51  };
52 
53  struct Command {
57  };
58 
59  QList<Command> commands() const { return m_commands; }
60  QMap<QString, QStringList> versionCommandMapping() const { return m_versionCommandMapping; }
61 
62  void setFileName(const QString &fn) { m_fn = fn; }
63 
64 private:
65  void skip();
66  void parseFeature();
67  void parseFeatureRequire(const QString &versionDefine);
68  void parseCommands();
69  Command parseCommand();
70  TypedName parseParamOrProto(const QString &tag);
71  QString parseName();
72 
73  QFile m_file;
74  QXmlStreamReader m_reader;
75  QList<Command> m_commands;
76  QMap<QString, QStringList> m_versionCommandMapping; // "1.0" -> ["vkGetPhysicalDeviceProperties", ...]
77  QString m_fn;
78 };
79 
81 {
82  m_file.setFileName(m_fn);
83  if (!m_file.open(QIODevice::ReadOnly | QIODevice::Text)) {
84  qWarning("Failed to open %s", qPrintable(m_file.fileName()));
85  return false;
86  }
87  m_reader.setDevice(&m_file);
88 
89  m_commands.clear();
90  m_versionCommandMapping.clear();
91 
92  while (!m_reader.atEnd()) {
93  m_reader.readNext();
94  if (m_reader.isStartElement()) {
95  if (m_reader.name() == QStringLiteral("commands"))
96  parseCommands();
97  else if (m_reader.name() == QStringLiteral("feature"))
98  parseFeature();
99  }
100  }
101 
102  return true;
103 }
104 
105 void VkSpecParser::skip()
106 {
107  QString tag = m_reader.name().toString();
108  while (!m_reader.atEnd()) {
109  m_reader.readNext();
110  if (m_reader.isEndElement() && m_reader.name() == tag)
111  break;
112  }
113 }
114 
115 void VkSpecParser::parseFeature()
116 {
117  // <feature api="vulkan" name="VK_VERSION_1_0" number="1.0" comment="Vulkan core API interface definitions">
118  // <require comment="Device initialization">
119 
120  QString api;
121  QString versionName;
122  for (const QXmlStreamAttribute &attr : m_reader.attributes()) {
123  if (attr.name() == QStringLiteral("api"))
124  api = attr.value().toString().trimmed();
125  else if (attr.name() == QStringLiteral("name"))
126  versionName = attr.value().toString().trimmed();
127  }
128  const bool isVulkan = api == QStringLiteral("vulkan");
129 
130  while (!m_reader.atEnd()) {
131  m_reader.readNext();
132  if (m_reader.isEndElement() && m_reader.name() == QStringLiteral("feature"))
133  return;
134  if (m_reader.isStartElement() && m_reader.name() == QStringLiteral("require")) {
135  if (isVulkan)
136  parseFeatureRequire(versionName);
137  }
138  }
139 }
140 
141 void VkSpecParser::parseFeatureRequire(const QString &versionDefine)
142 {
143  // <require comment="Device initialization">
144  // <command name="vkCreateInstance"/>
145 
146  while (!m_reader.atEnd()) {
147  m_reader.readNext();
148  if (m_reader.isEndElement() && m_reader.name() == QStringLiteral("require"))
149  return;
150  if (m_reader.isStartElement() && m_reader.name() == QStringLiteral("command")) {
151  for (const QXmlStreamAttribute &attr : m_reader.attributes()) {
152  if (attr.name() == QStringLiteral("name"))
153  m_versionCommandMapping[versionDefine].append(attr.value().toString().trimmed());
154  }
155  }
156  }
157 }
158 
159 void VkSpecParser::parseCommands()
160 {
161  // <commands comment="Vulkan command definitions">
162  // <command successcodes="VK_SUCCESS" ...>
163 
164  while (!m_reader.atEnd()) {
165  m_reader.readNext();
166  if (m_reader.isEndElement() && m_reader.name() == QStringLiteral("commands"))
167  return;
168  if (m_reader.isStartElement() && m_reader.name() == QStringLiteral("command")) {
169  const Command c = parseCommand();
170  if (!c.cmd.name.isEmpty()) // skip aliases
171  m_commands.append(c);
172  }
173  }
174 }
175 
176 VkSpecParser::Command VkSpecParser::parseCommand()
177 {
178  Command c;
179 
180  // <command successcodes="VK_SUCCESS" ...>
181  // <proto><type>VkResult</type> <name>vkCreateInstance</name></proto>
182  // <param>const <type>VkInstanceCreateInfo</type>* <name>pCreateInfo</name></param>
183  // <param optional="true">const <type>VkAllocationCallbacks</type>* <name>pAllocator</name></param>
184  // <param><type>VkInstance</type>* <name>pInstance</name></param>
185 
186  while (!m_reader.atEnd()) {
187  m_reader.readNext();
188  if (m_reader.isEndElement() && m_reader.name() == QStringLiteral("command"))
189  break;
190  if (m_reader.isStartElement()) {
191  const QString protoStr = QStringLiteral("proto");
192  const QString paramStr = QStringLiteral("param");
193  if (m_reader.name() == protoStr) {
194  c.cmd = parseParamOrProto(protoStr);
195  } else if (m_reader.name() == paramStr) {
196  c.args.append(parseParamOrProto(paramStr));
197  } else {
198  skip();
199  }
200  }
201  }
202 
203  c.deviceLevel = false;
204  if (!c.args.isEmpty()) {
205  QStringList dispatchableDeviceAndChildTypes {
206  QStringLiteral("VkDevice"),
207  QStringLiteral("VkQueue"),
208  QStringLiteral("VkCommandBuffer")
209  };
210  if (dispatchableDeviceAndChildTypes.contains(c.args[0].type)
211  && c.cmd.name != QStringLiteral("vkGetDeviceProcAddr"))
212  {
213  c.deviceLevel = true;
214  }
215  }
216 
217  return c;
218 }
219 
220 VkSpecParser::TypedName VkSpecParser::parseParamOrProto(const QString &tag)
221 {
222  TypedName t;
223 
224  while (!m_reader.atEnd()) {
225  m_reader.readNext();
226  if (m_reader.isEndElement() && m_reader.name() == tag)
227  break;
228  if (m_reader.isStartElement()) {
229  if (m_reader.name() == QStringLiteral("name")) {
230  t.name = parseName();
231  } else if (m_reader.name() != QStringLiteral("type")) {
232  skip();
233  }
234  } else {
235  auto text = m_reader.text().trimmed();
236  if (!text.isEmpty()) {
237  if (text.startsWith(QLatin1Char('['))) {
238  t.typeSuffix += text;
239  } else {
240  if (!t.type.isEmpty())
241  t.type += QLatin1Char(' ');
242  t.type += text;
243  }
244  }
245  }
246  }
247 
248  return t;
249 }
250 
251 QString VkSpecParser::parseName()
252 {
253  QString name;
254  while (!m_reader.atEnd()) {
255  m_reader.readNext();
256  if (m_reader.isEndElement() && m_reader.name() == QStringLiteral("name"))
257  break;
258  name += m_reader.text();
259  }
260  return name.trimmed();
261 }
262 
263 QString funcSig(const VkSpecParser::Command &c, const char *className = nullptr)
264 {
265  QString s(QString::asprintf("%s %s%s%s", qPrintable(c.cmd.type),
266  (className ? className : ""), (className ? "::" : ""),
267  qPrintable(c.cmd.name)));
268  if (!c.args.isEmpty()) {
269  s += QLatin1Char('(');
270  bool first = true;
271  for (const VkSpecParser::TypedName &a : c.args) {
272  if (!first)
273  s += QStringLiteral(", ");
274  else
275  first = false;
276  s += QString::asprintf("%s%s%s%s", qPrintable(a.type),
277  (a.type.endsWith(QLatin1Char('*')) ? "" : " "),
278  qPrintable(a.name), qPrintable(a.typeSuffix));
279  }
280  s += QLatin1Char(')');
281  }
282  return s;
283 }
284 
286 {
287  // template:
288  // [return] reinterpret_cast<PFN_vkEnumeratePhysicalDevices>(d_ptr->m_funcs[0])(instance, pPhysicalDeviceCount, pPhysicalDevices);
289  QString s = QString::asprintf("%sreinterpret_cast<PFN_%s>(d_ptr->m_funcs[%d])",
290  (c.cmd.type == QStringLiteral("void") ? "" : "return "),
291  qPrintable(c.cmd.name),
292  idx);
293  if (!c.args.isEmpty()) {
294  s += QLatin1Char('(');
295  bool first = true;
296  for (const VkSpecParser::TypedName &a : c.args) {
297  if (!first)
298  s += QStringLiteral(", ");
299  else
300  first = false;
301  s += a.name;
302  }
303  s += QLatin1Char(')');
304  }
305  return s;
306 }
307 
308 class Preamble
309 {
310 public:
311  QByteArray get(const QString &fn);
312 
313 private:
314  QByteArray m_str;
316 
318 {
319  if (!m_str.isEmpty())
320  return m_str;
321 
322  QFile f(fn);
323  if (!f.open(QIODevice::ReadOnly | QIODevice::Text)) {
324  qWarning("Failed to open %s", qPrintable(fn));
325  return m_str;
326  }
327 
328  m_str = f.readAll();
329  m_str.replace("FOO", "QtGui");
330  m_str += "\n// This file is automatically generated by qvkgen. Do not edit.\n";
331 
332  return m_str;
333 }
334 
336  const QMap<QString, QStringList> &versionCommandMapping,
337  const QString &licHeaderFn,
338  const QString &outputBase)
339 {
340  QFile f(outputBase + QStringLiteral(".h"));
341  if (!f.open(QIODevice::WriteOnly | QIODevice::Text)) {
342  qWarning("Failed to write %s", qPrintable(f.fileName()));
343  return false;
344  }
345 
346  static const char *s =
347 "%s\n"
348 "#ifndef QVULKANFUNCTIONS_H\n"
349 "#define QVULKANFUNCTIONS_H\n"
350 "\n"
351 "#include <QtGui/qtguiglobal.h>\n"
352 "\n"
353 "#if QT_CONFIG(vulkan) || defined(Q_CLANG_QDOC)\n"
354 "\n"
355 "#ifndef VK_NO_PROTOTYPES\n"
356 "#define VK_NO_PROTOTYPES\n"
357 "#endif\n"
358 "#include <vulkan/vulkan.h>\n"
359 "\n"
360 "#include <QtCore/qscopedpointer.h>\n"
361 "\n"
362 "QT_BEGIN_NAMESPACE\n"
363 "\n"
364 "class QVulkanInstance;\n"
365 "class QVulkanFunctionsPrivate;\n"
366 "class QVulkanDeviceFunctionsPrivate;\n"
367 "\n"
368 "class Q_GUI_EXPORT QVulkanFunctions\n"
369 "{\n"
370 "public:\n"
371 " ~QVulkanFunctions();\n"
372 "\n"
373 "%s\n"
374 "private:\n"
375 " Q_DISABLE_COPY(QVulkanFunctions)\n"
376 " QVulkanFunctions(QVulkanInstance *inst);\n"
377 "\n"
378 " QScopedPointer<QVulkanFunctionsPrivate> d_ptr;\n"
379 " friend class QVulkanInstance;\n"
380 "};\n"
381 "\n"
382 "class Q_GUI_EXPORT QVulkanDeviceFunctions\n"
383 "{\n"
384 "public:\n"
385 " ~QVulkanDeviceFunctions();\n"
386 "\n"
387 "%s\n"
388 "private:\n"
389 " Q_DISABLE_COPY(QVulkanDeviceFunctions)\n"
390 " QVulkanDeviceFunctions(QVulkanInstance *inst, VkDevice device);\n"
391 "\n"
392 " QScopedPointer<QVulkanDeviceFunctionsPrivate> d_ptr;\n"
393 " friend class QVulkanInstance;\n"
394 "};\n"
395 "\n"
396 "QT_END_NAMESPACE\n"
397 "\n"
398 "#endif // QT_CONFIG(vulkan) || defined(Q_CLANG_QDOC)\n"
399 "\n"
400 "#endif // QVULKANFUNCTIONS_H\n";
401 
402  QString instCmdStr;
403  QString devCmdStr;
404  for (const QString &version : VERSIONS) {
405  const QStringList &coreFunctionsInVersion = versionCommandMapping[version];
406  instCmdStr += "#if " + version + "\n";
407  devCmdStr += "#if " + version + "\n";
408  for (const VkSpecParser::Command &c : commands) {
409  if (!coreFunctionsInVersion.contains(c.cmd.name))
410  continue;
411 
412  QString *dst = c.deviceLevel ? &devCmdStr : &instCmdStr;
413  *dst += QStringLiteral(" ");
414  *dst += funcSig(c);
415  *dst += QStringLiteral(";\n");
416  }
417  instCmdStr += "#endif\n";
418  devCmdStr += "#endif\n";
419  }
420 
421  f.write(QString::asprintf(s, preamble.get(licHeaderFn).constData(),
422  instCmdStr.toUtf8().constData(),
423  devCmdStr.toUtf8().constData()).toUtf8());
424 
425  return true;
426 }
427 
429  const QMap<QString, QStringList> &versionCommandMapping,
430  const QString &licHeaderFn,
431  const QString &outputBase)
432 {
433  QFile f(outputBase + QStringLiteral("_p.h"));
434  if (!f.open(QIODevice::WriteOnly | QIODevice::Text)) {
435  qWarning("Failed to write %s", qPrintable(f.fileName()));
436  return false;
437  }
438 
439  static const char *s =
440 "%s\n"
441 "#ifndef QVULKANFUNCTIONS_P_H\n"
442 "#define QVULKANFUNCTIONS_P_H\n"
443 "\n"
444 "//\n"
445 "// W A R N I N G\n"
446 "// -------------\n"
447 "//\n"
448 "// This file is not part of the Qt API. It exists purely as an\n"
449 "// implementation detail. This header file may change from version to\n"
450 "// version without notice, or even be removed.\n"
451 "//\n"
452 "// We mean it.\n"
453 "//\n"
454 "\n"
455 "#include \"qvulkanfunctions.h\"\n"
456 "\n"
457 "QT_BEGIN_NAMESPACE\n"
458 "\n"
459 "class QVulkanInstance;\n"
460 "\n"
461 "class QVulkanFunctionsPrivate\n"
462 "{\n"
463 "public:\n"
464 " QVulkanFunctionsPrivate(QVulkanInstance *inst);\n"
465 "\n"
466 " PFN_vkVoidFunction m_funcs[%d];\n"
467 "};\n"
468 "\n"
469 "class QVulkanDeviceFunctionsPrivate\n"
470 "{\n"
471 "public:\n"
472 " QVulkanDeviceFunctionsPrivate(QVulkanInstance *inst, VkDevice device);\n"
473 "\n"
474 " PFN_vkVoidFunction m_funcs[%d];\n"
475 "};\n"
476 "\n"
477 "QT_END_NAMESPACE\n"
478 "\n"
479 "#endif // QVULKANFUNCTIONS_P_H\n";
480 
481  int devLevelCount = 0;
482  int instLevelCount = 0;
483  for (const QString &version : VERSIONS) {
484  const QStringList &coreFunctionsInVersion = versionCommandMapping[version];
485  for (const VkSpecParser::Command &c : commands) {
486  if (!coreFunctionsInVersion.contains(c.cmd.name))
487  continue;
488 
489  if (c.deviceLevel)
490  devLevelCount += 1;
491  else
492  instLevelCount += 1;
493  }
494  }
495 
496  f.write(QString::asprintf(s, preamble.get(licHeaderFn).constData(), instLevelCount, devLevelCount).toUtf8());
497 
498  return true;
499 }
500 
502  const QMap<QString, QStringList> &versionCommandMapping,
503  const QString &licHeaderFn,
504  const QString &outputBase)
505 {
506  QFile f(outputBase + QStringLiteral("_p.cpp"));
507  if (!f.open(QIODevice::WriteOnly | QIODevice::Text)) {
508  qWarning("Failed to write %s", qPrintable(f.fileName()));
509  return false;
510  }
511 
512  static const char s[] =
513 "%s\n"
514 "#include \"qvulkanfunctions_p.h\"\n"
515 "#include \"qvulkaninstance.h\"\n"
516 "\n"
517 "#include <QtCore/private/qoffsetstringarray_p.h>\n"
518 "\n"
519 "QT_BEGIN_NAMESPACE\n"
520 "\n%s"
521 "QVulkanFunctionsPrivate::QVulkanFunctionsPrivate(QVulkanInstance *inst)\n"
522 "{\n"
523 " static constexpr auto funcNames = qOffsetStringArray(\n"
524 "%s\n"
525 " );\n"
526 " static_assert(std::extent_v<decltype(m_funcs)> == size_t(funcNames.count()));\n"
527 " for (int i = 0; i < funcNames.count(); ++i) {\n"
528 " m_funcs[i] = inst->getInstanceProcAddr(funcNames.at(i));\n"
529 " if (i < %d && !m_funcs[i])\n"
530 " qWarning(\"QVulkanFunctions: Failed to resolve %%s\", funcNames.at(i));\n"
531 " }\n"
532 "}\n"
533 "\n%s"
534 "QVulkanDeviceFunctionsPrivate::QVulkanDeviceFunctionsPrivate(QVulkanInstance *inst, VkDevice device)\n"
535 "{\n"
536 " QVulkanFunctions *f = inst->functions();\n"
537 " Q_ASSERT(f);\n\n"
538 " static constexpr auto funcNames = qOffsetStringArray(\n"
539 "%s\n"
540 " );\n"
541 " static_assert(std::extent_v<decltype(m_funcs)> == size_t(funcNames.count()));\n"
542 " for (int i = 0; i < funcNames.count(); ++i) {\n"
543 " m_funcs[i] = f->vkGetDeviceProcAddr(device, funcNames.at(i));\n"
544 " if (i < %d && !m_funcs[i])\n"
545 " qWarning(\"QVulkanDeviceFunctions: Failed to resolve %%s\", funcNames.at(i));\n"
546 " }\n"
547 "}\n"
548 "\n"
549 "QT_END_NAMESPACE\n";
550 
551  QString devCmdWrapperStr;
552  QString instCmdWrapperStr;
553  int devIdx = 0;
554  int instIdx = 0;
555  QString devCmdNamesStr;
556  QString instCmdNamesStr;
557  int vulkan10DevCount = 0;
558  int vulkan10InstCount = 0;
559 
560  for (const QString &version : VERSIONS) {
561  const QStringList &coreFunctionsInVersion = versionCommandMapping[version];
562  instCmdWrapperStr += "\n#if " + version + "\n";
563  devCmdWrapperStr += "\n#if " + version + "\n";
564  for (const VkSpecParser::Command &c : commands) {
565  if (!coreFunctionsInVersion.contains(c.cmd.name))
566  continue;
567 
568  QString *dst = c.deviceLevel ? &devCmdWrapperStr : &instCmdWrapperStr;
569  int *idx = c.deviceLevel ? &devIdx : &instIdx;
570  *dst += funcSig(c, c.deviceLevel ? "QVulkanDeviceFunctions" : "QVulkanFunctions");
571  *dst += QString(QStringLiteral("\n{\n Q_ASSERT(d_ptr->m_funcs[%1]);\n ")).arg(*idx);
572  *dst += funcCall(c, *idx);
573  *dst += QStringLiteral(";\n}\n\n");
574  *idx += 1;
575 
576  dst = c.deviceLevel ? &devCmdNamesStr : &instCmdNamesStr;
577  *dst += QStringLiteral(" \"");
578  *dst += c.cmd.name;
579  *dst += QStringLiteral("\",\n");
580  }
581  if (version == QStringLiteral("VK_VERSION_1_0")) {
582  vulkan10InstCount = instIdx;
583  vulkan10DevCount = devIdx;
584  }
585  instCmdWrapperStr += "#endif\n\n";
586  devCmdWrapperStr += "#endif\n\n";
587  }
588 
589  if (devCmdNamesStr.count() > 2)
590  devCmdNamesStr = devCmdNamesStr.left(devCmdNamesStr.count() - 2);
591  if (instCmdNamesStr.count() > 2)
592  instCmdNamesStr = instCmdNamesStr.left(instCmdNamesStr.count() - 2);
593 
594  const QString str =
595  QString::asprintf(s, preamble.get(licHeaderFn).constData(),
596  instCmdWrapperStr.toUtf8().constData(),
597  instCmdNamesStr.toUtf8().constData(), vulkan10InstCount,
598  devCmdWrapperStr.toUtf8().constData(),
599  devCmdNamesStr.toUtf8().constData(), vulkan10DevCount);
600 
601  f.write(str.toUtf8());
602 
603  return true;
604 }
605 
606 int main(int argc, char **argv)
607 {
608  QCoreApplication app(argc, argv);
610 
611  if (argc < 4) {
612  qWarning("Usage: qvkgen input_vk_xml input_license_header output_base\n"
613  " For example: qvkgen vulkan/vk.xml vulkan/qvulkanfunctions.header vulkan/qvulkanfunctions");
614  return 1;
615  }
616 
617  parser.setFileName(QString::fromUtf8(argv[1]));
618 
619  if (!parser.parse())
620  return 1;
621 
622  // Now we have a list of functions (commands), including extensions, and a
623  // table of Version (1.0, 1.1, 1.2) -> Core functions in that version.
625  QMap<QString, QStringList> versionCommandMapping = parser.versionCommandMapping();
626 
627  QStringList ignoredFuncs {
628  QStringLiteral("vkCreateInstance"),
629  QStringLiteral("vkDestroyInstance"),
630  QStringLiteral("vkGetInstanceProcAddr"),
631  QStringLiteral("vkEnumerateInstanceVersion")
632  };
633  for (int i = 0; i < commands.count(); ++i) {
634  if (ignoredFuncs.contains(commands[i].cmd.name))
635  commands.remove(i--);
636  }
637 
638  QString licenseHeaderFileName = QString::fromUtf8(argv[2]);
639  QString outputBase = QString::fromUtf8(argv[3]);
640  genVulkanFunctionsH(commands, versionCommandMapping, licenseHeaderFileName, outputBase);
641  genVulkanFunctionsPH(commands, versionCommandMapping, licenseHeaderFileName, outputBase);
642  genVulkanFunctionsPC(commands, versionCommandMapping, licenseHeaderFileName, outputBase);
643 
644  return 0;
645 }
small capitals from c petite p scientific i
[1]
Definition: afcover.h:80
FT_UInt idx
Definition: cffcmap.c:135
QByteArray get(const QString &fn)
Definition: qvkgen.cpp:317
The QByteArray class provides an array of bytes.
Definition: qbytearray.h:85
const char * constData() const noexcept
Definition: qbytearray.h:144
bool isEmpty() const noexcept
Definition: qbytearray.h:129
QByteArray & replace(qsizetype index, qsizetype len, const char *s, qsizetype alen)
Definition: qbytearray.h:278
The QCoreApplication class provides an event loop for Qt applications without UI.
The QFile class provides an interface for reading from and writing to files.
Definition: qfile.h:94
bool open(OpenMode flags) override
Definition: qfile.cpp:897
void setFileName(const QString &name)
Definition: qfile.cpp:327
QString fileName() const override
Definition: qfile.cpp:302
Definition: qlist.h:108
void clear()
Definition: qmap.h:324
The QString class provides a Unicode character string.
Definition: qstring.h:388
qsizetype count() const
Definition: qstring.h:414
static QString fromUtf8(QByteArrayView utf8)
Definition: qstring.cpp:5632
QString left(qsizetype n) const
Definition: qstring.cpp:4951
QByteArray toUtf8() const &
Definition: qstring.h:749
static QString static QString asprintf(const char *format,...) Q_ATTRIBUTE_FORMAT_PRINTF(1
Definition: qstring.cpp:6759
The QStringList class provides a list of strings.
QString toString() const
Definition: qstring.h:1165
QStringView trimmed() const noexcept
Definition: qstringview.h:296
The QXmlStreamAttribute class represents a single XML attribute.
Definition: qxmlstream.h:79
The QXmlStreamReader class provides a fast parser for reading well-formed XML via a simple streaming ...
Definition: qxmlstream.h:216
QXmlStreamAttributes attributes() const
QStringView text() const
TokenType readNext()
Definition: qxmlstream.cpp:602
QStringView name() const
bool isStartElement() const
Definition: qxmlstream.h:263
bool atEnd() const
Definition: qxmlstream.cpp:569
bool isEndElement() const
Definition: qxmlstream.h:264
void setDevice(QIODevice *device)
Definition: qxmlstream.cpp:470
QList< Command > commands() const
Definition: qvkgen.cpp:59
void setFileName(const QString &fn)
Definition: qvkgen.cpp:62
QMap< QString, QStringList > versionCommandMapping() const
Definition: qvkgen.cpp:60
bool parse()
Definition: qvkgen.cpp:80
QString str
[2]
int const char * version
Definition: zlib.h:814
parser
Definition: devices.py:74
#define QString()
Definition: parse-defines.h:51
@ text
#define qWarning
Definition: qlogging.h:179
GLsizei const GLubyte * commands
[10]
GLboolean GLboolean GLboolean GLboolean a
[7]
GLfloat GLfloat f
GLenum GLenum dst
GLuint name
GLint first
const GLubyte * c
Definition: qopenglext.h:12701
GLdouble GLdouble t
[9]
Definition: qopenglext.h:243
GLdouble s
[6]
Definition: qopenglext.h:235
#define QStringLiteral(str)
int main(int argc, char **argv)
[1]
Definition: qvkgen.cpp:606
QString funcCall(const VkSpecParser::Command &c, int idx)
Definition: qvkgen.cpp:285
bool genVulkanFunctionsH(const QList< VkSpecParser::Command > &commands, const QMap< QString, QStringList > &versionCommandMapping, const QString &licHeaderFn, const QString &outputBase)
Definition: qvkgen.cpp:335
class Preamble preamble
bool genVulkanFunctionsPH(const QList< VkSpecParser::Command > &commands, const QMap< QString, QStringList > &versionCommandMapping, const QString &licHeaderFn, const QString &outputBase)
Definition: qvkgen.cpp:428
bool genVulkanFunctionsPC(const QList< VkSpecParser::Command > &commands, const QMap< QString, QStringList > &versionCommandMapping, const QString &licHeaderFn, const QString &outputBase)
Definition: qvkgen.cpp:501
QString funcSig(const VkSpecParser::Command &c, const char *className=nullptr)
Definition: qvkgen.cpp:263
const char className[16]
[1]
Definition: qwizard.cpp:135
QApplication app(argc, argv)
[0]
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:53
QList< TypedName > args
Definition: qvkgen.cpp:55
int fn(int &i)
XmlOutput::xml_output tag(const QString &name)
Definition: xmloutput.h:154
XmlOutput::xml_output attr(const QString &name, const QString &value)
Definition: xmloutput.h:202