Skip to content

Commit

Permalink
Update wgpu to 47fd776
Browse files Browse the repository at this point in the history
  • Loading branch information
kvark committed Nov 18, 2021
1 parent afd5c28 commit 10e8e6b
Show file tree
Hide file tree
Showing 8 changed files with 57 additions and 67 deletions.
75 changes: 40 additions & 35 deletions Cargo.lock

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

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ rust-ini = "0.17"
serde = "1.0"
serde_derive = "1.0"
serde_scan = "0.4"
wgpu = { git = "https://github.com/gfx-rs/wgpu", rev = "8f02b73", features = [] }
wgpu = { git = "https://github.com/gfx-rs/wgpu", rev = "47fd776", features = [] }
# binaries
env_logger = "0.8"
getopts = "0.2"
Expand All @@ -69,8 +69,8 @@ png = "0.16"
winit = "0.25"

[dev-dependencies]
#naga = { git = "https://github.com/gfx-rs/naga", rev = "7613798", features = ["wgsl-in"] }
naga = { version = "0.6", features = ["wgsl-in"] }
naga = { git = "https://github.com/gfx-rs/naga", rev = "eda078d", features = ["wgsl-in"] }
#naga = { version = "0.6", features = ["wgsl-in"] }

[dependencies.profiling]
version = "1.0.1"
Expand All @@ -80,6 +80,7 @@ default-features = false
#naga = { path = "../naga" }

[patch."https://github.com/gfx-rs/wgpu"]
#wgpu = { path = "../wgpu/wgpu" }
#wgpu-hal = { path = "../wgpu/wgpu-hal" }
#wgpu-core = { path = "../wgpu/wgpu-core" }
#wgpu-types = { path = "../wgpu/wgpu-types" }
5 changes: 3 additions & 2 deletions bin/boilerplate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ impl Harness {
.run_until(instance.request_adapter(&wgpu::RequestAdapterOptions {
power_preference: wgpu::PowerPreference::HighPerformance,
compatible_surface: Some(&surface),
force_fallback_adapter: false,
}))
.expect("Unable to initialize GPU via the selected backend.");

Expand Down Expand Up @@ -227,10 +228,9 @@ impl Harness {
queue.submit(update_command_buffers);
}

match surface.get_current_frame() {
match surface.get_current_texture() {
Ok(frame) => {
let view = frame
.output
.texture
.create_view(&wgpu::TextureViewDescriptor::default());
let targets = ScreenTargets {
Expand All @@ -240,6 +240,7 @@ impl Harness {
};
let render_command_buffer = app.draw(&device, targets, &spawner);
queue.submit(Some(render_command_buffer));
frame.present();
}
Err(_) => {}
};
Expand Down
2 changes: 1 addition & 1 deletion res/shader/body.inc.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ struct DragConstants {
abs_stop: vec2<f32>;
coll: vec2<f32>;
other: vec2<f32>; // X = wheel speed, Y = drag Z
_pad: vec2<f32>;
padding: vec2<f32>;
};

struct GlobalConstants {
Expand Down
3 changes: 2 additions & 1 deletion src/render/collision.rs
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,8 @@ impl GpuCollider {
contents: bytemuck::bytes_of(&globals),
usage: wgpu::BufferUsages::UNIFORM,
});
let locals_size = mem::size_of::<Locals>().max(wgpu::BIND_BUFFER_ALIGNMENT as usize);
//TODO: device.limits().min_uniform_buffer_offset_alignment
let locals_size = mem::size_of::<Locals>().max(256);
let locals_total_size = (settings.max_objects * locals_size) as wgpu::BufferAddress;
let local_uniforms = device.create_buffer(&wgpu::BufferDescriptor {
label: Some("Collision Locals"),
Expand Down
10 changes: 2 additions & 8 deletions src/render/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,10 +65,7 @@ impl Context {
wgpu::BindGroupLayoutEntry {
binding: 1,
visibility: wgpu::ShaderStages::all(),
ty: wgpu::BindingType::Sampler {
filtering: true,
comparison: false,
},
ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering),
count: None,
},
// GPU store
Expand Down Expand Up @@ -98,10 +95,7 @@ impl Context {
wgpu::BindGroupLayoutEntry {
binding: 4,
visibility: wgpu::ShaderStages::FRAGMENT,
ty: wgpu::BindingType::Sampler {
filtering: true,
comparison: true,
},
ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Comparison),
count: None,
},
],
Expand Down
7 changes: 2 additions & 5 deletions src/render/object.rs
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ impl Context {
primitive: wgpu::PrimitiveState {
topology: wgpu::PrimitiveTopology::TriangleList,
front_face: wgpu::FrontFace::Ccw,
clamp_depth: false,
unclipped_depth: false,
..Default::default()
},
depth_stencil: Some(wgpu::DepthStencilState {
Expand Down Expand Up @@ -261,10 +261,7 @@ impl Context {
wgpu::BindGroupLayoutEntry {
binding: 2,
visibility: wgpu::ShaderStages::VERTEX,
ty: wgpu::BindingType::Sampler {
filtering: false,
comparison: false,
},
ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::NonFiltering),
count: None,
},
],
Expand Down
15 changes: 3 additions & 12 deletions src/render/terrain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -645,30 +645,21 @@ impl Context {
wgpu::BindGroupLayoutEntry {
binding: 7,
visibility: wgpu::ShaderStages::all(),
ty: wgpu::BindingType::Sampler {
filtering: true,
comparison: false,
},
ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering),
count: None,
},
// flood sampler
wgpu::BindGroupLayoutEntry {
binding: 8,
visibility: wgpu::ShaderStages::FRAGMENT | wgpu::ShaderStages::COMPUTE,
ty: wgpu::BindingType::Sampler {
filtering: true,
comparison: false,
},
ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering),
count: None,
},
// table sampler
wgpu::BindGroupLayoutEntry {
binding: 9,
visibility: wgpu::ShaderStages::FRAGMENT,
ty: wgpu::BindingType::Sampler {
filtering: true,
comparison: false,
},
ty: wgpu::BindingType::Sampler(wgpu::SamplerBindingType::Filtering),
count: None,
},
],
Expand Down

0 comments on commit 10e8e6b

Please sign in to comment.