Module: Mesa
Branch: main
Commit: d9ba75e2e1193de45f110509e748038633853a8c
URL:    
http://cgit.freedesktop.org/mesa/mesa/commit/?id=d9ba75e2e1193de45f110509e748038633853a8c

Author: Chia-I Wu <[email protected]>
Date:   Sun Dec 24 13:41:22 2023 -0800

Revert "vk/util: ignore unsupported feature structs"

This reverts commit eb5bb5c784e97c533e30b348e82e446ac0da59c8.  The
commit broke drivers which do not initialize
vk_physical_device::properties.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26813>

---

 src/vulkan/util/vk_physical_device_features_gen.py | 26 +++-------------------
 1 file changed, 3 insertions(+), 23 deletions(-)

diff --git a/src/vulkan/util/vk_physical_device_features_gen.py 
b/src/vulkan/util/vk_physical_device_features_gen.py
index 8459d71c66a..f0d15fc3c16 100644
--- a/src/vulkan/util/vk_physical_device_features_gen.py
+++ b/src/vulkan/util/vk_physical_device_features_gen.py
@@ -32,7 +32,7 @@ import xml.etree.ElementTree as et
 
 import mako
 from mako.template import Template
-from vk_extensions import Requirements, get_all_required, filter_api
+from vk_extensions import get_all_required, filter_api
 
 def str_removeprefix(s, prefix):
     if s.startswith(prefix):
@@ -124,21 +124,10 @@ def get_renamed_feature(c_type, feature):
 
 @dataclass
 class FeatureStruct:
-    reqs: Requirements
     c_type: str
     s_type: str
     features: typing.List[str]
 
-    def condition(self, physical_dev):
-        conds = []
-        if self.reqs.core_version:
-            conds.append(physical_dev + '->properties.apiVersion >= ' +
-                         self.reqs.core_version.c_vk_version())
-        for ext in self.reqs.extensions:
-            conds.append(physical_dev + '->supported_extensions.' +
-                         ext.name[3:])
-        return '(' + ' || '.join(conds) + ')'
-
 TEMPLATE_H = Template(COPYRIGHT + """
 /* This file generated from ${filename}, don't edit directly. */
 #ifndef VK_FEATURES_H
@@ -214,10 +203,6 @@ vk_physical_device_check_device_features(struct 
vk_physical_device *physical_dev
       switch (features->sType) {
 % for f in feature_structs:
       case ${f.s_type}:
-% if f.condition("physical_device"):
-         if (!${f.condition("physical_device")})
-            break;
-% endif
          supported = (VkBaseOutStructure *) &supported_${f.c_type};
          break;
 % endfor
@@ -267,10 +252,6 @@ vk_physical_device_check_device_features(struct 
vk_physical_device *physical_dev
       }
 % for f in feature_structs:
       case ${f.s_type}: {
-% if f.condition("physical_device"):
-         if (!${f.condition("physical_device")})
-            break;
-% endif
          const ${f.c_type} *a = &supported_${f.c_type};
          const ${f.c_type} *b = (const void *) features;
 % for flag in f.features:
@@ -384,9 +365,8 @@ def get_feature_structs(doc, api, beta):
         if _type.attrib['name'] not in required:
             continue
 
-        reqs = required[_type.attrib['name']]
         # Skip extensions with a define for now
-        guard = reqs.guard
+        guard = required[_type.attrib['name']].guard
         if guard is not None and (guard != "VK_ENABLE_BETA_EXTENSIONS" or not 
beta):
             continue
 
@@ -411,7 +391,7 @@ def get_feature_structs(doc, api, beta):
                 assert p.find('./type').text == 'VkBool32'
                 flags.append(m_name)
 
-        feature_struct = FeatureStruct(reqs=reqs, 
c_type=_type.attrib.get('name'), s_type=s_type, features=flags)
+        feature_struct = FeatureStruct(c_type=_type.attrib.get('name'), 
s_type=s_type, features=flags)
         feature_structs[feature_struct.c_type] = feature_struct
 
     return feature_structs.values()

Reply via email to