GPU Validation texture barrier errors

In an attempt to clear out as many D3D warnings/errors as I can, I have recently started trying to run with -gpuvalidation enabled. The first errors to pop out of this are these:

LogD3D12RHI: Error: [D3DDebug] [ID: 1358] GPU-BASED VALIDATION: Dispatch, Incompatible texture barrier layout: Resource: 0x0000025EA744B400:'SkyAtmosphere.CameraAPVolumeMieOnly0', Subresource Index: [0], Descriptor heap index to DescriptorTableStart: [452545], Descriptor heap index FromTableStart: [2], Binding Type In Descriptor: SRV, Layout: D3D12_BARRIER_LAYOUT_UNORDERED_ACCESS(0x3), Index of Descriptor Range: 0, Shader Stage: COMPUTE, ...
LogD3D12RHI: Error: [D3DDebug] [ID: 1358] GPU-BASED VALIDATION: Dispatch, Incompatible texture barrier layout: Resource: 0x0000025EA744A770:'SkyAtmosphere.CameraAPVolumeRayOnly0', Subresource Index: [0], Descriptor heap index to DescriptorTableStart: [452545], Descriptor heap index FromTableStart: [3], Binding Type In Descriptor: SRV, Layout: D3D12_BARRIER_LAYOUT_UNORDERED_ACCESS(0x3), Index of Descriptor Range: 0, Shader Stage: COMPUTE, ...
LogD3D12RHI: Error: [D3DDebug] [ID: 1358] GPU-BASED VALIDATION: Draw, Incompatible texture barrier layout: Resource: 0x0000015F0C593890:'RT_WeatherGPU_Air_Output', Subresource Index: [0], Descriptor heap index to DescriptorTableStart: [27368], Descriptor heap index FromTableStart: [1], Binding Type In Descriptor: SRV, Layout: D3D12_BARRIER_LAYOUT_RENDER_TARGET(0x2), Index of Descriptor Range: 0, Shader Stage: PIXEL, ...

The first two instances might be due to the fact that in VolumetricCloud.usf, these textures are referenced via View.CameraAerialPerspectiveVolumeMieOnly/RayOnly.

These are declared in FViewUniformShaderParameters as SHADER_TEXTURE_PARAMETERs instead of SHADER_PARAMETER_RDG_TEXTUREs, so the RDG system cannot detect their usage as SRVs and auto-generate the appropriate resource barriers.

The other textures declared alongside these which do not error all seem to also be bound in FRenderSkyAtmospherePS::Parameters as well, where they ARE defined as SHADER_PARAMETER_RDG_TEXTUREs. I’m guessing that the resource barriers are emitted when they are used there, before getting to volumetric clouds.

If this is the case, this seems like something that I can at least work around, but I am less certain how to approach the last instance. This texture is never read or written directly from code - it is a Texture2DRenderTarget asset that is entirely handled through a blueprint. It is updated through a Draw Material to Render Target node in the blueprint, and sampled by creating a dynamic material instance through a node in another part of the blueprint graph and using a Set Texture Parameter Value node, as well as a Set Niagara Variable (Texture) node. As such, I’m not sure what sort of fix would be required to detect and emit the correct barriers.

In the end, is this even something I need to worry about? Or are these relatively harmless errors that I should just filter out with the others in FD3D12Adapter::CreateD3DInfoQueue() and move on?

[Attachment Removed]

Steps to Reproduce

  1. Run game with GPU validation enabled
  2. Load into main game world
  3. Wait 2-3 hours for loading to complete (GPU validation layer is sloooooooow)
    [Attachment Removed]

Hi Mike,

Thanks for reaching out. It looks like the first two validation errors can be pretty easily fixed by converting SkyAtmosphere.CameraAPVolumeMieOnly0 and SkyAtmosphere.CameraAPVolumeRayOnly0 to external access textures. The third validation error would be much trickier to fix, as it comes from a blueprint-driven Texture2DRenderTarget that we cannot easily track via the RDG. However, it’s not a major issue, as on desktop D3D12 still allows shader reads for both UAV and RTV layouts, meaning that on current PC hardware, these are only minor validation model violations. So I would say you can probably ignore those messages and suppress them by filtering them out, as you said. I created a patch you can try applying to your build to see if it removes the warnings for the first two transitions. Let me know if it works for you, and I can look to submit upstream.

Cheers,

Tim

[Attachment Removed]

Ok, great! I will look to merge this change into our codebase then. If you don’t have any further questions, I will go ahead and close out the ticket. Let me know if that is ok with you.

[Attachment Removed]

Thank you! Applying the patch now. Also glad to confirm that this is a relatively harmless warning.

[Attachment Removed]

It looks like the patch did work to eliminate those SkyAtmosphere warnings. Thank you again.

[Attachment Removed]