Skip to content

Commit

Permalink
Relax render pass color_attachments validation
Browse files Browse the repository at this point in the history
  • Loading branch information
jinleili committed Jun 16, 2022
1 parent 94276f9 commit 3233906
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion deno_webgpu/webgpu.idl
Original file line number Diff line number Diff line change
Expand Up @@ -908,7 +908,7 @@ GPURenderPassEncoder includes GPUBindingCommandsMixin;
GPURenderPassEncoder includes GPURenderCommandsMixin;

dictionary GPURenderPassDescriptor : GPUObjectDescriptorBase {
required sequence<GPURenderPassColorAttachment> colorAttachments;
required sequence<GPURenderPassColorAttachment?> colorAttachments;
GPURenderPassDepthStencilAttachment depthStencilAttachment;
GPUQuerySet occlusionQuerySet;
};
Expand Down
6 changes: 3 additions & 3 deletions wgpu-core/src/command/render.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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));
}

Expand All @@ -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 {
Expand Down

0 comments on commit 3233906

Please sign in to comment.