summaryrefslogtreecommitdiffstats
path: root/tests/auto/render/textures/tst_textures.cpp
diff options
context:
space:
mode:
authorPaul Lemire <paul.lemire@kdab.com>2017-06-02 13:28:45 +0200
committerPaul Lemire <paul.lemire@kdab.com>2019-12-18 10:35:17 +0100
commit24dd795de773c00d5cfe64e887ce63719db88015 (patch)
tree2ec97f258decc8daa99839b95441d572fbee26b7 /tests/auto/render/textures/tst_textures.cpp
parent1776037b0443dc57d59afe0772a83b1d47aced14 (diff)
Add dedicated managers holder for GL Resources
That way NodeManagers only refers to managers holding nodes (so can be used by aspect and all renderer) and GLResourceManagers refers to renderer specific resources. Note: the Scene2D resourceaccessor was making direct access to GL resource through the managers, this has been commented and will be restored later Change-Id: Ic32784f60eac35aab8c066d1769f078639fa25b8
Diffstat (limited to 'tests/auto/render/textures/tst_textures.cpp')
-rw-r--r--tests/auto/render/textures/tst_textures.cpp33
1 files changed, 18 insertions, 15 deletions
diff --git a/tests/auto/render/textures/tst_textures.cpp b/tests/auto/render/textures/tst_textures.cpp
index 555bd09a3..fc0bd2543 100644
--- a/tests/auto/render/textures/tst_textures.cpp
+++ b/tests/auto/render/textures/tst_textures.cpp
@@ -34,11 +34,11 @@
#include <Qt3DRender/qtexturedata.h>
#include <Qt3DRender/private/renderer_p.h>
+#include <Qt3DRender/private/glresourcemanagers_p.h>
#include <Qt3DRender/private/texture_p.h>
#include <Qt3DRender/private/textureimage_p.h>
#include <Qt3DRender/private/nodemanagers_p.h>
#include <Qt3DRender/private/managers_p.h>
-#include <Qt3DRender/private/gltexturemanager_p.h>
#include <Qt3DRender/private/gltexture_p.h>
#include <Qt3DRender/private/qtexture_p.h>
@@ -238,8 +238,8 @@ private Q_SLOTS:
renderer.updateTexture(bt1b);
// THEN
- QCOMPARE(mgrs->glTextureManager()->lookupResource(bt1a->peerId()), mgrs->glTextureManager()->lookupResource(bt1b->peerId()));
-
+ QCOMPARE(renderer.glResourceManagers()->glTextureManager()->lookupResource(bt1a->peerId()),
+ renderer.glResourceManagers()->glTextureManager()->lookupResource(bt1b->peerId()));
renderer.shutdown();
}
@@ -274,11 +274,12 @@ private Q_SLOTS:
// no 2 textures must be the same
for (int i = 0; i < backend.size(); i++)
for (int k = i+1; k < backend.size(); k++)
- QVERIFY(mgrs->glTextureManager()->lookupResource(backend[i]->peerId()) != mgrs->glTextureManager()->lookupResource(backend[k]->peerId()));
+ QVERIFY(renderer.glResourceManagers()->glTextureManager()->lookupResource(backend[i]->peerId()) !=
+ renderer.glResourceManagers()->glTextureManager()->lookupResource(backend[k]->peerId()));
QVector<Qt3DRender::Render::GLTexture *> glTextures;
for (Qt3DRender::Render::Texture *t : backend)
- glTextures.push_back(mgrs->glTextureManager()->lookupResource(t->peerId()));
+ glTextures.push_back(renderer.glResourceManagers()->glTextureManager()->lookupResource(t->peerId()));
// some texture generators must be the same
QVERIFY(glTextures[0]->textureGenerator().data() == nullptr);
@@ -304,6 +305,8 @@ private Q_SLOTS:
Qt3DRender::Render::Renderer renderer(Qt3DRender::QRenderAspect::Synchronous);
renderer.setNodeManagers(mgrs.data());
+ Qt3DRender::Render::GLResourceManagers *glMgrs = renderer.glResourceManagers();
+
// both texture having the same sharedTextureId
{
// GIVEN
@@ -328,8 +331,8 @@ private Q_SLOTS:
renderer.updateTexture(bt2);
// THEN
- Qt3DRender::Render::GLTexture *glt1 = mgrs->glTextureManager()->lookupResource(bt1->peerId());
- Qt3DRender::Render::GLTexture *glt2 = mgrs->glTextureManager()->lookupResource(bt2->peerId());
+ Qt3DRender::Render::GLTexture *glt1 = glMgrs->glTextureManager()->lookupResource(bt1->peerId());
+ Qt3DRender::Render::GLTexture *glt2 = glMgrs->glTextureManager()->lookupResource(bt2->peerId());
QVERIFY(glt1 != glt2);
QCOMPARE(glt1->sharedTextureId(), bt1->sharedTextureId());
QCOMPARE(glt2->sharedTextureId(), bt2->sharedTextureId());
@@ -359,8 +362,8 @@ private Q_SLOTS:
renderer.updateTexture(bt2);
// THEN
- Qt3DRender::Render::GLTexture *glt1 = mgrs->glTextureManager()->lookupResource(bt1->peerId());
- Qt3DRender::Render::GLTexture *glt2 = mgrs->glTextureManager()->lookupResource(bt2->peerId());
+ Qt3DRender::Render::GLTexture *glt1 = glMgrs->glTextureManager()->lookupResource(bt1->peerId());
+ Qt3DRender::Render::GLTexture *glt2 = glMgrs->glTextureManager()->lookupResource(bt2->peerId());
QVERIFY(glt1 != glt2);
QCOMPARE(glt1->sharedTextureId(), bt1->sharedTextureId());
QCOMPARE(glt2->sharedTextureId(), bt2->sharedTextureId());
@@ -392,12 +395,12 @@ private Q_SLOTS:
renderer.updateTexture(backendTexture);
}
- Qt3DRender::QTextureImageDataGeneratorPtr idg1a = mgrs->glTextureManager()->lookupResource(backend[0]->peerId())->images()[0].generator;
- Qt3DRender::QTextureImageDataGeneratorPtr idg1b = mgrs->glTextureManager()->lookupResource(backend[1]->peerId())->images()[0].generator;
- Qt3DRender::QTextureImageDataGeneratorPtr idg2 = mgrs->glTextureManager()->lookupResource(backend[1]->peerId())->images()[1].generator;
- Qt3DRender::QTextureGeneratorPtr tg1a = mgrs->glTextureManager()->lookupResource(backend[0]->peerId())->textureGenerator();
- Qt3DRender::QTextureGeneratorPtr tg1b = mgrs->glTextureManager()->lookupResource(backend[2]->peerId())->textureGenerator();
- Qt3DRender::QTextureGeneratorPtr tg2 = mgrs->glTextureManager()->lookupResource(backend[1]->peerId())->textureGenerator();
+ Qt3DRender::QTextureImageDataGeneratorPtr idg1a = renderer.glResourceManagers()->glTextureManager()->lookupResource(backend[0]->peerId())->images()[0].generator;
+ Qt3DRender::QTextureImageDataGeneratorPtr idg1b = renderer.glResourceManagers()->glTextureManager()->lookupResource(backend[1]->peerId())->images()[0].generator;
+ Qt3DRender::QTextureImageDataGeneratorPtr idg2 = renderer.glResourceManagers()->glTextureManager()->lookupResource(backend[1]->peerId())->images()[1].generator;
+ Qt3DRender::QTextureGeneratorPtr tg1a = renderer.glResourceManagers()->glTextureManager()->lookupResource(backend[0]->peerId())->textureGenerator();
+ Qt3DRender::QTextureGeneratorPtr tg1b = renderer.glResourceManagers()->glTextureManager()->lookupResource(backend[2]->peerId())->textureGenerator();
+ Qt3DRender::QTextureGeneratorPtr tg2 = renderer.glResourceManagers()->glTextureManager()->lookupResource(backend[1]->peerId())->textureGenerator();
// THEN
QVERIFY(idg1a);