From a5a94f52ffcbf3119d272a9369021a213ea6dad2 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Wed, 9 Feb 2022 15:00:05 +0100 Subject: MacroHLE: Add MultidrawIndirect HLE Macro. --- src/video_core/macro/macro_hle.cpp | 53 +++++++++++++++++++------------------- 1 file changed, 27 insertions(+), 26 deletions(-) (limited to 'src/video_core/macro/macro_hle.cpp') diff --git a/src/video_core/macro/macro_hle.cpp b/src/video_core/macro/macro_hle.cpp index 8549db2e4..1cc202cc7 100644 --- a/src/video_core/macro/macro_hle.cpp +++ b/src/video_core/macro/macro_hle.cpp @@ -53,42 +53,43 @@ void HLE_0217920100488FF7(Engines::Maxwell3D& maxwell3d, const std::vector& // Multidraw Indirect void HLE_3F5E74B9C9A50164(Engines::Maxwell3D& maxwell3d, const std::vector& parameters) { - SCOPE_EXIT({ - // Clean everything. - maxwell3d.regs.vertex_id_base = 0x0; - maxwell3d.CallMethod(0x8e3, 0x640, true); - maxwell3d.CallMethod(0x8e4, 0x0, true); - maxwell3d.CallMethod(0x8e5, 0x0, true); - maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; - }); const u32 start_indirect = parameters[0]; const u32 end_indirect = parameters[1]; if (start_indirect >= end_indirect) { // Nothing to do. return; } - const u32 padding = parameters[3]; - const std::size_t max_draws = parameters[4]; + const auto topology = + static_cast(parameters[2]); + const u32 padding = parameters[3]; // padding is in words + // size of each indirect segment const u32 indirect_words = 5 + padding; - const std::size_t first_draw = start_indirect; - const std::size_t effective_draws = end_indirect - start_indirect; - const std::size_t last_draw = start_indirect + std::min(effective_draws, max_draws); - - for (std::size_t index = first_draw; index < last_draw; index++) { + const u32 stride = indirect_words * sizeof(u32); + const GPUVAddr start_address = maxwell3d.current_dma_segment + 4 * sizeof(u32); + const std::size_t draw_count = end_indirect - start_indirect; + u32 lowest_first = std::numeric_limits::max(); + u32 highest_limit = std::numeric_limits::min(); + for (std::size_t index = 0; index < draw_count; index++) { const std::size_t base = index * indirect_words + 5; - const u32 base_vertex = parameters[base + 3]; - const u32 base_instance = parameters[base + 4]; - maxwell3d.regs.vertex_id_base = base_vertex; - maxwell3d.CallMethod(0x8e3, 0x640, true); - maxwell3d.CallMethod(0x8e4, base_vertex, true); - maxwell3d.CallMethod(0x8e5, base_instance, true); - maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; - maxwell3d.draw_manager->DrawIndex( - static_cast(parameters[2]), - parameters[base + 2], parameters[base], base_vertex, base_instance, - parameters[base + 1]); + const u32 count = parameters[base]; + const u32 first_index = parameters[base + 2]; + lowest_first = std::min(lowest_first, first_index); + highest_limit = std::max(highest_limit, first_index + count); } + + const u32 base_vertex = parameters[8]; + const u32 base_instance = parameters[9]; + maxwell3d.CallMethod(0x8e3, 0x640, true); + maxwell3d.CallMethod(0x8e4, base_vertex, true); + maxwell3d.CallMethod(0x8e5, base_instance, true); + auto& params = maxwell3d.draw_manager->GetIndirectParams(); + params.start_address = start_address; + params.buffer_size = sizeof(u32) + stride * draw_count; + params.max_draw_counts = draw_count; + params.stride = stride; + maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; + maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, highest_limit); } // Multi-layer Clear -- cgit v1.2.3 From 0f89828073a541eaa2cfd985483f839bd2f97b74 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Wed, 9 Feb 2022 15:39:40 +0100 Subject: MacroHLE: Implement DrawIndexedIndirect & DrawArraysIndirect. --- src/video_core/macro/macro_hle.cpp | 45 ++++++++++++++++++++++++-------------- 1 file changed, 29 insertions(+), 16 deletions(-) (limited to 'src/video_core/macro/macro_hle.cpp') diff --git a/src/video_core/macro/macro_hle.cpp b/src/video_core/macro/macro_hle.cpp index 1cc202cc7..da988cc0d 100644 --- a/src/video_core/macro/macro_hle.cpp +++ b/src/video_core/macro/macro_hle.cpp @@ -9,6 +9,7 @@ #include "video_core/engines/maxwell_3d.h" #include "video_core/macro/macro.h" #include "video_core/macro/macro_hle.h" +#include "video_core/memory_manager.h" #include "video_core/rasterizer_interface.h" namespace Tegra { @@ -24,15 +25,14 @@ void HLE_771BB18C62444DA0(Engines::Maxwell3D& maxwell3d, const std::vector& parameters[4], parameters[1], parameters[3], parameters[5], instance_count); } -void HLE_0D61FC9FAAC9FCAD(Engines::Maxwell3D& maxwell3d, const std::vector& parameters) { +void HLE_DrawArraysIndirect(Engines::Maxwell3D& maxwell3d, const std::vector& parameters) { const u32 instance_count = (maxwell3d.GetRegisterValue(0xD1B) & parameters[2]); maxwell3d.draw_manager->DrawArray( static_cast(parameters[0]), parameters[3], parameters[1], parameters[4], instance_count); } -void HLE_0217920100488FF7(Engines::Maxwell3D& maxwell3d, const std::vector& parameters) { - const u32 instance_count = (maxwell3d.GetRegisterValue(0xD1B) & parameters[2]); +void HLE_DrawIndexedIndirect(Engines::Maxwell3D& maxwell3d, const std::vector& parameters) { const u32 element_base = parameters[4]; const u32 base_instance = parameters[5]; maxwell3d.regs.vertex_id_base = element_base; @@ -41,9 +41,18 @@ void HLE_0217920100488FF7(Engines::Maxwell3D& maxwell3d, const std::vector& maxwell3d.CallMethod(0x8e4, element_base, true); maxwell3d.CallMethod(0x8e5, base_instance, true); - maxwell3d.draw_manager->DrawIndex( - static_cast(parameters[0]), - parameters[3], parameters[1], element_base, base_instance, instance_count); + auto& params = maxwell3d.draw_manager->GetIndirectParams(); + params.is_indexed = true; + params.include_count = false; + params.count_start_address = 0; + params.indirect_start_address = maxwell3d.macro_addresses[1]; + params.buffer_size = 5 * sizeof(u32); + params.max_draw_counts = 1; + params.stride = 0; + + maxwell3d.draw_manager->DrawIndexedIndirect( + static_cast(parameters[0]), 0, + 1U << 18); maxwell3d.regs.vertex_id_base = 0x0; maxwell3d.CallMethod(0x8e3, 0x640, true); @@ -51,8 +60,9 @@ void HLE_0217920100488FF7(Engines::Maxwell3D& maxwell3d, const std::vector& maxwell3d.CallMethod(0x8e5, 0x0, true); } -// Multidraw Indirect -void HLE_3F5E74B9C9A50164(Engines::Maxwell3D& maxwell3d, const std::vector& parameters) { +// Multidraw Indixed Indirect +void HLE_MultiDrawIndexedIndirect(Engines::Maxwell3D& maxwell3d, + const std::vector& parameters) { const u32 start_indirect = parameters[0]; const u32 end_indirect = parameters[1]; if (start_indirect >= end_indirect) { @@ -66,7 +76,6 @@ void HLE_3F5E74B9C9A50164(Engines::Maxwell3D& maxwell3d, const std::vector& // size of each indirect segment const u32 indirect_words = 5 + padding; const u32 stride = indirect_words * sizeof(u32); - const GPUVAddr start_address = maxwell3d.current_dma_segment + 4 * sizeof(u32); const std::size_t draw_count = end_indirect - start_indirect; u32 lowest_first = std::numeric_limits::max(); u32 highest_limit = std::numeric_limits::min(); @@ -80,12 +89,16 @@ void HLE_3F5E74B9C9A50164(Engines::Maxwell3D& maxwell3d, const std::vector& const u32 base_vertex = parameters[8]; const u32 base_instance = parameters[9]; + maxwell3d.regs.vertex_id_base = base_vertex; maxwell3d.CallMethod(0x8e3, 0x640, true); maxwell3d.CallMethod(0x8e4, base_vertex, true); maxwell3d.CallMethod(0x8e5, base_instance, true); auto& params = maxwell3d.draw_manager->GetIndirectParams(); - params.start_address = start_address; - params.buffer_size = sizeof(u32) + stride * draw_count; + params.is_indexed = true; + params.include_count = true; + params.count_start_address = maxwell3d.macro_addresses[4]; + params.indirect_start_address = maxwell3d.macro_addresses[5]; + params.buffer_size = stride * draw_count; params.max_draw_counts = draw_count; params.stride = stride; maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; @@ -93,7 +106,7 @@ void HLE_3F5E74B9C9A50164(Engines::Maxwell3D& maxwell3d, const std::vector& } // Multi-layer Clear -void HLE_EAD26C3E2109B06B(Engines::Maxwell3D& maxwell3d, const std::vector& parameters) { +void HLE_MultiLayerClear(Engines::Maxwell3D& maxwell3d, const std::vector& parameters) { ASSERT(parameters.size() == 1); const Engines::Maxwell3D::Regs::ClearSurface clear_params{parameters[0]}; @@ -107,10 +120,10 @@ void HLE_EAD26C3E2109B06B(Engines::Maxwell3D& maxwell3d, const std::vector& constexpr std::array, 5> hle_funcs{{ {0x771BB18C62444DA0, &HLE_771BB18C62444DA0}, - {0x0D61FC9FAAC9FCAD, &HLE_0D61FC9FAAC9FCAD}, - {0x0217920100488FF7, &HLE_0217920100488FF7}, - {0x3F5E74B9C9A50164, &HLE_3F5E74B9C9A50164}, - {0xEAD26C3E2109B06B, &HLE_EAD26C3E2109B06B}, + {0x0D61FC9FAAC9FCAD, &HLE_DrawArraysIndirect}, + {0x0217920100488FF7, &HLE_DrawIndexedIndirect}, + {0x3F5E74B9C9A50164, &HLE_MultiDrawIndexedIndirect}, + {0xEAD26C3E2109B06B, &HLE_MultiLayerClear}, }}; class HLEMacroImpl final : public CachedMacro { -- cgit v1.2.3 From c541559767c3912940ee3d73a122530b3edde9f1 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Sat, 5 Mar 2022 08:01:13 +0100 Subject: MacroHLE: Refactor MacroHLE system. --- src/video_core/macro/macro_hle.cpp | 445 ++++++++++++++++++++++++++++--------- 1 file changed, 334 insertions(+), 111 deletions(-) (limited to 'src/video_core/macro/macro_hle.cpp') diff --git a/src/video_core/macro/macro_hle.cpp b/src/video_core/macro/macro_hle.cpp index da988cc0d..79fab96e1 100644 --- a/src/video_core/macro/macro_hle.cpp +++ b/src/video_core/macro/macro_hle.cpp @@ -3,6 +3,7 @@ #include #include +#include "common/assert.h" #include "common/scope_exit.h" #include "video_core/dirty_flags.h" #include "video_core/engines/draw_manager.h" @@ -15,143 +16,365 @@ namespace Tegra { namespace { -using HLEFunction = void (*)(Engines::Maxwell3D& maxwell3d, const std::vector& parameters); - -// HLE'd functions -void HLE_771BB18C62444DA0(Engines::Maxwell3D& maxwell3d, const std::vector& parameters) { - const u32 instance_count = parameters[2] & maxwell3d.GetRegisterValue(0xD1B); - maxwell3d.draw_manager->DrawIndex( - static_cast(parameters[0] & 0x3ffffff), - parameters[4], parameters[1], parameters[3], parameters[5], instance_count); +bool IsTopologySafe(Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology topology) { + switch (topology) { + case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::Points: + case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::Lines: + case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::LineLoop: + case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::LineStrip: + case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::Triangles: + case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::TriangleStrip: + case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::TriangleFan: + case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::LinesAdjacency: + case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::LineStripAdjacency: + case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::TrianglesAdjacency: + case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::TriangleStripAdjacency: + case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::Patches: + return true; + case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::Quads: + case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::QuadStrip: + case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::Polygon: + default: + return false; + } } -void HLE_DrawArraysIndirect(Engines::Maxwell3D& maxwell3d, const std::vector& parameters) { - const u32 instance_count = (maxwell3d.GetRegisterValue(0xD1B) & parameters[2]); - maxwell3d.draw_manager->DrawArray( - static_cast(parameters[0]), - parameters[3], parameters[1], parameters[4], instance_count); -} +class HLEMacroImpl : public CachedMacro { +public: + explicit HLEMacroImpl(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} {} -void HLE_DrawIndexedIndirect(Engines::Maxwell3D& maxwell3d, const std::vector& parameters) { - const u32 element_base = parameters[4]; - const u32 base_instance = parameters[5]; - maxwell3d.regs.vertex_id_base = element_base; - maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; - maxwell3d.CallMethod(0x8e3, 0x640, true); - maxwell3d.CallMethod(0x8e4, element_base, true); - maxwell3d.CallMethod(0x8e5, base_instance, true); - - auto& params = maxwell3d.draw_manager->GetIndirectParams(); - params.is_indexed = true; - params.include_count = false; - params.count_start_address = 0; - params.indirect_start_address = maxwell3d.macro_addresses[1]; - params.buffer_size = 5 * sizeof(u32); - params.max_draw_counts = 1; - params.stride = 0; - - maxwell3d.draw_manager->DrawIndexedIndirect( - static_cast(parameters[0]), 0, - 1U << 18); - - maxwell3d.regs.vertex_id_base = 0x0; - maxwell3d.CallMethod(0x8e3, 0x640, true); - maxwell3d.CallMethod(0x8e4, 0x0, true); - maxwell3d.CallMethod(0x8e5, 0x0, true); -} +protected: + void advanceCheck() { + current_value = (current_value + 1) % fibonacci_post; + check_limit = current_value == 0; + if (check_limit) { + const u32 new_fibonacci = fibonacci_pre + fibonacci_post; + fibonacci_pre = fibonacci_post; + fibonacci_post = new_fibonacci; + } + } + + Engines::Maxwell3D& maxwell3d; + u32 fibonacci_pre{89}; + u32 fibonacci_post{144}; + u32 current_value{fibonacci_post - 1}; + bool check_limit{}; +}; + +class HLE_771BB18C62444DA0 final : public HLEMacroImpl { +public: + explicit HLE_771BB18C62444DA0(Engines::Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} -// Multidraw Indixed Indirect -void HLE_MultiDrawIndexedIndirect(Engines::Maxwell3D& maxwell3d, - const std::vector& parameters) { - const u32 start_indirect = parameters[0]; - const u32 end_indirect = parameters[1]; - if (start_indirect >= end_indirect) { - // Nothing to do. - return; + void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { + maxwell3d.RefreshParameters(); + const u32 instance_count = parameters[2] & maxwell3d.GetRegisterValue(0xD1B); + maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; + maxwell3d.draw_manager->DrawIndex( + static_cast(parameters[0] & + 0x3ffffff), + parameters[4], parameters[1], parameters[3], parameters[5], instance_count); } - const auto topology = - static_cast(parameters[2]); - const u32 padding = parameters[3]; // padding is in words - - // size of each indirect segment - const u32 indirect_words = 5 + padding; - const u32 stride = indirect_words * sizeof(u32); - const std::size_t draw_count = end_indirect - start_indirect; - u32 lowest_first = std::numeric_limits::max(); - u32 highest_limit = std::numeric_limits::min(); - for (std::size_t index = 0; index < draw_count; index++) { - const std::size_t base = index * indirect_words + 5; - const u32 count = parameters[base]; - const u32 first_index = parameters[base + 2]; - lowest_first = std::min(lowest_first, first_index); - highest_limit = std::max(highest_limit, first_index + count); +}; + +class HLE_DrawArraysIndirect final : public HLEMacroImpl { +public: + explicit HLE_DrawArraysIndirect(Engines::Maxwell3D& maxwell3d_, bool extended_ = false) + : HLEMacroImpl(maxwell3d_), extended(extended_) {} + + void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { + auto topology = + static_cast(parameters[0]); + if (!IsTopologySafe(topology)) { + Fallback(parameters); + return; + } + + auto& params = maxwell3d.draw_manager->GetIndirectParams(); + params.is_indexed = false; + params.include_count = false; + params.count_start_address = 0; + params.indirect_start_address = maxwell3d.getMacroAddress(1); + params.buffer_size = 4 * sizeof(u32); + params.max_draw_counts = 1; + params.stride = 0; + + if (extended) { + maxwell3d.CallMethod(0x8e3, 0x640, true); + maxwell3d.CallMethod(0x8e4, parameters[4], true); + } + + maxwell3d.draw_manager->DrawArrayIndirect(topology); + + if (extended) { + maxwell3d.CallMethod(0x8e3, 0x640, true); + maxwell3d.CallMethod(0x8e4, 0, true); + } + maxwell3d.regs.vertex_buffer.first = 0; + maxwell3d.regs.vertex_buffer.count = 0; } - const u32 base_vertex = parameters[8]; - const u32 base_instance = parameters[9]; - maxwell3d.regs.vertex_id_base = base_vertex; - maxwell3d.CallMethod(0x8e3, 0x640, true); - maxwell3d.CallMethod(0x8e4, base_vertex, true); - maxwell3d.CallMethod(0x8e5, base_instance, true); - auto& params = maxwell3d.draw_manager->GetIndirectParams(); - params.is_indexed = true; - params.include_count = true; - params.count_start_address = maxwell3d.macro_addresses[4]; - params.indirect_start_address = maxwell3d.macro_addresses[5]; - params.buffer_size = stride * draw_count; - params.max_draw_counts = draw_count; - params.stride = stride; - maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; - maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, highest_limit); -} +private: + void Fallback(const std::vector& parameters) { + SCOPE_EXIT({ + if (extended) { + maxwell3d.CallMethod(0x8e3, 0x640, true); + maxwell3d.CallMethod(0x8e4, 0, true); + } + }); + maxwell3d.RefreshParameters(); + const u32 instance_count = (maxwell3d.GetRegisterValue(0xD1B) & parameters[2]); -// Multi-layer Clear -void HLE_MultiLayerClear(Engines::Maxwell3D& maxwell3d, const std::vector& parameters) { - ASSERT(parameters.size() == 1); + const u32 vertex_first = parameters[3]; + const u32 vertex_count = parameters[1]; - const Engines::Maxwell3D::Regs::ClearSurface clear_params{parameters[0]}; - const u32 rt_index = clear_params.RT; - const u32 num_layers = maxwell3d.regs.rt[rt_index].depth; - ASSERT(clear_params.layer == 0); + if (maxwell3d.GetMaxCurrentVertices() < vertex_first + vertex_count) { + ASSERT_MSG(false, "Faulty draw!"); + return; + } - maxwell3d.regs.clear_surface.raw = clear_params.raw; - maxwell3d.draw_manager->Clear(num_layers); -} + const u32 base_instance = parameters[4]; + if (extended) { + maxwell3d.CallMethod(0x8e3, 0x640, true); + maxwell3d.CallMethod(0x8e4, base_instance, true); + } + + maxwell3d.draw_manager->DrawArray( + static_cast(parameters[0]), + vertex_first, vertex_count, base_instance, instance_count); + } -constexpr std::array, 5> hle_funcs{{ - {0x771BB18C62444DA0, &HLE_771BB18C62444DA0}, - {0x0D61FC9FAAC9FCAD, &HLE_DrawArraysIndirect}, - {0x0217920100488FF7, &HLE_DrawIndexedIndirect}, - {0x3F5E74B9C9A50164, &HLE_MultiDrawIndexedIndirect}, - {0xEAD26C3E2109B06B, &HLE_MultiLayerClear}, -}}; + bool extended; +}; -class HLEMacroImpl final : public CachedMacro { +class HLE_DrawIndexedIndirect final : public HLEMacroImpl { public: - explicit HLEMacroImpl(Engines::Maxwell3D& maxwell3d_, HLEFunction func_) - : maxwell3d{maxwell3d_}, func{func_} {} + explicit HLE_DrawIndexedIndirect(Engines::Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} - void Execute(const std::vector& parameters, u32 method) override { - func(maxwell3d, parameters); + void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { + auto topology = + static_cast(parameters[0]); + if (!IsTopologySafe(topology)) { + Fallback(parameters); + return; + } + + advanceCheck(); + if (check_limit) { + 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; + maxwell3d.CallMethod(0x8e3, 0x640, true); + maxwell3d.CallMethod(0x8e4, base_vertex, true); + maxwell3d.CallMethod(0x8e5, base_instance, true); + auto& params = maxwell3d.draw_manager->GetIndirectParams(); + params.is_indexed = true; + params.include_count = false; + params.count_start_address = 0; + params.indirect_start_address = maxwell3d.getMacroAddress(1); + params.buffer_size = 5 * sizeof(u32); + params.max_draw_counts = 1; + params.stride = 0; + maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; + maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, minimum_limit); + maxwell3d.CallMethod(0x8e3, 0x640, true); + maxwell3d.CallMethod(0x8e4, 0x0, true); + maxwell3d.CallMethod(0x8e5, 0x0, true); } private: - Engines::Maxwell3D& maxwell3d; - HLEFunction func; + void Fallback(const std::vector& parameters) { + maxwell3d.RefreshParameters(); + const u32 instance_count = (maxwell3d.GetRegisterValue(0xD1B) & parameters[2]); + const u32 element_base = parameters[4]; + const u32 base_instance = parameters[5]; + maxwell3d.regs.vertex_id_base = element_base; + maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; + maxwell3d.CallMethod(0x8e3, 0x640, true); + maxwell3d.CallMethod(0x8e4, element_base, true); + maxwell3d.CallMethod(0x8e5, base_instance, true); + + maxwell3d.draw_manager->DrawIndex( + static_cast(parameters[0]), + parameters[3], parameters[1], element_base, base_instance, instance_count); + + maxwell3d.regs.vertex_id_base = 0x0; + maxwell3d.CallMethod(0x8e3, 0x640, true); + maxwell3d.CallMethod(0x8e4, 0x0, true); + maxwell3d.CallMethod(0x8e5, 0x0, true); + } + + u32 minimum_limit{1 << 18}; +}; + +class HLE_MultiLayerClear final : public HLEMacroImpl { +public: + explicit HLE_MultiLayerClear(Engines::Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} + + void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { + maxwell3d.RefreshParameters(); + ASSERT(parameters.size() == 1); + + const Engines::Maxwell3D::Regs::ClearSurface clear_params{parameters[0]}; + const u32 rt_index = clear_params.RT; + const u32 num_layers = maxwell3d.regs.rt[rt_index].depth; + ASSERT(clear_params.layer == 0); + + maxwell3d.regs.clear_surface.raw = clear_params.raw; + maxwell3d.draw_manager->Clear(num_layers); + } +}; + +class HLE_MultiDrawIndexedIndirectCount final : public HLEMacroImpl { +public: + explicit HLE_MultiDrawIndexedIndirectCount(Engines::Maxwell3D& maxwell3d_) + : HLEMacroImpl(maxwell3d_) {} + + void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { + const auto topology = + static_cast(parameters[2]); + if (!IsTopologySafe(topology)) { + Fallback(parameters); + return; + } + + advanceCheck(); + if (check_limit) { + maxwell3d.RefreshParameters(); + } + const u32 start_indirect = parameters[0]; + const u32 end_indirect = parameters[1]; + if (start_indirect >= end_indirect) { + // Nothing to do. + return; + } + + maxwell3d.regs.draw.topology.Assign(topology); + const u32 padding = parameters[3]; // padding is in words + + // size of each indirect segment + const u32 indirect_words = 5 + padding; + const u32 stride = indirect_words * sizeof(u32); + const std::size_t draw_count = end_indirect - start_indirect; + u32 lowest_first = std::numeric_limits::max(); + u32 highest_limit = std::numeric_limits::min(); + for (std::size_t index = 0; index < draw_count; index++) { + const std::size_t base = index * indirect_words + 5; + const u32 count = parameters[base]; + const u32 first_index = parameters[base + 2]; + lowest_first = std::min(lowest_first, first_index); + highest_limit = std::max(highest_limit, first_index + count); + } + if (check_limit) { + minimum_limit = std::max(highest_limit, minimum_limit); + } + + maxwell3d.regs.index_buffer.first = 0; + maxwell3d.regs.index_buffer.count = std::max(highest_limit, minimum_limit); + maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; + auto& params = maxwell3d.draw_manager->GetIndirectParams(); + params.is_indexed = true; + params.include_count = true; + params.count_start_address = maxwell3d.getMacroAddress(4); + params.indirect_start_address = maxwell3d.getMacroAddress(5); + params.buffer_size = stride * draw_count; + params.max_draw_counts = draw_count; + params.stride = stride; + maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; + maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, highest_limit); + } + +private: + void Fallback(const std::vector& parameters) { + SCOPE_EXIT({ + // Clean everything. + // Clean everything. + maxwell3d.regs.vertex_id_base = 0x0; + maxwell3d.CallMethod(0x8e3, 0x640, true); + maxwell3d.CallMethod(0x8e4, 0x0, true); + maxwell3d.CallMethod(0x8e5, 0x0, true); + }); + maxwell3d.RefreshParameters(); + const u32 start_indirect = parameters[0]; + const u32 end_indirect = parameters[1]; + if (start_indirect >= end_indirect) { + // Nothing to do. + return; + } + const auto topology = + static_cast(parameters[2]); + maxwell3d.regs.draw.topology.Assign(topology); + const u32 padding = parameters[3]; + const std::size_t max_draws = parameters[4]; + + const u32 indirect_words = 5 + padding; + const std::size_t first_draw = start_indirect; + const std::size_t effective_draws = end_indirect - start_indirect; + const std::size_t last_draw = start_indirect + std::min(effective_draws, max_draws); + + for (std::size_t index = first_draw; index < last_draw; index++) { + const std::size_t base = index * indirect_words + 5; + const u32 base_vertex = parameters[base + 3]; + const u32 base_instance = parameters[base + 4]; + maxwell3d.regs.vertex_id_base = base_vertex; + maxwell3d.CallMethod(0x8e3, 0x640, true); + maxwell3d.CallMethod(0x8e4, base_vertex, true); + maxwell3d.CallMethod(0x8e5, base_instance, true); + maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; + maxwell3d.draw_manager->DrawIndex(topology, parameters[base + 2], parameters[base], + base_vertex, base_instance, parameters[base + 1]); + } + } + + u32 minimum_limit{1 << 12}; }; } // Anonymous namespace -HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} {} +HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} { + builders.emplace(0x771BB18C62444DA0ULL, + std::function(Engines::Maxwell3D&)>( + [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr { + return std::make_unique(maxwell3d); + })); + builders.emplace(0x0D61FC9FAAC9FCADULL, + std::function(Engines::Maxwell3D&)>( + [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr { + return std::make_unique(maxwell3d); + })); + builders.emplace(0x8A4D173EB99A8603ULL, + std::function(Engines::Maxwell3D&)>( + [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr { + return std::make_unique(maxwell3d, true); + })); + builders.emplace(0x0217920100488FF7ULL, + std::function(Engines::Maxwell3D&)>( + [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr { + return std::make_unique(maxwell3d); + })); + builders.emplace(0x3F5E74B9C9A50164ULL, + std::function(Engines::Maxwell3D&)>( + [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr { + return std::make_unique(maxwell3d); + })); + builders.emplace(0xEAD26C3E2109B06BULL, + std::function(Engines::Maxwell3D&)>( + [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr { + return std::make_unique(maxwell3d); + })); +} + HLEMacro::~HLEMacro() = default; std::unique_ptr HLEMacro::GetHLEProgram(u64 hash) const { - const auto it = std::find_if(hle_funcs.cbegin(), hle_funcs.cend(), - [hash](const auto& pair) { return pair.first == hash; }); - if (it == hle_funcs.end()) { + const auto it = builders.find(hash); + if (it == builders.end()) { return nullptr; } - return std::make_unique(maxwell3d, it->second); + return it->second(maxwell3d); } } // namespace Tegra -- cgit v1.2.3 From 93ac5a6a6d316966c1d288f8b83610bb48143a04 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Fri, 21 Oct 2022 01:46:51 +0200 Subject: MacroHLE: Add Index Buffer size estimation. --- src/video_core/macro/macro_hle.cpp | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src/video_core/macro/macro_hle.cpp') 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(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(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; -- cgit v1.2.3 From aad0cbf024fb8077a9b375a093c60a7e2ab1db3d Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Wed, 9 Nov 2022 17:58:10 +0100 Subject: MacroHLE: Add HLE replacement for base vertex and base instance. --- src/video_core/macro/macro_hle.cpp | 115 ++++++++++++++++++------------------- 1 file changed, 56 insertions(+), 59 deletions(-) (limited to 'src/video_core/macro/macro_hle.cpp') diff --git a/src/video_core/macro/macro_hle.cpp b/src/video_core/macro/macro_hle.cpp index 93b6d42a4..638247e55 100644 --- a/src/video_core/macro/macro_hle.cpp +++ b/src/video_core/macro/macro_hle.cpp @@ -14,26 +14,29 @@ #include "video_core/rasterizer_interface.h" namespace Tegra { + +using Maxwell = Engines::Maxwell3D; + namespace { -bool IsTopologySafe(Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology topology) { +bool IsTopologySafe(Maxwell::Regs::PrimitiveTopology topology) { switch (topology) { - case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::Points: - case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::Lines: - case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::LineLoop: - case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::LineStrip: - case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::Triangles: - case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::TriangleStrip: - case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::TriangleFan: - case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::LinesAdjacency: - case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::LineStripAdjacency: - case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::TrianglesAdjacency: - case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::TriangleStripAdjacency: - case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::Patches: + case Maxwell::Regs::PrimitiveTopology::Points: + case Maxwell::Regs::PrimitiveTopology::Lines: + case Maxwell::Regs::PrimitiveTopology::LineLoop: + case Maxwell::Regs::PrimitiveTopology::LineStrip: + case Maxwell::Regs::PrimitiveTopology::Triangles: + case Maxwell::Regs::PrimitiveTopology::TriangleStrip: + case Maxwell::Regs::PrimitiveTopology::TriangleFan: + case Maxwell::Regs::PrimitiveTopology::LinesAdjacency: + case Maxwell::Regs::PrimitiveTopology::LineStripAdjacency: + case Maxwell::Regs::PrimitiveTopology::TrianglesAdjacency: + case Maxwell::Regs::PrimitiveTopology::TriangleStripAdjacency: + case Maxwell::Regs::PrimitiveTopology::Patches: return true; - case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::Quads: - case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::QuadStrip: - case Tegra::Engines::Maxwell3D::Regs::PrimitiveTopology::Polygon: + case Maxwell::Regs::PrimitiveTopology::Quads: + case Maxwell::Regs::PrimitiveTopology::QuadStrip: + case Maxwell::Regs::PrimitiveTopology::Polygon: default: return false; } @@ -82,8 +85,7 @@ public: : HLEMacroImpl(maxwell3d_), extended(extended_) {} void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { - auto topology = - static_cast(parameters[0]); + auto topology = static_cast(parameters[0]); if (!IsTopologySafe(topology)) { Fallback(parameters); return; @@ -99,18 +101,16 @@ public: params.stride = 0; if (extended) { - maxwell3d.CallMethod(0x8e3, 0x640, true); - maxwell3d.CallMethod(0x8e4, parameters[4], true); + maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro; + maxwell3d.setHLEReplacementName(0, 0x640, Maxwell::HLEReplaceName::BaseInstance); } maxwell3d.draw_manager->DrawArrayIndirect(topology); if (extended) { - maxwell3d.CallMethod(0x8e3, 0x640, true); - maxwell3d.CallMethod(0x8e4, 0, true); + maxwell3d.engine_state = Maxwell::EngineHint::None; + maxwell3d.replace_table.clear(); } - maxwell3d.regs.vertex_buffer.first = 0; - maxwell3d.regs.vertex_buffer.count = 0; } private: @@ -134,13 +134,18 @@ private: const u32 base_instance = parameters[4]; if (extended) { - maxwell3d.CallMethod(0x8e3, 0x640, true); - maxwell3d.CallMethod(0x8e4, base_instance, true); + maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro; + maxwell3d.setHLEReplacementName(0, 0x640, Maxwell::HLEReplaceName::BaseInstance); } maxwell3d.draw_manager->DrawArray( static_cast(parameters[0]), vertex_first, vertex_count, base_instance, instance_count); + + if (extended) { + maxwell3d.engine_state = Maxwell::EngineHint::None; + maxwell3d.replace_table.clear(); + } } bool extended; @@ -151,8 +156,7 @@ public: explicit HLE_DrawIndexedIndirect(Engines::Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { - auto topology = - static_cast(parameters[0]); + auto topology = static_cast(parameters[0]); if (!IsTopologySafe(topology)) { Fallback(parameters); return; @@ -164,16 +168,12 @@ public: minimum_limit = std::max(parameters[3], minimum_limit); } const u32 estimate = static_cast(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 + const u32 base_size = std::max(minimum_limit, estimate); maxwell3d.regs.draw.topology.Assign(topology); maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; - maxwell3d.CallMethod(0x8e3, 0x640, true); - maxwell3d.CallMethod(0x8e4, element_base, true); - maxwell3d.CallMethod(0x8e5, base_instance, true); + maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro; + maxwell3d.setHLEReplacementName(0, 0x640, Maxwell::HLEReplaceName::BaseVertex); + maxwell3d.setHLEReplacementName(0, 0x644, Maxwell::HLEReplaceName::BaseInstance); auto& params = maxwell3d.draw_manager->GetIndirectParams(); params.is_indexed = true; params.include_count = false; @@ -184,9 +184,8 @@ public: params.stride = 0; maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, base_size); - maxwell3d.CallMethod(0x8e3, 0x640, true); - maxwell3d.CallMethod(0x8e4, 0x0, true); - maxwell3d.CallMethod(0x8e5, 0x0, true); + maxwell3d.engine_state = Maxwell::EngineHint::None; + maxwell3d.replace_table.clear(); } private: @@ -197,18 +196,17 @@ private: const u32 base_instance = parameters[5]; maxwell3d.regs.vertex_id_base = element_base; maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; - maxwell3d.CallMethod(0x8e3, 0x640, true); - maxwell3d.CallMethod(0x8e4, element_base, true); - maxwell3d.CallMethod(0x8e5, base_instance, true); + maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro; + maxwell3d.setHLEReplacementName(0, 0x640, Maxwell::HLEReplaceName::BaseVertex); + maxwell3d.setHLEReplacementName(0, 0x644, Maxwell::HLEReplaceName::BaseInstance); maxwell3d.draw_manager->DrawIndex( static_cast(parameters[0]), parameters[3], parameters[1], element_base, base_instance, instance_count); maxwell3d.regs.vertex_id_base = 0x0; - maxwell3d.CallMethod(0x8e3, 0x640, true); - maxwell3d.CallMethod(0x8e4, 0x0, true); - maxwell3d.CallMethod(0x8e5, 0x0, true); + maxwell3d.engine_state = Maxwell::EngineHint::None; + maxwell3d.replace_table.clear(); } u32 minimum_limit{1 << 18}; @@ -238,8 +236,7 @@ public: : HLEMacroImpl(maxwell3d_) {} void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { - const auto topology = - static_cast(parameters[2]); + const auto topology = static_cast(parameters[2]); if (!IsTopologySafe(topology)) { Fallback(parameters); return; @@ -277,9 +274,6 @@ public: } const u32 estimate = static_cast(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, base_size); maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; auto& params = maxwell3d.draw_manager->GetIndirectParams(); params.is_indexed = true; @@ -290,7 +284,12 @@ public: params.max_draw_counts = draw_count; params.stride = stride; maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; - maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, highest_limit); + maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro; + maxwell3d.setHLEReplacementName(0, 0x640, Maxwell::HLEReplaceName::BaseVertex); + maxwell3d.setHLEReplacementName(0, 0x644, Maxwell::HLEReplaceName::BaseInstance); + maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, base_size); + maxwell3d.engine_state = Maxwell::EngineHint::None; + maxwell3d.replace_table.clear(); } private: @@ -299,9 +298,8 @@ private: // Clean everything. // Clean everything. maxwell3d.regs.vertex_id_base = 0x0; - maxwell3d.CallMethod(0x8e3, 0x640, true); - maxwell3d.CallMethod(0x8e4, 0x0, true); - maxwell3d.CallMethod(0x8e5, 0x0, true); + maxwell3d.engine_state = Maxwell::EngineHint::None; + maxwell3d.replace_table.clear(); }); maxwell3d.RefreshParameters(); const u32 start_indirect = parameters[0]; @@ -310,8 +308,7 @@ private: // Nothing to do. return; } - const auto topology = - static_cast(parameters[2]); + const auto topology = static_cast(parameters[2]); maxwell3d.regs.draw.topology.Assign(topology); const u32 padding = parameters[3]; const std::size_t max_draws = parameters[4]; @@ -326,9 +323,9 @@ private: const u32 base_vertex = parameters[base + 3]; const u32 base_instance = parameters[base + 4]; maxwell3d.regs.vertex_id_base = base_vertex; - maxwell3d.CallMethod(0x8e3, 0x640, true); - maxwell3d.CallMethod(0x8e4, base_vertex, true); - maxwell3d.CallMethod(0x8e5, base_instance, true); + maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro; + maxwell3d.setHLEReplacementName(0, 0x640, Maxwell::HLEReplaceName::BaseVertex); + maxwell3d.setHLEReplacementName(0, 0x644, Maxwell::HLEReplaceName::BaseInstance); maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; maxwell3d.draw_manager->DrawIndex(topology, parameters[base + 2], parameters[base], base_vertex, base_instance, parameters[base + 1]); -- cgit v1.2.3 From ce448ce770b6c329caec7ad1ae00e01dddb67b03 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Fri, 18 Nov 2022 00:21:13 +0100 Subject: Revert Buffer cache changes and setup additional macros. --- src/video_core/macro/macro_hle.cpp | 122 ++++++++++++++++++++++++++++++++++--- 1 file changed, 115 insertions(+), 7 deletions(-) (limited to 'src/video_core/macro/macro_hle.cpp') diff --git a/src/video_core/macro/macro_hle.cpp b/src/video_core/macro/macro_hle.cpp index 638247e55..3eac50975 100644 --- a/src/video_core/macro/macro_hle.cpp +++ b/src/video_core/macro/macro_hle.cpp @@ -86,7 +86,7 @@ public: void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { auto topology = static_cast(parameters[0]); - if (!IsTopologySafe(topology)) { + if (!maxwell3d.AnyParametersDirty() || !IsTopologySafe(topology)) { Fallback(parameters); return; } @@ -117,8 +117,8 @@ private: void Fallback(const std::vector& parameters) { SCOPE_EXIT({ if (extended) { - maxwell3d.CallMethod(0x8e3, 0x640, true); - maxwell3d.CallMethod(0x8e4, 0, true); + maxwell3d.engine_state = Maxwell::EngineHint::None; + maxwell3d.replace_table.clear(); } }); maxwell3d.RefreshParameters(); @@ -127,7 +127,8 @@ private: const u32 vertex_first = parameters[3]; const u32 vertex_count = parameters[1]; - if (maxwell3d.GetMaxCurrentVertices() < vertex_first + vertex_count) { + if (maxwell3d.AnyParametersDirty() && + maxwell3d.GetMaxCurrentVertices() < vertex_first + vertex_count) { ASSERT_MSG(false, "Faulty draw!"); return; } @@ -157,7 +158,7 @@ public: void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { auto topology = static_cast(parameters[0]); - if (!IsTopologySafe(topology)) { + if (!maxwell3d.AnyParametersDirty() || !IsTopologySafe(topology)) { Fallback(parameters); return; } @@ -169,7 +170,11 @@ public: } const u32 estimate = static_cast(maxwell3d.EstimateIndexBufferSize()); const u32 base_size = std::max(minimum_limit, estimate); - maxwell3d.regs.draw.topology.Assign(topology); + const u32 element_base = parameters[4]; + const u32 base_instance = parameters[5]; + maxwell3d.regs.vertex_id_base = element_base; + maxwell3d.regs.global_base_vertex_index = element_base; + maxwell3d.regs.global_base_instance_index = base_instance; maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro; maxwell3d.setHLEReplacementName(0, 0x640, Maxwell::HLEReplaceName::BaseVertex); @@ -186,6 +191,9 @@ public: maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, base_size); maxwell3d.engine_state = Maxwell::EngineHint::None; maxwell3d.replace_table.clear(); + maxwell3d.regs.vertex_id_base = 0x0; + maxwell3d.regs.global_base_vertex_index = 0x0; + maxwell3d.regs.global_base_instance_index = 0x0; } private: @@ -195,6 +203,8 @@ private: const u32 element_base = parameters[4]; const u32 base_instance = parameters[5]; maxwell3d.regs.vertex_id_base = element_base; + maxwell3d.regs.global_base_vertex_index = element_base; + maxwell3d.regs.global_base_instance_index = base_instance; maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro; maxwell3d.setHLEReplacementName(0, 0x640, Maxwell::HLEReplaceName::BaseVertex); @@ -205,6 +215,8 @@ private: parameters[3], parameters[1], element_base, base_instance, instance_count); maxwell3d.regs.vertex_id_base = 0x0; + maxwell3d.regs.global_base_vertex_index = 0x0; + maxwell3d.regs.global_base_instance_index = 0x0; maxwell3d.engine_state = Maxwell::EngineHint::None; maxwell3d.replace_table.clear(); } @@ -253,7 +265,6 @@ public: return; } - maxwell3d.regs.draw.topology.Assign(topology); const u32 padding = parameters[3]; // padding is in words // size of each indirect segment @@ -335,6 +346,83 @@ private: u32 minimum_limit{1 << 12}; }; +class HLE_C713C83D8F63CCF3 final : public HLEMacroImpl { +public: + explicit HLE_C713C83D8F63CCF3(Engines::Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} + + void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { + maxwell3d.RefreshParameters(); + const u32 offset = (parameters[0] & 0x3FFFFFFF) << 2; + const u32 address = maxwell3d.regs.shadow_scratch[24]; + auto& const_buffer = maxwell3d.regs.const_buffer; + const_buffer.size = 0x7000; + const_buffer.address_high = (address >> 24) & 0xFF; + const_buffer.address_low = address << 8; + const_buffer.offset = offset; + } +}; + +class HLE_D7333D26E0A93EDE final : public HLEMacroImpl { +public: + explicit HLE_D7333D26E0A93EDE(Engines::Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} + + void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { + maxwell3d.RefreshParameters(); + const size_t index = parameters[0]; + const u32 address = maxwell3d.regs.shadow_scratch[42 + index]; + const u32 size = maxwell3d.regs.shadow_scratch[47 + index]; + auto& const_buffer = maxwell3d.regs.const_buffer; + const_buffer.size = size; + const_buffer.address_high = (address >> 24) & 0xFF; + const_buffer.address_low = address << 8; + } +}; + +class HLE_BindShader final : public HLEMacroImpl { +public: + explicit HLE_BindShader(Engines::Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} + + void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { + maxwell3d.RefreshParameters(); + auto& regs = maxwell3d.regs; + const u32 index = parameters[0]; + if ((parameters[1] - regs.shadow_scratch[28 + index]) == 0) { + return; + } + + regs.pipelines[index & 0xF].offset = parameters[2]; + maxwell3d.dirty.flags[VideoCommon::Dirty::Shaders] = true; + regs.shadow_scratch[28 + index] = parameters[1]; + regs.shadow_scratch[34 + index] = parameters[2]; + + const u32 address = parameters[4]; + auto& const_buffer = regs.const_buffer; + const_buffer.size = 0x10000; + const_buffer.address_high = (address >> 24) & 0xFF; + const_buffer.address_low = address << 8; + + const size_t bind_group_id = parameters[3] & 0x7F; + auto& bind_group = regs.bind_groups[bind_group_id]; + bind_group.raw_config = 0x11; + maxwell3d.ProcessCBBind(bind_group_id); + } +}; + +class HLE_SetRasterBoundingBox final : public HLEMacroImpl { +public: + explicit HLE_SetRasterBoundingBox(Engines::Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} + + void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { + maxwell3d.RefreshParameters(); + const u32 raster_mode = parameters[0]; + auto& regs = maxwell3d.regs; + const u32 raster_enabled = maxwell3d.regs.conservative_raster_enable; + const u32 scratch_data = maxwell3d.regs.shadow_scratch[52]; + regs.raster_bounding_box.raw = raster_mode & 0xFFFFF00F; + regs.raster_bounding_box.pad.Assign(scratch_data & raster_enabled); + } +}; + } // Anonymous namespace HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} { @@ -368,6 +456,26 @@ HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} { [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr { return std::make_unique(maxwell3d); })); + builders.emplace(0xC713C83D8F63CCF3ULL, + std::function(Engines::Maxwell3D&)>( + [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr { + return std::make_unique(maxwell3d); + })); + builders.emplace(0xD7333D26E0A93EDEULL, + std::function(Engines::Maxwell3D&)>( + [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr { + return std::make_unique(maxwell3d); + })); + builders.emplace(0xEB29B2A09AA06D38ULL, + std::function(Engines::Maxwell3D&)>( + [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr { + return std::make_unique(maxwell3d); + })); + builders.emplace(0xDB1341DBEB4C8AF7ULL, + std::function(Engines::Maxwell3D&)>( + [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr { + return std::make_unique(maxwell3d); + })); } HLEMacro::~HLEMacro() = default; -- cgit v1.2.3 From cb1497d0d7711a1c0e527aaa3e1dc3f95e5a6644 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Sun, 27 Nov 2022 00:58:06 +0100 Subject: DMAPusher: Improve collection of non executing methods --- src/video_core/macro/macro_hle.cpp | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/video_core/macro/macro_hle.cpp') diff --git a/src/video_core/macro/macro_hle.cpp b/src/video_core/macro/macro_hle.cpp index 3eac50975..294a338d2 100644 --- a/src/video_core/macro/macro_hle.cpp +++ b/src/video_core/macro/macro_hle.cpp @@ -126,6 +126,7 @@ private: const u32 vertex_first = parameters[3]; const u32 vertex_count = parameters[1]; + if (maxwell3d.AnyParametersDirty() && maxwell3d.GetMaxCurrentVertices() < vertex_first + vertex_count) { @@ -135,6 +136,7 @@ private: const u32 base_instance = parameters[4]; if (extended) { + maxwell3d.regs.global_base_instance_index = base_instance; maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro; maxwell3d.setHLEReplacementName(0, 0x640, Maxwell::HLEReplaceName::BaseInstance); } @@ -144,6 +146,7 @@ private: vertex_first, vertex_count, base_instance, instance_count); if (extended) { + maxwell3d.regs.global_base_instance_index = 0; maxwell3d.engine_state = Maxwell::EngineHint::None; maxwell3d.replace_table.clear(); } -- cgit v1.2.3 From d09aa0182f18d1ac338ab47009b42fdeb67497a8 Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Sat, 24 Dec 2022 19:19:41 -0500 Subject: MacroHLE: Final cleanup and fixes. --- src/video_core/macro/macro_hle.cpp | 98 +++++++++++--------------------------- 1 file changed, 28 insertions(+), 70 deletions(-) (limited to 'src/video_core/macro/macro_hle.cpp') diff --git a/src/video_core/macro/macro_hle.cpp b/src/video_core/macro/macro_hle.cpp index 294a338d2..3481fcd41 100644 --- a/src/video_core/macro/macro_hle.cpp +++ b/src/video_core/macro/macro_hle.cpp @@ -47,21 +47,7 @@ public: explicit HLEMacroImpl(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} {} protected: - void advanceCheck() { - current_value = (current_value + 1) % fibonacci_post; - check_limit = current_value == 0; - if (check_limit) { - const u32 new_fibonacci = fibonacci_pre + fibonacci_post; - fibonacci_pre = fibonacci_post; - fibonacci_post = new_fibonacci; - } - } - Engines::Maxwell3D& maxwell3d; - u32 fibonacci_pre{89}; - u32 fibonacci_post{144}; - u32 current_value{fibonacci_post - 1}; - bool check_limit{}; }; class HLE_771BB18C62444DA0 final : public HLEMacroImpl { @@ -124,12 +110,13 @@ private: maxwell3d.RefreshParameters(); const u32 instance_count = (maxwell3d.GetRegisterValue(0xD1B) & parameters[2]); + auto topology = static_cast(parameters[0]); const u32 vertex_first = parameters[3]; const u32 vertex_count = parameters[1]; - - if (maxwell3d.AnyParametersDirty() && - maxwell3d.GetMaxCurrentVertices() < vertex_first + vertex_count) { + if (!IsTopologySafe(topology) && + static_cast(maxwell3d.GetMaxCurrentVertices()) < + static_cast(vertex_first) + static_cast(vertex_count)) { ASSERT_MSG(false, "Faulty draw!"); return; } @@ -141,9 +128,8 @@ private: maxwell3d.setHLEReplacementName(0, 0x640, Maxwell::HLEReplaceName::BaseInstance); } - maxwell3d.draw_manager->DrawArray( - static_cast(parameters[0]), - vertex_first, vertex_count, base_instance, instance_count); + maxwell3d.draw_manager->DrawArray(topology, vertex_first, vertex_count, base_instance, + instance_count); if (extended) { maxwell3d.regs.global_base_instance_index = 0; @@ -166,13 +152,7 @@ public: return; } - advanceCheck(); - if (check_limit) { - maxwell3d.RefreshParameters(); - minimum_limit = std::max(parameters[3], minimum_limit); - } const u32 estimate = static_cast(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.vertex_id_base = element_base; @@ -191,7 +171,7 @@ public: params.max_draw_counts = 1; params.stride = 0; maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; - maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, base_size); + maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, estimate); maxwell3d.engine_state = Maxwell::EngineHint::None; maxwell3d.replace_table.clear(); maxwell3d.regs.vertex_id_base = 0x0; @@ -223,8 +203,6 @@ private: maxwell3d.engine_state = Maxwell::EngineHint::None; maxwell3d.replace_table.clear(); } - - u32 minimum_limit{1 << 18}; }; class HLE_MultiLayerClear final : public HLEMacroImpl { @@ -257,10 +235,6 @@ public: return; } - advanceCheck(); - if (check_limit) { - maxwell3d.RefreshParameters(); - } const u32 start_indirect = parameters[0]; const u32 end_indirect = parameters[1]; if (start_indirect >= end_indirect) { @@ -274,20 +248,7 @@ public: const u32 indirect_words = 5 + padding; const u32 stride = indirect_words * sizeof(u32); const std::size_t draw_count = end_indirect - start_indirect; - u32 lowest_first = std::numeric_limits::max(); - u32 highest_limit = std::numeric_limits::min(); - for (std::size_t index = 0; index < draw_count; index++) { - const std::size_t base = index * indirect_words + 5; - const u32 count = parameters[base]; - const u32 first_index = parameters[base + 2]; - lowest_first = std::min(lowest_first, first_index); - highest_limit = std::max(highest_limit, first_index + count); - } - if (check_limit) { - minimum_limit = std::max(highest_limit, minimum_limit); - } const u32 estimate = static_cast(maxwell3d.EstimateIndexBufferSize()); - const u32 base_size = std::max(minimum_limit, estimate); maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; auto& params = maxwell3d.draw_manager->GetIndirectParams(); params.is_indexed = true; @@ -301,7 +262,7 @@ public: maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro; maxwell3d.setHLEReplacementName(0, 0x640, Maxwell::HLEReplaceName::BaseVertex); maxwell3d.setHLEReplacementName(0, 0x644, Maxwell::HLEReplaceName::BaseInstance); - maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, base_size); + maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, estimate); maxwell3d.engine_state = Maxwell::EngineHint::None; maxwell3d.replace_table.clear(); } @@ -323,7 +284,6 @@ private: return; } const auto topology = static_cast(parameters[2]); - maxwell3d.regs.draw.topology.Assign(topology); const u32 padding = parameters[3]; const std::size_t max_draws = parameters[4]; @@ -345,8 +305,6 @@ private: base_vertex, base_instance, parameters[base + 1]); } } - - u32 minimum_limit{1 << 12}; }; class HLE_C713C83D8F63CCF3 final : public HLEMacroImpl { @@ -431,53 +389,53 @@ public: HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} { builders.emplace(0x771BB18C62444DA0ULL, std::function(Engines::Maxwell3D&)>( - [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr { - return std::make_unique(maxwell3d); + [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { + return std::make_unique(maxwell3d__); })); builders.emplace(0x0D61FC9FAAC9FCADULL, std::function(Engines::Maxwell3D&)>( - [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr { - return std::make_unique(maxwell3d); + [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { + return std::make_unique(maxwell3d__); })); builders.emplace(0x8A4D173EB99A8603ULL, std::function(Engines::Maxwell3D&)>( - [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr { - return std::make_unique(maxwell3d, true); + [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { + return std::make_unique(maxwell3d__, true); })); builders.emplace(0x0217920100488FF7ULL, std::function(Engines::Maxwell3D&)>( - [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr { - return std::make_unique(maxwell3d); + [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { + return std::make_unique(maxwell3d__); })); builders.emplace(0x3F5E74B9C9A50164ULL, std::function(Engines::Maxwell3D&)>( - [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr { - return std::make_unique(maxwell3d); + [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { + return std::make_unique(maxwell3d__); })); builders.emplace(0xEAD26C3E2109B06BULL, std::function(Engines::Maxwell3D&)>( - [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr { - return std::make_unique(maxwell3d); + [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { + return std::make_unique(maxwell3d__); })); builders.emplace(0xC713C83D8F63CCF3ULL, std::function(Engines::Maxwell3D&)>( - [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr { - return std::make_unique(maxwell3d); + [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { + return std::make_unique(maxwell3d__); })); builders.emplace(0xD7333D26E0A93EDEULL, std::function(Engines::Maxwell3D&)>( - [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr { - return std::make_unique(maxwell3d); + [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { + return std::make_unique(maxwell3d__); })); builders.emplace(0xEB29B2A09AA06D38ULL, std::function(Engines::Maxwell3D&)>( - [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr { - return std::make_unique(maxwell3d); + [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { + return std::make_unique(maxwell3d__); })); builders.emplace(0xDB1341DBEB4C8AF7ULL, std::function(Engines::Maxwell3D&)>( - [](Engines::Maxwell3D& maxwell3d) -> std::unique_ptr { - return std::make_unique(maxwell3d); + [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { + return std::make_unique(maxwell3d__); })); } -- cgit v1.2.3 From 4814d87385a3e06a70514be4ecb2739cba358bdf Mon Sep 17 00:00:00 2001 From: Liam Date: Sat, 24 Dec 2022 22:24:56 -0500 Subject: video_core: fix build --- src/video_core/macro/macro_hle.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/video_core/macro/macro_hle.cpp') diff --git a/src/video_core/macro/macro_hle.cpp b/src/video_core/macro/macro_hle.cpp index 3481fcd41..c08b4abb3 100644 --- a/src/video_core/macro/macro_hle.cpp +++ b/src/video_core/macro/macro_hle.cpp @@ -410,7 +410,8 @@ HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} { builders.emplace(0x3F5E74B9C9A50164ULL, std::function(Engines::Maxwell3D&)>( [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { - return std::make_unique(maxwell3d__); + return std::make_unique( + maxwell3d__); })); builders.emplace(0xEAD26C3E2109B06BULL, std::function(Engines::Maxwell3D&)>( -- cgit v1.2.3 From a0c697124ced080f58866825e2e323e8682bbd7f Mon Sep 17 00:00:00 2001 From: Fernando Sahmkow Date: Tue, 3 Jan 2023 10:01:25 -0500 Subject: Video_core: Address feedback --- src/video_core/macro/macro_hle.cpp | 356 ++++++++++++++++++++++++++----------- 1 file changed, 248 insertions(+), 108 deletions(-) (limited to 'src/video_core/macro/macro_hle.cpp') diff --git a/src/video_core/macro/macro_hle.cpp b/src/video_core/macro/macro_hle.cpp index c08b4abb3..a5476e795 100644 --- a/src/video_core/macro/macro_hle.cpp +++ b/src/video_core/macro/macro_hle.cpp @@ -1,5 +1,5 @@ -// SPDX-FileCopyrightText: Copyright 2020 yuzu Emulator Project -// SPDX-License-Identifier: GPL-2.0-or-later +// SPDX-FileCopyrightText: Copyright 2023 yuzu Emulator Project +// SPDX-License-Identifier: GPL-3.0-or-later #include #include @@ -15,28 +15,28 @@ namespace Tegra { -using Maxwell = Engines::Maxwell3D; +using Maxwell3D = Engines::Maxwell3D; namespace { -bool IsTopologySafe(Maxwell::Regs::PrimitiveTopology topology) { +bool IsTopologySafe(Maxwell3D::Regs::PrimitiveTopology topology) { switch (topology) { - case Maxwell::Regs::PrimitiveTopology::Points: - case Maxwell::Regs::PrimitiveTopology::Lines: - case Maxwell::Regs::PrimitiveTopology::LineLoop: - case Maxwell::Regs::PrimitiveTopology::LineStrip: - case Maxwell::Regs::PrimitiveTopology::Triangles: - case Maxwell::Regs::PrimitiveTopology::TriangleStrip: - case Maxwell::Regs::PrimitiveTopology::TriangleFan: - case Maxwell::Regs::PrimitiveTopology::LinesAdjacency: - case Maxwell::Regs::PrimitiveTopology::LineStripAdjacency: - case Maxwell::Regs::PrimitiveTopology::TrianglesAdjacency: - case Maxwell::Regs::PrimitiveTopology::TriangleStripAdjacency: - case Maxwell::Regs::PrimitiveTopology::Patches: + case Maxwell3D::Regs::PrimitiveTopology::Points: + case Maxwell3D::Regs::PrimitiveTopology::Lines: + case Maxwell3D::Regs::PrimitiveTopology::LineLoop: + case Maxwell3D::Regs::PrimitiveTopology::LineStrip: + case Maxwell3D::Regs::PrimitiveTopology::Triangles: + case Maxwell3D::Regs::PrimitiveTopology::TriangleStrip: + case Maxwell3D::Regs::PrimitiveTopology::TriangleFan: + case Maxwell3D::Regs::PrimitiveTopology::LinesAdjacency: + case Maxwell3D::Regs::PrimitiveTopology::LineStripAdjacency: + case Maxwell3D::Regs::PrimitiveTopology::TrianglesAdjacency: + case Maxwell3D::Regs::PrimitiveTopology::TriangleStripAdjacency: + case Maxwell3D::Regs::PrimitiveTopology::Patches: return true; - case Maxwell::Regs::PrimitiveTopology::Quads: - case Maxwell::Regs::PrimitiveTopology::QuadStrip: - case Maxwell::Regs::PrimitiveTopology::Polygon: + case Maxwell3D::Regs::PrimitiveTopology::Quads: + case Maxwell3D::Regs::PrimitiveTopology::QuadStrip: + case Maxwell3D::Regs::PrimitiveTopology::Polygon: default: return false; } @@ -44,34 +44,55 @@ bool IsTopologySafe(Maxwell::Regs::PrimitiveTopology topology) { class HLEMacroImpl : public CachedMacro { public: - explicit HLEMacroImpl(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} {} + explicit HLEMacroImpl(Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} {} protected: - Engines::Maxwell3D& maxwell3d; + Maxwell3D& maxwell3d; }; -class HLE_771BB18C62444DA0 final : public HLEMacroImpl { +class HLE_DrawArrays final : public HLEMacroImpl { public: - explicit HLE_771BB18C62444DA0(Engines::Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} + explicit HLE_DrawArrays(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { maxwell3d.RefreshParameters(); - const u32 instance_count = parameters[2] & maxwell3d.GetRegisterValue(0xD1B); + + auto topology = static_cast(parameters[0]); + maxwell3d.draw_manager->DrawArray(topology, parameters[1], parameters[2], + maxwell3d.regs.global_base_instance_index, 1); + } +}; + +class HLE_DrawIndexed final : public HLEMacroImpl { +public: + explicit HLE_DrawIndexed(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} + + void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { + maxwell3d.RefreshParameters(); + maxwell3d.regs.index_buffer.start_addr_high = parameters[1]; + maxwell3d.regs.index_buffer.start_addr_low = parameters[2]; + maxwell3d.regs.index_buffer.format = + static_cast(parameters[3]); maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; - maxwell3d.draw_manager->DrawIndex( - static_cast(parameters[0] & - 0x3ffffff), - parameters[4], parameters[1], parameters[3], parameters[5], instance_count); + + auto topology = static_cast(parameters[0]); + maxwell3d.draw_manager->DrawIndex(topology, 0, parameters[4], + maxwell3d.regs.global_base_vertex_index, + maxwell3d.regs.global_base_instance_index, 1); } }; +/* + * @note: these macros have two versions, a normal and extended version, with the extended version + * also assigning the base vertex/instance. + */ +template class HLE_DrawArraysIndirect final : public HLEMacroImpl { public: - explicit HLE_DrawArraysIndirect(Engines::Maxwell3D& maxwell3d_, bool extended_ = false) - : HLEMacroImpl(maxwell3d_), extended(extended_) {} + explicit HLE_DrawArraysIndirect(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { - auto topology = static_cast(parameters[0]); + auto topology = static_cast(parameters[0]); if (!maxwell3d.AnyParametersDirty() || !IsTopologySafe(topology)) { Fallback(parameters); return; @@ -81,20 +102,21 @@ public: params.is_indexed = false; params.include_count = false; params.count_start_address = 0; - params.indirect_start_address = maxwell3d.getMacroAddress(1); + params.indirect_start_address = maxwell3d.GetMacroAddress(1); params.buffer_size = 4 * sizeof(u32); params.max_draw_counts = 1; params.stride = 0; - if (extended) { - maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro; - maxwell3d.setHLEReplacementName(0, 0x640, Maxwell::HLEReplaceName::BaseInstance); + if constexpr (extended) { + maxwell3d.engine_state = Maxwell3D::EngineHint::OnHLEMacro; + maxwell3d.SetHLEReplacementAttributeType( + 0, 0x640, Maxwell3D::HLEReplacementAttributeType::BaseInstance); } maxwell3d.draw_manager->DrawArrayIndirect(topology); - if (extended) { - maxwell3d.engine_state = Maxwell::EngineHint::None; + if constexpr (extended) { + maxwell3d.engine_state = Maxwell3D::EngineHint::None; maxwell3d.replace_table.clear(); } } @@ -103,14 +125,14 @@ private: void Fallback(const std::vector& parameters) { SCOPE_EXIT({ if (extended) { - maxwell3d.engine_state = Maxwell::EngineHint::None; + maxwell3d.engine_state = Maxwell3D::EngineHint::None; maxwell3d.replace_table.clear(); } }); maxwell3d.RefreshParameters(); const u32 instance_count = (maxwell3d.GetRegisterValue(0xD1B) & parameters[2]); - auto topology = static_cast(parameters[0]); + auto topology = static_cast(parameters[0]); const u32 vertex_first = parameters[3]; const u32 vertex_count = parameters[1]; @@ -122,31 +144,35 @@ private: } const u32 base_instance = parameters[4]; - if (extended) { + if constexpr (extended) { maxwell3d.regs.global_base_instance_index = base_instance; - maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro; - maxwell3d.setHLEReplacementName(0, 0x640, Maxwell::HLEReplaceName::BaseInstance); + maxwell3d.engine_state = Maxwell3D::EngineHint::OnHLEMacro; + maxwell3d.SetHLEReplacementAttributeType( + 0, 0x640, Maxwell3D::HLEReplacementAttributeType::BaseInstance); } maxwell3d.draw_manager->DrawArray(topology, vertex_first, vertex_count, base_instance, instance_count); - if (extended) { + if constexpr (extended) { maxwell3d.regs.global_base_instance_index = 0; - maxwell3d.engine_state = Maxwell::EngineHint::None; + maxwell3d.engine_state = Maxwell3D::EngineHint::None; maxwell3d.replace_table.clear(); } } - - bool extended; }; +/* + * @note: these macros have two versions, a normal and extended version, with the extended version + * also assigning the base vertex/instance. + */ +template class HLE_DrawIndexedIndirect final : public HLEMacroImpl { public: - explicit HLE_DrawIndexedIndirect(Engines::Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} + explicit HLE_DrawIndexedIndirect(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { - auto topology = static_cast(parameters[0]); + auto topology = static_cast(parameters[0]); if (!maxwell3d.AnyParametersDirty() || !IsTopologySafe(topology)) { Fallback(parameters); return; @@ -159,24 +185,30 @@ public: maxwell3d.regs.global_base_vertex_index = element_base; maxwell3d.regs.global_base_instance_index = base_instance; maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; - maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro; - maxwell3d.setHLEReplacementName(0, 0x640, Maxwell::HLEReplaceName::BaseVertex); - maxwell3d.setHLEReplacementName(0, 0x644, Maxwell::HLEReplaceName::BaseInstance); + if constexpr (extended) { + maxwell3d.engine_state = Maxwell3D::EngineHint::OnHLEMacro; + maxwell3d.SetHLEReplacementAttributeType( + 0, 0x640, Maxwell3D::HLEReplacementAttributeType::BaseVertex); + maxwell3d.SetHLEReplacementAttributeType( + 0, 0x644, Maxwell3D::HLEReplacementAttributeType::BaseInstance); + } auto& params = maxwell3d.draw_manager->GetIndirectParams(); params.is_indexed = true; params.include_count = false; params.count_start_address = 0; - params.indirect_start_address = maxwell3d.getMacroAddress(1); + params.indirect_start_address = maxwell3d.GetMacroAddress(1); params.buffer_size = 5 * sizeof(u32); params.max_draw_counts = 1; params.stride = 0; maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, estimate); - maxwell3d.engine_state = Maxwell::EngineHint::None; - maxwell3d.replace_table.clear(); maxwell3d.regs.vertex_id_base = 0x0; maxwell3d.regs.global_base_vertex_index = 0x0; maxwell3d.regs.global_base_instance_index = 0x0; + if constexpr (extended) { + maxwell3d.engine_state = Maxwell3D::EngineHint::None; + maxwell3d.replace_table.clear(); + } } private: @@ -189,31 +221,37 @@ private: maxwell3d.regs.global_base_vertex_index = element_base; maxwell3d.regs.global_base_instance_index = base_instance; maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; - maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro; - maxwell3d.setHLEReplacementName(0, 0x640, Maxwell::HLEReplaceName::BaseVertex); - maxwell3d.setHLEReplacementName(0, 0x644, Maxwell::HLEReplaceName::BaseInstance); + if constexpr (extended) { + maxwell3d.engine_state = Maxwell3D::EngineHint::OnHLEMacro; + maxwell3d.SetHLEReplacementAttributeType( + 0, 0x640, Maxwell3D::HLEReplacementAttributeType::BaseVertex); + maxwell3d.SetHLEReplacementAttributeType( + 0, 0x644, Maxwell3D::HLEReplacementAttributeType::BaseInstance); + } maxwell3d.draw_manager->DrawIndex( - static_cast(parameters[0]), - parameters[3], parameters[1], element_base, base_instance, instance_count); + static_cast(parameters[0]), parameters[3], + parameters[1], element_base, base_instance, instance_count); maxwell3d.regs.vertex_id_base = 0x0; maxwell3d.regs.global_base_vertex_index = 0x0; maxwell3d.regs.global_base_instance_index = 0x0; - maxwell3d.engine_state = Maxwell::EngineHint::None; - maxwell3d.replace_table.clear(); + if constexpr (extended) { + maxwell3d.engine_state = Maxwell3D::EngineHint::None; + maxwell3d.replace_table.clear(); + } } }; class HLE_MultiLayerClear final : public HLEMacroImpl { public: - explicit HLE_MultiLayerClear(Engines::Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} + explicit HLE_MultiLayerClear(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { maxwell3d.RefreshParameters(); ASSERT(parameters.size() == 1); - const Engines::Maxwell3D::Regs::ClearSurface clear_params{parameters[0]}; + const Maxwell3D::Regs::ClearSurface clear_params{parameters[0]}; const u32 rt_index = clear_params.RT; const u32 num_layers = maxwell3d.regs.rt[rt_index].depth; ASSERT(clear_params.layer == 0); @@ -225,11 +263,10 @@ public: class HLE_MultiDrawIndexedIndirectCount final : public HLEMacroImpl { public: - explicit HLE_MultiDrawIndexedIndirectCount(Engines::Maxwell3D& maxwell3d_) - : HLEMacroImpl(maxwell3d_) {} + explicit HLE_MultiDrawIndexedIndirectCount(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { - const auto topology = static_cast(parameters[2]); + const auto topology = static_cast(parameters[2]); if (!IsTopologySafe(topology)) { Fallback(parameters); return; @@ -253,27 +290,30 @@ public: auto& params = maxwell3d.draw_manager->GetIndirectParams(); params.is_indexed = true; params.include_count = true; - params.count_start_address = maxwell3d.getMacroAddress(4); - params.indirect_start_address = maxwell3d.getMacroAddress(5); + params.count_start_address = maxwell3d.GetMacroAddress(4); + params.indirect_start_address = maxwell3d.GetMacroAddress(5); params.buffer_size = stride * draw_count; params.max_draw_counts = draw_count; params.stride = stride; maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; - maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro; - maxwell3d.setHLEReplacementName(0, 0x640, Maxwell::HLEReplaceName::BaseVertex); - maxwell3d.setHLEReplacementName(0, 0x644, Maxwell::HLEReplaceName::BaseInstance); + maxwell3d.engine_state = Maxwell3D::EngineHint::OnHLEMacro; + maxwell3d.SetHLEReplacementAttributeType( + 0, 0x640, Maxwell3D::HLEReplacementAttributeType::BaseVertex); + maxwell3d.SetHLEReplacementAttributeType( + 0, 0x644, Maxwell3D::HLEReplacementAttributeType::BaseInstance); + maxwell3d.SetHLEReplacementAttributeType(0, 0x648, + Maxwell3D::HLEReplacementAttributeType::DrawID); maxwell3d.draw_manager->DrawIndexedIndirect(topology, 0, estimate); - maxwell3d.engine_state = Maxwell::EngineHint::None; + maxwell3d.engine_state = Maxwell3D::EngineHint::None; maxwell3d.replace_table.clear(); } private: void Fallback(const std::vector& parameters) { SCOPE_EXIT({ - // Clean everything. // Clean everything. maxwell3d.regs.vertex_id_base = 0x0; - maxwell3d.engine_state = Maxwell::EngineHint::None; + maxwell3d.engine_state = Maxwell3D::EngineHint::None; maxwell3d.replace_table.clear(); }); maxwell3d.RefreshParameters(); @@ -283,7 +323,7 @@ private: // Nothing to do. return; } - const auto topology = static_cast(parameters[2]); + const auto topology = static_cast(parameters[2]); const u32 padding = parameters[3]; const std::size_t max_draws = parameters[4]; @@ -297,9 +337,13 @@ private: const u32 base_vertex = parameters[base + 3]; const u32 base_instance = parameters[base + 4]; maxwell3d.regs.vertex_id_base = base_vertex; - maxwell3d.engine_state = Maxwell::EngineHint::OnHLEMacro; - maxwell3d.setHLEReplacementName(0, 0x640, Maxwell::HLEReplaceName::BaseVertex); - maxwell3d.setHLEReplacementName(0, 0x644, Maxwell::HLEReplaceName::BaseInstance); + maxwell3d.engine_state = Maxwell3D::EngineHint::OnHLEMacro; + maxwell3d.SetHLEReplacementAttributeType( + 0, 0x640, Maxwell3D::HLEReplacementAttributeType::BaseVertex); + maxwell3d.SetHLEReplacementAttributeType( + 0, 0x644, Maxwell3D::HLEReplacementAttributeType::BaseInstance); + maxwell3d.CallMethod(0x8e3, 0x648, true); + maxwell3d.CallMethod(0x8e4, static_cast(index), true); maxwell3d.dirty.flags[VideoCommon::Dirty::IndexBuffer] = true; maxwell3d.draw_manager->DrawIndex(topology, parameters[base + 2], parameters[base], base_vertex, base_instance, parameters[base + 1]); @@ -309,7 +353,7 @@ private: class HLE_C713C83D8F63CCF3 final : public HLEMacroImpl { public: - explicit HLE_C713C83D8F63CCF3(Engines::Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} + explicit HLE_C713C83D8F63CCF3(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { maxwell3d.RefreshParameters(); @@ -325,7 +369,7 @@ public: class HLE_D7333D26E0A93EDE final : public HLEMacroImpl { public: - explicit HLE_D7333D26E0A93EDE(Engines::Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} + explicit HLE_D7333D26E0A93EDE(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { maxwell3d.RefreshParameters(); @@ -341,7 +385,7 @@ public: class HLE_BindShader final : public HLEMacroImpl { public: - explicit HLE_BindShader(Engines::Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} + explicit HLE_BindShader(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { maxwell3d.RefreshParameters(); @@ -371,7 +415,7 @@ public: class HLE_SetRasterBoundingBox final : public HLEMacroImpl { public: - explicit HLE_SetRasterBoundingBox(Engines::Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} + explicit HLE_SetRasterBoundingBox(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { maxwell3d.RefreshParameters(); @@ -384,60 +428,156 @@ public: } }; +template +class HLE_ClearConstBuffer final : public HLEMacroImpl { +public: + explicit HLE_ClearConstBuffer(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} + + void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { + maxwell3d.RefreshParameters(); + static constexpr std::array zeroes{}; + auto& regs = maxwell3d.regs; + regs.const_buffer.size = static_cast(base_size); + regs.const_buffer.address_high = parameters[0]; + regs.const_buffer.address_low = parameters[1]; + regs.const_buffer.offset = 0; + maxwell3d.ProcessCBMultiData(zeroes.data(), parameters[2] * 4); + } +}; + +class HLE_ClearMemory final : public HLEMacroImpl { +public: + explicit HLE_ClearMemory(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} + + void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { + maxwell3d.RefreshParameters(); + + const u32 needed_memory = parameters[2] / sizeof(u32); + if (needed_memory > zero_memory.size()) { + zero_memory.resize(needed_memory, 0); + } + auto& regs = maxwell3d.regs; + regs.upload.line_length_in = parameters[2]; + regs.upload.line_count = 1; + regs.upload.dest.address_high = parameters[0]; + regs.upload.dest.address_low = parameters[1]; + maxwell3d.CallMethod(static_cast(MAXWELL3D_REG_INDEX(launch_dma)), 0x1011, true); + maxwell3d.CallMultiMethod(static_cast(MAXWELL3D_REG_INDEX(inline_data)), + zero_memory.data(), needed_memory, needed_memory); + } + +private: + std::vector zero_memory; +}; + +class HLE_TransformFeedbackSetup final : public HLEMacroImpl { +public: + explicit HLE_TransformFeedbackSetup(Maxwell3D& maxwell3d_) : HLEMacroImpl(maxwell3d_) {} + + void Execute(const std::vector& parameters, [[maybe_unused]] u32 method) override { + maxwell3d.RefreshParameters(); + + auto& regs = maxwell3d.regs; + regs.transform_feedback_enabled = 1; + regs.transform_feedback.buffers[0].start_offset = 0; + regs.transform_feedback.buffers[1].start_offset = 0; + regs.transform_feedback.buffers[2].start_offset = 0; + regs.transform_feedback.buffers[3].start_offset = 0; + + regs.upload.line_length_in = 4; + regs.upload.line_count = 1; + regs.upload.dest.address_high = parameters[0]; + regs.upload.dest.address_low = parameters[1]; + maxwell3d.CallMethod(static_cast(MAXWELL3D_REG_INDEX(launch_dma)), 0x1011, true); + maxwell3d.CallMethod(static_cast(MAXWELL3D_REG_INDEX(inline_data)), + regs.transform_feedback.controls[0].stride, true); + } +}; + } // Anonymous namespace -HLEMacro::HLEMacro(Engines::Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} { - builders.emplace(0x771BB18C62444DA0ULL, - std::function(Engines::Maxwell3D&)>( - [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { - return std::make_unique(maxwell3d__); +HLEMacro::HLEMacro(Maxwell3D& maxwell3d_) : maxwell3d{maxwell3d_} { + builders.emplace(0xDD6A7FA92A7D2674ULL, + std::function(Maxwell3D&)>( + [](Maxwell3D& maxwell3d__) -> std::unique_ptr { + return std::make_unique(maxwell3d__); })); builders.emplace(0x0D61FC9FAAC9FCADULL, - std::function(Engines::Maxwell3D&)>( - [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { - return std::make_unique(maxwell3d__); + std::function(Maxwell3D&)>( + [](Maxwell3D& maxwell3d__) -> std::unique_ptr { + return std::make_unique>(maxwell3d__); })); builders.emplace(0x8A4D173EB99A8603ULL, - std::function(Engines::Maxwell3D&)>( - [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { - return std::make_unique(maxwell3d__, true); + std::function(Maxwell3D&)>( + [](Maxwell3D& maxwell3d__) -> std::unique_ptr { + return std::make_unique>(maxwell3d__); + })); + builders.emplace(0x2DB33AADB741839CULL, + std::function(Maxwell3D&)>( + [](Maxwell3D& maxwell3d__) -> std::unique_ptr { + return std::make_unique(maxwell3d__); + })); + builders.emplace(0x771BB18C62444DA0ULL, + std::function(Maxwell3D&)>( + [](Maxwell3D& maxwell3d__) -> std::unique_ptr { + return std::make_unique>(maxwell3d__); })); builders.emplace(0x0217920100488FF7ULL, - std::function(Engines::Maxwell3D&)>( - [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { - return std::make_unique(maxwell3d__); + std::function(Maxwell3D&)>( + [](Maxwell3D& maxwell3d__) -> std::unique_ptr { + return std::make_unique>(maxwell3d__); })); builders.emplace(0x3F5E74B9C9A50164ULL, - std::function(Engines::Maxwell3D&)>( - [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { + std::function(Maxwell3D&)>( + [](Maxwell3D& maxwell3d__) -> std::unique_ptr { return std::make_unique( maxwell3d__); })); builders.emplace(0xEAD26C3E2109B06BULL, - std::function(Engines::Maxwell3D&)>( - [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { + std::function(Maxwell3D&)>( + [](Maxwell3D& maxwell3d__) -> std::unique_ptr { return std::make_unique(maxwell3d__); })); builders.emplace(0xC713C83D8F63CCF3ULL, - std::function(Engines::Maxwell3D&)>( - [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { + std::function(Maxwell3D&)>( + [](Maxwell3D& maxwell3d__) -> std::unique_ptr { return std::make_unique(maxwell3d__); })); builders.emplace(0xD7333D26E0A93EDEULL, - std::function(Engines::Maxwell3D&)>( - [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { + std::function(Maxwell3D&)>( + [](Maxwell3D& maxwell3d__) -> std::unique_ptr { return std::make_unique(maxwell3d__); })); builders.emplace(0xEB29B2A09AA06D38ULL, - std::function(Engines::Maxwell3D&)>( - [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { + std::function(Maxwell3D&)>( + [](Maxwell3D& maxwell3d__) -> std::unique_ptr { return std::make_unique(maxwell3d__); })); builders.emplace(0xDB1341DBEB4C8AF7ULL, - std::function(Engines::Maxwell3D&)>( - [](Engines::Maxwell3D& maxwell3d__) -> std::unique_ptr { + std::function(Maxwell3D&)>( + [](Maxwell3D& maxwell3d__) -> std::unique_ptr { return std::make_unique(maxwell3d__); })); + builders.emplace(0x6C97861D891EDf7EULL, + std::function(Maxwell3D&)>( + [](Maxwell3D& maxwell3d__) -> std::unique_ptr { + return std::make_unique>(maxwell3d__); + })); + builders.emplace(0xD246FDDF3A6173D7ULL, + std::function(Maxwell3D&)>( + [](Maxwell3D& maxwell3d__) -> std::unique_ptr { + return std::make_unique>(maxwell3d__); + })); + builders.emplace(0xEE4D0004BEC8ECF4ULL, + std::function(Maxwell3D&)>( + [](Maxwell3D& maxwell3d__) -> std::unique_ptr { + return std::make_unique(maxwell3d__); + })); + builders.emplace(0xFC0CF27F5FFAA661ULL, + std::function(Maxwell3D&)>( + [](Maxwell3D& maxwell3d__) -> std::unique_ptr { + return std::make_unique(maxwell3d__); + })); } HLEMacro::~HLEMacro() = default; -- cgit v1.2.3