Commit 97e9589a by Chris Forbes

Add support for OpKill

Bug: b/124056625 Change-Id: I2e5650f81516da1e8f18775cb4b10ff5cfbb8a80 Reviewed-on: https://swiftshader-review.googlesource.com/c/SwiftShader/+/28328 Presubmit-Ready: Chris Forbes <chrisforbes@google.com> Tested-by: 's avatarChris Forbes <chrisforbes@google.com> Kokoro-Presubmit: kokoro <noreply+kokoro@google.com> Reviewed-by: 's avatarBen Clayton <bclayton@google.com>
parent 4fa92a7b
......@@ -47,6 +47,14 @@ namespace sw
clampColor(c);
if(spirvShader->getModes().ContainsKill)
{
for (auto i = 0u; i < state.multiSample; i++)
{
cMask[i] &= ~routine.killMask;
}
}
if(spirvShader->getModes().DepthReplacing)
{
oDepth = Min(Max(oDepth, Float4(0.0f)), Float4(1.0f));
......
......@@ -1681,6 +1681,9 @@ namespace sw
case spv::OpReturn:
return EmitReturn(insn, state);
case spv::OpKill:
return EmitKill(insn, state);
default:
UNIMPLEMENTED("opcode: %s", OpcodeName(insn.opcode()).c_str());
break;
......@@ -3028,6 +3031,13 @@ namespace sw
return EmitResult::Terminator;
}
SpirvShader::EmitResult SpirvShader::EmitKill(InsnIterator insn, EmitState *state) const
{
state->routine->killMask |= SignMask(state->activeLaneMask());
state->setActiveLaneMask(SIMD::Int(0));
return EmitResult::Terminator;
}
SpirvShader::EmitResult SpirvShader::EmitPhi(InsnIterator insn, EmitState *state) const
{
auto routine = state->routine;
......
......@@ -630,6 +630,7 @@ namespace sw
EmitResult EmitSwitch(InsnIterator insn, EmitState *state) const;
EmitResult EmitUnreachable(InsnIterator insn, EmitState *state) const;
EmitResult EmitReturn(InsnIterator insn, EmitState *state) const;
EmitResult EmitKill(InsnIterator insn, EmitState *state) const;
EmitResult EmitPhi(InsnIterator insn, EmitState *state) const;
// OpcodeName() returns the name of the opcode op.
......@@ -661,6 +662,7 @@ namespace sw
std::array<Pointer<Byte>, vk::MAX_BOUND_DESCRIPTOR_SETS> descriptorSets;
Pointer<Byte> pushConstants;
Int killMask = Int{0};
void createLvalue(SpirvShader::Object::ID id, uint32_t size)
{
......
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