Browse Source

{vk, texture_cache] TEST: Adjusting vk format reinterpretation

pull/2981/head
CamilleLaVey 3 months ago
parent
commit
8cfc2ce3c0
  1. 10
      src/video_core/renderer_vulkan/vk_texture_cache.cpp

10
src/video_core/renderer_vulkan/vk_texture_cache.cpp

@ -1697,7 +1697,7 @@ Image::Image(TextureCacheRuntime& runtime_, const ImageInfo& info_, GPUVAddr gpu
VAddr cpu_addr_) VAddr cpu_addr_)
: VideoCommon::ImageBase(info_, gpu_addr_, cpu_addr_), scheduler{&runtime_.scheduler}, : VideoCommon::ImageBase(info_, gpu_addr_, cpu_addr_), scheduler{&runtime_.scheduler},
runtime{&runtime_} { runtime{&runtime_} {
// CRITICAL: Adjust MSAA for HDR formats if driver doesn't support shaderStorageImageMultisample
// Adjust MSAA for HDR formats if driver doesn't support shaderStorageImageMultisample
// This prevents texture corruption by degrading to non-MSAA when msaa_copy_pass would fail // This prevents texture corruption by degrading to non-MSAA when msaa_copy_pass would fail
const ImageInfo adjusted_info = AdjustMSAAForHDRFormats(runtime_.device, info_); const ImageInfo adjusted_info = AdjustMSAAForHDRFormats(runtime_.device, info_);
@ -2228,15 +2228,14 @@ ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewI
VkFormat view_format = format_info.format; VkFormat view_format = format_info.format;
// Format reinterpretation for games with incorrect format usage // Format reinterpretation for games with incorrect format usage
// Only apply to sampled images (not render targets, not storage images)
// Only apply to sampled images (not render targets)
// NOTE: Storage images use separate views created via StorageView()/MakeView(),
// so reinterpretation here only affects sampled texture reads, not storage writes
const auto reinterpretation_mode = Settings::values.format_reinterpretation.GetValue(); const auto reinterpretation_mode = Settings::values.format_reinterpretation.GetValue();
if (reinterpretation_mode != Settings::FormatReinterpretation::Disabled && if (reinterpretation_mode != Settings::FormatReinterpretation::Disabled &&
!info.IsRenderTarget() && !info.IsRenderTarget() &&
(ImageUsageFlags(format_info, format) & VK_IMAGE_USAGE_SAMPLED_BIT)) { (ImageUsageFlags(format_info, format) & VK_IMAGE_USAGE_SAMPLED_BIT)) {
// Only reinterpret if NOT used as storage image (storage requires matching types)
const bool is_storage = (ImageUsageFlags(format_info, format) & VK_IMAGE_USAGE_STORAGE_BIT) != 0;
if (!is_storage) {
switch (reinterpretation_mode) { switch (reinterpretation_mode) {
case Settings::FormatReinterpretation::R32UintToR32Sfloat: case Settings::FormatReinterpretation::R32UintToR32Sfloat:
if (view_format == VK_FORMAT_R32_UINT) { if (view_format == VK_FORMAT_R32_UINT) {
@ -2260,7 +2259,6 @@ ImageView::ImageView(TextureCacheRuntime& runtime, const VideoCommon::ImageViewI
break; break;
} }
} }
}
if (ImageUsageFlags(format_info, format) != image.UsageFlags()) { if (ImageUsageFlags(format_info, format) != image.UsageFlags()) {
LOG_WARNING(Render_Vulkan, LOG_WARNING(Render_Vulkan,

Loading…
Cancel
Save