Remove unused id

This commit is contained in:
Maximilian Ammann 2022-01-08 11:13:17 +01:00
parent 96732dde1d
commit ebc7476266
4 changed files with 4 additions and 19 deletions

View File

@ -64,7 +64,7 @@ impl Cache {
let mut geometry: VertexBuffers<GpuVertexUniform, IndexDataType> =
VertexBuffers::new();
tile.tesselate_stroke(&mut geometry, 1);
tile.tesselate_stroke(&mut geometry);
self.responses.push(TesselatedTile {
id: current_id,
coords,

View File

@ -50,25 +50,17 @@ impl GlobalsUniform {
pub struct GpuVertexUniform {
pub position: Vec2f32,
pub normal: Vec2f32,
pub tile_id: u32,
_pad1: i32, // _padX aligns it to 8 bytes = AlignOf(Vec2f32=vec2<f32>):
// https://gpuweb.github.io/gpuweb/wgsl/#alignment-and-size
}
impl GpuVertexUniform {
pub fn new(position: Vec2f32, normal: Vec2f32, tile_id: u32) -> Self {
Self {
position,
normal,
tile_id,
_pad1: Default::default(),
}
pub fn new(position: Vec2f32, normal: Vec2f32) -> Self {
Self { position, normal }
}
}
impl Default for GpuVertexUniform {
fn default() -> Self {
GpuVertexUniform::new([0.0, 0.0], [0.0, 0.0], 0)
GpuVertexUniform::new([0.0, 0.0], [0.0, 0.0])
}
}

View File

@ -88,12 +88,6 @@ pub mod tile {
format: wgpu::VertexFormat::Float32x2,
shader_location: 1,
},
// tile_id
wgpu::VertexAttribute {
offset: 2 * wgpu::VertexFormat::Float32x2.size(),
format: wgpu::VertexFormat::Uint32,
shader_location: 2,
},
],
},
wgpu::VertexBufferLayout {

View File

@ -19,7 +19,6 @@ struct VertexOutput {
fn main(
[[location(0)]] position: vec2<f32>,
[[location(1)]] normal: vec2<f32>,
[[location(2)]] tile_id: u32,
[[location(3)]] color: vec4<f32>,
[[location(4)]] translate: vec3<f32>,
[[builtin(instance_index)]] instance_idx: u32 // instance_index is used when we have multiple instances of the same "object"