diff --git a/src/video_core/renderer_vulkan/vk_compute_pass.cpp b/src/video_core/renderer_vulkan/vk_compute_pass.cpp index 76061d8cc9..604a0d7cac 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pass.cpp +++ b/src/video_core/renderer_vulkan/vk_compute_pass.cpp @@ -16,16 +16,12 @@ #include "common/common_types.h" #include "common/div_ceil.h" #include "common/vector_math.h" -#include #include "video_core/host_shaders/astc_decoder_comp_spv.h" #include "video_core/host_shaders/queries_prefix_scan_sum_comp_spv.h" #include "video_core/host_shaders/queries_prefix_scan_sum_nosubgroups_comp_spv.h" #include "video_core/host_shaders/resolve_conditional_render_comp_spv.h" #include "video_core/host_shaders/vulkan_quad_indexed_comp_spv.h" #include "video_core/host_shaders/vulkan_uint8_comp_spv.h" -#include "video_core/host_shaders/block_linear_unswizzle_2d_comp_spv.h" -#include "video_core/host_shaders/block_linear_unswizzle_3d_comp_spv.h" -#include "video_core/host_shaders/pitch_unswizzle_comp_spv.h" #include "video_core/renderer_vulkan/vk_compute_pass.h" #include "video_core/surface.h" #include "video_core/renderer_vulkan/vk_descriptor_pool.h" @@ -188,26 +184,6 @@ struct AstcPushConstants { u32 block_height_mask; }; -struct BlockLinear3DImagePushConstants { - alignas(16) std::array origin; - alignas(16) std::array destination; - u32 bytes_per_block_log2; - u32 slice_size; - u32 block_size; - u32 x_shift; - u32 block_height; - u32 block_height_mask; - u32 block_depth; - u32 block_depth_mask; -}; - -struct PitchUnswizzlePushConstants { - std::array origin; - std::array destination; - u32 bytes_per_block_log2; - u32 pitch; -}; - struct QueriesPrefixScanPushConstants { u32 min_accumulation_base; u32 max_accumulation_base; @@ -639,230 +615,4 @@ void ASTCDecoderPass::Assemble(Image& image, const StagingBufferRef& map, scheduler.Finish(); } -namespace { - -void RecordUnswizzleBeginBarrier(Scheduler& scheduler, VkPipeline vk_pipeline, VkImage vk_image, - VkImageAspectFlags aspect_mask, bool is_initialized) { - VkAccessFlags src_access = VK_ACCESS_NONE; - VkImageLayout old_layout = VK_IMAGE_LAYOUT_UNDEFINED; - VkPipelineStageFlags src_stage = VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT; - if (is_initialized) { - src_access = VK_ACCESS_MEMORY_WRITE_BIT; - old_layout = VK_IMAGE_LAYOUT_GENERAL; - src_stage = vk::PIPELINE_STAGE_GRAPHICS_COMPUTE_TRANSFER; - } - scheduler.Record([vk_pipeline, vk_image, aspect_mask, src_access, old_layout, - src_stage](vk::CommandBuffer cmdbuf) { - const VkImageMemoryBarrier image_barrier{ - .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, - .pNext = nullptr, - .srcAccessMask = src_access, - .dstAccessMask = VK_ACCESS_SHADER_READ_BIT | VK_ACCESS_SHADER_WRITE_BIT, - .oldLayout = old_layout, - .newLayout = VK_IMAGE_LAYOUT_GENERAL, - .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, - .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, - .image = vk_image, - .subresourceRange{ - .aspectMask = aspect_mask, - .baseMipLevel = 0, - .levelCount = VK_REMAINING_MIP_LEVELS, - .baseArrayLayer = 0, - .layerCount = VK_REMAINING_ARRAY_LAYERS, - }, - }; - cmdbuf.PipelineBarrier(src_stage, VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, image_barrier); - cmdbuf.BindPipeline(VK_PIPELINE_BIND_POINT_COMPUTE, vk_pipeline); - }); -} - -void RecordUnswizzleEndBarrier(Scheduler& scheduler, VkImage vk_image, - VkImageAspectFlags aspect_mask) { - scheduler.Record([vk_image, aspect_mask](vk::CommandBuffer cmdbuf) { - const VkImageMemoryBarrier image_barrier{ - .sType = VK_STRUCTURE_TYPE_IMAGE_MEMORY_BARRIER, - .pNext = nullptr, - .srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT, - .dstAccessMask = VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT, - .oldLayout = VK_IMAGE_LAYOUT_GENERAL, - .newLayout = VK_IMAGE_LAYOUT_GENERAL, - .srcQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, - .dstQueueFamilyIndex = VK_QUEUE_FAMILY_IGNORED, - .image = vk_image, - .subresourceRange{ - .aspectMask = aspect_mask, - .baseMipLevel = 0, - .levelCount = VK_REMAINING_MIP_LEVELS, - .baseArrayLayer = 0, - .layerCount = VK_REMAINING_ARRAY_LAYERS, - }, - }; - cmdbuf.PipelineBarrier(VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, - vk::PIPELINE_STAGE_GRAPHICS_COMPUTE_TRANSFER, 0, image_barrier); - }); -} - -} // Anonymous namespace - -BlockLinearUnswizzleImage2DPass::BlockLinearUnswizzleImage2DPass( - const Device& device_, Scheduler& scheduler_, DescriptorPool& descriptor_pool_, - StagingBufferPool& staging_buffer_pool_, - ComputePassDescriptorQueue& compute_pass_descriptor_queue_) - : ComputePass(device_, scheduler_, descriptor_pool_, ASTC_DESCRIPTOR_SET_BINDINGS, - ASTC_PASS_DESCRIPTOR_UPDATE_TEMPLATE_ENTRY, ASTC_BANK_INFO, - COMPUTE_PUSH_CONSTANT_RANGE< - sizeof(VideoCommon::Accelerated::BlockLinearSwizzle2DParams)>, - BLOCK_LINEAR_UNSWIZZLE_2D_COMP_SPV), - scheduler{scheduler_}, staging_buffer_pool{staging_buffer_pool_}, - compute_pass_descriptor_queue{compute_pass_descriptor_queue_} {} - -BlockLinearUnswizzleImage2DPass::~BlockLinearUnswizzleImage2DPass() = default; - -void BlockLinearUnswizzleImage2DPass::Unswizzle( - Image& image, const StagingBufferRef& map, - std::span swizzles) { - using namespace VideoCommon::Accelerated; - scheduler.RequestOutsideRenderPassOperationContext(); - const VkImageAspectFlags aspect_mask = image.AspectMask(); - const VkImage vk_image = image.Handle(); - RecordUnswizzleBeginBarrier(scheduler, *pipeline, vk_image, aspect_mask, - image.ExchangeInitialization()); - for (const VideoCommon::SwizzleParameters& swizzle : swizzles) { - const size_t input_offset = swizzle.buffer_offset + map.offset; - const u32 num_dispatches_x = Common::DivCeil(swizzle.num_tiles.width, 32U); - const u32 num_dispatches_y = Common::DivCeil(swizzle.num_tiles.height, 8U); - const u32 num_dispatches_z = image.info.resources.layers; - - compute_pass_descriptor_queue.Acquire(scheduler, 2); - compute_pass_descriptor_queue.AddBuffer(map.buffer, input_offset, - image.guest_size_bytes - swizzle.buffer_offset); - compute_pass_descriptor_queue.AddImage(image.StorageImageView(swizzle.level)); - const void* const descriptor_data{compute_pass_descriptor_queue.UpdateData()}; - - const auto params = MakeBlockLinearSwizzle2DParams(swizzle, image.info); - scheduler.Record([this, num_dispatches_x, num_dispatches_y, num_dispatches_z, params, - descriptor_data](vk::CommandBuffer cmdbuf) { - const VkDescriptorSet set = descriptor_allocator.Commit(); - device.GetLogical().UpdateDescriptorSet(set, *descriptor_template, descriptor_data); - cmdbuf.BindDescriptorSets(VK_PIPELINE_BIND_POINT_COMPUTE, *layout, 0, set, {}); - cmdbuf.PushConstants(*layout, VK_SHADER_STAGE_COMPUTE_BIT, params); - cmdbuf.Dispatch(num_dispatches_x, num_dispatches_y, num_dispatches_z); - }); - } - RecordUnswizzleEndBarrier(scheduler, vk_image, aspect_mask); - scheduler.Finish(); -} - -BlockLinearUnswizzleImage3DPass::BlockLinearUnswizzleImage3DPass( - const Device& device_, Scheduler& scheduler_, DescriptorPool& descriptor_pool_, - StagingBufferPool& staging_buffer_pool_, - ComputePassDescriptorQueue& compute_pass_descriptor_queue_) - : ComputePass(device_, scheduler_, descriptor_pool_, ASTC_DESCRIPTOR_SET_BINDINGS, - ASTC_PASS_DESCRIPTOR_UPDATE_TEMPLATE_ENTRY, ASTC_BANK_INFO, - COMPUTE_PUSH_CONSTANT_RANGE, - BLOCK_LINEAR_UNSWIZZLE_3D_COMP_SPV), - scheduler{scheduler_}, staging_buffer_pool{staging_buffer_pool_}, - compute_pass_descriptor_queue{compute_pass_descriptor_queue_} {} - -BlockLinearUnswizzleImage3DPass::~BlockLinearUnswizzleImage3DPass() = default; - -void BlockLinearUnswizzleImage3DPass::Unswizzle( - Image& image, const StagingBufferRef& map, - std::span swizzles) { - using namespace VideoCommon::Accelerated; - scheduler.RequestOutsideRenderPassOperationContext(); - const VkImageAspectFlags aspect_mask = image.AspectMask(); - const VkImage vk_image = image.Handle(); - RecordUnswizzleBeginBarrier(scheduler, *pipeline, vk_image, aspect_mask, - image.ExchangeInitialization()); - for (const VideoCommon::SwizzleParameters& swizzle : swizzles) { - const size_t input_offset = swizzle.buffer_offset + map.offset; - const u32 num_dispatches_x = Common::DivCeil(swizzle.num_tiles.width, 16U); - const u32 num_dispatches_y = Common::DivCeil(swizzle.num_tiles.height, 8U); - const u32 num_dispatches_z = Common::DivCeil(swizzle.num_tiles.depth, 2U); - - compute_pass_descriptor_queue.Acquire(scheduler, 2); - compute_pass_descriptor_queue.AddBuffer(map.buffer, input_offset, - image.guest_size_bytes - swizzle.buffer_offset); - compute_pass_descriptor_queue.AddImage(image.StorageImageView(swizzle.level)); - const void* const descriptor_data{compute_pass_descriptor_queue.UpdateData()}; - - const auto p = MakeBlockLinearSwizzle3DParams(swizzle, image.info); - const BlockLinear3DImagePushConstants params{ - .origin = p.origin, - .destination = p.destination, - .bytes_per_block_log2 = p.bytes_per_block_log2, - .slice_size = p.slice_size, - .block_size = p.block_size, - .x_shift = p.x_shift, - .block_height = p.block_height, - .block_height_mask = p.block_height_mask, - .block_depth = p.block_depth, - .block_depth_mask = p.block_depth_mask, - }; - scheduler.Record([this, num_dispatches_x, num_dispatches_y, num_dispatches_z, params, - descriptor_data](vk::CommandBuffer cmdbuf) { - const VkDescriptorSet set = descriptor_allocator.Commit(); - device.GetLogical().UpdateDescriptorSet(set, *descriptor_template, descriptor_data); - cmdbuf.BindDescriptorSets(VK_PIPELINE_BIND_POINT_COMPUTE, *layout, 0, set, {}); - cmdbuf.PushConstants(*layout, VK_SHADER_STAGE_COMPUTE_BIT, params); - cmdbuf.Dispatch(num_dispatches_x, num_dispatches_y, num_dispatches_z); - }); - } - RecordUnswizzleEndBarrier(scheduler, vk_image, aspect_mask); - scheduler.Finish(); -} - -PitchUnswizzlePass::PitchUnswizzlePass(const Device& device_, Scheduler& scheduler_, - DescriptorPool& descriptor_pool_, - StagingBufferPool& staging_buffer_pool_, - ComputePassDescriptorQueue& compute_pass_descriptor_queue_) - : ComputePass(device_, scheduler_, descriptor_pool_, ASTC_DESCRIPTOR_SET_BINDINGS, - ASTC_PASS_DESCRIPTOR_UPDATE_TEMPLATE_ENTRY, ASTC_BANK_INFO, - COMPUTE_PUSH_CONSTANT_RANGE, - PITCH_UNSWIZZLE_COMP_SPV), - scheduler{scheduler_}, staging_buffer_pool{staging_buffer_pool_}, - compute_pass_descriptor_queue{compute_pass_descriptor_queue_} {} - -PitchUnswizzlePass::~PitchUnswizzlePass() = default; - -void PitchUnswizzlePass::Unswizzle(Image& image, const StagingBufferRef& map, - std::span swizzles) { - const u32 bytes_per_block = VideoCore::Surface::BytesPerBlock(image.info.format); - ASSERT(std::has_single_bit(bytes_per_block)); - scheduler.RequestOutsideRenderPassOperationContext(); - const VkImageAspectFlags aspect_mask = image.AspectMask(); - const VkImage vk_image = image.Handle(); - RecordUnswizzleBeginBarrier(scheduler, *pipeline, vk_image, aspect_mask, - image.ExchangeInitialization()); - for (const VideoCommon::SwizzleParameters& swizzle : swizzles) { - const size_t input_offset = swizzle.buffer_offset + map.offset; - const u32 num_dispatches_x = Common::DivCeil(swizzle.num_tiles.width, 32U); - const u32 num_dispatches_y = Common::DivCeil(swizzle.num_tiles.height, 8U); - - compute_pass_descriptor_queue.Acquire(scheduler, 2); - compute_pass_descriptor_queue.AddBuffer(map.buffer, input_offset, - image.guest_size_bytes - swizzle.buffer_offset); - compute_pass_descriptor_queue.AddImage(image.StorageImageView(swizzle.level)); - const void* const descriptor_data{compute_pass_descriptor_queue.UpdateData()}; - - const PitchUnswizzlePushConstants params{ - .origin = {0, 0}, - .destination = {0, 0}, - .bytes_per_block_log2 = static_cast(std::countr_zero(bytes_per_block)), - .pitch = image.info.pitch, - }; - scheduler.Record([this, num_dispatches_x, num_dispatches_y, params, - descriptor_data](vk::CommandBuffer cmdbuf) { - const VkDescriptorSet set = descriptor_allocator.Commit(); - device.GetLogical().UpdateDescriptorSet(set, *descriptor_template, descriptor_data); - cmdbuf.BindDescriptorSets(VK_PIPELINE_BIND_POINT_COMPUTE, *layout, 0, set, {}); - cmdbuf.PushConstants(*layout, VK_SHADER_STAGE_COMPUTE_BIT, params); - cmdbuf.Dispatch(num_dispatches_x, num_dispatches_y, 1); - }); - } - RecordUnswizzleEndBarrier(scheduler, vk_image, aspect_mask); - scheduler.Finish(); -} - } // namespace Vulkan diff --git a/src/video_core/renderer_vulkan/vk_compute_pass.h b/src/video_core/renderer_vulkan/vk_compute_pass.h index 811deee8a2..12723099ca 100644 --- a/src/video_core/renderer_vulkan/vk_compute_pass.h +++ b/src/video_core/renderer_vulkan/vk_compute_pass.h @@ -134,55 +134,4 @@ private: MemoryAllocator& memory_allocator; }; -class BlockLinearUnswizzleImage2DPass final : public ComputePass { -public: - explicit BlockLinearUnswizzleImage2DPass( - const Device& device_, Scheduler& scheduler_, DescriptorPool& descriptor_pool_, - StagingBufferPool& staging_buffer_pool_, - ComputePassDescriptorQueue& compute_pass_descriptor_queue_); - ~BlockLinearUnswizzleImage2DPass(); - - void Unswizzle(Image& image, const StagingBufferRef& map, - std::span swizzles); - -private: - Scheduler& scheduler; - StagingBufferPool& staging_buffer_pool; - ComputePassDescriptorQueue& compute_pass_descriptor_queue; -}; - -class BlockLinearUnswizzleImage3DPass final : public ComputePass { -public: - explicit BlockLinearUnswizzleImage3DPass( - const Device& device_, Scheduler& scheduler_, DescriptorPool& descriptor_pool_, - StagingBufferPool& staging_buffer_pool_, - ComputePassDescriptorQueue& compute_pass_descriptor_queue_); - ~BlockLinearUnswizzleImage3DPass(); - - void Unswizzle(Image& image, const StagingBufferRef& map, - std::span swizzles); - -private: - Scheduler& scheduler; - StagingBufferPool& staging_buffer_pool; - ComputePassDescriptorQueue& compute_pass_descriptor_queue; -}; - -class PitchUnswizzlePass final : public ComputePass { -public: - explicit PitchUnswizzlePass(const Device& device_, Scheduler& scheduler_, - DescriptorPool& descriptor_pool_, - StagingBufferPool& staging_buffer_pool_, - ComputePassDescriptorQueue& compute_pass_descriptor_queue_); - ~PitchUnswizzlePass(); - - void Unswizzle(Image& image, const StagingBufferRef& map, - std::span swizzles); - -private: - Scheduler& scheduler; - StagingBufferPool& staging_buffer_pool; - ComputePassDescriptorQueue& compute_pass_descriptor_queue; -}; - } // namespace Vulkan diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.cpp b/src/video_core/renderer_vulkan/vk_texture_cache.cpp index ed4105efa6..5663220045 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.cpp +++ b/src/video_core/renderer_vulkan/vk_texture_cache.cpp @@ -57,8 +57,6 @@ using VideoCore::Surface::SurfaceType; namespace { constexpr bool ENABLE_MSAA_TILER_RESOLVE = true; constexpr bool ENABLE_MSAA_RESOLVE_CONSUME = true; -constexpr bool ENABLE_ACCELERATED_UNSWIZZLE = true; -constexpr bool ENABLE_ACCELERATED_UNSWIZZLE_DISPATCH = true; constexpr bool ENABLE_MSAA_COLOR_DISCARD = true; constexpr bool ENABLE_MSAA_DEPTH_STENCIL_DISCARD = true; @@ -162,82 +160,6 @@ constexpr VkBorderColor ConvertBorderColor(const std::array& color) { info.size.depth == 1; } -[[nodiscard]] VkFormat UnswizzleStorageFormat(u32 bytes_per_block) { - switch (bytes_per_block) { - case 1: - return VK_FORMAT_R8_UINT; - case 2: - return VK_FORMAT_R16_UINT; - case 4: - return VK_FORMAT_R32_UINT; - case 8: - return VK_FORMAT_R32G32_UINT; - case 16: - return VK_FORMAT_R32G32B32A32_UINT; - default: - return VK_FORMAT_UNDEFINED; - } -} - -[[nodiscard]] bool IsUnswizzleStorageFormatSupported(const Device& device, u32 bytes_per_block) { - switch (bytes_per_block) { - case 1: - return device.IsStorageBuffer8BitAccessSupported(); - case 2: - return device.IsStorageBuffer16BitAccessSupported(); - case 4: - case 8: - case 16: - return true; - default: - return false; - } -} - -[[nodiscard]] bool IsUnswizzleAcceleratedFormat(const Device& device, PixelFormat format) { - if (!ENABLE_ACCELERATED_UNSWIZZLE) { - return false; - } - if (IsPixelFormatASTC(format) || VideoCore::Surface::IsPixelFormatBCn(format)) { - return false; - } - if (VideoCore::Surface::GetFormatType(format) != SurfaceType::ColorTexture) { - return false; - } - if (!MaxwellToVK::SurfaceFormat(device, FormatType::Optimal, false, format).storage) { - return false; - } - return IsUnswizzleStorageFormatSupported(device, BytesPerBlock(format)); -} - -[[nodiscard]] bool WillUseAcceleratedUnswizzle(const Device& device, const ImageInfo& info) { - if (!ENABLE_ACCELERATED_UNSWIZZLE_DISPATCH) { - return false; - } - switch (info.type) { - case ImageType::e2D: - case ImageType::e3D: - case ImageType::Linear: - break; - default: - return false; - } - if (info.num_samples > 1 || !device.IsKhrImageFormatListSupported()) { - return false; - } - return IsUnswizzleAcceleratedFormat(device, info.format); -} - -[[nodiscard]] VkImageViewType UnswizzleStorageViewType(ImageType type) { - if (type == ImageType::e3D) { - return VK_IMAGE_VIEW_TYPE_3D; - } - if (type == ImageType::Linear) { - return VK_IMAGE_VIEW_TYPE_2D; - } - return VK_IMAGE_VIEW_TYPE_2D_ARRAY; -} - [[nodiscard]] VkImageCreateInfo MakeImageCreateInfo(const Device& device, const ImageInfo& info, std::optional format_override = {}) { auto format_info = @@ -327,23 +249,18 @@ constexpr VkBorderColor ConvertBorderColor(const std::array& color) { } [[nodiscard]] vk::ImageView MakeStorageView(const vk::Device& device, u32 level, VkImage image, - VkFormat format, - VkImageViewType view_type = VK_IMAGE_VIEW_TYPE_2D_ARRAY) { + VkFormat format) { static constexpr VkImageViewUsageCreateInfo storage_image_view_usage_create_info{ .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_USAGE_CREATE_INFO, .pNext = nullptr, .usage = VK_IMAGE_USAGE_STORAGE_BIT, }; - u32 layer_count = VK_REMAINING_ARRAY_LAYERS; - if (view_type == VK_IMAGE_VIEW_TYPE_2D || view_type == VK_IMAGE_VIEW_TYPE_3D) { - layer_count = 1; - } return device.CreateImageView(VkImageViewCreateInfo{ .sType = VK_STRUCTURE_TYPE_IMAGE_VIEW_CREATE_INFO, .pNext = &storage_image_view_usage_create_info, .flags = 0, .image = image, - .viewType = view_type, + .viewType = VK_IMAGE_VIEW_TYPE_2D_ARRAY, .format = format, .components{ .r = VK_COMPONENT_SWIZZLE_IDENTITY, @@ -356,7 +273,7 @@ constexpr VkBorderColor ConvertBorderColor(const std::array& color) { .baseMipLevel = level, .levelCount = 1, .baseArrayLayer = 0, - .layerCount = layer_count, + .layerCount = VK_REMAINING_ARRAY_LAYERS, }, }); } @@ -1029,14 +946,6 @@ TextureCacheRuntime::TextureCacheRuntime(const Device& device_, Scheduler& sched astc_decoder_pass.emplace(device, scheduler, descriptor_pool, staging_buffer_pool, compute_pass_descriptor_queue, memory_allocator); } - if (ENABLE_ACCELERATED_UNSWIZZLE && device.IsKhrImageFormatListSupported()) { - bl_unswizzle_2d_pass.emplace(device, scheduler, descriptor_pool, staging_buffer_pool, - compute_pass_descriptor_queue); - bl_unswizzle_3d_pass.emplace(device, scheduler, descriptor_pool, staging_buffer_pool, - compute_pass_descriptor_queue); - pitch_unswizzle_pass.emplace(device, scheduler, descriptor_pool, staging_buffer_pool, - compute_pass_descriptor_queue); - } if (!device.IsKhrImageFormatListSupported()) { return; } @@ -1044,8 +953,6 @@ TextureCacheRuntime::TextureCacheRuntime(const Device& device_, Scheduler& sched const auto image_format = static_cast(index_a); if (IsPixelFormatASTC(image_format) && !device.IsOptimalAstcSupported()) { view_formats[index_a].push_back(VK_FORMAT_A8B8G8R8_UNORM_PACK32); - } else if (IsUnswizzleAcceleratedFormat(device, image_format)) { - view_formats[index_a].push_back(UnswizzleStorageFormat(BytesPerBlock(image_format))); } for (size_t index_b = 0; index_b < VideoCore::Surface::MaxPixelFormat; index_b++) { const auto view_format = static_cast(index_b); @@ -1988,10 +1895,6 @@ Image::Image(TextureCacheRuntime& runtime_, const ImageInfo& info_, GPUVAddr gpu flags |= VideoCommon::ImageFlagBits::Converted; flags |= VideoCommon::ImageFlagBits::CostlyLoad; } - if (False(flags & VideoCommon::ImageFlagBits::Converted) && - WillUseAcceleratedUnswizzle(runtime->device, info)) { - flags |= VideoCommon::ImageFlagBits::AcceleratedUpload; - } if (runtime->device.HasDebuggingToolAttached()) { original_image.SetObjectNameEXT(VideoCommon::Name(*this).c_str()); } @@ -2377,15 +2280,11 @@ VkImageView Image::StorageImageView(s32 level) noexcept { if (!view) { auto format_info = MaxwellToVK::SurfaceFormat(runtime->device, FormatType::Optimal, true, info.format); - VkImageViewType view_type = VK_IMAGE_VIEW_TYPE_2D_ARRAY; if (WillUseAcceleratedAstcDecode(runtime->device, info)) { format_info.format = VK_FORMAT_A8B8G8R8_UNORM_PACK32; - } else if (True(flags & VideoCommon::ImageFlagBits::AcceleratedUpload)) { - format_info.format = UnswizzleStorageFormat(BytesPerBlock(info.format)); - view_type = UnswizzleStorageViewType(info.type); } view = MakeStorageView(runtime->device.GetLogical(), level, *(this->*current_image), - format_info.format, view_type); + format_info.format); } return *view; } @@ -2778,7 +2677,7 @@ vk::ImageView ImageView::MakeView(VkFormat vk_format, VkImageAspectFlags aspect_ .pNext = nullptr, .flags = 0, .image = image_handle, - .viewType = view_type, + .viewType = VK_IMAGE_VIEW_TYPE_2D_ARRAY, .format = vk_format, .components{ .r = VK_COMPONENT_SWIZZLE_IDENTITY, @@ -3189,24 +3088,7 @@ void TextureCacheRuntime::AccelerateImageUpload( if (is_rescaled) { image.ScaleDown(true); } - if (IsPixelFormatASTC(image.info.format)) { - astc_decoder_pass->Assemble(image, map, swizzles); - } else { - switch (image.info.type) { - case ImageType::e2D: - bl_unswizzle_2d_pass->Unswizzle(image, map, swizzles); - break; - case ImageType::e3D: - bl_unswizzle_3d_pass->Unswizzle(image, map, swizzles); - break; - case ImageType::Linear: - pitch_unswizzle_pass->Unswizzle(image, map, swizzles); - break; - default: - ASSERT(false); - break; - } - } + astc_decoder_pass->Assemble(image, map, swizzles); if (is_rescaled) { image.ScaleUp(); } diff --git a/src/video_core/renderer_vulkan/vk_texture_cache.h b/src/video_core/renderer_vulkan/vk_texture_cache.h index 2e6b547e72..6510e10e50 100644 --- a/src/video_core/renderer_vulkan/vk_texture_cache.h +++ b/src/video_core/renderer_vulkan/vk_texture_cache.h @@ -156,9 +156,6 @@ public: BlitImageHelper& blit_image_helper; RenderPassCache& render_pass_cache; std::optional astc_decoder_pass; - std::optional bl_unswizzle_2d_pass; - std::optional bl_unswizzle_3d_pass; - std::optional pitch_unswizzle_pass; const Settings::ResolutionScalingInfo& resolution; std::array, VideoCore::Surface::MaxPixelFormat> view_formats;