kwinglutils: Assert glFenceSync

This really should not fail unless we did something seriously wrong
on our end, such as changing GL context during paintScreen.

If we add an invalid `GLSync` to the queue it can lead to very hard
to debug crashes in seemingly unrelated parts of the rendering
process, when the queue is drained, potentially seconds after the
actual failure that occurred here.

Signed-off-by: Eike Hein <eike.hein@mbition.io>
This commit is contained in:
Kai Uwe Broulik 2022-02-16 08:38:23 +01:00 committed by Kai Uwe Broulik
parent 2d56154fe8
commit 53473d72e6

View file

@ -1755,6 +1755,7 @@ GLvoid *GLVertexBufferPrivate::getIdleRange(size_t size)
// Emit a fence now
BufferFence fence;
fence.sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
Q_ASSERT(fence.sync);
fence.nextEnd = bufferSize;
fences.emplace_back(fence);
}
@ -2045,6 +2046,7 @@ void GLVertexBuffer::endOfFrame()
} else {
BufferFence fence;
fence.sync = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
Q_ASSERT(fence.sync);
fence.nextEnd = d->nextOffset + d->bufferSize;
d->fences.emplace_back(fence);