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]