我尝试创建输出纹理并将其设置为colorattachments [0] 在renderpassDesriptor中,而不是curentdrawable.texture中。换句话说,场景被渲染到屏幕外的帧缓冲区中
let textureDescriptor = MTLTextureDescriptor()
textureDescriptor.textureType = MTLTextureType.type2DMultisample
textureDescriptor.width = drawable.texture.width
textureDescriptor.height = drawable.texture.height
textureDescriptor.sampleCount = 4
textureDescriptor.pixelFormat = .bgra8Unorm
textureDescriptor.storageMode = .private
textureDescriptor.usage = .renderTarget
let sampleTex = device.makeTexture(descriptor: textureDescriptor)
let renderPassDescriptor = MTLRenderPassDescriptor()
renderPassDescriptor.colorAttachments[0].texture = sampleTex
renderPassDescriptor.colorAttachments[0].loadAction = .clear
renderPassDescriptor.colorAttachments[0].clearColor =
MTLClearColor(red: 1.0, green: 0.0, blue: 0.0, alpha: 1.0)
renderPassDescriptor.colorAttachments[0].storeAction = .store
屏幕外帧缓冲区绑定为纹理。所以我需要做的是将屏幕外的帧缓冲纹理设置为当前的可播放纹理。这意味着我渲染到屏幕外纹理而不是直接渲染到屏幕上的内容应显示为当前可绘制对象。有什么建议吗?