Skip to content

Commit

Permalink
Deduplicate wgpu dependency
Browse files Browse the repository at this point in the history
  • Loading branch information
PolyMeilex committed Aug 19, 2022
1 parent cd2e78d commit 19b15ad
Show file tree
Hide file tree
Showing 8 changed files with 13 additions and 11 deletions.
2 changes: 0 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions quad-pipeline/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ version = "0.1.0"
edition = "2021"

[dependencies]
wgpu = "0.13.0"
wgpu-jumpstart = { path = "../wgpu-jumpstart" }
bytemuck = "1.5.0"
bytemuck = "1.5"
1 change: 1 addition & 0 deletions quad-pipeline/src/instance_data.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use wgpu::vertex_attr_array;
use wgpu_jumpstart::wgpu;

use bytemuck::{Pod, Zeroable};

Expand Down
4 changes: 1 addition & 3 deletions quad-pipeline/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,12 @@ mod instance_data;
pub use instance_data::QuadInstance;

use wgpu_jumpstart::{
Gpu, Instances, RenderPipelineBuilder, Shape, TransformUniform, Uniform,
wgpu, Gpu, Instances, RenderPipelineBuilder, Shape, TransformUniform, Uniform,
};

pub struct QuadPipeline {
render_pipeline: wgpu::RenderPipeline,

quad: Shape,

instances: Instances<QuadInstance>,
}

Expand Down
3 changes: 1 addition & 2 deletions waterfall-pipeline/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@ version = "0.1.0"
edition = "2021"

[dependencies]
wgpu = "0.13.0"
wgpu-jumpstart = { path = "../wgpu-jumpstart" }
bytemuck = "1.5.0"
bytemuck = "1.5"
5 changes: 4 additions & 1 deletion waterfall-pipeline/src/instance_data.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use wgpu::vertex_attr_array;
use wgpu_jumpstart::wgpu;

use bytemuck::{Pod, Zeroable};
use wgpu::vertex_attr_array;

#[repr(C)]
#[derive(Debug, Copy, Clone, Pod, Zeroable)]
Expand All @@ -10,10 +11,12 @@ pub struct NoteInstance {
pub color: [f32; 3],
pub radius: f32,
}

impl NoteInstance {
pub fn attributes() -> [wgpu::VertexAttribute; 4] {
vertex_attr_array!(1 => Float32x2, 2 => Float32x2, 3 => Float32x3, 4 => Float32)
}

pub fn layout(attributes: &[wgpu::VertexAttribute]) -> wgpu::VertexBufferLayout {
wgpu::VertexBufferLayout {
array_stride: std::mem::size_of::<NoteInstance>() as wgpu::BufferAddress,
Expand Down
5 changes: 4 additions & 1 deletion waterfall-pipeline/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ mod instance_data;

pub use instance_data::NoteInstance;

use wgpu_jumpstart::{Gpu, Instances, RenderPipelineBuilder, Shape, TransformUniform, Uniform};
use wgpu_jumpstart::{
wgpu, Gpu, Instances, RenderPipelineBuilder, Shape, TransformUniform, Uniform,
};

use bytemuck::{Pod, Zeroable};

Expand Down Expand Up @@ -103,6 +105,7 @@ impl<'a> WaterfallPipeline {
struct TimeUniform {
time: f32,
}

impl Default for TimeUniform {
fn default() -> Self {
Self { time: 0.0 }
Expand Down
1 change: 1 addition & 0 deletions wgpu-jumpstart/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ mod window;

mod transform_uniform;

pub use wgpu;
pub use {
color::Color, gpu::Gpu, instances::Instances, render_pipeline_builder::RenderPipelineBuilder,
shape::Shape, transform_uniform::TransformUniform, uniform::Uniform, window::Window,
Expand Down

0 comments on commit 19b15ad

Please sign in to comment.