diff --git a/src/video_core/query_cache/query_cache.h b/src/video_core/query_cache/query_cache.h index 4ed42487aa..3614195cd8 100644 --- a/src/video_core/query_cache/query_cache.h +++ b/src/video_core/query_cache/query_cache.h @@ -236,10 +236,34 @@ void QueryCacheBase::CounterReport(GPUVAddr addr, QueryType counter_type size_t streamer_id = static_cast(counter_type); auto* streamer = impl->streamers[streamer_id]; if (streamer == nullptr) [[unlikely]] { - counter_type = QueryType::Payload; - payload = 1U; - streamer_id = static_cast(counter_type); - streamer = impl->streamers[streamer_id]; + auto cpu_addr_opt = gpu_memory->GpuToCpuAddress(addr); + if (!cpu_addr_opt) [[unlikely]] { + return; + } + const DAddr cpu_addr = *cpu_addr_opt; + u8* pointer = impl->device_memory.template GetPointer(cpu_addr); + u8* pointer_timestamp = impl->device_memory.template GetPointer(cpu_addr + 8); + if (pointer == nullptr || (has_timestamp && pointer_timestamp == nullptr)) [[unlikely]] { + return; + } + const u64 fallback_value = counter_type == QueryType::Payload ? static_cast(payload) : 0; + std::function operation([this, has_timestamp, fallback_value, pointer, + pointer_timestamp] { + if (has_timestamp) { + const u64 timestamp = impl->gpu.GetTicks(); + std::memcpy(pointer_timestamp, ×tamp, sizeof(timestamp)); + std::memcpy(pointer, &fallback_value, sizeof(fallback_value)); + } else { + const u32 value = static_cast(fallback_value); + std::memcpy(pointer, &value, sizeof(value)); + } + }); + if (is_fence) { + impl->rasterizer.SignalFence(std::move(operation)); + } else { + impl->rasterizer.SyncOperation(std::move(operation)); + } + return; } auto cpu_addr_opt = gpu_memory->GpuToCpuAddress(addr); if (!cpu_addr_opt) [[unlikely]] { @@ -437,8 +461,10 @@ bool QueryCacheBase::AccelerateHostConditionalRendering() { impl->runtime.EndHostConditionalRendering(); return false; case ComparisonMode::Conditional: { - VideoCommon::LookupData object_1{gen_lookup(address)}; - return impl->runtime.HostConditionalRenderingCompareValue(object_1, qc_dirty); + // Guest conditional mode expects both initial_sequence and initial_mode to be non-zero + // fall back to software eval + impl->runtime.EndHostConditionalRendering(); + return false; } case ComparisonMode::IfEqual: { VideoCommon::LookupData object_1{gen_lookup(address)}; diff --git a/src/video_core/renderer_vulkan/vk_query_cache.cpp b/src/video_core/renderer_vulkan/vk_query_cache.cpp index 8518d89eee..a0d8452aad 100644 --- a/src/video_core/renderer_vulkan/vk_query_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_query_cache.cpp @@ -1457,11 +1457,13 @@ VideoCommon::StreamerInterface* QueryCacheRuntime::GetStreamerInterface(QueryTyp return &impl->sample_streamer; case QueryType::StreamingByteCount: return &impl->tfb_streamer; + case QueryType::PrimitivesGenerated: case QueryType::StreamingPrimitivesNeeded: case QueryType::VtgPrimitivesOut: case QueryType::StreamingPrimitivesSucceeded: return &impl->primitives_succeeded_streamer; case QueryType::StreamingPrimitivesNeededMinusSucceeded: + case QueryType::TotalStreamingPrimitivesNeededMinusSucceeded: return &impl->primitives_needed_minus_succeeded_streamer; default: return nullptr; diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index f867980a6f..be65890c28 100644 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -607,10 +607,6 @@ void RasterizerVulkan::DispatchCompute() { } void RasterizerVulkan::ResetCounter(VideoCommon::QueryType type) { - if (type != VideoCommon::QueryType::ZPassPixelCount64) { - LOG_DEBUG(Render_Vulkan, "Unimplemented counter reset={}", type); - return; - } query_cache.CounterReset(type); }