Change GrRingBuffer::finishSubmit to be a finishedProc
Change-Id: I307669ee928152ea3616f3814716da7476a03c46
Bug: skia:10530
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/305716
Reviewed-by: Brian Osman <brianosman@google.com>
Commit-Queue: Jim Van Verth <jvanverth@google.com>
diff --git a/src/gpu/GrRingBuffer.cpp b/src/gpu/GrRingBuffer.cpp
index a911c20..86b7904 100644
--- a/src/gpu/GrRingBuffer.cpp
+++ b/src/gpu/GrRingBuffer.cpp
@@ -79,17 +79,27 @@
}
// used when current command buffer/command list is submitted
-void GrRingBuffer::startSubmit(GrRingBuffer::SubmitData* submitData) {
- submitData->fTrackedBuffers = std::move(fTrackedBuffers);
- submitData->fLastHead = fHead;
- submitData->fGenID = fGenID;
+void GrRingBuffer::startSubmit(GrGpu* gpu) {
+ for (unsigned int i = 0; i < fTrackedBuffers.size(); ++i) {
+ gpu->takeOwnershipOfBuffer(std::move(fTrackedBuffers[i]));
+ }
+ fTrackedBuffers.clear();
// add current buffer to be tracked for next submit
fTrackedBuffers.push_back(fCurrentBuffer);
+
+ SubmitData* submitData = new SubmitData();
+ submitData->fOwner = this;
+ submitData->fLastHead = fHead;
+ submitData->fGenID = fGenID;
+ gpu->addFinishedProc(FinishSubmit, submitData);
}
// used when current command buffer/command list is completed
-void GrRingBuffer::finishSubmit(const GrRingBuffer::SubmitData& submitData) {
- if (submitData.fGenID == fGenID) {
- fTail = submitData.fLastHead;
+void GrRingBuffer::FinishSubmit(void* finishedContext) {
+ GrRingBuffer::SubmitData* submitData = (GrRingBuffer::SubmitData*)finishedContext;
+ if (submitData && submitData->fOwner && submitData->fGenID == submitData->fOwner->fGenID) {
+ submitData->fOwner->fTail = submitData->fLastHead;
+ submitData->fOwner = nullptr;
}
+ delete submitData;
}