This commit is contained in:
Dr. Chat 2016-02-21 16:52:43 -06:00
parent 568845e81d
commit 1d4190af02
1 changed files with 18 additions and 0 deletions

View File

@ -740,6 +740,24 @@ void SpirvShaderTranslator::ProcessVectorAluInstruction(
dest = b.createBinOp(spv::Op::OpFAdd, vec4_float_type_, dest, sources[2]); dest = b.createBinOp(spv::Op::OpFAdd, vec4_float_type_, dest, sources[2]);
} break; } break;
case AluVectorOpcode::kMaxA: {
// a0 = clamp(floor(src0.w + 0.5), -256, 255)
auto addr = b.createCompositeExtract(sources[0], float_type_, 3);
addr = b.createBinOp(spv::Op::OpFAdd, float_type_, addr,
b.makeFloatConstant(0.5f));
addr = b.createUnaryOp(spv::Op::OpConvertFToS, int_type_, addr);
addr = CreateGlslStd450InstructionCall(
spv::Decoration::DecorationInvariant, int_type_,
spv::GLSLstd450::kSClamp,
{addr, b.makeIntConstant(-256), b.makeIntConstant(255)});
b.createStore(addr, a0_);
// dest = src0 >= src1 ? src0 : src1
dest = CreateGlslStd450InstructionCall(
spv::Decoration::DecorationInvariant, vec4_float_type_,
spv::GLSLstd450::kFMax, {sources[0], sources[1]});
} break;
case AluVectorOpcode::kMax: { case AluVectorOpcode::kMax: {
dest = CreateGlslStd450InstructionCall( dest = CreateGlslStd450InstructionCall(
spv::Decoration::DecorationInvariant, vec4_float_type_, spv::Decoration::DecorationInvariant, vec4_float_type_,