video_core: The draw manager manages whether Clear is required.

This commit is contained in:
FengChen 2022-12-08 22:51:18 +08:00
parent 15d63c3d3d
commit 1e64b5e2ec
3 changed files with 9 additions and 10 deletions

View File

@ -52,12 +52,15 @@ void DrawManager::ProcessMethodCall(u32 method, u32 argument) {
} }
void DrawManager::Clear(u32 layer_count) { void DrawManager::Clear(u32 layer_count) {
if (maxwell3d->ShouldExecute()) {
maxwell3d->rasterizer->Clear(layer_count); maxwell3d->rasterizer->Clear(layer_count);
}
} }
void DrawManager::DrawDeferred() { void DrawManager::DrawDeferred() {
if (draw_state.draw_mode != DrawMode::Instance || draw_state.instance_count == 0) if (draw_state.draw_mode != DrawMode::Instance || draw_state.instance_count == 0) {
return; return;
}
DrawEnd(draw_state.instance_count + 1, true); DrawEnd(draw_state.instance_count + 1, true);
draw_state.instance_count = 0; draw_state.instance_count = 0;
} }
@ -112,8 +115,9 @@ void DrawManager::DrawEnd(u32 instance_count, bool force_draw) {
const auto& regs{maxwell3d->regs}; const auto& regs{maxwell3d->regs};
switch (draw_state.draw_mode) { switch (draw_state.draw_mode) {
case DrawMode::Instance: case DrawMode::Instance:
if (!force_draw) if (!force_draw) {
break; break;
}
[[fallthrough]]; [[fallthrough]];
case DrawMode::General: case DrawMode::General:
draw_state.base_instance = regs.global_base_instance_index; draw_state.base_instance = regs.global_base_instance_index;
@ -185,7 +189,8 @@ void DrawManager::ProcessDraw(bool draw_indexed, u32 instance_count) {
UpdateTopology(); UpdateTopology();
if (maxwell3d->ShouldExecute()) if (maxwell3d->ShouldExecute()) {
maxwell3d->rasterizer->Draw(draw_indexed, instance_count); maxwell3d->rasterizer->Draw(draw_indexed, instance_count);
}
} }
} // namespace Tegra::Engines } // namespace Tegra::Engines

View File

@ -138,9 +138,6 @@ void RasterizerOpenGL::LoadDiskResources(u64 title_id, std::stop_token stop_load
void RasterizerOpenGL::Clear(u32 layer_count) { void RasterizerOpenGL::Clear(u32 layer_count) {
MICROPROFILE_SCOPE(OpenGL_Clears); MICROPROFILE_SCOPE(OpenGL_Clears);
if (!maxwell3d->ShouldExecute()) {
return;
}
const auto& regs = maxwell3d->regs; const auto& regs = maxwell3d->regs;
bool use_color{}; bool use_color{};

View File

@ -216,9 +216,6 @@ void RasterizerVulkan::Draw(bool is_indexed, u32 instance_count) {
void RasterizerVulkan::Clear(u32 layer_count) { void RasterizerVulkan::Clear(u32 layer_count) {
MICROPROFILE_SCOPE(Vulkan_Clearing); MICROPROFILE_SCOPE(Vulkan_Clearing);
if (!maxwell3d->ShouldExecute()) {
return;
}
FlushWork(); FlushWork();
query_cache.UpdateCounters(); query_cache.UpdateCounters();