Нет цветовой привязки в металлическом проходе - PullRequest
0 голосов
/ 19 декабря 2018

Возможно ли иметь 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.'

1 Ответ

0 голосов
/ 19 декабря 2018

Как утверждает утверждение, вам нужно установить pixelFormat в недопустимое значение при создании MTLRenderPipelineState:

pipelineStateDescriptor.colorAttachments[0].pixelFormat = MTLPixelFormatInvalid;
...