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

◆ ConvertPresentationParametersToNative()

unsafe void Microsoft.Xna.Framework.Graphics.GraphicsDevice.ConvertPresentationParametersToNative ( GraphicsAdapter adapter,
PresentationParameters presentationParameters,
_D3DPRESENT_PARAMETERS_ * pp )
inlineprivate

Definition at line 1007 of file GraphicsDevice.cs.

1008 {
1009 if (presentationParameters.DeviceWindowHandle == IntPtr.Zero)
1010 {
1011 throw new ArgumentException(FrameworkResources.NullWindowHandleNotAllowed);
1012 }
1013 Helpers.ValidateOrientation(presentationParameters.DisplayOrientation);
1014 if (presentationParameters.BackBufferWidth <= 0 || presentationParameters.BackBufferHeight <= 0)
1015 {
1016 System.Runtime.CompilerServices.Unsafe.SkipInit(out tagRECT tagRECT);
1017 if (!presentationParameters.IsFullScreen && _003CModule_003E.GetClientRect((HWND__*)presentationParameters.DeviceWindowHandle.ToPointer(), &tagRECT) != 0)
1018 {
1019 presentationParameters.BackBufferWidth = System.Runtime.CompilerServices.Unsafe.As<tagRECT, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref tagRECT, 8)) - *(int*)(&tagRECT);
1020 presentationParameters.BackBufferHeight = System.Runtime.CompilerServices.Unsafe.As<tagRECT, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref tagRECT, 12)) - System.Runtime.CompilerServices.Unsafe.As<tagRECT, int>(ref System.Runtime.CompilerServices.Unsafe.AddByteOffset(ref tagRECT, 4));
1021 }
1022 else
1023 {
1024 presentationParameters.BackBufferWidth = adapter.CurrentDisplayMode.Width;
1025 presentationParameters.BackBufferHeight = adapter.CurrentDisplayMode.Height;
1026 }
1027 }
1028 SurfaceFormat selectedFormat = presentationParameters.BackBufferFormat;
1029 DepthFormat selectedDepthFormat = presentationParameters.DepthStencilFormat;
1030 int selectedMultiSampleCount = presentationParameters.MultiSampleCount;
1031 adapter.QueryFormat(isBackBuffer: true, _deviceType, _graphicsProfile, selectedFormat, selectedDepthFormat, selectedMultiSampleCount, out selectedFormat, out selectedDepthFormat, out selectedMultiSampleCount);
1032 *(int*)pp = presentationParameters.BackBufferWidth;
1033 *(int*)((byte*)pp + 4) = presentationParameters.BackBufferHeight;
1034 *(_D3DFORMAT*)((byte*)pp + 8) = _003CModule_003E.ConvertXnaFormatToWindows(selectedFormat);
1035 *(int*)((byte*)pp + 12) = 1;
1036 int num = (((*(_D3DFORMAT*)((byte*)pp + 40) = _003CModule_003E.ConvertXnaFormatToWindows(selectedDepthFormat)) != 0) ? 1 : 0);
1037 *(int*)((byte*)pp + 36) = num;
1038 *(int*)((byte*)pp + 16) = selectedMultiSampleCount;
1039 *(int*)((byte*)pp + 28) = (int)presentationParameters.DeviceWindowHandle.ToPointer();
1040 int num2 = ((!presentationParameters.IsFullScreen) ? 1 : 0);
1041 *(int*)((byte*)pp + 32) = num2;
1042 *(int*)((byte*)pp + 24) = 1;
1043 switch (presentationParameters.PresentationInterval)
1044 {
1045 default:
1046 *(int*)((byte*)pp + 52) = 0;
1047 break;
1048 case PresentInterval.Immediate:
1049 *(int*)((byte*)pp + 52) = int.MinValue;
1050 break;
1051 case PresentInterval.Two:
1052 if (presentationParameters.IsFullScreen && ((uint)(*(int*)((byte*)d3dCaps.t + 20)) & 2u) != 0)
1053 {
1054 *(int*)((byte*)pp + 52) = 2;
1055 }
1056 else
1057 {
1058 *(int*)((byte*)pp + 52) = 1;
1059 }
1060 break;
1061 case PresentInterval.One:
1062 *(int*)((byte*)pp + 52) = 1;
1063 break;
1064 }
1065 }
static readonly IntPtr Zero
Definition IntPtr.cs:18

References Microsoft.Xna.Framework.Graphics.GraphicsDevice._deviceType, Microsoft.Xna.Framework.Graphics.GraphicsDevice._graphicsProfile, Microsoft.Xna.Framework.Graphics.PresentationParameters.BackBufferFormat, Microsoft.Xna.Framework.Graphics.PresentationParameters.BackBufferHeight, Microsoft.Xna.Framework.Graphics.PresentationParameters.BackBufferWidth, Microsoft.Xna.Framework.Graphics.GraphicsAdapter.CurrentDisplayMode, Microsoft.Xna.Framework.Graphics.PresentationParameters.DepthStencilFormat, Microsoft.Xna.Framework.Graphics.PresentationParameters.DeviceWindowHandle, Microsoft.Xna.Framework.Graphics.PresentationParameters.DisplayOrientation, Microsoft.Xna.Framework.Graphics.DisplayMode.Height, Microsoft.Xna.Framework.Graphics.PresentationParameters.IsFullScreen, Microsoft.Xna.Framework.Graphics.PresentationParameters.MultiSampleCount, Microsoft.Xna.Framework.FrameworkResources.NullWindowHandleNotAllowed, Microsoft.Xna.Framework.Graphics.PresentationParameters.PresentationInterval, Microsoft.Xna.Framework.Graphics.GraphicsAdapter.QueryFormat(), System.IntPtr.ToPointer(), Microsoft.Xna.Framework.Helpers.ValidateOrientation(), Microsoft.Xna.Framework.Graphics.DisplayMode.Width, and System.IntPtr.Zero.

Referenced by Microsoft.Xna.Framework.Graphics.GraphicsDevice.CreateDevice(), and Microsoft.Xna.Framework.Graphics.GraphicsDevice.Reset().