Add checking for compute in main queue

This commit is contained in:
Benau 2022-08-04 10:56:29 +08:00
parent c96881208a
commit 211c901335
2 changed files with 31 additions and 2 deletions

View File

@ -25,6 +25,7 @@ bool g_supports_partially_bound = false;
uint32_t g_max_sampler_supported = 0;
bool g_supports_multi_draw_indirect = false;
bool g_supports_base_vertex_rendering = true;
bool g_supports_compute_in_main_queue = false;
} // GEVulkanFeatures
// ============================================================================
@ -78,6 +79,23 @@ void GEVulkanFeatures::init(GEVulkanDriver* vk)
g_supports_descriptor_indexing = true;
}
uint32_t queue_family_count = 0;
vkGetPhysicalDeviceQueueFamilyProperties(vk->getPhysicalDevice(),
&queue_family_count, NULL);
if (queue_family_count != 0)
{
std::vector<VkQueueFamilyProperties> queue_families(queue_family_count);
vkGetPhysicalDeviceQueueFamilyProperties(vk->getPhysicalDevice(),
&queue_family_count, &queue_families[0]);
uint32_t main_family = vk->getGraphicsFamily();
if (main_family < queue_families.size())
{
g_supports_compute_in_main_queue =
(queue_families[main_family].queueFlags & VK_QUEUE_COMPUTE_BIT)
!= 0;
}
}
VkPhysicalDeviceFeatures2 supported_features = {};
supported_features.sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_FEATURES_2;
VkPhysicalDeviceDescriptorIndexingFeatures descriptor_indexing_features = {};
@ -161,6 +179,9 @@ void GEVulkanFeatures::printStats()
os::Printer::log(
"Vulkan supports base vertex rendering",
g_supports_base_vertex_rendering ? "true" : "false");
os::Printer::log(
"Vulkan supports compute in main queue",
g_supports_compute_in_main_queue ? "true" : "false");
os::Printer::log(
"Vulkan descriptor indexes can be dynamically non-uniform",
g_supports_non_uniform_indexing ? "true" : "false");
@ -226,12 +247,18 @@ bool GEVulkanFeatures::supportsBindMeshTexturesAtOnce()
bool GEVulkanFeatures::supportsMultiDrawIndirect()
{
return g_supports_multi_draw_indirect;
} // supportsBindMeshTexturesAtOnce
} // supportsMultiDrawIndirect
// ----------------------------------------------------------------------------
bool GEVulkanFeatures::supportsBaseVertexRendering()
{
return g_supports_base_vertex_rendering;
} // supportsBindMeshTexturesAtOnce
} // supportsBaseVertexRendering
// ----------------------------------------------------------------------------
bool GEVulkanFeatures::supportsComputeInMainQueue()
{
return g_supports_compute_in_main_queue;
} // supportsComputeInMainQueue
}

View File

@ -32,6 +32,8 @@ bool supportsBindMeshTexturesAtOnce();
bool supportsMultiDrawIndirect();
// ----------------------------------------------------------------------------
bool supportsBaseVertexRendering();
// ----------------------------------------------------------------------------
bool supportsComputeInMainQueue();
}; // GEVulkanFeatures
}