Browse Source

Add three extension capability support check (#4626)

* Add some extension capability for vma
tags/20230517
張小凡 GitHub 3 years ago
parent
commit
772b13a1d1
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 36 additions and 0 deletions
  1. +33
    -0
      src/gpu.cpp
  2. +3
    -0
      src/gpu.h

+ 33
- 0
src/gpu.cpp View File

@@ -226,6 +226,7 @@ public:
int support_VK_KHR_8bit_storage;
int support_VK_KHR_16bit_storage;
int support_VK_KHR_bind_memory2;
int support_VK_KHR_buffer_device_address;
int support_VK_KHR_create_renderpass2;
int support_VK_KHR_dedicated_allocation;
int support_VK_KHR_descriptor_update_template;
@@ -244,7 +245,9 @@ public:
int support_VK_KHR_swapchain;
int support_VK_EXT_descriptor_indexing;
int support_VK_EXT_memory_budget;
int support_VK_EXT_memory_priority;
int support_VK_EXT_queue_family_foreign;
int support_VK_AMD_device_coherent_memory;
#if __ANDROID_API__ >= 26
int support_VK_ANDROID_external_memory_android_hardware_buffer;
#endif // __ANDROID_API__ >= 26
@@ -536,6 +539,11 @@ int GpuInfo::support_VK_KHR_bind_memory2() const
return d->support_VK_KHR_bind_memory2;
}

int GpuInfo::support_VK_KHR_buffer_device_address() const
{
return d->support_VK_KHR_buffer_device_address;
}

int GpuInfo::support_VK_KHR_create_renderpass2() const
{
return d->support_VK_KHR_create_renderpass2;
@@ -626,11 +634,21 @@ int GpuInfo::support_VK_EXT_memory_budget() const
return d->support_VK_EXT_memory_budget;
}

int GpuInfo::support_VK_EXT_memory_priority() const
{
return d->support_VK_EXT_memory_priority;
}

int GpuInfo::support_VK_EXT_queue_family_foreign() const
{
return d->support_VK_EXT_queue_family_foreign;
}

int GpuInfo::support_VK_AMD_device_coherent_memory() const
{
return d->support_VK_AMD_device_coherent_memory;
}

#if __ANDROID_API__ >= 26
int GpuInfo::support_VK_ANDROID_external_memory_android_hardware_buffer() const
{
@@ -1320,6 +1338,7 @@ int create_gpu_instance()
gpu_info.support_VK_KHR_8bit_storage = 0;
gpu_info.support_VK_KHR_16bit_storage = 0;
gpu_info.support_VK_KHR_bind_memory2 = 0;
gpu_info.support_VK_KHR_buffer_device_address = 0;
gpu_info.support_VK_KHR_create_renderpass2 = 0;
gpu_info.support_VK_KHR_dedicated_allocation = 0;
gpu_info.support_VK_KHR_descriptor_update_template = 0;
@@ -1338,7 +1357,9 @@ int create_gpu_instance()
gpu_info.support_VK_KHR_swapchain = 0;
gpu_info.support_VK_EXT_descriptor_indexing = 0;
gpu_info.support_VK_EXT_memory_budget = 0;
gpu_info.support_VK_EXT_memory_priority = 0;
gpu_info.support_VK_EXT_queue_family_foreign = 0;
gpu_info.support_VK_AMD_device_coherent_memory = 0;
#if __ANDROID_API__ >= 26
gpu_info.support_VK_ANDROID_external_memory_android_hardware_buffer = 0;
#endif // __ANDROID_API__ >= 26
@@ -1354,6 +1375,8 @@ int create_gpu_instance()
gpu_info.support_VK_KHR_16bit_storage = exp.specVersion;
else if (strcmp(exp.extensionName, "VK_KHR_bind_memory2") == 0)
gpu_info.support_VK_KHR_bind_memory2 = exp.specVersion;
else if (strcmp(exp.extensionName, "VK_KHR_buffer_device_address") == 0)
gpu_info.support_VK_KHR_buffer_device_address = exp.specVersion;
else if (strcmp(exp.extensionName, "VK_KHR_create_renderpass2") == 0)
gpu_info.support_VK_KHR_create_renderpass2 = exp.specVersion;
else if (strcmp(exp.extensionName, "VK_KHR_dedicated_allocation") == 0)
@@ -1390,8 +1413,12 @@ int create_gpu_instance()
gpu_info.support_VK_EXT_descriptor_indexing = exp.specVersion;
else if (strcmp(exp.extensionName, "VK_EXT_memory_budget") == 0)
gpu_info.support_VK_EXT_memory_budget = exp.specVersion;
else if (strcmp(exp.extensionName, "VK_EXT_memory_priority") == 0)
gpu_info.support_VK_EXT_memory_priority = exp.specVersion;
else if (strcmp(exp.extensionName, "VK_EXT_queue_family_foreign") == 0)
gpu_info.support_VK_EXT_queue_family_foreign = exp.specVersion;
else if (strcmp(exp.extensionName, "VK_AMD_device_coherent_memory") == 0)
gpu_info.support_VK_AMD_device_coherent_memory = exp.specVersion;
#if __ANDROID_API__ >= 26
else if (strcmp(exp.extensionName, "VK_ANDROID_external_memory_android_hardware_buffer") == 0)
gpu_info.support_VK_ANDROID_external_memory_android_hardware_buffer = exp.specVersion;
@@ -1931,6 +1958,8 @@ VulkanDevice::VulkanDevice(int device_index)
enabledExtensions.push_back("VK_KHR_16bit_storage");
if (info.support_VK_KHR_bind_memory2())
enabledExtensions.push_back("VK_KHR_bind_memory2");
if (info.support_VK_KHR_buffer_device_address())
enabledExtensions.push_back("VK_KHR_buffer_device_address");
if (info.support_VK_KHR_create_renderpass2())
enabledExtensions.push_back("VK_KHR_create_renderpass2");
if (info.support_VK_KHR_dedicated_allocation())
@@ -1967,8 +1996,12 @@ VulkanDevice::VulkanDevice(int device_index)
enabledExtensions.push_back("VK_EXT_descriptor_indexing");
if (info.support_VK_EXT_memory_budget())
enabledExtensions.push_back("VK_EXT_memory_budget");
if (info.support_VK_EXT_memory_priority())
enabledExtensions.push_back("VK_EXT_memory_priority");
if (info.support_VK_EXT_queue_family_foreign())
enabledExtensions.push_back("VK_EXT_queue_family_foreign");
if (info.support_VK_AMD_device_coherent_memory())
enabledExtensions.push_back("VK_AMD_device_coherent_memory");
#if __ANDROID_API__ >= 26
if (info.support_VK_ANDROID_external_memory_android_hardware_buffer())
enabledExtensions.push_back("VK_ANDROID_external_memory_android_hardware_buffer");


+ 3
- 0
src/gpu.h View File

@@ -167,6 +167,7 @@ public:
int support_VK_KHR_8bit_storage() const;
int support_VK_KHR_16bit_storage() const;
int support_VK_KHR_bind_memory2() const;
int support_VK_KHR_buffer_device_address() const;
int support_VK_KHR_create_renderpass2() const;
int support_VK_KHR_dedicated_allocation() const;
int support_VK_KHR_descriptor_update_template() const;
@@ -185,7 +186,9 @@ public:
int support_VK_KHR_swapchain() const;
int support_VK_EXT_descriptor_indexing() const;
int support_VK_EXT_memory_budget() const;
int support_VK_EXT_memory_priority() const;
int support_VK_EXT_queue_family_foreign() const;
int support_VK_AMD_device_coherent_memory() const;
#if __ANDROID_API__ >= 26
int support_VK_ANDROID_external_memory_android_hardware_buffer() const;
#endif // __ANDROID_API__ >= 26


Loading…
Cancel
Save