use core::ptr::NonNull;
use objc2::{extern_protocol, runtime::ProtocolObject};
use crate::{
MTLBuffer, MTLCommandEncoder, MTLFence, MTLSparseTextureMappingMode, MTLTexture,
types::{MTLOrigin, MTLRegion, MTLSize},
};
extern_protocol!(
pub unsafe trait MTLResourceStateCommandEncoder: MTLCommandEncoder {
#[optional]
#[unsafe(method(updateTextureMappings:mode:regions:mipLevels:slices:numRegions:))]
#[unsafe(method_family = none)]
fn update_texture_mappings(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
mode: MTLSparseTextureMappingMode,
regions: NonNull<MTLRegion>,
mip_levels: NonNull<usize>,
slices: NonNull<usize>,
num_regions: usize,
);
#[optional]
#[unsafe(method(updateTextureMapping:mode:region:mipLevel:slice:))]
#[unsafe(method_family = none)]
fn update_texture_mapping(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
mode: MTLSparseTextureMappingMode,
region: MTLRegion,
mip_level: usize,
slice: usize,
);
#[optional]
#[unsafe(method(updateTextureMapping:mode:indirectBuffer:indirectBufferOffset:))]
#[unsafe(method_family = none)]
fn update_texture_mapping_indirect(
&self,
texture: &ProtocolObject<dyn MTLTexture>,
mode: MTLSparseTextureMappingMode,
indirect_buffer: &ProtocolObject<dyn MTLBuffer>,
indirect_buffer_offset: usize,
);
#[optional]
#[unsafe(method(updateFence:))]
#[unsafe(method_family = none)]
fn update_fence(
&self,
fence: &ProtocolObject<dyn MTLFence>,
);
#[optional]
#[unsafe(method(waitForFence:))]
#[unsafe(method_family = none)]
fn wait_for_fence(
&self,
fence: &ProtocolObject<dyn MTLFence>,
);
#[optional]
#[unsafe(method(moveTextureMappingsFromTexture:sourceSlice:sourceLevel:sourceOrigin:sourceSize:toTexture:destinationSlice:destinationLevel:destinationOrigin:))]
#[unsafe(method_family = none)]
fn move_texture_mappings(
&self,
source_texture: &ProtocolObject<dyn MTLTexture>,
source_slice: usize,
source_level: usize,
source_origin: MTLOrigin,
source_size: MTLSize,
destination_texture: &ProtocolObject<dyn MTLTexture>,
destination_slice: usize,
destination_level: usize,
destination_origin: MTLOrigin,
);
}
);