Use Vulkan 1.1 if available
Bug: chromium:976495 Change-Id: I10940340fab44b44e26cfb025f8c932a5e62f02e Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/9500 Reviewed-by: Kai Ninomiya <kainino@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org> Commit-Queue: Kai Ninomiya <kainino@chromium.org>
This commit is contained in:
parent
10fe83305a
commit
7dec2d1c56
|
@ -166,7 +166,7 @@ namespace dawn_native { namespace vulkan {
|
||||||
appInfo.applicationVersion = 0;
|
appInfo.applicationVersion = 0;
|
||||||
appInfo.pEngineName = nullptr;
|
appInfo.pEngineName = nullptr;
|
||||||
appInfo.engineVersion = 0;
|
appInfo.engineVersion = 0;
|
||||||
appInfo.apiVersion = VK_API_VERSION_1_0;
|
appInfo.apiVersion = mGlobalInfo.apiVersion;
|
||||||
|
|
||||||
VkInstanceCreateInfo createInfo;
|
VkInstanceCreateInfo createInfo;
|
||||||
createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
createInfo.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO;
|
||||||
|
|
|
@ -34,6 +34,10 @@ namespace dawn_native { namespace vulkan {
|
||||||
GET_GLOBAL_PROC(EnumerateInstanceExtensionProperties);
|
GET_GLOBAL_PROC(EnumerateInstanceExtensionProperties);
|
||||||
GET_GLOBAL_PROC(EnumerateInstanceLayerProperties);
|
GET_GLOBAL_PROC(EnumerateInstanceLayerProperties);
|
||||||
|
|
||||||
|
// Is not available in Vulkan 1.0, so allow nullptr
|
||||||
|
EnumerateInstanceVersion = reinterpret_cast<decltype(EnumerateInstanceVersion)>(
|
||||||
|
GetInstanceProcAddr(nullptr, "vkEnumerateInstanceVersion"));
|
||||||
|
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,6 +45,9 @@ namespace dawn_native { namespace vulkan {
|
||||||
// before querying the instance procs in case we need to error out during initialization.
|
// before querying the instance procs in case we need to error out during initialization.
|
||||||
PFN_vkDestroyInstance DestroyInstance = nullptr;
|
PFN_vkDestroyInstance DestroyInstance = nullptr;
|
||||||
|
|
||||||
|
// Core Vulkan 1.1
|
||||||
|
PFN_vkEnumerateInstanceVersion EnumerateInstanceVersion = nullptr;
|
||||||
|
|
||||||
// ---------- Instance procs
|
// ---------- Instance procs
|
||||||
|
|
||||||
// Core Vulkan 1.0
|
// Core Vulkan 1.0
|
||||||
|
|
|
@ -120,6 +120,19 @@ namespace dawn_native { namespace vulkan {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Gather info on available API version
|
||||||
|
{
|
||||||
|
uint32_t supportedAPIVersion = VK_MAKE_VERSION(1, 0, 0);
|
||||||
|
if (vkFunctions.EnumerateInstanceVersion) {
|
||||||
|
vkFunctions.EnumerateInstanceVersion(&supportedAPIVersion);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Use Vulkan 1.1 if it's available.
|
||||||
|
info.apiVersion = (supportedAPIVersion >= VK_MAKE_VERSION(1, 1, 0))
|
||||||
|
? VK_MAKE_VERSION(1, 1, 0)
|
||||||
|
: VK_MAKE_VERSION(1, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO(cwallez@chromium:org): Each layer can expose additional extensions, query them?
|
// TODO(cwallez@chromium:org): Each layer can expose additional extensions, query them?
|
||||||
|
|
||||||
return info;
|
return info;
|
||||||
|
|
|
@ -59,6 +59,7 @@ namespace dawn_native { namespace vulkan {
|
||||||
struct VulkanGlobalInfo : VulkanGlobalKnobs {
|
struct VulkanGlobalInfo : VulkanGlobalKnobs {
|
||||||
std::vector<VkLayerProperties> layers;
|
std::vector<VkLayerProperties> layers;
|
||||||
std::vector<VkExtensionProperties> extensions;
|
std::vector<VkExtensionProperties> extensions;
|
||||||
|
uint32_t apiVersion;
|
||||||
// TODO(cwallez@chromium.org): layer instance extensions
|
// TODO(cwallez@chromium.org): layer instance extensions
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue