mellinoe / veldrid-samples

Sample projects for Veldrid
https://mellinoe.github.io/veldrid-docs/
121 stars 49 forks source link

Convert samples to SPIR-V #9

Closed tzachshabtay closed 5 years ago

tzachshabtay commented 5 years ago

The samples are currently using ShaderGen, but from what I understand you're now recommending using SPIR-V instead, right? It would help a lot if the samples were also using SPIR-V instead of (or in addition to?) ShaderGen.

mellinoe commented 5 years ago

I have been planning to do this for a while, and I do have a branch with the conversion started. One of the blockers was that Veldrid.SPIRV didn’t support Android and iOS, but I have added that recently. Now I just need to spend some time to convert the shaders.

xposure commented 5 years ago

Could I ask why SPRIV over ShaderGen? I really like the concept of ShaderGen and would love to see something like that main stream.

mellinoe commented 5 years ago

@xposure There's a few main reasons I've moved away from it.

  1. ShaderGen is difficult for me to maintain along with everything else that keeps Veldrid moving. I would love if it were an equally viable option for folks to use (although I'd likely still use SPIR-V), but the nature of the project (a cross-compiler based on AST manipulation) makes it hard to get the quality high enough IMO.
  2. SPIR-V is becoming a defacto standard for shaders, so there's a ton of tooling and resources out there already, without me putting in any extra effort. shaderc and SPIRV-Cross are actively developed and get support for new features often, so just keeping them up to date brings benefits in.
  3. Long-term, I think a better pipeline would be C# -> SPIR-V (through something like ShaderGen), and then SPIR-V -> (through SPIRV-Cross). SPIR-V is intended as a compilation target, so there would likely be less weird syntactic mismatches that ShaderGen deals with when compiling directly to another source language.

FWIW, this issue is actually already complete; the samples are using Veldrid.SPIRV.