summaryrefslogtreecommitdiff
path: root/src/video_core/engines
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2023-01-03 10:01:25 -0500
committerGravatar Fernando Sahmkow2023-01-04 14:39:42 -0500
commita0c697124ced080f58866825e2e323e8682bbd7f (patch)
tree73830fc46134be10d7feffc3da11aa9f0ea58ffb /src/video_core/engines
parentTexture Cache: Implement async texture downloads. (diff)
downloadyuzu-a0c697124ced080f58866825e2e323e8682bbd7f.tar.gz
yuzu-a0c697124ced080f58866825e2e323e8682bbd7f.tar.xz
yuzu-a0c697124ced080f58866825e2e323e8682bbd7f.zip
Video_core: Address feedback
Diffstat (limited to 'src/video_core/engines')
-rw-r--r--src/video_core/engines/draw_manager.cpp13
-rw-r--r--src/video_core/engines/draw_manager.h2
-rw-r--r--src/video_core/engines/maxwell_3d.cpp13
-rw-r--r--src/video_core/engines/maxwell_3d.h30
4 files changed, 27 insertions, 31 deletions
diff --git a/src/video_core/engines/draw_manager.cpp b/src/video_core/engines/draw_manager.cpp
index feea89c0e..2437121ce 100644
--- a/src/video_core/engines/draw_manager.cpp
+++ b/src/video_core/engines/draw_manager.cpp
@@ -94,7 +94,7 @@ void DrawManager::DrawIndex(PrimitiveTopology topology, u32 index_first, u32 ind
94void DrawManager::DrawArrayIndirect(PrimitiveTopology topology) { 94void DrawManager::DrawArrayIndirect(PrimitiveTopology topology) {
95 draw_state.topology = topology; 95 draw_state.topology = topology;
96 96
97 ProcessDrawIndirect(true); 97 ProcessDrawIndirect();
98} 98}
99 99
100void DrawManager::DrawIndexedIndirect(PrimitiveTopology topology, u32 index_first, 100void DrawManager::DrawIndexedIndirect(PrimitiveTopology topology, u32 index_first,
@@ -105,7 +105,7 @@ void DrawManager::DrawIndexedIndirect(PrimitiveTopology topology, u32 index_firs
105 draw_state.index_buffer.first = index_first; 105 draw_state.index_buffer.first = index_first;
106 draw_state.index_buffer.count = index_count; 106 draw_state.index_buffer.count = index_count;
107 107
108 ProcessDrawIndirect(true); 108 ProcessDrawIndirect();
109} 109}
110 110
111void DrawManager::SetInlineIndexBuffer(u32 index) { 111void DrawManager::SetInlineIndexBuffer(u32 index) {
@@ -216,9 +216,12 @@ void DrawManager::ProcessDraw(bool draw_indexed, u32 instance_count) {
216 } 216 }
217} 217}
218 218
219void DrawManager::ProcessDrawIndirect(bool draw_indexed) { 219void DrawManager::ProcessDrawIndirect() {
220 LOG_TRACE(HW_GPU, "called, topology={}, count={}", draw_state.topology, 220 LOG_TRACE(
221 draw_indexed ? draw_state.index_buffer.count : draw_state.vertex_buffer.count); 221 HW_GPU,
222 "called, topology={}, is_indexed={}, includes_count={}, buffer_size={}, max_draw_count={}",
223 draw_state.topology, indirect_state.is_indexed, indirect_state.include_count,
224 indirect_state.buffer_size, indirect_state.max_draw_counts);
222 225
223 UpdateTopology(); 226 UpdateTopology();
224 227
diff --git a/src/video_core/engines/draw_manager.h b/src/video_core/engines/draw_manager.h
index 49a4fca48..58d1b2d59 100644
--- a/src/video_core/engines/draw_manager.h
+++ b/src/video_core/engines/draw_manager.h
@@ -85,7 +85,7 @@ private:
85 85
86 void ProcessDraw(bool draw_indexed, u32 instance_count); 86 void ProcessDraw(bool draw_indexed, u32 instance_count);
87 87
88 void ProcessDrawIndirect(bool draw_indexed); 88 void ProcessDrawIndirect();
89 89
90 Maxwell3D* maxwell3d{}; 90 Maxwell3D* maxwell3d{};
91 State draw_state{}; 91 State draw_state{};
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index 943a69935..fbfd1ddd2 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -220,9 +220,6 @@ void Maxwell3D::ProcessMacro(u32 method, const u32* base_start, u32 amount, bool
220} 220}
221 221
222void Maxwell3D::RefreshParametersImpl() { 222void Maxwell3D::RefreshParametersImpl() {
223 if (!Settings::IsGPULevelHigh()) {
224 return;
225 }
226 size_t current_index = 0; 223 size_t current_index = 0;
227 for (auto& segment : macro_segments) { 224 for (auto& segment : macro_segments) {
228 if (segment.first == 0) { 225 if (segment.first == 0) {
@@ -448,9 +445,11 @@ void Maxwell3D::CallMultiMethod(u32 method, const u32* base_start, u32 amount,
448 case MAXWELL3D_REG_INDEX(const_buffer.buffer) + 15: 445 case MAXWELL3D_REG_INDEX(const_buffer.buffer) + 15:
449 ProcessCBMultiData(base_start, amount); 446 ProcessCBMultiData(base_start, amount);
450 break; 447 break;
451 case MAXWELL3D_REG_INDEX(inline_data): 448 case MAXWELL3D_REG_INDEX(inline_data): {
449 ASSERT(methods_pending == amount);
452 upload_state.ProcessData(base_start, amount); 450 upload_state.ProcessData(base_start, amount);
453 return; 451 return;
452 }
454 default: 453 default:
455 for (u32 i = 0; i < amount; i++) { 454 for (u32 i = 0; i < amount; i++) {
456 CallMethod(method, base_start[i], methods_pending - i <= 1); 455 CallMethod(method, base_start[i], methods_pending - i <= 1);
@@ -537,7 +536,7 @@ void Maxwell3D::ProcessQueryGet() {
537void Maxwell3D::ProcessQueryCondition() { 536void Maxwell3D::ProcessQueryCondition() {
538 const GPUVAddr condition_address{regs.render_enable.Address()}; 537 const GPUVAddr condition_address{regs.render_enable.Address()};
539 switch (regs.render_enable_override) { 538 switch (regs.render_enable_override) {
540 case Regs::RenderEnable::Override::AlwaysRender: { 539 case Regs::RenderEnable::Override::AlwaysRender:
541 execute_on = true; 540 execute_on = true;
542 break; 541 break;
543 case Regs::RenderEnable::Override::NeverRender: 542 case Regs::RenderEnable::Override::NeverRender:
@@ -586,7 +585,6 @@ void Maxwell3D::ProcessQueryCondition() {
586 break; 585 break;
587 } 586 }
588 } 587 }
589 }
590} 588}
591 589
592void Maxwell3D::ProcessCounterReset() { 590void Maxwell3D::ProcessCounterReset() {
@@ -685,7 +683,8 @@ u32 Maxwell3D::GetRegisterValue(u32 method) const {
685 return regs.reg_array[method]; 683 return regs.reg_array[method];
686} 684}
687 685
688void Maxwell3D::setHLEReplacementName(u32 bank, u32 offset, HLEReplaceName name) { 686void Maxwell3D::SetHLEReplacementAttributeType(u32 bank, u32 offset,
687 HLEReplacementAttributeType name) {
689 const u64 key = (static_cast<u64>(bank) << 32) | offset; 688 const u64 key = (static_cast<u64>(bank) << 32) | offset;
690 replace_table.emplace(key, name); 689 replace_table.emplace(key, name);
691} 690}
diff --git a/src/video_core/engines/maxwell_3d.h b/src/video_core/engines/maxwell_3d.h
index a2dff0350..0b2fd2928 100644
--- a/src/video_core/engines/maxwell_3d.h
+++ b/src/video_core/engines/maxwell_3d.h
@@ -1218,12 +1218,12 @@ public:
1218 1218
1219 struct Window { 1219 struct Window {
1220 union { 1220 union {
1221 u32 raw_1; 1221 u32 raw_x;
1222 BitField<0, 16, u32> x_min; 1222 BitField<0, 16, u32> x_min;
1223 BitField<16, 16, u32> x_max; 1223 BitField<16, 16, u32> x_max;
1224 }; 1224 };
1225 union { 1225 union {
1226 u32 raw_2; 1226 u32 raw_y;
1227 BitField<0, 16, u32> y_min; 1227 BitField<0, 16, u32> y_min;
1228 BitField<16, 16, u32> y_max; 1228 BitField<16, 16, u32> y_max;
1229 }; 1229 };
@@ -3031,14 +3031,15 @@ public:
3031 3031
3032 EngineHint engine_state{EngineHint::None}; 3032 EngineHint engine_state{EngineHint::None};
3033 3033
3034 enum class HLEReplaceName : u32 { 3034 enum class HLEReplacementAttributeType : u32 {
3035 BaseVertex = 0x0, 3035 BaseVertex = 0x0,
3036 BaseInstance = 0x1, 3036 BaseInstance = 0x1,
3037 DrawID = 0x2,
3037 }; 3038 };
3038 3039
3039 void setHLEReplacementName(u32 bank, u32 offset, HLEReplaceName name); 3040 void SetHLEReplacementAttributeType(u32 bank, u32 offset, HLEReplacementAttributeType name);
3040 3041
3041 std::unordered_map<u64, HLEReplaceName> replace_table; 3042 std::unordered_map<u64, HLEReplacementAttributeType> replace_table;
3042 3043
3043 static_assert(sizeof(Regs) == Regs::NUM_REGS * sizeof(u32), "Maxwell3D Regs has wrong size"); 3044 static_assert(sizeof(Regs) == Regs::NUM_REGS * sizeof(u32), "Maxwell3D Regs has wrong size");
3044 static_assert(std::is_trivially_copyable_v<Regs>, "Maxwell3D Regs must be trivially copyable"); 3045 static_assert(std::is_trivially_copyable_v<Regs>, "Maxwell3D Regs must be trivially copyable");
@@ -3087,9 +3088,7 @@ public:
3087 std::unique_ptr<DrawManager> draw_manager; 3088 std::unique_ptr<DrawManager> draw_manager;
3088 friend class DrawManager; 3089 friend class DrawManager;
3089 3090
3090 std::vector<u8> inline_index_draw_indexes; 3091 GPUVAddr GetMacroAddress(size_t index) const {
3091
3092 GPUVAddr getMacroAddress(size_t index) const {
3093 return macro_addresses[index]; 3092 return macro_addresses[index];
3094 } 3093 }
3095 3094
@@ -3100,7 +3099,7 @@ public:
3100 RefreshParametersImpl(); 3099 RefreshParametersImpl();
3101 } 3100 }
3102 3101
3103 bool AnyParametersDirty() { 3102 bool AnyParametersDirty() const {
3104 return current_macro_dirty; 3103 return current_macro_dirty;
3105 } 3104 }
3106 3105
@@ -3114,6 +3113,10 @@ public:
3114 /// Handles a write to the CB_BIND register. 3113 /// Handles a write to the CB_BIND register.
3115 void ProcessCBBind(size_t stage_index); 3114 void ProcessCBBind(size_t stage_index);
3116 3115
3116 /// Handles a write to the CB_DATA[i] register.
3117 void ProcessCBData(u32 value);
3118 void ProcessCBMultiData(const u32* start_base, u32 amount);
3119
3117private: 3120private:
3118 void InitializeRegisterDefaults(); 3121 void InitializeRegisterDefaults();
3119 3122
@@ -3165,10 +3168,6 @@ private:
3165 /// Handles writes to syncing register. 3168 /// Handles writes to syncing register.
3166 void ProcessSyncPoint(); 3169 void ProcessSyncPoint();
3167 3170
3168 /// Handles a write to the CB_DATA[i] register.
3169 void ProcessCBData(u32 value);
3170 void ProcessCBMultiData(const u32* start_base, u32 amount);
3171
3172 /// Returns a query's value or an empty object if the value will be deferred through a cache. 3171 /// Returns a query's value or an empty object if the value will be deferred through a cache.
3173 std::optional<u64> GetQueryResult(); 3172 std::optional<u64> GetQueryResult();
3174 3173
@@ -3196,11 +3195,6 @@ private:
3196 3195
3197 bool execute_on{true}; 3196 bool execute_on{true};
3198 3197
3199 std::array<bool, Regs::NUM_REGS> draw_command{};
3200 std::vector<u32> deferred_draw_method;
3201 enum class DrawMode : u32 { General = 0, Instance, InlineIndex };
3202 DrawMode draw_mode{DrawMode::General};
3203 bool draw_indexed{};
3204 std::vector<std::pair<GPUVAddr, size_t>> macro_segments; 3198 std::vector<std::pair<GPUVAddr, size_t>> macro_segments;
3205 std::vector<GPUVAddr> macro_addresses; 3199 std::vector<GPUVAddr> macro_addresses;
3206 bool current_macro_dirty{}; 3200 bool current_macro_dirty{};