diff options
author | Jason Ekstrand <[email protected]> | 2018-01-16 15:49:28 -0800 |
---|---|---|
committer | Jason Ekstrand <[email protected]> | 2018-01-23 00:15:40 -0800 |
commit | ff5f3e2b21e693c7418de67a34ca247cd07cc4ab (patch) | |
tree | fe065612f2bfb6274bdfd3b3358bfe159c02dc9c /src/intel/vulkan/anv_device.c | |
parent | dd088d4bec74f37ffe4cd02626a6a8af93fdebac (diff) |
anv: Use tables for instance extension wrangling
This lets us move a bunch of stuff out of codegen and back into
anv_device.c which is a bit nicer.
Reviewed-by: Samuel Iglesias Gonsálvez <[email protected]>
Diffstat (limited to 'src/intel/vulkan/anv_device.c')
-rw-r--r-- | src/intel/vulkan/anv_device.c | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/src/intel/vulkan/anv_device.c b/src/intel/vulkan/anv_device.c index 777abd87578..7835b8780b9 100644 --- a/src/intel/vulkan/anv_device.c +++ b/src/intel/vulkan/anv_device.c @@ -476,6 +476,24 @@ static const VkAllocationCallbacks default_alloc = { .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, @@ -522,8 +540,17 @@ VkResult anv_CreateInstance( } 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); } |