2

我创建了一个简单的金属代码来显示一些 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)

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

4

0 回答 0