mirror of
https://github.com/gfx-rs/wgpu.git
synced 2026-04-22 03:02:01 -04:00
Check render target aspects
This commit is contained in:
@@ -391,6 +391,10 @@ pub enum RenderPassErrorInner {
|
||||
Encoder(#[from] CommandEncoderError),
|
||||
#[error("attachment texture view {0:?} is invalid")]
|
||||
InvalidAttachment(id::TextureViewId),
|
||||
#[error("attachment format {0:?} is not a color format")]
|
||||
InvalidColorAttachmentFormat(wgt::TextureFormat),
|
||||
#[error("attachment format {0:?} is not a depth-stencil format")]
|
||||
InvalidDepthStencilAttachmentFormat(wgt::TextureFormat),
|
||||
#[error("necessary attachments are missing")]
|
||||
MissingAttachments,
|
||||
#[error("attachments have differing sizes: {previous:?} is followed by {mismatch:?}")]
|
||||
@@ -567,6 +571,11 @@ impl<'a, B: GfxBackend> RenderPassInfo<'a, B> {
|
||||
add_view(view, "depth")?;
|
||||
|
||||
depth_stencil_aspects = view.aspects;
|
||||
if view.aspects.contains(hal::format::Aspects::COLOR) {
|
||||
return Err(RenderPassErrorInner::InvalidDepthStencilAttachmentFormat(
|
||||
view.format,
|
||||
));
|
||||
}
|
||||
|
||||
let source_id = match view.inner {
|
||||
TextureViewInner::Native { ref source_id, .. } => source_id,
|
||||
@@ -624,6 +633,12 @@ impl<'a, B: GfxBackend> RenderPassInfo<'a, B> {
|
||||
.map_err(|_| RenderPassErrorInner::InvalidAttachment(at.view))?;
|
||||
add_view(view, "color")?;
|
||||
|
||||
if !view.aspects.contains(hal::format::Aspects::COLOR) {
|
||||
return Err(RenderPassErrorInner::InvalidColorAttachmentFormat(
|
||||
view.format,
|
||||
));
|
||||
}
|
||||
|
||||
let layouts = match view.inner {
|
||||
TextureViewInner::Native { ref source_id, .. } => {
|
||||
let previous_use = cmd_buf
|
||||
|
||||
Reference in New Issue
Block a user