const std::string decoded_string = decoded_text->str;
spvTextDestroy(decoded_text);
- return decoded_string;
+ // Remove the preamble comments generated by disassembler.
+ const std::string schema0 = "Schema: 0\n";
+ std::string::size_type preamble_end = decoded_string.find(schema0);
+ return decoded_string.substr(preamble_end + schema0.size());
}
// Compiles SPIR-V text, asserts success, and returns the words representing
TEST_F(TextToBinaryTest, DISABLED_LiteralStringTooLong) {
const std::string code =
"OpSourceExtension \"" + std::string(65534, 'o') + "\"\n";
- const std::string header =
- "; SPIR-V\n; Version: 99\n; Generator: Khronos\n; "
- "Bound: 1\n; Schema: 0\n";
- EXPECT_EQ(header + code, EncodeAndDecodeSuccessfully(code));
+ EXPECT_EQ(code, EncodeAndDecodeSuccessfully(code));
}
} // anonymous namespace
ASSERT_EQ(SPV_SUCCESS, spvOperandTableGet(&operandTable));
uint32_t value;
- EXPECT_NE(SPV_SUCCESS, spvTextParseMaskOperand(operandTable,
- SPV_OPERAND_TYPE_FP_FAST_MATH_MODE,
- GetParam(), &value));
+ EXPECT_NE(SPV_SUCCESS, spvTextParseMaskOperand(
+ operandTable, SPV_OPERAND_TYPE_FP_FAST_MATH_MODE,
+ GetParam(), &value));
}
INSTANTIATE_TEST_CASE_P(ParseMask, BadFPFastMathMaskParseTest,
// little endian for encoding comparison!
spv_endianness_t endian = SPV_ENDIANNESS_LITTLE;
- const char *textStr = R"(
+ const char* textStr = R"(
OpSource OpenCL 12
OpMemoryModel Physical64 OpenCL
OpSourceExtension "PlaceholderExtensionName"
const std::string assembly = "%1 = OpTypeFloat 32\n%2 = OpConstant %1 ";
const std::string input_string = assembly + GetParam().first;
const std::string expected_string =
- "; SPIR-V\n; Version: 99\n; Generator: Khronos\n; "
- "Bound: 3\n; Schema: 0\n" +
assembly + std::to_string(GetParam().second) + "\n";
const std::string decoded_string = EncodeAndDecodeSuccessfully(input_string);
EXPECT_EQ(expected_string, decoded_string);