diff options
author | Samuel Rødal <samuel.rodal@nokia.com> | 2012-02-10 09:52:47 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-02-10 16:24:27 +0100 |
commit | a541fd4d7133618a3748b952196dd69dae786e95 (patch) | |
tree | 43de51904e5b1d83678d89c80270085e5ef394ea | |
parent | fb62fdac1cdb4e26388b5bacc7422ec4579b217e (diff) |
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>
-rw-r--r-- | src/platformsupport/eglconvenience/qeglconvenience.cpp | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/platformsupport/eglconvenience/qeglconvenience.cpp b/src/platformsupport/eglconvenience/qeglconvenience.cpp index f9ccde6b52..4ba9c1f5ac 100644 --- a/src/platformsupport/eglconvenience/qeglconvenience.cpp +++ b/src/platformsupport/eglconvenience/qeglconvenience.cpp @@ -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; } |