XCode8 Swift 2.2中的MTLPixelFormatInvalid

时间:2016-10-20 09:16:23

标签: ios metalanguage

我创建了一个简单的金属代码来显示一些3D对象。现在代码在我的mac中工作正常。

当我将其转移到安装了相同xcode 8的另一台相同的Mac机器时,它给我以下错误

/BuildRoot/Library/Caches/com.apple.xbs/Sources/Metal/Metal-85.83/ToolsLayers/Debug/MTLDebugRenderCommandEncoder.mm:969: failed assertion `For depth attachment, the renderPipelineState pixelFormat must be MTLPixelFormatInvalid, as no texture is set.'

以下区域显示错误:

let renderPassDescriptor = MTLRenderPassDescriptor()
        renderPassDescriptor.colorAttachments[0].texture = drawable.texture
        renderPassDescriptor.colorAttachments[0].loadAction = .Clear
        renderPassDescriptor.colorAttachments[0].clearColor = MTLClearColor(red: 1.0, green: 1.0, blue: 1.0, alpha: 1.0)
        renderPassDescriptor.colorAttachments[0].storeAction = .Store
        renderPassDescriptor.depthAttachment.loadAction = .Clear
        renderPassDescriptor.depthAttachment.clearDepth = 1.0
        renderPassDescriptor.depthAttachment.storeAction = .MultisampleResolve
        let commandBuffer = commandQueue.commandBuffer()
        commandBuffer.addCompletedHandler { (commandBuffer) -> Void in
            dispatch_semaphore_signal(self.bufferProvider.avaliableResourcesSemaphore)
        }
        renderEncoder = commandBuffer.renderCommandEncoderWithDescriptor(renderPassDescriptor)
        //For now cull mode is used instead of depth buffer
        renderEncoder.setCullMode(.None)
       // renderEncoder.setDepthClipMode(.Clip)
        renderEncoder.setDepthStencilState(depthStencilStateE)
        renderEncoder.setRenderPipelineState(pipelineState)

他最后一行我收到了这个错误。任何人都可以帮忙吗?

0 个答案:

没有答案