MCPcopy
hub / github.com/KhronosGroup/Vulkan-Docs / endFile

Method endFile

scripts/formatsgenerator.py:58–189  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

56 return (None, True)
57
58 def endFile(self):
59
60 # Generate compatibility table
61 compatibility_table = []
62 for class_name, info in self.format_classes.items():
63 # Do an initial loop of formats in class to see if whole class is a single condition
64 class_condition = None
65 for index, format in enumerate(info['formats']):
66 condition = self.format_conditions[format]
67 if (condition == None) or (class_condition != None and class_condition != condition):
68 class_condition = None
69 break
70 else:
71 class_condition = condition
72
73 # If not single class condition for the class, next check if a single format has a condition
74 # Move all condition formats to the front of array to make listing the formats in table
75 if class_condition == None:
76 condition_list = []
77 noncondition_list = []
78 for index, format in enumerate(info['formats']):
79 if self.format_conditions[format] == None:
80 noncondition_list.append(format)
81 else:
82 condition_list.append(format)
83 info['formats'] = condition_list + noncondition_list
84
85 # Evaluate class condition if present
86 class_condition_result = True
87 if class_condition != None:
88 class_condition_result = evaluateDependency(class_condition, lambda name: name in self.registry.genFeatures.keys())
89 if not class_condition_result:
90 compatibility_table.append(f'// {class_condition} -> {class_condition_result}, not emitting class {class_name}')
91
92 if class_condition_result:
93 def tableHeader(continued):
94 """Generate table header for this class.
95 If continued is True, mark it as a continuation of the
96 previous class."""
97
98 continuedText = '(continued) ' if continued else ''
99
100 compatibility_table.append(f"| {class_name} {continuedText}+")
101 compatibility_table.append(f" Block size {info['meta']['blockSize']} byte +")
102 compatibility_table.append(f" {info['meta']['blockExtent'].replace(',', 'x')} block extent +")
103 compatibility_table.append(f" {info['meta']['texelsPerBlock']} texel/block |")
104
105 tableHeader(continued = False)
106
107 # This is an ad-hoc restriction due to a limitation of
108 # asciidoctor-pdf, which fails with an error if a table cell is
109 # too long for a single page.
110 # Should be genericized to be reused for other, similar tables.
111 max_table_rows = 44
112
113 # First pass: determine which formats will be emitted
114 emitted_formats = []
115 for format in info['formats']:

Callers

nothing calls this directly

Calls 6

writeBlockMethod · 0.95
evaluateDependencyFunction · 0.90
itemsMethod · 0.80
appendMethod · 0.80
keysMethod · 0.80

Tested by

no test coverage detected