Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump webgpu to 0.8 #1416

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions backends/conrod_vulkano/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ edition = "2018"
[dependencies]
#conrod_core = { path = "../../conrod_core", version = "0.71" }
conrod_core = "0.71"
vulkano = "0.16"
vulkano-shaders = "0.16"
vulkano = "0.22"
vulkano-shaders = "0.22"

[dev-dependencies]
#conrod_example_shared = { path = "../conrod_example_shared", version = "0.71" }
Expand All @@ -28,5 +28,5 @@ conrod_example_shared = "0.71"
conrod_winit = "0.71"
find_folder = "0.3"
image = "0.22"
vulkano-win = "0.16"
vulkano-win = "0.22"
winit = "0.19"
2 changes: 1 addition & 1 deletion backends/conrod_wgpu/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ edition = "2018"

[dependencies]
conrod_core = { path = "../../conrod_core", version = "0.72" }
wgpu = "0.7"
wgpu = "0.8"

[dev-dependencies]
conrod_example_shared = { path = "../conrod_example_shared", version = "0.72" }
Expand Down
18 changes: 9 additions & 9 deletions backends/conrod_wgpu/examples/all_winit_wgpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ fn main() {
1 => (&frame.output.view, None),
_ => (&multisampled_framebuffer, Some(&frame.output.view)),
};
let color_attachment_desc = wgpu::RenderPassColorAttachmentDescriptor {
attachment,
let color_attachment_desc = wgpu::RenderPassColorAttachment {
view: attachment,
resolve_target,
ops: wgpu::Operations {
load: wgpu::LoadOp::Clear(wgpu::Color::BLACK),
Expand Down Expand Up @@ -262,7 +262,7 @@ fn create_multisampled_framebuffer(
let multisampled_texture_extent = wgpu::Extent3d {
width: sc_desc.width,
height: sc_desc.height,
depth: 1,
depth_or_array_layers: 1,
};
let multisampled_frame_descriptor = &wgpu::TextureDescriptor {
label: Some("conrod_msaa_texture"),
Expand All @@ -288,7 +288,7 @@ fn create_logo_texture(
let logo_tex_extent = wgpu::Extent3d {
width,
height,
depth: 1,
depth_or_array_layers: 1,
};
let logo_tex = device.create_texture(&wgpu::TextureDescriptor {
label: Some("conrod_rust_logo_texture"),
Expand All @@ -305,20 +305,20 @@ fn create_logo_texture(

// Submit command for copying pixel data to the texture.
let pixel_size_bytes = 4; // Rgba8, as above.
let data_layout = wgpu::TextureDataLayout {
let data_layout = wgpu::ImageDataLayout {
offset: 0,
bytes_per_row: width * pixel_size_bytes,
rows_per_image: height,
bytes_per_row: std::num::NonZeroU32::new(width * pixel_size_bytes),
rows_per_image: std::num::NonZeroU32::new(height),
};
let texture_copy_view = wgpu::TextureCopyView {
let texture_copy_view = wgpu::ImageCopyTexture {
texture: &logo_tex,
mip_level: 0,
origin: wgpu::Origin3d::ZERO,
};
let extent = wgpu::Extent3d {
width: width,
height: height,
depth: 1,
depth_or_array_layers: 1,
};
let cmd_encoder_desc = wgpu::CommandEncoderDescriptor {
label: Some("conrod_upload_image_command_encoder"),
Expand Down
56 changes: 29 additions & 27 deletions backends/conrod_wgpu/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -456,20 +456,20 @@ impl<'a> GlyphCacheCommand<'a> {
}

/// Create the copy view ready for copying the pixel data to the texture.
pub fn buffer_copy_view<'b>(&self, buffer: &'b wgpu::Buffer) -> wgpu::BufferCopyView<'b> {
wgpu::BufferCopyView {
pub fn buffer_copy_view<'b>(&self, buffer: &'b wgpu::Buffer) -> wgpu::ImageCopyBuffer<'b> {
wgpu::ImageCopyBuffer {
buffer,
layout: wgpu::TextureDataLayout {
layout: wgpu::ImageDataLayout {
offset: 0,
bytes_per_row: self.width,
rows_per_image: self.height,
bytes_per_row: std::num::NonZeroU32::new(self.width),
rows_per_image: std::num::NonZeroU32::new(self.height),
},
}
}

/// Create the texture copy view ready for receiving the pixel data from the buffer.
pub fn texture_copy_view(&self) -> wgpu::TextureCopyView {
wgpu::TextureCopyView {
pub fn texture_copy_view(&self) -> wgpu::ImageCopyTexture {
wgpu::ImageCopyTexture {
texture: &self.glyph_cache_texture,
mip_level: 0,
origin: wgpu::Origin3d::ZERO,
Expand All @@ -489,7 +489,7 @@ impl<'a> GlyphCacheCommand<'a> {
wgpu::Extent3d {
width: self.width,
height: self.height,
depth: 1,
depth_or_array_layers: 1,
}
}

Expand All @@ -501,11 +501,11 @@ impl<'a> GlyphCacheCommand<'a> {
}

fn glyph_cache_tex_desc([width, height]: [u32; 2]) -> wgpu::TextureDescriptor<'static> {
let depth = 1;
let depth_or_array_layers = 1;
let texture_extent = wgpu::Extent3d {
width,
height,
depth,
depth_or_array_layers,
};
wgpu::TextureDescriptor {
label: Some("conrod_wgpu_glyph_cache_texture"),
Expand All @@ -521,11 +521,11 @@ fn glyph_cache_tex_desc([width, height]: [u32; 2]) -> wgpu::TextureDescriptor<'s
fn default_image_tex_desc() -> wgpu::TextureDescriptor<'static> {
let width = 64;
let height = 64;
let depth = 1;
let depth_or_array_layers = 1;
let texture_extent = wgpu::Extent3d {
width,
height,
depth,
depth_or_array_layers,
};
wgpu::TextureDescriptor {
label: Some("conrod_wgpu_image_texture"),
Expand Down Expand Up @@ -660,25 +660,25 @@ fn vertex_attrs() -> [wgpu::VertexAttribute; 4] {
[
// position
wgpu::VertexAttribute {
format: wgpu::VertexFormat::Float2,
format: wgpu::VertexFormat::Float32x2,
offset: position_offset,
shader_location: 0,
},
// tex_coords
wgpu::VertexAttribute {
format: wgpu::VertexFormat::Float2,
format: wgpu::VertexFormat::Float32x2,
offset: tex_coords_offset,
shader_location: 1,
},
// rgba
wgpu::VertexAttribute {
format: wgpu::VertexFormat::Float4,
format: wgpu::VertexFormat::Float32x4,
offset: rgba_offset,
shader_location: 2,
},
// mode
wgpu::VertexAttribute {
format: wgpu::VertexFormat::Uint,
format: wgpu::VertexFormat::Uint32,
offset: mode_offset,
shader_location: 3,
},
Expand All @@ -695,16 +695,18 @@ fn render_pipeline(
) -> wgpu::RenderPipeline {
let color_state = wgpu::ColorTargetState {
format: dst_format,
color_blend: wgpu::BlendState {
src_factor: wgpu::BlendFactor::SrcAlpha,
dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
operation: wgpu::BlendOperation::Add,
},
alpha_blend: wgpu::BlendState {
src_factor: wgpu::BlendFactor::One,
dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
operation: wgpu::BlendOperation::Add,
},
blend: Some(wgpu::BlendState {
color: wgpu::BlendComponent {
src_factor: wgpu::BlendFactor::SrcAlpha,
dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
operation: wgpu::BlendOperation::Add,
},
alpha: wgpu::BlendComponent {
src_factor: wgpu::BlendFactor::One,
dst_factor: wgpu::BlendFactor::OneMinusSrcAlpha,
operation: wgpu::BlendOperation::Add,
},
}),
write_mask: wgpu::ColorWrite::ALL,
};
let vertex_attrs = vertex_attrs();
Expand All @@ -721,7 +723,7 @@ fn render_pipeline(
let primitive_state = wgpu::PrimitiveState {
topology: wgpu::PrimitiveTopology::TriangleList,
front_face: wgpu::FrontFace::Ccw,
cull_mode: wgpu::CullMode::None,
cull_mode: None,
strip_index_format: Some(wgpu::IndexFormat::Uint16),
..Default::default()
};
Expand Down