rhi: gl: Prevent GPU timings from stopping upon resize

Doing glGenQueries every time the window (and so swapchain) is resized
is not great.

Change-Id: Ide1cf970d86dd5469b06633a3276c2130b030037
Reviewed-by: Andy Nichols <andy.nichols@qt.io>
This commit is contained in:
Laszlo Agocs 2023-08-31 12:27:25 +02:00
parent bfc2d69c61
commit fc704d0ebf

View File

@ -6294,12 +6294,15 @@ bool QGles2SwapChain::createOrResize()
void QGles2SwapChainTimestamps::prepare(QRhiGles2 *rhiD)
{
rhiD->f->glGenQueries(TIMESTAMP_PAIRS * 2, query);
if (!query[0])
rhiD->f->glGenQueries(TIMESTAMP_PAIRS * 2, query);
}
void QGles2SwapChainTimestamps::destroy(QRhiGles2 *rhiD)
{
rhiD->f->glDeleteQueries(TIMESTAMP_PAIRS * 2, query);
memset(active, 0, sizeof(active));
memset(query, 0, sizeof(query));
}
bool QGles2SwapChainTimestamps::tryQueryTimestamps(int pairIndex, QRhiGles2 *rhiD, double *elapsedSec)