objc2-metal-performance-shaders 0.3.2

Bindings to the MetalPerformanceShaders framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use objc2_metal::*;

use crate::*;

extern_class!(
    /// A vertex buffer and optional index and mask buffer for a set of polygons
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/metalperformanceshaders/mpspolygonbuffer?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[deprecated]
    pub struct MPSPolygonBuffer;
);

extern_conformance!(
    unsafe impl NSCoding for MPSPolygonBuffer {}
);

extern_conformance!(
    unsafe impl NSCopying for MPSPolygonBuffer {}
);

unsafe impl CopyingHelper for MPSPolygonBuffer {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for MPSPolygonBuffer {}
);

extern_conformance!(
    unsafe impl NSSecureCoding for MPSPolygonBuffer {}
);

impl MPSPolygonBuffer {
    extern_methods!(
        /// Initialize the polygon buffer
        #[deprecated]
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        /// Initialize the polygon buffer with an NSCoder. Buffer properties such as the vertex
        /// buffer, instance buffer, etc. are set to nil. Encode and decode these buffers along with the
        /// polygon buffer instead.
        ///
        /// # Safety
        ///
        /// `a_decoder` possibly has further requirements.
        #[deprecated]
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(
            this: Allocated<Self>,
            a_decoder: &NSCoder,
        ) -> Option<Retained<Self>>;

        #[deprecated]
        #[unsafe(method(polygonBuffer))]
        #[unsafe(method_family = none)]
        pub unsafe fn polygonBuffer() -> Retained<Self>;

        /// Create a a copy of this polygon buffer
        ///
        ///
        /// Buffer properties of the polygon buffer such as the vertex buffer, instance, buffer,
        /// etc. are set to nil. Copy these buffers and assign them to the new polygon buffer or reassign
        /// the existing buffers to the new polygon buffer.
        ///
        ///
        /// Parameter `zone`: This parameter is ignored. Memory zones are no longer used by Objective-C.
        ///
        /// # Safety
        ///
        /// `zone` must be a valid pointer or null.
        #[deprecated]
        #[unsafe(method(copyWithZone:))]
        #[unsafe(method_family = copy)]
        pub unsafe fn copyWithZone(&self, zone: *mut NSZone) -> Retained<Self>;

        /// Vertex buffer containing vertex data encoded as three 32 bit floats per vertex. Note
        /// that by default each vertex is aligned to the alignment of the vector_float3 type: 16 bytes.
        /// This can be changed using the vertexStride property. A vertex buffer must be provided before
        /// the acceleration structure is built.
        ///
        /// When using triangle polygons, degenerate (zero or negative area) triangles are ignored
        /// during acceleration structure construction. This can be used to pad triangle indices if needed.
        ///
        /// Quadrilateral polygons are internally treated as two triangles. If the quadrilateral has
        /// vertices v0, v1, v2, and v3, the two triangles will have vertices v0, v1, v2 and v0, v2, v3.
        /// A quadrilateral may be used to represent a triangle by repeating the last vertex. If the first
        /// triangle is degenerate (zero or negative area), the entire quadrilateral will be ignored. This
        /// can be used to pad quadrilateral indices if needed. All four vertices of a quadrilateral must
        /// be coplanar and the quadrilateral must be convex.
        #[deprecated]
        #[unsafe(method(vertexBuffer))]
        #[unsafe(method_family = none)]
        pub unsafe fn vertexBuffer(&self) -> Option<Retained<ProtocolObject<dyn MTLBuffer>>>;

        /// Setter for [`vertexBuffer`][Self::vertexBuffer].
        ///
        /// # Safety
        ///
        /// - `vertex_buffer` may need to be synchronized.
        /// - `vertex_buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `vertex_buffer` contents should be of the correct type.
        #[deprecated]
        #[unsafe(method(setVertexBuffer:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setVertexBuffer(&self, vertex_buffer: Option<&ProtocolObject<dyn MTLBuffer>>);

        /// Offset, in bytes, into the vertex buffer. Defaults to 0 bytes. Must be aligned to 4
        /// bytes.
        #[deprecated]
        #[unsafe(method(vertexBufferOffset))]
        #[unsafe(method_family = none)]
        pub unsafe fn vertexBufferOffset(&self) -> NSUInteger;

        /// Setter for [`vertexBufferOffset`][Self::vertexBufferOffset].
        #[deprecated]
        #[unsafe(method(setVertexBufferOffset:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setVertexBufferOffset(&self, vertex_buffer_offset: NSUInteger);

        /// Index buffer containing index data. Each index references a vertex in the vertex buffer.
        /// May be nil.
        #[deprecated]
        #[unsafe(method(indexBuffer))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexBuffer(&self) -> Option<Retained<ProtocolObject<dyn MTLBuffer>>>;

        /// Setter for [`indexBuffer`][Self::indexBuffer].
        ///
        /// # Safety
        ///
        /// - `index_buffer` may need to be synchronized.
        /// - `index_buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `index_buffer` contents should be of the correct type.
        #[deprecated]
        #[unsafe(method(setIndexBuffer:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setIndexBuffer(&self, index_buffer: Option<&ProtocolObject<dyn MTLBuffer>>);

        /// Offset, in bytes, into the index buffer. Defaults to 0 bytes. Must be aligned to a
        /// multiple of the index type. Changes to this property require rebuilding the acceleration
        /// structure.
        #[deprecated]
        #[unsafe(method(indexBufferOffset))]
        #[unsafe(method_family = none)]
        pub unsafe fn indexBufferOffset(&self) -> NSUInteger;

        /// Setter for [`indexBufferOffset`][Self::indexBufferOffset].
        #[deprecated]
        #[unsafe(method(setIndexBufferOffset:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setIndexBufferOffset(&self, index_buffer_offset: NSUInteger);

        /// Mask buffer containing one uint32_t mask per polygon. May be nil. Otherwise, the mask
        /// type must be specified on the MPSRayIntersector with which it is used.
        #[deprecated]
        #[unsafe(method(maskBuffer))]
        #[unsafe(method_family = none)]
        pub unsafe fn maskBuffer(&self) -> Option<Retained<ProtocolObject<dyn MTLBuffer>>>;

        /// Setter for [`maskBuffer`][Self::maskBuffer].
        ///
        /// # Safety
        ///
        /// - `mask_buffer` may need to be synchronized.
        /// - `mask_buffer` may be unretained, you must ensure it is kept alive while in use.
        /// - `mask_buffer` contents should be of the correct type.
        #[deprecated]
        #[unsafe(method(setMaskBuffer:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMaskBuffer(&self, mask_buffer: Option<&ProtocolObject<dyn MTLBuffer>>);

        /// Offset, in bytes, into the mask buffer. Defaults to 0 bytes. Must be aligned to 4 bytes.
        #[deprecated]
        #[unsafe(method(maskBufferOffset))]
        #[unsafe(method_family = none)]
        pub unsafe fn maskBufferOffset(&self) -> NSUInteger;

        /// Setter for [`maskBufferOffset`][Self::maskBufferOffset].
        #[deprecated]
        #[unsafe(method(setMaskBufferOffset:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setMaskBufferOffset(&self, mask_buffer_offset: NSUInteger);

        /// Number of polygons. Changes to this property require rebuilding the acceleration
        /// structure.
        #[deprecated]
        #[unsafe(method(polygonCount))]
        #[unsafe(method_family = none)]
        pub unsafe fn polygonCount(&self) -> NSUInteger;

        /// Setter for [`polygonCount`][Self::polygonCount].
        #[deprecated]
        #[unsafe(method(setPolygonCount:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPolygonCount(&self, polygon_count: NSUInteger);
    );
}

/// Methods declared on superclass `NSObject`.
impl MPSPolygonBuffer {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}