我想使用金属性能着色器处理来自深度缓冲区的信息,例如使用高斯或索贝尔着色器。
MTLTexture
使用depth32Float
像素格式时遇到问题。MPSImageGaussianBlur
或任何其他性能着色器不接受它作为源纹理。
我尝试使用转换它:depthBufferTexture.makeTextureView(pixelFormat: .bgra8Unorm)
但收到错误消息:
validateArgumentsForTextureViewOnDevice:1406:断言失败
source texture pixelFormat (MTLPixelFormatDepth32Float) not castable.
有什么方法可以转换depth32Float
为bgra8UNorm
或任何其他像素格式吗?