summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar ReinUsesLisp2020-02-14 18:09:37 -0300
committerGravatar ReinUsesLisp2020-02-14 18:09:40 -0300
commit91aa58e41072e648cd1d43d284b08c2a01af08a2 (patch)
treea8d4f0ab607c9e0868cdb4da65163318312a714d
parentMerge pull request #3401 from FernandoS27/synchronization (diff)
downloadyuzu-91aa58e41072e648cd1d43d284b08c2a01af08a2.tar.gz
yuzu-91aa58e41072e648cd1d43d284b08c2a01af08a2.tar.xz
yuzu-91aa58e41072e648cd1d43d284b08c2a01af08a2.zip
maxwell_3d: Unify draw methods
Pass instanced state of a draw invocation as an argument instead of having two separate virtual methods.
-rw-r--r--src/video_core/engines/maxwell_3d.cpp4
-rw-r--r--src/video_core/rasterizer_interface.h7
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp10
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h6
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.cpp10
-rw-r--r--src/video_core/renderer_vulkan/vk_rasterizer.h5
6 files changed, 6 insertions, 36 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index 0b3e8749b..5a74d1c2a 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -482,7 +482,7 @@ void Maxwell3D::FlushMMEInlineDraw() {
482 482
483 const bool is_indexed = mme_draw.current_mode == MMEDrawMode::Indexed; 483 const bool is_indexed = mme_draw.current_mode == MMEDrawMode::Indexed;
484 if (ShouldExecute()) { 484 if (ShouldExecute()) {
485 rasterizer.DrawMultiBatch(is_indexed); 485 rasterizer.Draw(is_indexed, true);
486 } 486 }
487 487
488 // TODO(bunnei): Below, we reset vertex count so that we can use these registers to determine if 488 // TODO(bunnei): Below, we reset vertex count so that we can use these registers to determine if
@@ -647,7 +647,7 @@ void Maxwell3D::DrawArrays() {
647 647
648 const bool is_indexed{regs.index_array.count && !regs.vertex_buffer.count}; 648 const bool is_indexed{regs.index_array.count && !regs.vertex_buffer.count};
649 if (ShouldExecute()) { 649 if (ShouldExecute()) {
650 rasterizer.DrawBatch(is_indexed); 650 rasterizer.Draw(is_indexed, false);
651 } 651 }
652 652
653 // TODO(bunnei): Below, we reset vertex count so that we can use these registers to determine if 653 // TODO(bunnei): Below, we reset vertex count so that we can use these registers to determine if
diff --git a/src/video_core/rasterizer_interface.h b/src/video_core/rasterizer_interface.h
index c586cd6fe..a8fc66711 100644
--- a/src/video_core/rasterizer_interface.h
+++ b/src/video_core/rasterizer_interface.h
@@ -29,11 +29,8 @@ class RasterizerInterface {
29public: 29public:
30 virtual ~RasterizerInterface() {} 30 virtual ~RasterizerInterface() {}
31 31
32 /// Draw the current batch of vertex arrays 32 /// Dispatches a draw invocation
33 virtual bool DrawBatch(bool is_indexed) = 0; 33 virtual void Draw(bool is_indexed, bool is_instanced) = 0;
34
35 /// Draw the current batch of multiple instances of vertex arrays
36 virtual bool DrawMultiBatch(bool is_indexed) = 0;
37 34
38 /// Clear the current framebuffer 35 /// Clear the current framebuffer
39 virtual void Clear() = 0; 36 virtual void Clear() = 0;
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index b0eb14c8b..048d43b89 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -657,16 +657,6 @@ void RasterizerOpenGL::Draw(bool is_indexed, bool is_instanced) {
657 } 657 }
658} 658}
659 659
660bool RasterizerOpenGL::DrawBatch(bool is_indexed) {
661 Draw(is_indexed, false);
662 return true;
663}
664
665bool RasterizerOpenGL::DrawMultiBatch(bool is_indexed) {
666 Draw(is_indexed, true);
667 return true;
668}
669
670void RasterizerOpenGL::DispatchCompute(GPUVAddr code_addr) { 660void RasterizerOpenGL::DispatchCompute(GPUVAddr code_addr) {
671 if (device.HasBrokenCompute()) { 661 if (device.HasBrokenCompute()) {
672 return; 662 return;
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index 0501f3828..bc28a3bcf 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -57,8 +57,7 @@ public:
57 ScreenInfo& info); 57 ScreenInfo& info);
58 ~RasterizerOpenGL() override; 58 ~RasterizerOpenGL() override;
59 59
60 bool DrawBatch(bool is_indexed) override; 60 void Draw(bool is_indexed, bool is_instanced) override;
61 bool DrawMultiBatch(bool is_indexed) override;
62 void Clear() override; 61 void Clear() override;
63 void DispatchCompute(GPUVAddr code_addr) override; 62 void DispatchCompute(GPUVAddr code_addr) override;
64 void FlushAll() override; 63 void FlushAll() override;
@@ -102,9 +101,6 @@ private:
102 void SetupGlobalMemory(u32 binding, const GLShader::GlobalMemoryEntry& entry, GPUVAddr gpu_addr, 101 void SetupGlobalMemory(u32 binding, const GLShader::GlobalMemoryEntry& entry, GPUVAddr gpu_addr,
103 std::size_t size); 102 std::size_t size);
104 103
105 /// Syncs all the state, shaders, render targets and textures setting before a draw call.
106 void Draw(bool is_indexed, bool is_instanced);
107
108 /// Configures the current textures to use for the draw command. 104 /// Configures the current textures to use for the draw command.
109 void SetupDrawTextures(std::size_t stage_index, const Shader& shader); 105 void SetupDrawTextures(std::size_t stage_index, const Shader& shader);
110 106
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.cpp b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
index aada38702..bfeaf98ac 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.cpp
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.cpp
@@ -293,16 +293,6 @@ RasterizerVulkan::RasterizerVulkan(Core::System& system, Core::Frontend::EmuWind
293 293
294RasterizerVulkan::~RasterizerVulkan() = default; 294RasterizerVulkan::~RasterizerVulkan() = default;
295 295
296bool RasterizerVulkan::DrawBatch(bool is_indexed) {
297 Draw(is_indexed, false);
298 return true;
299}
300
301bool RasterizerVulkan::DrawMultiBatch(bool is_indexed) {
302 Draw(is_indexed, true);
303 return true;
304}
305
306void RasterizerVulkan::Draw(bool is_indexed, bool is_instanced) { 296void RasterizerVulkan::Draw(bool is_indexed, bool is_instanced) {
307 MICROPROFILE_SCOPE(Vulkan_Drawing); 297 MICROPROFILE_SCOPE(Vulkan_Drawing);
308 298
diff --git a/src/video_core/renderer_vulkan/vk_rasterizer.h b/src/video_core/renderer_vulkan/vk_rasterizer.h
index 7be71e734..ff74de164 100644
--- a/src/video_core/renderer_vulkan/vk_rasterizer.h
+++ b/src/video_core/renderer_vulkan/vk_rasterizer.h
@@ -104,8 +104,7 @@ public:
104 VKScheduler& scheduler); 104 VKScheduler& scheduler);
105 ~RasterizerVulkan() override; 105 ~RasterizerVulkan() override;
106 106
107 bool DrawBatch(bool is_indexed) override; 107 void Draw(bool is_indexed, bool is_instanced) override;
108 bool DrawMultiBatch(bool is_indexed) override;
109 void Clear() override; 108 void Clear() override;
110 void DispatchCompute(GPUVAddr code_addr) override; 109 void DispatchCompute(GPUVAddr code_addr) override;
111 void FlushAll() override; 110 void FlushAll() override;
@@ -140,8 +139,6 @@ private:
140 139
141 static constexpr std::size_t ZETA_TEXCEPTION_INDEX = 8; 140 static constexpr std::size_t ZETA_TEXCEPTION_INDEX = 8;
142 141
143 void Draw(bool is_indexed, bool is_instanced);
144
145 void FlushWork(); 142 void FlushWork();
146 143
147 Texceptions UpdateAttachments(); 144 Texceptions UpdateAttachments();