mirror of
https://github.com/gfx-rs/wgpu.git
synced 2025-02-22 03:43:55 +00:00
Merge #1008
1008: Add helpers to convert passes to serialized forms r=grovesNL a=kvark **Connections** Stuff I needed to fix in the upcoming Gecko WebGPU update. **Description** It allows us to use the tracing `Command` more aggressively. **Testing** Tested in Gecko, doesn't need testing in wgpu Co-authored-by: Dzmitry Malyshau <dmalyshau@mozilla.com> Co-authored-by: Dzmitry Malyshau <kvark@fastmail.com>
This commit is contained in:
commit
7b9abf0fef
@ -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/. */
|
||||
|
@ -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! {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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]>),
|
||||
|
@ -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};
|
||||
@ -1252,6 +1252,8 @@ impl<L> BufferDescriptor<L> {
|
||||
|
||||
/// 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<L> {
|
||||
/// Debug label for the command encoder. This will show up in graphics debuggers for easy identification.
|
||||
|
Loading…
Reference in New Issue
Block a user