pub struct MTLRenderPassDescriptor { /* private fields */ }MTLRenderPass only.Expand description
MTLRenderPassDescriptor represents a collection of attachments to be used to create a concrete render command encoder
See also Apple’s documentation
Implementations§
Source§impl MTLRenderPassDescriptor
impl MTLRenderPassDescriptor
Sourcepub fn renderPassDescriptor() -> Retained<MTLRenderPassDescriptor>
pub fn renderPassDescriptor() -> Retained<MTLRenderPassDescriptor>
Create an autoreleased default frame buffer descriptor
pub fn colorAttachments( &self, ) -> Retained<MTLRenderPassColorAttachmentDescriptorArray>
pub fn depthAttachment( &self, ) -> Retained<MTLRenderPassDepthAttachmentDescriptor>
Sourcepub fn setDepthAttachment(
&self,
depth_attachment: Option<&MTLRenderPassDepthAttachmentDescriptor>,
)
pub fn setDepthAttachment( &self, depth_attachment: Option<&MTLRenderPassDepthAttachmentDescriptor>, )
Setter for depthAttachment.
This is copied when set.
pub fn stencilAttachment( &self, ) -> Retained<MTLRenderPassStencilAttachmentDescriptor>
Sourcepub fn setStencilAttachment(
&self,
stencil_attachment: Option<&MTLRenderPassStencilAttachmentDescriptor>,
)
pub fn setStencilAttachment( &self, stencil_attachment: Option<&MTLRenderPassStencilAttachmentDescriptor>, )
Setter for stencilAttachment.
This is copied when set.
Sourcepub fn visibilityResultBuffer(
&self,
) -> Option<Retained<ProtocolObject<dyn MTLBuffer>>>
Available on crate features MTLAllocation and MTLBuffer and MTLResource only.
pub fn visibilityResultBuffer( &self, ) -> Option<Retained<ProtocolObject<dyn MTLBuffer>>>
MTLAllocation and MTLBuffer and MTLResource only.Buffer into which samples passing the depth and stencil tests are counted.
Sourcepub fn setVisibilityResultBuffer(
&self,
visibility_result_buffer: Option<&ProtocolObject<dyn MTLBuffer>>,
)
Available on crate features MTLAllocation and MTLBuffer and MTLResource only.
pub fn setVisibilityResultBuffer( &self, visibility_result_buffer: Option<&ProtocolObject<dyn MTLBuffer>>, )
MTLAllocation and MTLBuffer and MTLResource only.Setter for visibilityResultBuffer.
Sourcepub fn renderTargetArrayLength(&self) -> NSUInteger
pub fn renderTargetArrayLength(&self) -> NSUInteger
The number of active layers
Sourcepub fn setRenderTargetArrayLength(&self, render_target_array_length: NSUInteger)
pub fn setRenderTargetArrayLength(&self, render_target_array_length: NSUInteger)
Setter for renderTargetArrayLength.
Sourcepub fn imageblockSampleLength(&self) -> NSUInteger
pub fn imageblockSampleLength(&self) -> NSUInteger
The per sample size in bytes of the largest explicit imageblock layout in the renderPass.
Sourcepub fn setImageblockSampleLength(&self, imageblock_sample_length: NSUInteger)
pub fn setImageblockSampleLength(&self, imageblock_sample_length: NSUInteger)
Setter for imageblockSampleLength.
Sourcepub fn threadgroupMemoryLength(&self) -> NSUInteger
pub fn threadgroupMemoryLength(&self) -> NSUInteger
The per tile size in bytes of the persistent threadgroup memory allocation.
Sourcepub fn setThreadgroupMemoryLength(&self, threadgroup_memory_length: NSUInteger)
pub fn setThreadgroupMemoryLength(&self, threadgroup_memory_length: NSUInteger)
Setter for threadgroupMemoryLength.
Sourcepub fn tileWidth(&self) -> NSUInteger
pub fn tileWidth(&self) -> NSUInteger
The width in pixels of the tile.
Defaults to 0. Zero means Metal chooses a width that fits within the local memory.
Sourcepub fn setTileWidth(&self, tile_width: NSUInteger)
pub fn setTileWidth(&self, tile_width: NSUInteger)
Setter for tileWidth.
Sourcepub fn tileHeight(&self) -> NSUInteger
pub fn tileHeight(&self) -> NSUInteger
The height in pixels of the tile.
Defaults to 0. Zero means Metal chooses a height that fits within the local memory.
Sourcepub fn setTileHeight(&self, tile_height: NSUInteger)
pub fn setTileHeight(&self, tile_height: NSUInteger)
Setter for tileHeight.
Sourcepub fn defaultRasterSampleCount(&self) -> NSUInteger
pub fn defaultRasterSampleCount(&self) -> NSUInteger
The raster sample count for the render pass when no attachments are given.
Sourcepub fn setDefaultRasterSampleCount(
&self,
default_raster_sample_count: NSUInteger,
)
pub fn setDefaultRasterSampleCount( &self, default_raster_sample_count: NSUInteger, )
Setter for defaultRasterSampleCount.
Sourcepub fn renderTargetWidth(&self) -> NSUInteger
pub fn renderTargetWidth(&self) -> NSUInteger
The width in pixels to constrain the render target to.
Defaults to 0. If non-zero the value must be smaller than or equal to the minimum width of all attachments.
Sourcepub fn setRenderTargetWidth(&self, render_target_width: NSUInteger)
pub fn setRenderTargetWidth(&self, render_target_width: NSUInteger)
Setter for renderTargetWidth.
Sourcepub fn renderTargetHeight(&self) -> NSUInteger
pub fn renderTargetHeight(&self) -> NSUInteger
The height in pixels to constrain the render target to.
Defaults to 0. If non-zero the value must be smaller than or equal to the minimum height of all attachments.
Sourcepub fn setRenderTargetHeight(&self, render_target_height: NSUInteger)
pub fn setRenderTargetHeight(&self, render_target_height: NSUInteger)
Setter for renderTargetHeight.
Sourcepub unsafe fn setSamplePositions_count(
&self,
positions: *const MTLSamplePosition,
count: NSUInteger,
)
Available on crate feature MTLTypes only.
pub unsafe fn setSamplePositions_count( &self, positions: *const MTLSamplePosition, count: NSUInteger, )
MTLTypes only.Configure the custom sample positions, to be used in MSAA rendering (i.e. when sample count > 1).
Parameter positions: The source array for custom sample position data.
Parameter count: Specifies the length of the positions array, and must be a valid sample count or 0 (to disable custom sample positions).
§Safety
positionsmust be a valid pointer or null.countmight not be bounds-checked.
Sourcepub unsafe fn getSamplePositions_count(
&self,
positions: *mut MTLSamplePosition,
count: NSUInteger,
) -> NSUInteger
Available on crate feature MTLTypes only.
pub unsafe fn getSamplePositions_count( &self, positions: *mut MTLSamplePosition, count: NSUInteger, ) -> NSUInteger
MTLTypes only.Retrieve the previously configured custom sample positions. The positions input array will only be modified when count specifies a length sufficient for the number of previously configured positions.
Parameter positions: The destination array for custom sample position data.
Parameter count: Specifies the length of the positions array, which must be large enough to hold all configured sample positions.
Returns: The number of previously configured custom sample positions.
§Safety
positionsmust be a valid pointer or null.countmight not be bounds-checked.
Sourcepub fn rasterizationRateMap(
&self,
) -> Option<Retained<ProtocolObject<dyn MTLRasterizationRateMap>>>
Available on crate feature MTLRasterizationRate only.
pub fn rasterizationRateMap( &self, ) -> Option<Retained<ProtocolObject<dyn MTLRasterizationRateMap>>>
MTLRasterizationRate only.The variable rasterization rate map to use when rendering this pass, or nil to not use variable rasterization rate.
The default value is nil. Enabling variable rasterization rate allows for decreasing the rasterization rate in unimportant regions of screen space.
Sourcepub fn setRasterizationRateMap(
&self,
rasterization_rate_map: Option<&ProtocolObject<dyn MTLRasterizationRateMap>>,
)
Available on crate feature MTLRasterizationRate only.
pub fn setRasterizationRateMap( &self, rasterization_rate_map: Option<&ProtocolObject<dyn MTLRasterizationRateMap>>, )
MTLRasterizationRate only.Setter for rasterizationRateMap.
Sourcepub fn sampleBufferAttachments(
&self,
) -> Retained<MTLRenderPassSampleBufferAttachmentDescriptorArray>
pub fn sampleBufferAttachments( &self, ) -> Retained<MTLRenderPassSampleBufferAttachmentDescriptorArray>
An array of sample buffers and associated sample indices.
Sourcepub fn visibilityResultType(&self) -> MTLVisibilityResultType
pub fn visibilityResultType(&self) -> MTLVisibilityResultType
Specifies if Metal accumulates visibility results between render encoders or resets them.
Sourcepub fn setVisibilityResultType(
&self,
visibility_result_type: MTLVisibilityResultType,
)
pub fn setVisibilityResultType( &self, visibility_result_type: MTLVisibilityResultType, )
Setter for visibilityResultType.
Sourcepub fn supportColorAttachmentMapping(&self) -> bool
pub fn supportColorAttachmentMapping(&self) -> bool
Specifies if the render pass should support color attachment mapping.
Sourcepub fn setSupportColorAttachmentMapping(
&self,
support_color_attachment_mapping: bool,
)
pub fn setSupportColorAttachmentMapping( &self, support_color_attachment_mapping: bool, )
Setter for supportColorAttachmentMapping.
Methods from Deref<Target = NSObject>§
Sourcepub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
pub fn doesNotRecognizeSelector(&self, sel: Sel) -> !
Handle messages the object doesn’t recognize.
See Apple’s documentation for details.
Methods from Deref<Target = AnyObject>§
Sourcepub fn class(&self) -> &'static AnyClass
pub fn class(&self) -> &'static AnyClass
Dynamically find the class of this object.
§Panics
May panic if the object is invalid (which may be the case for objects
returned from unavailable init/new methods).
§Example
Check that an instance of NSObject has the precise class NSObject.
use objc2::ClassType;
use objc2::runtime::NSObject;
let obj = NSObject::new();
assert_eq!(obj.class(), NSObject::class());Sourcepub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
👎Deprecated: this is difficult to use correctly, use Ivar::load instead.
pub unsafe fn get_ivar<T>(&self, name: &str) -> &Twhere
T: Encode,
Ivar::load instead.Use Ivar::load instead.
§Safety
The object must have an instance variable with the given name, and it
must be of type T.
See Ivar::load_ptr for details surrounding this.
Sourcepub fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastTarget,
pub fn downcast_ref<T>(&self) -> Option<&T>where
T: DowncastTarget,
Attempt to downcast the object to a class of type T.
This is the reference-variant. Use Retained::downcast if you want
to convert a retained object to another type.
§Mutable classes
Some classes have immutable and mutable variants, such as NSString
and NSMutableString.
When some Objective-C API signature says it gives you an immutable class, it generally expects you to not mutate that, even though it may technically be mutable “under the hood”.
So using this method to convert a NSString to a NSMutableString,
while not unsound, is generally frowned upon unless you created the
string yourself, or the API explicitly documents the string to be
mutable.
See Apple’s documentation on mutability and on
isKindOfClass: for more details.
§Generic classes
Objective-C generics are called “lightweight generics”, and that’s because they aren’t exposed in the runtime. This makes it impossible to safely downcast to generic collections, so this is disallowed by this method.
You can, however, safely downcast to generic collections where all the
type-parameters are AnyObject.
§Panics
This works internally by calling isKindOfClass:. That means that the
object must have the instance method of that name, and an exception
will be thrown (if CoreFoundation is linked) or the process will abort
if that is not the case. In the vast majority of cases, you don’t need
to worry about this, since both root objects NSObject and
NSProxy implement this method.
§Examples
Cast an NSString back and forth from NSObject.
use objc2::rc::Retained;
use objc2_foundation::{NSObject, NSString};
let obj: Retained<NSObject> = NSString::new().into_super();
let string = obj.downcast_ref::<NSString>().unwrap();
// Or with `downcast`, if we do not need the object afterwards
let string = obj.downcast::<NSString>().unwrap();Try (and fail) to cast an NSObject to an NSString.
use objc2_foundation::{NSObject, NSString};
let obj = NSObject::new();
assert!(obj.downcast_ref::<NSString>().is_none());Try to cast to an array of strings.
use objc2_foundation::{NSArray, NSObject, NSString};
let arr = NSArray::from_retained_slice(&[NSObject::new()]);
// This is invalid and doesn't type check.
let arr = arr.downcast_ref::<NSArray<NSString>>();This fails to compile, since it would require enumerating over the array to ensure that each element is of the desired type, which is a performance pitfall.
Downcast when processing each element instead.
use objc2_foundation::{NSArray, NSObject, NSString};
let arr = NSArray::from_retained_slice(&[NSObject::new()]);
for elem in arr {
if let Some(data) = elem.downcast_ref::<NSString>() {
// handle `data`
}
}Trait Implementations§
Source§impl AsRef<AnyObject> for MTLRenderPassDescriptor
impl AsRef<AnyObject> for MTLRenderPassDescriptor
Source§impl AsRef<NSObject> for MTLRenderPassDescriptor
impl AsRef<NSObject> for MTLRenderPassDescriptor
Source§impl Borrow<AnyObject> for MTLRenderPassDescriptor
impl Borrow<AnyObject> for MTLRenderPassDescriptor
Source§impl Borrow<NSObject> for MTLRenderPassDescriptor
impl Borrow<NSObject> for MTLRenderPassDescriptor
Source§impl ClassType for MTLRenderPassDescriptor
impl ClassType for MTLRenderPassDescriptor
Source§const NAME: &'static str = "MTLRenderPassDescriptor"
const NAME: &'static str = "MTLRenderPassDescriptor"
Source§type ThreadKind = <<MTLRenderPassDescriptor as ClassType>::Super as ClassType>::ThreadKind
type ThreadKind = <<MTLRenderPassDescriptor as ClassType>::Super as ClassType>::ThreadKind
Source§impl CopyingHelper for MTLRenderPassDescriptor
impl CopyingHelper for MTLRenderPassDescriptor
Source§type Result = MTLRenderPassDescriptor
type Result = MTLRenderPassDescriptor
Self if the type has no
immutable counterpart. Read moreSource§impl Debug for MTLRenderPassDescriptor
impl Debug for MTLRenderPassDescriptor
Source§impl Deref for MTLRenderPassDescriptor
impl Deref for MTLRenderPassDescriptor
Source§impl Hash for MTLRenderPassDescriptor
impl Hash for MTLRenderPassDescriptor
Source§impl Message for MTLRenderPassDescriptor
impl Message for MTLRenderPassDescriptor
Source§impl NSCopying for MTLRenderPassDescriptor
impl NSCopying for MTLRenderPassDescriptor
Source§impl NSObjectProtocol for MTLRenderPassDescriptor
impl NSObjectProtocol for MTLRenderPassDescriptor
Source§fn isEqual(&self, other: Option<&AnyObject>) -> bool
fn isEqual(&self, other: Option<&AnyObject>) -> bool
Source§fn hash(&self) -> usize
fn hash(&self) -> usize
Source§fn isKindOfClass(&self, cls: &AnyClass) -> bool
fn isKindOfClass(&self, cls: &AnyClass) -> bool
Source§fn is_kind_of<T>(&self) -> bool
fn is_kind_of<T>(&self) -> bool
isKindOfClass directly, or cast your objects with AnyObject::downcast_ref