From 67c4e62c51f072e36c368faaa5659a3b1427675a Mon Sep 17 00:00:00 2001 From: Immersion95 <47425204+Immersion95@users.noreply.github.com> Date: Tue, 20 Feb 2024 15:28:05 +0100 Subject: [PATCH] Adds option to enable/disable "Fix Upscale Bleeding Edge" Helps with texture bleeding case when upscaling. Disabling it can help if pixels are warping when upscaling in 2D games (MVC2, CVS, KOF, etc.) --- core/cfg/option.cpp | 1 + core/cfg/option.h | 1 + core/hw/pvr/ta_vtx.cpp | 2 +- core/rend/gui.cpp | 2 ++ shell/libretro/libretro_core_options.h | 14 ++++++++++++++ shell/libretro/option.cpp | 1 + 6 files changed, 20 insertions(+), 1 deletion(-) diff --git a/core/cfg/option.cpp b/core/cfg/option.cpp index d39ccbfb6d..affe084fe2 100644 --- a/core/cfg/option.cpp +++ b/core/cfg/option.cpp @@ -108,6 +108,7 @@ Option DupeFrames("rend.DupeFrames", false); Option PerPixelLayers("rend.PerPixelLayers", 32); Option NativeDepthInterpolation("rend.NativeDepthInterpolation", false); Option EmulateFramebuffer("rend.EmulateFramebuffer", false); +Option FixUpscaleBleedingEdge("rend.FixUpscaleBleedingEdge", true); #ifdef VIDEO_ROUTING Option VideoRouting("rend.VideoRouting", false); Option VideoRoutingScale("rend.VideoRoutingScale", false); diff --git a/core/cfg/option.h b/core/cfg/option.h index 65d41f3948..c2bd83e311 100644 --- a/core/cfg/option.h +++ b/core/cfg/option.h @@ -474,6 +474,7 @@ extern Option ThreadedRendering; extern Option DupeFrames; extern Option NativeDepthInterpolation; extern Option EmulateFramebuffer; +extern Option FixUpscaleBleedingEdge; #ifdef VIDEO_ROUTING extern Option VideoRouting; extern Option VideoRoutingScale; diff --git a/core/hw/pvr/ta_vtx.cpp b/core/hw/pvr/ta_vtx.cpp index fcf80f9678..ecc08a1704 100644 --- a/core/hw/pvr/ta_vtx.cpp +++ b/core/hw/pvr/ta_vtx.cpp @@ -1160,7 +1160,7 @@ static void parseRenderPass(RenderPass& pass, const RenderPass& previousPass, re || config::RendererType == RenderType::Vulkan_OIT; const bool mergeTranslucent = config::PerStripSorting || perPixel; - if (config::RenderResolution > 480 && !config::EmulateFramebuffer) + if (config::RenderResolution > 480 && !config::EmulateFramebuffer && config::FixUpscaleBleedingEdge) { fix_texture_bleeding(ctx.global_param_op, previousPass.op_count, pass.op_count, ctx); fix_texture_bleeding(ctx.global_param_pt, previousPass.pt_count, pass.pt_count, ctx); diff --git a/core/rend/gui.cpp b/core/rend/gui.cpp index 82e4054b25..641a106c65 100644 --- a/core/rend/gui.cpp +++ b/core/rend/gui.cpp @@ -2064,6 +2064,8 @@ static void gui_display_settings() OptionCheckbox("Rotate Screen 90°", config::Rotate90, "Rotate the screen 90° counterclockwise"); OptionCheckbox("Delay Frame Swapping", config::DelayFrameSwapping, "Useful to avoid flashing screen or glitchy videos. Not recommended on slow platforms"); + OptionCheckbox("Fix Upscale Bleeding Edge", config::FixUpscaleBleedingEdge, + "Helps with texture bleeding case when upscaling. Disabling it can help if pixels are warping when upscaling in 2D games (MVC2, CVS, KOF, etc.)"); OptionCheckbox("Native Depth Interpolation", config::NativeDepthInterpolation, "Helps with texture corruption and depth issues on AMD GPUs. Can also help Intel GPUs in some cases."); OptionCheckbox("Full Framebuffer Emulation", config::EmulateFramebuffer, diff --git a/shell/libretro/libretro_core_options.h b/shell/libretro/libretro_core_options.h index 1d1669f2c6..3cf6684c2d 100644 --- a/shell/libretro/libretro_core_options.h +++ b/shell/libretro/libretro_core_options.h @@ -596,6 +596,20 @@ struct retro_core_option_v2_definition option_defs_us[] = { }, "disabled", }, + { + CORE_OPTION_NAME "_fix_upscale_bleeding_edge", + "Fix Upscale Bleeding Edge", + NULL, + "Helps with texture bleeding case when upscaling. Disabling it can help if pixels are warping when upscaling in 2D games (MVC2, CVS, KOF, etc.)", + NULL, + "video", + { + { "disabled", NULL }, + { "enabled", NULL }, + { NULL, NULL }, + }, + "enabled", + }, { CORE_OPTION_NAME "_threaded_rendering", "Threaded Rendering", diff --git a/shell/libretro/option.cpp b/shell/libretro/option.cpp index f7dac40c43..22797bd6ce 100644 --- a/shell/libretro/option.cpp +++ b/shell/libretro/option.cpp @@ -92,6 +92,7 @@ Option PixelBufferSize("", 512_MB); IntOption PerPixelLayers(CORE_OPTION_NAME "_oit_layers"); Option NativeDepthInterpolation(CORE_OPTION_NAME "_native_depth_interpolation"); Option EmulateFramebuffer(CORE_OPTION_NAME "_emulate_framebuffer", false); +Option FixUpscaleBleedingEdge(CORE_OPTION_NAME "_fix_upscale_bleeding_edge", true); // Misc