objc2_metal/generated/
MTL4BufferRange.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use objc2::__framework_prelude::*;
4
5use crate::*;
6
7/// A struct representing a range of a Metal buffer. The offset into the buffer is included in the address.
8/// The length is generally optional, which a value of (uint64_t)-1 representing the range from the given address to
9/// the end of the buffer. However, providing the length can enable more accurate API validation, especially when
10/// sub-allocating ranges of a buffer.
11///
12/// See also [Apple's documentation](https://developer.apple.com/documentation/metal/mtl4bufferrange?language=objc)
13#[cfg(feature = "MTLGPUAddress")]
14#[repr(C)]
15#[derive(Clone, Copy, Debug, PartialEq)]
16pub struct MTL4BufferRange {
17    /// Buffer address returned by the gpuAddress property of an MTLBuffer plus any offset into the buffer
18    pub bufferAddress: MTLGPUAddress,
19    /// Length of the region which begins at the given address. If the length is not known, a value of
20    /// (uint64_t)-1 represents the range from the given address to the end of the buffer.
21    pub length: u64,
22}
23
24#[cfg(feature = "MTLGPUAddress")]
25unsafe impl Encode for MTL4BufferRange {
26    const ENCODING: Encoding = Encoding::Struct(
27        "MTL4BufferRange",
28        &[<MTLGPUAddress>::ENCODING, <u64>::ENCODING],
29    );
30}
31
32#[cfg(feature = "MTLGPUAddress")]
33unsafe impl RefEncode for MTL4BufferRange {
34    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
35}
36
37#[cfg(feature = "MTLGPUAddress")]
38impl MTL4BufferRange {
39    // TODO: pub fn MTL4BufferRangeMake(buffer_address: MTLGPUAddress,length: u64,) -> MTL4BufferRange;
40}