diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2022-11-18 00:21:13 +0100 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2023-01-01 22:43:57 +0100 |
commit | ce448ce770b6c329caec7ad1ae00e01dddb67b03 (patch) | |
tree | 88a76a0416244c89d1031551b1a419a606324004 /src/video_core/engines | |
parent | MacroHLE: Reduce massive calculations on sizing estimation. (diff) | |
download | yuzu-ce448ce770b6c329caec7ad1ae00e01dddb67b03.tar yuzu-ce448ce770b6c329caec7ad1ae00e01dddb67b03.tar.gz yuzu-ce448ce770b6c329caec7ad1ae00e01dddb67b03.tar.bz2 yuzu-ce448ce770b6c329caec7ad1ae00e01dddb67b03.tar.lz yuzu-ce448ce770b6c329caec7ad1ae00e01dddb67b03.tar.xz yuzu-ce448ce770b6c329caec7ad1ae00e01dddb67b03.tar.zst yuzu-ce448ce770b6c329caec7ad1ae00e01dddb67b03.zip |
Diffstat (limited to 'src/video_core/engines')
-rw-r--r-- | src/video_core/engines/engine_interface.h | 1 | ||||
-rw-r--r-- | src/video_core/engines/maxwell_3d.cpp | 26 | ||||
-rw-r--r-- | src/video_core/engines/maxwell_3d.h | 23 |
3 files changed, 28 insertions, 22 deletions
diff --git a/src/video_core/engines/engine_interface.h b/src/video_core/engines/engine_interface.h index 76630272d..38f1abdc4 100644 --- a/src/video_core/engines/engine_interface.h +++ b/src/video_core/engines/engine_interface.h @@ -18,6 +18,7 @@ public: virtual void CallMultiMethod(u32 method, const u32* base_start, u32 amount, u32 methods_pending) = 0; + bool current_dirty{}; GPUVAddr current_dma_segment; }; diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp index a9fd6d960..bbe3202fe 100644 --- a/src/video_core/engines/maxwell_3d.cpp +++ b/src/video_core/engines/maxwell_3d.cpp @@ -4,6 +4,7 @@ #include <cstring> #include <optional> #include "common/assert.h" +#include "common/settings.h" #include "core/core.h" #include "core/core_timing.h" #include "video_core/dirty_flags.h" @@ -14,6 +15,7 @@ #include "video_core/rasterizer_interface.h" #include "video_core/textures/texture.h" + namespace Tegra::Engines { using VideoCore::QueryType; @@ -134,6 +136,8 @@ void Maxwell3D::ProcessMacro(u32 method, const u32* base_start, u32 amount, bool macro_addresses.push_back(current_dma_segment + i * sizeof(u32)); } macro_segments.emplace_back(current_dma_segment, amount); + current_macro_dirty |= current_dirty; + current_dirty = false; // Call the macro when there are no more parameters in the command buffer if (is_last_call) { @@ -141,10 +145,14 @@ void Maxwell3D::ProcessMacro(u32 method, const u32* base_start, u32 amount, bool macro_params.clear(); macro_addresses.clear(); macro_segments.clear(); + current_macro_dirty = false; } } -void Maxwell3D::RefreshParameters() { +void Maxwell3D::RefreshParametersImpl() { + if (!Settings::IsGPULevelHigh()) { + return; + } size_t current_index = 0; for (auto& segment : macro_segments) { if (segment.first == 0) { @@ -157,21 +165,6 @@ void Maxwell3D::RefreshParameters() { } } -bool Maxwell3D::AnyParametersDirty() { - size_t current_index = 0; - for (auto& segment : macro_segments) { - if (segment.first == 0) { - current_index += segment.second; - continue; - } - if (memory_manager.IsMemoryDirty(segment.first, sizeof(u32) * segment.second)) { - return true; - } - current_index += segment.second; - } - return false; -} - u32 Maxwell3D::GetMaxCurrentVertices() { u32 num_vertices = 0; for (size_t index = 0; index < Regs::NumVertexArrays; ++index) { @@ -332,7 +325,6 @@ void Maxwell3D::CallMethod(u32 method, u32 method_argument, bool is_last_call) { const u32 argument = ProcessShadowRam(method, method_argument); ProcessDirtyRegisters(method, argument); - ProcessMethodCall(method, argument, method_argument, is_last_call); } diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h index cd996413c..f0a379801 100644 --- a/src/video_core/engines/maxwell_3d.h +++ b/src/video_core/engines/maxwell_3d.h @@ -272,6 +272,7 @@ public: }; union { + u32 raw; BitField<0, 1, Mode> mode; BitField<4, 8, u32> pad; }; @@ -1217,10 +1218,12 @@ public: struct Window { union { + u32 raw_1; BitField<0, 16, u32> x_min; BitField<16, 16, u32> x_max; }; union { + u32 raw_2; BitField<0, 16, u32> y_min; BitField<16, 16, u32> y_max; }; @@ -3090,9 +3093,16 @@ public: return macro_addresses[index]; } - void RefreshParameters(); + void RefreshParameters() { + if (!current_macro_dirty) { + return; + } + RefreshParametersImpl(); + } - bool AnyParametersDirty(); + bool AnyParametersDirty() { + return current_macro_dirty; + } u32 GetMaxCurrentVertices(); @@ -3101,6 +3111,9 @@ public: /// Handles a write to the CLEAR_BUFFERS register. void ProcessClearBuffers(u32 layer_count); + /// Handles a write to the CB_BIND register. + void ProcessCBBind(size_t stage_index); + private: void InitializeRegisterDefaults(); @@ -3154,12 +3167,11 @@ private: void ProcessCBData(u32 value); void ProcessCBMultiData(const u32* start_base, u32 amount); - /// Handles a write to the CB_BIND register. - void ProcessCBBind(size_t stage_index); - /// Returns a query's value or an empty object if the value will be deferred through a cache. std::optional<u64> GetQueryResult(); + void RefreshParametersImpl(); + Core::System& system; MemoryManager& memory_manager; @@ -3187,6 +3199,7 @@ private: bool draw_indexed{}; std::vector<std::pair<GPUVAddr, size_t>> macro_segments; std::vector<GPUVAddr> macro_addresses; + bool current_macro_dirty{}; }; #define ASSERT_REG_POSITION(field_name, position) \ |