mirror of
https://github.com/ARMSX2/ARMSX3.git
synced 2026-08-24 16:58:52 -07:00
rsx: Respect mip levels actually used during image reconstruction
This commit is contained in:
@@ -319,6 +319,11 @@ namespace rsx
|
||||
return external_handle;
|
||||
}
|
||||
|
||||
u8 exact_mip_count() const
|
||||
{
|
||||
return 1 + sections_to_copy.reduce(0, FN(std::max<u8>(x, y.level)));
|
||||
}
|
||||
|
||||
private:
|
||||
static deferred_subresource make_unwrap(
|
||||
deferred_request_command op,
|
||||
|
||||
@@ -585,8 +585,7 @@ namespace gl
|
||||
gl::texture_view* generate_cubemap_from_images(gl::command_context& cmd, const deferred_subresource& desc) override
|
||||
{
|
||||
auto _template = get_template_from_collection_impl(desc.sections_to_copy);
|
||||
const u8 mip_count = 1 + desc.sections_to_copy.reduce(0, FN(std::max<u8>(x, y.level)));
|
||||
auto result = create_temporary_subresource_impl(cmd, _template, GL_NONE, GL_TEXTURE_CUBE_MAP, desc.gcm_format, desc.width, desc.height, 1, mip_count, desc.remap);
|
||||
auto result = create_temporary_subresource_impl(cmd, _template, GL_NONE, GL_TEXTURE_CUBE_MAP, desc.gcm_format, desc.width, desc.height, 1, desc.exact_mip_count(), desc.remap);
|
||||
|
||||
if (desc.force_bg_load)
|
||||
{
|
||||
@@ -600,7 +599,7 @@ namespace gl
|
||||
gl::texture_view* generate_3d_from_2d_images(gl::command_context& cmd, const deferred_subresource& desc) override
|
||||
{
|
||||
auto _template = get_template_from_collection_impl(desc.sections_to_copy);
|
||||
auto result = create_temporary_subresource_impl(cmd, _template, GL_NONE, GL_TEXTURE_3D, desc.gcm_format, desc.width, desc.height, desc.depth, 1, desc.remap);
|
||||
auto result = create_temporary_subresource_impl(cmd, _template, GL_NONE, GL_TEXTURE_3D, desc.gcm_format, desc.width, desc.height, desc.depth, desc.exact_mip_count(), desc.remap);
|
||||
|
||||
if (desc.force_bg_load)
|
||||
{
|
||||
|
||||
@@ -760,7 +760,7 @@ namespace vk
|
||||
{
|
||||
const auto& sections_to_copy = desc.sections_to_copy;
|
||||
auto _template = get_template_from_collection_impl(sections_to_copy);
|
||||
const u8 mip_count = 1 + sections_to_copy.reduce(0, FN(std::max<u8>(x, y.level)));
|
||||
const u8 mip_count = desc.exact_mip_count();
|
||||
auto result = create_temporary_subresource_view_impl(cmd, _template, VK_IMAGE_TYPE_2D,
|
||||
VK_IMAGE_VIEW_TYPE_CUBE, desc.gcm_format, desc.width, desc.height, 1, mip_count, desc.remap);
|
||||
|
||||
@@ -809,8 +809,9 @@ namespace vk
|
||||
{
|
||||
const auto& sections_to_copy = desc.sections_to_copy;
|
||||
auto _template = get_template_from_collection_impl(sections_to_copy);
|
||||
const u8 mip_count = desc.exact_mip_count();
|
||||
auto result = create_temporary_subresource_view_impl(cmd, _template, VK_IMAGE_TYPE_3D,
|
||||
VK_IMAGE_VIEW_TYPE_3D, desc.gcm_format, desc.width, desc.height, desc.depth, 1, desc.remap);
|
||||
VK_IMAGE_VIEW_TYPE_3D, desc.gcm_format, desc.width, desc.height, desc.depth, mip_count, desc.remap);
|
||||
|
||||
if (!result)
|
||||
{
|
||||
@@ -820,7 +821,7 @@ namespace vk
|
||||
|
||||
const auto image = result->image();
|
||||
VkImageAspectFlags dst_aspect = vk::get_aspect_flags(result->info.format);
|
||||
VkImageSubresourceRange dst_range = { dst_aspect, 0, 1, 0, 1 };
|
||||
VkImageSubresourceRange dst_range = { dst_aspect, 0, mip_count, 0, 1 };
|
||||
vk::change_image_layout(cmd, image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, dst_range);
|
||||
|
||||
if (desc.force_bg_load)
|
||||
|
||||
Reference in New Issue
Block a user