mirror of
https://git.citron-emu.org/citron/emulator
synced 2025-12-19 02:33:32 +00:00
refactor(vulkan): Remove redundant query cache segment notifications
- Remove NotifySegment(true) from PrepareDraw, DrawTexture, and Clear - Remove NotifySegment(false) from AccelerateDisplay - Add state tracking for transform feedback to avoid redundant CounterEnable calls - Only call CounterEnable when transform feedback enable state changes This prevents double resume/pause operations and state management conflicts. Co-authored-by: Maufeat <maufeat@eden-emu.dev> Signed-off-by: Zephyron <zephyron@citron-emu.org>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
||||
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <algorithm>
|
||||
@@ -214,8 +215,6 @@ void RasterizerVulkan::PrepareDraw(bool is_indexed, Func&& draw_func) {
|
||||
FlushWork();
|
||||
gpu_memory->FlushCaching();
|
||||
|
||||
query_cache.NotifySegment(true);
|
||||
|
||||
GraphicsPipeline* const pipeline{pipeline_cache.CurrentGraphicsPipeline()};
|
||||
if (!pipeline) {
|
||||
return;
|
||||
@@ -307,8 +306,6 @@ void RasterizerVulkan::DrawTexture() {
|
||||
};
|
||||
FlushWork();
|
||||
|
||||
query_cache.NotifySegment(true);
|
||||
|
||||
std::scoped_lock l{texture_cache.mutex};
|
||||
texture_cache.SynchronizeGraphicsDescriptors();
|
||||
texture_cache.UpdateRenderTargets(false);
|
||||
@@ -355,7 +352,6 @@ void RasterizerVulkan::Clear(u32 layer_count) {
|
||||
FlushWork();
|
||||
gpu_memory->FlushCaching();
|
||||
|
||||
query_cache.NotifySegment(true);
|
||||
query_cache.CounterEnable(VideoCommon::QueryType::ZPassPixelCount64,
|
||||
maxwell3d->regs.zpass_pixel_count_enable);
|
||||
|
||||
@@ -875,7 +871,6 @@ std::optional<FramebufferTextureInfo> RasterizerVulkan::AccelerateDisplay(
|
||||
if (!image_view) {
|
||||
return {};
|
||||
}
|
||||
query_cache.NotifySegment(false);
|
||||
|
||||
const auto& resolution = Settings::values.resolution_info;
|
||||
|
||||
@@ -1028,9 +1023,14 @@ void RasterizerVulkan::HandleTransformFeedback() {
|
||||
});
|
||||
return;
|
||||
}
|
||||
query_cache.CounterEnable(VideoCommon::QueryType::StreamingByteCount,
|
||||
regs.transform_feedback_enabled);
|
||||
if (regs.transform_feedback_enabled != 0) {
|
||||
// Only update counter state when transform feedback enable state changes
|
||||
const bool transform_feedback_enabled = regs.transform_feedback_enabled != 0;
|
||||
if (last_transform_feedback_enabled != transform_feedback_enabled) {
|
||||
query_cache.CounterEnable(VideoCommon::QueryType::StreamingByteCount,
|
||||
transform_feedback_enabled);
|
||||
last_transform_feedback_enabled = transform_feedback_enabled;
|
||||
}
|
||||
if (transform_feedback_enabled) {
|
||||
UNIMPLEMENTED_IF(regs.IsShaderConfigEnabled(Maxwell::ShaderType::TessellationInit) ||
|
||||
regs.IsShaderConfigEnabled(Maxwell::ShaderType::Tessellation));
|
||||
}
|
||||
|
||||
@@ -219,6 +219,7 @@ private:
|
||||
boost::container::static_vector<VkSampler, MAX_TEXTURES> sampler_handles;
|
||||
|
||||
u32 draw_counter = 0;
|
||||
bool last_transform_feedback_enabled = false;
|
||||
};
|
||||
|
||||
} // namespace Vulkan
|
||||
|
||||
Reference in New Issue
Block a user