Use vec4 zero rather than float zero where needed

This commit is contained in:
Dr. Chat 2016-02-21 17:39:18 -06:00
parent 13049912ee
commit cbac9b2f4e
1 changed files with 9 additions and 3 deletions

View File

@ -613,7 +613,7 @@ void SpirvShaderTranslator::ProcessVectorAluInstruction(
case AluVectorOpcode::kCndEq: {
// dest = src0 == 0.0 ? src1 : src2;
auto c = b.createBinOp(spv::Op::OpFOrdEqual, vec4_bool_type_, sources[0],
b.makeFloatConstant(0.f));
vec4_float_zero_);
dest = b.createTriOp(spv::Op::OpSelect, vec4_float_type_, c, sources[1],
sources[2]);
} break;
@ -621,7 +621,7 @@ void SpirvShaderTranslator::ProcessVectorAluInstruction(
case AluVectorOpcode::kCndGe: {
// dest = src0 == 0.0 ? src1 : src2;
auto c = b.createBinOp(spv::Op::OpFOrdGreaterThanEqual, vec4_bool_type_,
sources[0], b.makeFloatConstant(0.f));
sources[0], vec4_float_zero_);
dest = b.createTriOp(spv::Op::OpSelect, vec4_float_type_, c, sources[1],
sources[2]);
} break;
@ -629,7 +629,7 @@ void SpirvShaderTranslator::ProcessVectorAluInstruction(
case AluVectorOpcode::kCndGt: {
// dest = src0 == 0.0 ? src1 : src2;
auto c = b.createBinOp(spv::Op::OpFOrdGreaterThan, vec4_bool_type_,
sources[0], b.makeFloatConstant(0.f));
sources[0], vec4_float_zero_);
dest = b.createTriOp(spv::Op::OpSelect, vec4_float_type_, c, sources[1],
sources[2]);
} break;
@ -1184,6 +1184,12 @@ void SpirvShaderTranslator::ProcessScalarAluInstruction(
b.makeFloatConstant(0.f), b.makeFloatConstant(1.f));
} break;
case AluScalarOpcode::kSetpPop: {
} break;
case AluScalarOpcode::kSetpRstr: {
} break;
case AluScalarOpcode::kSin: {
dest = CreateGlslStd450InstructionCall(
spv::Decoration::DecorationInvariant, float_type_, GLSLstd450::kSin,