VERY experimental Nintendo Switch 2 emulator
C++
vulkan_common: promote host query reset usage to core
Liam540a8413518d
diff --git a/src/video_core/renderer_vulkan/vk_query_cache.cpp b/src/video_core/renderer_vulkan/vk_query_cache.cppindex 4b15c0f85b..929c8ece66 100644--- a/src/video_core/renderer_vulkan/vk_query_cache.cpp+++ b/src/video_core/renderer_vulkan/vk_query_cache.cpp@@ -98,7 +98,7 @@ HostCounter::HostCounter(QueryCache& cache_, std::shared_ptr<HostCounter> dependquery{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);});}diff --git a/src/video_core/vulkan_common/vulkan_device.cpp b/src/video_core/vulkan_common/vulkan_device.cppindex 72968a01c9..c2bea3e9ef 100644--- a/src/video_core/vulkan_common/vulkan_device.cpp+++ b/src/video_core/vulkan_common/vulkan_device.cpp@@ -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 _WIN32VK_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,};diff --git a/src/video_core/vulkan_common/vulkan_wrapper.cpp b/src/video_core/vulkan_common/vulkan_wrapper.cppindex f842524c4d..1592d4184e 100644--- a/src/video_core/vulkan_common/vulkan_wrapper.cpp+++ b/src/video_core/vulkan_common/vulkan_wrapper.cpp@@ -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}diff --git a/src/video_core/vulkan_common/vulkan_wrapper.h b/src/video_core/vulkan_common/vulkan_wrapper.hindex 101205386f..9997420ddc 100644--- a/src/video_core/vulkan_common/vulkan_wrapper.h+++ b/src/video_core/vulkan_common/vulkan_wrapper.h@@ -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,