Problem with gb-shader, doesn't fit the viewport

Hi

I’m experiencing a weird problem with gb-shader (handhelds/gameboy/gb-shader): it doesn’t fill the viewport area.

Without gb-shader:

With gb-shader:

As you can see, there is an empty border around the image. The weird part comes when I go to menu and I do Integer Scaling (originally OFF) -> ON -> OFF in video settings. Then, the final image is what I would like to obtain in first place, the shader applied and the image with the correct size:

My configuration is:


- retroarch.cfg               <- default file automatically created by retroarch
         - main.cfg           <- my general override
                 - sys_gb.cfg <- my gb override

The content of main.cfg about video is:


custom_viewport_height = "1080"
custom_viewport_width = "1440"
custom_viewport_x = "240"
custom_viewport_y = "0"
input_overlay = ""

video_aspect_ratio = "1.85"
video_aspect_ratio_auto = "false"
video_filter = ""
video_force_srgb_disable = "false"
video_fullscreen = "true"
video_fullscreen_x = "0"
video_fullscreen_y = "0"
video_gpu_screenshot = "false"
video_hard_sync = "false"
video_hard_sync_frames = "0"
video_monitor_index = "0"
video_refresh_rate = "60"
video_scale = "1.000000"
video_scale_integer = "false"
video_shader_enable = "true"
video_shared_context = "false"
video_smooth = "true"
video_swap_interval = "1"
video_threaded = "false"
video_vsync = "true"
video_windowed_fullscreen = "false"

And the content of sys_gb.cfg is:


#input_overlay = "~/Retroarch/overlays/gb.cfg"
#video_shader = "/usr/share/libretro/shaders/handheld/gameboy/gb-shader.cgp"   <- playing with this parameter
#video_shader = "none"                                                         <- ... and this parameter

custom_viewport_height = "574"
custom_viewport_width = "638"
custom_viewport_x = "640"
custom_viewport_y = "252"

Any idea of what could be the problem and the solution to it? could it be a bug in the shader? maybe in retroarch?

Regards

It’s unexpected behavior, for sure, (probably related to rounding, since it’s sampling right on the integer scale edge) but why are you doing the custom viewport stuff anyway? The shader is designed to integer-scale the content and fill the rest with the background, so if you do a custom viewport just slightly larger than the integer size you want (1 or a few px all around should do it), it should avoid the rounding confusing.

It’s because I’m using a Game Boy overlay and that’s the proper size and position of the screen. I’ll try with a viewport of the right size and if it works, I’ll modify the overlay.

Thanks

ok, good luck. You are aware of the console-border shaders, right? they include the shader and the border in one package without needing to fool with custom viewports or overlays.

Checked, initially gb-shader resizes the playable area to an integer multiplication of the original resolution. Setting:


custom_viewport_height = "578"
custom_viewport_width = "642"

Which is 2px wider and taller than 4x resolution is good enough.

I wasn’t aware of console-border shaders (I think I saw them in the menu but I didn’t try them) so I’ll take a look and I’ll decide which method to use.

Thanks again.