Skip to content

Commit 945728e

Browse files
committed
chore: wgpu 0.14
Signed-off-by: Alec Goncharow <[email protected]>
1 parent cdf6830 commit 945728e

File tree

13 files changed

+858
-501
lines changed

13 files changed

+858
-501
lines changed

Cargo.lock

Lines changed: 789 additions & 455 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ members = [
66
"game-client",
77
"atlas",
88
"server",
9+
"mostly-harmless",
910
]
1011

1112
[profile.release]

atlas/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,5 +16,5 @@ bitflags = "1.3"
1616
static_assertions = "1.1.0"
1717

1818
[dependencies.wgpu]
19-
version = "0.12"
19+
version = "0.14"
2020
features = ["spirv"]

game-client/assets/shaders/shaded.vert

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,21 @@ layout(location=3) out vec4 v_camera_space;
3939
layout(location=4) out vec3 v_cascade_blend;
4040
layout(location=5) out vec4 v_cascade_coord_0;
4141

42+
43+
// out gl_PerVertex {
44+
//vec4 gl_Position;
45+
//float gl_PointSize;
46+
//float gl_ClipDistance[1];
47+
//};
48+
4249
const float min_bias = 0.005;
4350

4451
void main() {
4552
vec4 world_pos = entity.model * vec4(a_position, 1.0);
4653
// this is used so reflection passes only draw above water and
4754
// refraction passes only draw below the water
48-
gl_ClipDistance[0] = dot(world_pos, clip.plane);
55+
// gl_ClipDistance[0] = dot(world_pos, clip.plane);
56+
4957

5058
//
5159
// compute Lambertian diffuse term

game-client/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use hermes::tokio;
4242

4343
use pantheon::wgpu;
4444

45-
const PRESENT_MODE: wgpu::PresentMode = wgpu::PresentMode::Immediate;
45+
const PRESENT_MODE: wgpu::PresentMode = wgpu::PresentMode::AutoNoVsync;
4646

4747
// tracing
4848
use std::fs::File;

pantheon/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ resolver = "2"
1313
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1414

1515
[dependencies]
16-
winit = "0.26"
16+
winit = "0.27"
1717
futures = "0.3"
1818
bytemuck = "1.4"
1919
image = "0.23"
@@ -26,7 +26,7 @@ bitflags = "1.3"
2626
smallvec = "1.8"
2727

2828
[dependencies.wgpu]
29-
version = "0.12"
29+
version = "0.14"
3030
features = ["spirv"]
3131

3232
[dependencies.bumpalo]

pantheon/src/context.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
use std::path::PathBuf;
2+
use std::error::Error;
23

34
use crate::graphics;
45
use crate::graphics::mode::PolygonMode;
@@ -53,8 +54,13 @@ impl<'a, 'winit> Context<'a> {
5354
}))
5455
.unwrap();
5556

57+
58+
// @TODO lets write some checks here to validate the adapter supports the requested feature
59+
// and limits, and if not, let's use those.
60+
5661
println!("[adapter.backend] {:#?}", adapter.get_info().backend);
5762
println!("[adapter.features] {:#?}", adapter.features());
63+
println!("[adapter.limits] {:#?}", adapter.limits());
5864

5965
let mut features = wgpu::Features::empty();
6066
// @TODO need to wrap this so that non Vulkan/DX12 don't offer multiple pipelines
@@ -72,15 +78,16 @@ impl<'a, 'winit> Context<'a> {
7278
features,
7379
limits: wgpu::Limits {
7480
/// AMD pls https://www.khronos.org/registry/vulkan/specs/1.1/html/vkspec.html#limits-minmax
75-
max_push_constant_size: 256,
81+
max_push_constant_size: 128,
7682
..wgpu::Limits::default()
7783
},
7884
},
7985
None, // Trace path
8086
)) {
8187
Ok(stuff) => stuff,
8288
Err(e) => {
83-
eprintln!("[request_device] {:#?}", e);
89+
eprintln!("[request_device_error] requesting fallback device");
90+
eprintln!("[request_device_error] WARNING: running with no additional features");
8491
block_on(adapter.request_device(
8592
&wgpu::DeviceDescriptor {
8693
label: Some("Fallback Device"),
@@ -96,7 +103,8 @@ impl<'a, 'winit> Context<'a> {
96103

97104
let surface_config = wgpu::SurfaceConfiguration {
98105
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
99-
format: surface.get_preferred_format(&adapter).unwrap(),
106+
format: surface.get_supported_formats(&adapter)[0],
107+
alpha_mode: surface.get_supported_alpha_modes(&adapter)[0],
100108
width: size.width,
101109
height: size.height,
102110
present_mode,
@@ -198,7 +206,8 @@ impl<'a, 'winit> Context<'a> {
198206
let size = self.window.inner_size();
199207
self.surface_config = wgpu::SurfaceConfiguration {
200208
usage: wgpu::TextureUsages::RENDER_ATTACHMENT,
201-
format: self.surface.get_preferred_format(&self.adapter).unwrap(),
209+
format: self.surface.get_supported_formats(&self.adapter)[0],
210+
alpha_mode: self.surface.get_supported_alpha_modes(&self.adapter)[0],
202211
width: size.width,
203212
height: size.height,
204213
present_mode: self.surface_config.present_mode,

pantheon/src/event.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,11 @@ where
106106
#[cfg(target_os = "macos")]
107107
let mut wait = false;
108108

109+
println!("[pantheon] entering main event loop");
109110
events_loop.run(move |event, _, control_flow| {
110111
let _event_span = span!(Level::DEBUG, "event").entered();
111112
*control_flow = ControlFlow::Poll;
112113
ctx.process_event(&event);
113-
114114
match event {
115115
Event::WindowEvent { event, .. } => match event {
116116
WindowEvent::Resized(logical_size) => {

pantheon/src/graphics/pipeline.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ impl<'a> PipelineContext<'a> {
3636
shader_ctx: &ShaderContext,
3737
layouts: &[&wgpu::BindGroupLayout],
3838
device: &wgpu::Device,
39-
targets: Option<&Vec<wgpu::ColorTargetState>>,
39+
targets: &[Option<wgpu::ColorTargetState>],
4040
) -> [wgpu::RenderPipeline; 15] {
4141
let mut pipelines: [MaybeUninit<wgpu::RenderPipeline>; MAX_PIPELINES] =
4242
unsafe { MaybeUninit::uninit().assume_init() };
@@ -68,7 +68,7 @@ impl<'a> PipelineContext<'a> {
6868
// 2.
6969
module: &fs_module,
7070
entry_point: "main",
71-
targets: &targets.expect("nice one"),
71+
targets,
7272
})
7373
} else {
7474
None

pantheon/src/graphics/renderer.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,19 +56,20 @@ impl GraphicsContext {
5656
encoder.push_debug_group(pass.label);
5757

5858
let attachment;
59-
let color_attachments: &[wgpu::RenderPassColorAttachment] =
59+
60+
let color_attachments: &[Option<wgpu::RenderPassColorAttachment>] =
6061
if let Some(ops) = pass.color_attachment_ops {
6162
let attach_view = if let Some(handle) = &pass.color_attachment_view_handle {
6263
// @TODO @FIXME this should be it's own view, no fetching should be needed
6364
&wrangler.get_texture(handle).view
6465
} else {
6566
view
6667
};
67-
attachment = [wgpu::RenderPassColorAttachment {
68+
attachment = [Some(wgpu::RenderPassColorAttachment {
6869
view: attach_view,
6970
resolve_target: None,
7071
ops,
71-
}];
72+
})];
7273
&attachment
7374
} else {
7475
&[]

0 commit comments

Comments
 (0)