diff options
| author | Zephyron <zephyron@citron-emu.org> | 2025-02-01 23:08:34 +1000 |
|---|---|---|
| committer | MrPurple666 <antoniosacramento666usa@gmail.com> | 2025-04-11 17:05:30 -0300 |
| commit | 3e835ac3aa05767bb8fcd9944d462233e7d20c7a (patch) | |
| tree | 947a27baf86237f1ebc844797c7ef28a86c285d9 /src/video_core/renderer_vulkan/blit_image.cpp | |
| parent | 5cb3153f155c50489e394810b81b7884f8ea03da (diff) | |
video_core: Add new shader format conversion pipelines
Adds several new shader-based format conversion pipelines to support additional
texture formats and operations:
- RGBA8 to BGRA8 conversion
- YUV420/RGB conversions
- BC7 to RGBA8 decompression
- ASTC HDR to RGBA16F decompression
- RGBA16F to RGBA8 conversion
- Temporal dithering
- Dynamic resolution scaling
Updates the texture cache runtime to handle these new conversion paths and adds
helper functions to check format compatibility for dithering and scaling
operations.
The changes include:
- New shader files and CMake entries
- Additional conversion pipeline setup in BlitImageHelper
- Extended format conversion logic in TextureCacheRuntime
- New format compatibility check helpers
Diffstat (limited to 'src/video_core/renderer_vulkan/blit_image.cpp')
| -rw-r--r-- | src/video_core/renderer_vulkan/blit_image.cpp | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/src/video_core/renderer_vulkan/blit_image.cpp b/src/video_core/renderer_vulkan/blit_image.cpp index 1eeed165fb..cf8c5454cc 100644 --- a/src/video_core/renderer_vulkan/blit_image.cpp +++ b/src/video_core/renderer_vulkan/blit_image.cpp @@ -30,6 +30,14 @@ #include "video_core/vulkan_common/vulkan_device.h" #include "video_core/vulkan_common/vulkan_wrapper.h" #include "video_core/host_shaders/convert_abgr8_srgb_to_d24s8_frag_spv.h" +#include "video_core/host_shaders/convert_rgba8_to_bgra8_frag_spv.h" +#include "video_core/host_shaders/convert_yuv420_to_rgb_comp_spv.h" +#include "video_core/host_shaders/convert_rgb_to_yuv420_comp_spv.h" +#include "video_core/host_shaders/convert_bc7_to_rgba8_comp_spv.h" +#include "video_core/host_shaders/convert_astc_hdr_to_rgba16f_comp_spv.h" +#include "video_core/host_shaders/convert_rgba16f_to_rgba8_frag_spv.h" +#include "video_core/host_shaders/dither_temporal_frag_spv.h" +#include "video_core/host_shaders/dynamic_resolution_scale_comp_spv.h" namespace Vulkan { @@ -442,6 +450,14 @@ BlitImageHelper::BlitImageHelper(const Device& device_, Scheduler& scheduler_, convert_d24s8_to_abgr8_frag(BuildShader(device, CONVERT_D24S8_TO_ABGR8_FRAG_SPV)), convert_s8d24_to_abgr8_frag(BuildShader(device, CONVERT_S8D24_TO_ABGR8_FRAG_SPV)), convert_abgr8_srgb_to_d24s8_frag(BuildShader(device, CONVERT_ABGR8_SRGB_TO_D24S8_FRAG_SPV)), + convert_rgba_to_bgra_frag(BuildShader(device, CONVERT_RGBA8_TO_BGRA8_FRAG_SPV)), + convert_yuv420_to_rgb_comp(BuildShader(device, CONVERT_YUV420_TO_RGB_COMP_SPV)), + convert_rgb_to_yuv420_comp(BuildShader(device, CONVERT_RGB_TO_YUV420_COMP_SPV)), + convert_bc7_to_rgba8_comp(BuildShader(device, CONVERT_BC7_TO_RGBA8_COMP_SPV)), + convert_astc_hdr_to_rgba16f_comp(BuildShader(device, CONVERT_ASTC_HDR_TO_RGBA16F_COMP_SPV)), + convert_rgba16f_to_rgba8_frag(BuildShader(device, CONVERT_RGBA16F_TO_RGBA8_FRAG_SPV)), + dither_temporal_frag(BuildShader(device, DITHER_TEMPORAL_FRAG_SPV)), + dynamic_resolution_scale_comp(BuildShader(device, DYNAMIC_RESOLUTION_SCALE_COMP_SPV)), linear_sampler(device.GetLogical().CreateSampler(SAMPLER_CREATE_INFO<VK_FILTER_LINEAR>)), nearest_sampler(device.GetLogical().CreateSampler(SAMPLER_CREATE_INFO<VK_FILTER_NEAREST>)) {} @@ -1060,4 +1076,68 @@ void BlitImageHelper::ConvertPipeline(vk::Pipeline& pipeline, VkRenderPass rende }); } +void BlitImageHelper::ConvertRGBAtoGBRA(const Framebuffer* dst_framebuffer, + const ImageView& src_image_view) { + ConvertPipeline(convert_rgba_to_bgra_pipeline, + dst_framebuffer->RenderPass(), + false); + Convert(*convert_rgba_to_bgra_pipeline, dst_framebuffer, src_image_view); +} + +void BlitImageHelper::ConvertYUV420toRGB(const Framebuffer* dst_framebuffer, + const ImageView& src_image_view) { + ConvertPipeline(convert_yuv420_to_rgb_pipeline, + dst_framebuffer->RenderPass(), + false); + Convert(*convert_yuv420_to_rgb_pipeline, dst_framebuffer, src_image_view); +} + +void BlitImageHelper::ConvertRGBtoYUV420(const Framebuffer* dst_framebuffer, + const ImageView& src_image_view) { + ConvertPipeline(convert_rgb_to_yuv420_pipeline, + dst_framebuffer->RenderPass(), + false); + Convert(*convert_rgb_to_yuv420_pipeline, dst_framebuffer, src_image_view); +} + +void BlitImageHelper::ConvertBC7toRGBA8(const Framebuffer* dst_framebuffer, + const ImageView& src_image_view) { + ConvertPipeline(convert_bc7_to_rgba8_pipeline, + dst_framebuffer->RenderPass(), + false); + Convert(*convert_bc7_to_rgba8_pipeline, dst_framebuffer, src_image_view); +} + +void BlitImageHelper::ConvertASTCHDRtoRGBA16F(const Framebuffer* dst_framebuffer, + const ImageView& src_image_view) { + ConvertPipeline(convert_astc_hdr_to_rgba16f_pipeline, + dst_framebuffer->RenderPass(), + false); + Convert(*convert_astc_hdr_to_rgba16f_pipeline, dst_framebuffer, src_image_view); +} + +void BlitImageHelper::ConvertRGBA16FtoRGBA8(const Framebuffer* dst_framebuffer, + const ImageView& src_image_view) { + ConvertPipeline(convert_rgba16f_to_rgba8_pipeline, + dst_framebuffer->RenderPass(), + false); + Convert(*convert_rgba16f_to_rgba8_pipeline, dst_framebuffer, src_image_view); +} + +void BlitImageHelper::ApplyDitherTemporal(const Framebuffer* dst_framebuffer, + const ImageView& src_image_view) { + ConvertPipeline(dither_temporal_pipeline, + dst_framebuffer->RenderPass(), + false); + Convert(*dither_temporal_pipeline, dst_framebuffer, src_image_view); +} + +void BlitImageHelper::ApplyDynamicResolutionScale(const Framebuffer* dst_framebuffer, + const ImageView& src_image_view) { + ConvertPipeline(dynamic_resolution_scale_pipeline, + dst_framebuffer->RenderPass(), + false); + Convert(*dynamic_resolution_scale_pipeline, dst_framebuffer, src_image_view); +} + } // namespace Vulkan |
