diff --git a/deno_webgpu/webgpu.idl b/deno_webgpu/webgpu.idl index 5ea251e7744..00189c2744e 100644 --- a/deno_webgpu/webgpu.idl +++ b/deno_webgpu/webgpu.idl @@ -908,7 +908,7 @@ GPURenderPassEncoder includes GPUBindingCommandsMixin; GPURenderPassEncoder includes GPURenderCommandsMixin; dictionary GPURenderPassDescriptor : GPUObjectDescriptorBase { - required sequence colorAttachments; + required sequence colorAttachments; GPURenderPassDepthStencilAttachment depthStencilAttachment; GPUQuerySet occlusionQuerySet; }; diff --git a/wgpu-core/src/command/render.rs b/wgpu-core/src/command/render.rs index ae54a1202f9..095c8ee2f51 100644 --- a/wgpu-core/src/command/render.rs +++ b/wgpu-core/src/command/render.rs @@ -441,7 +441,7 @@ pub enum RenderPassErrorInner { InvalidDepthStencilAttachmentFormat(wgt::TextureFormat), #[error("attachment format {0:?} can not be resolved")] UnsupportedResolveTargetFormat(wgt::TextureFormat), - #[error("necessary attachments are missing")] + #[error("missing color or depth_tencil attachments, at least one is required.")] MissingAttachments, #[error("attachments have differing sizes: {previous:?} is followed by {mismatch:?}")] AttachmentsDimensionMismatch { @@ -930,7 +930,8 @@ impl<'a, A: HalApi> RenderPassInfo<'a, A> { }); } - if sample_count != 1 && sample_count != 4 { + let extent = extent.ok_or(RenderPassErrorInner::MissingAttachments)?; + if colors.len() > 0 && sample_count != 1 && sample_count != 4 { return Err(RenderPassErrorInner::InvalidSampleCount(sample_count)); } @@ -946,7 +947,6 @@ impl<'a, A: HalApi> RenderPassInfo<'a, A> { .collect(), depth_stencil: depth_stencil_attachment.map(|at| view_guard.get(at.view).unwrap()), }; - let extent = extent.ok_or(RenderPassErrorInner::MissingAttachments)?; let multiview = detected_multiview.expect("Multiview was not detected, no attachments"); let context = RenderPassContext {