libretro / RetroArch

Cross-platform, sophisticated frontend for the libretro API. Licensed GPLv3.
http://www.libretro.com
GNU General Public License v3.0
10.22k stars 1.82k forks source link

GLSL shaders not working with Intel HD Graphics 620 on Windows 10 #4723

Closed lotharsm closed 5 years ago

lotharsm commented 7 years ago

First and foremost consider this:

Description

Today, I got my new Laptop, powered by an Intel Core i5 7200U with integrated HD Graphics 620. I noticed that GLSL shaders don't work, at least not the ones with multiple passes. I couldn't test the all, but a good one to test is the shader preset "shaders_glsl/handheld/gameboy.glslp". It seems that the multipass shaders seems to be the worst, but I got some simple ones (like the simple lcd grid) working.

CG shaders work fine, SLANG shaders have some small issues (I might open a separate bug report about this)

I used the latest buildbot versions from RetroArch, the cores and obtained the latest shaders through the Online Updater. The exact same versions run fine on my old laptop featuring an AMD Radeon HD7400M, so this issue is specific to the Intel graphics solutions.

Expected behavior

GLSL shaders should work as expected.

Actual behavior

When selecting the shader preset to the menu, the menu simply returns to the previous menu without loading or applying the shader.

Log file:

RetroArch [INFO] :: [Shader driver]: Using GLSL shader backend.
RetroArch [INFO] :: Checking GLSL shader support ...
RetroArch [INFO] :: Found #pragma parameter Baseline Alpha (baseline_alpha) 0.100000 0.000000 1.000000 0.010000
RetroArch [INFO] :: Found #pragma parameter LCD Response Time (response_time) 0.333000 0.000000 0.777000 0.111000
RetroArch [INFO] :: Found #pragma parameter Console-Border Enable (console_border_enable) 0.000000 0.000000 1.000000 1.0                00000
RetroArch [INFO] :: Found #pragma parameter Video Scale (video_scale) 3.000000 3.000000 5.000000 1.000000
RetroArch [INFO] :: Found #pragma parameter Blending Mode (blending_mode) 1.000000 0.000000 1.000000 1.000000
RetroArch [INFO] :: Found #pragma parameter Neighbor Blending (adjacent_texel_alpha_blending) 0.175500 0.000000 1.000000                 0.050000
RetroArch [INFO] :: Found #pragma parameter Contrast (contrast) 0.950000 0.000000 1.000000 0.050000
RetroArch [INFO] :: Found #pragma parameter Ambient Screen Light (screen_light) 1.000000 0.000000 2.000000 0.050000
RetroArch [INFO] :: Found #pragma parameter Pixel Opacity (pixel_opacity) 1.000000 0.010000 1.000000 0.010000
RetroArch [INFO] :: Found #pragma parameter Background Smooth (bg_smoothing) 0.750000 0.000000 1.000000 0.050000
RetroArch [INFO] :: Found #pragma parameter Shadow Opacity (shadow_opacity) 0.550000 0.010000 1.000000 0.010000
RetroArch [INFO] :: Found #pragma parameter Shadow Offset Horiz (shadow_offset_x) 1.000000 -5.000000 5.000000 0.500000
RetroArch [INFO] :: Found #pragma parameter Shadow Offset Vert (shadow_offset_y) 1.000000 -5.000000 5.000000 0.500000
RetroArch [INFO] :: Found #pragma parameter Screen Offset Horiz (screen_offset_x) 0.000000 -5.000000 5.000000 0.500000
RetroArch [INFO] :: Found #pragma parameter Screen Offset Vert (screen_offset_y) 0.000000 -5.000000 5.000000 0.500000
RetroArch [INFO] :: Found GLSL vertex shader.
RetroArch [INFO] :: Shader log: WARNING: 3:1: '' :  #version directive missing

RetroArch [INFO] :: Found GLSL fragment shader.
RetroArch [INFO] :: Shader log: WARNING: 3:1: '' :  #version directive missing

RetroArch [INFO] :: Linking GLSL program.
RetroArch [INFO] :: Found GLSL vertex shader.
RetroArch [INFO] :: Shader log: ERROR: 3:117: '' : illegal recursive expansion of macro OutputSize
ERROR: 3:117: 'OutputSize' : failed to expand macro
ERROR: 3:117: '' : illegal recursive expansion of macro OutputSize
ERROR: 3:117: 'OutputSize' : failed to expand macro
ERROR: 3:121: '' : illegal recursive expansion of macro OutputSize
ERROR: 3:121: 'OutputSize' : failed to expand macro
ERROR: 3:121: '' : illegal recursive expansion of macro OutputSize
ERROR: 3:121: 'OutputSize' : failed to expand macro
ERROR: 3:123: '' : illegal recursive expansion of macro OutputSize
ERROR: 3:123: 'OutputSize' : failed to expand macro
ERROR: 3:123: '' : illegal recursive expansion of macro OutputSize
ERROR: 3:123: 'OutputSize' : failed to expand macro

RetroArch [ERROR] :: Failed to compile vertex shader #0
RetroArch [ERROR] :: Failed to link program #0.
RetroArch [ERROR] :: Failed to create GL program #0.
RetroArch [INFO] :: Checking GLSL shader support ...
RetroArch [WARN] :: [GL]: Stock GLSL shaders will be used.
RetroArch [INFO] :: Found GLSL vertex shader.
RetroArch [INFO] :: Shader log: WARNING: 3:1: '' :  #version directive missing

RetroArch [INFO] :: Found GLSL fragment shader.
RetroArch [INFO] :: Shader log: WARNING: 3:1: '' :  #version directive missing

RetroArch [INFO] :: Linking GLSL program.
RetroArch [INFO] :: Found GLSL vertex shader.
RetroArch [INFO] :: Shader log: WARNING: 3:1: '' :  #version directive missing

RetroArch [INFO] :: Found GLSL fragment shader.
RetroArch [INFO] :: Shader log: WARNING: 3:1: '' :  #version directive missing

RetroArch [INFO] :: Linking GLSL program.
RetroArch [INFO] :: Found GLSL vertex shader.
RetroArch [INFO] :: Shader log: WARNING: 3:1: '' :  #version directive missing

RetroArch [INFO] :: Found GLSL fragment shader.
RetroArch [INFO] :: Shader log: WARNING: 3:1: '' :  #version directive missing

RetroArch [INFO] :: Linking GLSL program.
RetroArch [INFO] :: Found GLSL vertex shader.
RetroArch [INFO] :: Shader log: WARNING: 3:1: '' :  #version directive missing

RetroArch [INFO] :: Found GLSL fragment shader.
RetroArch [INFO] :: Shader log: WARNING: 3:1: '' :  #version directive missing

RetroArch [INFO] :: Linking GLSL program.
RetroArch [INFO] :: Found GLSL vertex shader.
RetroArch [INFO] :: Shader log: WARNING: 3:1: '' :  #version directive missing

RetroArch [INFO] :: Found GLSL fragment shader.
RetroArch [INFO] :: Shader log: WARNING: 3:1: '' :  #version directive missing

RetroArch [INFO] :: Linking GLSL program.
RetroArch [INFO] :: Found GLSL vertex shader.
RetroArch [INFO] :: Shader log: WARNING: 3:1: '' :  #version directive missing

RetroArch [INFO] :: Found GLSL fragment shader.
RetroArch [INFO] :: Shader log: WARNING: 3:1: '' :  #version directive missing

RetroArch [INFO] :: Linking GLSL program.
RetroArch [INFO] :: Found GLSL vertex shader.
RetroArch [INFO] :: Shader log: WARNING: 3:1: '' :  #version directive missing

RetroArch [INFO] :: Found GLSL fragment shader.
RetroArch [INFO] :: Shader log: WARNING: 3:1: '' :  #version directive missing

RetroArch [INFO] :: Linking GLSL program.
RetroArch [INFO] :: Found GLSL vertex shader.
RetroArch [INFO] :: Shader log: WARNING: 3:1: '' :  #version directive missing

RetroArch [INFO] :: Found GLSL fragment shader.
RetroArch [INFO] :: Shader log: WARNING: 3:1: '' :  #version directive missing

RetroArch [INFO] :: Linking GLSL program.
RetroArch [WARN] :: [GL]: Failed to set multipass shader. Falling back to stock.

Steps to reproduce the bug

  1. Load some content
  2. Try to apply a shader preset

Version/Commit

ec395048b

Environment information

--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/42651715-glsl-shaders-not-working-with-intel-hd-graphics-620-on-windows-10?utm_campaign=plugin&utm_content=tracker%2F296058&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F296058&utm_medium=issues&utm_source=github).
hizzlekizzle commented 7 years ago

Ok, I'm working on hand-converting the GLSL shaders, so this kind of thing can happen in the process. Thanks for the report.

In the short term, is there a reason why you're wanting to use the GLSL shaders instead of Cg and/or slang?

EDIT: okay, I pushed a fix for that on the gameboy shader. If you can (wait a while for the shaders to update in the online updater and then) re-fetch them and give it another shot, let me know if it reports any other errors.

lotharsm commented 7 years ago

I tested again with the updated shaders, and now the Gameboy shader works fine, the other Gameboy shaders with borders enabled sadly still don't work. I wonder why the Intel driver complained about that missing version directive, while the radeon driver on my old laptop didn't.

There is no particular reason why I want to use GLSL shaders now. I just noticed they don't work on my system, so I reported that.

Is it correct that GLSL shaders are only meant as a fallback option in case Cg and/or slang is unsupported by the hardware? Will the slang shaders eventually replace the Cg shaders now that Nvidia stopped supporting Cg and put it in a legacy state? [see https://developer.nvidia.com/cg-toolkit]

hizzlekizzle commented 7 years ago

Yeah, we've officially deprecated Cg, but we'll keep it around as long as Nvidia still has the libs for download.

GLSL has been a fallback in the past, but I just spent the past week hand-converting a majority of the shaders, so it should be mostly on-par with the others now. There are a few notable exceptions, like crt-royale, that simply aren't going to be ported, though.

I'll try to fix up the console-border shaders ASAP. If you find any others that aren't working, do let me know. Each vendor's compiler has its own quirks, unfortunately, so the more testing that gets done, the more I'll be able to fix.

lotharsm commented 7 years ago

Thank you for looking at the console-border shader. In general, it seems that nearly all shaders are affected, except the real simple ones. Btw, in which repository are the GLSL shaders located?

Now that Cg is deprecated, is slang the shader language that will be the preferred one in the future?

hizzlekizzle commented 7 years ago

Yeah, I'm going to focus on keeping slang and GLSL as healthy as possible. I'll still try to keep Cg going but it's lower priority for me.

The GLSL repo is currently at https://github.com/hizzlekizzle/glsl-shaders but I'm going to probably move it under the libretro organization pretty soon, since it's mostly complete now.

lotharsm commented 7 years ago

Is there a way to automagically test all GLSL shader presets with the Intel GL compiler? Or do I have to test each and every shader by myself?

Btw, the shaders in handheld/console-borders are all affected.

hizzlekizzle commented 7 years ago

no programmatic way that I know of, unfortunately. You can save some time by only testing the ones from my repo and not the ones from the online updater, since it includes a bunch of auto-converted shaders that I can't really do anything about.

lotharsm commented 7 years ago

I am currently testing the shaders from your repository.

I wonder what happens if one single shader fails to compile on a multi-pass shader? E.g. when you have a shader with 5 passes, and one shader fails to compile - will the other 4 passes be available or does RetroArch throw an error immediately?

lotharsm commented 7 years ago

I just finished the first 68 shaders from your repository.

Shaders that refuse to compile

Shaders that compile, but have issues

Next batch will follow tomorrow. Please also notice that all tested shader presets produce warnings about missing version directives.

hizzlekizzle commented 7 years ago

Hey, this is great! Thanks for the testing.

I pushed some fixes for the crtglow and ntsc shaders, if you wouldn't mind trying those again. Any chance you can get me any of the errors on the ones that fail to compile (minus all of the version directive warnings)?

gtu-famicom and the other ntsc shaders will probably all be pink because of spotty support for float framebuffers in older OGL versions. Anything that includes crt-royale is going to be broken, too.

lotharsm commented 7 years ago

To make testing a bit easier, I wrote a little bash script that automatically creates a .cfg file for every .glslp file found. The created cfg file only contains a video_shader override. Then, the script automatically launches RetroArch with each generated .cfg file and exits RetroArch again after 128 frames. With this script it is possible to test entire shader directories completely unattended in a few minutes.

It only tests if the shaders will compile, but not if the shaders look as intended. Oh, and btw, the full output and only the ERROR lines are logged.

The script is available here: https://gist.github.com/rootfather/7e3ea06f1d7e546d82792307a9769da7

Here are my results. I pulled your repository at around 30 minutes ago.

Shaders that failed to compile (ignore the .cfg.error.log at the end)

./borders/gameboy-player/gameboy-player-crt-royale.glslp.cfg.error.log
./borders/gameboy-player/gameboy-player-tvout.glslp.cfg.error.log
./borders/sgb/sgb-crt-royale.glslp.cfg.error.log
./borders/sgb/sgb-tvout+interlacing.glslp.cfg.error.log
./crt/gtuv50.glslp.cfg.error.log
./dithering/bayer-matrix-dithering.glslp.cfg.error.log
./dithering/gdapt.glslp.cfg.error.log
./handheld/console-border/dmg-2x.glslp.cfg.error.log
./handheld/console-border/dmg-3x.glslp.cfg.error.log
./handheld/console-border/dmg-4x.glslp.cfg.error.log
./handheld/console-border/dmg-5x.glslp.cfg.error.log
./handheld/console-border/dmg-6x.glslp.cfg.error.log
./handheld/console-border/gb-pocket-2x.glslp.cfg.error.log
./handheld/console-border/gb-pocket-3x.glslp.cfg.error.log
./handheld/console-border/gb-pocket-4x.glslp.cfg.error.log
./handheld/console-border/gb-pocket-5x.glslp.cfg.error.log
./handheld/console-border/gb-pocket-6x.glslp.cfg.error.log
./handheld/console-border/gba-2x.glslp.cfg.error.log
./handheld/console-border/gba-3x.glslp.cfg.error.log
./handheld/console-border/gba-4x.glslp.cfg.error.log
./handheld/console-border/gba-5x.glslp.cfg.error.log
./handheld/console-border/gba-6x.glslp.cfg.error.log
./handheld/console-border/gbc-2x.glslp.cfg.error.log
./handheld/console-border/gbc-3x.glslp.cfg.error.log
./handheld/console-border/gbc-4x.glslp.cfg.error.log
./handheld/console-border/gbc-5x.glslp.cfg.error.log
./handheld/console-border/gbc-6x.glslp.cfg.error.log
./handheld/console-border/gg-2x.glslp.cfg.error.log
./handheld/console-border/gg-3x.glslp.cfg.error.log
./handheld/console-border/gg-4x.glslp.cfg.error.log
./handheld/console-border/gg-5x.glslp.cfg.error.log
./handheld/console-border/gg-6x.glslp.cfg.error.log
./handheld/console-border/old/dmg-2x-old.glslp.cfg.error.log
./handheld/console-border/old/dmg-3x.glslp.cfg.error.log
./handheld/console-border/old/dmg-4x.glslp.cfg.error.log
./handheld/console-border/old/dmg-5x.glslp.cfg.error.log
./handheld/console-border/old/dmg-6x.glslp.cfg.error.log
./handheld/console-border/old/gb-pocket-2x.glslp.cfg.error.log
./handheld/console-border/old/gb-pocket-3x.glslp.cfg.error.log
./handheld/console-border/old/gb-pocket-4x.glslp.cfg.error.log
./handheld/console-border/old/gb-pocket-5x.glslp.cfg.error.log
./handheld/console-border/old/gb-pocket-6x.glslp.cfg.error.log
./handheld/console-border/old/gba-2x.glslp.cfg.error.log
./handheld/console-border/old/gba-3x.glslp.cfg.error.log
./handheld/console-border/old/gba-4x.glslp.cfg.error.log
./handheld/console-border/old/gba-5x.glslp.cfg.error.log
./handheld/console-border/old/gba-6x.glslp.cfg.error.log
./handheld/console-border/old/gbc-2x.glslp.cfg.error.log
./handheld/console-border/old/gbc-3x.glslp.cfg.error.log
./handheld/console-border/old/gbc-4x.glslp.cfg.error.log
./handheld/console-border/old/gbc-5x.glslp.cfg.error.log
./handheld/console-border/old/gbc-6x.glslp.cfg.error.log
./handheld/console-border/old/gg-2x.glslp.cfg.error.log
./handheld/console-border/old/gg-3x.glslp.cfg.error.log
./handheld/console-border/old/gg-4x.glslp.cfg.error.log
./handheld/console-border/old/gg-5x.glslp.cfg.error.log
./handheld/console-border/old/gg-6x.glslp.cfg.error.log
./handheld/console-border/old/ngpc-2x.glslp.cfg.error.log
./handheld/console-border/old/ngpc-3x.glslp.cfg.error.log
./handheld/console-border/old/ngpc-4x.glslp.cfg.error.log
./handheld/console-border/old/ngpc-5x.glslp.cfg.error.log
./handheld/console-border/old/ngpc-6x.glslp.cfg.error.log
./handheld/console-border/old/psp-2x.glslp.cfg.error.log
./handheld/console-border/old/psp-3x.glslp.cfg.error.log
./handheld/console-border/old/psp-4x.glslp.cfg.error.log
./handheld/console-border/old/psp-5x.glslp.cfg.error.log
./handheld/console-border/old/psp-6x.glslp.cfg.error.log
./handheld/console-border/psp-2x.glslp.cfg.error.log
./handheld/console-border/psp-3x.glslp.cfg.error.log
./handheld/console-border/psp-4x.glslp.cfg.error.log
./handheld/console-border/psp-5x.glslp.cfg.error.log
./handheld/console-border/psp-6x.glslp.cfg.error.log
./handheld/lcd-shader/backup/lcd-shader.glslp.cfg.error.log
./pal/pal.glslp.cfg.error.log
./sabr/sabr-hybrid-deposterize.glslp.cfg.error.log

Error logfiles here: shader error logs.zip In addition to this, all shaders are complaining about a missing #version declaration.

Please let me know if you need the full log files too.

hizzlekizzle commented 7 years ago

eyyy, that's awesome! I'm glad you were able to script it!

I think I got the console-borders, PAL and gdapt fixed. I think I know how to fix tvout-tweaks and GTU but I need to test on some other GPUs before I push it up.

lotharsm commented 7 years ago

Thanks for looking into this! Just ping me if it's time for another test run.

hizzlekizzle commented 7 years ago

@rootfather Care to give them another shot?

I'm not sure how even begin debugging the ones like ddt and crt-geom where they compile but don't look right. On mobile/GLES, I would look at the precision first, but I don't think that's a problem with desktop OpenGL...

lotharsm commented 7 years ago

@hizzlekizzle, seems that you fixed a lot of the shaders.

Shaders that still won't compile

./borders/gameboy-player/gameboy-player-crt-royale.glslp.cfg.error.log
./borders/sgb/sgb-crt-royale.glslp.cfg.error.log
./dithering/bayer-matrix-dithering.glslp.cfg.error.log
./dithering/gdapt.glslp.cfg.error.log
./handheld/console-border/old/dmg-2x-old.glslp.cfg.error.log
./handheld/console-border/old/dmg-3x.glslp.cfg.error.log
./handheld/console-border/old/dmg-4x.glslp.cfg.error.log
./handheld/console-border/old/dmg-5x.glslp.cfg.error.log
./handheld/console-border/old/dmg-6x.glslp.cfg.error.log
./handheld/console-border/old/gb-pocket-2x.glslp.cfg.error.log
./handheld/console-border/old/gb-pocket-3x.glslp.cfg.error.log
./handheld/console-border/old/gb-pocket-4x.glslp.cfg.error.log
./handheld/console-border/old/gb-pocket-5x.glslp.cfg.error.log
./handheld/console-border/old/gb-pocket-6x.glslp.cfg.error.log
./handheld/console-border/old/gba-2x.glslp.cfg.error.log
./handheld/console-border/old/gba-3x.glslp.cfg.error.log
./handheld/console-border/old/gba-4x.glslp.cfg.error.log
./handheld/console-border/old/gba-5x.glslp.cfg.error.log
./handheld/console-border/old/gba-6x.glslp.cfg.error.log
./handheld/console-border/old/gbc-2x.glslp.cfg.error.log
./handheld/console-border/old/gbc-3x.glslp.cfg.error.log
./handheld/console-border/old/gbc-4x.glslp.cfg.error.log
./handheld/console-border/old/gbc-5x.glslp.cfg.error.log
./handheld/console-border/old/gbc-6x.glslp.cfg.error.log
./handheld/console-border/old/gg-2x.glslp.cfg.error.log
./handheld/console-border/old/gg-3x.glslp.cfg.error.log
./handheld/console-border/old/gg-4x.glslp.cfg.error.log
./handheld/console-border/old/gg-5x.glslp.cfg.error.log
./handheld/console-border/old/gg-6x.glslp.cfg.error.log
./handheld/console-border/old/ngpc-2x.glslp.cfg.error.log
./handheld/console-border/old/ngpc-3x.glslp.cfg.error.log
./handheld/console-border/old/ngpc-4x.glslp.cfg.error.log
./handheld/console-border/old/ngpc-5x.glslp.cfg.error.log
./handheld/console-border/old/ngpc-6x.glslp.cfg.error.log
./handheld/console-border/old/psp-2x.glslp.cfg.error.log
./handheld/console-border/old/psp-3x.glslp.cfg.error.log
./handheld/console-border/old/psp-4x.glslp.cfg.error.log
./handheld/console-border/old/psp-5x.glslp.cfg.error.log
./handheld/console-border/old/psp-6x.glslp.cfg.error.log
./handheld/lcd-shader/backup/lcd-shader.glslp.cfg.error.log
./sabr/sabr-hybrid-deposterize.glslp.cfg.error.log

Log files shader error logs.zip

Regarding shaders that compile but look wrong - is it possible that they use features that require a minimal openGL version? If so, is it possible that the Intel compiler falls back to an openGL version that is too old if a #version declaration is missing?

orbea commented 5 years ago

@lotharsm Is this still an issue with the current master?

hizzlekizzle commented 5 years ago

they should be fine now.

orbea commented 5 years ago

Cool! I'll close this then, but if anyone still has an issue please let us know!