SPIR-V: Fix vec4 Dst
This commit is contained in:
parent
d5865740e2
commit
5937e603d7
|
@ -1085,7 +1085,7 @@ void SpirvShaderTranslator::ProcessVectorAluInstruction(
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case AluVectorOpcode::kCndGe: {
|
case AluVectorOpcode::kCndGe: {
|
||||||
// dest = src0 == 0.0 ? src1 : src2;
|
// dest = src0 >= 0.0 ? src1 : src2;
|
||||||
auto c = b.createBinOp(spv::Op::OpFOrdGreaterThanEqual, vec4_bool_type_,
|
auto c = b.createBinOp(spv::Op::OpFOrdGreaterThanEqual, vec4_bool_type_,
|
||||||
sources[0], vec4_float_zero_);
|
sources[0], vec4_float_zero_);
|
||||||
dest = b.createTriOp(spv::Op::OpSelect, vec4_float_type_, c, sources[1],
|
dest = b.createTriOp(spv::Op::OpSelect, vec4_float_type_, c, sources[1],
|
||||||
|
@ -1093,7 +1093,7 @@ void SpirvShaderTranslator::ProcessVectorAluInstruction(
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case AluVectorOpcode::kCndGt: {
|
case AluVectorOpcode::kCndGt: {
|
||||||
// dest = src0 == 0.0 ? src1 : src2;
|
// dest = src0 > 0.0 ? src1 : src2;
|
||||||
auto c = b.createBinOp(spv::Op::OpFOrdGreaterThan, vec4_bool_type_,
|
auto c = b.createBinOp(spv::Op::OpFOrdGreaterThan, vec4_bool_type_,
|
||||||
sources[0], vec4_float_zero_);
|
sources[0], vec4_float_zero_);
|
||||||
dest = b.createTriOp(spv::Op::OpSelect, vec4_float_type_, c, sources[1],
|
dest = b.createTriOp(spv::Op::OpSelect, vec4_float_type_, c, sources[1],
|
||||||
|
@ -1110,7 +1110,7 @@ void SpirvShaderTranslator::ProcessVectorAluInstruction(
|
||||||
auto dst_y = b.createBinOp(spv::Op::OpFMul, float_type_, src0_y, src1_y);
|
auto dst_y = b.createBinOp(spv::Op::OpFMul, float_type_, src0_y, src1_y);
|
||||||
|
|
||||||
auto src0_z = b.createCompositeExtract(sources[0], float_type_, 3);
|
auto src0_z = b.createCompositeExtract(sources[0], float_type_, 3);
|
||||||
auto src1_w = b.createCompositeExtract(sources[0], float_type_, 4);
|
auto src1_w = b.createCompositeExtract(sources[1], float_type_, 4);
|
||||||
dest = b.createCompositeConstruct(
|
dest = b.createCompositeConstruct(
|
||||||
vec4_float_type_,
|
vec4_float_type_,
|
||||||
std::vector<Id>({b.makeFloatConstant(1.f), dst_y, src0_z, src1_w}));
|
std::vector<Id>({b.makeFloatConstant(1.f), dst_y, src0_z, src1_w}));
|
||||||
|
|
Loading…
Reference in New Issue