summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/render/texture/qtexture.cpp2
-rw-r--r--src/render/texture/qtexturedata.cpp2
-rw-r--r--src/render/texture/qtextureimagedata.cpp2
-rw-r--r--src/render/texture/texture_p.h2
-rw-r--r--tests/auto/render/qtextureimagedata/tst_qtextureimagedata.cpp2
-rw-r--r--tests/auto/render/texture/tst_texture.cpp23
6 files changed, 28 insertions, 5 deletions
diff --git a/src/render/texture/qtexture.cpp b/src/render/texture/qtexture.cpp
index e539ce9de..029e47817 100644
--- a/src/render/texture/qtexture.cpp
+++ b/src/render/texture/qtexture.cpp
@@ -1419,7 +1419,7 @@ QTextureFromSourceGenerator::QTextureFromSourceGenerator(QTextureLoader *texture
, m_mirrored()
, m_texture(textureId)
, m_engine(engine)
- , m_format(QAbstractTexture::RGBA8_UNorm)
+ , m_format(QAbstractTexture::NoFormat)
{
Q_ASSERT(textureLoader);
diff --git a/src/render/texture/qtexturedata.cpp b/src/render/texture/qtexturedata.cpp
index b7bb75242..ac4ca80c0 100644
--- a/src/render/texture/qtexturedata.cpp
+++ b/src/render/texture/qtexturedata.cpp
@@ -57,7 +57,7 @@ class QTextureDataPrivate
{
public:
QAbstractTexture::Target m_target;
- QAbstractTexture::TextureFormat m_format;
+ QAbstractTexture::TextureFormat m_format = QAbstractTexture::NoFormat;
int m_width = 0;
int m_height = 0;
int m_depth = 0;
diff --git a/src/render/texture/qtextureimagedata.cpp b/src/render/texture/qtextureimagedata.cpp
index c31f272a8..bf43a6e16 100644
--- a/src/render/texture/qtextureimagedata.cpp
+++ b/src/render/texture/qtextureimagedata.cpp
@@ -55,7 +55,7 @@ QTextureImageDataPrivate::QTextureImageDataPrivate()
, m_mipLevels(-1)
, m_blockSize(-1)
, m_target(QOpenGLTexture::Target2D)
- , m_format(QOpenGLTexture::RGBA8_UNorm)
+ , m_format(QOpenGLTexture::NoFormat)
, m_pixelFormat(QOpenGLTexture::RGBA)
, m_pixelType(QOpenGLTexture::UInt8)
, m_isCompressed(false)
diff --git a/src/render/texture/texture_p.h b/src/render/texture/texture_p.h
index 9e385cefe..86c49f695 100644
--- a/src/render/texture/texture_p.h
+++ b/src/render/texture/texture_p.h
@@ -84,7 +84,7 @@ struct TextureProperties
int mipLevels = 1;
int samples = 1;
QAbstractTexture::Target target = QAbstractTexture::Target2D;
- QAbstractTexture::TextureFormat format = QAbstractTexture::RGBA8_UNorm;
+ QAbstractTexture::TextureFormat format = QAbstractTexture::NoFormat;
bool generateMipMaps = false;
QAbstractTexture::Status status = QAbstractTexture::None;
diff --git a/tests/auto/render/qtextureimagedata/tst_qtextureimagedata.cpp b/tests/auto/render/qtextureimagedata/tst_qtextureimagedata.cpp
index dec816a5e..ba0c9a9bf 100644
--- a/tests/auto/render/qtextureimagedata/tst_qtextureimagedata.cpp
+++ b/tests/auto/render/qtextureimagedata/tst_qtextureimagedata.cpp
@@ -55,7 +55,7 @@ private Q_SLOTS:
QCOMPARE(tid->layers(), -1);
QCOMPARE(tid->mipLevels(), -1);
QCOMPARE(tid->target(), QOpenGLTexture::Target2D);
- QCOMPARE(tid->format(), QOpenGLTexture::RGBA8_UNorm);
+ QCOMPARE(tid->format(), QOpenGLTexture::NoFormat);
QCOMPARE(tid->pixelFormat(), QOpenGLTexture::RGBA);
QCOMPARE(tid->pixelType(), QOpenGLTexture::UInt8);
QCOMPARE(tid->isCompressed(), false);
diff --git a/tests/auto/render/texture/tst_texture.cpp b/tests/auto/render/texture/tst_texture.cpp
index 9876518e2..d64533732 100644
--- a/tests/auto/render/texture/tst_texture.cpp
+++ b/tests/auto/render/texture/tst_texture.cpp
@@ -72,12 +72,35 @@ private:
void checkPropertyMirroring();
private slots:
+ void checkDefaults();
void checkFrontendPropertyNotifications();
void checkPropertyMirroring();
void checkPropertyChanges();
void checkTextureImageBookeeping();
};
+void tst_RenderTexture::checkDefaults()
+{
+ Qt3DRender::Render::Texture backend;
+
+ QCOMPARE(backend.properties().format, Qt3DRender::QAbstractTexture::NoFormat);
+ QCOMPARE(backend.properties().width, 1);
+ QCOMPARE(backend.properties().height, 1);
+ QCOMPARE(backend.properties().depth, 1);
+ QCOMPARE(backend.properties().layers, 1);
+ QCOMPARE(backend.properties().mipLevels, 1);
+ QCOMPARE(backend.properties().samples, 1);
+ QCOMPARE(backend.properties().generateMipMaps, false);
+ QCOMPARE(backend.parameters().magnificationFilter, Qt3DRender::QAbstractTexture::Nearest);
+ QCOMPARE(backend.parameters().minificationFilter, Qt3DRender::QAbstractTexture::Nearest);
+ QCOMPARE(backend.parameters().wrapModeX, Qt3DRender::QTextureWrapMode::ClampToEdge);
+ QCOMPARE(backend.parameters().wrapModeY, Qt3DRender::QTextureWrapMode::ClampToEdge);
+ QCOMPARE(backend.parameters().wrapModeZ, Qt3DRender::QTextureWrapMode::ClampToEdge);
+ QCOMPARE(backend.parameters().maximumAnisotropy, 1.0f);
+ QCOMPARE(backend.parameters().comparisonFunction, Qt3DRender::QAbstractTexture::CompareLessEqual);
+ QCOMPARE(backend.parameters().comparisonMode, Qt3DRender::QAbstractTexture::CompareNone);
+}
+
void tst_RenderTexture::checkFrontendPropertyNotifications()
{
// GIVEN