summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2017-04-18 14:34:55 +0200
committerGiuseppe D'Angelo <giuseppe.dangelo@kdab.com>2017-04-18 13:40:48 +0000
commitba060af041dc866c80f89b64a2bf87d6085f995f (patch)
treeb64765233ed8f9f70e9488de3250d36288012391
parentc0c856168efa470d31d7261324dc1e94d4d99612 (diff)
tst_GraphicsHelperGL3_3::blitFramebuffer(): check how many samples are supported
We can't just generate a multisampled 2D texture with 4 samples per texel; we need to check the implementation-defined maximum amount of samples. Lacking glGetInternalformat*, query GL_MAX_SAMPLES. Since OpenGL does not mandate a minimum, getting 0 is actually allowed; glTexImage2DMultisample however does not accept 0 as number of samples, hence skip the test in that case. Change-Id: Id1b0c9705aed0665093aae44983eac8b656b676f Task-number: QTBUG-59828 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
-rw-r--r--tests/auto/render/graphicshelpergl3_3/tst_graphicshelpergl3_3.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/tests/auto/render/graphicshelpergl3_3/tst_graphicshelpergl3_3.cpp b/tests/auto/render/graphicshelpergl3_3/tst_graphicshelpergl3_3.cpp
index 293750dbf..58c12fcc9 100644
--- a/tests/auto/render/graphicshelpergl3_3/tst_graphicshelpergl3_3.cpp
+++ b/tests/auto/render/graphicshelpergl3_3/tst_graphicshelpergl3_3.cpp
@@ -1967,6 +1967,11 @@ private Q_SLOTS:
if (!m_initializationSuccessful)
QSKIP("Initialization failed, OpenGL 3.3 Core functions not supported");
+ GLint maxSamples;
+ m_func->glGetIntegerv(GL_MAX_SAMPLES, &maxSamples);
+ if (maxSamples < 1)
+ QSKIP("This test requires an implementation that supports multisampled textures");
+
// GIVEN
GLuint fbos[2];
GLuint fboTextures[2];
@@ -1975,7 +1980,7 @@ private Q_SLOTS:
m_func->glGenTextures(2, fboTextures);
m_func->glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, fboTextures[0]);
- m_func->glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, 4, GL_RGBA8, 10, 10, true);
+ m_func->glTexImage2DMultisample(GL_TEXTURE_2D_MULTISAMPLE, maxSamples, GL_RGBA8, 10, 10, true);
m_func->glBindTexture(GL_TEXTURE_2D_MULTISAMPLE, 0);
m_func->glBindTexture(GL_TEXTURE_2D, fboTextures[1]);