Add an end2end test to ensure dawn cache system considers dynamic attributes

Binding layout uses an attribute to mark dynamic resource. And this should be taken into
consideration when determining whether two bindingInfo are equal.

Otherwise, dawn cache system may take two different bind group layouts(they have same binding
resource type, masks and visibilities but one bind group has dynamic resource and the other
not) as the same. This will return wrong bind group layout object to user and cause validation
error when user tries to use dynamic buffer offset.

BUG=dawn:188

Change-Id: I11b158724c7592718af434b48c9e3f2f9bb72b93
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/8901
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Yan, Shaobo 2019-07-16 08:37:49 +00:00 committed by Commit Bot service account
parent f07e85c604
commit c8ab96cdd9
1 changed files with 13 additions and 0 deletions

View File

@ -32,6 +32,19 @@ TEST_P(ObjectCachingTest, BindGroupLayoutDeduplication) {
EXPECT_EQ(bgl.Get() == sameBgl.Get(), !UsesWire());
}
// Test that two similar bind group layouts won't refer to the same one.
TEST_P(ObjectCachingTest, BindGroupLayoutDynamic) {
dawn::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer, true}});
dawn::BindGroupLayout sameBgl = utils::MakeBindGroupLayout(
device, {{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer, true}});
dawn::BindGroupLayout otherBgl = utils::MakeBindGroupLayout(
device, {{1, dawn::ShaderStageBit::Fragment, dawn::BindingType::UniformBuffer, false}});
EXPECT_NE(bgl.Get(), otherBgl.Get());
EXPECT_EQ(bgl.Get() == sameBgl.Get(), !UsesWire());
}
// Test that an error object doesn't try to uncache itself
TEST_P(ObjectCachingTest, ErrorObjectDoesntUncache) {
ASSERT_DEVICE_ERROR(