Comments (9)
I think we should mimic GCC's -masm=dialect option.
https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html#index-masm_003d_0040var_007bdialect_007d-2832
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.
So how about we just emit a brace-initialization list of values, and it's up to you to wrap the result.
eg. the output could be
{ 0x07230203, 0x00010000, 0x00080000, 1, 0 }
And you'd put that into a "binary.inc"
Then in your C code (or C++ code) you'd say
static uint32_t empty_binary[] =
#include "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.
from shaderc.
Shaderc follows closely the glslang design here, and glslang only has functions to compile into a vector<unsigned int>
for now.
from shaderc.
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.
from shaderc.
Sorry, I thought you were proposing a libshaderc interface extension. But it sounds like you just want to take the spv_binary
and print its elements into a .h
file? That's doable in ~4 lines of code, I think. Or are you proposing that we add a flag to glslc to do it automatically?
from shaderc.
I was thinking about adding some flags to glslc to dump out a header instead of raw .spv.
Again, trivial to do, but it's very convenient.
from shaderc.
@Themaister: makes sense. We'll come up with a suitable flag name and implement.
from shaderc.
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.
from shaderc.
#218 is landed. Closing.
from shaderc.
Works great. Thanks :)
from shaderc.
Related Issues (20)
- Shader stage does matter for preprocessing
- Ninja Multi-Config generator fails - Evaluation file to be written multiple times with different content HOT 1
- Including shaderc/CMakeLists.txt as suggested in README not working HOT 4
- Linking error against spirv-tools
- Proper handling of namespace in HLSL
- Is glsl 330 actually supported ?
- Gmock not found HOT 4
- FRP this Android
- No support for source level debug info?
- SPIR_V: Generate nonsemantic shader debug information (with source) HOT 1
- shaderc not found while compiling FFMPEG HOT 1
- tests fail with updated Glslang: TestDashCapOWithDashG fails due to debug output change HOT 2
- enable Glslang tests when Shaderc tests are enabled HOT 1
- "NVVM compilation failed: 3" with mesh shaders
- Build faild when I set BUILD_SHARED_LIBS ON, Windows 10 HOT 1
- RFE: is it possible to start making github releases?🤔 HOT 3
- Optimization issue when specifying --target-env
- [Documentation] gmock appears to be necessary for shaderc HOT 1
- Always say error when wnt instal shaderc with ninja or msvc same
- Compilation succeed with CLI but unexpected INTCONSTANT with C API HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from shaderc.