diff options
| author | 2022-11-18 00:21:13 +0100 | |
|---|---|---|
| committer | 2023-01-01 16:43:57 -0500 | |
| commit | ce448ce770b6c329caec7ad1ae00e01dddb67b03 (patch) | |
| tree | 88a76a0416244c89d1031551b1a419a606324004 /src/video_core/engines | |
| parent | MacroHLE: Reduce massive calculations on sizing estimation. (diff) | |
| download | yuzu-ce448ce770b6c329caec7ad1ae00e01dddb67b03.tar.gz yuzu-ce448ce770b6c329caec7ad1ae00e01dddb67b03.tar.xz yuzu-ce448ce770b6c329caec7ad1ae00e01dddb67b03.zip | |
Revert Buffer cache changes and setup additional macros.
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: | |||
| 18 | virtual void CallMultiMethod(u32 method, const u32* base_start, u32 amount, | 18 | virtual void CallMultiMethod(u32 method, const u32* base_start, u32 amount, |
| 19 | u32 methods_pending) = 0; | 19 | u32 methods_pending) = 0; |
| 20 | 20 | ||
| 21 | bool current_dirty{}; | ||
| 21 | GPUVAddr current_dma_segment; | 22 | GPUVAddr current_dma_segment; |
| 22 | }; | 23 | }; |
| 23 | 24 | ||
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 @@ | |||
| 4 | #include <cstring> | 4 | #include <cstring> |
| 5 | #include <optional> | 5 | #include <optional> |
| 6 | #include "common/assert.h" | 6 | #include "common/assert.h" |
| 7 | #include "common/settings.h" | ||
| 7 | #include "core/core.h" | 8 | #include "core/core.h" |
| 8 | #include "core/core_timing.h" | 9 | #include "core/core_timing.h" |
| 9 | #include "video_core/dirty_flags.h" | 10 | #include "video_core/dirty_flags.h" |
| @@ -14,6 +15,7 @@ | |||
| 14 | #include "video_core/rasterizer_interface.h" | 15 | #include "video_core/rasterizer_interface.h" |
| 15 | #include "video_core/textures/texture.h" | 16 | #include "video_core/textures/texture.h" |
| 16 | 17 | ||
| 18 | |||
| 17 | namespace Tegra::Engines { | 19 | namespace Tegra::Engines { |
| 18 | 20 | ||
| 19 | using VideoCore::QueryType; | 21 | using VideoCore::QueryType; |
| @@ -134,6 +136,8 @@ void Maxwell3D::ProcessMacro(u32 method, const u32* base_start, u32 amount, bool | |||
| 134 | macro_addresses.push_back(current_dma_segment + i * sizeof(u32)); | 136 | macro_addresses.push_back(current_dma_segment + i * sizeof(u32)); |
| 135 | } | 137 | } |
| 136 | macro_segments.emplace_back(current_dma_segment, amount); | 138 | macro_segments.emplace_back(current_dma_segment, amount); |
| 139 | current_macro_dirty |= current_dirty; | ||
| 140 | current_dirty = false; | ||
| 137 | 141 | ||
| 138 | // Call the macro when there are no more parameters in the command buffer | 142 | // Call the macro when there are no more parameters in the command buffer |
| 139 | if (is_last_call) { | 143 | if (is_last_call) { |
| @@ -141,10 +145,14 @@ void Maxwell3D::ProcessMacro(u32 method, const u32* base_start, u32 amount, bool | |||
| 141 | macro_params.clear(); | 145 | macro_params.clear(); |
| 142 | macro_addresses.clear(); | 146 | macro_addresses.clear(); |
| 143 | macro_segments.clear(); | 147 | macro_segments.clear(); |
| 148 | current_macro_dirty = false; | ||
| 144 | } | 149 | } |
| 145 | } | 150 | } |
| 146 | 151 | ||
| 147 | void Maxwell3D::RefreshParameters() { | 152 | void Maxwell3D::RefreshParametersImpl() { |
| 153 | if (!Settings::IsGPULevelHigh()) { | ||
| 154 | return; | ||
| 155 | } | ||
| 148 | size_t current_index = 0; | 156 | size_t current_index = 0; |
| 149 | for (auto& segment : macro_segments) { | 157 | for (auto& segment : macro_segments) { |
| 150 | if (segment.first == 0) { | 158 | if (segment.first == 0) { |
| @@ -157,21 +165,6 @@ void Maxwell3D::RefreshParameters() { | |||
| 157 | } | 165 | } |
| 158 | } | 166 | } |
| 159 | 167 | ||
| 160 | bool Maxwell3D::AnyParametersDirty() { | ||
| 161 | size_t current_index = 0; | ||
| 162 | for (auto& segment : macro_segments) { | ||
| 163 | if (segment.first == 0) { | ||
| 164 | current_index += segment.second; | ||
| 165 | continue; | ||
| 166 | } | ||
| 167 | if (memory_manager.IsMemoryDirty(segment.first, sizeof(u32) * segment.second)) { | ||
| 168 | return true; | ||
| 169 | } | ||
| 170 | current_index += segment.second; | ||
| 171 | } | ||
| 172 | return false; | ||
| 173 | } | ||
| 174 | |||
| 175 | u32 Maxwell3D::GetMaxCurrentVertices() { | 168 | u32 Maxwell3D::GetMaxCurrentVertices() { |
| 176 | u32 num_vertices = 0; | 169 | u32 num_vertices = 0; |
| 177 | for (size_t index = 0; index < Regs::NumVertexArrays; ++index) { | 170 | 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) { | |||
| 332 | 325 | ||
| 333 | const u32 argument = ProcessShadowRam(method, method_argument); | 326 | const u32 argument = ProcessShadowRam(method, method_argument); |
| 334 | ProcessDirtyRegisters(method, argument); | 327 | ProcessDirtyRegisters(method, argument); |
| 335 | |||
| 336 | ProcessMethodCall(method, argument, method_argument, is_last_call); | 328 | ProcessMethodCall(method, argument, method_argument, is_last_call); |
| 337 | } | 329 | } |
| 338 | 330 | ||
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: | |||
| 272 | }; | 272 | }; |
| 273 | 273 | ||
| 274 | union { | 274 | union { |
| 275 | u32 raw; | ||
| 275 | BitField<0, 1, Mode> mode; | 276 | BitField<0, 1, Mode> mode; |
| 276 | BitField<4, 8, u32> pad; | 277 | BitField<4, 8, u32> pad; |
| 277 | }; | 278 | }; |
| @@ -1217,10 +1218,12 @@ public: | |||
| 1217 | 1218 | ||
| 1218 | struct Window { | 1219 | struct Window { |
| 1219 | union { | 1220 | union { |
| 1221 | u32 raw_1; | ||
| 1220 | BitField<0, 16, u32> x_min; | 1222 | BitField<0, 16, u32> x_min; |
| 1221 | BitField<16, 16, u32> x_max; | 1223 | BitField<16, 16, u32> x_max; |
| 1222 | }; | 1224 | }; |
| 1223 | union { | 1225 | union { |
| 1226 | u32 raw_2; | ||
| 1224 | BitField<0, 16, u32> y_min; | 1227 | BitField<0, 16, u32> y_min; |
| 1225 | BitField<16, 16, u32> y_max; | 1228 | BitField<16, 16, u32> y_max; |
| 1226 | }; | 1229 | }; |
| @@ -3090,9 +3093,16 @@ public: | |||
| 3090 | return macro_addresses[index]; | 3093 | return macro_addresses[index]; |
| 3091 | } | 3094 | } |
| 3092 | 3095 | ||
| 3093 | void RefreshParameters(); | 3096 | void RefreshParameters() { |
| 3097 | if (!current_macro_dirty) { | ||
| 3098 | return; | ||
| 3099 | } | ||
| 3100 | RefreshParametersImpl(); | ||
| 3101 | } | ||
| 3094 | 3102 | ||
| 3095 | bool AnyParametersDirty(); | 3103 | bool AnyParametersDirty() { |
| 3104 | return current_macro_dirty; | ||
| 3105 | } | ||
| 3096 | 3106 | ||
| 3097 | u32 GetMaxCurrentVertices(); | 3107 | u32 GetMaxCurrentVertices(); |
| 3098 | 3108 | ||
| @@ -3101,6 +3111,9 @@ public: | |||
| 3101 | /// Handles a write to the CLEAR_BUFFERS register. | 3111 | /// Handles a write to the CLEAR_BUFFERS register. |
| 3102 | void ProcessClearBuffers(u32 layer_count); | 3112 | void ProcessClearBuffers(u32 layer_count); |
| 3103 | 3113 | ||
| 3114 | /// Handles a write to the CB_BIND register. | ||
| 3115 | void ProcessCBBind(size_t stage_index); | ||
| 3116 | |||
| 3104 | private: | 3117 | private: |
| 3105 | void InitializeRegisterDefaults(); | 3118 | void InitializeRegisterDefaults(); |
| 3106 | 3119 | ||
| @@ -3154,12 +3167,11 @@ private: | |||
| 3154 | void ProcessCBData(u32 value); | 3167 | void ProcessCBData(u32 value); |
| 3155 | void ProcessCBMultiData(const u32* start_base, u32 amount); | 3168 | void ProcessCBMultiData(const u32* start_base, u32 amount); |
| 3156 | 3169 | ||
| 3157 | /// Handles a write to the CB_BIND register. | ||
| 3158 | void ProcessCBBind(size_t stage_index); | ||
| 3159 | |||
| 3160 | /// Returns a query's value or an empty object if the value will be deferred through a cache. | 3170 | /// Returns a query's value or an empty object if the value will be deferred through a cache. |
| 3161 | std::optional<u64> GetQueryResult(); | 3171 | std::optional<u64> GetQueryResult(); |
| 3162 | 3172 | ||
| 3173 | void RefreshParametersImpl(); | ||
| 3174 | |||
| 3163 | Core::System& system; | 3175 | Core::System& system; |
| 3164 | MemoryManager& memory_manager; | 3176 | MemoryManager& memory_manager; |
| 3165 | 3177 | ||
| @@ -3187,6 +3199,7 @@ private: | |||
| 3187 | bool draw_indexed{}; | 3199 | bool draw_indexed{}; |
| 3188 | std::vector<std::pair<GPUVAddr, size_t>> macro_segments; | 3200 | std::vector<std::pair<GPUVAddr, size_t>> macro_segments; |
| 3189 | std::vector<GPUVAddr> macro_addresses; | 3201 | std::vector<GPUVAddr> macro_addresses; |
| 3202 | bool current_macro_dirty{}; | ||
| 3190 | }; | 3203 | }; |
| 3191 | 3204 | ||
| 3192 | #define ASSERT_REG_POSITION(field_name, position) \ | 3205 | #define ASSERT_REG_POSITION(field_name, position) \ |