mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-06 06:51:26 +12:00
gl: Fix memory barrier implementation and stub for RCB/RDB
- It's a miracle it even compiled
This commit is contained in:
parent
50b1e26b17
commit
2b5c24b304
2 changed files with 46 additions and 19 deletions
|
@ -429,9 +429,7 @@ void GLGSRender::read_buffers()
|
||||||
// TODO
|
// TODO
|
||||||
}
|
}
|
||||||
|
|
||||||
void gl::render_target::memory_barrier(gl::command_context& cmd, bool force_init)
|
void gl::render_target::clear_memory(gl::command_context& cmd)
|
||||||
{
|
|
||||||
auto clear_surface_impl = [&]()
|
|
||||||
{
|
{
|
||||||
if (aspect() & gl::image_aspect::depth)
|
if (aspect() & gl::image_aspect::depth)
|
||||||
{
|
{
|
||||||
|
@ -443,16 +441,41 @@ void gl::render_target::memory_barrier(gl::command_context& cmd, bool force_init
|
||||||
}
|
}
|
||||||
|
|
||||||
state_flags &= ~rsx::surface_state_flags::erase_bkgnd;
|
state_flags &= ~rsx::surface_state_flags::erase_bkgnd;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
void gl::render_target::load_memory(gl::command_context& cmd)
|
||||||
|
{
|
||||||
|
// TODO
|
||||||
|
clear_memory(cmd);
|
||||||
|
}
|
||||||
|
|
||||||
|
void gl::render_target::initialize_memory(gl::command_context& cmd, bool /*read_access*/)
|
||||||
|
{
|
||||||
|
const bool memory_load = is_depth_surface() ?
|
||||||
|
!!g_cfg.video.read_depth_buffer :
|
||||||
|
!!g_cfg.video.read_color_buffers;
|
||||||
|
|
||||||
|
if (!memory_load)
|
||||||
|
{
|
||||||
|
clear_memory(cmd);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
load_memory(cmd);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void gl::render_target::memory_barrier(gl::command_context& cmd, rsx::surface_access access)
|
||||||
|
{
|
||||||
|
const bool read_access = (access != rsx::surface_access::write);
|
||||||
|
|
||||||
if (old_contents.empty())
|
if (old_contents.empty())
|
||||||
{
|
{
|
||||||
// No memory to inherit
|
// No memory to inherit
|
||||||
if (dirty() && (force_init || state_flags & rsx::surface_state_flags::erase_bkgnd))
|
if (dirty() && (read_access || state_flags & rsx::surface_state_flags::erase_bkgnd))
|
||||||
{
|
{
|
||||||
// Initialize memory contents if we did not find anything usable
|
// Initialize memory contents if we did not find anything usable
|
||||||
// TODO: Properly sync with Cell
|
initialize_memory(cmd, true);
|
||||||
clear_surface_impl();
|
|
||||||
on_write();
|
on_write();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -496,7 +519,7 @@ void gl::render_target::memory_barrier(gl::command_context& cmd, bool force_init
|
||||||
const auto area = section.dst_rect();
|
const auto area = section.dst_rect();
|
||||||
if (area.x1 > 0 || area.y1 > 0 || unsigned(area.x2) < width() || unsigned(area.y2) < height())
|
if (area.x1 > 0 || area.y1 > 0 || unsigned(area.x2) < width() || unsigned(area.y2) < height())
|
||||||
{
|
{
|
||||||
clear_surface_impl();
|
initialize_memory(cmd, false);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -49,6 +49,10 @@ namespace gl
|
||||||
{
|
{
|
||||||
u16 surface_pixel_size = 0;
|
u16 surface_pixel_size = 0;
|
||||||
|
|
||||||
|
void clear_memory(gl::command_context& cmd);
|
||||||
|
void load_memory(gl::command_context& cmd);
|
||||||
|
void initialize_memory(gl::command_context& cmd, bool read_access);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
render_target(GLuint width, GLuint height, GLenum sized_format)
|
render_target(GLuint width, GLuint height, GLenum sized_format)
|
||||||
: viewable_image(GL_TEXTURE_2D, width, height, 1, 1, sized_format)
|
: viewable_image(GL_TEXTURE_2D, width, height, 1, 1, sized_format)
|
||||||
|
@ -107,9 +111,9 @@ namespace gl
|
||||||
return (rsx::apply_resolution_scale(_width, true) == width()) && (rsx::apply_resolution_scale(_height, true) == height());
|
return (rsx::apply_resolution_scale(_width, true) == width()) && (rsx::apply_resolution_scale(_height, true) == height());
|
||||||
}
|
}
|
||||||
|
|
||||||
void memory_barrier(gl::command_context& cmd, bool force_init = false);
|
void memory_barrier(gl::command_context& cmd, rsx::surface_access access);
|
||||||
void read_barrier(gl::command_context& cmd) { memory_barrier(cmd, true); }
|
void read_barrier(gl::command_context& cmd) { memory_barrier(cmd, rsx::surface_access::read); }
|
||||||
void write_barrier(gl::command_context& cmd) { memory_barrier(cmd, false); }
|
void write_barrier(gl::command_context& cmd) { memory_barrier(cmd, rsx::surface_access::write); }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct framebuffer_holder : public gl::fbo, public rsx::ref_counted
|
struct framebuffer_holder : public gl::fbo, public rsx::ref_counted
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue