From 3ea2c22c47d108a6c955d8cfd5f94b48a753f2c0 Mon Sep 17 00:00:00 2001 From: Andreas Reich Date: Mon, 6 Feb 2023 18:19:33 +0100 Subject: [PATCH 01/19] Fix for some minor issues in comments on some features. (#3455) --- wgpu-types/src/lib.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index 374f5f35cca..9b9eed18b7c 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -304,11 +304,9 @@ bitflags::bitflags! { /// to get the timestamp in nanoseconds. Multiple timestamps can then be diffed to get the /// time for operations between them to finish. /// - /// Due to wgpu-hal limitations, this is only supported on vulkan for now. - /// /// Supported Platforms: - /// - Vulkan (works) - /// - DX12 (works) + /// - Vulkan + /// - DX12 /// /// This is a web and native feature. const TIMESTAMP_QUERY = 1 << 7; @@ -319,11 +317,9 @@ bitflags::bitflags! { /// They must be resolved using [`CommandEncoder::resolve_query_sets`] into a buffer. /// The rules on how these resolve into buffers are detailed in the documentation for [`PipelineStatisticsTypes`]. /// - /// Due to wgpu-hal limitations, this is only supported on vulkan for now. - /// /// Supported Platforms: - /// - Vulkan (works) - /// - DX12 (works) + /// - Vulkan + /// - DX12 /// /// This is a web and native feature. const PIPELINE_STATISTICS_QUERY = 1 << 8; @@ -617,6 +613,10 @@ bitflags::bitflags! { /// /// Supported platforms: /// - Vulkan + /// - DX11 (feature level 10+) + /// - DX12 + /// - Metal (some) + /// - OpenGL (some) /// /// This is a native only feature. const SHADER_PRIMITIVE_INDEX = 1 << 36; From 238697c2da1013ff2d22cbb26731f7542a00ac0f Mon Sep 17 00:00:00 2001 From: Nathan Adams Date: Mon, 6 Feb 2023 19:53:48 +0100 Subject: [PATCH 02/19] Add MULTISAMPLE_X16 texture format feature flag where supported (#3454) --- CHANGELOG.md | 4 ++++ wgpu-core/src/device/mod.rs | 3 ++- wgpu-core/src/instance.rs | 4 ++++ wgpu-hal/src/dx12/adapter.rs | 1 + wgpu-hal/src/gles/adapter.rs | 7 ++++++- wgpu-hal/src/lib.rs | 8 +++++--- wgpu-hal/src/metal/adapter.rs | 3 +++ wgpu-hal/src/vulkan/adapter.rs | 4 ++++ wgpu-types/src/lib.rs | 11 +++++++---- wgpu/examples/msaa-line/main.rs | 4 +++- 10 files changed, 39 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f8d114831b3..00aa7f961f4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -48,6 +48,10 @@ Bottom level categories: ### Changes +#### General + +- Added `TextureFormatFeatureFlags::MULTISAMPLE_X16`. By @Dinnerbone in [#3454](https://github.com/gfx-rs/wgpu/pull/3454) + #### WebGPU - Implement `CommandEncoder::clear_buffer`. By @raphlinus in [#3426](https://github.com/gfx-rs/wgpu/pull/3426) diff --git a/wgpu-core/src/device/mod.rs b/wgpu-core/src/device/mod.rs index ea9dece925d..49e158c6645 100644 --- a/wgpu-core/src/device/mod.rs +++ b/wgpu-core/src/device/mod.rs @@ -811,7 +811,8 @@ impl Device { if !format_features.flags.intersects( wgt::TextureFormatFeatureFlags::MULTISAMPLE_X4 | wgt::TextureFormatFeatureFlags::MULTISAMPLE_X2 - | wgt::TextureFormatFeatureFlags::MULTISAMPLE_X8, + | wgt::TextureFormatFeatureFlags::MULTISAMPLE_X8 + | wgt::TextureFormatFeatureFlags::MULTISAMPLE_X16, ) { return Err(CreateTextureError::InvalidMultisampledFormat(desc.format)); } diff --git a/wgpu-core/src/instance.rs b/wgpu-core/src/instance.rs index 51c4fec9f6a..02e4b518853 100644 --- a/wgpu-core/src/instance.rs +++ b/wgpu-core/src/instance.rs @@ -265,6 +265,10 @@ impl Adapter { wgt::TextureFormatFeatureFlags::MULTISAMPLE_X8, caps.contains(Tfc::MULTISAMPLE_X8), ); + flags.set( + wgt::TextureFormatFeatureFlags::MULTISAMPLE_X16, + caps.contains(Tfc::MULTISAMPLE_X16), + ); flags.set( wgt::TextureFormatFeatureFlags::MULTISAMPLE_RESOLVE, diff --git a/wgpu-hal/src/dx12/adapter.rs b/wgpu-hal/src/dx12/adapter.rs index 1e71cce7e64..4f6f75dc7da 100644 --- a/wgpu-hal/src/dx12/adapter.rs +++ b/wgpu-hal/src/dx12/adapter.rs @@ -492,6 +492,7 @@ impl crate::Adapter for super::Adapter { set_sample_count(2, Tfc::MULTISAMPLE_X2); set_sample_count(4, Tfc::MULTISAMPLE_X4); set_sample_count(8, Tfc::MULTISAMPLE_X8); + set_sample_count(16, Tfc::MULTISAMPLE_X16); caps } diff --git a/wgpu-hal/src/gles/adapter.rs b/wgpu-hal/src/gles/adapter.rs index ccdbd564b2c..a1a4ee6ba85 100644 --- a/wgpu-hal/src/gles/adapter.rs +++ b/wgpu-hal/src/gles/adapter.rs @@ -689,7 +689,12 @@ impl crate::Adapter for super::Adapter { .lock() .get_parameter_i32(glow::MAX_SAMPLES) }; - if max_samples >= 8 { + if max_samples >= 16 { + Tfc::MULTISAMPLE_X2 + | Tfc::MULTISAMPLE_X4 + | Tfc::MULTISAMPLE_X8 + | Tfc::MULTISAMPLE_X16 + } else if max_samples >= 8 { Tfc::MULTISAMPLE_X2 | Tfc::MULTISAMPLE_X4 | Tfc::MULTISAMPLE_X8 } else if max_samples >= 4 { Tfc::MULTISAMPLE_X2 | Tfc::MULTISAMPLE_X4 diff --git a/wgpu-hal/src/lib.rs b/wgpu-hal/src/lib.rs index 9a324b82650..3178e255af3 100644 --- a/wgpu-hal/src/lib.rs +++ b/wgpu-hal/src/lib.rs @@ -622,14 +622,16 @@ bitflags!( const MULTISAMPLE_X4 = 1 << 10; /// Format can be multisampled by x8. const MULTISAMPLE_X8 = 1 << 11; + /// Format can be multisampled by x16. + const MULTISAMPLE_X16 = 1 << 12; /// Format can be used for render pass resolve targets. - const MULTISAMPLE_RESOLVE = 1 << 12; + const MULTISAMPLE_RESOLVE = 1 << 13; /// Format can be copied from. - const COPY_SRC = 1 << 13; + const COPY_SRC = 1 << 14; /// Format can be copied to. - const COPY_DST = 1 << 14; + const COPY_DST = 1 << 15; } ); diff --git a/wgpu-hal/src/metal/adapter.rs b/wgpu-hal/src/metal/adapter.rs index 26bb167c338..419d9010c6c 100644 --- a/wgpu-hal/src/metal/adapter.rs +++ b/wgpu-hal/src/metal/adapter.rs @@ -484,6 +484,9 @@ impl super::PrivateCapabilities { if device.supports_texture_sample_count(8) { sample_count_mask |= crate::TextureFormatCapabilities::MULTISAMPLE_X8; } + if device.supports_texture_sample_count(16) { + sample_count_mask |= crate::TextureFormatCapabilities::MULTISAMPLE_X16; + } let rw_texture_tier = if version.at_least((10, 13), (11, 0)) { device.read_write_texture_support() diff --git a/wgpu-hal/src/vulkan/adapter.rs b/wgpu-hal/src/vulkan/adapter.rs index 772a37b1d12..197e831ee3a 100644 --- a/wgpu-hal/src/vulkan/adapter.rs +++ b/wgpu-hal/src/vulkan/adapter.rs @@ -1525,6 +1525,10 @@ impl crate::Adapter for super::Adapter { Tfc::MULTISAMPLE_X8, sample_flags.contains(vk::SampleCountFlags::TYPE_8), ); + flags.set( + Tfc::MULTISAMPLE_X16, + sample_flags.contains(vk::SampleCountFlags::TYPE_16), + ); flags } diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index 9b9eed18b7c..d29de1a71a5 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -1716,17 +1716,19 @@ bitflags::bitflags! { const MULTISAMPLE_X4 = 1 << 2 ; /// Allows [`TextureDescriptor::sample_count`] to be `8`. const MULTISAMPLE_X8 = 1 << 3 ; + /// Allows [`TextureDescriptor::sample_count`] to be `16`. + const MULTISAMPLE_X16 = 1 << 4; /// Allows a texture of this format to back a view passed as `resolve_target` /// to a render pass for an automatic driver-implemented resolve. - const MULTISAMPLE_RESOLVE = 1 << 4; + const MULTISAMPLE_RESOLVE = 1 << 5; /// When used as a STORAGE texture, then a texture with this format can be bound with /// [`StorageTextureAccess::ReadOnly`] or [`StorageTextureAccess::ReadWrite`]. - const STORAGE_READ_WRITE = 1 << 5; + const STORAGE_READ_WRITE = 1 << 6; /// When used as a STORAGE texture, then a texture with this format can be written to with atomics. // TODO: No access flag exposed as of writing - const STORAGE_ATOMICS = 1 << 6; + const STORAGE_ATOMICS = 1 << 7; /// If not present, the texture can't be blended into the render target. - const BLENDABLE = 1 << 7; + const BLENDABLE = 1 << 8; } } @@ -1742,6 +1744,7 @@ impl TextureFormatFeatureFlags { 2 => self.contains(tfsc::MULTISAMPLE_X2), 4 => self.contains(tfsc::MULTISAMPLE_X4), 8 => self.contains(tfsc::MULTISAMPLE_X8), + 16 => self.contains(tfsc::MULTISAMPLE_X16), _ => false, } } diff --git a/wgpu/examples/msaa-line/main.rs b/wgpu/examples/msaa-line/main.rs index a5777d71f77..b0fb3d68d93 100644 --- a/wgpu/examples/msaa-line/main.rs +++ b/wgpu/examples/msaa-line/main.rs @@ -134,7 +134,9 @@ impl framework::Example for Example { let sample_flags = _adapter.get_texture_format_features(config.format).flags; let max_sample_count = { - if sample_flags.contains(wgpu::TextureFormatFeatureFlags::MULTISAMPLE_X8) { + if sample_flags.contains(wgpu::TextureFormatFeatureFlags::MULTISAMPLE_X16) { + 16 + } else if sample_flags.contains(wgpu::TextureFormatFeatureFlags::MULTISAMPLE_X8) { 8 } else if sample_flags.contains(wgpu::TextureFormatFeatureFlags::MULTISAMPLE_X4) { 4 From b1d2ec043ecdebd822cfbcd3121834b45cba1d99 Mon Sep 17 00:00:00 2001 From: Jim Blandy Date: Tue, 7 Feb 2023 13:56:00 -0800 Subject: [PATCH 03/19] Don't try to build the entire workspace on wasm32. (#3460) --- .github/workflows/publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 68bd2db25fe..08546cff10e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -27,7 +27,7 @@ jobs: run: cargo install wasm-bindgen-cli --version=0.2.83 - name: Build WebGPU examples - run: cargo build --release --target wasm32-unknown-unknown --examples + run: cargo build --package wgpu --release --target wasm32-unknown-unknown --examples - name: Generate JS bindings for WebGPU examples run: | From f1ef213bbbd07a5fa70ffc860e0439831005850e Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Wed, 8 Feb 2023 19:52:25 -0500 Subject: [PATCH 04/19] Fix CI for merge queues --- .github/workflows/ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 48f20600e2d..410ca55ac03 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,6 +5,7 @@ on: branches: ["*"] tags: [v0.*] pull_request: + merge_group: env: RUST_BACKTRACE: 1 From 49cfc88f35a6589798023025e30552825218f322 Mon Sep 17 00:00:00 2001 From: Connor Fitzgerald Date: Thu, 9 Feb 2023 10:32:27 -0500 Subject: [PATCH 05/19] [GL] Unbind Vertex Buffers After Renderpass (#3459) Closes https://github.com/gfx-rs/wgpu/issues/3457 --- wgpu-hal/src/gles/command.rs | 5 + wgpu/tests/regression/issue_3457.rs | 187 ++++++++++++++++++++++++++ wgpu/tests/regression/issue_3457.wgsl | 33 +++++ wgpu/tests/root.rs | 3 + 4 files changed, 228 insertions(+) create mode 100644 wgpu/tests/regression/issue_3457.rs create mode 100644 wgpu/tests/regression/issue_3457.wgsl diff --git a/wgpu-hal/src/gles/command.rs b/wgpu-hal/src/gles/command.rs index 7c1eb1c841a..8076a13aebe 100644 --- a/wgpu-hal/src/gles/command.rs +++ b/wgpu-hal/src/gles/command.rs @@ -620,6 +620,11 @@ impl crate::CommandEncoder for super::CommandEncoder { self.state.dirty_vbuf_mask = 0; self.state.active_first_instance = 0; self.state.color_targets.clear(); + for index in 0..self.state.vertex_attributes.len() { + self.cmd_buffer + .commands + .push(C::UnsetVertexAttribute(index as u32)); + } self.state.vertex_attributes.clear(); self.state.primitive = super::PrimitiveState::default(); } diff --git a/wgpu/tests/regression/issue_3457.rs b/wgpu/tests/regression/issue_3457.rs new file mode 100644 index 00000000000..f4359fb9373 --- /dev/null +++ b/wgpu/tests/regression/issue_3457.rs @@ -0,0 +1,187 @@ +use crate::common::{initialize_test, TestParameters}; + +use wasm_bindgen_test::wasm_bindgen_test; +use wgpu::*; + +/// The core issue here was that we weren't properly disabling vertex attributes on GL +/// when a renderpass ends. This ended up being rather tricky to test for as GL is remarkably +/// tolerant of errors. This test, with the fix not-applied, only fails on WebGL. +/// +/// We need to setup a situation where it's invalid to issue a draw call without the fix. +/// To do this we first make a renderpass using two vertex buffers and draw on it. Then we +/// submit, delete the second vertex buffer and `poll(Wait)`. Because we maintained the device, +/// the actual underlying buffer for the second vertex buffer is deleted, causing a draw call +/// that is invalid if the second attribute is still enabled. +#[wasm_bindgen_test] +#[test] +fn pass_reset_vertex_buffer() { + initialize_test(TestParameters::default(), |ctx| { + let module = ctx + .device + .create_shader_module(include_wgsl!("issue_3457.wgsl")); + + // We use two separate vertex buffers so we can delete one in between submisions + let vertex_buffer1 = ctx.device.create_buffer(&BufferDescriptor { + label: Some("vertex buffer 1"), + size: 3 * 16, + usage: BufferUsages::VERTEX, + mapped_at_creation: false, + }); + + let vertex_buffer2 = ctx.device.create_buffer(&BufferDescriptor { + label: Some("vertex buffer 2"), + size: 3 * 4, + usage: BufferUsages::VERTEX, + mapped_at_creation: false, + }); + + let pipeline_layout = ctx + .device + .create_pipeline_layout(&PipelineLayoutDescriptor { + label: Some("Pipeline Layout"), + bind_group_layouts: &[], + push_constant_ranges: &[], + }); + + let double_pipeline = ctx + .device + .create_render_pipeline(&RenderPipelineDescriptor { + label: Some("Double Pipeline"), + layout: Some(&pipeline_layout), + vertex: VertexState { + module: &module, + entry_point: "double_buffer_vert", + buffers: &[ + VertexBufferLayout { + array_stride: 16, + step_mode: VertexStepMode::Vertex, + attributes: &vertex_attr_array![0 => Float32x4], + }, + VertexBufferLayout { + array_stride: 4, + step_mode: VertexStepMode::Vertex, + attributes: &vertex_attr_array![1 => Float32], + }, + ], + }, + primitive: PrimitiveState::default(), + depth_stencil: None, + multisample: MultisampleState::default(), + fragment: Some(FragmentState { + module: &module, + entry_point: "double_buffer_frag", + targets: &[Some(ColorTargetState { + format: TextureFormat::Rgba8Unorm, + blend: None, + write_mask: ColorWrites::all(), + })], + }), + multiview: None, + }); + + let single_pipeline = ctx + .device + .create_render_pipeline(&RenderPipelineDescriptor { + label: Some("Single Pipeline"), + layout: Some(&pipeline_layout), + vertex: VertexState { + module: &module, + entry_point: "single_buffer_vert", + buffers: &[VertexBufferLayout { + array_stride: 16, + step_mode: VertexStepMode::Vertex, + attributes: &vertex_attr_array![0 => Float32x4], + }], + }, + primitive: PrimitiveState::default(), + depth_stencil: None, + multisample: MultisampleState::default(), + fragment: Some(FragmentState { + module: &module, + entry_point: "single_buffer_frag", + targets: &[Some(ColorTargetState { + format: TextureFormat::Rgba8Unorm, + blend: None, + write_mask: ColorWrites::all(), + })], + }), + multiview: None, + }); + + let view = ctx + .device + .create_texture(&TextureDescriptor { + label: Some("Render texture"), + size: Extent3d { + width: 4, + height: 4, + depth_or_array_layers: 1, + }, + mip_level_count: 1, + sample_count: 1, + dimension: TextureDimension::D2, + format: TextureFormat::Rgba8Unorm, + usage: TextureUsages::RENDER_ATTACHMENT, + view_formats: &[], + }) + .create_view(&TextureViewDescriptor::default()); + + let mut encoder1 = ctx + .device + .create_command_encoder(&CommandEncoderDescriptor::default()); + + let mut double_rpass = encoder1.begin_render_pass(&RenderPassDescriptor { + label: Some("double renderpass"), + color_attachments: &[Some(RenderPassColorAttachment { + view: &view, + resolve_target: None, + ops: Operations { + load: LoadOp::Clear(Color::BLACK), + store: false, + }, + })], + depth_stencil_attachment: None, + }); + + double_rpass.set_pipeline(&double_pipeline); + double_rpass.set_vertex_buffer(0, vertex_buffer1.slice(..)); + double_rpass.set_vertex_buffer(1, vertex_buffer2.slice(..)); + double_rpass.draw(0..3, 0..1); + + drop(double_rpass); + + // Submit the first pass using both buffers + ctx.queue.submit(Some(encoder1.finish())); + // Drop the second buffer, meaning it's invalid to use draw + // unless it's unbound. + drop(vertex_buffer2); + + // Make sure the buffers are actually deleted. + ctx.device.poll(Maintain::Wait); + + let mut encoder2 = ctx + .device + .create_command_encoder(&CommandEncoderDescriptor::default()); + + let mut single_rpass = encoder2.begin_render_pass(&RenderPassDescriptor { + label: Some("single renderpass"), + color_attachments: &[Some(RenderPassColorAttachment { + view: &view, + resolve_target: None, + ops: Operations { + load: LoadOp::Clear(Color::BLACK), + store: false, + }, + })], + depth_stencil_attachment: None, + }); + + single_rpass.set_pipeline(&single_pipeline); + single_rpass.set_vertex_buffer(0, vertex_buffer1.slice(..)); + single_rpass.draw(0..3, 0..1); + + drop(single_rpass); + + ctx.queue.submit(Some(encoder2.finish())); + }) +} diff --git a/wgpu/tests/regression/issue_3457.wgsl b/wgpu/tests/regression/issue_3457.wgsl new file mode 100644 index 00000000000..f02aaa1bb10 --- /dev/null +++ b/wgpu/tests/regression/issue_3457.wgsl @@ -0,0 +1,33 @@ +struct DoubleVertexIn { + @location(0) position: vec4, + @location(1) value: f32, +} + +struct DoubleVertexOut { + @builtin(position) position: vec4, + @location(0) value: f32, +} + +@vertex +fn double_buffer_vert(v_in: DoubleVertexIn) -> DoubleVertexOut { + return DoubleVertexOut(v_in.position, v_in.value); +} + +@fragment +fn double_buffer_frag(v_out: DoubleVertexOut) -> @location(0) vec4 { + return vec4(v_out.value); +} + +struct SingleVertexIn { + @location(0) position: vec4, +} + +@vertex +fn single_buffer_vert(v_in: SingleVertexIn) -> @builtin(position) vec4 { + return v_in.position; +} + +@fragment +fn single_buffer_frag() -> @location(0) vec4 { + return vec4(0.0); +} diff --git a/wgpu/tests/root.rs b/wgpu/tests/root.rs index a8676fb9599..277b34eb65f 100644 --- a/wgpu/tests/root.rs +++ b/wgpu/tests/root.rs @@ -3,6 +3,9 @@ use wasm_bindgen_test::wasm_bindgen_test_configure; // All files containing tests mod common; +mod regression { + mod issue_3457; +} mod buffer; mod buffer_copy; mod buffer_usages; From 4bebad706ec09f1981f16f829d7a444238dccd31 Mon Sep 17 00:00:00 2001 From: Teodor Tanasoaia <28601907+teoxoy@users.noreply.github.com> Date: Thu, 9 Feb 2023 16:33:53 +0100 Subject: [PATCH 06/19] Improve CI (#3453) --- .github/workflows/ci.yml | 99 +++++++++++------------------------ .github/workflows/cts.yml | 21 ++++---- .github/workflows/docs.yml | 27 +++++----- .github/workflows/publish.yml | 36 ++++++------- 4 files changed, 72 insertions(+), 111 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 410ca55ac03..00c08589782 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -8,8 +8,10 @@ on: merge_group: env: - RUST_BACKTRACE: 1 - RUST_VERSION: 1.64 + CARGO_INCREMENTAL: false + CARGO_TERM_COLOR: always + RUST_BACKTRACE: full + MSRV: 1.64 PKG_CONFIG_ALLOW_CROSS: 1 # allow android to work RUSTFLAGS: --cfg=web_sys_unstable_apis -D warnings RUSTDOCFLAGS: -Dwarnings @@ -92,14 +94,10 @@ jobs: - name: checkout repo uses: actions/checkout@v3 - - name: install rust ${{ env.RUST_VERSION }} - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ env.RUST_VERSION }} - target: ${{ matrix.target }} - profile: minimal - override: true - components: clippy + - name: Install MSRV toolchain + run: | + rustup toolchain install ${{ env.MSRV }} --no-self-update --profile=minimal --component clippy --target ${{ matrix.target }} + rustup default ${{ env.MSRV }} - name: disable debug shell: bash @@ -107,7 +105,6 @@ jobs: mkdir -p .cargo echo """ [profile.dev] - incremental = false debug = false" >> .cargo/config.toml - name: caching @@ -142,8 +139,7 @@ jobs: set -e # build for Emscripten/WebGL - cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-hal \ - --no-default-features --features webgl,emscripten + cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-hal --no-default-features --features webgl,emscripten # build cube example cargo clippy --target ${{ matrix.target }} --example cube --features webgl,emscripten @@ -164,8 +160,7 @@ jobs: # (But watch out for backend-selection features in wgpu-core; some of # those only build on the right platforms.) cargo clippy --target ${{ matrix.target }} -p wgpu -p wgpu-info -p player --tests --all-features - cargo clippy --target ${{ matrix.target }} -p wgpu-core --tests \ - --features="portable_features" + cargo clippy --target ${{ matrix.target }} -p wgpu-core --tests --features="portable_features" # build docs # (Watch out for backend-selection features in wgpu-core; some of @@ -180,19 +175,14 @@ jobs: - name: checkout repo uses: actions/checkout@v3 - - name: install rust stable - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - override: true - - - name: install wasm-pack # install from fork until this is merged: https://github.com/rustwasm/wasm-pack/pull/1185 - run: | - # replace with "install wasm-pack action", which doesn't work for this project because of https://github.com/rustwasm/wasm-pack/issues/1180 - # - name: install wasm-pack - # uses: jetli/wasm-pack-action@v0.4.0 - cargo install --git https://github.com/haraldreingruber/wasm-pack wasm-pack + # TODO: replace with this once there is a release containing this PR: + # https://github.com/rustwasm/wasm-pack/pull/1185 + # - name: Install wasm-pack + # uses: taiki-e/install-action@v2 + # with: + # tool: wasm-pack + - name: install wasm-pack + run: cargo install --git https://github.com/rustwasm/wasm-pack --rev e1010233b0ce304f42cda59962254bf30ae97c3e wasm-pack - name: execute tests run: | @@ -221,18 +211,10 @@ jobs: - name: checkout repo uses: actions/checkout@v3 - - name: install rust stable - uses: actions-rs/toolchain@v1 + - name: Install cargo-nextest and cargo-llvm-cov + uses: taiki-e/install-action@v2 with: - toolchain: nightly - profile: minimal - override: true - components: llvm-tools-preview - - - name: latest cargo-nextest - uses: taiki-e/install-action@nextest - - name: install cargo-llvm-cov - uses: taiki-e/install-action@cargo-llvm-cov + tool: cargo-nextest,cargo-llvm-cov - name: install swiftshader if: matrix.os == 'ubuntu-22.04' @@ -266,7 +248,6 @@ jobs: mkdir -p .cargo echo """ [profile.dev] - incremental = false debug = 1" >> .cargo/config.toml - name: caching @@ -279,7 +260,7 @@ jobs: run: | set -e - cargo llvm-cov run --bin wgpu-info --no-report + cargo llvm-cov --no-cfg-coverage run --bin wgpu-info --no-report - name: run tests shell: bash @@ -288,7 +269,7 @@ jobs: for backend in ${{ matrix.backends }}; do echo "======= NATIVE TESTS $backend ======"; - WGPU_BACKEND=$backend cargo llvm-cov nextest -p wgpu -p wgpu-types -p wgpu-hal -p wgpu-core -p player --no-fail-fast --no-report + WGPU_BACKEND=$backend cargo llvm-cov --no-cfg-coverage nextest -p wgpu -p wgpu-types -p wgpu-hal -p wgpu-core -p player --no-fail-fast --no-report done - name: generate coverage report @@ -305,26 +286,18 @@ jobs: doctest: name: Doctest - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest steps: - name: checkout repo uses: actions/checkout@v3 - - name: install rust stable - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - profile: minimal - override: true - - name: disable debug shell: bash run: | mkdir -p .cargo echo """ [profile.dev] - incremental = false debug = 1" >> .cargo/config.toml - name: caching @@ -346,14 +319,6 @@ jobs: - name: checkout repo uses: actions/checkout@v3 - - name: install rust - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - components: rustfmt - - name: run rustfmt run: | cargo fmt -- --check @@ -365,13 +330,10 @@ jobs: - name: checkout repo uses: actions/checkout@v3 - - name: install rust ${{ env.RUST_VERSION }} - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: ${{ env.RUST_VERSION }} - override: true - components: clippy + - name: Install MSRV toolchain + run: | + rustup toolchain install ${{ env.MSRV }} --no-self-update --profile=minimal --component clippy + rustup default ${{ env.MSRV }} - name: disable debug shell: bash @@ -379,7 +341,6 @@ jobs: mkdir -p .cargo echo """ [profile.dev] - incremental = false debug = 1" >> .cargo/config.toml - name: caching @@ -403,7 +364,7 @@ jobs: with: command: check advisories arguments: --all-features --workspace - rust-version: ${{ env.RUST_VERSION }} + rust-version: ${{ env.MSRV }} cargo-deny-check-rest: name: "Run `cargo deny check`" @@ -417,4 +378,4 @@ jobs: with: command: check bans licenses sources arguments: --all-features --workspace - rust-version: ${{ env.RUST_VERSION }} + rust-version: ${{ env.MSRV }} diff --git a/.github/workflows/cts.yml b/.github/workflows/cts.yml index 332fc7fb6db..58fbc5e89d3 100644 --- a/.github/workflows/cts.yml +++ b/.github/workflows/cts.yml @@ -8,8 +8,10 @@ on: types: [labeled, opened, synchronize] env: - RUST_BACKTRACE: 1 - RUST_VERSION: 1.64 + CARGO_INCREMENTAL: false + CARGO_TERM_COLOR: always + RUST_BACKTRACE: full + MSRV: 1.64 jobs: cts: @@ -37,7 +39,7 @@ jobs: steps: - name: checkout repo - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: path: wgpu @@ -47,16 +49,13 @@ jobs: cd cts git checkout $(cat ../wgpu/cts_runner/revision.txt) - - name: install rust ${{ env.RUST_VERSION }} - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ env.RUST_VERSION }} - target: ${{ matrix.target }} - profile: minimal - override: true + - name: Install MSRV toolchain + run: | + rustup toolchain install ${{ env.MSRV }} --no-self-update --profile=minimal --target ${{ matrix.target }} + rustup default ${{ env.MSRV }} - name: caching - uses: Swatinem/rust-cache@v1 + uses: Swatinem/rust-cache@v2 with: key: cts-a # suffix for cache busting working-directory: wgpu/cts_runner diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 8e2c9885db0..7a6986a4a84 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -5,22 +5,23 @@ on: branches: - master +env: + CARGO_INCREMENTAL: false + CARGO_TERM_COLOR: always + RUST_BACKTRACE: full + jobs: build: runs-on: ubuntu-latest steps: - name: Checkout the code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: persist-credentials: false - - name: Install latest nightly - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - override: true - continue-on-error: true + - name: Install nightly toolchain + run: rustup toolchain install nightly --no-self-update --profile=minimal - name: Add EGL for OpenGL run: | @@ -38,10 +39,10 @@ jobs: if: ${{ failure() }} - name: Deploy the docs - uses: JamesIves/github-pages-deploy-action@releases/v3 + uses: JamesIves/github-pages-deploy-action@v4.4.1 with: - ACCESS_TOKEN: ${{ secrets.WEB_DEPLOY }} - FOLDER: target/doc - REPOSITORY_NAME: gfx-rs/wgpu-rs.github.io - BRANCH: master - TARGET_FOLDER: doc + token: ${{ secrets.WEB_DEPLOY }} + folder: target/doc + repository-name: gfx-rs/wgpu-rs.github.io + branch: master + target-folder: doc diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 08546cff10e..20adf8ccd7d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -6,6 +6,9 @@ on: - gecko env: + CARGO_INCREMENTAL: false + CARGO_TERM_COLOR: always + RUST_BACKTRACE: full RUSTFLAGS: --cfg=web_sys_unstable_apis jobs: @@ -13,15 +16,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout the code - uses: actions/checkout@v2 + uses: actions/checkout@v3 with: persist-credentials: false - - name: Install Rust WASM toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: wasm32-unknown-unknown + - name: Install Rust WASM target + run: rustup target add wasm32-unknown-unknown - name: Install wasm-bindgen-cli run: cargo install wasm-bindgen-cli --version=0.2.83 @@ -37,13 +37,13 @@ jobs: done - name: Deploy WebGPU examples - uses: JamesIves/github-pages-deploy-action@releases/v3 + uses: JamesIves/github-pages-deploy-action@v4.4.1 with: - ACCESS_TOKEN: ${{ secrets.WEB_DEPLOY }} - FOLDER: target/generated-gpu - REPOSITORY_NAME: gfx-rs/wgpu-rs.github.io - BRANCH: master - TARGET_FOLDER: examples-gpu/wasm + token: ${{ secrets.WEB_DEPLOY }} + folder: target/generated-gpu + repository-name: gfx-rs/wgpu-rs.github.io + branch: master + target-folder: examples-gpu/wasm - name: Clean the build run: cargo clean @@ -59,10 +59,10 @@ jobs: done - name: Deploy WebGL examples - uses: JamesIves/github-pages-deploy-action@releases/v3 + uses: JamesIves/github-pages-deploy-action@v4.4.1 with: - ACCESS_TOKEN: ${{ secrets.WEB_DEPLOY }} - FOLDER: target/generated-gl - REPOSITORY_NAME: gfx-rs/wgpu-rs.github.io - BRANCH: master - TARGET_FOLDER: examples-gl/wasm + token: ${{ secrets.WEB_DEPLOY }} + folder: target/generated-gl + repository-name: gfx-rs/wgpu-rs.github.io + branch: master + target-folder: examples-gl/wasm From 0d5b4841d5a04068396cf9ade1bbb525c7b944aa Mon Sep 17 00:00:00 2001 From: Jinlei Li Date: Fri, 10 Feb 2023 01:14:15 +0800 Subject: [PATCH 07/19] web: reimplement `adapter|device_features` (#3428) --- CHANGELOG.md | 1 + Cargo.lock | 67 +++++++++++++++++++++-------------------- Cargo.toml | 10 +++--- wgpu-hal/Cargo.toml | 8 ++--- wgpu/src/backend/web.rs | 47 ++++++++--------------------- 5 files changed, 57 insertions(+), 76 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 00aa7f961f4..f9d1283a292 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,7 @@ Bottom level categories: - Implement `CommandEncoder::clear_buffer`. By @raphlinus in [#3426](https://github.com/gfx-rs/wgpu/pull/3426) - Implement the new checks for readonly stencils. By @JCapucho in [#3443](https://github.com/gfx-rs/wgpu/pull/3443) +- Reimplement `adapter|device_features`. By @jinleili in [#3428](https://github.com/gfx-rs/wgpu/pull/3428) #### Vulkan diff --git a/Cargo.lock b/Cargo.lock index 994591d810c..31ca11d4e8e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -260,9 +260,9 @@ dependencies = [ [[package]] name = "cargo-run-wasm" -version = "0.2.0" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "611b811fad83eebfcdcf47ae1e425c82d1249608bc571d537448d706be08cf27" +checksum = "13b0eb1208f33599c1fea41f2f6a09bb7e27341acb79aa92e6d6847cc60a1828" dependencies = [ "devserver_lib", "pico-args", @@ -1314,9 +1314,9 @@ checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" [[package]] name = "js-sys" -version = "0.3.60" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49409df3e3bf0856b916e2ceaca09ee28e6871cf7d9ce97a692cacfdb2a25a47" +checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" dependencies = [ "wasm-bindgen", ] @@ -2672,9 +2672,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eaf9f5aceeec8be17c128b2e93e031fb8a4d469bb9c4ae2d7dc1888b26887268" +checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -2682,9 +2682,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8ffb332579b0557b52d268b91feab8df3615f265d5270fec2a8c95b17c1142" +checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" dependencies = [ "bumpalo", "log", @@ -2697,9 +2697,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-cli-support" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "03f35e0387a2c787ca5ee299bfb4259352b2a2184b406f8ee9f978c3c4671645" +checksum = "9d4780c659b883a19ddb7ced365db19f7f45cd182d832ee14de2b7ef52e88a9f" dependencies = [ "anyhow", "base64 0.9.3", @@ -2707,6 +2707,7 @@ dependencies = [ "rustc-demangle", "serde_json", "tempfile", + "unicode-ident", "walrus", "wasm-bindgen-externref-xform", "wasm-bindgen-multi-value-xform", @@ -2721,9 +2722,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-externref-xform" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d010a32a516a793adbea5835eab6f736d11c0cdd10ebe0c762c420f67510244" +checksum = "1d154c3843bf3b635b602ad41b56f505f8f1a25f8a0133fca4bbd0918d74efdc" dependencies = [ "anyhow", "walrus", @@ -2731,9 +2732,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-futures" -version = "0.4.33" +version = "0.4.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23639446165ca5a5de86ae1d8896b737ae80319560fbaa4c2887b7da6e7ebd7d" +checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" dependencies = [ "cfg-if", "js-sys", @@ -2743,9 +2744,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "052be0f94026e6cbc75cdefc9bae13fd6052cdcaf532fa6c45e7ae33a1e6c810" +checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2753,9 +2754,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07bc0c051dc5f23e307b13285f9d75df86bfdf816c5721e573dec1f9b8aa193c" +checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" dependencies = [ "proc-macro2", "quote", @@ -2766,9 +2767,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-multi-value-xform" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78b8c8d5dcc451b7e6a9c98d8fd966ff768a1e8f8afb270a829780086f2885ac" +checksum = "c00a577fbd4be358ef8095432189b5c2e6b6e71f5081797c2032572f77d65d26" dependencies = [ "anyhow", "walrus", @@ -2776,9 +2777,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1c38c045535d93ec4f0b4defec448e4291638ee608530863b1e2ba115d4fff7f" +checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" [[package]] name = "wasm-bindgen-test" @@ -2806,9 +2807,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-threads-xform" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d10f9246c4daa911283a7096fc3be9f1fab9e3e36400478a4ab8d7056701420" +checksum = "0aa93941bae037b7b4fac4ecfc132294b828036c5990a806d0e6fd9284297d94" dependencies = [ "anyhow", "walrus", @@ -2817,9 +2818,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-wasm-conventions" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4a5ab217f12f73b7c3ff23cbbbb5d36f7ee97dd65bb0be44beebda887df9002" +checksum = "d8f5de325048d945c90600fdf66b13521f3340d85971287775c36aa99c04466b" dependencies = [ "anyhow", "walrus", @@ -2827,9 +2828,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-wasm-interpreter" -version = "0.2.83" +version = "0.2.84" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fbb6c773b486889b7c1211d27a7a08eebaf54ec4269380266cadf69e269cd91" +checksum = "f695df44962e3a107436282232a2daa185b8453c16be8ddfb637cd2601f31128" dependencies = [ "anyhow", "log", @@ -2943,9 +2944,9 @@ dependencies = [ [[package]] name = "web-sys" -version = "0.3.60" +version = "0.3.61" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bcda906d8be16e728fd5adc5b729afad4e444e106ab28cd1c7256e54fa61510f" +checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" dependencies = [ "js-sys", "wasm-bindgen", @@ -2973,7 +2974,7 @@ dependencies = [ "nanorand", "noise", "obj", - "parking_lot 0.11.2", + "parking_lot 0.12.1", "png", "pollster", "profiling", @@ -3002,7 +3003,7 @@ dependencies = [ "fxhash", "log", "naga", - "parking_lot 0.11.2", + "parking_lot 0.12.1", "profiling", "raw-window-handle 0.5.0", "ron", @@ -3043,7 +3044,7 @@ dependencies = [ "metal", "naga", "objc", - "parking_lot 0.11.2", + "parking_lot 0.12.1", "profiling", "range-alloc", "raw-window-handle 0.5.0", diff --git a/Cargo.toml b/Cargo.toml index b91fc44e692..3d4f024312c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,7 +51,7 @@ async-executor = "1.0" bitflags = "1" bit-vec = "0.6" bytemuck = "1.4" -cargo-run-wasm = "0.2.0" +cargo-run-wasm = "0.3.0" cfg_aliases = "0.1" cfg-if = "1" codespan-reporting = "0.11" @@ -114,11 +114,11 @@ glutin = "0.29.1" # wasm32 dependencies console_error_panic_hook = "0.1.7" console_log = "0.2" -js-sys = "0.3.60" -wasm-bindgen = "0.2.83" -wasm-bindgen-futures = "0.4.33" +js-sys = "0.3.61" +wasm-bindgen = "0.2.84" +wasm-bindgen-futures = "0.4.34" wasm-bindgen-test = "0.3" -web-sys = "0.3.60" +web-sys = "0.3.61" # deno dependencies deno_console = "0.84.0" diff --git a/wgpu-hal/Cargo.toml b/wgpu-hal/Cargo.toml index fffc1944a94..4444f0577b3 100644 --- a/wgpu-hal/Cargo.toml +++ b/wgpu-hal/Cargo.toml @@ -102,9 +102,9 @@ objc = "0.2.5" core-graphics-types = "0.1" [target.'cfg(all(target_arch = "wasm32", not(target_os = "emscripten")))'.dependencies] -wasm-bindgen = "0.2.83" -web-sys = { version = "0.3.60", features = ["Window", "HtmlCanvasElement", "WebGl2RenderingContext", "OffscreenCanvas"] } -js-sys = "0.3.60" +wasm-bindgen = "0.2.84" +web-sys = { version = "0.3.61", features = ["Window", "HtmlCanvasElement", "WebGl2RenderingContext", "OffscreenCanvas"] } +js-sys = "0.3.61" [target.'cfg(unix)'.dependencies] libc = "0.2" @@ -127,7 +127,7 @@ features = ["wgsl-in"] [dev-dependencies] env_logger = "0.9" -winit = "0.27.1" # for "halmark" example +winit = "0.27.1" # for "halmark" example [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] glutin = "0.29.1" # for "gles" example diff --git a/wgpu/src/backend/web.rs b/wgpu/src/backend/web.rs index fee2819c956..f3b9383610c 100644 --- a/wgpu/src/backend/web.rs +++ b/wgpu/src/backend/web.rs @@ -585,6 +585,17 @@ const FEATURES_MAPPING: [(wgt::Features, web_sys::GpuFeatureName); 8] = [ ), ]; +fn map_wgt_features(supported_features: web_sys::GpuSupportedFeatures) -> wgt::Features { + let mut features = wgt::Features::empty(); + for (wgpu_feat, web_feat) in FEATURES_MAPPING { + match wasm_bindgen::JsValue::from(web_feat).as_string() { + Some(value) if supported_features.has(&value) => features |= wgpu_feat, + _ => {} + } + } + features +} + type JsFutureResult = Result; fn future_request_adapter(result: JsFutureResult) -> Option<(Identified, ())> { @@ -931,23 +942,7 @@ impl crate::context::Context for Context { adapter: &Self::AdapterId, _adapter_data: &Self::AdapterData, ) -> wgt::Features { - let features = adapter.0.features(); - - let features_set: js_sys::Set = features - .dyn_into() - .expect("adapter.features() is not setlike"); - - let mut features = wgt::Features::empty(); - - for (wgpu_feat, web_feat) in FEATURES_MAPPING { - let value = wasm_bindgen::JsValue::from(web_feat); - - if features_set.has(&value) { - features |= wgpu_feat; - } - } - - features + map_wgt_features(adapter.0.features()) } fn adapter_limits( @@ -1112,23 +1107,7 @@ impl crate::context::Context for Context { device: &Self::DeviceId, _device_data: &Self::DeviceData, ) -> wgt::Features { - let features = device.0.features(); - - let features_set: js_sys::Set = features - .dyn_into() - .expect("device.features() is not setlike"); - - let mut features = wgt::Features::empty(); - - for (wgpu_feat, web_feat) in FEATURES_MAPPING { - let value = wasm_bindgen::JsValue::from(web_feat); - - if features_set.has(&value) { - features |= wgpu_feat; - } - } - - features + map_wgt_features(device.0.features()) } fn device_limits( From 4593f951dd7572f609e50e2c9770bca9a5ceb587 Mon Sep 17 00:00:00 2001 From: Jinlei Li Date: Fri, 10 Feb 2023 02:00:42 +0800 Subject: [PATCH 08/19] vk: fix surface view formats validation error (#3432) Co-authored-by: Connor Fitzgerald --- CHANGELOG.md | 1 + wgpu-hal/src/vulkan/device.rs | 62 ++++++++++++++++++++++++++++----- wgpu-hal/src/vulkan/instance.rs | 13 ++++++- wgpu-hal/src/vulkan/mod.rs | 4 +++ 4 files changed, 70 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f9d1283a292..546e16ecf03 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -61,6 +61,7 @@ Bottom level categories: #### Vulkan - Improve format MSAA capabilities detection. By @jinleili in [#3429](https://github.com/gfx-rs/wgpu/pull/3429) +- Fix surface view formats validation error. By @jinleili in [#3432](https://github.com/gfx-rs/wgpu/pull/3432) ### Bug Fixes diff --git a/wgpu-hal/src/vulkan/device.rs b/wgpu-hal/src/vulkan/device.rs index 6c59c973580..e2372b5b49a 100644 --- a/wgpu-hal/src/vulkan/device.rs +++ b/wgpu-hal/src/vulkan/device.rs @@ -217,20 +217,32 @@ impl super::DeviceShared { .iter() .map(|at| self.private_caps.map_texture_format(at.view_format)) .collect::>(); + let vk_view_formats_list = e + .key() + .attachments + .iter() + .map(|at| at.raw_view_formats.clone()) + .collect::>(); + let vk_image_infos = e .key() .attachments .iter() .enumerate() .map(|(i, at)| { - vk::FramebufferAttachmentImageInfo::builder() + let mut info = vk::FramebufferAttachmentImageInfo::builder() .usage(conv::map_texture_usage(at.view_usage)) .flags(at.raw_image_flags) .width(e.key().extent.width) .height(e.key().extent.height) - .layer_count(e.key().extent.depth_or_array_layers) - .view_formats(&vk_view_formats[i..i + 1]) - .build() + .layer_count(e.key().extent.depth_or_array_layers); + // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkRenderPassBeginInfo.html#VUID-VkRenderPassBeginInfo-framebuffer-03214 + if vk_view_formats_list[i].is_empty() { + info = info.view_formats(&vk_view_formats[i..i + 1]); + } else { + info = info.view_formats(&vk_view_formats_list[i]); + }; + info.build() }) .collect::>(); @@ -550,6 +562,7 @@ impl super::Device { let original_format = self.shared.private_caps.map_texture_format(config.format); let mut raw_flags = vk::SwapchainCreateFlagsKHR::empty(); let mut raw_view_formats: Vec = vec![]; + let mut wgt_view_formats = vec![]; if !config.view_formats.is_empty() { raw_flags |= vk::SwapchainCreateFlagsKHR::MUTABLE_FORMAT; raw_view_formats = config @@ -558,6 +571,9 @@ impl super::Device { .map(|f| self.shared.private_caps.map_texture_format(*f)) .collect(); raw_view_formats.push(original_format); + + wgt_view_formats = config.view_formats.clone(); + wgt_view_formats.push(config.format); } let mut info = vk::SwapchainCreateInfoKHR::builder() @@ -617,11 +633,13 @@ impl super::Device { Ok(super::Swapchain { raw, + raw_flags, functor, device: Arc::clone(&self.shared), fence, images, config: config.clone(), + view_formats: wgt_view_formats, }) } @@ -630,11 +648,26 @@ impl super::Device { /// - `vk_image` must be created respecting `desc` /// - If `drop_guard` is `Some`, the application must manually destroy the image handle. This /// can be done inside the `Drop` impl of `drop_guard`. + /// - If the `ImageCreateFlags` does not contain `MUTABLE_FORMAT`, the `view_formats` of `desc` must be empty. pub unsafe fn texture_from_raw( vk_image: vk::Image, desc: &crate::TextureDescriptor, drop_guard: Option, ) -> super::Texture { + let mut raw_flags = vk::ImageCreateFlags::empty(); + let mut view_formats = vec![]; + for tf in desc.view_formats.iter() { + if *tf == desc.format { + continue; + } + view_formats.push(*tf); + } + if !view_formats.is_empty() { + raw_flags |= + vk::ImageCreateFlags::MUTABLE_FORMAT | vk::ImageCreateFlags::EXTENDED_USAGE; + view_formats.push(desc.format) + } + super::Texture { raw: vk_image, drop_guard, @@ -644,6 +677,7 @@ impl super::Device { format_info: desc.format.describe(), raw_flags: vk::ImageCreateFlags::empty(), copy_size: desc.copy_extent(), + view_formats, } } @@ -908,20 +942,24 @@ impl crate::Device for super::Device { } let original_format = self.shared.private_caps.map_texture_format(desc.format); - let mut hal_view_formats: Vec = vec![]; + let mut vk_view_formats = vec![]; + let mut wgt_view_formats = vec![]; if !desc.view_formats.is_empty() { raw_flags |= vk::ImageCreateFlags::MUTABLE_FORMAT; + wgt_view_formats = desc.view_formats.clone(); + wgt_view_formats.push(desc.format); + if self.shared_instance().driver_api_version >= vk::API_VERSION_1_2 || self .enabled_device_extensions() .contains(&vk::KhrImageFormatListFn::name()) { - hal_view_formats = desc + vk_view_formats = desc .view_formats .iter() .map(|f| self.shared.private_caps.map_texture_format(*f)) .collect(); - hal_view_formats.push(original_format) + vk_view_formats.push(original_format) } } @@ -939,8 +977,8 @@ impl crate::Device for super::Device { .initial_layout(vk::ImageLayout::UNDEFINED); let mut format_list_info = vk::ImageFormatListCreateInfo::builder(); - if !hal_view_formats.is_empty() { - format_list_info = format_list_info.view_formats(&hal_view_formats); + if !vk_view_formats.is_empty() { + format_list_info = format_list_info.view_formats(&vk_view_formats); vk_info = vk_info.push_next(&mut format_list_info); } @@ -981,6 +1019,7 @@ impl crate::Device for super::Device { format_info: desc.format.describe(), raw_flags, copy_size, + view_formats: wgt_view_formats, }) } unsafe fn destroy_texture(&self, texture: super::Texture) { @@ -1036,6 +1075,11 @@ impl crate::Device for super::Device { raw_image_flags: texture.raw_flags, view_usage, view_format: desc.format, + raw_view_formats: texture + .view_formats + .iter() + .map(|tf| self.shared.private_caps.map_texture_format(*tf)) + .collect(), }; Ok(super::TextureView { diff --git a/wgpu-hal/src/vulkan/instance.rs b/wgpu-hal/src/vulkan/instance.rs index 1f4015f5d1f..4d8bfdd8614 100644 --- a/wgpu-hal/src/vulkan/instance.rs +++ b/wgpu-hal/src/vulkan/instance.rs @@ -782,6 +782,16 @@ impl crate::Surface for super::Surface { .map_err(crate::DeviceError::from)?; unsafe { sc.device.raw.reset_fences(fences) }.map_err(crate::DeviceError::from)?; + // https://registry.khronos.org/vulkan/specs/1.3-extensions/man/html/VkRenderPassBeginInfo.html#VUID-VkRenderPassBeginInfo-framebuffer-03209 + let raw_flags = if sc + .raw_flags + .contains(vk::SwapchainCreateFlagsKHR::MUTABLE_FORMAT) + { + vk::ImageCreateFlags::MUTABLE_FORMAT | vk::ImageCreateFlags::EXTENDED_USAGE + } else { + vk::ImageCreateFlags::empty() + }; + let texture = super::SurfaceTexture { index, texture: super::Texture { @@ -791,12 +801,13 @@ impl crate::Surface for super::Surface { usage: sc.config.usage, aspects: crate::FormatAspects::COLOR, format_info: sc.config.format.describe(), - raw_flags: vk::ImageCreateFlags::empty(), + raw_flags, copy_size: crate::CopyExtent { width: sc.config.extent.width, height: sc.config.extent.height, depth: 1, }, + view_formats: sc.view_formats.clone(), }, }; Ok(Some(crate::AcquiredSurfaceTexture { diff --git a/wgpu-hal/src/vulkan/mod.rs b/wgpu-hal/src/vulkan/mod.rs index 3c2ebbb5e97..fff9655490a 100644 --- a/wgpu-hal/src/vulkan/mod.rs +++ b/wgpu-hal/src/vulkan/mod.rs @@ -96,11 +96,13 @@ pub struct Instance { struct Swapchain { raw: vk::SwapchainKHR, + raw_flags: vk::SwapchainCreateFlagsKHR, functor: khr::Swapchain, device: Arc, fence: vk::Fence, images: Vec, config: crate::SurfaceConfiguration, + view_formats: Vec, } pub struct Surface { @@ -225,6 +227,7 @@ struct FramebufferAttachment { raw_image_flags: vk::ImageCreateFlags, view_usage: crate::TextureUses, view_format: wgt::TextureFormat, + raw_view_formats: Vec, } #[derive(Clone, Eq, Hash, PartialEq)] @@ -294,6 +297,7 @@ pub struct Texture { format_info: wgt::TextureFormatInfo, raw_flags: vk::ImageCreateFlags, copy_size: crate::CopyExtent, + view_formats: Vec, } impl Texture { From 5b8c55c4510fc58aa2b6baf03e31ed61d640b866 Mon Sep 17 00:00:00 2001 From: daxpedda Date: Thu, 9 Feb 2023 21:38:40 +0100 Subject: [PATCH 09/19] Build for WASM on docs.rs (#3462) --- wgpu-core/Cargo.toml | 6 ++++++ wgpu-hal/Cargo.toml | 6 ++++++ wgpu-types/Cargo.toml | 6 ++++++ wgpu/Cargo.toml | 6 ++++++ 4 files changed, 24 insertions(+) diff --git a/wgpu-core/Cargo.toml b/wgpu-core/Cargo.toml index e672f224cba..8f0c00babc0 100644 --- a/wgpu-core/Cargo.toml +++ b/wgpu-core/Cargo.toml @@ -12,6 +12,12 @@ license = "MIT OR Apache-2.0" [package.metadata.docs.rs] all-features = true rustdoc-args = ["--cfg", "docsrs"] +targets = [ + "x86_64-unknown-linux-gnu", + "x86_64-apple-darwin", + "x86_64-pc-windows-msvc", + "wasm32-unknown-unknown", +] [lib] diff --git a/wgpu-hal/Cargo.toml b/wgpu-hal/Cargo.toml index 4444f0577b3..a782c68d9ec 100644 --- a/wgpu-hal/Cargo.toml +++ b/wgpu-hal/Cargo.toml @@ -23,6 +23,12 @@ rust-version = "1.60" # with the dx11 and dx12 features. features = ["vulkan", "gles", "renderdoc"] rustdoc-args = ["--cfg", "docsrs"] +targets = [ + "x86_64-unknown-linux-gnu", + "x86_64-apple-darwin", + "x86_64-pc-windows-msvc", + "wasm32-unknown-unknown", +] [lib] diff --git a/wgpu-types/Cargo.toml b/wgpu-types/Cargo.toml index 32446f6b58b..54c53e5b0e0 100644 --- a/wgpu-types/Cargo.toml +++ b/wgpu-types/Cargo.toml @@ -12,6 +12,12 @@ license = "MIT OR Apache-2.0" [package.metadata.docs.rs] all-features = true rustdoc-args = ["--cfg", "docsrs"] +targets = [ + "x86_64-unknown-linux-gnu", + "x86_64-apple-darwin", + "x86_64-pc-windows-msvc", + "wasm32-unknown-unknown", +] [lib] diff --git a/wgpu/Cargo.toml b/wgpu/Cargo.toml index 2fe881d98de..cf377227ea2 100644 --- a/wgpu/Cargo.toml +++ b/wgpu/Cargo.toml @@ -24,6 +24,12 @@ autotests = false [package.metadata.docs.rs] all-features = true rustdoc-args = ["--cfg", "docsrs"] +targets = [ + "x86_64-unknown-linux-gnu", + "x86_64-apple-darwin", + "x86_64-pc-windows-msvc", + "wasm32-unknown-unknown", +] [lib] From 5677195873e8d11899a079966ccd828039c4837e Mon Sep 17 00:00:00 2001 From: daxpedda Date: Fri, 10 Feb 2023 17:51:06 +0100 Subject: [PATCH 10/19] Add Dependabot (#3468) --- .github/dependabot.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 .github/dependabot.yml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 00000000000..74b048acfaa --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,12 @@ +version: 2 + +updates: + - package-ecosystem: cargo + directory: / + schedule: + interval: daily + + - package-ecosystem: github-actions + directory: / + schedule: + interval: daily From 492b877b6892a1cb642a11421a3b289c1c8dd01a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Feb 2023 17:06:57 +0000 Subject: [PATCH 11/19] Bump libc from 0.2.126 to 0.2.139 (#3469) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 31ca11d4e8e..94f5a75c949 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1352,9 +1352,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.126" +version = "0.2.139" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349d5a591cd28b49e1d1037471617a32ddcda5731b99419008085f72d5a53836" +checksum = "201de327520df007757c1f0adce6e827fe8562fbc28bfd9c15571c66ca1f5f79" [[package]] name = "libloading" From 72ff326b534e8a6691fd07f70f8cb515b7b53def Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Feb 2023 17:09:40 +0000 Subject: [PATCH 12/19] Bump bytemuck from 1.12.3 to 1.13.0 (#3470) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 94f5a75c949..a0666f67f56 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -215,18 +215,18 @@ checksum = "572f695136211188308f16ad2ca5c851a712c464060ae6974944458eb83880ba" [[package]] name = "bytemuck" -version = "1.12.3" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aaa3a8d9a1ca92e282c96a32d6511b695d7d994d1d102ba85d279f9b2756947f" +checksum = "c041d3eab048880cb0b86b256447da3f18859a163c3b8d8893f4e6368abe6393" dependencies = [ "bytemuck_derive", ] [[package]] name = "bytemuck_derive" -version = "1.3.0" +version = "1.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5fe233b960f12f8007e3db2d136e3cb1c291bfd7396e384ee76025fc1a3932b4" +checksum = "1aca418a974d83d40a0c1f0c5cba6ff4bc28d8df099109ca459a2118d40b6322" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 3d4f024312c..6cc18d48bdc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -50,7 +50,7 @@ arrayvec = "0.7" async-executor = "1.0" bitflags = "1" bit-vec = "0.6" -bytemuck = "1.4" +bytemuck = "1.13" cargo-run-wasm = "0.3.0" cfg_aliases = "0.1" cfg-if = "1" From 1c17d57e4d13a47bb3aa4295e09d36668f6f5cb9 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Feb 2023 17:16:09 +0000 Subject: [PATCH 13/19] Bump thiserror from 1.0.37 to 1.0.38 (#3471) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a0666f67f56..4d582596fbd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2389,18 +2389,18 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e" +checksum = "6a9cd18aa97d5c45c6603caea1da6628790b37f7a34b6ca89522331c5180fed0" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb" +checksum = "1fb327af4685e4d03fa8cbcf1716380da910eeb2bb8be417e7f9fd3fb164f36f" dependencies = [ "proc-macro2", "quote", From 0c273bc49611de15ba6d2c6689b668db14668a1e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Feb 2023 12:17:17 -0500 Subject: [PATCH 14/19] Bump hassle-rs from 0.9.0 to 0.10.0 (#3473) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- Cargo.toml | 2 +- wgpu-hal/Cargo.toml | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4d582596fbd..56b77860ac5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1192,9 +1192,9 @@ dependencies = [ [[package]] name = "hassle-rs" -version = "0.9.0" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90601c6189668c7345fc53842cb3f3a3d872203d523be1b3cb44a36a3e62fb85" +checksum = "1397650ee315e8891a0df210707f0fc61771b0cc518c3023896064c5407cb3b0" dependencies = [ "bitflags", "com-rs", @@ -3090,9 +3090,9 @@ dependencies = [ [[package]] name = "widestring" -version = "0.5.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17882f045410753661207383517a6f62ec3dbeb6a4ed2acce01f0728238d1983" +checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" [[package]] name = "winapi" diff --git a/Cargo.toml b/Cargo.toml index 6cc18d48bdc..02e6dd1c83b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -104,7 +104,7 @@ gpu-allocator = { version = "0.21", default_features = false, features = ["d3d12 native = { package = "d3d12", version = "0.5.0" } range-alloc = "0.1" winapi = "0.3" -hassle-rs = "0.9.0" +hassle-rs = "0.10.0" # Gles dependencies egl = { package = "khronos-egl", version = "4.1" } diff --git a/wgpu-hal/Cargo.toml b/wgpu-hal/Cargo.toml index a782c68d9ec..945c6a78f0d 100644 --- a/wgpu-hal/Cargo.toml +++ b/wgpu-hal/Cargo.toml @@ -82,7 +82,7 @@ glow = { version = "0.12.0", optional = true } bit-set = { version = "0.5", optional = true } range-alloc = { version = "0.1", optional = true } gpu-allocator = { version = "0.22", default_features = false, features = ["d3d12", "windows", "public-winapi"], optional = true } -hassle-rs = { version = "0.9", optional = true } +hassle-rs = { version = "0.10", optional = true } [dependencies.wgt] package = "wgpu-types" From 420cfe66f76ec032aeede0576b39e8b05e07ae20 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Feb 2023 17:36:56 +0000 Subject: [PATCH 15/19] Bump wasm-bindgen-test from 0.3.33 to 0.3.34 (#3474) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 56b77860ac5..b5e0c616a8c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2783,9 +2783,9 @@ checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" [[package]] name = "wasm-bindgen-test" -version = "0.3.33" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09d2fff962180c3fadf677438054b1db62bee4aa32af26a45388af07d1287e1d" +checksum = "6db36fc0f9fb209e88fb3642590ae0205bb5a56216dabd963ba15879fe53a30b" dependencies = [ "console_error_panic_hook", "js-sys", @@ -2797,9 +2797,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-test-macro" -version = "0.3.33" +version = "0.3.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4683da3dfc016f704c9f82cf401520c4f1cb3ee440f7f52b3d6ac29506a49ca7" +checksum = "0734759ae6b3b1717d661fe4f016efcfb9828f5edb4520c18eaee05af3b43be9" dependencies = [ "proc-macro2", "quote", From fd920338a05637d651febe0ffd1bbeb183798776 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Feb 2023 17:41:04 +0000 Subject: [PATCH 16/19] Bump range-alloc from 0.1.2 to 0.1.3 (#3477) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b5e0c616a8c..d573a08e528 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1970,9 +1970,9 @@ dependencies = [ [[package]] name = "range-alloc" -version = "0.1.2" +version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63e935c45e09cc6dcf00d2f0b2d630a58f4095320223d47fc68918722f0538b6" +checksum = "9c8a99fddc9f0ba0a85884b8d14e3592853e787d581ca1816c91349b10e4eeab" [[package]] name = "raw-window-handle" From 34da9b2da17cf4f221626c44f29511d76cad469d Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Feb 2023 20:09:18 +0000 Subject: [PATCH 17/19] Bump termcolor from 1.1.3 to 1.2.0 (#3478) Bumps [termcolor](https://github.com/BurntSushi/termcolor) from 1.1.3 to 1.2.0. - [Release notes](https://github.com/BurntSushi/termcolor/releases) - [Commits](https://github.com/BurntSushi/termcolor/compare/1.1.3...1.2.0) --- updated-dependencies: - dependency-name: termcolor dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d573a08e528..861a0878bf7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2380,9 +2380,9 @@ dependencies = [ [[package]] name = "termcolor" -version = "1.1.3" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bab24d30b911b2376f3a13cc2cd443142f0c81dda04c118693e35b3835757755" +checksum = "be55cf8942feac5c765c2c993422806843c9a9a45d4d5c407ad6dd2ea95eb9b6" dependencies = [ "winapi-util", ] diff --git a/Cargo.toml b/Cargo.toml index 02e6dd1c83b..e1ad68e19ad 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -128,7 +128,7 @@ deno_web = "0.115.0" deno_webidl = "0.84.0" deno_webgpu = { path = "./deno_webgpu" } tokio = "1.19.0" -termcolor = "1.1.2" +termcolor = "1.2.0" wgpu-core = { path = "./wgpu-core" } wgpu-types = { path = "./wgpu-types" } From bd712e083c1663f8274f261dc35906a331c41f4c Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 10 Feb 2023 20:12:04 +0000 Subject: [PATCH 18/19] Bump env_logger from 0.9.3 to 0.10.0 (#3479) Bumps [env_logger](https://github.com/rust-cli/env_logger) from 0.9.3 to 0.10.0. - [Release notes](https://github.com/rust-cli/env_logger/releases) - [Changelog](https://github.com/rust-cli/env_logger/blob/main/CHANGELOG.md) - [Commits](https://github.com/rust-cli/env_logger/compare/v0.9.3...v0.10.0) --- updated-dependencies: - dependency-name: env_logger dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- Cargo.lock | 97 ++++++++++++++++++++++++++++++++++++++------- Cargo.toml | 2 +- wgpu-hal/Cargo.toml | 2 +- 3 files changed, 84 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 861a0878bf7..50e701dba2c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -123,17 +123,6 @@ dependencies = [ "syn", ] -[[package]] -name = "atty" -version = "0.2.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" -dependencies = [ - "hermit-abi", - "libc", - "winapi", -] - [[package]] name = "autocfg" version = "1.1.0" @@ -742,17 +731,38 @@ dependencies = [ [[package]] name = "env_logger" -version = "0.9.3" +version = "0.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a12e6657c4c97ebab115a42dcee77225f7f482cdd841cf7088c657a42e9e00e7" +checksum = "85cdab6a89accf66733ad5a1693a4dcced6aeff64602b634530dd73c1f3ee9f0" dependencies = [ - "atty", "humantime", + "is-terminal", "log", "regex", "termcolor", ] +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "event-listener" version = "2.5.3" @@ -1223,6 +1233,12 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286" + [[package]] name = "hexf-parse" version = "0.2.1" @@ -1300,6 +1316,28 @@ dependencies = [ "web-sys", ] +[[package]] +name = "io-lifetimes" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1abeb7a0dd0f8181267ff8adc397075586500b81b28a73e8a0208b00fc170fb3" +dependencies = [ + "libc", + "windows-sys 0.45.0", +] + +[[package]] +name = "is-terminal" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22e18b0a45d56fe973d6db23972bf5bc46f988a4a2385deac9cc29572f09daef" +dependencies = [ + "hermit-abi 0.3.1", + "io-lifetimes", + "rustix", + "windows-sys 0.45.0", +] + [[package]] name = "itoa" version = "1.0.4" @@ -1366,6 +1404,12 @@ dependencies = [ "winapi", ] +[[package]] +name = "linux-raw-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" + [[package]] name = "lock_api" version = "0.4.9" @@ -1631,7 +1675,7 @@ version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", ] @@ -2081,6 +2125,20 @@ dependencies = [ "semver 1.0.14", ] +[[package]] +name = "rustix" +version = "0.36.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f43abb88211988493c1abb44a70efa56ff0ce98f233b7b276146f1f3f7ba9644" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys 0.45.0", +] + [[package]] name = "ryu" version = "1.0.11" @@ -3162,6 +3220,15 @@ dependencies = [ "windows_x86_64_msvc 0.42.1", ] +[[package]] +name = "windows-sys" +version = "0.45.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" +dependencies = [ + "windows-targets", +] + [[package]] name = "windows-targets" version = "0.42.1" diff --git a/Cargo.toml b/Cargo.toml index e1ad68e19ad..ef38332f585 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,7 +56,7 @@ cfg_aliases = "0.1" cfg-if = "1" codespan-reporting = "0.11" ddsfile = "0.5" -env_logger = "0.9" +env_logger = "0.10" futures-intrusive = "0.4" fxhash = "0.2.1" glam = "0.21.3" diff --git a/wgpu-hal/Cargo.toml b/wgpu-hal/Cargo.toml index 945c6a78f0d..983031c2b4d 100644 --- a/wgpu-hal/Cargo.toml +++ b/wgpu-hal/Cargo.toml @@ -132,7 +132,7 @@ version = "0.11.0" features = ["wgsl-in"] [dev-dependencies] -env_logger = "0.9" +env_logger = "0.10" winit = "0.27.1" # for "halmark" example [target.'cfg(not(target_arch = "wasm32"))'.dev-dependencies] From bb01d723ba90654fdec85d931edbe7c9be56869e Mon Sep 17 00:00:00 2001 From: Leo Kettmeir Date: Sat, 11 Feb 2023 01:29:07 +0100 Subject: [PATCH 19/19] fix(deno): use correct op for GPUDevice.createSampler (#3480) --- deno_webgpu/src/01_webgpu.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deno_webgpu/src/01_webgpu.js b/deno_webgpu/src/01_webgpu.js index e0b97366b6c..8bcd770f902 100644 --- a/deno_webgpu/src/01_webgpu.js +++ b/deno_webgpu/src/01_webgpu.js @@ -988,7 +988,7 @@ context: "Argument 1", }); const device = assertDevice(this, { prefix, context: "this" }); - const { rid, err } = ops.op_webgpu_create_texture({ + const { rid, err } = ops.op_webgpu_create_sampler({ deviceRid: device.rid, ...descriptor, });