mirror of
https://git.citron-emu.org/citron/emulator
synced 2025-12-19 10:43:33 +00:00
revert d5efa255ee
revert 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,5 +1,4 @@
|
|||||||
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
// SPDX-FileCopyrightText: Copyright 2019 yuzu Emulator Project
|
||||||
// SPDX-FileCopyrightText: Copyright 2025 citron Emulator Project
|
|
||||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
@@ -215,6 +214,8 @@ void RasterizerVulkan::PrepareDraw(bool is_indexed, Func&& draw_func) {
|
|||||||
FlushWork();
|
FlushWork();
|
||||||
gpu_memory->FlushCaching();
|
gpu_memory->FlushCaching();
|
||||||
|
|
||||||
|
query_cache.NotifySegment(true);
|
||||||
|
|
||||||
GraphicsPipeline* const pipeline{pipeline_cache.CurrentGraphicsPipeline()};
|
GraphicsPipeline* const pipeline{pipeline_cache.CurrentGraphicsPipeline()};
|
||||||
if (!pipeline) {
|
if (!pipeline) {
|
||||||
return;
|
return;
|
||||||
@@ -306,6 +307,8 @@ void RasterizerVulkan::DrawTexture() {
|
|||||||
};
|
};
|
||||||
FlushWork();
|
FlushWork();
|
||||||
|
|
||||||
|
query_cache.NotifySegment(true);
|
||||||
|
|
||||||
std::scoped_lock l{texture_cache.mutex};
|
std::scoped_lock l{texture_cache.mutex};
|
||||||
texture_cache.SynchronizeGraphicsDescriptors();
|
texture_cache.SynchronizeGraphicsDescriptors();
|
||||||
texture_cache.UpdateRenderTargets(false);
|
texture_cache.UpdateRenderTargets(false);
|
||||||
@@ -352,6 +355,7 @@ void RasterizerVulkan::Clear(u32 layer_count) {
|
|||||||
FlushWork();
|
FlushWork();
|
||||||
gpu_memory->FlushCaching();
|
gpu_memory->FlushCaching();
|
||||||
|
|
||||||
|
query_cache.NotifySegment(true);
|
||||||
query_cache.CounterEnable(VideoCommon::QueryType::ZPassPixelCount64,
|
query_cache.CounterEnable(VideoCommon::QueryType::ZPassPixelCount64,
|
||||||
maxwell3d->regs.zpass_pixel_count_enable);
|
maxwell3d->regs.zpass_pixel_count_enable);
|
||||||
|
|
||||||
@@ -871,6 +875,7 @@ std::optional<FramebufferTextureInfo> RasterizerVulkan::AccelerateDisplay(
|
|||||||
if (!image_view) {
|
if (!image_view) {
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
query_cache.NotifySegment(false);
|
||||||
|
|
||||||
const auto& resolution = Settings::values.resolution_info;
|
const auto& resolution = Settings::values.resolution_info;
|
||||||
|
|
||||||
@@ -1023,14 +1028,9 @@ void RasterizerVulkan::HandleTransformFeedback() {
|
|||||||
});
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// Only update counter state when transform feedback enable state changes
|
query_cache.CounterEnable(VideoCommon::QueryType::StreamingByteCount,
|
||||||
const bool transform_feedback_enabled = regs.transform_feedback_enabled != 0;
|
regs.transform_feedback_enabled);
|
||||||
if (last_transform_feedback_enabled != transform_feedback_enabled) {
|
if (regs.transform_feedback_enabled != 0) {
|
||||||
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) ||
|
UNIMPLEMENTED_IF(regs.IsShaderConfigEnabled(Maxwell::ShaderType::TessellationInit) ||
|
||||||
regs.IsShaderConfigEnabled(Maxwell::ShaderType::Tessellation));
|
regs.IsShaderConfigEnabled(Maxwell::ShaderType::Tessellation));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -219,7 +219,6 @@ private:
|
|||||||
boost::container::static_vector<VkSampler, MAX_TEXTURES> sampler_handles;
|
boost::container::static_vector<VkSampler, MAX_TEXTURES> sampler_handles;
|
||||||
|
|
||||||
u32 draw_counter = 0;
|
u32 draw_counter = 0;
|
||||||
bool last_transform_feedback_enabled = false;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Vulkan
|
} // namespace Vulkan
|
||||||
|
|||||||
Reference in New Issue
Block a user