Release draw call data when its owning pass goes away
Draw call data is looked up with the pass, the cid of the key, as
part of the key. The pass objects are owned by the layer render
data, so when a view is destroyed all entries keyed on its passes
become unreachable, but they were never released. Content that
outlives the view, for example models and materials in an import
scene shared with other views, would then leak its uniform buffers
and cached shader resource bindings on every view destruction. The
same pattern applied to render extensions that key draw call data
on themselves, to the effect system's uniform buffers, and to the
tonemapping quad keyed on the layer.
Add cleanupDrawCallDataForCid() and call it for every pass owned by
the layer render data when it is destroyed, for render extensions
when they are cleaned up, in the effect system's destructor, and
for the layer in the scene renderer's destructor.
Renderables prepared on behalf of an extension are keyed on the
extension combined with the prep context slot, so the layer render
data also releases those per extension context. An extension that
is destroyed while its layer lives on is only released for slot 0;
carrying the slot in the key's index instead of the cid would close
that gap and is left for a follow-up.
The new tst_qquick3ddrawcalldata test repeatedly destroys and
recreates a View3D importing a shared scene and verifies that the
draw call data returns to its baseline instead of growing with
every cycle.
Pick-to: 6.12 6.11 6.8
Task-number: QTBUG-149579
Change-Id: I9535d8bc6b793943aa3afc66c33bd046b8504ccc
Reviewed-by: Andy Nichols <andy.nichols@qt.io>