More graceful handling of QSurfaceFormat::samples() with EGL.

Earlier, if we asked for say 16 and the implementation only handled 4,
we defaulted to 0 (no antialiasing). Now, we instead try a progressively
lower number until we find a match.

Task-number: QTBUG-22669
Change-Id: I63f4b8aadf8e06713d19fdc9b9d73672162c816a
Reviewed-by: Jørgen Lind <jorgen.lind@nokia.com>
bb10
Samuel Rødal 2012-02-10 09:52:47 +01:00 committed by Qt by Nokia
parent fb62fdac1c
commit a541fd4d71
1 changed files with 10 additions and 4 deletions

View File

@ -152,13 +152,19 @@ bool q_reduceConfigAttributes(QVector<EGLint> *configAttributes)
}
}
i = configAttributes->indexOf(EGL_SAMPLES);
if (i >= 0) {
EGLint value = configAttributes->value(i+1, 0);
if (value > 1)
configAttributes->replace(i+1, qMin(EGLint(16), value / 2));
else
configAttributes->remove(i, 2);
return true;
}
i = configAttributes->indexOf(EGL_SAMPLE_BUFFERS);
if (i >= 0) {
configAttributes->remove(i,2);
i = configAttributes->indexOf(EGL_SAMPLES);
if (i >= 0) {
configAttributes->remove(i,2);
}
return true;
}