diff --git a/src/video_core/query_cache/query_cache.h b/src/video_core/query_cache/query_cache.h index 6e084cc079..9a7350f6b9 100644 --- a/src/video_core/query_cache/query_cache.h +++ b/src/video_core/query_cache/query_cache.h @@ -211,6 +211,12 @@ void QueryCacheBase::CounterClose(QueryType counter_type) { streamer->CloseCounter(); } +template +bool QueryCacheBase::HasStreamer(QueryType counter_type) const { + const size_t index = static_cast(counter_type); + return impl->streamers[index] != nullptr; +} + template void QueryCacheBase::CounterReset(QueryType counter_type) { size_t index = static_cast(counter_type); diff --git a/src/video_core/query_cache/query_cache_base.h b/src/video_core/query_cache/query_cache_base.h index 00c25c8d63..fa88133779 100644 --- a/src/video_core/query_cache/query_cache_base.h +++ b/src/video_core/query_cache/query_cache_base.h @@ -1,3 +1,6 @@ +// SPDX-FileCopyrightText: Copyright 2025 Eden Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later + // SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project // SPDX-License-Identifier: GPL-3.0-or-later @@ -92,6 +95,8 @@ public: void CounterReset(QueryType counter_type); + [[nodiscard]] bool HasStreamer(QueryType counter_type) const; + void CounterClose(QueryType counter_type); void CounterReport(GPUVAddr addr, QueryType counter_type, QueryPropertiesFlags flags, diff --git a/src/video_core/renderer_vulkan/vk_scheduler.cpp b/src/video_core/renderer_vulkan/vk_scheduler.cpp index 3a7b6eef9c..8c162fbfb7 100644 --- a/src/video_core/renderer_vulkan/vk_scheduler.cpp +++ b/src/video_core/renderer_vulkan/vk_scheduler.cpp @@ -40,8 +40,7 @@ void Scheduler::CommandChunk::ExecuteAll(vk::CommandBuffer cmdbuf, } Scheduler::Scheduler(const Device& device_, StateTracker& state_tracker_) - : device{device_}, supports_transform_feedback{device_.IsExtTransformFeedbackSupported()}, - state_tracker{state_tracker_}, + : device{device_}, state_tracker{state_tracker_}, master_semaphore{std::make_unique(device)}, command_pool{std::make_unique(*master_semaphore, device)} { AcquireNewChunk(); @@ -296,11 +295,13 @@ void Scheduler::EndRenderPass() return; } - query_cache->CounterEnable(VideoCommon::QueryType::ZPassPixelCount64, false); - if (supports_transform_feedback) { - query_cache->CounterEnable(VideoCommon::QueryType::StreamingByteCount, false); + if (query_cache) { + query_cache->CounterEnable(VideoCommon::QueryType::ZPassPixelCount64, false); + if (query_cache->HasStreamer(VideoCommon::QueryType::StreamingByteCount)) { + query_cache->CounterEnable(VideoCommon::QueryType::StreamingByteCount, false); + } + query_cache->NotifySegment(false); } - query_cache->NotifySegment(false); Record([num_images = num_renderpass_images, images = renderpass_images, diff --git a/src/video_core/renderer_vulkan/vk_scheduler.h b/src/video_core/renderer_vulkan/vk_scheduler.h index 12a8d75b54..5216a436c8 100644 --- a/src/video_core/renderer_vulkan/vk_scheduler.h +++ b/src/video_core/renderer_vulkan/vk_scheduler.h @@ -235,7 +235,6 @@ private: void AcquireNewChunk(); const Device& device; - const bool supports_transform_feedback; StateTracker& state_tracker; std::unique_ptr master_semaphore;