Render passes
Encode a render pass to draw graphics into an image.
Overview
A render pass processes and rasterizes geometry to one or more output attachments using a render pipeline.
Render passes consist of:
A set of input resources, such as buffers and textures
A render pipeline that configures the GPU that does work with the input resources
Draw commands
Vertex shaders, the GPU core functions that process and transform a scene’s geometry
An optional tessellation stage that adds fine details to a scene’s geometry
Fragment shaders, the GPU core functions that produce the final color values for each pixel
Optional outputs that can include color, depth, and stencil attachments, and their load and store operations
See the Customizing render pass setup sample for implementation details.
Topics
Encoding a render pass
MTL4RenderCommandEncoderMTLRenderCommandEncoderMTL4RenderEncoderOptionsMTLTriangleFillModeMTLWindingMTLCullModeMTLPrimitiveTypeMTLIndexTypeMTLDepthClipModeMTLVisibilityResultModeMTLVisibilityResultType
Encoding a render pass in parallel
Configuring a render command encoder
MTL4RenderPassDescriptorMTLRenderPassDescriptorMTLRenderPassAttachmentDescriptorMTLRenderPassColorAttachmentDescriptorArrayMTLRenderPassColorAttachmentDescriptorMTLClearColorMTLRenderPassDepthAttachmentDescriptorMTLMultisampleDepthResolveFilterMTL4RenderPipelineColorAttachmentDescriptorArrayMTLTileRenderPipelineColorAttachmentDescriptorArrayMTLRenderPassStencilAttachmentDescriptorMTLMultisampleStencilResolveFilterMTLRenderPassSampleBufferAttachmentDescriptorArrayMTLRenderPassSampleBufferAttachmentDescriptorMTLLogicalToPhysicalColorAttachmentMapMTLDispatchThreadsIndirectArguments
Render pipeline states
MTLRenderPipelineStateMTL4RenderPipelineDescriptorMTLRenderPipelineDescriptorMTLRenderPipelineFunctionsDescriptorMTL4MeshRenderPipelineDescriptorMTLMeshRenderPipelineDescriptorMTLPipelineBufferDescriptorMTLPipelineBufferDescriptorArrayMTL4RenderPipelineColorAttachmentDescriptorMTLRenderPipelineColorAttachmentDescriptorMTLRenderPipelineColorAttachmentDescriptorArrayMTL4TileRenderPipelineDescriptorMTLTileRenderPipelineDescriptorMTLTileRenderPipelineColorAttachmentDescriptorMTLPipelineOptionMTL4RenderPipelineBinaryFunctionsDescriptorMTL4RenderPipelineDynamicLinkingDescriptor
Dynamic render pipeline states
MTLViewportMTLScissorRectMTLVertexAmplificationViewMappingMTLQuadTessellationFactorsHalfMTLTriangleTessellationFactorsHalf
Render pass inputs
MTLVertexDescriptorMTLVertexAttributeDescriptorMTLVertexAttributeDescriptorArrayMTLVertexBufferLayoutDescriptorMTLVertexBufferLayoutDescriptorArrayMTLBufferLayoutStrideDynamic
Render pass outputs
Depth testing
Calculating primitive visibility using depth testingMTLDepthStencilStateMTLDepthStencilDescriptorMTLStencilDescriptor
Rasterization settings
Rendering at different rasterization ratesCreating a rasterization rate mapRendering with a rasterization rate mapScaling variable rasterization rate contentMTLRasterizationRateMapDescriptorMTLRasterizationRateMapMTLCoordinate2DMTLCoordinate2DMake(_:_:)
Optimizing techniques
Specifying drawing and dispatch arguments indirectlyRendering to multiple viewports in a draw commandRendering to multiple texture slices in a draw command
Advanced multisampling
Positioning samples programmaticallyStoring data a pass makes with custom sample positions for a subsequent pass