Skip to content

Commit 43e8a15

Browse files
zicklagcart
andcommitted
Upgrade to wgpu 0.11 (#2933)
Upgrades both the old and new renderer to wgpu 0.11 (and naga 0.7). This builds on @zicklag's work here #2556. Co-authored-by: Carter Anderson <[email protected]>
1 parent 40fccd2 commit 43e8a15

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+286
-267
lines changed

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ keywords = ["game", "engine", "gamedev", "graphics", "bevy"]
1414
license = "MIT OR Apache-2.0"
1515
readme = "README.md"
1616
repository = "https://github.com/bevyengine/bevy"
17+
resolver = "2"
1718

1819
[workspace]
1920
exclude = ["benches"]

crates/bevy_render/src/render_graph/base.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::{
77
LoadOp, Operations, PassDescriptor, RenderPassColorAttachment,
88
RenderPassDepthStencilAttachment, TextureAttachment,
99
},
10-
texture::{Extent3d, TextureDescriptor, TextureDimension, TextureFormat, TextureUsage},
10+
texture::{Extent3d, TextureDescriptor, TextureDimension, TextureFormat, TextureUsages},
1111
Color,
1212
};
1313
use bevy_ecs::{reflect::ReflectComponent, world::World};
@@ -126,7 +126,7 @@ pub(crate) fn add_base_graph(config: &BaseRenderGraphConfig, world: &mut World)
126126
dimension: TextureDimension::D2,
127127
format: TextureFormat::Depth32Float, /* PERF: vulkan docs recommend using 24
128128
* bit depth for better performance */
129-
usage: TextureUsage::OUTPUT_ATTACHMENT,
129+
usage: TextureUsages::OUTPUT_ATTACHMENT,
130130
},
131131
),
132132
);
@@ -220,7 +220,7 @@ pub(crate) fn add_base_graph(config: &BaseRenderGraphConfig, world: &mut World)
220220
sample_count: msaa.samples,
221221
dimension: TextureDimension::D2,
222222
format: TextureFormat::default(),
223-
usage: TextureUsage::OUTPUT_ATTACHMENT,
223+
usage: TextureUsages::OUTPUT_ATTACHMENT,
224224
},
225225
),
226226
);

crates/bevy_render/src/render_graph/nodes/window_swapchain_node.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ impl Node for WindowSwapChainNode {
5252

5353
let render_resource_context = render_context.resources_mut();
5454

55-
// create window swapchain when window is resized or created
55+
// reconfigure surface window is resized or created
5656
if self
5757
.window_created_event_reader
5858
.iter(window_created_events)
@@ -62,10 +62,10 @@ impl Node for WindowSwapChainNode {
6262
.iter(window_resized_events)
6363
.any(|e| e.id == window.id())
6464
{
65-
render_resource_context.create_swap_chain(window);
65+
render_resource_context.configure_surface(window);
6666
}
6767

68-
let swap_chain_texture = render_resource_context.next_swap_chain_texture(window);
68+
let swap_chain_texture = render_resource_context.next_surface_frame(window);
6969
output.set(
7070
WINDOW_TEXTURE,
7171
RenderResourceId::Texture(swap_chain_texture),

crates/bevy_render/src/renderer/headless_render_resource_context.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ impl HeadlessRenderResourceContext {
3131
}
3232

3333
impl RenderResourceContext for HeadlessRenderResourceContext {
34-
fn create_swap_chain(&self, _window: &Window) {}
34+
fn configure_surface(&self, _window: &Window) {}
3535

36-
fn next_swap_chain_texture(&self, _window: &Window) -> TextureId {
36+
fn next_surface_frame(&self, _window: &Window) -> TextureId {
3737
TextureId::new()
3838
}
3939

40-
fn drop_swap_chain_texture(&self, _render_resource: TextureId) {}
40+
fn drop_surface_frame(&self, _render_resource: TextureId) {}
4141

42-
fn drop_all_swap_chain_textures(&self) {}
42+
fn drop_all_surface_frames(&self) {}
4343

4444
fn create_sampler(&self, _sampler_descriptor: &SamplerDescriptor) -> SamplerId {
4545
SamplerId::new()

crates/bevy_render/src/renderer/render_resource_context.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ use downcast_rs::{impl_downcast, Downcast};
1212
use std::ops::Range;
1313

1414
pub trait RenderResourceContext: Downcast + Send + Sync + 'static {
15-
fn create_swap_chain(&self, window: &Window);
16-
fn next_swap_chain_texture(&self, window: &Window) -> TextureId;
17-
fn drop_swap_chain_texture(&self, resource: TextureId);
18-
fn drop_all_swap_chain_textures(&self);
15+
fn configure_surface(&self, window: &Window);
16+
fn next_surface_frame(&self, window: &Window) -> TextureId;
17+
fn drop_surface_frame(&self, resource: TextureId);
18+
fn drop_all_surface_frames(&self);
1919
fn create_sampler(&self, sampler_descriptor: &SamplerDescriptor) -> SamplerId;
2020
fn create_texture(&self, texture_descriptor: TextureDescriptor) -> TextureId;
2121
fn create_buffer(&self, buffer_info: BufferInfo) -> BufferId;

crates/bevy_render/src/shader/shader.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,9 @@ pub fn glsl_to_spirv(
106106
impl Into<shaderc::ShaderKind> for ShaderStage {
107107
fn into(self) -> shaderc::ShaderKind {
108108
match self {
109-
ShaderStage::Vertex => shaderc::ShaderKind::Vertex,
110-
ShaderStage::Fragment => shaderc::ShaderKind::Fragment,
111-
ShaderStage::Compute => shaderc::ShaderKind::Compute,
109+
ShaderStages::VERTEX => shaderc::ShaderKind::Vertex,
110+
ShaderStages::FRAGMENT => shaderc::ShaderKind::Fragment,
111+
ShaderStages::COMPUTE => shaderc::ShaderKind::Compute,
112112
}
113113
}
114114
}

crates/bevy_render/src/texture/texture_descriptor.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use super::{Extent3d, Texture, TextureDimension, TextureFormat, TextureUsage};
1+
use super::{Extent3d, Texture, TextureDimension, TextureFormat, TextureUsages};
22

33
/// Describes a texture
44
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
@@ -8,7 +8,7 @@ pub struct TextureDescriptor {
88
pub sample_count: u32,
99
pub dimension: TextureDimension,
1010
pub format: TextureFormat,
11-
pub usage: TextureUsage,
11+
pub usage: TextureUsages,
1212
}
1313

1414
impl From<&Texture> for TextureDescriptor {
@@ -19,7 +19,7 @@ impl From<&Texture> for TextureDescriptor {
1919
sample_count: 1,
2020
dimension: texture.dimension,
2121
format: texture.format,
22-
usage: TextureUsage::SAMPLED | TextureUsage::COPY_DST,
22+
usage: TextureUsages::SAMPLED | TextureUsages::COPY_DST,
2323
}
2424
}
2525
}
@@ -36,7 +36,7 @@ impl Default for TextureDescriptor {
3636
sample_count: 1,
3737
dimension: TextureDimension::D2,
3838
format: TextureFormat::Rgba8UnormSrgb,
39-
usage: TextureUsage::SAMPLED | TextureUsage::COPY_DST,
39+
usage: TextureUsages::SAMPLED | TextureUsages::COPY_DST,
4040
}
4141
}
4242
}

crates/bevy_render/src/texture/texture_dimension.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ impl Default for TextureFormat {
276276

277277
bitflags::bitflags! {
278278
#[repr(transparent)]
279-
pub struct TextureUsage: u32 {
279+
pub struct TextureUsages: u32 {
280280
const COPY_SRC = 1;
281281
const COPY_DST = 2;
282282
const SAMPLED = 4;

crates/bevy_sprite/src/render/sprite_sheet.vert

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct Rect {
2121
vec2 end;
2222
};
2323

24-
layout(set = 1, binding = 1) buffer TextureAtlas_textures {
24+
layout(set = 1, binding = 1) readonly buffer TextureAtlas_textures {
2525
Rect[] Textures;
2626
};
2727

crates/bevy_wgpu/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ bevy_winit = { path = "../bevy_winit", optional = true, version = "0.5.0" }
2929
bevy_utils = { path = "../bevy_utils", version = "0.5.0" }
3030

3131
# other
32-
wgpu = "0.9"
32+
wgpu = { version = "0.11.0", features = ["spirv"] }
3333
futures-lite = "1.4.0"
3434
crossbeam-channel = "0.5.0"
3535
crossbeam-utils = "0.8.1"

0 commit comments

Comments
 (0)