vk: Fix crash when running CPU detiler path

This commit is contained in:
kd-11 2026-04-07 01:42:15 +03:00 committed by Ani
parent 59468f1e1e
commit e0c3df5328
3 changed files with 9 additions and 7 deletions

View File

@ -71,10 +71,11 @@ namespace vk
enum image_upload_options enum image_upload_options
{ {
upload_contents_async = 1, upload_contents_async = 0x0001,
initialize_image_layout = 2, initialize_image_layout = 0x0002,
preserve_image_layout = 4, preserve_image_layout = 0x0004,
source_is_gpu_resident = 8, source_is_gpu_resident = 0x0008,
source_is_userptr = 0x0010,
// meta-flags // meta-flags
upload_contents_inline = 0, upload_contents_inline = 0,

View File

@ -724,6 +724,7 @@ namespace vk
subres.height_in_block subres.height_in_block
); );
subres.data = std::span(ext_data); subres.data = std::span(ext_data);
upload_flags |= source_is_userptr;
#else #else
const auto [scratch_buf, linear_data_scratch_offset] = vk::detile_memory_block(cmd, tiled_region, range, subres.width_in_block, subres.height_in_block, get_bpp()); const auto [scratch_buf, linear_data_scratch_offset] = vk::detile_memory_block(cmd, tiled_region, range, subres.width_in_block, subres.height_in_block, get_bpp());

View File

@ -990,7 +990,7 @@ namespace vk
auto pdev = vk::get_current_renderer(); auto pdev = vk::get_current_renderer();
rsx::texture_uploader_capabilities caps{ .supports_dxt = pdev->get_texture_compression_bc_support(), .alignment = heap_align }; rsx::texture_uploader_capabilities caps{ .supports_dxt = pdev->get_texture_compression_bc_support(), .alignment = heap_align };
rsx::texture_memory_info opt{}; rsx::texture_memory_info opt{};
bool check_caps = true; bool check_hw_caps = !(image_setup_flags & source_is_userptr);
vk::buffer* scratch_buf = nullptr; vk::buffer* scratch_buf = nullptr;
u32 scratch_offset = 0; u32 scratch_offset = 0;
@ -1015,13 +1015,13 @@ namespace vk
image_linear_size = row_pitch * layout.depth * (rsx::is_compressed_host_format(caps, format) ? layout.height_in_block : layout.height_in_texel); image_linear_size = row_pitch * layout.depth * (rsx::is_compressed_host_format(caps, format) ? layout.height_in_block : layout.height_in_texel);
// Only do GPU-side conversion if occupancy is good // Only do GPU-side conversion if occupancy is good
if (check_caps) if (check_hw_caps)
{ {
caps.supports_byteswap = (image_linear_size >= 1024) || (image_setup_flags & source_is_gpu_resident); caps.supports_byteswap = (image_linear_size >= 1024) || (image_setup_flags & source_is_gpu_resident);
caps.supports_hw_deswizzle = caps.supports_byteswap; caps.supports_hw_deswizzle = caps.supports_byteswap;
caps.supports_zero_copy = caps.supports_byteswap; caps.supports_zero_copy = caps.supports_byteswap;
caps.supports_vtc_decoding = false; caps.supports_vtc_decoding = false;
check_caps = false; check_hw_caps = false;
} }
auto buf_allocator = [&](usz) -> std::tuple<void*, usz> auto buf_allocator = [&](usz) -> std::tuple<void*, usz>