Skip to content

Commit

Permalink
[core] validate equal sample_count in copy_texture_to_texture
Browse files Browse the repository at this point in the history
Signed-off-by: sagudev <16504129+sagudev@users.noreply.github.com>
  • Loading branch information
sagudev committed Feb 23, 2025
1 parent d8833d0 commit 037dcb6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions wgpu-core/src/command/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,13 @@ pub enum TransferError {
MissingDownlevelFlags(#[from] MissingDownlevelFlags),
#[error("Source texture sample count must be 1, got {sample_count}")]
InvalidSampleCount { sample_count: u32 },
#[error(
"Source sample count ({src_sample_count:?}) and destination sample count ({dst_sample_count:?}) are not equal"
)]
SampleCountNotEqual {
src_sample_count: u32,
dst_sample_count: u32,
},
#[error("Requested mip level {requested} does no exist (count: {count})")]
InvalidMipLevel { requested: u32, count: u32 },
}
Expand Down Expand Up @@ -1100,6 +1107,13 @@ impl Global {
if dst_tex_base.aspect != dst_texture_aspects {
return Err(TransferError::CopyDstMissingAspects.into());
}
if src_texture.desc.sample_count != dst_texture.desc.sample_count {
return Err(TransferError::SampleCountNotEqual {
src_sample_count: src_texture.desc.sample_count,
dst_sample_count: dst_texture.desc.sample_count,
}
.into());
}

// Handle texture init *before* dealing with barrier transitions so we
// have an easier time inserting "immediate-inits" that may be required
Expand Down

0 comments on commit 037dcb6

Please sign in to comment.