Skip to content

Commit

Permalink
Don't use duplicate function name in boids shader
Browse files Browse the repository at this point in the history
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'
  • Loading branch information
Bobo1239 committed Nov 15, 2021
1 parent 052cb3d commit b1ff31f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions wgpu/examples/boids/draw.wgsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[[stage(vertex)]]
fn main(
fn main_vs(
[[location(0)]] particle_pos: vec2<f32>,
[[location(1)]] particle_vel: vec2<f32>,
[[location(2)]] position: vec2<f32>,
Expand All @@ -13,6 +13,6 @@ fn main(
}

[[stage(fragment)]]
fn main() -> [[location(0)]] vec4<f32> {
fn main_fs() -> [[location(0)]] vec4<f32> {
return vec4<f32>(1.0, 1.0, 1.0, 1.0);
}
4 changes: 2 additions & 2 deletions wgpu/examples/boids/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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(),
Expand Down

0 comments on commit b1ff31f

Please sign in to comment.