Merged in GZDB r2498.

This commit is contained in:
MascaraSnake 2016-04-07 22:03:23 +02:00
parent 6ad64c1cc0
commit 3e0adfbc4e
4 changed files with 54 additions and 32 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

@ -532,6 +532,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
@ -101,24 +101,38 @@ namespace CodeImp.DoomBuilder.Rendering
public void Dispose()
{
// Not already disposed?
if(!isdisposed)
if (!isdisposed)
{
// Clean up
foreach(ID3DResource res in resources) res.UnloadResource();
if(shaders != null) shaders.Dispose();
foreach (ID3DResource res in resources) res.UnloadResource();
if (shaders != null) shaders.Dispose();
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 (backbuffer != null) backbuffer.Dispose();
if (depthbuffer != null) depthbuffer.Dispose();
if (font != null) font.Dispose();
if(fonttexture != null) fonttexture.Dispose();
isrendering = false; //mxd
if (fonttexture != null) fonttexture.Dispose();
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;
}
}
@ -314,7 +328,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;