RHI: fix the leak of QRhiResourceUpdateBatch


There are 2 ways to dispose of a QRhiResourceUpdateBatch obtained with
QRhi::nextResourceUpdateBatch():
1) Either give it to beginPass/endPass/beginComputePass/endComputePass
so it is sent to the RHI backend and then automatically released;
2) or call QRhiResourceUpdateBatch::release() if the resource update
is not used for any pass.

The Qt3D RHI renderer was never disposing of the
QRhiResourceUpdateBatch, and could end up exhausting all the 64 batches
available in the RHI: "Resource update batch pool exhausted (max is
64)", in addition to consuming a lot of RAM if the buffers or textures
are large.

To fix this, ensure the QRhiResourceUpdateBatch'es we allocate are always
released: when requesting a new one, send the previous one to
endPass/endComputePass (1), and when destroying
the SubmissionContext, release the one we will not use (2).

Pick-to: 6.4 6.5
Change-Id: Ic3fb145b11a8e615c83745f560f019e6c4ee37f7
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
commit6b6465032f103a084e416cbddf03f8e83191aea2
parentb15f62e3234a85d7220fc1533b6a224522dd4735
authorAurélien Brooke <aurelien@bahiasoft.fr>
committerAurélien Brooke <aurelien@bahiasoft.fr>
commit timeMon, 19 Dec 2022 08:50:22 +0100