【问题标题】:No colour attachment in metal render pass金属渲染通道中没有颜色附件
【发布时间】:2018-12-19 23:03:27
【问题描述】:

是否可以有一个MTLRenderPassDescriptor 渲染到深度或模板纹理,但没有颜色附件?像这样:

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

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

failed assertion `For color attachment 0, the renderPipelineState pixelFormat must be MTLPixelFormatInvalid, as no texture is set.'

【问题讨论】:

    标签: metal


    【解决方案1】:

    如断言所述,您需要在创建MTLRenderPipelineState 时将pixelFormat 设置为无效:

    pipelineStateDescriptor.colorAttachments[0].pixelFormat = MTLPixelFormatInvalid;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-12-30
      • 2018-01-03
      • 2022-01-08
      • 2017-03-13
      • 1970-01-01
      • 2016-03-06
      • 2019-01-01
      相关资源
      最近更新 更多