I am trying to map a offscreen D2D render target to memory.
- The render target is created as a
ID3D12Resource
withD3D12_RESOURCE_FLAG_ALLOW_RENDER_TARGET
- Then passed through
ID3D11On12Device::CreateWrappedResource()
- Then made into a
ID2D1Bitmap1
withID2D1DeviceContext2::CreateBitmapFromDxgiSurface
The app draws on it with D2D, then it is used as a pixel shader resource in a D3D12 shader and I can verify that the content of the texture is correct this way.
However, if I copy it to a D3D12_HEAP_TYPE_READBACK
resource through CopyTextureRegion
, it comes back as fully set to 0. The code I use works for other textures. I tried after the D3D11DeviceContext
is flushed, and also after the Present to screen is done.
I also tried to copy and map it in the D2D realm, but I have the same result. I feel this resource is special in some way and I'm missing something.