floooh / sokol-tools

Command line tools for use with sokol headers
MIT License
231 stars 58 forks source link

sokol-shdc TODO #8

Open floooh opened 5 years ago

floooh commented 5 years ago
mattiasljungstrom commented 5 years ago

What if on error you compile the shader again with all optimizations turned off to get the line nrs?

floooh commented 5 years ago

Good idea!

eugeneko commented 5 years ago

Is it possible to publish sokol-shdc as library? It's useful tool, but I don't want to have process interop unless necessary. So I'd like to statically link against sokol-shdc and have some basic interface that will let me use it without unnecessary I/O (e.g. if I don't want to save compiled shader).

floooh commented 5 years ago

It's possible (main.c would need to be replaced with a sokol_shdc.h/.c, which implements a small API to pass options but otherwise looks much like main.c).

But I think the required dependencies would make this tricky / pretty big (the stuff in here would need to be linked in basically: https://github.com/floooh/sokol-tools/tree/master/ext).

Also the bytecode-compilation for D3D11 and especially Metal should be removed, this is better done via sokol_gfx.h then (especially because compiling Metal bytecode involves running the metal-compiler command line tool as external process).

eugeneko commented 5 years ago

I'm mostly interested in pure GLSL->HLSL, GLSL, Metal conversion and maybe shader optimization. This is the most re-usable and generic part of this tool. May you give me a hint what files in shdc are responsible for this logic?

floooh commented 5 years ago

Here's a quick explanation what each source file is responsible for:

You can read the main() function in main.cc from top to bottom to see the sequence of actions.