How to Sample Depth Texture in UE 4.27

As part of our plugin, we’ve written code to access the DeviceDepth in a callback to IRendererModule::RegisterPostOpaqueRenderDelegate using a DrawPrimitive call, and convert it to a suitable SceneDepth ourselves. In versions 4.22 - 4.26 of UE, this works great (picture a nice normal depth map), but in version 4.27, I instead get a very weird pattern:


This is from reading out FPostOpaqueRenderParameters::DepthTexture , passed to the callback by the event itself, so I would’ve expected everything to stay the same.
I’ve attached the core code that we’re calling in case it helps.
OpaqueGrab.cpp (9.5 KB)

I’ve narrowed this down slightly in that it seems to only happen with DX12 as the RHI (UE 4.26+DX12 works fine). I’ve tried calling RHICmdList->TransitionResource on the DepthTexture in case that was required but it just resulted in a pure white texture which seems like a lateral move at best.

Edit: In contrast to the code I shared above, I’ve also tried using RHICopySubTextureRegion_RenderThread in PostResolve to no effect - I get a pure white tex there as well.