/// Adds a command that clears a color image with a specific value.
///
/// # Panic
///
/// - Panics if `color` is not a color value.
///
Adds a command that clears a color image with a specific value.
Adds a command that clears a color image with a specific value .
pub fn clear_color_image_dimensions(
        &mut self,
        image: Arc<dyn ImageAccess>,
        first_layer: u32,
        num_layers: u32,
        first_mipmap: u32,
        num_mipmaps: u32,
        color: ClearValue,
    ) -> Result<&mut Self, ClearColorImageError> {
        unsafe {
            if !self.queue_family().supports_graphics() && !self.queue_family().supports_compute() {
                return Err(AutoCommandBufferBuilderContextError::NotSupportedByQueueFamily.into());
            }
            self.ensure_outside_render_pass()?;
            check_clear_color_image(
                self.device(),
                image.as_ref(),
                first_layer,
                num_layers,
                first_mipmap,
                num_mipmaps,
            )?;
            match color {
                ClearValue::Float(_) | ClearValue::Int(_) | ClearValue::Uint(_) => {}
                _ => panic!("The clear color is not a color value"),
            };
            let region = UnsafeCommandBufferBuilderColorImageClear {
                base_mip_level: first_mipmap,
                level_count: num_mipmaps,
                base_array_layer: first_layer,
                layer_count: num_layers,
            };
            // TODO: let choose layout
            self.inner.clear_color_image(
                image,
                ImageLayout::TransferDstOptimal,
                color,
                iter::once(region),
            )?;
            Ok(self)
        }
    }
pub fn clear_color_image_dimensions ( & mut self , image : Arc < dyn ImageAccess > , first_layer : u32 , num_layers : u32 , first_mipmap : u32 , num_mipmaps : u32 , color : ClearValue , ) -> Result < & mut Self , ClearColorImageError > { unsafe { if ! self . queue_family ( ) . supports_graphics ( ) && ! self . queue_family ( ) . supports_compute ( ) { return Err ( AutoCommandBufferBuilderContextError :: NotSupportedByQueueFamily . into ( ) ) ; } self . ensure_outside_render_pass ( ) ? ; check_clear_color_image ( self . device ( ) , image . as_ref ( ) , first_layer , num_layers , first_mipmap , num_mipmaps , ) ? ; match color { ClearValue :: Float ( _ ) | ClearValue :: Int ( _ ) | ClearValue :: Uint ( _ ) => { } _ => panic ! ( " " ) , } ; let region = UnsafeCommandBufferBuilderColorImageClear { base_mip_level : first_mipmap , level_count : num_mipmaps , base_array_layer : first_layer , layer_count : num_layers , } ; // TODO: let choose layout self . inner . clear_color_image ( image , ImageLayout :: TransferDstOptimal , color , iter :: once ( region ) , ) ? ; Ok ( self ) } }
Adds a command that clears a color image with a specific value.
Adds a command that clears a color image with a specific value .
&mut self
image
Arc<dyn ImageAccess>
first_layer
u32
num_layers
u32
first_mipmap
u32
num_mipmaps
u32
color
ClearValue
panic
Panics if `color` is not a color value.
Panics if ` color ` is not a color value .