<< "'.";
return SPV_ERROR_INVALID_BINARY);
- stream.get() << "Op" << opcodeEntry->name;
+ std::stringstream no_result_id_strstream;
+ out_stream no_result_id_stream(no_result_id_strstream);
+ const int16_t result_id_index = spvOpcodeResultIdIndex(opcodeEntry);
+ no_result_id_stream.get() << "Op" << opcodeEntry->name;
position->index++;
const uint32_t word = spvFixWord(pInst->words[index], endian);
const uint64_t currentPosIndex = position->index;
- stream.get() << " ";
+ if (result_id_index != index - 1) no_result_id_strstream << " ";
spv_operand_type_t type = spvBinaryOperandInfo(word, index, opcodeEntry,
operandTable, &operandEntry);
spvCheck(spvBinaryDecodeOperand(
opcodeEntry->opcode, type, pInst->words + index, endian,
options, operandTable, extInstTable, &pInst->extInstType,
- stream, position, pDiagnostic),
+ (result_id_index == index - 1 ? stream : no_result_id_stream),
+ position, pDiagnostic),
return SPV_ERROR_INVALID_BINARY);
+ if (result_id_index == index - 1) stream.get() << " = ";
index += (uint16_t)(position->index - currentPosIndex - 1);
}
+ stream.get() << no_result_id_strstream.str();
+
return SPV_SUCCESS;
}
ASSERT_EQ(SPV_SUCCESS, spvOperandTableGet(&operandTable));
ASSERT_EQ(SPV_SUCCESS, spvExtInstTableGet(&extInstTable));
- const char *textStr = R"(
+ const char* textStr = R"(
OpSource OpenCL 12
OpMemoryModel Physical64 OpenCL
OpSourceExtension "PlaceholderExtensionName"
ASSERT_EQ(SPV_SUCCESS, spvExtInstTableGet(&extInstTable));
const std::string spirv = R"(
OpCapability Shader
-OpExtInstImport %1 "GLSL.std.450"
+%1 = OpExtInstImport "GLSL.std.450"
OpMemoryModel Logical Simple
OpEntryPoint Vertex %2 "main"
-OpTypeVoid %3
-OpTypeFloat %4 32
-OpConstant %4 %5 1
-OpTypeFunction %6 %3
-OpFunction %3 %2 None %6
-OpLabel %8
-OpExtInst %4 %9 %1 )" + std::string(GetParam().inst) +
+%3 = OpTypeVoid
+%4 = OpTypeFloat 32
+%5 = OpConstant %4 1
+%6 = OpTypeFunction %3
+%2 = OpFunction %3 None %6
+%8 = OpLabel
+%9 = OpExtInst %4 %1 )" + std::string(GetParam().inst) +
R"( %5
OpReturn
OpFunctionEnd
}
spv_text output_text;
- error = spvBinaryToText(
- binary, SPV_BINARY_TO_TEXT_OPTION_NONE,
- opcodeTable, operandTable, extInstTable, &output_text, &diagnostic);
+ error =
+ spvBinaryToText(binary, SPV_BINARY_TO_TEXT_OPTION_NONE, opcodeTable,
+ operandTable, extInstTable, &output_text, &diagnostic);
if (error) {
spvDiagnosticPrint(diagnostic);