Unify WGSL syntax to put stage decoration on same line
Bug: dawn:572 Change-Id: Ic7baba88bcff9cdb42e0507be58f84c824b62d25 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/33980 Commit-Queue: Austin Eng <enga@chromium.org> Reviewed-by: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
parent
6401506adf
commit
2b606e9297
|
@ -37,16 +37,14 @@ class ClipSpaceTest : public DawnTest {
|
|||
[[builtin(vertex_idx)]] var<in> VertexIndex : i32;
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn main() -> void {
|
||||
[[stage(vertex)]] fn main() -> void {
|
||||
Position = vec4<f32>(pos[VertexIndex], 1.0);
|
||||
return;
|
||||
})");
|
||||
|
||||
pipelineDescriptor.cFragmentStage.module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[location(0)]] var<out> fragColor : vec4<f32>;;
|
||||
[[stage(fragment)]]
|
||||
fn main() -> void {
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
fragColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||
return;
|
||||
})");
|
||||
|
|
|
@ -33,8 +33,7 @@ class ColorStateTest : public DawnTest {
|
|||
[[builtin(vertex_idx)]] var<in> VertexIndex : i32;
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn main() -> void {
|
||||
[[stage(vertex)]] fn main() -> void {
|
||||
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
||||
vec2<f32>(-1.0, -1.0),
|
||||
vec2<f32>(3.0, -1.0),
|
||||
|
@ -64,8 +63,7 @@ class ColorStateTest : public DawnTest {
|
|||
|
||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn main() -> void {
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
fragColor = myUbo.color;
|
||||
return;
|
||||
}
|
||||
|
@ -785,8 +783,7 @@ TEST_P(ColorStateTest, IndependentColorState) {
|
|||
[[location(2)]] var<out> fragColor2 : vec4<f32>;
|
||||
[[location(3)]] var<out> fragColor3 : vec4<f32>;
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn main() -> void {
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
fragColor0 = myUbo.color0;
|
||||
fragColor1 = myUbo.color1;
|
||||
fragColor2 = myUbo.color2;
|
||||
|
@ -890,8 +887,7 @@ TEST_P(ColorStateTest, DefaultBlendColor) {
|
|||
|
||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn main() -> void {
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
fragColor = myUbo.color;
|
||||
return;
|
||||
}
|
||||
|
@ -1014,8 +1010,7 @@ TEST_P(ColorStateTest, ColorWriteMaskDoesNotAffectRenderPassLoadOpClear) {
|
|||
|
||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn main() -> void {
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
fragColor = myUbo.color;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -145,8 +145,7 @@ class CompressedTextureBCFormatTest : public DawnTest {
|
|||
|
||||
[[builtin(vertex_idx)]] var<in> VertexIndex : i32;
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn main() -> void {
|
||||
[[stage(vertex)]] fn main() -> void {
|
||||
const pos : array<vec2<f32>, 3> = array<vec2<f32>, 3>(
|
||||
vec2<f32>(-3.0, 1.0),
|
||||
vec2<f32>( 3.0, 1.0),
|
||||
|
@ -163,8 +162,7 @@ class CompressedTextureBCFormatTest : public DawnTest {
|
|||
[[location(0)]] var<in> texCoord : vec2<f32>;
|
||||
[[location(0)]] var<out> fragColor : vec4<f32>;
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn main() -> void {
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
fragColor = textureSample(texture0, sampler0, texCoord);
|
||||
return;
|
||||
})");
|
||||
|
|
|
@ -37,8 +37,7 @@ class CullingTest : public DawnTest {
|
|||
[[builtin(vertex_idx)]] var<in> VertexIndex : i32;
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn main() -> void {
|
||||
[[stage(vertex)]] fn main() -> void {
|
||||
Position = vec4<f32>(pos[VertexIndex], 0.0, 1.0);
|
||||
return;
|
||||
})");
|
||||
|
@ -50,8 +49,7 @@ class CullingTest : public DawnTest {
|
|||
[[location(0)]] var<out> fragColor : vec4<f32>;;
|
||||
[[builtin(frag_coord)]] var<in> FragCoord : vec4<f32>;
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn main() -> void {
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
fragColor = vec4<f32>(
|
||||
(FragCoord.xy - vec2<f32>(0.5, 0.5)) / vec2<f32>(255.0, 255.0),
|
||||
0.0, 1.0);
|
||||
|
|
|
@ -103,16 +103,14 @@ TEST_P(D3D12CachingTests, SameShaderNoCache) {
|
|||
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> void {
|
||||
[[stage(vertex)]] fn vertex_main() -> void {
|
||||
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||
return;
|
||||
}
|
||||
|
||||
[[location(0)]] var<out> outColor : vec4<f32>;
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() -> void {
|
||||
[[stage(fragment)]] fn fragment_main() -> void {
|
||||
outColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||
return;
|
||||
}
|
||||
|
@ -152,16 +150,14 @@ TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPointsPerStage) {
|
|||
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> void {
|
||||
[[stage(vertex)]] fn vertex_main() -> void {
|
||||
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||
return;
|
||||
}
|
||||
|
||||
[[location(0)]] var<out> outColor : vec4<f32>;
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() -> void {
|
||||
[[stage(fragment)]] fn fragment_main() -> void {
|
||||
outColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||
return;
|
||||
}
|
||||
|
@ -199,16 +195,14 @@ TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPointsPerStage) {
|
|||
wgpu::ShaderModule newModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> void {
|
||||
[[stage(vertex)]] fn vertex_main() -> void {
|
||||
Position = vec4<f32>(1.0, 1.0, 1.0, 1.0);
|
||||
return;
|
||||
}
|
||||
|
||||
[[location(0)]] var<out> outColor : vec4<f32>;
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() -> void {
|
||||
[[stage(fragment)]] fn fragment_main() -> void {
|
||||
outColor = vec4<f32>(1.0, 1.0, 1.0, 1.0);
|
||||
return;
|
||||
}
|
||||
|
@ -237,14 +231,12 @@ TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPoints) {
|
|||
};
|
||||
[[binding(0), set(0)]] var<storage_buffer> data : Data;
|
||||
|
||||
[[stage(compute)]]
|
||||
fn write1() -> void {
|
||||
[[stage(compute)]] fn write1() -> void {
|
||||
data.data = 1u;
|
||||
return;
|
||||
}
|
||||
|
||||
[[stage(compute)]]
|
||||
fn write42() -> void {
|
||||
[[stage(compute)]] fn write42() -> void {
|
||||
data.data = 42u;
|
||||
return;
|
||||
}
|
||||
|
@ -284,4 +276,4 @@ TEST_P(D3D12CachingTests, ReuseShaderWithMultipleEntryPoints) {
|
|||
EXPECT_EQ(mPersistentCache.mCache.size(), 2u);
|
||||
}
|
||||
|
||||
DAWN_INSTANTIATE_TEST(D3D12CachingTests, D3D12Backend());
|
||||
DAWN_INSTANTIATE_TEST(D3D12CachingTests, D3D12Backend());
|
||||
|
|
|
@ -38,8 +38,7 @@ class DepthBiasTests : public DawnTest {
|
|||
vertexSource = R"(
|
||||
[[builtin(vertex_idx)]] var<in> VertexIndex : i32;
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
[[stage(vertex)]]
|
||||
fn main() -> void {
|
||||
[[stage(vertex)]] fn main() -> void {
|
||||
const pos : array<vec2<f32>, 6> = array<vec2<f32>, 6>(
|
||||
vec2<f32>(-1.0, -1.0),
|
||||
vec2<f32>( 1.0, -1.0),
|
||||
|
@ -57,8 +56,7 @@ class DepthBiasTests : public DawnTest {
|
|||
vertexSource = R"(
|
||||
[[builtin(vertex_idx)]] var<in> VertexIndex : i32;
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
[[stage(vertex)]]
|
||||
fn main() -> void {
|
||||
[[stage(vertex)]] fn main() -> void {
|
||||
const pos : array<vec3<f32>, 6> = array<vec3<f32>, 6>(
|
||||
vec3<f32>(-1.0, -1.0, 0.0),
|
||||
vec3<f32>( 1.0, -1.0, 0.0),
|
||||
|
@ -76,8 +74,7 @@ class DepthBiasTests : public DawnTest {
|
|||
|
||||
wgpu::ShaderModule fragmentModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[location(0)]] var<out> fragColor : vec4<f32>;;
|
||||
[[stage(fragment)]]
|
||||
fn main() -> void {
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
fragColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||
return;
|
||||
})");
|
||||
|
|
|
@ -27,16 +27,14 @@ TEST_P(EntryPointTests, FragAndVertexSameModule) {
|
|||
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> void {
|
||||
[[stage(vertex)]] fn vertex_main() -> void {
|
||||
Position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||
return;
|
||||
}
|
||||
|
||||
[[location(0)]] var<out> outColor : vec4<f32>;
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() -> void {
|
||||
[[stage(fragment)]] fn fragment_main() -> void {
|
||||
outColor = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||
return;
|
||||
}
|
||||
|
@ -82,14 +80,12 @@ TEST_P(EntryPointTests, TwoComputeInModule) {
|
|||
};
|
||||
[[binding(0), set(0)]] var<storage_buffer> data : Data;
|
||||
|
||||
[[stage(compute)]]
|
||||
fn write1() -> void {
|
||||
[[stage(compute)]] fn write1() -> void {
|
||||
data.data = 1u;
|
||||
return;
|
||||
}
|
||||
|
||||
[[stage(compute)]]
|
||||
fn write42() -> void {
|
||||
[[stage(compute)]] fn write42() -> void {
|
||||
data.data = 42u;
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -35,8 +35,7 @@ class VertexBufferRobustnessTest : public DawnTest {
|
|||
return utils::CreateShaderModuleFromWGSL(device, (attributes + R"(
|
||||
[[builtin(position)]] var<out> Position : vec4<f32>;
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn main() -> void {
|
||||
[[stage(vertex)]] fn main() -> void {
|
||||
if ()" + successExpression + R"() {
|
||||
# Success case, move the vertex out of the viewport
|
||||
Position = vec4<f32>(-10.0, 0.0, 0.0, 1.0);
|
||||
|
@ -61,8 +60,7 @@ class VertexBufferRobustnessTest : public DawnTest {
|
|||
wgpu::ShaderModule fsModule = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[location(0)]] var<out> outColor : vec4<f32>;
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn main() -> void {
|
||||
[[stage(fragment)]] fn main() -> void {
|
||||
outColor = vec4<f32>(1.0, 1.0, 1.0, 1.0);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -594,15 +594,13 @@ TEST_F(RenderPipelineValidationTest, EntryPointNameValidation) {
|
|||
|
||||
wgpu::ShaderModule module = utils::CreateShaderModuleFromWGSL(device, R"(
|
||||
[[builtin(position)]] var<out> position : vec4<f32>;
|
||||
[[stage(vertex)]]
|
||||
fn vertex_main() -> void {
|
||||
[[stage(vertex)]] fn vertex_main() -> void {
|
||||
position = vec4<f32>(0.0, 0.0, 0.0, 1.0);
|
||||
return;
|
||||
}
|
||||
|
||||
[[location(0)]] var<out> color : vec4<f32>;
|
||||
[[stage(fragment)]]
|
||||
fn fragment_main() -> void {
|
||||
[[stage(fragment)]] fn fragment_main() -> void {
|
||||
color = vec4<f32>(1.0, 0.0, 0.0, 1.0);
|
||||
return;
|
||||
}
|
||||
|
@ -651,13 +649,11 @@ TEST_F(RenderPipelineValidationTest, VertexAttribCorrectEntryPoint) {
|
|||
[[location(0)]] var<in> attrib0 : vec4<f32>;
|
||||
[[location(1)]] var<in> attrib1 : vec4<f32>;
|
||||
|
||||
[[stage(vertex)]]
|
||||
fn vertex0() -> void {
|
||||
[[stage(vertex)]] fn vertex0() -> void {
|
||||
position = attrib0;
|
||||
return;
|
||||
}
|
||||
[[stage(vertex)]]
|
||||
fn vertex1() -> void {
|
||||
[[stage(vertex)]] fn vertex1() -> void {
|
||||
position = attrib1;
|
||||
return;
|
||||
}
|
||||
|
@ -700,13 +696,11 @@ TEST_F(RenderPipelineValidationTest, FragmentOutputCorrectEntryPoint) {
|
|||
[[location(0)]] var<out> colorFloat : vec4<f32>;
|
||||
[[location(0)]] var<out> colorUint : vec4<u32>;
|
||||
|
||||
[[stage(fragment)]]
|
||||
fn fragmentFloat() -> void {
|
||||
[[stage(fragment)]] fn fragmentFloat() -> void {
|
||||
colorFloat = vec4<f32>(0.0, 0.0, 0.0, 0.0);
|
||||
return;
|
||||
}
|
||||
[[stage(fragment)]]
|
||||
fn fragmentUint() -> void {
|
||||
[[stage(fragment)]] fn fragmentUint() -> void {
|
||||
colorUint = vec4<u32>(0, 0, 0, 0);
|
||||
return;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue