Updated command-line options, adding -o for saving binaries, -G for OpenGL SPIR-V validation, -v etc.
Old uses should still work as they did before. Also encapsulated use of these flags during parsing, for the parse context. Added SPIR-V version to -v.
This commit is contained in:
parent
b329715caf
commit
68d78fd31e
11 changed files with 159 additions and 97 deletions
|
|
@ -2543,13 +2543,18 @@ spv::Id TGlslangToSpvTraverser::createSpvConstant(const glslang::TType& glslangT
|
|||
|
||||
namespace glslang {
|
||||
|
||||
void GetSpirvVersion(std::string& version)
|
||||
{
|
||||
char buf[10];
|
||||
snprintf(buf, "0.%d", spv::Version);
|
||||
version = buf;
|
||||
}
|
||||
|
||||
// Write SPIR-V out to a binary file
|
||||
void OutputSpv(const std::vector<unsigned int>& spirv, const char* baseName)
|
||||
{
|
||||
std::ofstream out;
|
||||
std::string fileName(baseName);
|
||||
fileName.append(".spv");
|
||||
out.open(fileName.c_str(), std::ios::binary | std::ios::out);
|
||||
out.open(baseName, std::ios::binary | std::ios::out);
|
||||
for (int i = 0; i < (int)spirv.size(); ++i) {
|
||||
unsigned int word = spirv[i];
|
||||
out.write((const char*)&word, 4);
|
||||
|
|
|
|||
|
|
@ -36,6 +36,7 @@
|
|||
|
||||
namespace glslang {
|
||||
|
||||
void GetSpirvVersion(std::string&);
|
||||
void GlslangToSpv(const glslang::TIntermediate& intermediate, std::vector<unsigned int>& spirv);
|
||||
void OutputSpv(const std::vector<unsigned int>& spirv, const char* baseName);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue