projectM-visualizer / projectM-visualizer/projectm

[FEATURE] Try out libniceshade as a replacement for hlslparser

Open
#761 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C++
Stars
4.5k
Forks
485
Avg merge
3d 7h
Merged PRs (30d)
5

Description

Currently, libprojectM uses the "hlslparser" library from the game Natural Selection 2 to convert the HLSL warp and composite shader code in presets to GLSL. While this parser works well in most cases, it has not been maintained for ten years now, and thus doesn't support any modern versions of both HLSL and GLSL, which currently limits us to PS 2.0 and GLSL 3.30 syntax.

There is a recent and still-maintained library called libniceshade, which is a convenience wrapper around Microsoft DirectXShaderCompiler and SPIRV-Cross. This library supports converting shaders for use in modern 3D APIs, including OpenGL 4.3, Vulkan and Metal, and also supports modern HLSL versions as well.

We should try to integrate this library into libprojectM and use it instead of hlslparser in the MilkdropShader class. Switching to this library would also mean that we have to increase the required OpenGL version to 4.3 on desktop platforms and change the shader language verions and syntax of our built-in shaders accordingly. Mobile/embedded builds can still use OpenGL ES 3.1.

This library also requires C++17, which will make libprojectM incompatible with older systems, e.g. macOS 10.15 and earlier and some old Linux distros. At the time we will potentially release this change, these operating system versions will most probably no longer be relevant.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the MilkdropShader class and inspect how hlslparser currently converts preset shaders. Evaluate integrating libniceshade, then review the built-in shaders and platform requirements for OpenGL 4.3, OpenGL ES 3.1, and C++17. Done means the replacement works, built-in shader syntax is updated, and desktop and mobile/embedded requirements are preserved.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.