From 8dfea032f2fa367028c24fe4112f4e3638c51ec0 Mon Sep 17 00:00:00 2001 From: kd-11 Date: Wed, 4 Dec 2019 15:07:20 +0300 Subject: [PATCH] rsx: Remove deprecated do_method path that has been superceded by c++ inheritance for many years --- rpcs3/Emu/RSX/GL/GLGSRender.cpp | 50 ++++++----------------------- rpcs3/Emu/RSX/GL/GLGSRender.h | 3 +- rpcs3/Emu/RSX/Null/NullGSRender.cpp | 5 --- rpcs3/Emu/RSX/Null/NullGSRender.h | 1 - rpcs3/Emu/RSX/RSXThread.h | 2 +- rpcs3/Emu/RSX/VK/VKGSRender.cpp | 18 ----------- rpcs3/Emu/RSX/VK/VKGSRender.h | 3 +- rpcs3/Emu/RSX/rsx_methods.cpp | 23 +++---------- 8 files changed, 16 insertions(+), 89 deletions(-) diff --git a/rpcs3/Emu/RSX/GL/GLGSRender.cpp b/rpcs3/Emu/RSX/GL/GLGSRender.cpp index 516a96f4bd..5e19ae3ef6 100644 --- a/rpcs3/Emu/RSX/GL/GLGSRender.cpp +++ b/rpcs3/Emu/RSX/GL/GLGSRender.cpp @@ -1100,7 +1100,7 @@ void GLGSRender::on_exit() void GLGSRender::clear_surface(u32 arg) { - if (skip_current_frame || !framebuffer_status_valid) return; + if (skip_current_frame) return; // If stencil write mask is disabled, remove clear_stencil bit if (!rsx::method_registers.stencil_mask()) arg &= ~0x2u; @@ -1108,6 +1108,14 @@ void GLGSRender::clear_surface(u32 arg) // Ignore invalid clear flags if ((arg & 0xf3) == 0) return; + u8 ctx = rsx::framebuffer_creation_context::context_draw; + if (arg & 0xF0) ctx |= rsx::framebuffer_creation_context::context_clear_color; + if (arg & 0x3) ctx |= rsx::framebuffer_creation_context::context_clear_depth; + + init_buffers((rsx::framebuffer_creation_context)ctx, true); + + if (!framebuffer_status_valid) return; + GLbitfield mask = 0; gl::command_context cmd{ gl_state }; @@ -1223,46 +1231,6 @@ void GLGSRender::clear_surface(u32 arg) glClear(mask); } -bool GLGSRender::do_method(u32 cmd, u32 arg) -{ - switch (cmd) - { - case NV4097_CLEAR_SURFACE: - { - if (arg & 0xF3) - { - //Only do all this if we have actual work to do - u8 ctx = rsx::framebuffer_creation_context::context_draw; - if (arg & 0xF0) ctx |= rsx::framebuffer_creation_context::context_clear_color; - if (arg & 0x3) ctx |= rsx::framebuffer_creation_context::context_clear_depth; - - init_buffers(rsx::framebuffer_creation_context{ctx}, true); - clear_surface(arg); - } - - return true; - } - case NV4097_CLEAR_ZCULL_SURFACE: - { - // NOP - // Clearing zcull memory does not modify depth/stencil buffers 'bound' to the zcull region - return true; - } - case NV4097_TEXTURE_READ_SEMAPHORE_RELEASE: - { - // Texture barrier, seemingly not very useful - return true; - } - case NV4097_BACK_END_WRITE_SEMAPHORE_RELEASE: - { - //flush_draw_buffers = true; - return true; - } - } - - return false; -} - bool GLGSRender::load_program() { if (m_graphics_state & rsx::pipeline_state::invalidate_pipeline_bits) diff --git a/rpcs3/Emu/RSX/GL/GLGSRender.h b/rpcs3/Emu/RSX/GL/GLGSRender.h index ef24dc66fb..44311d703b 100644 --- a/rpcs3/Emu/RSX/GL/GLGSRender.h +++ b/rpcs3/Emu/RSX/GL/GLGSRender.h @@ -137,7 +137,6 @@ private: gl::vertex_upload_info set_vertex_buffer(); rsx::vertex_input_layout m_vertex_layout = {}; - void clear_surface(u32 arg); void init_buffers(rsx::framebuffer_creation_context context, bool skip_reading = false); bool load_program(); @@ -162,12 +161,12 @@ public: void discard_occlusion_query(rsx::reports::occlusion_query_info* query) override; protected: + void clear_surface(u32 arg) override; void begin() override; void end() override; void on_init_thread() override; void on_exit() override; - bool do_method(u32 cmd, u32 arg) override; void flip(const rsx::display_flip_info_t& info) override; void do_local_task(rsx::FIFO_state state) override; diff --git a/rpcs3/Emu/RSX/Null/NullGSRender.cpp b/rpcs3/Emu/RSX/Null/NullGSRender.cpp index e7b1e00962..e3dcec47fd 100644 --- a/rpcs3/Emu/RSX/Null/NullGSRender.cpp +++ b/rpcs3/Emu/RSX/Null/NullGSRender.cpp @@ -11,11 +11,6 @@ NullGSRender::NullGSRender() : GSRender() { } -bool NullGSRender::do_method(u32 cmd, u32 value) -{ - return false; -} - void NullGSRender::end() { rsx::method_registers.current_draw_clause.end(); diff --git a/rpcs3/Emu/RSX/Null/NullGSRender.h b/rpcs3/Emu/RSX/Null/NullGSRender.h index a22b4516d9..a49e711afd 100644 --- a/rpcs3/Emu/RSX/Null/NullGSRender.h +++ b/rpcs3/Emu/RSX/Null/NullGSRender.h @@ -8,6 +8,5 @@ public: NullGSRender(); private: - bool do_method(u32 cmd, u32 value) final; void end() override; }; diff --git a/rpcs3/Emu/RSX/RSXThread.h b/rpcs3/Emu/RSX/RSXThread.h index c9161eb985..cd05907843 100644 --- a/rpcs3/Emu/RSX/RSXThread.h +++ b/rpcs3/Emu/RSX/RSXThread.h @@ -687,13 +687,13 @@ namespace rsx void run_FIFO(); public: + virtual void clear_surface(u32 arg) {}; virtual void begin(); virtual void end(); virtual void execute_nop_draw(); virtual void on_init_rsx() = 0; virtual void on_init_thread() = 0; - virtual bool do_method(u32 /*cmd*/, u32 /*value*/) { return false; } virtual void on_frame_end(u32 buffer, bool forced = false); virtual void flip(const display_flip_info_t& info) = 0; virtual u64 timestamp(); diff --git a/rpcs3/Emu/RSX/VK/VKGSRender.cpp b/rpcs3/Emu/RSX/VK/VKGSRender.cpp index 24bc1ed009..bcad7d031e 100644 --- a/rpcs3/Emu/RSX/VK/VKGSRender.cpp +++ b/rpcs3/Emu/RSX/VK/VKGSRender.cpp @@ -2485,24 +2485,6 @@ void VKGSRender::do_local_task(rsx::FIFO_state state) } } -bool VKGSRender::do_method(u32 cmd, u32 arg) -{ - switch (cmd) - { - case NV4097_CLEAR_SURFACE: - clear_surface(arg); - return true; - case NV4097_TEXTURE_READ_SEMAPHORE_RELEASE: - // Texture barrier, seemingly not very useful - return true; - case NV4097_BACK_END_WRITE_SEMAPHORE_RELEASE: - //sync_at_semaphore_release(); - return true; - default: - return false; - } -} - bool VKGSRender::load_program() { if (m_graphics_state & rsx::pipeline_state::invalidate_pipeline_bits) diff --git a/rpcs3/Emu/RSX/VK/VKGSRender.h b/rpcs3/Emu/RSX/VK/VKGSRender.h index 9c99c60d30..ee010ec91a 100644 --- a/rpcs3/Emu/RSX/VK/VKGSRender.h +++ b/rpcs3/Emu/RSX/VK/VKGSRender.h @@ -426,7 +426,6 @@ public: ~VKGSRender() override; private: - void clear_surface(u32 mask); void prepare_rtts(rsx::framebuffer_creation_context context); void open_command_buffer(); @@ -478,13 +477,13 @@ public: void emergency_query_cleanup(vk::command_buffer* commands); protected: + void clear_surface(u32 mask) override; void begin() override; void end() override; void emit_geometry(u32 sub_index) override; void on_init_thread() override; void on_exit() override; - bool do_method(u32 cmd, u32 arg) override; void flip(const rsx::display_flip_info_t& info) override; void do_local_task(rsx::FIFO_state state) override; diff --git a/rpcs3/Emu/RSX/rsx_methods.cpp b/rpcs3/Emu/RSX/rsx_methods.cpp index 4b302afbe0..b0893c08a2 100644 --- a/rpcs3/Emu/RSX/rsx_methods.cpp +++ b/rpcs3/Emu/RSX/rsx_methods.cpp @@ -152,11 +152,7 @@ namespace rsx { void clear(thread* rsx, u32 _reg, u32 arg) { - // TODO: every backend must override method table to insert its own handlers - if (!rsx->do_method(NV4097_CLEAR_SURFACE, arg)) - { - // - } + rsx->clear_surface(arg); if (capture_current_frame) { @@ -166,8 +162,6 @@ namespace rsx void clear_zcull(thread* rsx, u32 _reg, u32 arg) { - rsx->do_method(NV4097_CLEAR_ZCULL_SURFACE, arg); - if (capture_current_frame) { rsx->capture_frame("clear zcull memory"); @@ -212,11 +206,6 @@ namespace rsx // lle-gcm likes to inject system reserved semaphores, presumably for system/vsh usage // Avoid calling render to avoid any havoc(flickering) they may cause from invalid flush/write const u32 offset = method_registers.semaphore_offset_4097() & -16; - if (offset > 63 * 4 && !rsx->do_method(NV4097_TEXTURE_READ_SEMAPHORE_RELEASE, arg)) - { - // - } - vm::_ref>(get_address(offset, method_registers.semaphore_context_dma_4097())).store( { arg, @@ -228,14 +217,10 @@ namespace rsx void back_end_write_semaphore_release(thread* rsx, u32 _reg, u32 arg) { // Full pipeline barrier - const u32 offset = method_registers.semaphore_offset_4097() & -16; - if (offset > 63 * 4 && !rsx->do_method(NV4097_BACK_END_WRITE_SEMAPHORE_RELEASE, arg)) - { - // - } - rsx->sync(); - u32 val = (arg & 0xff00ff00) | ((arg & 0xff) << 16) | ((arg >> 16) & 0xff); + + const u32 offset = method_registers.semaphore_offset_4097() & -16; + const u32 val = (arg & 0xff00ff00) | ((arg & 0xff) << 16) | ((arg >> 16) & 0xff); vm::_ref>(get_address(offset, method_registers.semaphore_context_dma_4097())).store( { val,