summaryrefslogtreecommitdiffstats
path: root/Graphics/GraphicsEngineVulkan
diff options
context:
space:
mode:
authorassiduous <assiduous@diligentgraphics.com>2020-01-07 06:42:47 +0000
committerassiduous <assiduous@diligentgraphics.com>2020-01-07 06:42:47 +0000
commita979f2e10e87ea534c923fa6303248df834521e3 (patch)
tree3050afd3ebcb9ff94a5f26af73b15949843f7dda /Graphics/GraphicsEngineVulkan
parentImproved device feature reporting; added flags for query support (diff)
downloadDiligentCore-a979f2e10e87ea534c923fa6303248df834521e3.tar.gz
DiligentCore-a979f2e10e87ea534c923fa6303248df834521e3.zip
Vulkan backend: fixed issues with occlusion and pipeline stats queries if they are not supported by device
Diffstat (limited to 'Graphics/GraphicsEngineVulkan')
-rw-r--r--Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp4
-rw-r--r--Graphics/GraphicsEngineVulkan/src/QueryManagerVk.cpp6
2 files changed, 8 insertions, 2 deletions
diff --git a/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp b/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp
index 6c457ce2..24e0c614 100644
--- a/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/EngineFactoryVk.cpp
@@ -196,8 +196,8 @@ void EngineFactoryVkImpl::CreateDeviceAndContextsVk(const EngineVkCreateInfo& _E
ENABLE_FEATURE(shaderStorageImageExtendedFormats)
#undef ENABLE_FEATURE
- DeviceFeatures.pipelineStatisticsQuery = VK_TRUE;
- DeviceFeatures.occlusionQueryPrecise = VK_TRUE;
+ DeviceFeatures.pipelineStatisticsQuery = PhysicalDeviceFeatures.pipelineStatisticsQuery;
+ DeviceFeatures.occlusionQueryPrecise = PhysicalDeviceFeatures.occlusionQueryPrecise;
DeviceCreateInfo.pEnabledFeatures = &DeviceFeatures; // NULL or a pointer to a VkPhysicalDeviceFeatures structure that contains
// boolean indicators of all the features to be enabled.
diff --git a/Graphics/GraphicsEngineVulkan/src/QueryManagerVk.cpp b/Graphics/GraphicsEngineVulkan/src/QueryManagerVk.cpp
index d7a47a6d..18db0546 100644
--- a/Graphics/GraphicsEngineVulkan/src/QueryManagerVk.cpp
+++ b/Graphics/GraphicsEngineVulkan/src/QueryManagerVk.cpp
@@ -47,8 +47,14 @@ QueryManagerVk::QueryManagerVk(RenderDeviceVkImpl* pRenderDeviceVk,
VkCommandBuffer vkCmdBuff;
pRenderDeviceVk->AllocateTransientCmdPool(CmdPool, vkCmdBuff, "Transient command pool to reset queries before first use");
+ const auto& deviceFeatures = PhysicalDevice.GetFeatures();
+
for (Uint32 QueryType = QUERY_TYPE_UNDEFINED + 1; QueryType < QUERY_TYPE_NUM_TYPES; ++QueryType)
{
+ if (QueryType == QUERY_TYPE_OCCLUSION && !deviceFeatures.occlusionQueryPrecise ||
+ QueryType == QUERY_TYPE_PIPELINE_STATISTICS && !deviceFeatures.pipelineStatisticsQuery)
+ continue;
+
// clang-format off
static_assert(QUERY_TYPE_OCCLUSION == 1, "Unexpected value of QUERY_TYPE_OCCLUSION. EngineVkCreateInfo::QueryPoolSizes must be updated");
static_assert(QUERY_TYPE_BINARY_OCCLUSION == 2, "Unexpected value of QUERY_TYPE_BINARY_OCCLUSION. EngineVkCreateInfo::QueryPoolSizes must be updated");