Commit 9f6c0b89 by Chris Forbes

Avoid emitting nonsquare scale matrix entries where there is no main diagonal element

As mentioned in the patch itself, this is fairly benign, but still junk that a later pass has to be able to eliminate. Is easier to just not produce it in the first place. Bug: b/116263076 Change-Id: I199672bb9b53eb4ee9d4a8e3a23fc2ce42f0dec6 Reviewed-on: https://swiftshader-review.googlesource.com/20770Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarChris Forbes <chrisforbes@google.com>
parent d46e9f66
...@@ -1569,9 +1569,19 @@ namespace glsl ...@@ -1569,9 +1569,19 @@ namespace glsl
for(int i = 0; i < outCols; i++) for(int i = 0; i < outCols; i++)
{ {
emit(sw::Shader::OPCODE_MOV, result, i, &zero); emit(sw::Shader::OPCODE_MOV, result, i, &zero);
Instruction *mov = emitCast(result, i, arg0, 0); if (i < outRows)
mov->dst.mask = 1 << i; {
ASSERT(mov->src[0].swizzle == 0x00); // Insert the scalar value on the main diagonal.
// For non-square matrices, Avoid emitting in
// a column which doesn't /have/ a main diagonal
// element, even though it would be fairly benign --
// it's not necessarily trivial for downstream
// passes to see that this is redundant and strip it
// out.
Instruction *mov = emitCast(result, i, arg0, 0);
mov->dst.mask = 1 << i;
ASSERT(mov->src[0].swizzle == 0x00);
}
} }
} }
else if(arg0->isMatrix()) else if(arg0->isMatrix())
......
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