summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/video_core/engines/maxwell_3d.cpp4
-rw-r--r--src/video_core/rasterizer_interface.h12
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.cpp29
-rw-r--r--src/video_core/renderer_opengl/gl_rasterizer.h6
4 files changed, 16 insertions, 35 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index d1f63a5eb..b8f071bc0 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -486,7 +486,7 @@ void Maxwell3D::FlushMMEInlineDraw() {
486 "Illegal combination of instancing parameters"); 486 "Illegal combination of instancing parameters");
487 487
488 const bool is_indexed = mme_draw.current_mode == MMMEDrawMode::Indexed; 488 const bool is_indexed = mme_draw.current_mode == MMMEDrawMode::Indexed;
489 rasterizer.AccelerateDrawMultiBatch(is_indexed); 489 rasterizer.DrawMultiBatch(is_indexed);
490 490
491 if (debug_context) { 491 if (debug_context) {
492 debug_context->OnEvent(Tegra::DebugContext::Event::FinishedPrimitiveBatch, nullptr); 492 debug_context->OnEvent(Tegra::DebugContext::Event::FinishedPrimitiveBatch, nullptr);
@@ -657,7 +657,7 @@ void Maxwell3D::DrawArrays() {
657 } 657 }
658 658
659 const bool is_indexed{regs.index_array.count && !regs.vertex_buffer.count}; 659 const bool is_indexed{regs.index_array.count && !regs.vertex_buffer.count};
660 rasterizer.AccelerateDrawBatch(is_indexed); 660 rasterizer.DrawBatch(is_indexed);
661 661
662 if (debug_context) { 662 if (debug_context) {
663 debug_context->OnEvent(Tegra::DebugContext::Event::FinishedPrimitiveBatch, nullptr); 663 debug_context->OnEvent(Tegra::DebugContext::Event::FinishedPrimitiveBatch, nullptr);
diff --git a/src/video_core/rasterizer_interface.h b/src/video_core/rasterizer_interface.h
index fe0d82255..deadd70ec 100644
--- a/src/video_core/rasterizer_interface.h
+++ b/src/video_core/rasterizer_interface.h
@@ -29,10 +29,10 @@ public:
29 virtual ~RasterizerInterface() {} 29 virtual ~RasterizerInterface() {}
30 30
31 /// Draw the current batch of vertex arrays 31 /// Draw the current batch of vertex arrays
32 virtual void DrawArrays() = 0; 32 virtual bool DrawBatch(bool is_indexed) = 0;
33 33
34 /// Draw the current batch of multiple instasnces of vertex arrays 34 /// Draw the current batch of multiple instasnces of vertex arrays
35 virtual void DrawMultiArrays() = 0; 35 virtual bool DrawMultiBatch(bool is_indexed) = 0;
36 36
37 /// Clear the current framebuffer 37 /// Clear the current framebuffer
38 virtual void Clear() = 0; 38 virtual void Clear() = 0;
@@ -72,14 +72,6 @@ public:
72 return false; 72 return false;
73 } 73 }
74 74
75 virtual bool AccelerateDrawBatch(bool is_indexed) {
76 return false;
77 }
78
79 virtual bool AccelerateDrawMultiBatch(bool is_indexed) {
80 return false;
81 }
82
83 /// Increase/decrease the number of object in pages touching the specified region 75 /// Increase/decrease the number of object in pages touching the specified region
84 virtual void UpdatePagesCachedCount(VAddr addr, u64 size, int delta) {} 76 virtual void UpdatePagesCachedCount(VAddr addr, u64 size, int delta) {}
85 77
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.cpp b/src/video_core/renderer_opengl/gl_rasterizer.cpp
index b86aa49f3..b5c55482f 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.cpp
+++ b/src/video_core/renderer_opengl/gl_rasterizer.cpp
@@ -342,18 +342,6 @@ std::size_t RasterizerOpenGL::CalculateIndexBufferSize() const {
342 static_cast<std::size_t>(regs.index_array.FormatSizeInBytes()); 342 static_cast<std::size_t>(regs.index_array.FormatSizeInBytes());
343} 343}
344 344
345bool RasterizerOpenGL::AccelerateDrawBatch(bool is_indexed) {
346 accelerate_draw = is_indexed ? AccelDraw::Indexed : AccelDraw::Arrays;
347 DrawArrays();
348 return true;
349}
350
351bool RasterizerOpenGL::AccelerateDrawMultiBatch(bool is_indexed) {
352 accelerate_draw = is_indexed ? AccelDraw::Indexed : AccelDraw::Arrays;
353 DrawMultiArrays();
354 return true;
355}
356
357template <typename Map, typename Interval> 345template <typename Map, typename Interval>
358static constexpr auto RangeFromInterval(Map& map, const Interval& interval) { 346static constexpr auto RangeFromInterval(Map& map, const Interval& interval) {
359 return boost::make_iterator_range(map.equal_range(interval)); 347 return boost::make_iterator_range(map.equal_range(interval));
@@ -764,14 +752,15 @@ struct DrawParams {
764 } 752 }
765}; 753};
766 754
767void RasterizerOpenGL::DrawArrays() { 755bool RasterizerOpenGL::DrawBatch(bool is_indexed) {
756 accelerate_draw = is_indexed ? AccelDraw::Indexed : AccelDraw::Arrays;
768 DrawPrelude(); 757 DrawPrelude();
769 758
770 auto& maxwell3d = system.GPU().Maxwell3D(); 759 auto& maxwell3d = system.GPU().Maxwell3D();
771 const auto& regs = maxwell3d.regs; 760 const auto& regs = maxwell3d.regs;
772 const auto current_instance = maxwell3d.state.current_instance; 761 const auto current_instance = maxwell3d.state.current_instance;
773 DrawParams draw_call{}; 762 DrawParams draw_call{};
774 draw_call.is_indexed = accelerate_draw == AccelDraw::Indexed; 763 draw_call.is_indexed = is_indexed;
775 draw_call.num_instances = static_cast<GLint>(1); 764 draw_call.num_instances = static_cast<GLint>(1);
776 draw_call.base_instance = static_cast<GLint>(current_instance); 765 draw_call.base_instance = static_cast<GLint>(current_instance);
777 draw_call.is_instanced = current_instance > 0; 766 draw_call.is_instanced = current_instance > 0;
@@ -787,19 +776,20 @@ void RasterizerOpenGL::DrawArrays() {
787 } 776 }
788 draw_call.DispatchDraw(); 777 draw_call.DispatchDraw();
789 778
790 accelerate_draw = AccelDraw::Disabled;
791 maxwell3d.dirty.memory_general = false; 779 maxwell3d.dirty.memory_general = false;
780 accelerate_draw = AccelDraw::Disabled;
781 return true;
792} 782}
793 783
794void RasterizerOpenGL::DrawMultiArrays() { 784bool RasterizerOpenGL::DrawMultiBatch(bool is_indexed) {
785 accelerate_draw = is_indexed ? AccelDraw::Indexed : AccelDraw::Arrays;
795 DrawPrelude(); 786 DrawPrelude();
796 787
797 auto& maxwell3d = system.GPU().Maxwell3D(); 788 auto& maxwell3d = system.GPU().Maxwell3D();
798 const auto& regs = maxwell3d.regs; 789 const auto& regs = maxwell3d.regs;
799 const auto& draw_setup = maxwell3d.mme_draw; 790 const auto& draw_setup = maxwell3d.mme_draw;
800 DrawParams draw_call{}; 791 DrawParams draw_call{};
801 draw_call.is_indexed = 792 draw_call.is_indexed = is_indexed;
802 draw_setup.current_mode == Tegra::Engines::Maxwell3D::MMMEDrawMode::Indexed;
803 draw_call.num_instances = static_cast<GLint>(draw_setup.instance_count); 793 draw_call.num_instances = static_cast<GLint>(draw_setup.instance_count);
804 draw_call.base_instance = static_cast<GLint>(regs.vb_base_instance); 794 draw_call.base_instance = static_cast<GLint>(regs.vb_base_instance);
805 draw_call.is_instanced = draw_setup.instance_count > 1; 795 draw_call.is_instanced = draw_setup.instance_count > 1;
@@ -815,8 +805,9 @@ void RasterizerOpenGL::DrawMultiArrays() {
815 } 805 }
816 draw_call.DispatchDraw(); 806 draw_call.DispatchDraw();
817 807
818 accelerate_draw = AccelDraw::Disabled;
819 maxwell3d.dirty.memory_general = false; 808 maxwell3d.dirty.memory_general = false;
809 accelerate_draw = AccelDraw::Disabled;
810 return true;
820} 811}
821 812
822void RasterizerOpenGL::DispatchCompute(GPUVAddr code_addr) { 813void RasterizerOpenGL::DispatchCompute(GPUVAddr code_addr) {
diff --git a/src/video_core/renderer_opengl/gl_rasterizer.h b/src/video_core/renderer_opengl/gl_rasterizer.h
index b4e21b9de..682f0becc 100644
--- a/src/video_core/renderer_opengl/gl_rasterizer.h
+++ b/src/video_core/renderer_opengl/gl_rasterizer.h
@@ -57,8 +57,8 @@ public:
57 ScreenInfo& info); 57 ScreenInfo& info);
58 ~RasterizerOpenGL() override; 58 ~RasterizerOpenGL() override;
59 59
60 void DrawArrays() override; 60 bool DrawBatch(bool is_indexed) override;
61 void DrawMultiArrays() override; 61 bool DrawMultiBatch(bool is_indexed) override;
62 void Clear() override; 62 void Clear() override;
63 void DispatchCompute(GPUVAddr code_addr) override; 63 void DispatchCompute(GPUVAddr code_addr) override;
64 void FlushAll() override; 64 void FlushAll() override;
@@ -72,8 +72,6 @@ public:
72 const Tegra::Engines::Fermi2D::Config& copy_config) override; 72 const Tegra::Engines::Fermi2D::Config& copy_config) override;
73 bool AccelerateDisplay(const Tegra::FramebufferConfig& config, VAddr framebuffer_addr, 73 bool AccelerateDisplay(const Tegra::FramebufferConfig& config, VAddr framebuffer_addr,
74 u32 pixel_stride) override; 74 u32 pixel_stride) override;
75 bool AccelerateDrawBatch(bool is_indexed) override;
76 bool AccelerateDrawMultiBatch(bool is_indexed) override;
77 void UpdatePagesCachedCount(VAddr addr, u64 size, int delta) override; 75 void UpdatePagesCachedCount(VAddr addr, u64 size, int delta) override;
78 void LoadDiskResources(const std::atomic_bool& stop_loading, 76 void LoadDiskResources(const std::atomic_bool& stop_loading,
79 const VideoCore::DiskResourceLoadCallback& callback) override; 77 const VideoCore::DiskResourceLoadCallback& callback) override;