diff --git a/src/sksl/SkSLVMGenerator.cpp b/src/sksl/SkSLVMGenerator.cpp index 7d5072f9dc..bca880671f 100644 --- a/src/sksl/SkSLVMGenerator.cpp +++ b/src/sksl/SkSLVMGenerator.cpp @@ -749,7 +749,7 @@ Value SkVMGenerator::writeConstructor(const Constructor& c) { } else if (srcKind == Type::NumberKind::kBoolean) { // bool -> int for (size_t i = 0; i < src.slots(); ++i) { - dst[i] = i32(src[i]) & 1; + dst[i] = skvm::select(i32(src[i]), 1, 0); } return dst; } diff --git a/tests/sksl/runtime/golden/ConversionConstructors.skvm b/tests/sksl/runtime/golden/ConversionConstructors.skvm index 66bde1b67d..fe63b55a47 100644 --- a/tests/sksl/runtime/golden/ConversionConstructors.skvm +++ b/tests/sksl/runtime/golden/ConversionConstructors.skvm @@ -12,9 +12,9 @@ 10 r3 = eq_i32 r1 r3 11 r3 = bit_xor r4 r3 12 r4 = splat 1 (1.4012985e-45) -13 r4 = bit_and r2 r4 +13 r2 = bit_and r4 r2 14 r0 = trunc r0 -15 r0 = select r3 r4 r0 +15 r0 = select r3 r2 r0 16 r0 = to_f32 r0 17 r0 = mul_f32 r7 r0 loop: