Advertise support for VK_KHR_swapchain Bug: b/124265819 Change-Id: I19bbaeefe19ade1afeb6764d4f5576a29334d8bd Reviewed-on: https://swiftshader-review.googlesource.com/c/25490 Tested-by: Hernan Liatis <hliatis@google.com> Reviewed-by: Nicolas Capens <nicolascapens@google.com> Reviewed-by: Alexis Hétu <sugoi@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
diff --git a/src/Vulkan/VkDevice.cpp b/src/Vulkan/VkDevice.cpp index 6b64cb0..4b3ae65 100644 --- a/src/Vulkan/VkDevice.cpp +++ b/src/Vulkan/VkDevice.cpp
@@ -49,11 +49,6 @@ // "The ppEnabledLayerNames and enabledLayerCount members of VkDeviceCreateInfo are deprecated and their values must be ignored by implementations." UNIMPLEMENTED(); // TODO(b/119321052): UNIMPLEMENTED() should be used only for features that must still be implemented. Use a more informational macro here. } - - if(pCreateInfo->enabledExtensionCount) - { - UNIMPLEMENTED(); - } } void Device::destroy(const VkAllocationCallbacks* pAllocator)
diff --git a/src/Vulkan/libVulkan.cpp b/src/Vulkan/libVulkan.cpp index b0ebe63..d92aa7a 100644 --- a/src/Vulkan/libVulkan.cpp +++ b/src/Vulkan/libVulkan.cpp
@@ -97,6 +97,7 @@ { VK_KHR_SHADER_DRAW_PARAMETERS_EXTENSION_NAME, VK_KHR_SHADER_DRAW_PARAMETERS_SPEC_VERSION }, { VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_EXTENSION_NAME, VK_KHR_STORAGE_BUFFER_STORAGE_CLASS_SPEC_VERSION }, { VK_KHR_VARIABLE_POINTERS_EXTENSION_NAME, VK_KHR_VARIABLE_POINTERS_SPEC_VERSION }, + { VK_KHR_SWAPCHAIN_EXTENSION_NAME, VK_KHR_SWAPCHAIN_SPEC_VERSION }, }; VKAPI_ATTR VkResult VKAPI_CALL vkCreateInstance(const VkInstanceCreateInfo* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkInstance* pInstance) @@ -292,6 +293,29 @@ UNIMPLEMENTED(); // TODO(b/119321052): UNIMPLEMENTED() should be used only for features that must still be implemented. Use a more informational macro here. } + + for (uint32_t i = 0; i < pCreateInfo->enabledExtensionCount; ++i) + { + const char* currentExtensionName = pCreateInfo->ppEnabledExtensionNames[i]; + uint32_t extensionPropertiesCount = sizeof(deviceExtensionProperties) / sizeof(deviceExtensionProperties[0]); + bool foundExtension = false; + + for (uint32_t j = 0; j < extensionPropertiesCount; ++j) + { + if (strcmp(currentExtensionName, deviceExtensionProperties[j].extensionName) == 0) + { + foundExtension = true; + break; + } + } + + if (!foundExtension) + { + return VK_ERROR_EXTENSION_NOT_PRESENT; + } + } + + const VkBaseInStructure* extensionCreateInfo = reinterpret_cast<const VkBaseInStructure*>(pCreateInfo->pNext); while(extensionCreateInfo)