mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-12-12 14:46:08 +00:00
writer/hlsl: Emit vector-of-bool as boolN
Much like uintN, intN, floatN - boolN is far more common, and easier to read than vector<bool, N> Change-Id: I51f9edc003c590266316d3eba286ca2f6882da10 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/53390 Kokoro: Kokoro <noreply+kokoro@google.com> Reviewed-by: Antonio Maiorano <amaiorano@google.com> Reviewed-by: James Price <jrprice@google.com>
This commit is contained in:
@@ -2479,6 +2479,8 @@ bool GeneratorImpl::EmitType(std::ostream& out,
|
||||
out << "int" << size;
|
||||
} else if (vec->type()->Is<sem::U32>() && size >= 1 && size <= 4) {
|
||||
out << "uint" << size;
|
||||
} else if (vec->type()->Is<sem::Bool>() && size >= 1 && size <= 4) {
|
||||
out << "bool" << size;
|
||||
} else {
|
||||
out << "vector<";
|
||||
if (!EmitType(out, vec->type(), storage_class, access, "")) {
|
||||
|
||||
@@ -290,8 +290,7 @@ TEST_F(HlslGeneratorImplTest_Intrinsic, Select_Vector) {
|
||||
|
||||
gen.increment_indent();
|
||||
ASSERT_TRUE(gen.EmitExpression(pre, out, call)) << gen.error();
|
||||
EXPECT_EQ(result(),
|
||||
"(vector<bool, 2>(true, false) ? int2(1, 2) : int2(3, 4))");
|
||||
EXPECT_EQ(result(), "(bool2(true, false) ? int2(1, 2) : int2(3, 4))");
|
||||
}
|
||||
|
||||
TEST_F(HlslGeneratorImplTest_Intrinsic, Pack4x8Snorm) {
|
||||
|
||||
Reference in New Issue
Block a user