mirror of
https://github.com/storytold/wgpu.git
synced 2026-11-20 22:41:07 +01:00
[wgpu-core] fix potential crash when device is not supplied to validate_render_bundle_encoder_descriptor (#9407)
This commit is contained in:
1 parent
fbaa92ddcd
commit
f7b650d55c
1 file changed
+5
-6
@@ -185,12 +185,11 @@ fn validate_render_bundle_encoder_descriptor(
|
||||
) -> Result<(bool, bool), CreateRenderBundleError> {
|
||||
let mut have_attachment = false;
|
||||
|
||||
if let Some(device) = device {
|
||||
check_color_attachment_count(
|
||||
desc.color_formats.len(),
|
||||
device.limits.max_color_attachments,
|
||||
)?;
|
||||
}
|
||||
let max_color_attachments = device.map_or(hal::MAX_COLOR_ATTACHMENTS as u32, |device| {
|
||||
assert!(device.limits.max_color_attachments <= hal::MAX_COLOR_ATTACHMENTS as u32);
|
||||
device.limits.max_color_attachments
|
||||
});
|
||||
check_color_attachment_count(desc.color_formats.len(), max_color_attachments)?;
|
||||
|
||||
for &format in desc.color_formats.iter().flatten() {
|
||||
have_attachment = true;
|
||||
|
||||
Reference in new issue
Block a user