mirror of
https://github.com/RPCSX/SPIRV-Tools.git
synced 2024-12-12 13:45:48 +00:00
Change BuildModule() to accept pointer-size pair for binary.
This commit is contained in:
parent
2cbb2cce3e
commit
f8dbed0455
@ -44,16 +44,16 @@ spv_result_t SetSpvInst(void* builder, const spv_parsed_instruction_t* inst) {
|
||||
|
||||
std::unique_ptr<ir::Module> BuildModule(spv_target_env env,
|
||||
MessageConsumer consumer,
|
||||
const std::vector<uint32_t>& binary) {
|
||||
const uint32_t* binary,
|
||||
const size_t size) {
|
||||
auto context = spvContextCreate(env);
|
||||
SetContextMessageConsumer(context, consumer);
|
||||
|
||||
auto module = MakeUnique<ir::Module>();
|
||||
ir::IrLoader loader(context->consumer, module.get());
|
||||
|
||||
spv_result_t status =
|
||||
spvBinaryParse(context, &loader, binary.data(), binary.size(),
|
||||
SetSpvHeader, SetSpvInst, nullptr);
|
||||
spv_result_t status = spvBinaryParse(context, &loader, binary, size,
|
||||
SetSpvHeader, SetSpvInst, nullptr);
|
||||
loader.EndModule();
|
||||
|
||||
spvContextDestroy(context);
|
||||
@ -68,7 +68,7 @@ std::unique_ptr<ir::Module> BuildModule(spv_target_env env,
|
||||
t.SetMessageConsumer(consumer);
|
||||
std::vector<uint32_t> binary;
|
||||
if (!t.Assemble(text, &binary)) return nullptr;
|
||||
return BuildModule(env, consumer, binary);
|
||||
return BuildModule(env, consumer, binary.data(), binary.size());
|
||||
}
|
||||
|
||||
} // namespace spvtools
|
||||
|
@ -25,12 +25,13 @@
|
||||
|
||||
namespace spvtools {
|
||||
|
||||
// Builds and returns an ir::Module from the given SPIR-V |binary|. The |binary|
|
||||
// will be decoded according to the given target |env|. Returns nullptr if erors
|
||||
// occur and sends the errors to |consumer|.
|
||||
// Builds and returns an ir::Module from the given SPIR-V |binary|. |size|
|
||||
// specifies number of words in |binary|. The |binary| will be decoded
|
||||
// according to the given target |env|. Returns nullptr if erors occur and
|
||||
// sends the errors to |consumer|.
|
||||
std::unique_ptr<ir::Module> BuildModule(spv_target_env env,
|
||||
MessageConsumer consumer,
|
||||
const std::vector<uint32_t>& binary);
|
||||
const uint32_t* binary, size_t size);
|
||||
|
||||
// Builds and returns an ir::Module from the given SPIR-V assembly |text|.
|
||||
// The |text| will be encoded according to the given target |env|. Returns
|
||||
|
@ -140,8 +140,8 @@ int main(int argc, char** argv) {
|
||||
spvDiagnosticDestroy(diagnostic);
|
||||
spvContextDestroy(context);
|
||||
|
||||
std::unique_ptr<ir::Module> module =
|
||||
BuildModule(target_env, pass_manager.consumer(), source);
|
||||
std::unique_ptr<ir::Module> module = BuildModule(
|
||||
target_env, pass_manager.consumer(), source.data(), source.size());
|
||||
pass_manager.Run(module.get());
|
||||
|
||||
std::vector<uint32_t> target;
|
||||
|
Loading…
Reference in New Issue
Block a user