Ensure correct shader reflection for texture_external

Adds some handling that ensures correct reflection of texture_external now
that Dawn uses Tint by default. Enables the previously written tests.

dawn: 1004
Change-Id: I8fd43292e9fe243aee037c70fe47b79ace8b672f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/58540
Commit-Queue: Brandon Jones (Intel) <brandon1.jones@intel.com>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Brandon Jones
2021-07-19 22:26:47 +00:00
committed by Dawn LUCI CQ
parent 1fdcabf4a9
commit 631b300262
5 changed files with 34 additions and 38 deletions

View File

@@ -2126,8 +2126,9 @@ TEST_F(BindGroupLayoutCompatibilityTest, TextureViewDimension) {
wgpu::TextureViewDimension::e2D}})}));
}
// TODO(dawn:728) Enable this test when Dawn no longer relies on SPIRV-Cross to extract shader info.
TEST_F(BindGroupLayoutCompatibilityTest, DISABLED_ExternalTextureBindGroupLayoutCompatibility) {
// Test that a bgl with an external texture is compatible with texture_external in a shader and that
// an error is returned when the binding in the shader does not match.
TEST_F(BindGroupLayoutCompatibilityTest, ExternalTextureBindGroupLayoutCompatibility) {
wgpu::BindGroupLayout bgl = utils::MakeBindGroupLayout(
device, {{0, wgpu::ShaderStage::Fragment, &utils::kExternalTextureBindingLayout}});
@@ -2135,7 +2136,7 @@ TEST_F(BindGroupLayoutCompatibilityTest, DISABLED_ExternalTextureBindGroupLayout
CreateFSRenderPipeline(R"(
[[group(0), binding(0)]] var myExternalTexture: texture_external;
[[stage(fragment)]] fn main() {
textureDimensions(myExternalTexture);
ignore(myExternalTexture);
})",
{bgl});
@@ -2143,7 +2144,7 @@ TEST_F(BindGroupLayoutCompatibilityTest, DISABLED_ExternalTextureBindGroupLayout
ASSERT_DEVICE_ERROR(CreateFSRenderPipeline(R"(
[[group(0), binding(0)]] var myTexture: texture_2d<f32>;
[[stage(fragment)]] fn main() {
ignore(textureDimensions(myTexture));
ignore(myTexture);
})",
{bgl}));
}

View File

@@ -390,10 +390,9 @@ TEST_F(GetBindGroupLayoutTests, BindingType) {
}
}
// Test that an external texture binding type matches a shader using texture_external.
// TODO(dawn:728) Enable this test once Dawn no longer relies on SPIRV-Cross to extract shader info.
// Consider combining with the similar test above.
TEST_F(GetBindGroupLayoutTests, DISABLED_ExternalTextureBindingType) {
// Tests that the external texture binding type matches with a texture_external declared in the
// shader.
TEST_F(GetBindGroupLayoutTests, ExternalTextureBindingType) {
// This test works assuming Dawn Native's object deduplication.
// Getting the same pointer to equivalent bind group layouts is an implementation detail of Dawn
// Native.
@@ -412,7 +411,7 @@ TEST_F(GetBindGroupLayoutTests, DISABLED_ExternalTextureBindingType) {
[[group(0), binding(0)]] var myExternalTexture: texture_external;
[[stage(fragment)]] fn main() {
textureDimensions(myExternalTexture);
ignore(myExternalTexture);
})");
EXPECT_EQ(device.CreateBindGroupLayout(&desc).Get(), pipeline.GetBindGroupLayout(0).Get());
}