mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-26 04:32:35 +01:00
rsx: Allow linear filtering when reading back GPU-resident memory
This commit is contained in:
parent
cc7848b3ef
commit
741ee9ac41
@ -153,8 +153,6 @@ namespace gl
|
||||
std::unique_ptr<gl::viewable_image> managed_texture;
|
||||
std::unique_ptr<gl::texture> scaled_texture;
|
||||
|
||||
bool is_depth = false;
|
||||
|
||||
texture::format format = texture::format::rgba;
|
||||
texture::type type = texture::type::ubyte;
|
||||
rsx::surface_antialiasing aa_mode = rsx::surface_antialiasing::center_1_sample;
|
||||
@ -260,7 +258,6 @@ namespace gl
|
||||
flushed = false;
|
||||
synchronized = false;
|
||||
sync_timestamp = 0ull;
|
||||
is_depth = false;
|
||||
|
||||
vram_texture = nullptr;
|
||||
managed_texture.reset();
|
||||
@ -287,7 +284,6 @@ namespace gl
|
||||
flushed = false;
|
||||
synchronized = false;
|
||||
sync_timestamp = 0ull;
|
||||
is_depth = false;
|
||||
|
||||
this->width = w;
|
||||
this->height = h;
|
||||
@ -347,11 +343,6 @@ namespace gl
|
||||
}
|
||||
}
|
||||
|
||||
void set_depth_flag(bool is_depth_fmt)
|
||||
{
|
||||
is_depth = is_depth_fmt;
|
||||
}
|
||||
|
||||
void copy_texture(bool=false)
|
||||
{
|
||||
if (!pbo_id)
|
||||
@ -405,7 +396,8 @@ namespace gl
|
||||
scaled_texture = std::make_unique<gl::texture>(GL_TEXTURE_2D, real_width, real_height, 1, 1, (GLenum)ifmt);
|
||||
}
|
||||
|
||||
bool linear_interp = false; //TODO: Make optional or detect full sized sources
|
||||
const bool is_depth = is_depth_texture();
|
||||
const bool linear_interp = is_depth? false : true;
|
||||
g_hw_blitter->scale_image(vram_texture, scaled_texture.get(), src_area, dst_area, linear_interp, is_depth, {});
|
||||
target_texture = scaled_texture.get();
|
||||
}
|
||||
@ -674,7 +666,15 @@ namespace gl
|
||||
|
||||
bool is_depth_texture() const
|
||||
{
|
||||
return is_depth;
|
||||
switch (vram_texture->get_internal_format())
|
||||
{
|
||||
case gl::texture::internal_format::depth16:
|
||||
case gl::texture::internal_format::depth24_stencil8:
|
||||
case gl::texture::internal_format::depth32f_stencil8:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
bool has_compatible_format(gl::texture* tex) const
|
||||
@ -950,15 +950,6 @@ namespace gl
|
||||
cached_texture_section* create_new_texture(void*&, u32 rsx_address, u32 rsx_size, u16 width, u16 height, u16 depth, u16 mipmaps, u32 gcm_format,
|
||||
rsx::texture_upload_context context, rsx::texture_dimension_extended type, rsx::texture_create_flags flags) override
|
||||
{
|
||||
bool depth_flag = false;
|
||||
switch (gcm_format)
|
||||
{
|
||||
case CELL_GCM_TEXTURE_DEPTH24_D8:
|
||||
case CELL_GCM_TEXTURE_DEPTH16:
|
||||
depth_flag = true;
|
||||
break;
|
||||
}
|
||||
|
||||
auto image = gl::create_texture(gcm_format, width, height, depth, mipmaps, type);
|
||||
|
||||
const auto swizzle = get_component_mapping(gcm_format, flags);
|
||||
@ -966,7 +957,6 @@ namespace gl
|
||||
|
||||
auto& cached = create_texture(image, rsx_address, rsx_size, width, height, depth, mipmaps);
|
||||
cached.set_dirty(false);
|
||||
cached.set_depth_flag(depth_flag);
|
||||
cached.set_view_flags(flags);
|
||||
cached.set_context(context);
|
||||
cached.set_gcm_format(gcm_format);
|
||||
|
@ -189,8 +189,11 @@ namespace vk
|
||||
target = vk::get_typeless_helper(vram_texture->info.format);
|
||||
change_image_layout(cmd, target, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, subresource_range);
|
||||
|
||||
// Allow bilinear filtering on color textures where compatibility is likely
|
||||
const auto filter = (aspect_flag == VK_IMAGE_ASPECT_COLOR_BIT) ? VK_FILTER_LINEAR : VK_FILTER_NEAREST;
|
||||
|
||||
vk::copy_scaled_image(cmd, vram_texture->value, target->value, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, target->current_layout,
|
||||
0, 0, vram_texture->width(), vram_texture->height(), 0, 0, transfer_width, transfer_height, 1, aspect_flag, true, VK_FILTER_NEAREST,
|
||||
0, 0, vram_texture->width(), vram_texture->height(), 0, 0, transfer_width, transfer_height, 1, aspect_flag, true, filter,
|
||||
vram_texture->info.format, target->info.format);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user