I recently updated to 2023.1.5 and pulled the 2023.1 staging branch of UnityGraphics into my project. Most things worked smoothly, except one: enabling any Custom Pass caused the following console error on every frame:
Color and Depth buffer MSAA flags doesn't match, no rendering will occur.
Digging around a little, it looks like this is coming from HDRenderPipeline.PostProcess.cs line 502, inside the RenderPostProcess function. If we’re not in the final pass, we create a TextureDesc, but we never actually give that TextureDesc any indication of how many MSAA Samples it needs to have.
TextureHandle dest = postProcessIsFinalPass ? backBuffer : renderGraph.CreateTexture(
new TextureDesc(Vector2.one, false, true) { colorFormat = GetColorBufferFormat(), name = "Intermediate Postprocess buffer" });
I’ve changed that line to this, and the error goes away:
TextureHandle dest = postProcessIsFinalPass ? backBuffer : renderGraph.CreateTexture(
new TextureDesc(Vector2.one, false, true) { colorFormat = GetColorBufferFormat(), name = "Intermediate Postprocess buffer"
, msaaSamples = hdCamera.msaaSamples}); //add MSAA Samples
This seems like a reasonable fix? But I admit I’m in over my head here. Maybe I’m doing something wrong somewhere else, and this is just a knock-on effect.
If anyone knows what’s going on, and the correct fix for this issue, I’m all ears!