summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2019-09-19 17:41:07 +0200
committerFernandoS27 <fsahmkow27@gmail.com>2019-09-19 17:41:33 +0200
commit7761e44d186deff278e51814bdec0c25e8e1a09c (patch)
tree03e9879770a0e847bdf5bd8de624bfe9e96f8809
parentRasterizer: Address Feedback and conscerns. (diff)
downloadyuzu-7761e44d186deff278e51814bdec0c25e8e1a09c.tar
yuzu-7761e44d186deff278e51814bdec0c25e8e1a09c.tar.gz
yuzu-7761e44d186deff278e51814bdec0c25e8e1a09c.tar.bz2
yuzu-7761e44d186deff278e51814bdec0c25e8e1a09c.tar.lz
yuzu-7761e44d186deff278e51814bdec0c25e8e1a09c.tar.xz
yuzu-7761e44d186deff278e51814bdec0c25e8e1a09c.tar.zst
yuzu-7761e44d186deff278e51814bdec0c25e8e1a09c.zip
-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() {
"Illegal combination of instancing parameters");
const bool is_indexed = mme_draw.current_mode == MMMEDrawMode::Indexed;
- rasterizer.AccelerateDrawMultiBatch(is_indexed);
+ rasterizer.DrawMultiBatch(is_indexed);
if (debug_context) {
debug_context->OnEvent(Tegra::DebugContext::Event::FinishedPrimitiveBatch, nullptr);
@@ -657,7 +657,7 @@ void Maxwell3D::DrawArrays() {
}
const bool is_indexed{regs.index_array.count && !regs.vertex_buffer.count};
- rasterizer.AccelerateDrawBatch(is_indexed);
+ rasterizer.DrawBatch(is_indexed);
if (debug_context) {
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:
virtual ~RasterizerInterface() {}
/// Draw the current batch of vertex arrays
- virtual void DrawArrays() = 0;
+ virtual bool DrawBatch(bool is_indexed) = 0;
/// Draw the current batch of multiple instasnces of vertex arrays
- virtual void DrawMultiArrays() = 0;
+ virtual bool DrawMultiBatch(bool is_indexed) = 0;
/// Clear the current framebuffer
virtual void Clear() = 0;
@@ -72,14 +72,6 @@ public:
return false;
}
- virtual bool AccelerateDrawBatch(bool is_indexed) {
- return false;
- }
-
- virtual bool AccelerateDrawMultiBatch(bool is_indexed) {
- return false;
- }
-
/// Increase/decrease the number of object in pages touching the specified region
virtual void UpdatePagesCachedCount(VAddr addr, u64 size, int delta) {}
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 {
static_cast<std::size_t>(regs.index_array.FormatSizeInBytes());
}
-bool RasterizerOpenGL::AccelerateDrawBatch(bool is_indexed) {
- accelerate_draw = is_indexed ? AccelDraw::Indexed : AccelDraw::Arrays;
- DrawArrays();
- return true;
-}
-
-bool RasterizerOpenGL::AccelerateDrawMultiBatch(bool is_indexed) {
- accelerate_draw = is_indexed ? AccelDraw::Indexed : AccelDraw::Arrays;
- DrawMultiArrays();
- return true;
-}
-
template <typename Map, typename Interval>
static constexpr auto RangeFromInterval(Map& map, const Interval& interval) {
return boost::make_iterator_range(map.equal_range(interval));
@@ -764,14 +752,15 @@ struct DrawParams {
}
};
-void RasterizerOpenGL::DrawArrays() {
+bool RasterizerOpenGL::DrawBatch(bool is_indexed) {
+ accelerate_draw = is_indexed ? AccelDraw::Indexed : AccelDraw::Arrays;
DrawPrelude();
auto& maxwell3d = system.GPU().Maxwell3D();
const auto& regs = maxwell3d.regs;
const auto current_instance = maxwell3d.state.current_instance;
DrawParams draw_call{};
- draw_call.is_indexed = accelerate_draw == AccelDraw::Indexed;
+ draw_call.is_indexed = is_indexed;
draw_call.num_instances = static_cast<GLint>(1);
draw_call.base_instance = static_cast<GLint>(current_instance);
draw_call.is_instanced = current_instance > 0;
@@ -787,19 +776,20 @@ void RasterizerOpenGL::DrawArrays() {
}
draw_call.DispatchDraw();
- accelerate_draw = AccelDraw::Disabled;
maxwell3d.dirty.memory_general = false;
+ accelerate_draw = AccelDraw::Disabled;
+ return true;
}
-void RasterizerOpenGL::DrawMultiArrays() {
+bool RasterizerOpenGL::DrawMultiBatch(bool is_indexed) {
+ accelerate_draw = is_indexed ? AccelDraw::Indexed : AccelDraw::Arrays;
DrawPrelude();
auto& maxwell3d = system.GPU().Maxwell3D();
const auto& regs = maxwell3d.regs;
const auto& draw_setup = maxwell3d.mme_draw;
DrawParams draw_call{};
- draw_call.is_indexed =
- draw_setup.current_mode == Tegra::Engines::Maxwell3D::MMMEDrawMode::Indexed;
+ draw_call.is_indexed = is_indexed;
draw_call.num_instances = static_cast<GLint>(draw_setup.instance_count);
draw_call.base_instance = static_cast<GLint>(regs.vb_base_instance);
draw_call.is_instanced = draw_setup.instance_count > 1;
@@ -815,8 +805,9 @@ void RasterizerOpenGL::DrawMultiArrays() {
}
draw_call.DispatchDraw();
- accelerate_draw = AccelDraw::Disabled;
maxwell3d.dirty.memory_general = false;
+ accelerate_draw = AccelDraw::Disabled;
+ return true;
}
void 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:
ScreenInfo& info);
~RasterizerOpenGL() override;
- void DrawArrays() override;
- void DrawMultiArrays() override;
+ bool DrawBatch(bool is_indexed) override;
+ bool DrawMultiBatch(bool is_indexed) override;
void Clear() override;
void DispatchCompute(GPUVAddr code_addr) override;
void FlushAll() override;
@@ -72,8 +72,6 @@ public:
const Tegra::Engines::Fermi2D::Config& copy_config) override;
bool AccelerateDisplay(const Tegra::FramebufferConfig& config, VAddr framebuffer_addr,
u32 pixel_stride) override;
- bool AccelerateDrawBatch(bool is_indexed) override;
- bool AccelerateDrawMultiBatch(bool is_indexed) override;
void UpdatePagesCachedCount(VAddr addr, u64 size, int delta) override;
void LoadDiskResources(const std::atomic_bool& stop_loading,
const VideoCore::DiskResourceLoadCallback& callback) override;