vk: Allow cubemap unwrap to generate more than 1 mipmap level

This commit is contained in:
kd-11 2026-04-05 23:23:02 +03:00 committed by Ani
parent ce12c29441
commit c279583f1f
2 changed files with 7 additions and 2 deletions

View File

@ -471,6 +471,10 @@ void VKGSRender::load_texture_env()
// Clamp min and max lod
actual_mipmaps = static_cast<f32>(sampler_state->external_subresource_desc.sections_to_copy.size());
}
else if (sampler_state->external_subresource_desc.op == rsx::deferred_request_command::cubemap_unwrap)
{
actual_mipmaps = static_cast<f32>(sampler_state->external_subresource_desc.mipmaps);
}
else
{
actual_mipmaps = 1.f;

View File

@ -761,8 +761,9 @@ namespace vk
const rsx::simple_array<copy_region_descriptor>& sections_to_copy, const rsx::texture_channel_remap_t& remap_vector)
{
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)));
auto result = create_temporary_subresource_view_impl(cmd, _template, VK_IMAGE_TYPE_2D,
VK_IMAGE_VIEW_TYPE_CUBE, gcm_format, 0, 0, size, size, 1, 1, remap_vector, false);
VK_IMAGE_VIEW_TYPE_CUBE, gcm_format, 0, 0, size, size, 1, mip_count, remap_vector, false);
if (!result)
{
@ -772,7 +773,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, 6 };
VkImageSubresourceRange dst_range = { dst_aspect, 0, mip_count, 0, 6 };
vk::change_image_layout(cmd, image, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, dst_range);
if (!(dst_aspect & VK_IMAGE_ASPECT_DEPTH_BIT))