I am trying to strip all of the build functionality of ShaderGen into a source generator that can produce SPIR-V byte code at compile time for a ShaderGen shader.
I have created this small project to test if I can get the backend code to generate: https://github.com/ScottKane/ShaderGenTest
For some reason the following code doesn't produce any shader sets:
var hlsl = new HlslBackend(compilation);
var glsl330 = new Glsl330Backend(compilation);
var glsles300 = new GlslEs300Backend(compilation);
var glsl450 = new Glsl450Backend(compilation);
var metal = new MetalBackend(compilation);
var languages = new LanguageBackend[]
{
hlsl,
glsl330,
glsles300,
glsl450,
metal,
};
var generator = new ShaderGen.ShaderGenerator(compilation, languages);
var result = generator.GenerateShaders();
foreach (var language in languages)
{
var extension = BackendExtension(language);
var sets = result.GetOutput(language);
foreach (var set in sets)
{
var name = set.Name;
if (set.VertexShaderCode != null)
{
name = name + "-vertex." + extension;
c.AddSource(name, ToCommented(set.VertexShaderCode));
}
if (set.FragmentShaderCode != null)
{
name = name + "-fragment." + extension;
c.AddSource(name, ToCommented(set.FragmentShaderCode));
}
if (set.ComputeShaderCode != null)
{
name = name + "-compute." + extension;
c.AddSource(name, ToCommented(set.ComputeShaderCode));
}
}
}
@mellinoe If you have any capacity to take a quick look, any help would be greatly appreciated. The DebugRoslynComponent run profile should allow you to debug the generator to see what's going on if you run it from Visual Studio (Rider doesn't support debugging roslyn components yet).
I think if I can get this working as a generator it could breathe new life into the project.
Thanks
I am trying to strip all of the build functionality of
ShaderGeninto a source generator that can produceSPIR-Vbyte code at compile time for aShaderGenshader.I have created this small project to test if I can get the backend code to generate: https://github.com/ScottKane/ShaderGenTest
For some reason the following code doesn't produce any shader sets:
@mellinoe If you have any capacity to take a quick look, any help would be greatly appreciated. The
DebugRoslynComponentrun profile should allow you to debug the generator to see what's going on if you run it from Visual Studio (Rider doesn't support debugging roslyn components yet).I think if I can get this working as a generator it could breathe new life into the project.
Thanks