D3D12 Error in FVirtualTextureSpace

Hi,

We’re seeing the following D3D12 error when launching with -d3ddebug:

D3D12 ERROR: ID3D12CommandQueue1::ExecuteCommandLists: Placed resources, reserved resources, or committed resources with D3D12_HEAP_FLAG_CREATE_NOT_ZEROED flag with either render target or depth stencil flags must be initialized with a Discard/Clear/Copy operations before other operations are supported. Resource (0x000002D0A04BCF80:‘VirtualPageTable_0’), Subresource (0) is not initialized but is used in Function (ID3D12CommandList::DrawInstanced) on Command List (0x000002D0E1DAA900:‘FD3D12CommandList (GPU 0)’). [ EXECUTION ERROR #1422: RENDER_TARGET_OR_DEPTH_STENCIL_RESOUCE_NOT_INITIALIZED]

The error seems to originate from not clearing “VirtualPageTable_0” created in FVirtualTextureSpace::AllocateTextures before rendering. I had a look in the Epic P4 repo, but couldn’t find any fixes that seem related. Does this error ring a bell? Can it be safely ignored?

All the best,

Marcus

Steps to Reproduce

Hi Marcus,

As far as I know, that error has not come up recently, and the code you are referring to has been around for some time, so it is strange for you to run into this. I do not know if RHI validation is enabled with -d3debug, but just to make sure, can you check if there is any output related to this error when you have -rhivalidation running in addition to -d3debug? I imagine if there was a fix we made for this, it should likely have been done at the RDG level. Please let me know what you find.

Hi Tim,

I tried running with -rhivalidation, but no warnings or errors triggered in the RHI validation.

All the best,

Marcus

This error seems to trigger on multiple render targets. Same thing with “DistanceFieldBentNormalAO” and “CombineLUTs”. It’s fairly easy to resolve by just adding initial clears, but feels a bit unnecessary considering the previous contents are not used. Could consider adding the error ID to the deny list in D3D12Adapter.cpp. Not sure about the severity though.

Hi, I wanted to give you an update, as I don’t have a complete answer from the development team yet. I would suggest against adding this validation error to the ignore list, since we are currently investigating an issue with resource creation that does not specify a clear, copy, or discard operation at initialization. I am not yet sure when we will have a fix in place, but I will keep you informed once I hear more. Do you have any issues you think are tied to this validation error, or how did you come across this?

No, I don’t suspect we have any issues tied to this error. I came across it when I was investigating something else.

Okay, that sounds good to me. That also aligns with our own experience with this validation error. If you do not see any issues related to this error, then I would say you should be okay ignoring it for now. There is an ongoing internal code review that will target a fix in the near future, but it is likely to be included in 5.7 or 5.8. I can send you the CL once it has been submitted and you can try to backport it. Please let me know if you are interested in that.

Hi Marcus, I just found out that the patch intended to resolve these validation errors was submitted to UE5-Main yesterday. If you want to cherry-pick it, you can find the change at CL 48043548.