From a4010b33125fa01fad270529691269dbd761284f Mon Sep 17 00:00:00 2001 From: Lander Gallastegi Date: Tue, 12 Nov 2024 22:44:18 +0100 Subject: [PATCH] Add surface formats --- .../renderer_vulkan/liverpool_to_vk.cpp | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/src/video_core/renderer_vulkan/liverpool_to_vk.cpp b/src/video_core/renderer_vulkan/liverpool_to_vk.cpp index 258e7f391..5e82952f0 100644 --- a/src/video_core/renderer_vulkan/liverpool_to_vk.cpp +++ b/src/video_core/renderer_vulkan/liverpool_to_vk.cpp @@ -635,6 +635,33 @@ std::span SurfaceFormats() { vk::Format::eBc7UnormBlock), CreateSurfaceFormatInfo(AmdGpu::DataFormat::FormatBc7, AmdGpu::NumberFormat::Srgb, vk::Format::eBc7SrgbBlock), + + /* + * Shaders reading/writing these formats need to be patched to normalize/unnormalize the + * values This is because the Vulkan doesn't support these formats directly + * + * see shader_recompiler/ir/passes/resource_tracking_pass.cpp + */ + // 32 + CreateSurfaceFormatInfo(AmdGpu::DataFormat::Format32, AmdGpu::NumberFormat::Unorm, + vk::Format::eR32Uint), + CreateSurfaceFormatInfo(AmdGpu::DataFormat::Format32, AmdGpu::NumberFormat::Snorm, + vk::Format::eR32Uint), + // 32_32 + CreateSurfaceFormatInfo(AmdGpu::DataFormat::Format32_32, AmdGpu::NumberFormat::Unorm, + vk::Format::eR32G32Uint), + CreateSurfaceFormatInfo(AmdGpu::DataFormat::Format32_32, AmdGpu::NumberFormat::Snorm, + vk::Format::eR32G32Uint), + // 32_32_32 + CreateSurfaceFormatInfo(AmdGpu::DataFormat::Format32_32_32, AmdGpu::NumberFormat::Unorm, + vk::Format::eR32G32B32Uint), + CreateSurfaceFormatInfo(AmdGpu::DataFormat::Format32_32_32, AmdGpu::NumberFormat::Snorm, + vk::Format::eR32G32B32Uint), + // 32_32_32_32 + CreateSurfaceFormatInfo(AmdGpu::DataFormat::Format32_32_32_32, AmdGpu::NumberFormat::Unorm, + vk::Format::eR32G32B32A32Uint), + CreateSurfaceFormatInfo(AmdGpu::DataFormat::Format32_32_32_32, AmdGpu::NumberFormat::Snorm, + vk::Format::eR32G32B32A32Uint), }; return formats; }