Clearing a non-color attachment should be unreachable (#3393)

This commit is contained in:
Teodor Tanasoaia
2023-01-18 21:52:25 +01:00
committed by GitHub
parent 0705c7ad6b
commit b22cfa1298
2 changed files with 5 additions and 6 deletions

View File

@@ -525,7 +525,7 @@ impl crate::CommandEncoder<super::Api> for super::CommandEncoder {
color: [c.r as f32, c.g as f32, c.b as f32, c.a as f32],
is_srgb: cat.target.view.format.describe().srgb,
},
wgt::TextureSampleType::Depth => unimplemented!(),
wgt::TextureSampleType::Depth => unreachable!(),
wgt::TextureSampleType::Uint => C::ClearColorU(
i as u32,
[c.r as u32, c.g as u32, c.b as u32, c.a as u32],

View File

@@ -203,17 +203,16 @@ impl crate::ColorAttachment<'_, super::Api> {
.describe()
.sample_type
{
wgt::TextureSampleType::Float { .. } | wgt::TextureSampleType::Depth => {
vk::ClearColorValue {
float32: [cv.r as f32, cv.g as f32, cv.b as f32, cv.a as f32],
}
}
wgt::TextureSampleType::Float { .. } => vk::ClearColorValue {
float32: [cv.r as f32, cv.g as f32, cv.b as f32, cv.a as f32],
},
wgt::TextureSampleType::Sint => vk::ClearColorValue {
int32: [cv.r as i32, cv.g as i32, cv.b as i32, cv.a as i32],
},
wgt::TextureSampleType::Uint => vk::ClearColorValue {
uint32: [cv.r as u32, cv.g as u32, cv.b as u32, cv.a as u32],
},
wgt::TextureSampleType::Depth => unreachable!(),
}
}
}