Graphics/ForwardFramePipeline: Fix unregister + register the same renderable pointer not invalidating rendering
This can happen with ECS components which are mostly stable in memory, when destroying a graphics entity and recreating it (even with a different mesh) its pointer may not change due to memory recycling, especially on simple scenes. A UInt8 generation counter helps prevents this
This commit is contained in:
@@ -108,6 +108,7 @@ namespace Nz
|
||||
const InstancedRenderable* renderable;
|
||||
Recti scissorBox;
|
||||
UInt32 renderMask = 0;
|
||||
UInt8 generation;
|
||||
|
||||
NazaraSlot(InstancedRenderable, OnElementInvalidated, onElementInvalidated);
|
||||
NazaraSlot(InstancedRenderable, OnMaterialInvalidated, onMaterialInvalidated);
|
||||
@@ -169,6 +170,7 @@ namespace Nz
|
||||
MemoryPool<ViewerData> m_viewerPool;
|
||||
MemoryPool<WorldInstanceData> m_worldInstances;
|
||||
RenderFrame* m_currentRenderFrame;
|
||||
UInt8 m_generationCounter;
|
||||
bool m_rebuildFrameGraph;
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user