mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-19 22:11:01 +01:00
[core] Make ComputePassDescriptor and RenderPassDescriptor ser/de (#9666)
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
This commit is contained in:
4 files changed
+10
-7
No files matched your search
@@ -131,8 +131,8 @@ impl GPUCommandEncoder {
|
||||
let wgpu_descriptor = wgpu_core::command::RenderPassDescriptor {
|
||||
label: crate::transform_label(descriptor.label.clone()),
|
||||
color_attachments,
|
||||
depth_stencil_attachment: depth_stencil_attachment.as_ref(),
|
||||
timestamp_writes: timestamp_writes.as_ref(),
|
||||
depth_stencil_attachment,
|
||||
timestamp_writes,
|
||||
occlusion_query_set: descriptor
|
||||
.occlusion_query_set
|
||||
.map(|query_set| query_set.id),
|
||||
|
||||
@@ -107,6 +107,7 @@ impl fmt::Debug for ComputePass {
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, Default)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct ComputePassDescriptor<'a, PTW = PassTimestampWrites> {
|
||||
pub label: Label<'a>,
|
||||
/// Defines where and when timestamp values will be written for this pass.
|
||||
|
||||
@@ -255,14 +255,15 @@ pub struct ResolvedRenderPassDepthStencilAttachment<TV> {
|
||||
|
||||
/// Describes the attachments of a render pass.
|
||||
#[derive(Clone, Debug, Default, PartialEq)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||
pub struct RenderPassDescriptor<'a> {
|
||||
pub label: Label<'a>,
|
||||
/// The color attachments of the render pass.
|
||||
pub color_attachments: Cow<'a, [Option<RenderPassColorAttachment>]>,
|
||||
/// The depth and stencil attachment of the render pass, if any.
|
||||
pub depth_stencil_attachment: Option<&'a RenderPassDepthStencilAttachment<id::TextureViewId>>,
|
||||
pub depth_stencil_attachment: Option<RenderPassDepthStencilAttachment<id::TextureViewId>>,
|
||||
/// Defines where and when timestamp values will be written for this pass.
|
||||
pub timestamp_writes: Option<&'a PassTimestampWrites>,
|
||||
pub timestamp_writes: Option<PassTimestampWrites>,
|
||||
/// Defines where the occlusion query results will be stored for this pass.
|
||||
pub occlusion_query_set: Option<id::QuerySetId>,
|
||||
/// The multiview array layers that will be used
|
||||
@@ -1868,7 +1869,7 @@ impl Global {
|
||||
|
||||
arc_desc.depth_stencil_attachment =
|
||||
// https://gpuweb.github.io/gpuweb/#abstract-opdef-gpurenderpassdepthstencilattachment-gpurenderpassdepthstencilattachment-valid-usage
|
||||
if let Some(depth_stencil_attachment) = desc.depth_stencil_attachment {
|
||||
if let Some(depth_stencil_attachment) = desc.depth_stencil_attachment.as_ref() {
|
||||
let view = texture_views.get(depth_stencil_attachment.view).get()?;
|
||||
view.same_device(device)?;
|
||||
|
||||
@@ -1921,6 +1922,7 @@ impl Global {
|
||||
|
||||
arc_desc.timestamp_writes = desc
|
||||
.timestamp_writes
|
||||
.as_ref()
|
||||
.map(|tw| {
|
||||
Global::validate_pass_timestamp_writes::<RenderPassErrorInner>(
|
||||
device,
|
||||
|
||||
@@ -2637,9 +2637,9 @@ impl dispatch::CommandEncoderInterface for CoreCommandEncoder {
|
||||
self.id,
|
||||
&wgc::command::RenderPassDescriptor {
|
||||
label: desc.label.map(Borrowed),
|
||||
timestamp_writes: timestamp_writes.as_ref(),
|
||||
timestamp_writes,
|
||||
color_attachments: Borrowed(&colors),
|
||||
depth_stencil_attachment: depth_stencil.as_ref(),
|
||||
depth_stencil_attachment: depth_stencil,
|
||||
occlusion_query_set: desc.occlusion_query_set.map(|qs| qs.inner.as_core().id),
|
||||
multiview_mask: desc.multiview_mask,
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user