- Simplify D3DDevice

This commit is contained in:
Magnus Norddahl 2019-08-08 03:19:11 +02:00
parent 90b5c41517
commit 1be047d316
22 changed files with 596 additions and 1440 deletions

View file

@ -475,21 +475,17 @@ namespace CodeImp.DoomBuilder.Data
memstream.Seek(0, SeekOrigin.Begin);
if(dynamictexture)
{
texture = Texture.FromStream(General.Map.Graphics.Device, memstream, (int)memstream.Length,
img.Size.Width, img.Size.Height, mipmaplevels, Usage.Dynamic, Format.A8R8G8B8,
Pool.Default, General.Map.Graphics.PostFilter, General.Map.Graphics.MipGenerateFilter, 0);
texture = Texture.FromStream(memstream, (int)memstream.Length, img.Size.Width, img.Size.Height, mipmaplevels, Usage.Dynamic, Format.A8R8G8B8, Pool.Default);
}
else
{
texture = Texture.FromStream(General.Map.Graphics.Device, memstream, (int)memstream.Length,
img.Size.Width, img.Size.Height, mipmaplevels, Usage.None, Format.Unknown,
Pool.Managed, General.Map.Graphics.PostFilter, General.Map.Graphics.MipGenerateFilter, 0);
texture = Texture.FromStream(memstream, (int)memstream.Length, img.Size.Width, img.Size.Height, mipmaplevels, Usage.None, Format.Unknown, Pool.Managed);
}
memstream.Dispose();
if(dynamictexture)
{
if((width != texture.GetLevelDescription(0).Width) || (height != texture.GetLevelDescription(0).Height))
if((width != texture.Width) || (height != texture.Height))
throw new Exception("Could not create a texture with the same size as the image.");
}