金属中没有颜色附着渲染通道

时间:2018-12-19 09:19:12

标签: metal

是否可以使用<script src="https://cdnjs.cloudflare.com/ajax/libs/lodash.js/4.13.1/lodash.min.js"></script>来渲染深度或模版纹理,但没有颜色附件?像这样:

MTLRenderPassDescriptor

我尝试这样做,但是在尝试使用此管道状态时收到以下错误:

MTLRenderPassDescriptor* textureRenderPassDescriptor = [MTLRenderPassDescriptor renderPassDescriptor];
MTLRenderPassStencilAttachmentDescriptor* textureAttachment = [[MTLRenderPassStencilAttachmentDescriptor alloc]init];
textureAttachment.texture = texture;
textureAttachment.loadAction = MTLLoadActionClear;
textureAttachment.storeAction = MTLStoreActionStore;
textureRenderPassDescriptor.stencilAttachment = textureAttachment;

1 个答案:

答案 0 :(得分:3)

作为声明状态,创建pixelFormat时需要将MTLRenderPipelineState设置为无效:

pipelineStateDescriptor.colorAttachments[0].pixelFormat = MTLPixelFormatInvalid;