| 1 |
// Copyright 2017 GFX developers |
| 2 |
// |
| 3 |
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or |
| 4 |
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or |
| 5 |
// http://opensource.org/licenses/MIT>, at your option. This file may not be |
| 6 |
// copied, modified, or distributed except according to those terms. |
| 7 |
|
| 8 |
use super::*; |
| 9 |
|
| 10 |
mod compute; |
| 11 |
mod render; |
| 12 |
|
| 13 |
pub use self::compute::*; |
| 14 |
pub use self::render::*; |
| 15 |
|
| 16 |
/// See <https://developer.apple.com/documentation/metal/mtlmutability> |
| 17 |
#[repr(u64)] |
| 18 |
#[allow(non_camel_case_types)] |
| 19 |
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] |
| 20 |
pub enum MTLMutability { |
| 21 |
Default = 0, |
| 22 |
Mutable = 1, |
| 23 |
Immutable = 2, |
| 24 |
} |
| 25 |
|
| 26 |
impl Default for MTLMutability { |
| 27 |
#[inline] |
| 28 |
fn default() -> Self { |
| 29 |
MTLMutability::Default |
| 30 |
} |
| 31 |
} |
| 32 |
|
| 33 |
/// See <https://developer.apple.com/documentation/metal/mtlpipelinebufferdescriptorarray> |
| 34 |
pub enum MTLPipelineBufferDescriptorArray {} |
| 35 |
|
| 36 |
foreign_obj_type! { |
| 37 |
type CType = MTLPipelineBufferDescriptorArray; |
| 38 |
pub struct PipelineBufferDescriptorArray; |
| 39 |
} |
| 40 |
|
| 41 |
impl PipelineBufferDescriptorArrayRef { |
| 42 |
pub fn object_at(&self, index: NSUInteger) -> Option<&PipelineBufferDescriptorRef> { |
| 43 |
unsafe { msg_send![self, objectAtIndexedSubscript: index] } |
| 44 |
} |
| 45 |
|
| 46 |
pub fn set_object_at( |
| 47 |
&self, |
| 48 |
index: NSUInteger, |
| 49 |
buffer_desc: Option<&PipelineBufferDescriptorRef>, |
| 50 |
) { |
| 51 |
unsafe { msg_send![self, setObject:buffer_desc atIndexedSubscript:index] } |
| 52 |
} |
| 53 |
} |
| 54 |
|
| 55 |
/// See <https://developer.apple.com/documentation/metal/mtlpipelinebufferdescriptor> |
| 56 |
pub enum MTLPipelineBufferDescriptor {} |
| 57 |
|
| 58 |
foreign_obj_type! { |
| 59 |
type CType = MTLPipelineBufferDescriptor; |
| 60 |
pub struct PipelineBufferDescriptor; |
| 61 |
} |
| 62 |
|
| 63 |
impl PipelineBufferDescriptorRef { |
| 64 |
pub fn mutability(&self) -> MTLMutability { |
| 65 |
unsafe { msg_send![self, mutability] } |
| 66 |
} |
| 67 |
|
| 68 |
pub fn set_mutability(&self, new_mutability: MTLMutability) { |
| 69 |
unsafe { msg_send![self, setMutability: new_mutability] } |
| 70 |
} |
| 71 |
} |