Skip to content

d3d12: Fixes stale context bindings after copy, resolve, and clear

d3d12: Fixes stale context bindings after copy, resolve, and clear

Some GL applications, including Blender, are producing rendering artifacts due to missing resource state barriers.

The d3d12_context keeps track of all resources bound as shader resource or constant buffers. If any of these resources are used for Copy, Resolve, or Clear source/target, the context tracking must be updated so the correct state can be restored before the next draw call.

This change is something of a big hammer. Essentially, if a resource currently bound as an SRV or CBV gets used for a non-shader access, a flag is set in the context that invalidates all bindings of the same type on the same shader stage. Thus the next Draw execution refreshes the shader views and state transitions state before invoking Draw on the command list.

A more elegant (and complex) fix would limit the invalidation to resource state only, rather than also forcing a recreation of resource views. It is unclear right now whether it is worth the time to implement a more elegant fix.

This MR contains an additional change that sets all SRV and CBV descriptors as data-static.

Merge request reports