Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adaptive CRT shader compatibility fixes for really old GPUs #3172

Merged
merged 2 commits into from Dec 3, 2023

Conversation

johnnovak
Copy link
Member

@johnnovak johnnovak commented Dec 3, 2023

Description

Fixes #3114

@Burrito78 kindly gave me remote desktop access to his problematic old MacMini with an Intel HD 4000 iGPU that displays only a black screen when using any of the new adaptive CRT shaders. I was able to pinpoint the problem by the time-tested method of trial and error, also known as "just dicking around" in some circles 馃槑

The problem seems to be that there's just too much branching going on in one of the functions. GLSL is still a fairly high-level language at the end of the day, and the shader compilers try to do their best to optimise per-pixel branching away. This branching code is not a problem at all on more recent GPUs (7-8 years old), but on this ancient 10+ year old iGPU, the shader compiles without errors, but somehow, who knows how and why, it just displays a black screen at runtime... Commenting out some of the branches fixes it, so the solution I adopted is to comment every branch of the function out that is not used by the adaptive shaders. This is an attempt to pre-empt similar problems on other weird old GPUs.

For the record, the problem could not be reproduced on my $200 bottom-of-the-barrel mini laptop I bought in 2015 which also has an Intel iGPU, but a more recent model. So I have reason to believe the issue could only manifest on ancient 10+ year old GPUs...

Disclaimer

Yes, I know that it's absolutely horrible that I have 22 copies of the exact same (!) shader code, just with different settings... 馃ザ But we have no preset support, so this was the only practical way to release my set of shaders this year (and to do this before eXoDOS v6 is out, so our shader work can be included) using our current shader pipeline which is very barebones.

I have plans for how to make this a lot nicer in the future; most likely these 22 copies will be replaced by a single shader, and I'll just send it different settings at runtime when there's a "shader change" (which is really just a "preset change"). But that's for the future... 馃槃

Manual testing

Tested a few fixed shaders on Burrito's box to make sure I understood the problem.

Regression tested all fixed shaders on my M1 MacBook to make sure they still work.

Checklist

Please tick the items as you have addressed them. Don't remove items; leave the ones that are not applicable unchecked.

I have:

  • followed the project's contributing guidelines and code of conduct.
  • performed a self-review of my code.
  • commented on the particularly hard-to-understand areas of my code.
  • split my work into well-defined, bisectable commits, and I named my commits well.
  • applied the appropriate labels (bug, enhancement, refactoring, documentation, etc.)
  • checked that all my commits can be built.
  • confirmed that my code does not cause performance regressions (e.g., by running the Quake benchmark).
  • added unit tests where applicable to prove the correctness of my code and to avoid future regressions.
  • made corresponding changes to the documentation or the website according to the documentation guidelines.
  • locally verified my website or documentation changes.

@johnnovak johnnovak changed the title Jn/shader fixes Adaptive CRT shader compatibility fixes for really old GPUs Dec 3, 2023
@johnnovak johnnovak self-assigned this Dec 3, 2023
@johnnovak johnnovak added video Graphics and video related issues shaders Issues related to shaders bug Something isn't working labels Dec 3, 2023
@johnnovak johnnovak marked this pull request as ready for review December 3, 2023 12:12
Copy link
Collaborator

@Burrito78 Burrito78 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works in windowed and fullscreen with various resolutions. Thanks!

@Grounded0
Copy link
Collaborator

Grounded0 commented Dec 3, 2023

Check at least a few modified shaders for performance regressions.

@Burrito78
Copy link
Collaborator

Burrito78 commented Dec 3, 2023

Check at least a few popular shaders for performance regressions.
I checked QTD with crt-auto, sharp and none using default cfg and got got around 137-140fps which is the highest result you're going to get on that machine. So I think we are fine.

Did check "sharp", "crt-auto" and "none" and got around 140fps which is the highest score you'll get on this machine.

@FeralChild64
Copy link
Collaborator

Tested on my Intel ARC, no problems found.

@kcgen
Copy link
Member

kcgen commented Dec 3, 2023

Tested CGA, Tandy, EGA, VGA (various), and VESA modes on the Pi4 (Broadcom OpenGL 4.x compatible) and found no problems.

@johnnovak
Copy link
Member Author

Check at least a few modified shaders for performance regressions.

Not possible to introduce any by commenting unused stuff out.

@johnnovak
Copy link
Member Author

Thanks for the testing guys. Can someone approve this then please @kcgen @Burrito78 @FeralChild64

Having two many branches result in a black screen (but no compilation
errors) on some older GPUs such as the Intel HD 4000 iGPU. So we're
commenting out the branches that are not used by the adaptive CRT
shaders.
@johnnovak johnnovak merged commit 98b2950 into main Dec 3, 2023
50 checks passed
@kcgen kcgen deleted the jn/shader-fixes branch December 4, 2023 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working shaders Issues related to shaders video Graphics and video related issues
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Black screen with new adaptive CRT shaders on Intel HD 4000 iGPU on macOS
5 participants