CRT Scanline minimal thickness in x4 scale


#21

@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.


#22

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);


#23

@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


#24

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


#25

Thanks so much for testing that :slight_smile:


#26

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


#27

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


#28

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


#29

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.

#30

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…


#31

that’s just the nature of noninteger and scanline shaders. @hunterk we should ask maister for an option to integer scale to the higher number instead to the lower one even if it forces some overscan


#32

Thank you @hunterk it works now. Looks great!

@radius I agree. Either an extra toggle below the integer option or multiple integer options like (off, on, on with overscan) would be nice. I’ve wanted something like that for some of my overrides.


#33

Yeah, I put an option for it into my border shaders, and I use a custom AR to do it with other shaders, but just having an option for it would be very nice.