/// Binds an index buffer for future indexed draw calls.
///
/// # Panics
///
/// - Panics if the queue family of the command buffer does not support graphics operations.
/// - Panics if `self` and `index_buffer` do not belong to the same device.
/// - Panics if `index_buffer` does not have the
///   [`index_buffer`](crate::buffer::BufferUsage::index_buffer) usage enabled.
/// - If the index buffer contains `u8` indices, panics if the
///   [`index_type_uint8`](crate::device::Features::index_type_uint8) feature is not
///   enabled on the device.
Binds an index buffer for future indexed draw calls.
Binds an index buffer for future indexed draw calls .
pub fn bind_index_buffer<Ib, I>(&mut self, index_buffer: Arc<Ib>) -> &mut Self
    where
        Ib: TypedBufferAccess<Content = [I]> + 'static,
        I: Index + 'static,
    {
        assert!(
            self.queue_family().supports_graphics(),
            "the queue family of the command buffer must support graphics operations"
        );
        assert_eq!(
            index_buffer.device().internal_object(),
            self.device().internal_object()
        );
        // TODO:
        // The sum of offset and the address of the range of VkDeviceMemory object that is backing
        // buffer, must be a multiple of the type indicated by indexType
        assert!(
            index_buffer.inner().buffer.usage().index_buffer,
            "index_buffer must have the index_buffer usage enabled"
        );
        // TODO:
        // If buffer is non-sparse then it must be bound completely and contiguously to a single
        // VkDeviceMemory object
        if !self.device().enabled_features().index_type_uint8 {
            assert!(I::ty() != IndexType::U8, "if the index buffer contains u8 indices, the index_type_uint8 feature must be enabled on the device");
        }
        unsafe {
            self.inner.bind_index_buffer(index_buffer, I::ty());
        }
        self
    }
pub fn bind_index_buffer < Ib , I > ( & mut self , index_buffer : Arc < Ib > ) -> & mut Self where Ib : TypedBufferAccess < Content = [ I ] > + ' static , I : Index + ' static , { assert ! ( self queue_family ( ) supports_graphics ( ) " " ) ; assert_eq ! ( index_buffer device ( ) internal_object ( ) self device ( ) internal_object ( ) ) ; // TODO: // The sum of offset and the address of the range of VkDeviceMemory object that is backing // buffer, must be a multiple of the type indicated by indexType assert ! ( index_buffer inner ( ) buffer usage ( ) index_buffer " " ) ; // TODO: // If buffer is non-sparse then it must be bound completely and contiguously to a single // VkDeviceMemory object if ! self . device ( ) . enabled_features ( ) . index_type_uint8 { assert ! ( I ty ( ) IndexType U8 " " ) ; } unsafe { self . inner . bind_index_buffer ( index_buffer , I :: ty ( ) ) ; } self }
Binds an index buffer for future indexed draw calls.
Binds an index buffer for future indexed draw calls .
&mut self
index_buffer
Arc<Ib>
panics
Panics if the queue family of the command buffer does not support graphics operations.
Panics if `self` and `index_buffer` do not belong to the same device.
Panics if `index_buffer` does not have the
[`index_buffer`](crate::buffer::BufferUsage::index_buffer) usage enabled.
If the index buffer contains `u8` indices, panics if the
[`index_type_uint8`](crate::device::Features::index_type_uint8) feature is not
enabled on the device.
Panics if the queue family of the command buffer does not support graphics operations . Panics if ` self ` and ` index_buffer ` do not belong to the same device . Panics if ` index_buffer ` does not have the [ ` index_buffer ` ] ( crate :: buffer :: BufferUsage :: index_buffer ) usage enabled . If the index buffer contains ` u8 ` indices panics if the [ ` index_type_uint8 ` ] ( crate :: device :: Features :: index_type_uint8 ) feature is not enabled on the device .