From fd00d63783eee02b6db557630a8695da731be115 Mon Sep 17 00:00:00 2001 From: pineappleEA Date: Sun, 11 Dec 2022 06:57:36 +0100 Subject: [PATCH] early-access version 3204 --- README.md | 2 +- src/video_core/engines/draw_manager.cpp | 58 +++++++++++-------- src/video_core/engines/draw_manager.h | 4 +- .../renderer_opengl/gl_rasterizer.cpp | 3 - .../renderer_vulkan/vk_rasterizer.cpp | 3 - 5 files changed, 37 insertions(+), 33 deletions(-) diff --git a/README.md b/README.md index b803095cb..e729cba7c 100755 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ yuzu emulator early access ============= -This is the source code for early-access 3203. +This is the source code for early-access 3204. ## Legal Notice diff --git a/src/video_core/engines/draw_manager.cpp b/src/video_core/engines/draw_manager.cpp index b213c374f..3a78421f6 100755 --- a/src/video_core/engines/draw_manager.cpp +++ b/src/video_core/engines/draw_manager.cpp @@ -46,21 +46,26 @@ void DrawManager::ProcessMethodCall(u32 method, u32 argument) { SetInlineIndexBuffer(regs.inline_index_4x8.index2); SetInlineIndexBuffer(regs.inline_index_4x8.index3); break; - case MAXWELL3D_REG_INDEX(topology_override): - use_topology_override = true; + case MAXWELL3D_REG_INDEX(vertex_array_instance_first): + case MAXWELL3D_REG_INDEX(vertex_array_instance_subsequent): { + LOG_WARNING(HW_GPU, "(STUBBED) called"); break; + } default: break; } } void DrawManager::Clear(u32 layer_count) { - maxwell3d->rasterizer->Clear(layer_count); + if (maxwell3d->ShouldExecute()) { + maxwell3d->rasterizer->Clear(layer_count); + } } 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; + } DrawEnd(draw_state.instance_count + 1, true); draw_state.instance_count = 0; } @@ -115,8 +120,9 @@ void DrawManager::DrawEnd(u32 instance_count, bool force_draw) { const auto& regs{maxwell3d->regs}; switch (draw_state.draw_mode) { case DrawMode::Instance: - if (!force_draw) + if (!force_draw) { break; + } [[fallthrough]]; case DrawMode::General: draw_state.base_instance = regs.global_base_instance_index; @@ -156,25 +162,28 @@ void DrawManager::DrawIndexSmall(u32 argument) { ProcessDraw(true, 1); } -void DrawManager::ProcessTopologyOverride() { - if (!use_topology_override) - return; - +void DrawManager::UpdateTopology() { const auto& regs{maxwell3d->regs}; - switch (regs.topology_override) { - case PrimitiveTopologyOverride::None: + switch (regs.primitive_topology_control) { + case PrimitiveTopologyControl::UseInBeginMethods: break; - case PrimitiveTopologyOverride::Points: - draw_state.topology = PrimitiveTopology::Points; - break; - case PrimitiveTopologyOverride::Lines: - draw_state.topology = PrimitiveTopology::Lines; - break; - case PrimitiveTopologyOverride::LineStrip: - draw_state.topology = PrimitiveTopology::LineStrip; - break; - default: - draw_state.topology = static_cast(regs.topology_override); + case PrimitiveTopologyControl::UseSeparateState: + switch (regs.topology_override) { + case PrimitiveTopologyOverride::None: + break; + case PrimitiveTopologyOverride::Points: + draw_state.topology = PrimitiveTopology::Points; + break; + case PrimitiveTopologyOverride::Lines: + draw_state.topology = PrimitiveTopology::Lines; + break; + case PrimitiveTopologyOverride::LineStrip: + draw_state.topology = PrimitiveTopology::LineStrip; + break; + default: + draw_state.topology = static_cast(regs.topology_override); + break; + } break; } } @@ -183,9 +192,10 @@ void DrawManager::ProcessDraw(bool draw_indexed, u32 instance_count) { LOG_TRACE(HW_GPU, "called, topology={}, count={}", draw_state.topology, draw_indexed ? draw_state.index_buffer.count : draw_state.vertex_buffer.count); - ProcessTopologyOverride(); + UpdateTopology(); - if (maxwell3d->ShouldExecute()) + if (maxwell3d->ShouldExecute()) { maxwell3d->rasterizer->Draw(draw_indexed, instance_count); + } } } // namespace Tegra::Engines diff --git a/src/video_core/engines/draw_manager.h b/src/video_core/engines/draw_manager.h index 4f67027ca..0e6930a9c 100755 --- a/src/video_core/engines/draw_manager.h +++ b/src/video_core/engines/draw_manager.h @@ -10,6 +10,7 @@ class RasterizerInterface; } namespace Tegra::Engines { +using PrimitiveTopologyControl = Maxwell3D::Regs::PrimitiveTopologyControl; using PrimitiveTopology = Maxwell3D::Regs::PrimitiveTopology; using PrimitiveTopologyOverride = Maxwell3D::Regs::PrimitiveTopologyOverride; using IndexBuffer = Maxwell3D::Regs::IndexBuffer; @@ -58,12 +59,11 @@ private: void DrawIndexSmall(u32 argument); - void ProcessTopologyOverride(); + void UpdateTopology(); void ProcessDraw(bool draw_indexed, u32 instance_count); Maxwell3D* maxwell3d{}; State draw_state{}; - bool use_topology_override{}; }; } // namespace Tegra::Engines diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp index 5b054d6fe..cdbf4dd1d 100755 --- a/src/video_core/renderer_opengl/gl_rasterizer.cpp +++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp @@ -138,9 +138,6 @@ void RasterizerOpenGL::LoadDiskResources(u64 title_id, std::stop_token stop_load void RasterizerOpenGL::Clear(u32 layer_count) { MICROPROFILE_SCOPE(OpenGL_Clears); - if (!maxwell3d->ShouldExecute()) { - return; - } const auto& regs = maxwell3d->regs; bool use_color{}; diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp index 6a84b3e33..b579cb74b 100755 --- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp +++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp @@ -216,9 +216,6 @@ void RasterizerVulkan::Draw(bool is_indexed, u32 instance_count) { void RasterizerVulkan::Clear(u32 layer_count) { MICROPROFILE_SCOPE(Vulkan_Clearing); - if (!maxwell3d->ShouldExecute()) { - return; - } FlushWork(); query_cache.UpdateCounters();