SetpPop/SetpRstr

This commit is contained in:
Dr. Chat 2016-02-21 18:52:49 -06:00
parent 5c2b5123ac
commit 9030c87386
1 changed files with 13 additions and 0 deletions

View File

@ -1203,9 +1203,22 @@ void SpirvShaderTranslator::ProcessScalarAluInstruction(
} break; } break;
case AluScalarOpcode::kSetpPop: { case AluScalarOpcode::kSetpPop: {
auto src = b.createBinOp(spv::Op::OpFSub, float_type_, sources[0],
b.makeFloatConstant(1.f));
auto c = b.createBinOp(spv::Op::OpFOrdLessThanEqual, bool_type_, src,
b.makeFloatConstant(0.f));
b.createStore(c, p0_);
dest = CreateGlslStd450InstructionCall(
spv::Decoration::DecorationInvariant, float_type_, GLSLstd450::kFMax,
{sources[0], b.makeFloatConstant(0.f)});
} break; } break;
case AluScalarOpcode::kSetpRstr: { case AluScalarOpcode::kSetpRstr: {
auto c = b.createBinOp(spv::Op::OpFOrdEqual, bool_type_, sources[0],
b.makeFloatConstant(0.f));
b.createStore(c, p0_);
dest = sources[0];
} break; } break;
case AluScalarOpcode::kSin: { case AluScalarOpcode::kSin: {