rhi: tst_qrhi: Check for OpenGL cap on the platform
Running tst_qrhi -platform eglfs will pass on RPi4 / Mesa 22. This does not test Vulkan of course since the platform plugin cannot create a Vulkan instance. Running tst_qrhi -platform vkkhrdisplay will enable Vulkan but will still try OpenGL since the autotest does not query the platform integration about OpenGL support. Make this nicer by skipping most of the GL test if the platform integration we have cannot handle OpenGL stuff anyway. For some tests the data-driven approach has to be removed since doing QFETCH without any rows will crash. These two OpenGL-specific tests now check OpenGL support directly and QSKIP if needed. While we are at it, fix up the Vulkan instance API version as well. Change-Id: I2891c04540bc2dfd0ccf475629bd23542bff15f5 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Andy Nichols <andy.nichols@qt.io> (cherry picked from commit 2de14b81a9c76ce95c96385262467f41892a2a1c) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
496147fd3f
commit
0c3d791e66
@ -17,6 +17,8 @@
|
||||
# include <QOpenGLContext>
|
||||
# include <QOpenGLFunctions>
|
||||
# include <QtGui/private/qrhigles2_p.h>
|
||||
# include <QtGui/private/qguiapplication_p.h>
|
||||
# include <qpa/qplatformintegration.h>
|
||||
# define TST_GL
|
||||
#endif
|
||||
|
||||
@ -49,7 +51,6 @@ private slots:
|
||||
void cleanupTestCase();
|
||||
|
||||
void rhiTestData();
|
||||
void rhiTestDataOpenGL();
|
||||
void create_data();
|
||||
void create();
|
||||
void nativeHandles_data();
|
||||
@ -121,9 +122,7 @@ private slots:
|
||||
|
||||
void pipelineCache_data();
|
||||
void pipelineCache();
|
||||
void textureImportOpenGL_data();
|
||||
void textureImportOpenGL();
|
||||
void renderbufferImportOpenGL_data();
|
||||
void renderbufferImportOpenGL();
|
||||
void threeDimTexture_data();
|
||||
void threeDimTexture();
|
||||
@ -178,7 +177,7 @@ void tst_QRhi::initTestCase()
|
||||
if (supportedVersion >= QVersionNumber(1, 2))
|
||||
vulkanInstance.setApiVersion(QVersionNumber(1, 2));
|
||||
else if (supportedVersion >= QVersionNumber(1, 1))
|
||||
vulkanInstance.setApiVersion(QVersionNumber(1, 2));
|
||||
vulkanInstance.setApiVersion(QVersionNumber(1, 1));
|
||||
vulkanInstance.setLayers({ "VK_LAYER_KHRONOS_validation" });
|
||||
vulkanInstance.setExtensions(QRhiVulkanInitParams::preferredInstanceExtensions());
|
||||
vulkanInstance.create();
|
||||
@ -209,7 +208,8 @@ void tst_QRhi::rhiTestData()
|
||||
QTest::newRow("Null") << QRhi::Null << static_cast<QRhiInitParams *>(&initParams.null);
|
||||
#endif
|
||||
#ifdef TST_GL
|
||||
QTest::newRow("OpenGL") << QRhi::OpenGLES2 << static_cast<QRhiInitParams *>(&initParams.gl);
|
||||
if (QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL))
|
||||
QTest::newRow("OpenGL") << QRhi::OpenGLES2 << static_cast<QRhiInitParams *>(&initParams.gl);
|
||||
#endif
|
||||
#ifdef TST_VK
|
||||
if (vulkanInstance.isValid())
|
||||
@ -223,16 +223,6 @@ void tst_QRhi::rhiTestData()
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QRhi::rhiTestDataOpenGL()
|
||||
{
|
||||
QTest::addColumn<QRhi::Implementation>("impl");
|
||||
QTest::addColumn<QRhiInitParams *>("initParams");
|
||||
|
||||
#ifdef TST_GL
|
||||
QTest::newRow("OpenGL") << QRhi::OpenGLES2 << static_cast<QRhiInitParams *>(&initParams.gl);
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QRhi::create_data()
|
||||
{
|
||||
rhiTestData();
|
||||
@ -4383,21 +4373,13 @@ void tst_QRhi::pipelineCache()
|
||||
}
|
||||
}
|
||||
|
||||
void tst_QRhi::textureImportOpenGL_data()
|
||||
{
|
||||
rhiTestDataOpenGL();
|
||||
}
|
||||
|
||||
void tst_QRhi::textureImportOpenGL()
|
||||
{
|
||||
QFETCH(QRhi::Implementation, impl);
|
||||
if (impl != QRhi::OpenGLES2)
|
||||
#ifdef TST_GL
|
||||
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL))
|
||||
QSKIP("Skipping OpenGL-dependent test");
|
||||
|
||||
#ifdef TST_GL
|
||||
QFETCH(QRhiInitParams *, initParams);
|
||||
|
||||
QScopedPointer<QRhi> rhi(QRhi::create(impl, initParams, QRhi::Flags(), nullptr));
|
||||
QScopedPointer<QRhi> rhi(QRhi::create(QRhi::OpenGLES2, &initParams.gl, QRhi::Flags(), nullptr));
|
||||
if (!rhi)
|
||||
QSKIP("QRhi could not be created, skipping testing native texture");
|
||||
|
||||
@ -4437,21 +4419,13 @@ void tst_QRhi::textureImportOpenGL()
|
||||
#endif
|
||||
}
|
||||
|
||||
void tst_QRhi::renderbufferImportOpenGL_data()
|
||||
{
|
||||
rhiTestDataOpenGL();
|
||||
}
|
||||
|
||||
void tst_QRhi::renderbufferImportOpenGL()
|
||||
{
|
||||
QFETCH(QRhi::Implementation, impl);
|
||||
if (impl != QRhi::OpenGLES2)
|
||||
#ifdef TST_GL
|
||||
if (!QGuiApplicationPrivate::platformIntegration()->hasCapability(QPlatformIntegration::OpenGL))
|
||||
QSKIP("Skipping OpenGL-dependent test");
|
||||
|
||||
#ifdef TST_GL
|
||||
QFETCH(QRhiInitParams *, initParams);
|
||||
|
||||
QScopedPointer<QRhi> rhi(QRhi::create(impl, initParams, QRhi::Flags(), nullptr));
|
||||
QScopedPointer<QRhi> rhi(QRhi::create(QRhi::OpenGLES2, &initParams.gl, QRhi::Flags(), nullptr));
|
||||
if (!rhi)
|
||||
QSKIP("QRhi could not be created, skipping testing native texture");
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user