Add regression test for MSL compilation failure with texture_external
It seems that using a second binding in the same group causes issues:
@group(0) @binding(1) var<storage, read_write> dimension : vec2u;
@group(0) @binding(0) var t : texture_external;
Bug: 346174896
Change-Id: Ia89bee5460375170c0cfbc85f069a373c1bd4f53
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/192580
Auto-Submit: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: dan sinclair <dsinclair@google.com>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
diff --git a/src/dawn/tests/end2end/ExternalTextureTests.cpp b/src/dawn/tests/end2end/ExternalTextureTests.cpp
index 98a2944..896fb4e 100644
--- a/src/dawn/tests/end2end/ExternalTextureTests.cpp
+++ b/src/dawn/tests/end2end/ExternalTextureTests.cpp
@@ -1332,6 +1332,35 @@
ASSERT_NE(pipeline.Get(), nullptr);
}
+// Regression test for issue 346174896.
+TEST_P(ExternalTextureTests, Regression346174896) {
+ // TODO(346174896): Remove suppression once the issue in Tint MSL AST is fixed.
+ DAWN_SUPPRESS_TEST_IF(IsMetal());
+
+ auto wgslModule = utils::CreateShaderModule(device, R"(
+ @vertex fn vertexMain() -> @builtin(position) vec4f {
+ return vec4f(1);
+ }
+
+ @group(0) @binding(1) var<storage, read_write> dimension : vec2u;
+ @group(0) @binding(0) var t : texture_external;
+
+ @fragment fn main(@builtin(position) FragCoord : vec4f)
+ -> @location(0) vec4f {
+ dimension = textureDimensions(t);
+
+ var coords = textureDimensions(t) / 2 + vec2u(FragCoord.xy) - vec2(1, 1);
+ return textureLoad(t, coords);
+ })");
+
+ utils::ComboRenderPipelineDescriptor descriptor;
+ descriptor.vertex.module = wgslModule;
+ descriptor.cFragment.module = wgslModule;
+ wgpu::RenderPipeline pipeline = device.CreateRenderPipeline(&descriptor);
+
+ ASSERT_NE(pipeline.Get(), nullptr);
+}
+
TEST_P(ExternalTextureTests, MultipleBindings) {
auto wgslModule = utils::CreateShaderModule(device, R"(
@vertex