spvtools::SpirvTools tools(SPV_ENV_VULKAN_1_0);
std::string errors; auto msgFn = [&errors](spv_message_level_t, constchar*, const spv_position_t&, constchar* m) {
errors += "SPIR-V validation error: ";
errors += m;
errors += '\n';
};
tools.SetMessageConsumer(msgFn);
bool result = tools.Validate(programData, programSize); if (result) { returntrue;
} // If disassemble is set, we won't abort but instead append the errors. This allows // us to keep going and show all the errors, which is used by skslc to make sure // expected validation errors fail as expected.. if (disassemble) { // Send the message, plus the entire disassembled SPIR-V (for easier context & debugging) // as if were an SkSL compile error message.
std::string disassembly;
uint32_t options = spvtools::SpirvTools::kDefaultDisassembleOption;
options |= SPV_BINARY_TO_TEXT_OPTION_INDENT; if (tools.Disassemble(programData, programSize, &disassembly, options)) {
errors.append(disassembly);
}
reporter.error(Position(), errors);
} else { // Normal validation mode - abort() in a debug build with an error message.
SkDEBUGFAILF("%s", errors.c_str());
} returnfalse;
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.