I have a painting app and I'm trying to add a layers feature. My latest confusion over disappearing brush strokes leads to this code...
let rpd = MTLRenderPassDescriptor()
rpd.colorAttachments[0].texture = sharedMultiSampleTexture
rpd.colorAttachments[0].resolveTexture = layer.flattened
rpd.colorAttachments[0].loadAction = .load
rpd.colorAttachments[0].storeAction = .multisampleResolve
let renc = commandBuffer.makeRenderCommandEncoder(descriptor: rpd)
[ ... draw brush marks ... ]
I'm trying to render anti-aliased shapes to the MTLTexture `layer.flattened` and have them accumulate over multiple passes through this code. I think the `loadAction = .load` would accumulate results, if I weren't using multisampling. But it seems the resolveTexture is cleared and overwritten every time. Is there no equivalent of `loadAction = .load` for the resolve texture? ... Or maybe I've misdiagnosed the problem completely...
Rob