Commit 13eba6ca by Chris Forbes

Fix OpVectorShuffle with mixed vector widths

There is a subtle trap here -- almost all SPIRV instructions require vector widths to match, but for OpVectorShuffle, the widths of the result vector and the two sources are completely independent. Fixes dEQP-VK.glsl.operator.unary_operator.plus.highp_vec2_vertex and many others. Bug: b/127959969 Change-Id: Iaa2cc09fb510fa2ab07a6f53599af8dade553a9a Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/26570 Presubmit-Ready: Chris Forbes <chrisforbes@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Tested-by: 's avatarChris Forbes <chrisforbes@google.com> Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com>
parent 53733a68
...@@ -1412,6 +1412,10 @@ namespace sw ...@@ -1412,6 +1412,10 @@ namespace sw
auto &type = getType(insn.word(1)); auto &type = getType(insn.word(1));
auto &dst = routine->createIntermediate(insn.word(2), type.sizeInComponents); auto &dst = routine->createIntermediate(insn.word(2), type.sizeInComponents);
// Note: number of components in result type, first half type, and second
// half type are all independent.
auto &firstHalfType = getType(getObject(insn.word(3)).type);
GenericValue firstHalfAccess(this, routine, insn.word(3)); GenericValue firstHalfAccess(this, routine, insn.word(3));
GenericValue secondHalfAccess(this, routine, insn.word(4)); GenericValue secondHalfAccess(this, routine, insn.word(4));
...@@ -1424,13 +1428,13 @@ namespace sw ...@@ -1424,13 +1428,13 @@ namespace sw
// a value as any // a value as any
dst.emplace(i, RValue<SIMD::Float>(0.0f)); dst.emplace(i, RValue<SIMD::Float>(0.0f));
} }
else if (selector < type.sizeInComponents) else if (selector < firstHalfType.sizeInComponents)
{ {
dst.emplace(i, firstHalfAccess[selector]); dst.emplace(i, firstHalfAccess[selector]);
} }
else else
{ {
dst.emplace(i, secondHalfAccess[selector - type.sizeInComponents]); dst.emplace(i, secondHalfAccess[selector - firstHalfType.sizeInComponents]);
} }
} }
} }
......
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