Skip to content

Commit

Permalink
HLSL-IR: Enable the remaining disables tint_unittests
Browse files Browse the repository at this point in the history
Bug: 42251045
Change-Id: I3d00d13d1d56f3aa9f221f5c27660c42db70f3b1
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/214334
Commit-Queue: Antonio Maiorano <[email protected]>
Reviewed-by: James Price <[email protected]>
Reviewed-by: dan sinclair <[email protected]>
  • Loading branch information
amaiorano authored and Dawn LUCI CQ committed Nov 7, 2024
1 parent ed79e01 commit 61c0a9d
Showing 1 changed file with 13 additions and 15 deletions.
28 changes: 13 additions & 15 deletions src/tint/lang/hlsl/writer/function_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,7 @@ vert2_main1_outputs vert2_main1() {
)");
}

TEST_F(HlslWriterTest, DISABLED_FunctionEntryPointWithUniform) {
TEST_F(HlslWriterTest, FunctionEntryPointWithUniform) {
// struct Uniforms {
// coord: vec4f,
// }
Expand Down Expand Up @@ -454,9 +454,8 @@ TEST_F(HlslWriterTest, DISABLED_FunctionEntryPointWithUniform) {
cbuffer cbuffer_ubo : register(b0, space1) {
uint4 ubo[1];
};
float sub_func(float param) {
return asfloat(ubo[0].x);
return asfloat(ubo[0u].x);
}
void frag_main() {
Expand All @@ -466,7 +465,7 @@ void frag_main() {
)");
}

TEST_F(HlslWriterTest, DISABLED_FunctionEntryPointWithUniformStruct) {
TEST_F(HlslWriterTest, FunctionEntryPointWithUniformStruct) {
// struct Uniforms {
// coord: vec4f,
// }
Expand Down Expand Up @@ -502,8 +501,7 @@ cbuffer cbuffer_ubo : register(b0, space1) {
uint4 ubo[1];
};
void frag_main() {
float v = asfloat(ubo[0].x);
return;
float v = asfloat(ubo[0u].x);
}
)");
Expand Down Expand Up @@ -588,7 +586,7 @@ void frag_main() {
)");
}

TEST_F(HlslWriterTest, DISABLED_FunctionEntryPointWithWOStorageBufferStore) {
TEST_F(HlslWriterTest, FunctionEntryPointWithWOStorageBufferStore) {
// struct Data {
// a: i32,
// b: f32,
Expand Down Expand Up @@ -621,13 +619,12 @@ TEST_F(HlslWriterTest, DISABLED_FunctionEntryPointWithWOStorageBufferStore) {
RWByteAddressBuffer coord : register(u0, space1);
void frag_main() {
coord.Store(4u, asuint(2.0f));
return;
}
)");
}

TEST_F(HlslWriterTest, DISABLED_FunctionEntryPointWithStorageBufferStore) {
TEST_F(HlslWriterTest, FunctionEntryPointWithStorageBufferStore) {
// struct Data {
// a: i32,
// b: f32,
Expand Down Expand Up @@ -660,13 +657,12 @@ TEST_F(HlslWriterTest, DISABLED_FunctionEntryPointWithStorageBufferStore) {
RWByteAddressBuffer coord : register(u0, space1);
void frag_main() {
coord.Store(4u, asuint(2.0f));
return;
}
)");
}

TEST_F(HlslWriterTest, DISABLED_FunctionCalledByEntryPointWithUniform) {
TEST_F(HlslWriterTest, FunctionCalledByEntryPointWithUniform) {
// Struct S {
// x: f32,
// }
Expand All @@ -687,7 +683,10 @@ TEST_F(HlslWriterTest, DISABLED_FunctionCalledByEntryPointWithUniform) {
coord->SetBindingPoint(1, 0);
b.ir.root_block->Append(coord);

auto* param = b.FunctionParam("param", ty.f32());
auto* sub_func = b.Function("sub_func", ty.f32());
sub_func->SetParams({param});

b.Append(sub_func->Block(), [&] {
auto* a = b.Access(ty.ptr<uniform, f32, core::Access::kRead>(), coord, 0_u);
b.Return(sub_func, b.Load(a));
Expand All @@ -700,17 +699,16 @@ TEST_F(HlslWriterTest, DISABLED_FunctionCalledByEntryPointWithUniform) {
});

ASSERT_TRUE(Generate()) << err_ << output_.hlsl;
EXPECT_EQ(output_.hlsl, R"(cbuffer cbuffer_coord : register(b0, space1) {
EXPECT_EQ(output_.hlsl, R"(
cbuffer cbuffer_coord : register(b0, space1) {
uint4 coord[1];
};
float sub_func(float param) {
return coord.x;
return asfloat(coord[0u].x);
}
void frag_main() {
float v = sub_func(1.0f);
return;
}
)");
Expand Down

0 comments on commit 61c0a9d

Please sign in to comment.