anv: Use the common extension table struct

Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com>
Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8676>
This commit is contained in:
Jason Ekstrand
2021-01-23 14:45:32 -06:00
committed by Marge Bot
parent e4cc52c054
commit 82f5acd952
4 changed files with 27 additions and 24 deletions

View File

@@ -668,10 +668,10 @@ VkResult anv_EnumerateInstanceExtensionProperties(
{
VK_OUTARRAY_MAKE(out, pProperties, pPropertyCount);
for (int i = 0; i < ANV_INSTANCE_EXTENSION_COUNT; i++) {
for (int i = 0; i < VK_INSTANCE_EXTENSION_COUNT; i++) {
if (anv_instance_extensions_supported.extensions[i]) {
vk_outarray_append(&out, prop) {
*prop = anv_instance_extensions[i];
*prop = vk_instance_extensions[i];
}
}
}
@@ -702,16 +702,16 @@ VkResult anv_CreateInstance(
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO);
struct anv_instance_extension_table enabled_extensions = {};
struct vk_instance_extension_table enabled_extensions = {};
for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
int idx;
for (idx = 0; idx < ANV_INSTANCE_EXTENSION_COUNT; idx++) {
for (idx = 0; idx < VK_INSTANCE_EXTENSION_COUNT; idx++) {
if (strcmp(pCreateInfo->ppEnabledExtensionNames[i],
anv_instance_extensions[idx].extensionName) == 0)
vk_instance_extensions[idx].extensionName) == 0)
break;
}
if (idx >= ANV_INSTANCE_EXTENSION_COUNT)
if (idx >= VK_INSTANCE_EXTENSION_COUNT)
return vk_error(VK_ERROR_EXTENSION_NOT_PRESENT);
if (!anv_instance_extensions_supported.extensions[idx])
@@ -2609,10 +2609,10 @@ VkResult anv_EnumerateDeviceExtensionProperties(
ANV_FROM_HANDLE(anv_physical_device, device, physicalDevice);
VK_OUTARRAY_MAKE(out, pProperties, pPropertyCount);
for (int i = 0; i < ANV_DEVICE_EXTENSION_COUNT; i++) {
for (int i = 0; i < VK_DEVICE_EXTENSION_COUNT; i++) {
if (device->supported_extensions.extensions[i]) {
vk_outarray_append(&out, prop) {
*prop = anv_device_extensions[i];
*prop = vk_device_extensions[i];
}
}
}
@@ -2786,16 +2786,16 @@ VkResult anv_CreateDevice(
assert(pCreateInfo->sType == VK_STRUCTURE_TYPE_DEVICE_CREATE_INFO);
struct anv_device_extension_table enabled_extensions = { };
struct vk_device_extension_table enabled_extensions = { };
for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; i++) {
int idx;
for (idx = 0; idx < ANV_DEVICE_EXTENSION_COUNT; idx++) {
for (idx = 0; idx < VK_DEVICE_EXTENSION_COUNT; idx++) {
if (strcmp(pCreateInfo->ppEnabledExtensionNames[i],
anv_device_extensions[idx].extensionName) == 0)
vk_device_extensions[idx].extensionName) == 0)
break;
}
if (idx >= ANV_DEVICE_EXTENSION_COUNT)
if (idx >= VK_DEVICE_EXTENSION_COUNT)
return vk_error(VK_ERROR_EXTENSION_NOT_PRESENT);
if (!physical_device->supported_extensions.extensions[idx])

View File

@@ -382,7 +382,7 @@ const struct anv_physical_device_dispatch_table anv_physical_device_dispatch_tab
*/
bool
anv_instance_entrypoint_is_enabled(int index, uint32_t core_version,
const struct anv_instance_extension_table *instance)
const struct vk_instance_extension_table *instance)
{
switch (index) {
% for e in instance_entrypoints:
@@ -416,7 +416,7 @@ anv_instance_entrypoint_is_enabled(int index, uint32_t core_version,
*/
bool
anv_physical_device_entrypoint_is_enabled(int index, uint32_t core_version,
const struct anv_instance_extension_table *instance)
const struct vk_instance_extension_table *instance)
{
switch (index) {
% for e in physical_device_entrypoints:
@@ -450,8 +450,8 @@ anv_physical_device_entrypoint_is_enabled(int index, uint32_t core_version,
*/
bool
anv_device_entrypoint_is_enabled(int index, uint32_t core_version,
const struct anv_instance_extension_table *instance,
const struct anv_device_extension_table *device)
const struct vk_instance_extension_table *instance,
const struct vk_device_extension_table *device)
{
switch (index) {
% for e in device_entrypoints:

View File

@@ -49,4 +49,6 @@ if __name__ == '__main__':
"perf/gen_perf.h"
]
gen_extensions('anv', args.xml_files, API_VERSIONS, MAX_API_VERSION, EXTENSIONS, args.out_c, args.out_h, includes)
gen_extensions('anv', args.xml_files, API_VERSIONS, MAX_API_VERSION,
EXTENSIONS, args.out_c, args.out_h, includes,
type_prefix='vk')

View File

@@ -1135,7 +1135,7 @@ struct anv_physical_device {
bool always_flush_cache;
struct anv_device_extension_table supported_extensions;
struct vk_device_extension_table supported_extensions;
uint32_t eu_total;
uint32_t subslice_total;
@@ -1180,7 +1180,7 @@ struct anv_instance {
struct anv_app_info app_info;
struct anv_instance_extension_table enabled_extensions;
struct vk_instance_extension_table enabled_extensions;
struct anv_instance_dispatch_table dispatch;
struct anv_physical_device_dispatch_table physical_device_dispatch;
struct anv_device_dispatch_table device_dispatch;
@@ -1199,6 +1199,7 @@ struct anv_instance {
VkResult anv_init_wsi(struct anv_physical_device *physical_device);
void anv_finish_wsi(struct anv_physical_device *physical_device);
extern const struct vk_instance_extension_table anv_instance_extensions_supported;
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);
@@ -1380,7 +1381,7 @@ struct anv_device {
bool can_chain_batches;
bool robust_buffer_access;
bool has_thread_submit;
struct anv_device_extension_table enabled_extensions;
struct vk_device_extension_table enabled_extensions;
struct anv_device_dispatch_table dispatch;
pthread_mutex_t vma_mutex;
@@ -4505,14 +4506,14 @@ const char *anv_get_device_entry_name(int index);
bool
anv_instance_entrypoint_is_enabled(int index, uint32_t core_version,
const struct anv_instance_extension_table *instance);
const struct vk_instance_extension_table *instance);
bool
anv_physical_device_entrypoint_is_enabled(int index, uint32_t core_version,
const struct anv_instance_extension_table *instance);
const struct vk_instance_extension_table *instance);
bool
anv_device_entrypoint_is_enabled(int index, uint32_t core_version,
const struct anv_instance_extension_table *instance,
const struct anv_device_extension_table *device);
const struct vk_instance_extension_table *instance,
const struct vk_device_extension_table *device);
void *anv_resolve_device_entrypoint(const struct gen_device_info *devinfo,
uint32_t index);