From 47fd77619f11a9c008401341f2df95909bce4153 Mon Sep 17 00:00:00 2001 From: Boris-Chengbiao Zhou Date: Wed, 17 Nov 2021 05:25:33 +0100 Subject: [PATCH] Don't use duplicate function name in boids shader (#2183) From the spec: "A declaration must not introduce a name when that identifier is already in scope with the same end scope as another instance of that name." naga doesn't yet check this (gfx-rs/naga#1480) but Chrome/Tint rightly complains with: error: redefinition of 'main' --- wgpu/examples/boids/draw.wgsl | 4 ++-- wgpu/examples/boids/main.rs | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/wgpu/examples/boids/draw.wgsl b/wgpu/examples/boids/draw.wgsl index 8980eb7d11..6822c57bbf 100644 --- a/wgpu/examples/boids/draw.wgsl +++ b/wgpu/examples/boids/draw.wgsl @@ -1,5 +1,5 @@ [[stage(vertex)]] -fn main( +fn main_vs( [[location(0)]] particle_pos: vec2, [[location(1)]] particle_vel: vec2, [[location(2)]] position: vec2, @@ -13,6 +13,6 @@ fn main( } [[stage(fragment)]] -fn main() -> [[location(0)]] vec4 { +fn main_fs() -> [[location(0)]] vec4 { return vec4(1.0, 1.0, 1.0, 1.0); } diff --git a/wgpu/examples/boids/main.rs b/wgpu/examples/boids/main.rs index 54c1c47638..74824e8047 100644 --- a/wgpu/examples/boids/main.rs +++ b/wgpu/examples/boids/main.rs @@ -137,7 +137,7 @@ impl framework::Example for Example { layout: Some(&render_pipeline_layout), vertex: wgpu::VertexState { module: &draw_shader, - entry_point: "main", + entry_point: "main_vs", buffers: &[ wgpu::VertexBufferLayout { array_stride: 4 * 4, @@ -153,7 +153,7 @@ impl framework::Example for Example { }, fragment: Some(wgpu::FragmentState { module: &draw_shader, - entry_point: "main", + entry_point: "main_fs", targets: &[config.format.into()], }), primitive: wgpu::PrimitiveState::default(),