summaryrefslogtreecommitdiffstats
path: root/tests/auto/render/ddstextures
diff options
context:
space:
mode:
authorMauro Persano <mauro.persano@kdab.com>2016-01-12 10:49:20 -0200
committerSean Harmer <sean.harmer@kdab.com>2016-01-16 15:52:31 +0000
commit634ac2a3c1a7bae9eef6476c37cd68209c28ae4f (patch)
tree270469aeac7988b3534918bedd2becf70cfb8e98 /tests/auto/render/ddstextures
parent43e55cd54635a5ef1eb09fe9cff701f7eb16cd7a (diff)
Support for DDS textures
This commit adds support for DDS textures. It also adds QTextureLoader, a generic texture provider without a texture target. The actual texture target will be based on the properties of the texture loaded from its "source" property. Change-Id: If89cce7a55b3d82355f2da35588a091b7188f36c Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'tests/auto/render/ddstextures')
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-1-bc1-dx10.ddsbin0 -> 332 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-1-bc1-nomips-dx10.ddsbin0 -> 276 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-1-bc1-nomips.ddsbin0 -> 256 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-1-bc1.ddsbin0 -> 312 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-1-bc3-dx10.ddsbin0 -> 516 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-1-bc3-nomips-dx10.ddsbin0 -> 404 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-1-bc3-nomips.ddsbin0 -> 384 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-1-bc3.ddsbin0 -> 496 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-1-lumi-nomips.ddsbin0 -> 384 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-1-lumi.ddsbin0 -> 469 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-1-rgb-nomips.ddsbin0 -> 1152 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-1-rgb.ddsbin0 -> 1492 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-6-bc1-dx10.ddsbin0 -> 1252 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-6-bc1-nomips-dx10.ddsbin0 -> 916 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-6-bc1-nomips.ddsbin0 -> 896 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-6-bc1.ddsbin0 -> 1232 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-6-bc3-dx10.ddsbin0 -> 2356 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-6-bc3-nomips-dx10.ddsbin0 -> 1684 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-6-bc3-nomips.ddsbin0 -> 1664 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-6-bc3.ddsbin0 -> 2336 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-6-lumi-nomips.ddsbin0 -> 1664 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-6-lumi.ddsbin0 -> 2174 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-6-rgb-nomips.ddsbin0 -> 6272 bytes
-rw-r--r--tests/auto/render/ddstextures/data/16x16x1-6-rgb.ddsbin0 -> 8312 bytes
-rw-r--r--tests/auto/render/ddstextures/ddstextures.pro37
-rw-r--r--tests/auto/render/ddstextures/tst_ddstextures.cpp101
26 files changed, 138 insertions, 0 deletions
diff --git a/tests/auto/render/ddstextures/data/16x16x1-1-bc1-dx10.dds b/tests/auto/render/ddstextures/data/16x16x1-1-bc1-dx10.dds
new file mode 100644
index 000000000..feacae8d1
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-1-bc1-dx10.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-1-bc1-nomips-dx10.dds b/tests/auto/render/ddstextures/data/16x16x1-1-bc1-nomips-dx10.dds
new file mode 100644
index 000000000..40da98cde
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-1-bc1-nomips-dx10.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-1-bc1-nomips.dds b/tests/auto/render/ddstextures/data/16x16x1-1-bc1-nomips.dds
new file mode 100644
index 000000000..1dd3e1e91
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-1-bc1-nomips.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-1-bc1.dds b/tests/auto/render/ddstextures/data/16x16x1-1-bc1.dds
new file mode 100644
index 000000000..e31f410d2
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-1-bc1.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-1-bc3-dx10.dds b/tests/auto/render/ddstextures/data/16x16x1-1-bc3-dx10.dds
new file mode 100644
index 000000000..76c820f31
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-1-bc3-dx10.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-1-bc3-nomips-dx10.dds b/tests/auto/render/ddstextures/data/16x16x1-1-bc3-nomips-dx10.dds
new file mode 100644
index 000000000..0a2964f12
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-1-bc3-nomips-dx10.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-1-bc3-nomips.dds b/tests/auto/render/ddstextures/data/16x16x1-1-bc3-nomips.dds
new file mode 100644
index 000000000..c8c94d85f
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-1-bc3-nomips.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-1-bc3.dds b/tests/auto/render/ddstextures/data/16x16x1-1-bc3.dds
new file mode 100644
index 000000000..4a08d324a
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-1-bc3.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-1-lumi-nomips.dds b/tests/auto/render/ddstextures/data/16x16x1-1-lumi-nomips.dds
new file mode 100644
index 000000000..8fdd5e3e1
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-1-lumi-nomips.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-1-lumi.dds b/tests/auto/render/ddstextures/data/16x16x1-1-lumi.dds
new file mode 100644
index 000000000..82ab57958
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-1-lumi.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-1-rgb-nomips.dds b/tests/auto/render/ddstextures/data/16x16x1-1-rgb-nomips.dds
new file mode 100644
index 000000000..94d06c2c4
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-1-rgb-nomips.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-1-rgb.dds b/tests/auto/render/ddstextures/data/16x16x1-1-rgb.dds
new file mode 100644
index 000000000..45635dd97
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-1-rgb.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-6-bc1-dx10.dds b/tests/auto/render/ddstextures/data/16x16x1-6-bc1-dx10.dds
new file mode 100644
index 000000000..209b796f0
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-6-bc1-dx10.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-6-bc1-nomips-dx10.dds b/tests/auto/render/ddstextures/data/16x16x1-6-bc1-nomips-dx10.dds
new file mode 100644
index 000000000..e79e29ab5
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-6-bc1-nomips-dx10.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-6-bc1-nomips.dds b/tests/auto/render/ddstextures/data/16x16x1-6-bc1-nomips.dds
new file mode 100644
index 000000000..de6796d9f
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-6-bc1-nomips.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-6-bc1.dds b/tests/auto/render/ddstextures/data/16x16x1-6-bc1.dds
new file mode 100644
index 000000000..92b95ae73
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-6-bc1.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-6-bc3-dx10.dds b/tests/auto/render/ddstextures/data/16x16x1-6-bc3-dx10.dds
new file mode 100644
index 000000000..f56fa09fd
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-6-bc3-dx10.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-6-bc3-nomips-dx10.dds b/tests/auto/render/ddstextures/data/16x16x1-6-bc3-nomips-dx10.dds
new file mode 100644
index 000000000..31e137553
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-6-bc3-nomips-dx10.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-6-bc3-nomips.dds b/tests/auto/render/ddstextures/data/16x16x1-6-bc3-nomips.dds
new file mode 100644
index 000000000..644274601
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-6-bc3-nomips.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-6-bc3.dds b/tests/auto/render/ddstextures/data/16x16x1-6-bc3.dds
new file mode 100644
index 000000000..144515bb0
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-6-bc3.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-6-lumi-nomips.dds b/tests/auto/render/ddstextures/data/16x16x1-6-lumi-nomips.dds
new file mode 100644
index 000000000..baa884a36
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-6-lumi-nomips.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-6-lumi.dds b/tests/auto/render/ddstextures/data/16x16x1-6-lumi.dds
new file mode 100644
index 000000000..1a4e6f46f
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-6-lumi.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-6-rgb-nomips.dds b/tests/auto/render/ddstextures/data/16x16x1-6-rgb-nomips.dds
new file mode 100644
index 000000000..318a0bd35
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-6-rgb-nomips.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/data/16x16x1-6-rgb.dds b/tests/auto/render/ddstextures/data/16x16x1-6-rgb.dds
new file mode 100644
index 000000000..1f3c8f9cf
--- /dev/null
+++ b/tests/auto/render/ddstextures/data/16x16x1-6-rgb.dds
Binary files differ
diff --git a/tests/auto/render/ddstextures/ddstextures.pro b/tests/auto/render/ddstextures/ddstextures.pro
new file mode 100644
index 000000000..e81fd80d8
--- /dev/null
+++ b/tests/auto/render/ddstextures/ddstextures.pro
@@ -0,0 +1,37 @@
+TEMPLATE = app
+
+TARGET = tst_ddstextures
+
+CONFIG += testcase
+
+SOURCES += tst_ddstextures.cpp
+
+OTHER_FILES = \
+ data/16x16x1-1-bc1.dds \
+ data/16x16x1-1-bc1-dx10.dds \
+ data/16x16x1-1-bc1-nomips.dds \
+ data/16x16x1-1-bc1-nomips-dx10.dds \
+ data/16x16x1-1-bc3.dds \
+ data/16x16x1-1-bc3-dx10.dds \
+ data/16x16x1-1-bc3-nomips.dds \
+ data/16x16x1-1-bc3-nomips-dx10.dds \
+ data/16x16x1-1-lumi.dds \
+ data/16x16x1-1-lumi-nomips.dds \
+ data/16x16x1-1-rgb.dds \
+ data/16x16x1-1-rgb-nomips.dds \
+ data/16x16x1-6-bc1.dds \
+ data/16x16x1-6-bc1-dx10.dds \
+ data/16x16x1-6-bc1-nomips.dds \
+ data/16x16x1-6-bc1-nomips-dx10.dds \
+ data/16x16x1-6-bc3.dds \
+ data/16x16x1-6-bc3-dx10.dds \
+ data/16x16x1-6-bc3-nomips.dds \
+ data/16x16x1-6-bc3-nomips-dx10.dds \
+ data/16x16x1-6-lumi.dds \
+ data/16x16x1-6-lumi-nomips.dds \
+ data/16x16x1-6-rgb.dds \
+ data/16x16x1-6-rgb-nomips.dds
+
+TESTDATA = data/*
+
+QT += core-private 3dcore 3dcore-private 3drender 3drender-private testlib
diff --git a/tests/auto/render/ddstextures/tst_ddstextures.cpp b/tests/auto/render/ddstextures/tst_ddstextures.cpp
new file mode 100644
index 000000000..55e9f7f5f
--- /dev/null
+++ b/tests/auto/render/ddstextures/tst_ddstextures.cpp
@@ -0,0 +1,101 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 Klaralvdalens Datakonsult AB (KDAB).
+** Contact: http://www.qt-project.org/legal
+**
+** This file is part of the Qt3D module of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL3$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see http://www.qt.io/terms-conditions. For further
+** information use the contact form at http://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPLv3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl.html.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or later as published by the Free
+** Software Foundation and appearing in the file LICENSE.GPL included in
+** the packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 2.0 requirements will be
+** met: http://www.gnu.org/licenses/gpl-2.0.html.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <QtTest/QTest>
+#include <Qt3DRender/qtexturedata.h>
+
+class tst_DdsTextures : public QObject
+{
+ Q_OBJECT
+
+private slots:
+ void ddsImageData();
+};
+
+void tst_DdsTextures::ddsImageData()
+{
+ const struct TextureInfo {
+ const char *source;
+ int width;
+ int height;
+ int depth;
+ int faces;
+ int mipmapLevels;
+ QOpenGLTexture::TextureFormat format;
+ } textures[] = {
+ { "data/16x16x1-1-lumi-nomips.dds", 16, 16, 1, 1, 1, QOpenGLTexture::R8_UNorm },
+ { "data/16x16x1-1-lumi.dds", 16, 16, 1, 1, 5, QOpenGLTexture::R8_UNorm },
+ { "data/16x16x1-1-rgb-nomips.dds", 16, 16, 1, 1, 1, QOpenGLTexture::RGBA8_UNorm },
+ { "data/16x16x1-1-rgb.dds", 16, 16, 1, 1, 5, QOpenGLTexture::RGBA8_UNorm },
+ { "data/16x16x1-1-bc1-nomips.dds", 16, 16, 1, 1, 1, QOpenGLTexture::RGBA_DXT1 },
+ { "data/16x16x1-1-bc1.dds", 16, 16, 1, 1, 5, QOpenGLTexture::RGBA_DXT1 },
+ { "data/16x16x1-1-bc3-nomips.dds", 16, 16, 1, 1, 1, QOpenGLTexture::RGBA_DXT5 },
+ { "data/16x16x1-1-bc3.dds", 16, 16, 1, 1, 5, QOpenGLTexture::RGBA_DXT5 },
+ { "data/16x16x1-1-bc1-nomips-dx10.dds", 16, 16, 1, 1, 1, QOpenGLTexture::RGBA_DXT1 },
+ { "data/16x16x1-1-bc1-dx10.dds", 16, 16, 1, 1, 5, QOpenGLTexture::RGBA_DXT1 },
+ { "data/16x16x1-1-bc3-nomips-dx10.dds", 16, 16, 1, 1, 1, QOpenGLTexture::RGBA_DXT5 },
+ { "data/16x16x1-1-bc3-dx10.dds", 16, 16, 1, 1, 5, QOpenGLTexture::RGBA_DXT5 },
+ { "data/16x16x1-6-lumi-nomips.dds", 16, 16, 1, 6, 1, QOpenGLTexture::R8_UNorm },
+ { "data/16x16x1-6-lumi.dds", 16, 16, 1, 6, 5, QOpenGLTexture::R8_UNorm },
+ { "data/16x16x1-6-rgb-nomips.dds", 16, 16, 1, 6, 1, QOpenGLTexture::RGBA8_UNorm },
+ { "data/16x16x1-6-rgb.dds", 16, 16, 1, 6, 5, QOpenGLTexture::RGBA8_UNorm },
+ { "data/16x16x1-6-bc1-nomips.dds", 16, 16, 1, 6, 1, QOpenGLTexture::RGBA_DXT1 },
+ { "data/16x16x1-6-bc1.dds", 16, 16, 1, 6, 5, QOpenGLTexture::RGBA_DXT1 },
+ { "data/16x16x1-6-bc3-nomips.dds", 16, 16, 1, 6, 1, QOpenGLTexture::RGBA_DXT5 },
+ { "data/16x16x1-6-bc3.dds", 16, 16, 1, 6, 5, QOpenGLTexture::RGBA_DXT5 },
+ { "data/16x16x1-6-bc1-nomips-dx10.dds", 16, 16, 1, 6, 1, QOpenGLTexture::RGBA_DXT1 },
+ { "data/16x16x1-6-bc1-dx10.dds", 16, 16, 1, 6, 5, QOpenGLTexture::RGBA_DXT1 },
+ { "data/16x16x1-6-bc3-nomips-dx10.dds", 16, 16, 1, 6, 1, QOpenGLTexture::RGBA_DXT5 },
+ { "data/16x16x1-6-bc3-dx10.dds", 16, 16, 1, 6, 5, QOpenGLTexture::RGBA_DXT5 },
+ };
+
+ for (unsigned i = 0; i < sizeof(textures)/sizeof(*textures); i++) {
+ const TextureInfo *texture = &textures[i];
+
+ Qt3DRender::QTexImageData data;
+
+ QVERIFY(data.setCompressedFile(texture->source));
+ QCOMPARE(data.width(), texture->width);
+ QCOMPARE(data.height(), texture->height);
+ QCOMPARE(data.faces(), texture->faces);
+ QCOMPARE(data.mipLevels(), texture->mipmapLevels);
+ QCOMPARE(data.format(), texture->format);
+ }
+}
+
+QTEST_APPLESS_MAIN(tst_DdsTextures)
+
+#include "tst_ddstextures.moc"