Use move semantics for present_frame

This commit is contained in:
Megamouse 2025-03-03 18:41:42 +01:00
parent 01cdc83aeb
commit f913edede4
7 changed files with 9 additions and 9 deletions

View file

@ -296,7 +296,7 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
}
else
{
m_frame->present_frame(sshot_frame, buffer_width * 4, buffer_width, buffer_height, false);
m_frame->present_frame(std::move(sshot_frame), buffer_width * 4, buffer_width, buffer_height, false);
}
}

View file

@ -31,6 +31,6 @@ public:
virtual display_handle_t handle() const = 0;
virtual bool can_consume_frame() const = 0;
virtual void present_frame(std::vector<u8>& data, u32 pitch, u32 width, u32 height, bool is_bgra) const = 0;
virtual void present_frame(std::vector<u8>&& data, u32 pitch, u32 width, u32 height, bool is_bgra) const = 0;
virtual void take_screenshot(std::vector<u8>&& sshot_data, u32 sshot_width, u32 sshot_height, bool is_bgra) = 0;
};

View file

@ -749,7 +749,7 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info)
image_to_flip->pop_layout(*m_current_command_buffer);
flush_command_queue(true);
auto src = sshot_vkbuf.map(0, sshot_size);
const auto src = sshot_vkbuf.map(0, sshot_size);
std::vector<u8> sshot_frame(sshot_size);
memcpy(sshot_frame.data(), src, sshot_size);
sshot_vkbuf.unmap();
@ -762,7 +762,7 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info)
}
else
{
m_frame->present_frame(sshot_frame, buffer_width * 4, buffer_width, buffer_height, is_bgra);
m_frame->present_frame(std::move(sshot_frame), buffer_width * 4, buffer_width, buffer_height, is_bgra);
}
}
}

View file

@ -787,10 +787,10 @@ bool gs_frame::can_consume_frame() const
return video_provider.can_consume_frame();
}
void gs_frame::present_frame(std::vector<u8>& data, u32 pitch, u32 width, u32 height, bool is_bgra) const
void gs_frame::present_frame(std::vector<u8>&& data, u32 pitch, u32 width, u32 height, bool is_bgra) const
{
utils::video_provider& video_provider = g_fxo->get<utils::video_provider>();
video_provider.present_frame(data, pitch, width, height, is_bgra);
video_provider.present_frame(std::move(data), pitch, width, height, is_bgra);
}
void gs_frame::take_screenshot(std::vector<u8>&& data, u32 sshot_width, u32 sshot_height, bool is_bgra)

View file

@ -78,7 +78,7 @@ public:
bool get_mouse_lock_state();
bool can_consume_frame() const override;
void present_frame(std::vector<u8>& data, u32 pitch, u32 width, u32 height, bool is_bgra) const override;
void present_frame(std::vector<u8>&& data, u32 pitch, u32 width, u32 height, bool is_bgra) const override;
void take_screenshot(std::vector<u8>&& data, u32 sshot_width, u32 sshot_height, bool is_bgra) override;
protected:

View file

@ -122,7 +122,7 @@ namespace utils
return pts > m_last_video_pts_incoming;
}
void video_provider::present_frame(std::vector<u8>& data, u32 pitch, u32 width, u32 height, bool is_bgra)
void video_provider::present_frame(std::vector<u8>&& data, u32 pitch, u32 width, u32 height, bool is_bgra)
{
if (!m_active)
{

View file

@ -21,7 +21,7 @@ namespace utils
void set_pause_time_us(usz pause_time_us);
bool can_consume_frame();
void present_frame(std::vector<u8>& data, u32 pitch, u32 width, u32 height, bool is_bgra);
void present_frame(std::vector<u8>&& data, u32 pitch, u32 width, u32 height, bool is_bgra);
void present_samples(u8* buf, u32 sample_count, u16 channels);