spirv-fuzz: Fix to operand id type (#3937)

Fixes #3934.
This commit is contained in:
Alastair Donaldson 2020-10-19 17:33:25 +01:00 коммит произвёл GitHub
Родитель cd1d3b6e0c
Коммит 5d7893b376
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
2 изменённых файлов: 7 добавлений и 1 удалений

Просмотреть файл

@ -117,7 +117,7 @@ void TransformationReplaceBranchFromDeadBlockWithExit::Apply(
opt::Instruction::OperandList new_terminator_in_operands;
if (message_.opcode() == SpvOpReturnValue) {
new_terminator_in_operands.push_back(
{SPV_OPERAND_TYPE_TYPE_ID, {message_.return_value_id()}});
{SPV_OPERAND_TYPE_ID, {message_.return_value_id()}});
}
auto terminator = block->terminator();
terminator->SetOpcode(static_cast<SpvOp>(message_.opcode()));

Просмотреть файл

@ -337,6 +337,12 @@ TEST(TransformationReplaceBranchFromDeadBlockWithExitTest,
ASSERT_TRUE(fuzzerutil::IsValidAndWellFormed(context.get(), validator_options,
kConsoleMessageConsumer));
opt::Instruction* return_value_inst =
context->get_instr_block(201)->terminator();
ASSERT_EQ(SpvOpReturnValue, return_value_inst->opcode());
ASSERT_EQ(SPV_OPERAND_TYPE_ID, return_value_inst->GetInOperand(0).type);
ASSERT_EQ(400, return_value_inst->GetSingleWordInOperand(0));
std::string after_transformation = R"(
OpCapability Shader
%1 = OpExtInstImport "GLSL.std.450"