summaryrefslogtreecommitdiffstats
path: root/src/runtimerender/rendererimpl/Qt3DSRendererImpl.cpp
diff options
context:
space:
mode:
authorAntti Määttä <antti.maatta@qt.io>2019-06-25 12:47:00 +0300
committerAntti Määttä <antti.maatta@qt.io>2019-06-28 09:31:06 +0300
commit3a014b324f1948192cb973c62c40150464ce5aa2 (patch)
treed39fc14754d878313d94d256f0f1f79d9209f650 /src/runtimerender/rendererimpl/Qt3DSRendererImpl.cpp
parenta0eef0c702b06e442db90a3b6ef1b488e67b63f5 (diff)
Fix progressive antialiasing
There were two problems with the antialiasing. The default materials inside container were never cleared dirty. The subpresentation rendering didn't correctly set the dirty flags when the same subpresentation is rendered multiple times. Task-number: QT3DS-1796 Change-Id: Ice1942ec4b919df009c59aa3ffdfc8efd430db1e Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Jari Karppinen <jari.karppinen@qt.io> Reviewed-by: Pasi Keränen <pasi.keranen@qt.io>
Diffstat (limited to 'src/runtimerender/rendererimpl/Qt3DSRendererImpl.cpp')
-rw-r--r--src/runtimerender/rendererimpl/Qt3DSRendererImpl.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/runtimerender/rendererimpl/Qt3DSRendererImpl.cpp b/src/runtimerender/rendererimpl/Qt3DSRendererImpl.cpp
index c40ff55..10f62c3 100644
--- a/src/runtimerender/rendererimpl/Qt3DSRendererImpl.cpp
+++ b/src/runtimerender/rendererimpl/Qt3DSRendererImpl.cpp
@@ -236,6 +236,20 @@ namespace render {
if (theRenderData) {
theRenderData->PrepareForRender();
+ if (id) {
+ if (m_initialPrepareData.contains(theLayer)) {
+ // Copy dirty state from the initial since the graph is
+ // not dirty for subsequent calls
+ auto &flags = theRenderData->m_LayerPrepResult->m_Flags;
+ const auto &initialFlags
+ = m_initialPrepareData[theLayer]->m_LayerPrepResult->m_Flags;
+ flags.SetWasDirty(flags.WasDirty() || initialFlags.WasDirty());
+ flags.SetLayerDataDirty(flags.WasLayerDataDirty()
+ || initialFlags.WasLayerDataDirty());
+ } else {
+ m_initialPrepareData.insert(theLayer, theRenderData);
+ }
+ }
retval = retval || theRenderData->m_LayerPrepResult->m_Flags.WasDirty();
} else {
QT3DS_ASSERT(false);
@@ -495,6 +509,14 @@ namespace render {
for (QT3DSU32 idx = 0, end = m_LastFrameLayers.size(); idx < end; ++idx)
m_LastFrameLayers[idx]->ResetForFrame();
m_LastFrameLayers.clear();
+ m_initialPrepareData.clear();
+ for (auto *obj : qAsConst(m_materialClearDirty)) {
+ if (obj->m_Type == GraphObjectTypes::DefaultMaterial)
+ static_cast<SDefaultMaterial *>(obj)->m_Dirty.UpdateDirtyForFrame();
+ else if (obj->m_Type == GraphObjectTypes::CustomMaterial)
+ static_cast<SCustomMaterial *>(obj)->UpdateDirtyForFrame();
+ }
+ m_materialClearDirty.clear();
m_BeginFrameViewport = m_qt3dsContext.GetRenderList().GetViewport();
}
void Qt3DSRendererImpl::EndFrame()
@@ -1141,6 +1163,11 @@ namespace render {
inImage.m_TextureData.m_Texture->GenerateMipmaps();
}
+ void Qt3DSRendererImpl::addMaterialDirtyClear(SGraphObject *obj)
+ {
+ m_materialClearDirty.insert(obj);
+ }
+
bool NodeContainsBoneRoot(SNode &childNode, QT3DSI32 rootID)
{
for (SNode *childChild = childNode.m_FirstChild; childChild != NULL;