I was able to solve the problem with the compute shader version you gave me below.
I was able to get it to work by using the fork you gave me!
Thank you very much.
In the official MonoGame version, the presence of “constants used only by pixel shaders” resulted in an error at runtime.
This problem was solved by using the Compute Shader version.
Note that the compute shader version also had some limitations, such as not being able to use arrays, so some tweaking was necessary.
# Migrating Shaders from MojoShader to ShaderConductor
This only applies to OpenGL platforms.<br>
You don't necessarily have to migrate existing shaders, as MojoShader is still included. If all shaders in a file are shader model 2 or 3 MojoShader will automatically be used for shader compilation. This should ensure full backwards compatibility for existing projects.
You can mix MojoShader and ShaderConductor shaders in the same project, only ShaderConductor can handle shader model 4 or 5 though.
<br>
The moment a single shader in the file is set to shader model 4 or higher, the entire file will be compiled through ShaderConductor. So if you mix SM 3 and SM 4 shaders in the same file, even the SM 3 shaders will be compiled through ShaderConductor. It is recommended to switch all shaders in the file to SM 4 or higher simultaneously, because SM 2 and 3 support is not that great with ShaderConductor (see SM 2 and 3 limitations below).
<br>
ShaderConductor compilation does not require Wine on Linux or Mac, so forcing ShaderConductor compilation for pure SM 2 and 3 files can still be useful.
You can force ShaderConductor compilation by adding the <b>CONDUCTOR</b> define to the effect processor by:
- using the MGCB editor UI: Effect Properties -> Processor Parameters -> Defines
- adding <b>/processorParam:Defines=MOJO</b> to the mgcb file in the corresponding effect block
- adding the <b>/Defines:MOJO</b> argument when calling MGFXC directly via command line
<br>
In order to compile using ShaderConductor the following modifications to the HLSL source are neccessary, mainly because the new HLSL compiler from Microsoft (DXC) does not support the old DX9-style syntax anymore.
This file has been truncated. show original
Note that the problem has been resolved for Windows and DesktopGL, but is still trial and error for Android (OpenGL ES).