-
-
Notifications
You must be signed in to change notification settings - Fork 375
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backport GLSL shaders to version 1.2 to support older hardware. #399
Conversation
Yo, this is terrific! Thanks! I think older Pis may have issues anyway due to CPU limitations (mine certainly did running without shaders) If this means we can require a lower minimum GL version this should be updated - https://github.com/projectM-visualizer/projectm/blob/master/src/projectM-sdl/projectM_SDL_main.cpp#L307 If there's any way to keep our modified hlslparser in sync with upstream that would be super cool https://github.com/Thekla/hlslparser/tree/master/src |
CPU limitations are definitely an issue. I'm using the Pi to run an addressable LED array with ~3000 pixels, so much smaller raster and grid size is OK, plus I'm curating presets that run smoothly. I mentioned in #168 that async would help with this. Another potential plus would be supporting vectorization on ARM (I see that only SSE intrinsics are used for acceleration currently). One way to do this scalably would be to rewrite the fixed-function parts of the per-frame and per-vertex equations in Halide. |
Re: keeping things in sync with upstream; any reason this project is not making use of submodules and/or a build system with imports? I used Bazel for my fork and that also allowed me to support cross-compilation (compiling projectM from source every time on the Pi itself is absolutely miserable). |
Async would help. |
Upgrading build system is fine, though it may make downstream projects 😞 |
Tested on macOS Catalina:
Perhaps we need to be able to run different versions of the shader code depending on the GL version? |
Maybe we could query the available GL version using glGetString and then select a variant of the shaders that way? If we go that route, I would propose taking the shader code out of string literals and instead either load them in at runtime or compile them in as binary resources. |
Yeah makes sense |
I ran a small test program on both my RPi 3A and my Razer Blade 14" 2017:
Razer Blade: Raspberry Pi: Looking at this table, I can map the version number to a GLSL version. I'm thinking as a first pass that we can select the GLSL1.2 code for GL version <= 3.2, and the original GLSL3.3 code for GL version >= 3.3.0. |
Added another commit to the PR which refactors the shaders out into a separate manager. The manager queries the supported GLSL version and picks either the original GLSL3.3 shaders or the backported GLSL1.2 shaders depending on the result of the query. |
I also opened #402 |
It looks like the builds are failing because the new sources are not included in the project manifests for the XCode and Visual Studio builds. Does someone else have the time to add them? |
I'll do the visual studio bits tonight. |
What remains to be done to get this merged? @milkdropper do you have a fixed VS project file? Also I think the XCode project file needs to be updated--I don't have a Mac, so I can't do it. |
I'll give it another shot with msvc. I actually had problems last time I tried, but will take a look with a fresh set of eyes. |
Nice! Thanks for the assist! |
This PR backports the GLSL hardcoded shaders in ShaderEngine.cpp to GLSL1.2 and also adds another target version to hlslparser to export GLSL1.2. These changes enable running ProjectM on hardware which supports only older GLSL versions, such as the VideoCore IV GL implementation used by the Raspberry Pi (versions <=3).