Added a Compiler ctor that takes IR as raw array and count

This avoids the need to construct a temporary std::vector on the application side just to create a Compiler instance if application itself doesn't use STL containers.
This commit is contained in:
Yuriy O'Donnell 2017-04-01 12:31:34 +02:00
parent af75c7585a
commit ae8de51138
2 changed files with 7 additions and 0 deletions

View File

@ -70,6 +70,12 @@ Compiler::Compiler(vector<uint32_t> ir)
parse(); parse();
} }
Compiler::Compiler(const uint32_t *ir, size_t word_count)
: spirv(ir, ir + word_count)
{
parse();
}
string Compiler::compile() string Compiler::compile()
{ {
// Force a classic "C" locale, reverts when function returns // Force a classic "C" locale, reverts when function returns

View File

@ -106,6 +106,7 @@ public:
// The constructor takes a buffer of SPIR-V words and parses it. // The constructor takes a buffer of SPIR-V words and parses it.
Compiler(std::vector<uint32_t> ir); Compiler(std::vector<uint32_t> ir);
Compiler(const uint32_t *ir, size_t word_count);
virtual ~Compiler() = default; virtual ~Compiler() = default;