summaryrefslogtreecommitdiffstats
path: root/src/render/backend
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-08-17 09:07:20 +0200
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2018-08-17 09:07:21 +0200
commitebd195c59fe50c49dd28f27828afa802384d7011 (patch)
treeb19869be7f7458aa2569ff2afe2f38a48ee711f1 /src/render/backend
parentdb836a410555108adff3bd594cf75f4174069f0c (diff)
parentccfe440c34479377363679fc890f10b44ee57769 (diff)
Merge remote-tracking branch 'origin/5.11' into dev
Diffstat (limited to 'src/render/backend')
-rw-r--r--src/render/backend/resourceaccessor.cpp16
-rw-r--r--src/render/backend/resourceaccessor_p.h3
2 files changed, 14 insertions, 5 deletions
diff --git a/src/render/backend/resourceaccessor.cpp b/src/render/backend/resourceaccessor.cpp
index 8ca11e7a7..c6496976a 100644
--- a/src/render/backend/resourceaccessor.cpp
+++ b/src/render/backend/resourceaccessor.cpp
@@ -73,7 +73,10 @@ bool ResourceAccessor::accessResource(ResourceType type, Qt3DCore::QNodeId nodeI
{
switch (type) {
- case RenderBackendResourceAccessor::OGLTexture: {
+ case RenderBackendResourceAccessor::OGLTextureWrite:
+ Q_FALLTHROUGH();
+ case RenderBackendResourceAccessor::OGLTextureRead:
+ {
Texture *tex = m_textureManager->lookupResource(nodeId);
if (!tex)
return false;
@@ -85,10 +88,15 @@ bool ResourceAccessor::accessResource(ResourceType type, Qt3DCore::QNodeId nodeI
if (glTex->isDirty())
return false;
- glTex->setExternalRenderingEnabled(true);
+ if (type == RenderBackendResourceAccessor::OGLTextureWrite)
+ glTex->setExternalRenderingEnabled(true);
+
QOpenGLTexture **glTextureHandle = reinterpret_cast<QOpenGLTexture **>(handle);
- *glTextureHandle = glTex->getOrCreateGLTexture();
- *lock = glTex->externalRenderingLock();
+ *glTextureHandle = glTex->getGLTexture();
+
+ if (type == RenderBackendResourceAccessor::OGLTextureWrite)
+ *lock = glTex->externalRenderingLock();
+
return true;
}
diff --git a/src/render/backend/resourceaccessor_p.h b/src/render/backend/resourceaccessor_p.h
index 10e4abaa9..627efcb0d 100644
--- a/src/render/backend/resourceaccessor_p.h
+++ b/src/render/backend/resourceaccessor_p.h
@@ -73,7 +73,8 @@ class RenderBackendResourceAccessor
{
public:
enum ResourceType {
- OGLTexture,
+ OGLTextureWrite,
+ OGLTextureRead,
OutputAttachment,
EntityHandle,
};