From 7420fe580a4b778990e51bd11481839830909217 Mon Sep 17 00:00:00 2001 From: Alexandru Ene Date: Thu, 13 May 2021 02:54:59 +0100 Subject: [PATCH 1/3] Bump webgpu to 0.8 --- backends/conrod_wgpu/Cargo.toml | 2 +- .../conrod_wgpu/examples/all_winit_wgpu.rs | 18 +++--- backends/conrod_wgpu/src/lib.rs | 56 ++++++++++--------- 3 files changed, 39 insertions(+), 37 deletions(-) diff --git a/backends/conrod_wgpu/Cargo.toml b/backends/conrod_wgpu/Cargo.toml index 5603d7d5..9cdb96f3 100644 --- a/backends/conrod_wgpu/Cargo.toml +++ b/backends/conrod_wgpu/Cargo.toml @@ -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" } diff --git a/backends/conrod_wgpu/examples/all_winit_wgpu.rs b/backends/conrod_wgpu/examples/all_winit_wgpu.rs index c19ab668..709ec9fd 100644 --- a/backends/conrod_wgpu/examples/all_winit_wgpu.rs +++ b/backends/conrod_wgpu/examples/all_winit_wgpu.rs @@ -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), @@ -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"), @@ -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"), @@ -305,12 +305,12 @@ 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, @@ -318,7 +318,7 @@ fn create_logo_texture( 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"), diff --git a/backends/conrod_wgpu/src/lib.rs b/backends/conrod_wgpu/src/lib.rs index 3f941339..84d131fd 100644 --- a/backends/conrod_wgpu/src/lib.rs +++ b/backends/conrod_wgpu/src/lib.rs @@ -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, @@ -489,7 +489,7 @@ impl<'a> GlyphCacheCommand<'a> { wgpu::Extent3d { width: self.width, height: self.height, - depth: 1, + depth_or_array_layers: 1, } } @@ -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"), @@ -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"), @@ -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, }, @@ -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(); @@ -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() }; From 4aa79b23b5eecffe1d511a828a44edfe6251254a Mon Sep 17 00:00:00 2001 From: Alexandru Ene Date: Sat, 15 May 2021 17:35:01 +0100 Subject: [PATCH 2/3] Trying to fix vk build issue --- backends/conrod_vulkano/Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backends/conrod_vulkano/Cargo.toml b/backends/conrod_vulkano/Cargo.toml index e2fdd17f..03da19bc 100644 --- a/backends/conrod_vulkano/Cargo.toml +++ b/backends/conrod_vulkano/Cargo.toml @@ -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.17" +vulkano-shaders = "0.17" [dev-dependencies] #conrod_example_shared = { path = "../conrod_example_shared", version = "0.71" } @@ -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.17" winit = "0.19" From e2e413552c08f9528c8aa5e69ff1f382e228d218 Mon Sep 17 00:00:00 2001 From: Alexandru Ene Date: Sat, 15 May 2021 17:44:55 +0100 Subject: [PATCH 3/3] fix build error due to vulkano --- backends/conrod_vulkano/Cargo.toml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/backends/conrod_vulkano/Cargo.toml b/backends/conrod_vulkano/Cargo.toml index 03da19bc..65f9c040 100644 --- a/backends/conrod_vulkano/Cargo.toml +++ b/backends/conrod_vulkano/Cargo.toml @@ -18,8 +18,8 @@ edition = "2018" [dependencies] #conrod_core = { path = "../../conrod_core", version = "0.71" } conrod_core = "0.71" -vulkano = "0.17" -vulkano-shaders = "0.17" +vulkano = "0.22" +vulkano-shaders = "0.22" [dev-dependencies] #conrod_example_shared = { path = "../conrod_example_shared", version = "0.71" } @@ -28,5 +28,5 @@ conrod_example_shared = "0.71" conrod_winit = "0.71" find_folder = "0.3" image = "0.22" -vulkano-win = "0.17" +vulkano-win = "0.22" winit = "0.19"