mirror of
https://github.com/RPCS3/rpcs3.git
synced 2026-03-26 12:28:34 -06:00
overlays: Show overlays in window space when requested
This commit is contained in:
parent
716ff5a212
commit
b53631ebcc
@ -399,8 +399,9 @@ namespace gl
|
||||
|
||||
void ui_overlay_renderer::run(gl::command_context& cmd_, const areau& viewport, GLuint target, rsx::overlays::overlay& ui, bool flip_vertically)
|
||||
{
|
||||
ui.set_render_viewport(viewport.width(), viewport.height());
|
||||
program_handle.uniforms["viewport"] = color4f(static_cast<f32>(viewport.width()), static_cast<f32>(viewport.height()), static_cast<f32>(viewport.x1), static_cast<f32>(viewport.y1));
|
||||
program_handle.uniforms["ui_scale"] = color4f(static_cast<f32>(ui.virtual_width), static_cast<f32>(ui.virtual_height), 1.f, 1.f);
|
||||
program_handle.uniforms["ui_scale"] = color4f(static_cast<f32>(ui.get_virtual_width()), static_cast<f32>(ui.get_virtual_height()), 1.f, 1.f);
|
||||
|
||||
saved_sampler_state save_30(30, m_sampler);
|
||||
saved_sampler_state save_31(31, m_sampler);
|
||||
|
||||
@ -316,9 +316,11 @@ void GLGSRender::flip(const rsx::display_flip_info_t& info)
|
||||
// Lock to avoid modification during run-update chain
|
||||
std::lock_guard lock(*m_overlay_manager);
|
||||
|
||||
const areau display_area = {0, 0, static_cast<u32>(m_frame->client_width()), static_cast<u32>(m_frame->client_height())};
|
||||
for (const auto& view : m_overlay_manager->get_views())
|
||||
{
|
||||
m_ui_renderer.run(cmd, aspect_ratio, target, *view.get(), flip_vertically);
|
||||
const areau render_area = view->use_window_space ? display_area : aspect_ratio;
|
||||
m_ui_renderer.run(cmd, render_area, target, *view.get(), flip_vertically);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@ -46,6 +46,7 @@ namespace rsx
|
||||
|
||||
static constexpr u16 virtual_width = 1280;
|
||||
static constexpr u16 virtual_height = 720;
|
||||
bool use_window_space = false;
|
||||
|
||||
u32 min_refresh_duration_us = 16600;
|
||||
atomic_t<bool> visible = false;
|
||||
@ -57,6 +58,9 @@ namespace rsx
|
||||
virtual compiled_resource get_compiled() = 0;
|
||||
|
||||
void refresh() const;
|
||||
virtual u16 get_virtual_width() const { return virtual_width;}
|
||||
virtual u16 get_virtual_height() const { return virtual_height;}
|
||||
virtual void set_render_viewport(u32 /*width*/, u32 /*height*/) {}
|
||||
};
|
||||
|
||||
// Interactable UI element
|
||||
|
||||
@ -613,7 +613,8 @@ namespace vk
|
||||
void ui_overlay_renderer::run(vk::command_buffer& cmd, const areau& viewport, vk::framebuffer* target, VkRenderPass render_pass,
|
||||
vk::data_heap& upload_heap, rsx::overlays::overlay& ui)
|
||||
{
|
||||
m_scale_offset = color4f(ui.virtual_width, ui.virtual_height, 1.f, 1.f);
|
||||
ui.set_render_viewport(viewport.width(), viewport.height());
|
||||
m_scale_offset = color4f(ui.get_virtual_width(), ui.get_virtual_height(), 1.f, 1.f);
|
||||
m_viewport = { { static_cast<f32>(viewport.x1), static_cast<f32>(viewport.y1) }, { static_cast<f32>(viewport.width()), static_cast<f32>(viewport.height()) } };
|
||||
|
||||
std::vector<vk::image_view*> image_views
|
||||
|
||||
@ -662,9 +662,11 @@ void VKGSRender::flip(const rsx::display_flip_info_t& info)
|
||||
auto ui_renderer = vk::get_overlay_pass<vk::ui_overlay_renderer>();
|
||||
std::lock_guard lock(*m_overlay_manager);
|
||||
|
||||
const areau display_area = {0, 0, static_cast<u32>(m_swapchain_dims.width), static_cast<u32>(m_swapchain_dims.height)};
|
||||
for (const auto& view : m_overlay_manager->get_views())
|
||||
{
|
||||
ui_renderer->run(*m_current_command_buffer, area, fbo, single_target_pass, m_texture_upload_buffer_ring_info, *view.get());
|
||||
const areau render_area = view->use_window_space ? display_area : area;
|
||||
ui_renderer->run(*m_current_command_buffer, render_area, fbo, single_target_pass, m_texture_upload_buffer_ring_info, *view.get());
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user