在创建MTLRenderCommandEncoder对象的时候需要传入 MTLRenderPassDescriptor 作为参数, 那么MTLRenderPassDescritpor 是个什么东西, 应该如何设置其中的参数呢?
1. 创建 MTLRenderPassDescriptor
+ (MTLRenderPassDescriptor
*)renderPassDescriptor
2 常用的属性
(1) colorAttachment
在定义中是数组(array). 继承自MTLRenderPassAttachmentDescritpor
(2) depthAttachment
depthAttachment 也是继承自 MTLRenderPassAttachmentDescritpor, 所以常用的属性就很相似
3. MTLRenderPassAttachmentDescritpor
其常用属性包括:
@property (nullable, nonatomic, strong) id<MTLTexture> texture, 普通直接使用CAMetalLayer的nextDrawable中的texture
@property (nonatomic) MTLClearColor clearColor
@property (nonatomic) MTLStoreAction storeAction
@property (nonatomic) MTLLoadAction loadAction