MTLPixelFormatInvalid in XCode8 Swift 2.2

1k Views Asked by At

I have created a simple metal code to display some 3D object. Now the code is working fine in my mac.

When I shifted it to another Identical Mac machine with same xcode 8 installed, its giving me the following error

/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.'

And the error indicating in he following region:

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)

he last line I am getting this error. can any one help?

0

There are 0 best solutions below