|
|
|
@ -933,6 +933,33 @@ void BlitScale(Scheduler& scheduler, VkImage src_image, VkImage dst_image, const |
|
|
|
0, nullptr, nullptr, write_barriers); |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
[[nodiscard]] bool ByteWidthSupported(u32 bpp, const Device& device) { |
|
|
|
switch (bpp) { |
|
|
|
case 1: |
|
|
|
return device.IsStorageBuffer8BitAccessSupported(); |
|
|
|
case 2: |
|
|
|
return device.IsStorageBuffer16BitAccessSupported(); |
|
|
|
case 4: |
|
|
|
case 8: |
|
|
|
case 16: |
|
|
|
return true; |
|
|
|
default: |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[[nodiscard]] boost::container::small_vector<VkFormat, 8> BuildViewFormats( |
|
|
|
const ImageInfo& info, std::span<const VkFormat> base_view_formats) { |
|
|
|
boost::container::small_vector<VkFormat, 8> formats(base_view_formats.begin(), |
|
|
|
base_view_formats.end()); |
|
|
|
if (Settings::values.gpu_unswizzle_enabled.GetValue()) { |
|
|
|
if (const auto block_view_format = BlockTexelViewFormat(info.format)) { |
|
|
|
formats.push_back(*block_view_format); |
|
|
|
} |
|
|
|
} |
|
|
|
return formats; |
|
|
|
} |
|
|
|
} // Anonymous namespace
|
|
|
|
|
|
|
|
TextureCacheRuntime::TextureCacheRuntime(const Device& device_, Scheduler& scheduler_, |
|
|
|
@ -986,21 +1013,6 @@ TextureCacheRuntime::TextureCacheRuntime(const Device& device_, Scheduler& sched |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[[nodiscard]] bool ByteWidthSupported(u32 bpp, const Device& device) { |
|
|
|
switch (bpp) { |
|
|
|
case 1: |
|
|
|
return device.IsStorageBuffer8BitAccessSupported(); |
|
|
|
case 2: |
|
|
|
return device.IsStorageBuffer16BitAccessSupported(); |
|
|
|
case 4: |
|
|
|
case 8: |
|
|
|
case 16: |
|
|
|
return true; |
|
|
|
default: |
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
bool TextureCacheRuntime::IsUnswizzleStorageFormatSupported(PixelFormat format) const { |
|
|
|
const u32 bytes_per_block = VideoCore::Surface::BytesPerBlock(format); |
|
|
|
if (!ByteWidthSupported(bytes_per_block, device)) { |
|
|
|
@ -1880,18 +1892,6 @@ void TextureCacheRuntime::ReleaseSparseUnswizzleBuffer(Image& image) { |
|
|
|
}); |
|
|
|
} |
|
|
|
|
|
|
|
[[nodiscard]] boost::container::small_vector<VkFormat, 8> BuildViewFormats( |
|
|
|
const ImageInfo& info, std::span<const VkFormat> base_view_formats) { |
|
|
|
boost::container::small_vector<VkFormat, 8> formats(base_view_formats.begin(), |
|
|
|
base_view_formats.end()); |
|
|
|
if (Settings::values.gpu_unswizzle_enabled.GetValue()) { |
|
|
|
if (const auto block_view_format = BlockTexelViewFormat(info.format)) { |
|
|
|
formats.push_back(*block_view_format); |
|
|
|
} |
|
|
|
} |
|
|
|
return formats; |
|
|
|
} |
|
|
|
|
|
|
|
Image::Image(TextureCacheRuntime& runtime_, const ImageInfo& info_, GPUVAddr gpu_addr_, |
|
|
|
VAddr cpu_addr_) |
|
|
|
: VideoCommon::ImageBase(info_, gpu_addr_, cpu_addr_), scheduler{&runtime_.scheduler}, |
|
|
|
|