rsx: Remove some old restrictions affecting memory persistence

This commit is contained in:
kd-11 2019-04-03 20:48:32 +03:00 committed by kd-11
parent 0a604e39f1
commit f04a0a2bb6
3 changed files with 18 additions and 29 deletions

View File

@ -367,8 +367,8 @@ namespace gl
{
std::unique_ptr<texture> typeless_src;
std::unique_ptr<texture> typeless_dst;
u32 src_id = src->id();
u32 dst_id = dst->id();
const gl::texture* real_src = src;
const gl::texture* real_dst = dst;
if (xfer_info.src_is_typeless)
{
@ -380,7 +380,7 @@ namespace gl
typeless_src = std::make_unique<texture>(GL_TEXTURE_2D, internal_width, src->height(), 1, 1, internal_fmt);
copy_typeless(typeless_src.get(), src);
src_id = typeless_src->id();
real_src = typeless_src.get();
src_rect.x1 = (u16)(src_rect.x1 * xfer_info.src_scaling_hint);
src_rect.x2 = (u16)(src_rect.x2 * xfer_info.src_scaling_hint);
}
@ -395,7 +395,7 @@ namespace gl
typeless_dst = std::make_unique<texture>(GL_TEXTURE_2D, internal_width, dst->height(), 1, 1, internal_fmt);
copy_typeless(typeless_dst.get(), dst);
dst_id = typeless_dst->id();
real_dst = typeless_dst.get();
dst_rect.x1 = (u16)(dst_rect.x1 * xfer_info.dst_scaling_hint);
dst_rect.x2 = (u16)(dst_rect.x2 * xfer_info.dst_scaling_hint);
}
@ -406,17 +406,17 @@ namespace gl
if (is_depth_copy)
{
if (src->get_internal_format() == gl::texture::internal_format::depth16 ||
dst->get_internal_format() == gl::texture::internal_format::depth16)
{
attachment = GL_DEPTH_ATTACHMENT;
target = gl::buffers::depth;
}
else
verify(HERE), real_src->aspect() == real_dst->aspect();
if (real_dst->aspect() & gl::image_aspect::stencil)
{
attachment = GL_DEPTH_STENCIL_ATTACHMENT;
target = gl::buffers::depth_stencil;
}
else
{
attachment = GL_DEPTH_ATTACHMENT;
target = gl::buffers::depth;
}
}
else
{
@ -429,10 +429,10 @@ namespace gl
save_binding_state saved;
glBindFramebuffer(GL_READ_FRAMEBUFFER, blit_src.id());
glFramebufferTexture2D(GL_READ_FRAMEBUFFER, attachment, GL_TEXTURE_2D, src_id, 0);
glFramebufferTexture2D(GL_READ_FRAMEBUFFER, attachment, GL_TEXTURE_2D, real_src->id(), 0);
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, blit_dst.id());
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, attachment, GL_TEXTURE_2D, dst_id, 0);
glFramebufferTexture2D(GL_DRAW_FRAMEBUFFER, attachment, GL_TEXTURE_2D, real_dst->id(), 0);
if (xfer_info.flip_horizontal)
{

View File

@ -617,7 +617,6 @@ void gl::render_target::memory_barrier(gl::command_context& cmd, bool force_init
const auto dst_bpp = get_bpp();
rsx::typeless_xfer typeless_info{};
const bool dst_is_depth = is_depth(get_internal_format());
const auto region = rsx::get_transferable_region(this);
if (get_internal_format() == src_texture->get_internal_format())
@ -628,17 +627,17 @@ void gl::render_target::memory_barrier(gl::command_context& cmd, bool force_init
else
{
// Mem cast, generate typeless xfer info
const bool src_is_depth = is_depth(src_texture->get_internal_format());
if (src_bpp != dst_bpp || dst_is_depth || src_is_depth)
if (src_bpp != dst_bpp || aspect() != src_texture->aspect())
{
typeless_info.src_is_typeless = true;
typeless_info.src_context = rsx::texture_upload_context::framebuffer_storage;
typeless_info.src_native_format_override = (u32)get_internal_format();
typeless_info.src_is_depth = src_is_depth;
typeless_info.src_is_depth = !!(src_texture->aspect() & gl::image_aspect::depth);
typeless_info.src_scaling_hint = f32(src_bpp) / dst_bpp;
}
}
const bool dst_is_depth = !!(aspect() & gl::image_aspect::depth);
gl::g_hw_blitter->scale_image(cmd, old_contents, this,
{ 0, 0, std::get<0>(region), std::get<1>(region) },
{ 0, 0, std::get<2>(region) , std::get<3>(region) },

View File

@ -118,22 +118,12 @@ namespace vk
}
else
{
const bool src_is_depth = !!(src_texture->attachment_aspect_flag & VK_IMAGE_ASPECT_DEPTH_BIT);
const bool dst_is_depth = !!(attachment_aspect_flag & VK_IMAGE_ASPECT_DEPTH_BIT);
if (src_is_depth != dst_is_depth)
{
// TODO: Implement proper copy_typeless for vulkan that crosses the depth<->color aspect barrier
null_transfer_impl();
return;
}
if (src_bpp != dst_bpp || src_is_depth || dst_is_depth)
if (src_bpp != dst_bpp || src_texture->attachment_aspect_flag != attachment_aspect_flag)
{
typeless_info.src_is_typeless = true;
typeless_info.src_context = rsx::texture_upload_context::framebuffer_storage;
typeless_info.src_native_format_override = (u32)info.format;
typeless_info.src_is_depth = src_is_depth;
typeless_info.src_is_depth = !!(src_texture->attachment_aspect_flag & VK_IMAGE_ASPECT_DEPTH_BIT);
typeless_info.src_scaling_hint = f32(src_bpp) / dst_bpp;
}
}