diff --git a/src/video_core/host_shaders/CMakeLists.txt b/src/video_core/host_shaders/CMakeLists.txt index 708227c028..40fa4968a8 100644 --- a/src/video_core/host_shaders/CMakeLists.txt +++ b/src/video_core/host_shaders/CMakeLists.txt @@ -76,9 +76,6 @@ set(SHADER_FILES vulkan_quad_indexed.comp vulkan_turbo_mode.comp vulkan_uint8.comp - convert_rgba8_to_bgra8.frag - dither_temporal.frag - dynamic_resolution_scale.comp ) if (PLATFORM_HAIKU) diff --git a/src/video_core/host_shaders/convert_rgb_to_yuv420.comp b/src/video_core/host_shaders/convert_rgb_to_yuv420.comp deleted file mode 100644 index 0a5cfab390..0000000000 --- a/src/video_core/host_shaders/convert_rgb_to_yuv420.comp +++ /dev/null @@ -1,29 +0,0 @@ -#version 450 - -layout(local_size_x = 8, local_size_y = 8) in; - -layout(binding = 0) uniform sampler2D input_texture; -layout(binding = 1, r8) uniform writeonly image2D y_output; -layout(binding = 2, r8) uniform writeonly image2D u_output; -layout(binding = 3, r8) uniform writeonly image2D v_output; - -void main() { - ivec2 pos = ivec2(gl_GlobalInvocationID.xy); - ivec2 size = imageSize(y_output); - - if (pos.x >= size.x || pos.y >= size.y) { - return; - } - - vec2 tex_coord = vec2(pos) / vec2(size); - vec3 rgb = texture(input_texture, tex_coord).rgb; - - // RGB to YUV conversion - float y = 0.299 * rgb.r + 0.587 * rgb.g + 0.114 * rgb.b; - float u = -0.147 * rgb.r - 0.289 * rgb.g + 0.436 * rgb.b + 0.5; - float v = 0.615 * rgb.r - 0.515 * rgb.g - 0.100 * rgb.b + 0.5; - - imageStore(y_output, pos, vec4(y)); - imageStore(u_output, pos / 2, vec4(u)); - imageStore(v_output, pos / 2, vec4(v)); -} \ No newline at end of file diff --git a/src/video_core/host_shaders/convert_rgba8_to_bgra8.frag b/src/video_core/host_shaders/convert_rgba8_to_bgra8.frag deleted file mode 100644 index 6f7d247985..0000000000 --- a/src/video_core/host_shaders/convert_rgba8_to_bgra8.frag +++ /dev/null @@ -1,11 +0,0 @@ -#version 450 - -layout(location = 0) in vec2 texcoord; -layout(location = 0) out vec4 color; - -layout(binding = 0) uniform sampler2D input_texture; - -void main() { - vec4 rgba = texture(input_texture, texcoord); - color = rgba.bgra; // Swap red and blue channels -} \ No newline at end of file diff --git a/src/video_core/host_shaders/dither_temporal.frag b/src/video_core/host_shaders/dither_temporal.frag deleted file mode 100644 index feaddc9aaf..0000000000 --- a/src/video_core/host_shaders/dither_temporal.frag +++ /dev/null @@ -1,29 +0,0 @@ -#version 450 - -layout(location = 0) in vec2 texcoord; -layout(location = 0) out vec4 color; - -layout(binding = 0) uniform sampler2D input_texture; - -layout(push_constant) uniform PushConstants { - float frame_count; - float dither_strength; -} constants; - -// Pseudo-random number generator -float rand(vec2 co) { - return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453); -} - -void main() { - vec4 input_color = texture(input_texture, texcoord); - - // Generate temporal noise based on frame count - vec2 noise_coord = gl_FragCoord.xy + vec2(constants.frame_count); - float noise = rand(noise_coord) * 2.0 - 1.0; - - // Apply dithering - vec3 dithered = input_color.rgb + noise * constants.dither_strength; - - color = vec4(dithered, input_color.a); -} \ No newline at end of file diff --git a/src/video_core/host_shaders/dynamic_resolution_scale.comp b/src/video_core/host_shaders/dynamic_resolution_scale.comp deleted file mode 100644 index 88f0a41c1c..0000000000 --- a/src/video_core/host_shaders/dynamic_resolution_scale.comp +++ /dev/null @@ -1,68 +0,0 @@ -#version 450 - -layout(local_size_x = 8, local_size_y = 8) in; - -layout(binding = 0) uniform sampler2D input_texture; -layout(binding = 1, rgba8) uniform writeonly image2D output_image; - -layout(push_constant) uniform PushConstants { - vec2 scale_factor; - vec2 input_size; -} constants; - -vec4 cubic(float v) { - vec4 n = vec4(1.0, 2.0, 3.0, 4.0) - v; - vec4 s = n * n * n; - float x = s.x; - float y = s.y - 4.0 * s.x; - float z = s.z - 4.0 * s.y + 6.0 * s.x; - float w = s.w - 4.0 * s.z + 6.0 * s.y - 4.0 * s.x; - return vec4(x, y, z, w) * (1.0/6.0); -} - -vec4 bicubic_sample(sampler2D tex, vec2 tex_coord) { - vec2 tex_size = constants.input_size; - vec2 inv_tex_size = 1.0 / tex_size; - - tex_coord = tex_coord * tex_size - 0.5; - - vec2 fxy = fract(tex_coord); - tex_coord -= fxy; - - vec4 xcubic = cubic(fxy.x); - vec4 ycubic = cubic(fxy.y); - - vec4 c = tex_coord.xxyy + vec2(-0.5, +1.5).xyxy; - vec4 s = vec4(xcubic.xz + xcubic.yw, ycubic.xz + ycubic.yw); - vec4 offset = c + vec4(xcubic.yw, ycubic.yw) / s; - - offset *= inv_tex_size.xxyy; - - vec4 sample0 = texture(tex, offset.xz); - vec4 sample1 = texture(tex, offset.yz); - vec4 sample2 = texture(tex, offset.xw); - vec4 sample3 = texture(tex, offset.yw); - - float sx = s.x / (s.x + s.y); - float sy = s.z / (s.z + s.w); - - return mix( - mix(sample3, sample2, sx), - mix(sample1, sample0, sx), - sy - ); -} - -void main() { - ivec2 pos = ivec2(gl_GlobalInvocationID.xy); - ivec2 size = imageSize(output_image); - - if (pos.x >= size.x || pos.y >= size.y) { - return; - } - - vec2 tex_coord = vec2(pos) / vec2(size); - vec4 color = bicubic_sample(input_texture, tex_coord); - - imageStore(output_image, pos, color); -} \ No newline at end of file diff --git a/src/video_core/renderer_vulkan/blit_image.cpp b/src/video_core/renderer_vulkan/blit_image.cpp index 334042e417..07611ef98c 100644 --- a/src/video_core/renderer_vulkan/blit_image.cpp +++ b/src/video_core/renderer_vulkan/blit_image.cpp @@ -31,9 +31,6 @@ #include "video_core/surface.h" #include "video_core/vulkan_common/vulkan_device.h" #include "video_core/vulkan_common/vulkan_wrapper.h" -#include "video_core/host_shaders/convert_rgba8_to_bgra8_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 { @@ -534,9 +531,6 @@ BlitImageHelper::BlitImageHelper(const Device& device_, Scheduler& scheduler_, convert_d32f_to_abgr8_frag(BuildShader(device, CONVERT_D32F_TO_ABGR8_FRAG_SPV)), 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_rgba_to_bgra_frag(BuildShader(device, CONVERT_RGBA8_TO_BGRA8_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)), nearest_sampler(device.GetLogical().CreateSampler(SAMPLER_CREATE_INFO)) {} @@ -1165,28 +1159,4 @@ 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::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 diff --git a/src/video_core/renderer_vulkan/blit_image.h b/src/video_core/renderer_vulkan/blit_image.h index 4ae2679913..34f1b25f0f 100644 --- a/src/video_core/renderer_vulkan/blit_image.h +++ b/src/video_core/renderer_vulkan/blit_image.h @@ -84,11 +84,6 @@ public: void ClearDepthStencil(const Framebuffer* dst_framebuffer, bool depth_clear, f32 clear_depth, u8 stencil_mask, u32 stencil_ref, u32 stencil_compare_mask, const Region2D& dst_region); - - void ConvertRGBAtoGBRA(const Framebuffer* dst_framebuffer, const ImageView& src_image_view); - void ApplyDitherTemporal(const Framebuffer* dst_framebuffer, const ImageView& src_image_view); - void ApplyDynamicResolutionScale(const Framebuffer* dst_framebuffer, const ImageView& src_image_view); - private: void Convert(VkPipeline pipeline, const Framebuffer* dst_framebuffer, const ImageView& src_image_view); @@ -143,9 +138,6 @@ private: vk::ShaderModule convert_d32f_to_abgr8_frag; vk::ShaderModule convert_d24s8_to_abgr8_frag; vk::ShaderModule convert_s8d24_to_abgr8_frag; - vk::ShaderModule convert_rgba_to_bgra_frag; - vk::ShaderModule dither_temporal_frag; - vk::ShaderModule dynamic_resolution_scale_comp; vk::Sampler linear_sampler; vk::Sampler nearest_sampler; @@ -166,9 +158,6 @@ private: vk::Pipeline convert_d32f_to_abgr8_pipeline; vk::Pipeline convert_d24s8_to_abgr8_pipeline; vk::Pipeline convert_s8d24_to_abgr8_pipeline; - vk::Pipeline convert_rgba_to_bgra_pipeline; - vk::Pipeline dither_temporal_pipeline; - vk::Pipeline dynamic_resolution_scale_pipeline; }; } // namespace Vulkan