Specify buffers to read when blitting output to backbuffer

This commit is contained in:
kd-11 2016-04-06 00:43:32 +03:00
parent 1a61ef0440
commit dab1dda903
3 changed files with 17 additions and 0 deletions

View File

@ -122,6 +122,14 @@ namespace gl
__glcheck glDrawBuffers((GLsizei)ids.size(), ids.data());
}
void fbo::read_buffer(const attachment& buffer) const
{
save_binding_state save(*this);
GLenum buf = buffer.id();
__glcheck glReadBuffer(buf);
}
void fbo::draw_arrays(rsx::primitive_type mode, GLsizei count, GLint first) const
{
save_binding_state save(*this);

View File

@ -1550,6 +1550,8 @@ namespace gl
void recreate();
void draw_buffer(const attachment& buffer) const;
void draw_buffers(const std::initializer_list<attachment>& indexes) const;
void read_buffer(const attachment& buffer) const;
void draw_arrays(rsx::primitive_type mode, GLsizei count, GLint first = 0) const;
void draw_arrays(const buffer& buffer, rsx::primitive_type mode, GLsizei count, GLint first = 0) const;

View File

@ -76,6 +76,7 @@ void GLGSRender::init_buffers(bool skip_reading)
if (draw_fbo && !m_rtts_dirty)
return;
m_rtts_dirty = false;
m_rtts.prepare_render_target(nullptr, surface_format, clip_horizontal, clip_vertical, rsx::to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET]),
@ -88,9 +89,12 @@ void GLGSRender::init_buffers(bool skip_reading)
if (std::get<0>(m_rtts.m_bound_render_targets[i]) != 0)
__glcheck draw_fbo.color[i] = *std::get<1>(m_rtts.m_bound_render_targets[i]);
}
if (std::get<0>(m_rtts.m_bound_depth_stencil) != 0)
__glcheck draw_fbo.depth = *std::get<1>(m_rtts.m_bound_depth_stencil);
__glcheck draw_fbo.check();
__glcheck draw_fbo.read_buffer(draw_fbo.color[0]);
switch (rsx::to_surface_target(rsx::method_registers[NV4097_SET_SURFACE_COLOR_TARGET]))
@ -102,8 +106,11 @@ void GLGSRender::init_buffers(bool skip_reading)
break;
case rsx::surface_target::surface_b:
{
__glcheck draw_fbo.draw_buffer(draw_fbo.color[1]);
__glcheck draw_fbo.read_buffer(draw_fbo.color[1]);
break;
}
case rsx::surface_target::surfaces_a_b:
__glcheck draw_fbo.draw_buffers({ draw_fbo.color[0], draw_fbo.color[1] });