Using includes, you can then put the actual workload functions in other hlsl/glsl files. This takes some extra effort, as you have to specify the entry point when you compile, but it’s doable, and worth the one-time effort, if you ask me.
-
-
Näytä tämä ketjuKiitos. Käytämme tätä aikajanasi parantamiseen. KumoaKumoa
-
-
-
I structure them together through a technique system which puts them together into one monolithic program (I don't mix and match shaders, contrary to what many people do. Separable programs force shader recompiles in GL). However, API wise they're seen as separate string sources
-
Code duplication is reduced through a module system. It's all copy-paste strings at the end of the day though. You can see an example of this here (in addition to the permutation system).https://gist.github.com/graphitemaster/2b43bffc83e60346698b82e6a5b50966 …
Keskustelun loppu
Uusi keskustelu -
-
-
This is how Unity’s Shader Lab shader’s are generally structured. I think it helps with user “grok-ability.”
Kiitos. Käytämme tätä aikajanasi parantamiseen. KumoaKumoa
-
-
-
I *had* been doing this forever, but I've noticed that more and more, I'm decoupling geometry from shading and don't recommend this practice anymore. Especially as mesh-shaders come in, I think the two phases are separable and should be "mix-and-matched" more easily
-
To the point about shared data/ubos, I instead use common headers that define data structures/helpers that are included from compatible vertex/mesh and pixel shaders
- Näytä vastaukset
Uusi keskustelu -
-
-
I tend to prefer sperated files with a *.vert/frag extension, just because it makes the tooling simpler. glslang recognizes this and you can just call every entry point "main".
Kiitos. Käytämme tätä aikajanasi parantamiseen. KumoaKumoa
-
Lataaminen näyttää kestävän hetken.
Twitter saattaa olla ruuhkautunut tai ongelma on muuten hetkellinen. Yritä uudelleen tai käy Twitterin tilasivulla saadaksesi lisätietoja.