CRT Scanline minimal thickness in x4 scale

@Flamex Do you mean it still shows 2 pixel thick scanlines on AMD?

Could you try replacing this line:

    if (mod(scale, 2.0)) offset = 0.0;

With this:

    if (fract(scale / 2.0)) offset = 0.0;

Or failing that, just deleting that line altogether to see if thin scanlines will display on AMD.

Sorry to ask, but I don’t have an AMD card to test this out on.

Usually, when something works on nvidia but not on AMD, it’s a difference in the way they handle rounding. In this case, I believe it was tripping up the ‘floor’ function, which in turn threw off the scale/mod detection. Adding a very small offset to the scale calculation seems to fix it here:

float scale = floor((OutputSize.y / InputSize.y) + 0.001);

3 Likes

@EasyMode tried replacing didn’t work so I removed the line, I have thin line but there’s something wrong there’s a little offset and scanlines aren’t symetrical.

didn’t try hunterk fix yet

@hunterk @EasyMode Ok it works with hunterk workaround ! :slight_smile:

3 Likes

Thanks so much for testing that :slight_smile:

1 Like

Is there a way to have your scanline shader at non integer scales? Because if I try to add a small blurring shader (only meant to blur the pixels enough to scale to any size) the scanlines disappear

it should work at non-integer scales already on its own

When I’m running a game at non integer scales with this shader, the scanlines are uneven.

The new crt-aperture.glsl downloaded through the Retroarch updater still isn’t working for me. So I’m running Linux Mint 19.1 (so basically Ubuntu 18.04 LTS) on a Dell Optiplex 9020 with an AMD R7 240.

Let me know if you need more logs or anything. Thanks!

[INFO] RetroArch 1.7.6 (Git cc07982)
*snip*
[INFO] [Shader driver]: Using GLSL shader backend.
[INFO] [GLSL]: Checking GLSL shader support ...
[INFO] Found #pragma parameter Sharpness Image (SHARPNESS_IMAGE) 1.000000 1.000000 5.000000 1.000000 in pass 0
[INFO] Found #pragma parameter Sharpness Edges (SHARPNESS_EDGES) 3.000000 1.000000 5.000000 1.000000 in pass 0
*snip*
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] [GLSL]: Linking GLSL program.
[INFO] [GLSL]: Found GLSL vertex shader.
[INFO] [GLSL]: Found GLSL fragment shader.
[INFO] Shader log: 0:211(6): error: if-statement condition must be scalar boolean

[ERROR] Failed to compile fragment shader #0
[ERROR] Failed to link program #0.
[ERROR] Failed to create GL program #0.
[INFO] [GLSL]: Checking GLSL shader support ...
[WARN] [GL]: Stock GLSL shaders will be used.

I just pushed up a fix to the repo, so it should make it to the online updater soon. In the meantime, you can try to apply the fix manually, if you like. Just change this line:

if (mod(scale, 2.0)) offset = 0.0;

to this:

if (bool(mod(scale, 2.0))) offset = 0.0;

Some compilers are picky about implicit casts…

1 Like

Thank you @hunterk it works now. Looks great!

1 Like