Fix a warning in FirstIndexOffsetTests about "flat" interpolation
This patch fixes a shader compilation warning in FirstIndexOffsetTests
by adding "flat" interpolation types to the user-defined unsigned
integer vertex outputs and fragment inputs.
This patch also enables FirstIndexOffsetTests on Vulkan backends as
we have already correctly supported "flat" interpolation in WGSL.
BUG=tint:451
TEST=dawn_end2end_tests
Change-Id: I965572c8460494e3eaec5dcf83e2dc67c0771250
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/70025
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Jiawei Shao <jiawei.shao@intel.com>
diff --git a/src/tests/end2end/FirstIndexOffsetTests.cpp b/src/tests/end2end/FirstIndexOffsetTests.cpp
index 8d12bd2..7da6b28 100644
--- a/src/tests/end2end/FirstIndexOffsetTests.cpp
+++ b/src/tests/end2end/FirstIndexOffsetTests.cpp
@@ -50,10 +50,8 @@
protected:
void SetUp() override {
DawnTest::SetUp();
- // WGSL doesn't have the ability to tag attributes as "flat". "flat" is required on u32
- // attributes for correct runtime behavior under Vulkan and codegen under OpenGL(ES).
- // TODO(tint:451): Remove once resolved by spec/tint
- DAWN_SUPPRESS_TEST_IF(IsVulkan() || IsOpenGL() || IsOpenGLES());
+ // TODO(tint:451): Remove once "flat" is supported under OpenGL(ES).
+ DAWN_SUPPRESS_TEST_IF(IsOpenGL() || IsOpenGLES());
}
private:
@@ -99,18 +97,18 @@
if ((checkIndex & CheckIndex::Vertex) != 0) {
vertexInputs << " [[builtin(vertex_index)]] vertex_index : u32;\n";
- vertexOutputs << " [[location(1)]] vertex_index : u32;\n";
+ vertexOutputs << " [[location(1), interpolate(flat)]] vertex_index : u32;\n";
vertexBody << " output.vertex_index = input.vertex_index;\n";
- fragmentInputs << " [[location(1)]] vertex_index : u32;\n";
+ fragmentInputs << " [[location(1), interpolate(flat)]] vertex_index : u32;\n";
fragmentBody << " _ = atomicMin(&idx_vals.vertex_index, input.vertex_index);\n";
}
if ((checkIndex & CheckIndex::Instance) != 0) {
vertexInputs << " [[builtin(instance_index)]] instance_index : u32;\n";
- vertexOutputs << " [[location(2)]] instance_index : u32;\n";
+ vertexOutputs << " [[location(2), interpolate(flat)]] instance_index : u32;\n";
vertexBody << " output.instance_index = input.instance_index;\n";
- fragmentInputs << " [[location(2)]] instance_index : u32;\n";
+ fragmentInputs << " [[location(2), interpolate(flat)]] instance_index : u32;\n";
fragmentBody << " _ = atomicMin(&idx_vals.instance_index, input.instance_index);\n";
}