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

Shaders using GLSL not Cg/HLSL #26

Merged
merged 105 commits into from Sep 8, 2018

Conversation

Projects
None yet
3 participants
@revmischa
Collaborator

revmischa commented Feb 2, 2018

Trying to get rid of super ancient unsupported nVidia Cg framework and use standard GL shaders.
The shaders in preset files are written in HLSL for DirectX. projectM used a toolkit from nVidia called Cg to handle them, but Cg is long deprecated and obsolete.
I'm attempting to use https://github.com/Thekla/hlslparser to transpile from HLSL to GLSL on the fly, and it's close to working but has some syntax issues.

The main conversion is done in:
https://github.com/projectM-visualizer/projectm/pull/26/files#diff-6df95f02d59c83baf42ed81c8668722a
https://github.com/projectM-visualizer/projectm/pull/26/files#diff-f4b5c1904e3d8fa6c1248fe1ac843d79

This may be close to working but it has issues right now. Needs work.

@revmischa revmischa self-assigned this Feb 2, 2018

@axe312ger

This comment has been minimized.

Contributor

axe312ger commented Feb 27, 2018

Awesome! Will this boost the visual quality, too? Or is it just refactoring to get rid of legacy code?

@revmischa

This comment has been minimized.

Collaborator

revmischa commented Feb 27, 2018

If we can get the shaders to work it will greatly increase the quality. However the shaders are written in DirectX/Cg style and may need some converting to GLSL style. I dunno anything about doing that so someone else needs to help.

@axe312ger

This comment has been minimized.

Contributor

axe312ger commented Feb 27, 2018

Maybe twitter can help? I tweeted about it here: https://twitter.com/axe312ger/status/968429518095634432

@revmischa

This comment has been minimized.

Collaborator

revmischa commented Feb 27, 2018

I'll put up a status update on where things are at in the next few weeks.. stay tuned

@revmischa

This comment has been minimized.

Collaborator

revmischa commented Feb 27, 2018

I'm not working on anything right now for projectM (busy with $dayjob), but I'm happy to provide guidance to anyone who wants to contribute

@axe312ger

This comment has been minimized.

Contributor

axe312ger commented Feb 28, 2018

@revmischa

This comment has been minimized.

Collaborator

revmischa commented Feb 28, 2018

Very cool! Feel free to give it a try. The shader code is shoved inside the preset files in a funky format though so you'd have to parse it out, convert it, and reinsert it

@revmischa revmischa referenced this pull request Apr 8, 2018

Closed

Optimization Projects #51

Merge branch 'master' into glsl
Merge master + work on HLSL->GLSL transpilation
@revmischa

This comment has been minimized.

Collaborator

revmischa commented May 27, 2018

I'm giving https://github.com/Thekla/hlslparser a try - it should transpile from HLSL to GLSL. I've got it hooked up, now work needs to be done on passing in the variables and texture samplers from projectM into the shaders. Then maybe shaders will work!

revmischa added some commits May 27, 2018

@revmischa

This comment has been minimized.

Collaborator

revmischa commented May 28, 2018

Some syntax issues and GL versioning issues but it's close! I think!

@revmischa revmischa changed the title from Shaders using GLSL not Cg to Shaders using GLSL not Cg/HLSL May 28, 2018

@deltaoscarmike

This comment has been minimized.

Collaborator

deltaoscarmike commented Aug 22, 2018

Status:

  • All presets with a warp and/or composite shader are successfully compiled in GLSL
  • Nativepresets are working again
  • screens "borders" are fixed

To do: fix rendering differences against winamp/milkdrop. Some presets are correctly rendered but other have visual issues.

loadTextureDir();
loadTextureDir(std::string(DATADIR_PATH) + "/presets");
loadTextureDir(std::string(DATADIR_PATH) + "/textures");

This comment has been minimized.

@revmischa

revmischa Aug 22, 2018

Collaborator

does this exist?

@revmischa

This comment has been minimized.

Collaborator

revmischa commented Aug 22, 2018

Bravo! Good stuff 👍
You think you're gonna submit the hlslparser fixes back?

@revmischa

This comment has been minimized.

Collaborator

revmischa commented Aug 22, 2018

Got a crash:

libc++abi.dylib: Pure virtual function called!
Process 76589 stopped
* thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
    frame #0: 0x00007fff5ba5bb66 libsystem_kernel.dylib`__pthread_kill + 10
libsystem_kernel.dylib`__pthread_kill:
->  0x7fff5ba5bb66 <+10>: jae    0x7fff5ba5bb70            ; <+20>
    0x7fff5ba5bb68 <+12>: movq   %rax, %rdi
    0x7fff5ba5bb6b <+15>: jmp    0x7fff5ba52ae9            ; cerror_nocancel
    0x7fff5ba5bb70 <+20>: retq   
Target 0: (projectMSDL) stopped.
@revmischa

This comment has been minimized.

Collaborator

revmischa commented Aug 22, 2018

doesn't crash if i disable threading

@deltaoscarmike

This comment has been minimized.

Collaborator

deltaoscarmike commented Aug 23, 2018

You think you're gonna submit the hlslparser fixes back?

No, my modifications have many impacts on Metal and HLSL generators and it's a lot of work to make sure these will still generate valid code.

Got a crash:

Could you provide a more explicit backtrace callstack (with files and line number) ?

deltaoscarmike and others added some commits Aug 23, 2018

Fix unlock FPS flag
Add comments for test flags
@revmischa

This comment has been minimized.

Collaborator

revmischa commented Sep 2, 2018

Anything left to do @deltaoscarmike? Is it good to go? Can I help with anything?

@revmischa

This comment has been minimized.

Collaborator

revmischa commented Sep 7, 2018

@deltaoscarmike merge y/n?

@deltaoscarmike

This comment has been minimized.

Collaborator

deltaoscarmike commented Sep 8, 2018

Yes

@revmischa revmischa merged commit 6240b9d into master Sep 8, 2018

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment