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/engines/draw_manager.cpp | 13 ++++++++----- src/video_core/engines/draw_manager.h | 2 +- src/video_core/engines/maxwell_3d.cpp | 13 ++++++------- src/video_core/engines/maxwell_3d.h | 30 ++++++++++++------------------ 4 files changed, 27 insertions(+), 31 deletions(-) (limited to 'src/video_core/engines') 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 void DrawManager::DrawArrayIndirect(PrimitiveTopology topology) { draw_state.topology = topology; - ProcessDrawIndirect(true); + ProcessDrawIndirect(); } void DrawManager::DrawIndexedIndirect(PrimitiveTopology topology, u32 index_first, @@ -105,7 +105,7 @@ void DrawManager::DrawIndexedIndirect(PrimitiveTopology topology, u32 index_firs draw_state.index_buffer.first = index_first; draw_state.index_buffer.count = index_count; - ProcessDrawIndirect(true); + ProcessDrawIndirect(); } void DrawManager::SetInlineIndexBuffer(u32 index) { @@ -216,9 +216,12 @@ void DrawManager::ProcessDraw(bool draw_indexed, u32 instance_count) { } } -void DrawManager::ProcessDrawIndirect(bool draw_indexed) { - LOG_TRACE(HW_GPU, "called, topology={}, count={}", draw_state.topology, - draw_indexed ? draw_state.index_buffer.count : draw_state.vertex_buffer.count); +void DrawManager::ProcessDrawIndirect() { + LOG_TRACE( + HW_GPU, + "called, topology={}, is_indexed={}, includes_count={}, buffer_size={}, max_draw_count={}", + draw_state.topology, indirect_state.is_indexed, indirect_state.include_count, + indirect_state.buffer_size, indirect_state.max_draw_counts); UpdateTopology(); 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: void ProcessDraw(bool draw_indexed, u32 instance_count); - void ProcessDrawIndirect(bool draw_indexed); + void ProcessDrawIndirect(); Maxwell3D* maxwell3d{}; 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 } void Maxwell3D::RefreshParametersImpl() { - if (!Settings::IsGPULevelHigh()) { - return; - } size_t current_index = 0; for (auto& segment : macro_segments) { if (segment.first == 0) { @@ -448,9 +445,11 @@ void Maxwell3D::CallMultiMethod(u32 method, const u32* base_start, u32 amount, case MAXWELL3D_REG_INDEX(const_buffer.buffer) + 15: ProcessCBMultiData(base_start, amount); break; - case MAXWELL3D_REG_INDEX(inline_data): + case MAXWELL3D_REG_INDEX(inline_data): { + ASSERT(methods_pending == amount); upload_state.ProcessData(base_start, amount); return; + } default: for (u32 i = 0; i < amount; i++) { CallMethod(method, base_start[i], methods_pending - i <= 1); @@ -537,7 +536,7 @@ void Maxwell3D::ProcessQueryGet() { void Maxwell3D::ProcessQueryCondition() { const GPUVAddr condition_address{regs.render_enable.Address()}; switch (regs.render_enable_override) { - case Regs::RenderEnable::Override::AlwaysRender: { + case Regs::RenderEnable::Override::AlwaysRender: execute_on = true; break; case Regs::RenderEnable::Override::NeverRender: @@ -586,7 +585,6 @@ void Maxwell3D::ProcessQueryCondition() { break; } } - } } void Maxwell3D::ProcessCounterReset() { @@ -685,7 +683,8 @@ u32 Maxwell3D::GetRegisterValue(u32 method) const { return regs.reg_array[method]; } -void Maxwell3D::setHLEReplacementName(u32 bank, u32 offset, HLEReplaceName name) { +void Maxwell3D::SetHLEReplacementAttributeType(u32 bank, u32 offset, + HLEReplacementAttributeType name) { const u64 key = (static_cast(bank) << 32) | offset; replace_table.emplace(key, name); } 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: struct Window { union { - u32 raw_1; + u32 raw_x; BitField<0, 16, u32> x_min; BitField<16, 16, u32> x_max; }; union { - u32 raw_2; + u32 raw_y; BitField<0, 16, u32> y_min; BitField<16, 16, u32> y_max; }; @@ -3031,14 +3031,15 @@ public: EngineHint engine_state{EngineHint::None}; - enum class HLEReplaceName : u32 { + enum class HLEReplacementAttributeType : u32 { BaseVertex = 0x0, BaseInstance = 0x1, + DrawID = 0x2, }; - void setHLEReplacementName(u32 bank, u32 offset, HLEReplaceName name); + void SetHLEReplacementAttributeType(u32 bank, u32 offset, HLEReplacementAttributeType name); - std::unordered_map replace_table; + std::unordered_map replace_table; static_assert(sizeof(Regs) == Regs::NUM_REGS * sizeof(u32), "Maxwell3D Regs has wrong size"); static_assert(std::is_trivially_copyable_v, "Maxwell3D Regs must be trivially copyable"); @@ -3087,9 +3088,7 @@ public: std::unique_ptr draw_manager; friend class DrawManager; - std::vector inline_index_draw_indexes; - - GPUVAddr getMacroAddress(size_t index) const { + GPUVAddr GetMacroAddress(size_t index) const { return macro_addresses[index]; } @@ -3100,7 +3099,7 @@ public: RefreshParametersImpl(); } - bool AnyParametersDirty() { + bool AnyParametersDirty() const { return current_macro_dirty; } @@ -3114,6 +3113,10 @@ public: /// Handles a write to the CB_BIND register. void ProcessCBBind(size_t stage_index); + /// Handles a write to the CB_DATA[i] register. + void ProcessCBData(u32 value); + void ProcessCBMultiData(const u32* start_base, u32 amount); + private: void InitializeRegisterDefaults(); @@ -3165,10 +3168,6 @@ private: /// Handles writes to syncing register. void ProcessSyncPoint(); - /// Handles a write to the CB_DATA[i] register. - void ProcessCBData(u32 value); - void ProcessCBMultiData(const u32* start_base, u32 amount); - /// Returns a query's value or an empty object if the value will be deferred through a cache. std::optional GetQueryResult(); @@ -3196,11 +3195,6 @@ private: bool execute_on{true}; - std::array draw_command{}; - std::vector deferred_draw_method; - enum class DrawMode : u32 { General = 0, Instance, InlineIndex }; - DrawMode draw_mode{DrawMode::General}; - bool draw_indexed{}; std::vector> macro_segments; std::vector macro_addresses; bool current_macro_dirty{}; -- cgit v1.2.3