summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorMäättä Antti <antti.maatta@qt.io>2017-10-11 12:50:42 +0300
committerAntti Määttä <antti.maatta@qt.io>2017-10-20 09:22:33 +0000
commite45ef3505b735ac422ecd2c69b0a19f30c2ff946 (patch)
treeba64c305c9823570c3d2af309dc27abe3e9e6bdb /tests
parentd0dbd6cdbf8c4cc5b4b46ec1cdd3687b1170edc6 (diff)
Add GLES2 backend to runtime
Task-number: BOUL-789 Change-Id: I4a076b6a56860275d3ea89dd4d6709cb14fb1c40 Reviewed-by: Tomi Korpipää <tomi.korpipaa@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/runtime/Qt3DSRenderTestBase.cpp26
-rw-r--r--tests/auto/runtime/shadergenerator/Qt3DSRenderTestCustomMaterialGenerator.cpp2
-rw-r--r--tests/auto/runtime/tst_qt3dsruntime.cpp81
-rw-r--r--tests/auto/runtime/tst_qt3dsruntime.h22
4 files changed, 109 insertions, 22 deletions
diff --git a/tests/auto/runtime/Qt3DSRenderTestBase.cpp b/tests/auto/runtime/Qt3DSRenderTestBase.cpp
index 24712ec8..99748916 100644
--- a/tests/auto/runtime/Qt3DSRenderTestBase.cpp
+++ b/tests/auto/runtime/Qt3DSRenderTestBase.cpp
@@ -46,6 +46,32 @@ bool NVRenderTestBase::initializeUICRenderer(QSurfaceFormat format)
m_rc = m_factory->GetUICRenderContext();
m_renderImpl = new uic::render::CUICRendererImpl(*m_rc);
+ QString versionString;
+ switch ((QT3DSU32)m_rc->GetRenderContext().GetRenderContextType()) {
+ case NVRenderContextValues::GLES2:
+ versionString = QLatin1Literal("gles2");
+ break;
+ case NVRenderContextValues::GL2:
+ versionString = QLatin1Literal("gl2");
+ break;
+ case NVRenderContextValues::GLES3:
+ versionString = QLatin1Literal("gles3");
+ break;
+ case NVRenderContextValues::GL3:
+ versionString = QLatin1Literal("gl3");
+ break;
+ case NVRenderContextValues::GLES3PLUS:
+ versionString = QLatin1Literal("gles3x");
+ break;
+ case NVRenderContextValues::GL4:
+ versionString = QLatin1Literal("gl4");
+ break;
+ default:
+ break;
+ }
+
+ m_rc->GetDynamicObjectSystem().setShaderCodeLibraryVersion(versionString);
+
return true;
}
diff --git a/tests/auto/runtime/shadergenerator/Qt3DSRenderTestCustomMaterialGenerator.cpp b/tests/auto/runtime/shadergenerator/Qt3DSRenderTestCustomMaterialGenerator.cpp
index a76a2de8..6e5dcf00 100644
--- a/tests/auto/runtime/shadergenerator/Qt3DSRenderTestCustomMaterialGenerator.cpp
+++ b/tests/auto/runtime/shadergenerator/Qt3DSRenderTestCustomMaterialGenerator.cpp
@@ -224,7 +224,7 @@ struct CustomTestKey
#define MAX_TEST_KEY ((1llu<<20)-1)
-CustomTestKey randomizeTestKey()
+static CustomTestKey randomizeTestKey()
{
uint64_t v = (uint64_t(qrand()))%MAX_TEST_KEY;
return *reinterpret_cast<CustomTestKey*>(&v);
diff --git a/tests/auto/runtime/tst_qt3dsruntime.cpp b/tests/auto/runtime/tst_qt3dsruntime.cpp
index f272d7ea..32a5fb96 100644
--- a/tests/auto/runtime/tst_qt3dsruntime.cpp
+++ b/tests/auto/runtime/tst_qt3dsruntime.cpp
@@ -168,7 +168,9 @@ bool tst_qt3dsruntime::init(QSurfaceFormat format)
bool tst_qt3dsruntime::init()
{
-#if defined(Q_OS_ANDROID)
+#if defined(QT_OPENGL_ES_2)
+ return init(makeFormat(2, 0, true, false));
+#elif defined(Q_OS_ANDROID) || defined(QT_OPENGL_ES_3)
return init(makeFormat(3, 2, true, false));
#else
return init(makeFormat(4, 3));
@@ -459,7 +461,67 @@ void tst_qt3dsruntime::testNVRenderTestProgramPipeline()
cleanup();
}
-#if !defined(Q_OS_ANDROID)
+#if defined(QT_OPENGL_ES_2)
+void tst_qt3dsruntime::testRenderDefaultShaderGenerator_200es()
+{
+ if (init(makeFormat(2, 0, true, false))) {
+ runDefaultShaderGeneratorTest();
+ cleanup();
+ }
+}
+void tst_qt3dsruntime::testRenderCustomShaderGenerator_200es()
+{
+ runCustomShaderGeneratorTest(makeFormat(2, 0, true, false));
+ cleanup();
+}
+#endif
+
+#if defined(QT_OPENGL_ES_3)
+void tst_qt3dsruntime::testRenderDefaultShaderGenerator_300es()
+{
+ if (init(makeFormat(3, 0, true, false))) {
+ runDefaultShaderGeneratorTest();
+ cleanup();
+ }
+}
+void tst_qt3dsruntime::testRenderCustomShaderGenerator_300es()
+{
+ runCustomShaderGeneratorTest(makeFormat(3, 0, true, false));
+ cleanup();
+}
+
+#if defined(QT_FEATURE_opengles31)
+void tst_qt3dsruntime::testRenderDefaultShaderGenerator_310es()
+{
+ if (init(makeFormat(3, 1, true, false))) {
+ runDefaultShaderGeneratorTest();
+ cleanup();
+ }
+}
+void tst_qt3dsruntime::testRenderCustomShaderGenerator_310es()
+{
+ runCustomShaderGeneratorTest(makeFormat(3, 1, true, false));
+ cleanup();
+}
+#endif
+#if defined(QT_FEATURE_opengles32)
+void tst_qt3dsruntime::testRenderDefaultShaderGenerator_320es()
+{
+ if (init(makeFormat(3, 1, true, false))) {
+ runDefaultShaderGeneratorTest();
+ cleanup();
+ }
+}
+void tst_qt3dsruntime::testRenderCustomShaderGenerator_320es()
+{
+ runCustomShaderGeneratorTest(makeFormat(3, 1, true, false));
+ cleanup();
+}
+
+#endif
+#endif
+
+#if defined(QT_OPENGL_DYNAMIC)
void tst_qt3dsruntime::testRenderDefaultShaderGenerator_300()
{
QSKIP("OpenGL 3.0 is not supported");
@@ -566,21 +628,6 @@ void tst_qt3dsruntime::testRenderCustomShaderGenerator_430()
runCustomShaderGeneratorTest(makeFormat(4, 3));
}
-#else
-
-void tst_qt3dsruntime::testRenderDefaultShaderGenerator_320es()
-{
- if (init(makeFormat(3, 2, true, false))) {
- runDefaultShaderGeneratorTest();
- cleanup();
- }
-}
-
-void tst_qt3dsruntime::testRenderCustomShaderGenerator_320es()
-{
- runCustomShaderGeneratorTest(makeFormat(3, 2, true, false));
-}
-
#endif
void tst_qt3dsruntime::runDefaultShaderGeneratorTest()
diff --git a/tests/auto/runtime/tst_qt3dsruntime.h b/tests/auto/runtime/tst_qt3dsruntime.h
index a6370d75..1f5b943e 100644
--- a/tests/auto/runtime/tst_qt3dsruntime.h
+++ b/tests/auto/runtime/tst_qt3dsruntime.h
@@ -85,7 +85,24 @@ private Q_SLOTS:
void testRenderEffectGenerator();
-#if !defined(Q_OS_ANDROID)
+#if defined(QT_OPENGL_ES_2)
+ void testRenderDefaultShaderGenerator_200es();
+ void testRenderCustomShaderGenerator_200es();
+#endif
+#if defined(QT_OPENGL_ES_3)
+ void testRenderDefaultShaderGenerator_300es();
+ void testRenderCustomShaderGenerator_300es();
+#if defined(QT_FEATURE_opengles31)
+ void testRenderDefaultShaderGenerator_310es();
+ void testRenderCustomShaderGenerator_310es();
+#endif
+#if defined(QT_FEATURE_opengles32)
+ void testRenderDefaultShaderGenerator_320es();
+ void testRenderCustomShaderGenerator_320es();
+#endif
+#endif
+
+#if defined(QT_OPENGL_DYNAMIC)
void testRenderDefaultShaderGenerator_300();
void testRenderDefaultShaderGenerator_310();
void testRenderDefaultShaderGenerator_320();
@@ -103,9 +120,6 @@ private Q_SLOTS:
void testRenderCustomShaderGenerator_410();
void testRenderCustomShaderGenerator_420();
void testRenderCustomShaderGenerator_430();
-#else
- void testRenderDefaultShaderGenerator_320es();
- void testRenderCustomShaderGenerator_320es();
#endif