From 4f5bbe56ba1a590f4f266945d29b4bc9a04c23fd Mon Sep 17 00:00:00 2001 From: ReinUsesLisp Date: Sat, 19 Sep 2020 01:47:29 -0300 Subject: vk_query_cache: Hack counter destructor to avoid reserving queries This is a hack to destroy all HostCounter instances before the base class destructor is called. The query cache should be redesigned to have a proper ownership model instead of using shared pointers. For now, destroy the host counter hierarchy from the derived class destructor. --- src/video_core/renderer_vulkan/vk_query_cache.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/video_core/renderer_vulkan/vk_query_cache.cpp') diff --git a/src/video_core/renderer_vulkan/vk_query_cache.cpp b/src/video_core/renderer_vulkan/vk_query_cache.cpp index 28a793f97..ee2d871e3 100644 --- a/src/video_core/renderer_vulkan/vk_query_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_query_cache.cpp @@ -76,7 +76,16 @@ VKQueryCache::VKQueryCache(VideoCore::RasterizerInterface& rasterizer, QueryType::SamplesPassed}, } {} -VKQueryCache::~VKQueryCache() = default; +VKQueryCache::~VKQueryCache() { + // TODO(Rodrigo): This is a hack to destroy all HostCounter instances before the base class + // destructor is called. The query cache should be redesigned to have a proper ownership model + // instead of using shared pointers. + for (size_t query_type = 0; query_type < VideoCore::NumQueryTypes; ++query_type) { + auto& stream = Stream(static_cast(query_type)); + stream.Update(false); + stream.Reset(); + } +} std::pair VKQueryCache::AllocateQuery(QueryType type) { return query_pools[static_cast(type)].Commit(); -- cgit v1.2.3