mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-01-31 06:32:41 +00:00
rsx: Properly pass format_class information during RTV/DSV resource barrier
- Also takes the opportunity to remove repeating code in a minor refactor.
This commit is contained in:
parent
d012abd924
commit
a50ea09053
@ -276,6 +276,16 @@ namespace rsx
|
|||||||
return format_info.gcm_depth_format;
|
return format_info.gcm_depth_format;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u32 get_gcm_format() const
|
||||||
|
{
|
||||||
|
return
|
||||||
|
(
|
||||||
|
is_depth_surface() ?
|
||||||
|
get_compatible_gcm_format(format_info.gcm_depth_format).first :
|
||||||
|
get_compatible_gcm_format(format_info.gcm_color_format).first
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
bool dirty() const
|
bool dirty() const
|
||||||
{
|
{
|
||||||
return (state_flags != rsx::surface_state_flags::ready) || !old_contents.empty();
|
return (state_flags != rsx::surface_state_flags::ready) || !old_contents.empty();
|
||||||
|
@ -454,9 +454,6 @@ void gl::render_target::clear_memory(gl::command_context& cmd)
|
|||||||
void gl::render_target::load_memory(gl::command_context& cmd)
|
void gl::render_target::load_memory(gl::command_context& cmd)
|
||||||
{
|
{
|
||||||
const bool is_swizzled = (raster_type == rsx::surface_raster_type::swizzle);
|
const bool is_swizzled = (raster_type == rsx::surface_raster_type::swizzle);
|
||||||
const u32 gcm_format = is_depth_surface() ?
|
|
||||||
get_compatible_gcm_format(format_info.gcm_depth_format).first :
|
|
||||||
get_compatible_gcm_format(format_info.gcm_color_format).first;
|
|
||||||
|
|
||||||
rsx::subresource_layout subres{};
|
rsx::subresource_layout subres{};
|
||||||
subres.width_in_block = subres.width_in_texel = surface_width * samples_x;
|
subres.width_in_block = subres.width_in_texel = surface_width * samples_x;
|
||||||
@ -468,12 +465,12 @@ void gl::render_target::load_memory(gl::command_context& cmd)
|
|||||||
// TODO: MSAA support
|
// TODO: MSAA support
|
||||||
if (g_cfg.video.resolution_scale_percent == 100 && spp == 1) [[likely]]
|
if (g_cfg.video.resolution_scale_percent == 100 && spp == 1) [[likely]]
|
||||||
{
|
{
|
||||||
gl::upload_texture(this, gcm_format, is_swizzled, { subres });
|
gl::upload_texture(this, get_gcm_format(), is_swizzled, { subres });
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto tmp = std::make_unique<gl::texture>(GL_TEXTURE_2D, subres.width_in_block, subres.height_in_block, 1, 1, static_cast<GLenum>(get_internal_format()));
|
auto tmp = std::make_unique<gl::texture>(GL_TEXTURE_2D, subres.width_in_block, subres.height_in_block, 1, 1, static_cast<GLenum>(get_internal_format()), format_class());
|
||||||
gl::upload_texture(tmp.get(), gcm_format, is_swizzled, { subres });
|
gl::upload_texture(tmp.get(), get_gcm_format(), is_swizzled, { subres });
|
||||||
|
|
||||||
gl::g_hw_blitter->scale_image(cmd, tmp.get(), this,
|
gl::g_hw_blitter->scale_image(cmd, tmp.get(), this,
|
||||||
{ 0, 0, subres.width_in_block, subres.height_in_block },
|
{ 0, 0, subres.width_in_block, subres.height_in_block },
|
||||||
@ -542,6 +539,7 @@ void gl::render_target::memory_barrier(gl::command_context& cmd, rsx::surface_ac
|
|||||||
typeless_info.src_is_typeless = true;
|
typeless_info.src_is_typeless = true;
|
||||||
typeless_info.src_context = rsx::texture_upload_context::framebuffer_storage;
|
typeless_info.src_context = rsx::texture_upload_context::framebuffer_storage;
|
||||||
typeless_info.src_native_format_override = static_cast<u32>(get_internal_format());
|
typeless_info.src_native_format_override = static_cast<u32>(get_internal_format());
|
||||||
|
typeless_info.src_gcm_format = src_texture->get_gcm_format();
|
||||||
typeless_info.src_scaling_hint = static_cast<f32>(src_bpp) / dst_bpp;
|
typeless_info.src_scaling_hint = static_cast<f32>(src_bpp) / dst_bpp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -233,11 +233,7 @@ namespace vk
|
|||||||
void load_memory(vk::command_buffer& cmd)
|
void load_memory(vk::command_buffer& cmd)
|
||||||
{
|
{
|
||||||
auto& upload_heap = *vk::get_upload_heap();
|
auto& upload_heap = *vk::get_upload_heap();
|
||||||
|
|
||||||
const bool is_swizzled = (raster_type == rsx::surface_raster_type::swizzle);
|
const bool is_swizzled = (raster_type == rsx::surface_raster_type::swizzle);
|
||||||
const u32 gcm_format = is_depth_surface() ?
|
|
||||||
get_compatible_gcm_format(format_info.gcm_depth_format).first :
|
|
||||||
get_compatible_gcm_format(format_info.gcm_color_format).first;
|
|
||||||
|
|
||||||
rsx::subresource_layout subres{};
|
rsx::subresource_layout subres{};
|
||||||
subres.width_in_block = subres.width_in_texel = surface_width * samples_x;
|
subres.width_in_block = subres.width_in_texel = surface_width * samples_x;
|
||||||
@ -249,7 +245,7 @@ namespace vk
|
|||||||
if (g_cfg.video.resolution_scale_percent == 100 && spp == 1) [[likely]]
|
if (g_cfg.video.resolution_scale_percent == 100 && spp == 1) [[likely]]
|
||||||
{
|
{
|
||||||
push_layout(cmd, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
|
push_layout(cmd, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
|
||||||
vk::copy_mipmaped_image_using_buffer(cmd, this, { subres }, gcm_format, is_swizzled, 1, aspect(), upload_heap, rsx_pitch);
|
vk::copy_mipmaped_image_using_buffer(cmd, this, { subres }, get_gcm_format(), is_swizzled, 1, aspect(), upload_heap, rsx_pitch);
|
||||||
pop_layout(cmd);
|
pop_layout(cmd);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -269,12 +265,12 @@ namespace vk
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
content = vk::get_typeless_helper(format(), rsx::classify_format(gcm_format), subres.width_in_block, subres.height_in_block);
|
content = vk::get_typeless_helper(format(), format_class(), subres.width_in_block, subres.height_in_block);
|
||||||
content->change_layout(cmd, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
|
content->change_layout(cmd, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Load Cell data into temp buffer
|
// Load Cell data into temp buffer
|
||||||
vk::copy_mipmaped_image_using_buffer(cmd, content, { subres }, gcm_format, is_swizzled, 1, aspect(), upload_heap, rsx_pitch);
|
vk::copy_mipmaped_image_using_buffer(cmd, content, { subres }, get_gcm_format(), is_swizzled, 1, aspect(), upload_heap, rsx_pitch);
|
||||||
|
|
||||||
// Write into final image
|
// Write into final image
|
||||||
if (content != final_dst)
|
if (content != final_dst)
|
||||||
@ -520,6 +516,7 @@ namespace vk
|
|||||||
typeless_info.src_is_typeless = true;
|
typeless_info.src_is_typeless = true;
|
||||||
typeless_info.src_context = rsx::texture_upload_context::framebuffer_storage;
|
typeless_info.src_context = rsx::texture_upload_context::framebuffer_storage;
|
||||||
typeless_info.src_native_format_override = static_cast<u32>(info.format);
|
typeless_info.src_native_format_override = static_cast<u32>(info.format);
|
||||||
|
typeless_info.src_gcm_format = src_texture->get_gcm_format();
|
||||||
typeless_info.src_scaling_hint = f32(src_bpp) / dst_bpp;
|
typeless_info.src_scaling_hint = f32(src_bpp) / dst_bpp;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user