From a16888649704ea9aa51ad9031511146c738086aa Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Tue, 27 Oct 2020 12:38:52 -0400 Subject: [PATCH 1/3] Add helpers to convert passes to serialized forms --- wgpu-core/src/command/compute.rs | 5 +++++ wgpu-core/src/command/render.rs | 9 +++++++++ wgpu-core/src/pipeline.rs | 3 ++- 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/wgpu-core/src/command/compute.rs b/wgpu-core/src/command/compute.rs index 6bd4c00d6..792497a18 100644 --- a/wgpu-core/src/command/compute.rs +++ b/wgpu-core/src/command/compute.rs @@ -79,6 +79,11 @@ impl ComputePass { pub fn parent_id(&self) -> id::CommandEncoderId { self.parent_id } + + #[cfg(feature = "trace")] + pub fn into_command(self) -> crate::device::trace::Command { + crate::device::trace::Command::RunComputePass { base: self.base } + } } impl fmt::Debug for ComputePass { diff --git a/wgpu-core/src/command/render.rs b/wgpu-core/src/command/render.rs index 6794227d8..96b0e5d60 100644 --- a/wgpu-core/src/command/render.rs +++ b/wgpu-core/src/command/render.rs @@ -163,6 +163,15 @@ impl RenderPass { pub fn parent_id(&self) -> id::CommandEncoderId { self.parent_id } + + #[cfg(feature = "trace")] + pub fn into_command(self) -> crate::device::trace::Command { + crate::device::trace::Command::RunRenderPass { + base: self.base, + target_colors: self.color_targets.into_iter().collect(), + target_depth_stencil: self.depth_stencil_target, + } + } } impl fmt::Debug for RenderPass { diff --git a/wgpu-core/src/pipeline.rs b/wgpu-core/src/pipeline.rs index 116326833..e1f51adc0 100644 --- a/wgpu-core/src/pipeline.rs +++ b/wgpu-core/src/pipeline.rs @@ -13,7 +13,8 @@ use std::borrow::{Borrow, Cow}; use thiserror::Error; use wgt::{BufferAddress, IndexFormat, InputStepMode}; -#[repr(C)] +// Unable to serialize with `naga::Module` in here: +// requires naga serialization feature. #[derive(Debug)] pub enum ShaderModuleSource<'a> { SpirV(Cow<'a, [u32]>), From 6e3c7b359ff1ccb6b4de8a423e9d0fb43755bd08 Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Wed, 28 Oct 2020 13:35:53 -0400 Subject: [PATCH 2/3] Add missing license headers --- dummy/src/lib.rs | 4 +++- wgpu-core/build.rs | 4 ++++ wgpu-types/src/lib.rs | 2 ++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dummy/src/lib.rs b/dummy/src/lib.rs index 8b1378917..e0032240a 100644 --- a/dummy/src/lib.rs +++ b/dummy/src/lib.rs @@ -1 +1,3 @@ - +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ diff --git a/wgpu-core/build.rs b/wgpu-core/build.rs index 85b31c28d..5f7d660ab 100644 --- a/wgpu-core/build.rs +++ b/wgpu-core/build.rs @@ -1,3 +1,7 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + fn main() { // Setup cfg aliases cfg_aliases::cfg_aliases! { diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index 6ed9622a1..83c1670b7 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -1252,6 +1252,8 @@ impl BufferDescriptor { /// Describes a [`CommandEncoder`]. #[repr(C)] +#[cfg_attr(feature = "trace", derive(Serialize))] +#[cfg_attr(feature = "replay", derive(Deserialize))] #[derive(Clone, Debug, PartialEq, Eq, Hash)] pub struct CommandEncoderDescriptor { /// Debug label for the command encoder. This will show up in graphics debuggers for easy identification. From 367735d08561bb0eeb0200f79c3555913da8e532 Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Mon, 2 Nov 2020 18:00:56 -0500 Subject: [PATCH 3/3] Rename the lint to broken_intra_doc_links --- wgpu-types/src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wgpu-types/src/lib.rs b/wgpu-types/src/lib.rs index 83c1670b7..4ae3b5adc 100644 --- a/wgpu-types/src/lib.rs +++ b/wgpu-types/src/lib.rs @@ -6,7 +6,7 @@ // However when building from both the wgpu crate or this crate cargo doc will claim all the links cannot be resolved // despite the fact that it works fine when it needs to. // So we just disable those warnings. -#![allow(intra_doc_link_resolution_failure)] +#![allow(broken_intra_doc_links)] #[cfg(feature = "serde")] use serde::{Deserialize, Serialize};