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

◆ CreateSurfaces()

unsafe void Microsoft.Xna.Framework.Graphics.RenderTargetHelper.CreateSurfaces ( GraphicsDevice graphicsDevice)
inlinepackage

Definition at line 77 of file RenderTargetHelper.cs.

78 {
79 if (multiSampleCount != 0)
80 {
81 fixed (IDirect3DSurface9** ptr = &pRenderTargetSurface)
82 {
83 try
84 {
85 int num = *(int*)graphicsDevice.pComPtr + 112;
86 int num2 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, uint, uint, _D3DFORMAT, _D3DMULTISAMPLE_TYPE, uint, int, IDirect3DSurface9**, void**, int>)(int)(*(uint*)num))((nint)graphicsDevice.pComPtr, (uint)width, (uint)height, _003CModule_003E.ConvertXnaFormatToWindows(format), (_D3DMULTISAMPLE_TYPE)multiSampleCount, 0u, 0, ptr, null);
87 if (num2 < 0)
88 {
89 throw GraphicsHelpers.GetExceptionFromResult((uint)num2);
90 }
91 }
92 catch
93 {
94 //try-fault
95 ptr = null;
96 throw;
97 }
98 }
99 }
100 if (depthFormat != 0)
101 {
102 IntPtr intPtr = IntPtr.Zero;
103 if (usage == RenderTargetUsage.DiscardContents)
104 {
105 intPtr = graphicsDevice.Resources.FindResourceW(GetSharedDepthSurface);
106 }
107 if (intPtr != IntPtr.Zero)
108 {
109 pDepthSurface = (IDirect3DSurface9*)intPtr.ToPointer();
110 }
111 else
112 {
113 fixed (IDirect3DSurface9** ptr2 = &pDepthSurface)
114 {
115 try
116 {
117 int num3 = *(int*)graphicsDevice.pComPtr + 116;
118 int num4 = ((delegate* unmanaged[Stdcall, Stdcall]<IntPtr, uint, uint, _D3DFORMAT, _D3DMULTISAMPLE_TYPE, uint, int, IDirect3DSurface9**, void**, int>)(int)(*(uint*)num3))((nint)graphicsDevice.pComPtr, (uint)width, (uint)height, _003CModule_003E.ConvertXnaFormatToWindows(depthFormat), (_D3DMULTISAMPLE_TYPE)multiSampleCount, 0u, 0, ptr2, null);
119 if (num4 < 0)
120 {
121 throw GraphicsHelpers.GetExceptionFromResult((uint)num4);
122 }
123 }
124 catch
125 {
126 //try-fault
127 ptr2 = null;
128 throw;
129 }
130 }
131 }
132 }
133 try
134 {
135 return;
136 }
137 catch
138 {
139 //try-fault
140 throw;
141 }
142 }
unsafe IntPtr GetSharedDepthSurface(object managedObject)
static readonly IntPtr Zero
Definition IntPtr.cs:18
unsafe void * ToPointer()
Definition IntPtr.cs:210

References Microsoft.Xna.Framework.Graphics.RenderTargetHelper.depthFormat, Microsoft.Xna.Framework.Graphics.DeviceResourceManager.FindResourceW(), Microsoft.Xna.Framework.Graphics.RenderTargetHelper.format, Microsoft.Xna.Framework.Graphics.GraphicsHelpers.GetExceptionFromResult(), Microsoft.Xna.Framework.Graphics.RenderTargetHelper.GetSharedDepthSurface(), Microsoft.Xna.Framework.Graphics.RenderTargetHelper.height, Microsoft.Xna.Framework.Graphics.RenderTargetHelper.multiSampleCount, Microsoft.Xna.Framework.Graphics.GraphicsDevice.pComPtr, Microsoft.Xna.Framework.Graphics.RenderTargetHelper.pDepthSurface, Microsoft.Xna.Framework.Graphics.RenderTargetHelper.pRenderTargetSurface, Microsoft.Xna.Framework.Graphics.GraphicsDevice.Resources, System.IntPtr.ToPointer(), Microsoft.Xna.Framework.Graphics.RenderTargetHelper.usage, Microsoft.Xna.Framework.Graphics.RenderTargetHelper.width, and System.IntPtr.Zero.

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