summaryrefslogtreecommitdiffstats
path: root/src/video_core/macro
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2022-10-21 01:46:51 +0200
committerFernando Sahmkow <fsahmkow27@gmail.com>2023-01-01 22:43:57 +0100
commit93ac5a6a6d316966c1d288f8b83610bb48143a04 (patch)
treede24cc21ecb8b49d60d63356f18de6324be4cb38 /src/video_core/macro
parentMacroHLE: Refactor MacroHLE system. (diff)
downloadyuzu-93ac5a6a6d316966c1d288f8b83610bb48143a04.tar
yuzu-93ac5a6a6d316966c1d288f8b83610bb48143a04.tar.gz
yuzu-93ac5a6a6d316966c1d288f8b83610bb48143a04.tar.bz2
yuzu-93ac5a6a6d316966c1d288f8b83610bb48143a04.tar.lz
yuzu-93ac5a6a6d316966c1d288f8b83610bb48143a04.tar.xz
yuzu-93ac5a6a6d316966c1d288f8b83610bb48143a04.tar.zst
yuzu-93ac5a6a6d316966c1d288f8b83610bb48143a04.zip
Diffstat (limited to 'src/video_core/macro')
-rw-r--r--src/video_core/macro/macro_hle.cpp20
1 files changed, 13 insertions, 7 deletions
diff --git a/src/video_core/macro/macro_hle.cpp b/src/video_core/macro/macro_hle.cpp
index 79fab96e1..93b6d42a4 100644
--- a/src/video_core/macro/macro_hle.cpp
+++ b/src/video_core/macro/macro_hle.cpp
@@ -163,12 +163,16 @@ public:
maxwell3d.RefreshParameters();
minimum_limit = std::max(parameters[3], minimum_limit);
}
-
- const u32 base_vertex = parameters[8];
- const u32 base_instance = parameters[9];
- maxwell3d.regs.vertex_id_base = base_vertex;
+ const u32 estimate = static_cast<u32>(maxwell3d.EstimateIndexBufferSize());
+ const u32 base_size = std::max(minimum_limit, estimate);
+ const u32 element_base = parameters[4];
+ const u32 base_instance = parameters[5];
+ maxwell3d.regs.index_buffer.first = 0;
+ maxwell3d.regs.index_buffer.count = base_size; // Use a fixed size, just for mapping
+ maxwell3d.regs.draw.topology.Assign(topology);
+ maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true;
maxwell3d.CallMethod(0x8e3, 0x640, true);
- maxwell3d.CallMethod(0x8e4, base_vertex, true);
+ maxwell3d.CallMethod(0x8e4, element_base, true);
maxwell3d.CallMethod(0x8e5, base_instance, true);
auto& params = maxwell3d.draw_manager->GetIndirectParams();
params.is_indexed = true;
@@ -179,7 +183,7 @@ public:
params.max_draw_counts = 1;
params.stride = 0;
maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true;
- maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, minimum_limit);
+ maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, base_size);
maxwell3d.CallMethod(0x8e3, 0x640, true);
maxwell3d.CallMethod(0x8e4, 0x0, true);
maxwell3d.CallMethod(0x8e5, 0x0, true);
@@ -271,9 +275,11 @@ public:
if (check_limit) {
minimum_limit = std::max(highest_limit, minimum_limit);
}
+ const u32 estimate = static_cast<u32>(maxwell3d.EstimateIndexBufferSize());
+ const u32 base_size = std::max(minimum_limit, estimate);
maxwell3d.regs.index_buffer.first = 0;
- maxwell3d.regs.index_buffer.count = std::max(highest_limit, minimum_limit);
+ maxwell3d.regs.index_buffer.count = std::max(highest_limit, base_size);
maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true;
auto& params = maxwell3d.draw_manager->GetIndirectParams();
params.is_indexed = true;