summaryrefslogtreecommitdiffstats
path: root/src/video_core/engines/draw_manager.h
diff options
context:
space:
mode:
authorFeng Chen <vonchenplus@gmail.com>2022-12-06 06:45:26 +0100
committerFeng Chen <vonchenplus@gmail.com>2022-12-08 03:12:19 +0100
commitbf0b957c05013f33855e67c31a48e61b1e86d356 (patch)
tree72db2458cb7e5b7572b53527e0755d4fe45e9db0 /src/video_core/engines/draw_manager.h
parentMerge pull request #9381 from liamwhite/uninit (diff)
downloadyuzu-bf0b957c05013f33855e67c31a48e61b1e86d356.tar
yuzu-bf0b957c05013f33855e67c31a48e61b1e86d356.tar.gz
yuzu-bf0b957c05013f33855e67c31a48e61b1e86d356.tar.bz2
yuzu-bf0b957c05013f33855e67c31a48e61b1e86d356.tar.lz
yuzu-bf0b957c05013f33855e67c31a48e61b1e86d356.tar.xz
yuzu-bf0b957c05013f33855e67c31a48e61b1e86d356.tar.zst
yuzu-bf0b957c05013f33855e67c31a48e61b1e86d356.zip
Diffstat (limited to 'src/video_core/engines/draw_manager.h')
-rw-r--r--src/video_core/engines/draw_manager.h69
1 files changed, 69 insertions, 0 deletions
diff --git a/src/video_core/engines/draw_manager.h b/src/video_core/engines/draw_manager.h
new file mode 100644
index 000000000..4f67027ca
--- /dev/null
+++ b/src/video_core/engines/draw_manager.h
@@ -0,0 +1,69 @@
+// SPDX-FileCopyrightText: Copyright 2022 yuzu Emulator Project
+// SPDX-License-Identifier: GPL-2.0-or-later
+
+#pragma once
+#include "common/common_types.h"
+#include "video_core/engines/maxwell_3d.h"
+
+namespace VideoCore {
+class RasterizerInterface;
+}
+
+namespace Tegra::Engines {
+using PrimitiveTopology = Maxwell3D::Regs::PrimitiveTopology;
+using PrimitiveTopologyOverride = Maxwell3D::Regs::PrimitiveTopologyOverride;
+using IndexBuffer = Maxwell3D::Regs::IndexBuffer;
+using VertexBuffer = Maxwell3D::Regs::VertexBuffer;
+using IndexBufferSmall = Maxwell3D::Regs::IndexBufferSmall;
+
+class DrawManager {
+public:
+ enum class DrawMode : u32 { General = 0, Instance, InlineIndex };
+ struct State {
+ PrimitiveTopology topology{};
+ DrawMode draw_mode{};
+ bool draw_indexed{};
+ u32 base_index{};
+ VertexBuffer vertex_buffer;
+ IndexBuffer index_buffer;
+ u32 base_instance{};
+ u32 instance_count{};
+ std::vector<u8> inline_index_draw_indexes;
+ };
+
+ explicit DrawManager(Maxwell3D* maxwell_3d);
+
+ void ProcessMethodCall(u32 method, u32 argument);
+
+ void Clear(u32 layer_count);
+
+ void DrawDeferred();
+
+ void DrawArray(PrimitiveTopology topology, u32 vertex_first, u32 vertex_count,
+ u32 base_instance, u32 num_instances);
+
+ void DrawIndex(PrimitiveTopology topology, u32 index_first, u32 index_count, u32 base_index,
+ u32 base_instance, u32 num_instances);
+
+ const State& GetDrawState() const {
+ return draw_state;
+ }
+
+private:
+ void SetInlineIndexBuffer(u32 index);
+
+ void DrawBegin();
+
+ void DrawEnd(u32 instance_count = 1, bool force_draw = false);
+
+ void DrawIndexSmall(u32 argument);
+
+ void ProcessTopologyOverride();
+
+ void ProcessDraw(bool draw_indexed, u32 instance_count);
+
+ Maxwell3D* maxwell3d{};
+ State draw_state{};
+ bool use_topology_override{};
+};
+} // namespace Tegra::Engines