.pfnFree = default_free_func,
};
+VkResult anv_EnumerateInstanceExtensionProperties(
+ const char* pLayerName,
+ uint32_t* pPropertyCount,
+ VkExtensionProperties* pProperties)
+{
+ VK_OUTARRAY_MAKE(out, pProperties, pPropertyCount);
+
+ for (int i = 0; i < ANV_INSTANCE_EXTENSION_COUNT; i++) {
+ if (anv_instance_extensions_supported.extensions[i]) {
+ vk_outarray_append(&out, prop) {
+ *prop = anv_instance_extensions[i];
+ }
+ }
+ }
+
+ return vk_outarray_status(&out);
+}
+
VkResult anv_CreateInstance(
const VkInstanceCreateInfo* pCreateInfo,
const VkAllocationCallbacks* pAllocator,
}
for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
- const char *ext_name = pCreateInfo->ppEnabledExtensionNames[i];
- if (!anv_instance_extension_supported(ext_name))
+ int idx;
+ for (idx = 0; idx < ANV_INSTANCE_EXTENSION_COUNT; idx++) {
+ if (strcmp(pCreateInfo->ppEnabledExtensionNames[i],
+ anv_instance_extensions[idx].extensionName) == 0)
+ break;
+ }
+
+ if (idx >= ANV_INSTANCE_EXTENSION_COUNT)
+ return vk_error(VK_ERROR_EXTENSION_NOT_PRESENT);
+
+ if (!anv_instance_extensions_supported.extensions[idx])
return vk_error(VK_ERROR_EXTENSION_NOT_PRESENT);
}
};
};
+extern const struct anv_instance_extension_table anv_instance_extensions_supported;
+
#define ANV_DEVICE_EXTENSION_COUNT ${len(device_extensions)}
%endfor
};
-bool
-anv_instance_extension_supported(const char *name)
-{
-%for ext in instance_extensions:
- if (strcmp(name, "${ext.name}") == 0)
- return ${ext.enable};
-%endfor
- return false;
-}
-
-VkResult anv_EnumerateInstanceExtensionProperties(
- const char* pLayerName,
- uint32_t* pPropertyCount,
- VkExtensionProperties* pProperties)
-{
- VK_OUTARRAY_MAKE(out, pProperties, pPropertyCount);
-
+const struct anv_instance_extension_table anv_instance_extensions_supported = {
%for ext in instance_extensions:
- if (${ext.enable}) {
- vk_outarray_append(&out, prop) {
- *prop = (VkExtensionProperties) {
- .extensionName = "${ext.name}",
- .specVersion = ${ext.ext_version},
- };
- }
- }
+ .${ext.name[3:]} = ${ext.enable},
%endfor
-
- return vk_outarray_status(&out);
-}
+};
uint32_t
anv_physical_device_api_version(struct anv_physical_device *dev)
VkResult anv_init_wsi(struct anv_physical_device *physical_device);
void anv_finish_wsi(struct anv_physical_device *physical_device);
-bool anv_instance_extension_supported(const char *name);
uint32_t anv_physical_device_api_version(struct anv_physical_device *dev);
bool anv_physical_device_extension_supported(struct anv_physical_device *dev,
const char *name);