Closed stevenswart closed 1 year ago
Many of these presets have issues with the compute shaders. MilkDrop uses HLSL in the presets, while projectM uses OpenGL, which has a different shading language (GLSL). projectM has a converter built in to translate the programs, but there might still be some specific constructs that aren't converted correctly. The hlslparser project hasn't seen any updates in the last 7 years, so unless someone bothers to dig into it, the situation will not improve.
At some point in the future, projectM might use Vulkan for rendering which now natively supports compiling HLSL shaders to SPIR-V, but there's currently no work done or planned to implement this.
Some time has passed since my last comment, and I recently reworked the multithreading code in libprojectM. Here's what I can tell about the state of loading presets asynchronously:
So, to properly fix these freezes, all work that needs to be done before a preset can be displayed should happen in the loader thread, which can take multiple frames for presets with large textures and complex shaders. Here's what needs to be done:
Why do we need a new OpenGL context to compile the shaders? Can we not create a new glProgram in the same context?
From what I understand: An OpenGL context is tied to a single thread, so if you want to run OpenGL functions in a separate thread, you need a different context, as the context is keeping the current state machine - shader compilation could interfere with what the driver does in the other thread, e.g. rendering things or uploading data to the GPU. Most resources can be shared between contexts. So to compile a shader asynchronously, is needs to be done in both a separate thread and context.
Over two years have passed since this issue was opened, and in the meantime most of the projectM internals were rewritten. I've not seen any crashes or freezes in the past year or so, and no new issues in that regard were posted. Will close this as fixed then.
20th of March 2021
This issue is probably not a duplicate of:
https://github.com/projectM-visualizer/projectm/issues/408
I see that bug has been closed some time ago. However, I am still experiencing freezes with certain presets, so it seems that the fix didn’t completely solve the problem with all presets.
My habit had been to move all problem presets out of my preset directory, and into a subdirectory. After I saw that issue 408 had been marked fixed, and still noticed the freezes, I watched my updates and every time the ProjectM library was updated, I would create a new subdirectory. I am on OpenSUSE Tumbleweed.
As of today, the versions I have installed are:
Please see attached zip file Freezes.4.zip.
On my Tumbleweed system, the creation dates I have for the subdirectories are as follows:
freezes Sunday, November 1, 2020 10:19:06 PM SAST new Monday, February 22, 2021 11:15:20 PM SAST newer Sunday, February 28, 2021 12:00:46 PM SAST newest Thursday, March 4, 2021 12:31:15 PM SAST newest2 Tuesday, March 9, 2021 11:51:11 AM SAST
I am still regularly getting crashes and freezes, so it seems that I haven’t removed all of the problem presets yet.
Complete list of freezing presets follows – note that some of these may no longer cause the problem because of the fix to issue 408.
Freezes.4.zip