mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-24 16:31:11 +01:00
Handle TooManyAttachments in wgpu-core (#6076)
This commit is contained in:
1 parent
9619a43849
commit
de960ccbba
3 files changed
+15
-11
No files matched your search
@@ -595,6 +595,8 @@ pub enum CommandEncoderError {
|
||||
InvalidTimestampWritesQuerySetId(id::QuerySetId),
|
||||
#[error("Attachment TextureViewId {0:?} is invalid")]
|
||||
InvalidAttachmentId(id::TextureViewId),
|
||||
#[error(transparent)]
|
||||
InvalidColorAttachment(#[from] ColorAttachmentError),
|
||||
#[error("Resolve attachment TextureViewId {0:?} is invalid")]
|
||||
InvalidResolveTargetId(id::TextureViewId),
|
||||
#[error("Depth stencil attachment TextureViewId {0:?} is invalid")]
|
||||
|
||||
@@ -1342,10 +1342,21 @@ impl Global {
|
||||
hub: &crate::hub::Hub<A>,
|
||||
desc: &RenderPassDescriptor<'_>,
|
||||
arc_desc: &mut ArcRenderPassDescriptor<A>,
|
||||
device: &Device<A>,
|
||||
) -> Result<(), CommandEncoderError> {
|
||||
let query_sets = hub.query_sets.read();
|
||||
let texture_views = hub.texture_views.read();
|
||||
|
||||
let max_color_attachments = device.limits.max_color_attachments as usize;
|
||||
if desc.color_attachments.len() > max_color_attachments {
|
||||
return Err(CommandEncoderError::InvalidColorAttachment(
|
||||
ColorAttachmentError::TooMany {
|
||||
given: desc.color_attachments.len(),
|
||||
limit: max_color_attachments,
|
||||
},
|
||||
));
|
||||
}
|
||||
|
||||
for color_attachment in desc.color_attachments.iter() {
|
||||
if let Some(RenderPassColorAttachment {
|
||||
view: view_id,
|
||||
@@ -1447,7 +1458,7 @@ impl Global {
|
||||
Err(e) => return make_err(e, arc_desc),
|
||||
};
|
||||
|
||||
let err = fill_arc_desc(hub, desc, &mut arc_desc).err();
|
||||
let err = fill_arc_desc(hub, desc, &mut arc_desc, &cmd_buf.device).err();
|
||||
|
||||
(RenderPass::new(Some(cmd_buf), arc_desc), err)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user