-
Notifications
You must be signed in to change notification settings - Fork 343
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for compiling to C/C++ header #214
Comments
Shaderc follows closely the glslang design here, and glslang only has functions to compile into a |
True, but emitting a C header is essentially just a different way of dumping the u32 vector to disk, so it shouldn't affect glslang at all. It is standalone enough that this could even be a separate binary. |
Sorry, I thought you were proposing a libshaderc interface extension. But it sounds like you just want to take the |
I was thinking about adding some flags to glslc to dump out a header instead of raw .spv. |
@Themaister: makes sense. We'll come up with a suitable flag name and implement. |
I think we should mimic GCC's -masm=dialect option. So you'd use -S to emit assembly and -masm=c to say you want C source. One difficulty is in saying what variable name you want for the result. You might want to do this with several binaries.
And you'd put that into a "binary.inc"
The point is that all the decisions about integrating it into the rest of your program are left to you, rather than adding lots of config parameters to glslc. In this case I'd be tempted to use -masm=c-init-list as the option. |
That's a solid solution. It is indeed nice to avoid having to specify the array name on CLI, and it's also nice to avoid having to specify static/constness of the array in question. It can also be used as an initializer list in C++11 that way too. |
#218 is landed. Closing. |
Works great. Thanks :) |
I know there was some churn on which version of this shader was correct - but right now, this goes from broken on all 4 backends to working on all 4 backends. So this seems better. The old code (accidentally?) uses descriptor arrays (I think), which are not trivial to support on all backends, so we won't use them for now.
For many applications, it would be very convenient to be able to compile GLSL directly to a SPIR-V encoded as a static const uint32_t[].
In smaller projects, and especially for embedded/mobile, it is very useful to bake the SPIR-V shaders directly into the binary.
The text was updated successfully, but these errors were encountered: