Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ CreateTexture()

unsafe void Microsoft.Xna.Framework.Graphics.Texture2D.CreateTexture ( GraphicsDevice graphicsDevice,
int width,
int height,
[MarshalAs(UnmanagedType.U1)] bool mipMap,
uint usage,
_D3DPOOL pool,
SurfaceFormat format )
inlineprotected

Definition at line 609 of file Texture2D.cs.

610 {
611 if (graphicsDevice == null)
612 {
613 throw new ArgumentNullException("graphicsDevice", FrameworkResources.DeviceCannotBeNullOnResourceCreate);
614 }
615 ValidateCreationParameters(graphicsDevice._profileCapabilities, width, height, format, mipMap);
616 int num = ((!mipMap) ? 1 : 0);
617 fixed (IDirect3DTexture9** ptr = &pComPtr)
618 {
619 int num2 = *(int*)graphicsDevice.pComPtr + 92;
620 int num3 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, uint, uint, uint, uint, _D3DFORMAT, _D3DPOOL, IDirect3DTexture9**, void**, int>)(int)(*(uint*)num2))((nint)graphicsDevice.pComPtr, (uint)width, (uint)height, (uint)num, usage, _003CModule_003E.ConvertXnaFormatToWindows(format), pool, ptr, null);
621 if (num3 < 0)
622 {
623 throw GraphicsHelpers.GetExceptionFromResult((uint)num3);
624 }
625 isDisposed = false;
626 _parent = graphicsDevice;
627 SurfaceFormat? format2 = format;
628 InitializeDescription(format2);
629 graphicsDevice.Resources.AddTrackedObject(this, pComPtr, (uint)pool, _internalHandle, ref _internalHandle);
630 }
631 }
static void ValidateCreationParameters(ProfileCapabilities profile, int width, int height, SurfaceFormat format, [MarshalAs(UnmanagedType.U1)] bool mipMap)
Definition Texture2D.cs:633
unsafe IDirect3DTexture9 * pComPtr
Definition Texture2D.cs:22
unsafe void InitializeDescription(SurfaceFormat? format)
Definition Texture2D.cs:589

References Microsoft.Xna.Framework.Graphics.GraphicsResource._internalHandle, Microsoft.Xna.Framework.Graphics.GraphicsResource._parent, Microsoft.Xna.Framework.Graphics.GraphicsDevice._profileCapabilities, Microsoft.Xna.Framework.Graphics.DeviceResourceManager.AddTrackedObject(), Microsoft.Xna.Framework.FrameworkResources.DeviceCannotBeNullOnResourceCreate, System.format, Microsoft.Xna.Framework.Graphics.GraphicsHelpers.GetExceptionFromResult(), Microsoft.Xna.Framework.Graphics.Texture2D.InitializeDescription(), Microsoft.Xna.Framework.Graphics.GraphicsResource.isDisposed, Microsoft.Xna.Framework.Graphics.GraphicsDevice.pComPtr, Microsoft.Xna.Framework.Graphics.Texture2D.pComPtr, Microsoft.Xna.Framework.Graphics.GraphicsDevice.Resources, and Microsoft.Xna.Framework.Graphics.Texture2D.ValidateCreationParameters().

Referenced by Microsoft.Xna.Framework.Graphics.Texture2D.Texture2D(), Microsoft.Xna.Framework.Graphics.Texture2D.Texture2D(), Microsoft.Xna.Framework.Graphics.Texture2D.Texture2D(), Microsoft.Xna.Framework.Graphics.RenderTarget2D.CreateRenderTarget(), and Microsoft.Xna.Framework.Graphics.RenderTarget2D.RecreateAndPopulateObject().