RenderSpritesRenderingStep disposal
#1
Hi,

I've been tracking some resources and found, that RenderSpritesRenderingStep might not be correctly disposed (or displayed). When I log the tracked resources, all rendering steps except sprite, are marked as disposed. In the collection there are some wpf objects (grid and lines), lights, no sprites.

I've added the log (lines 14, 37) where there is an entry for the rendering step. I've tried version 5.0.8000 and 5.1.8153.

Best regards,
Janovsky Roman

Tracked Resources:

  1 Ab3d.DirectX.DXDevice                                                  DISPOSED  'DXDevice'
  2 Ab3d.DirectX.EffectsManager                                            DISPOSED 
  3 Ab3d.DirectX.CommonStates                                              DISPOSED 
  4 Ab3d.DirectX.TextureCache                                              DISPOSED 
  5 Ab3d.DirectX.ContextStatesManager                                      DISPOSED  'MainThread-ContextStatesManager'
  7 Ab3d.DirectX.Controls.DXViewportView                                   
  8 Ab3d.DirectX.DXDevice                                                  'DXDevice'
  9 Ab3d.DirectX.DXScene                                                    DISPOSED 
10 Ab3d.DirectX.InitializeRenderingStep                                    DISPOSED  'Initialize': InitializeRenderingStep  Name: 'Initialize'
11 Ab3d.DirectX.PrepareRenderTargetsRenderingStep                          DISPOSED  'PrepareRenderTargets': PrepareRenderTargetsRenderingStep  Name: 'PrepareRenderTargets'
12 Ab3d.DirectX.RenderObjectsRenderingStep                                DISPOSED  'StandardRenderObjects': RenderObjectsRenderingStep  Name: 'StandardRenderObjects'
13 Ab3d.DirectX.ResolveBackBufferRenderingStep                            DISPOSED  'StandardResolveBackBuffer': ResolveBackBufferRenderingStep  Name: 'StandardResolveBackBuffer'
14 Ab3d.DirectX.RenderSpritesRenderingStep                                'RenderSprites': RenderSpritesRenderingStep  Name: 'RenderSprites'
15 Ab3d.DirectX.CompleteRenderingStep                                      DISPOSED  'Complete': CompleteRenderingStep  Name: 'Complete'
16 Ab3d.DirectX.RenderingStepsGroup                                        DISPOSED  'RenderPostProcessingGroup': RenderingStepsGroup  Name: 'RenderPostProcessingGroup' (DISABLED)\r\n - PreparePostProcessingRenderingStep  Name: 'PreparePostProcessing' (PARENT DISABLED)\r\n - RenderPostProcessingRenderingStep  Name: 'RenderPostProcessing' (PARENT DISABLED)
17 Ab3d.DirectX.RenderPostProcessingRenderingStep                          DISPOSED  'RenderPostProcessing': RenderPostProcessingRenderingStep  Name: 'RenderPostProcessing'
18 Ab3d.DirectX.PreparePostProcessingRenderingStep                        DISPOSED  'PreparePostProcessing': PreparePostProcessingRenderingStep  Name: 'PreparePostProcessing'
19 Ab3d.DirectX.EffectsManager                                           
20 Ab3d.DirectX.CommonStates                                             
21 Ab3d.DirectX.TextureCache                                             
22 Ab3d.DirectX.ContextStatesManager                                      'MainThread-ContextStatesManager'
23 Ab3d.DirectX.Models.WpfVisual3DCollectionNode                          DISPOSED  RefCount: 0  'Viewport3D.Children': WpfVisual3DCollectionNode (23) 'Viewport3D.Children'  (DISPOSED) (NOT INITIALIZED) (IsActuallyVisible: false)
31 Ab3d.DirectX.Controls.DXViewportView                                    DISPOSED  'MainDXViewportView'
32 Ab3d.DirectX.DXScene                                                    DISPOSED 
33 Ab3d.DirectX.InitializeRenderingStep                                    DISPOSED  'Initialize': InitializeRenderingStep  Name: 'Initialize'
34 Ab3d.DirectX.PrepareRenderTargetsRenderingStep                          DISPOSED  'PrepareRenderTargets': PrepareRenderTargetsRenderingStep  Name: 'PrepareRenderTargets'
35 Ab3d.DirectX.RenderObjectsRenderingStep                                DISPOSED  'StandardRenderObjects': RenderObjectsRenderingStep  Name: 'StandardRenderObjects'
36 Ab3d.DirectX.ResolveBackBufferRenderingStep                            DISPOSED  'StandardResolveBackBuffer': ResolveBackBufferRenderingStep  Name: 'StandardResolveBackBuffer'
37 Ab3d.DirectX.RenderSpritesRenderingStep                                'RenderSprites': RenderSpritesRenderingStep  Name: 'RenderSprites'
#2
Thank you for investigating this.

I have checked that and found out that in case when all sprite batches are removed from the scene before the DXScene is disposed, then the RenderSpritesRenderingStep step was not disposed (as shown in your log file). This may lead to some unmanaged resources (vertex and pixel shader) to not being released. What is more, SpriteBatch objects that were removed from the DXScene were not disposed also (this may leak vertex and index buffer).

I have improved the engine so that RenderSpritesRenderingStep is always correctly disposed. Also all the SpriteBatch objects will release their resources (if not by the DXScene then in finalizer).
Andrej Benedik
  


Forum Jump:


Users browsing this thread:
1 Guest(s)