Commit 83fc5445 by Chris Forbes

Add support for OpVectorShuffle

Bug: b/126472836 Change-Id: I0e7afc53e863540fb5bd76ec8737f4b2aa3a015b Reviewed-on: https://swiftshader-review.googlesource.com/c/25649Tested-by: 's avatarChris Forbes <chrisforbes@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Reviewed-by: 's avatarBen Clayton <bclayton@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com>
parent b12846d1
......@@ -262,6 +262,7 @@ namespace sw
case spv::OpCompositeConstruct:
case spv::OpCompositeInsert:
case spv::OpCompositeExtract:
case spv::OpVectorShuffle:
// Instructions that yield an ssavalue.
{
TypeID typeId = insn.word(1);
......@@ -1025,6 +1026,34 @@ namespace sw
dst.emplace(i, compositeObjectAccess[firstComponent + i]);
break;
}
case spv::OpVectorShuffle:
{
auto &type = getType(insn.word(1));
auto &dst = routine->createIntermediate(insn.word(2), type.sizeInComponents);
GenericValue firstHalfAccess(this, routine, insn.word(3));
GenericValue secondHalfAccess(this, routine, insn.word(4));
for (auto i = 0u; i < type.sizeInComponents; i++)
{
auto selector = insn.word(5 + i);
if (selector == static_cast<uint32_t>(-1))
{
// Undefined value. Until we decide to do real undef values, zero is as good
// a value as any
dst.emplace(i, RValue<Float4>(0.0f));
}
else if (selector < type.sizeInComponents)
{
dst.emplace(i, firstHalfAccess[selector]);
}
else
{
dst.emplace(i, secondHalfAccess[selector - type.sizeInComponents]);
}
}
break;
}
default:
printf("emit: ignoring opcode %d\n", insn.opcode());
break;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment