vulkan_common: promote host query reset usage to core
This commit is contained in:
		@@ -98,7 +98,7 @@ HostCounter::HostCounter(QueryCache& cache_, std::shared_ptr<HostCounter> depend
 | 
			
		||||
      query{cache_.AllocateQuery(type_)}, tick{cache_.GetScheduler().CurrentTick()} {
 | 
			
		||||
    const vk::Device* logical = &cache.GetDevice().GetLogical();
 | 
			
		||||
    cache.GetScheduler().Record([logical, query = query](vk::CommandBuffer cmdbuf) {
 | 
			
		||||
        logical->ResetQueryPoolEXT(query.first, query.second, 1);
 | 
			
		||||
        logical->ResetQueryPool(query.first, query.second, 1);
 | 
			
		||||
        cmdbuf.BeginQuery(query.first, query.second, VK_QUERY_CONTROL_PRECISE_BIT);
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -77,10 +77,6 @@ enum class NvidiaArchitecture {
 | 
			
		||||
constexpr std::array REQUIRED_EXTENSIONS{
 | 
			
		||||
    VK_EXT_VERTEX_ATTRIBUTE_DIVISOR_EXTENSION_NAME,
 | 
			
		||||
    VK_EXT_ROBUSTNESS_2_EXTENSION_NAME,
 | 
			
		||||
 | 
			
		||||
    // Core in 1.2, but required due to use of extension methods,
 | 
			
		||||
    // and well-supported by drivers
 | 
			
		||||
    VK_EXT_HOST_QUERY_RESET_EXTENSION_NAME,
 | 
			
		||||
#ifdef _WIN32
 | 
			
		||||
    VK_KHR_EXTERNAL_MEMORY_WIN32_EXTENSION_NAME,
 | 
			
		||||
#endif
 | 
			
		||||
@@ -438,8 +434,8 @@ Device::Device(VkInstance instance_, vk::PhysicalDevice physical_, VkSurfaceKHR
 | 
			
		||||
    };
 | 
			
		||||
    SetNext(next, robustness2);
 | 
			
		||||
 | 
			
		||||
    VkPhysicalDeviceHostQueryResetFeaturesEXT host_query_reset{
 | 
			
		||||
        .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES_EXT,
 | 
			
		||||
    VkPhysicalDeviceHostQueryResetFeatures host_query_reset{
 | 
			
		||||
        .sType = VK_STRUCTURE_TYPE_PHYSICAL_DEVICE_HOST_QUERY_RESET_FEATURES,
 | 
			
		||||
        .pNext = nullptr,
 | 
			
		||||
        .hostQueryReset = true,
 | 
			
		||||
    };
 | 
			
		||||
 
 | 
			
		||||
@@ -184,7 +184,7 @@ void Load(VkDevice device, DeviceDispatch& dld) noexcept {
 | 
			
		||||
    X(vkMapMemory);
 | 
			
		||||
    X(vkQueueSubmit);
 | 
			
		||||
    X(vkResetFences);
 | 
			
		||||
    X(vkResetQueryPoolEXT);
 | 
			
		||||
    X(vkResetQueryPool);
 | 
			
		||||
    X(vkSetDebugUtilsObjectNameEXT);
 | 
			
		||||
    X(vkSetDebugUtilsObjectTagEXT);
 | 
			
		||||
    X(vkUnmapMemory);
 | 
			
		||||
@@ -199,6 +199,11 @@ void Load(VkDevice device, DeviceDispatch& dld) noexcept {
 | 
			
		||||
        Proc(dld.vkWaitForFences, dld, "vkWaitForFencesKHR", device);
 | 
			
		||||
        Proc(dld.vkWaitSemaphores, dld, "vkWaitSemaphoresKHR", device);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Support for host query reset is mandatory in Vulkan 1.2
 | 
			
		||||
    if (!dld.vkResetQueryPool) {
 | 
			
		||||
        Proc(dld.vkResetQueryPool, dld, "vkResetQueryPoolEXT", device);
 | 
			
		||||
    }
 | 
			
		||||
#undef X
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -301,7 +301,7 @@ struct DeviceDispatch : InstanceDispatch {
 | 
			
		||||
    PFN_vkMapMemory vkMapMemory{};
 | 
			
		||||
    PFN_vkQueueSubmit vkQueueSubmit{};
 | 
			
		||||
    PFN_vkResetFences vkResetFences{};
 | 
			
		||||
    PFN_vkResetQueryPoolEXT vkResetQueryPoolEXT{};
 | 
			
		||||
    PFN_vkResetQueryPool vkResetQueryPool{};
 | 
			
		||||
    PFN_vkSetDebugUtilsObjectNameEXT vkSetDebugUtilsObjectNameEXT{};
 | 
			
		||||
    PFN_vkSetDebugUtilsObjectTagEXT vkSetDebugUtilsObjectTagEXT{};
 | 
			
		||||
    PFN_vkUnmapMemory vkUnmapMemory{};
 | 
			
		||||
@@ -884,8 +884,8 @@ public:
 | 
			
		||||
        return dld->vkDeviceWaitIdle(handle);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    void ResetQueryPoolEXT(VkQueryPool query_pool, u32 first, u32 count) const noexcept {
 | 
			
		||||
        dld->vkResetQueryPoolEXT(handle, query_pool, first, count);
 | 
			
		||||
    void ResetQueryPool(VkQueryPool query_pool, u32 first, u32 count) const noexcept {
 | 
			
		||||
        dld->vkResetQueryPool(handle, query_pool, first, count);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    VkResult GetQueryResults(VkQueryPool query_pool, u32 first, u32 count, std::size_t data_size,
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user