/// Adds a command that clears a depth / stencil image with a specific value.
///
/// # Panic
///
/// - Panics if `clear_value` is not a depth / stencil value.
///
Adds a command that clears a depth / stencil image with a specific value.
Adds a command that clears a depth / stencil image with a specific value .
pub fn clear_depth_stencil_image_dimensions(
        &mut self,
        image: Arc<dyn ImageAccess>,
        first_layer: u32,
        num_layers: u32,
        clear_value: ClearValue,
    ) -> Result<&mut Self, ClearDepthStencilImageError> {
        unsafe {
            if !self.queue_family().supports_graphics() && !self.queue_family().supports_compute() {
                return Err(AutoCommandBufferBuilderContextError::NotSupportedByQueueFamily.into());
            }
            self.ensure_outside_render_pass()?;
            check_clear_depth_stencil_image(
                self.device(),
                image.as_ref(),
                first_layer,
                num_layers,
            )?;
            let (clear_depth, clear_stencil) = match clear_value {
                ClearValue::Depth(_) => (true, false),
                ClearValue::Stencil(_) => (false, true),
                ClearValue::DepthStencil(_) => (true, true),
                _ => panic!("The clear value is not a depth / stencil value"),
            };
            let region = UnsafeCommandBufferBuilderDepthStencilImageClear {
                base_array_layer: first_layer,
                layer_count: num_layers,
                clear_depth,
                clear_stencil,
            };
            // TODO: let choose layout
            self.inner.clear_depth_stencil_image(
                image,
                ImageLayout::TransferDstOptimal,
                clear_value,
                iter::once(region),
            )?;
            Ok(self)
        }
    }
pub fn clear_depth_stencil_image_dimensions ( & mut self , image : Arc < dyn ImageAccess > , first_layer : u32 , num_layers : u32 , clear_value : ClearValue , ) -> Result < & mut Self , ClearDepthStencilImageError > { unsafe { if ! self . queue_family ( ) . supports_graphics ( ) && ! self . queue_family ( ) . supports_compute ( ) { return Err ( AutoCommandBufferBuilderContextError :: NotSupportedByQueueFamily . into ( ) ) ; } self . ensure_outside_render_pass ( ) ? ; check_clear_depth_stencil_image ( self . device ( ) , image . as_ref ( ) , first_layer , num_layers , ) ? ; let ( clear_depth , clear_stencil ) = match clear_value { ClearValue :: Depth ( _ ) => ( true , false ) , ClearValue :: Stencil ( _ ) => ( false , true ) , ClearValue :: DepthStencil ( _ ) => ( true , true ) , _ => panic ! ( " " ) , } ; let region = UnsafeCommandBufferBuilderDepthStencilImageClear { base_array_layer : first_layer , layer_count : num_layers , clear_depth , clear_stencil , } ; // TODO: let choose layout self . inner . clear_depth_stencil_image ( image , ImageLayout :: TransferDstOptimal , clear_value , iter :: once ( region ) , ) ? ; Ok ( self ) } }
Adds a command that clears a depth / stencil image with a specific value.
Adds a command that clears a depth / stencil image with a specific value .
&mut self
image
Arc<dyn ImageAccess>
first_layer
u32
num_layers
u32
clear_value
ClearValue
panic
Panics if `clear_value` is not a depth / stencil value.
Panics if ` clear_value ` is not a depth / stencil value .