Re-fixed, Visual mode: in some cases some D3D textures were not disposed after closing a map, eventually resulting in E_OUTOFMEMORY crash.

Fixed, Preferences window: some folding settings were not applied in the Script Editor preview control.
Changed, Visual mode: increased z-buffer depth to 24 bits. Z-fighting among far away but close to each other surfaces should be less noticeable now.
This commit is contained in:
MaxED 2016-02-06 00:04:02 +00:00
parent 7691ec087e
commit 3b90d100ff
4 changed files with 34 additions and 12 deletions

View file

@ -289,7 +289,10 @@ namespace CodeImp.DoomBuilder.Controls
{
// Instruct the lexer to calculate folding
scriptedit.SetProperty("fold", "1");
scriptedit.SetProperty("fold.compact", "1");
scriptedit.SetProperty("fold.compact", "0"); // 1 = folds blank lines
scriptedit.SetProperty("fold.comment", "1"); // Enable block comment folding
scriptedit.SetProperty("fold.preprocessor", "1"); // Enable #region folding
scriptedit.SetFoldFlags(FoldFlags.LineAfterContracted); // Draw line below if not expanded
// Configure a margin to display folding symbols
scriptedit.Margins[2].Type = MarginType.Symbol;

View file

@ -530,6 +530,7 @@ namespace CodeImp.DoomBuilder.Data
foreach(KeyValuePair<long, ImageData> i in textures) i.Value.Dispose();
foreach(KeyValuePair<long, ImageData> i in flats) i.Value.Dispose();
foreach(KeyValuePair<long, ImageData> i in sprites) i.Value.Dispose();
foreach(KeyValuePair<string, ImageData> i in internalsprites) i.Value.Dispose(); //mxd
palette = null;
//mxd. Dispose models

View file

@ -462,6 +462,10 @@ namespace CodeImp.DoomBuilder.Data
if((width != texture.GetLevelDescription(0).Width) || (height != texture.GetLevelDescription(0).Height))
throw new Exception("Could not create a texture with the same size as the image.");
}
#if DEBUG
texture.Tag = name; //mxd. Helps with tracking undisposed resources...
#endif
}
}
}

View file

@ -18,13 +18,13 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;
using System.Drawing;
using SlimDX.Direct3D9;
using System.Windows.Forms;
using CodeImp.DoomBuilder.Controls;
using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.Geometry;
using SlimDX;
using CodeImp.DoomBuilder.Data;
using CodeImp.DoomBuilder.Controls;
using SlimDX.Direct3D9;
#endregion
@ -109,16 +109,30 @@ namespace CodeImp.DoomBuilder.Rendering
rendertarget = null;
if(backbuffer != null) backbuffer.Dispose();
if(depthbuffer != null) depthbuffer.Dispose();
if(device != null)
{
device.Reset(new PresentParameters()); //mxd. Some video memory is not freed without this line if Visual mode was visited
device.Dispose();
}
if(font != null) font.Dispose();
if(fonttexture != null) fonttexture.Dispose();
isrendering = false; //mxd
if(device != null) device.Dispose();
if(ObjectTable.Objects.Count > 1) //mxd. Direct3D itself is not disposed while the editor is running
{
//mxd. Get rid of any remaining D3D objects...
foreach(ComObject o in ObjectTable.Objects)
{
if(o is Direct3D) continue; // Don't dispose the device itself...
General.WriteLogLine("WARNING: D3D resource " + o
+ (o.Tag != null ? " (" + o.Tag + ")" : string.Empty) + " was not disposed properly!"
+ (o.CreationSource != null ? " Stack trace: " + o.CreationSource : string.Empty));
o.Dispose();
}
#if DEBUG
General.ShowWarningMessage("Some D3D resources were not disposed properly! See the event log for more details.",
MessageBoxButtons.OK);
#endif
}
// Done
isrendering = false; //mxd
isdisposed = true;
}
}
@ -313,7 +327,7 @@ namespace CodeImp.DoomBuilder.Rendering
displaypp.BackBufferWidth = rendertarget.ClientSize.Width;
displaypp.BackBufferHeight = rendertarget.ClientSize.Height;
displaypp.EnableAutoDepthStencil = true;
displaypp.AutoDepthStencilFormat = Format.D16;
displaypp.AutoDepthStencilFormat = Format.D24X8; //Format.D16;
displaypp.Multisample = MultisampleType.None;
displaypp.PresentationInterval = PresentInterval.Immediate;