Don't create an OpenGL context when using Direct3D9. Saves 4-14 megabytes of RAM. May also slightly increase performance though this has not been personally observed.

This commit is contained in:
UnknownShadow200 2015-10-15 19:03:20 +11:00
parent 80f6793a33
commit 8a63da7e02
4 changed files with 46 additions and 5 deletions

View file

@ -15,6 +15,7 @@ Global
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
Debug_DX|Any CPU = Debug_DX|Any CPU
Release_DX|Any CPU = Release_DX|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{23B9BDA8-4330-46AB-9012-08D87430391A}.Debug|Any CPU.Build.0 = Debug|Any CPU
@ -27,20 +28,28 @@ Global
{BEB1C785-5CAD-48FF-A886-876BF0A318D4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BEB1C785-5CAD-48FF-A886-876BF0A318D4}.Release|Any CPU.Build.0 = Release|Any CPU
{BEB1C785-5CAD-48FF-A886-876BF0A318D4}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BEB1C785-5CAD-48FF-A886-876BF0A318D4}.Debug_DX|Any CPU.Build.0 = Debug_DX|Any CPU
{BEB1C785-5CAD-48FF-A886-876BF0A318D4}.Debug_DX|Any CPU.ActiveCfg = Debug_DX|Any CPU
{BEB1C785-5CAD-48FF-A886-876BF0A318D4}.Debug_DX|Any CPU.Build.0 = Debug_D3D|Any CPU
{BEB1C785-5CAD-48FF-A886-876BF0A318D4}.Debug_DX|Any CPU.ActiveCfg = Debug_D3D|Any CPU
{35FEE071-2DE6-48A1-9343-B5C1F202A12B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{35FEE071-2DE6-48A1-9343-B5C1F202A12B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{35FEE071-2DE6-48A1-9343-B5C1F202A12B}.Release|Any CPU.Build.0 = Release|Any CPU
{35FEE071-2DE6-48A1-9343-B5C1F202A12B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{35FEE071-2DE6-48A1-9343-B5C1F202A12B}.Debug_DX|Any CPU.Build.0 = Debug|Any CPU
{35FEE071-2DE6-48A1-9343-B5C1F202A12B}.Debug_DX|Any CPU.ActiveCfg = Debug|Any CPU
{35FEE071-2DE6-48A1-9343-B5C1F202A12B}.Debug_DX|Any CPU.ActiveCfg = Debug_D3D|Any CPU
{4A4110EE-21CA-4715-AF67-0C8B7CE0642F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4A4110EE-21CA-4715-AF67-0C8B7CE0642F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4A4110EE-21CA-4715-AF67-0C8B7CE0642F}.Release|Any CPU.Build.0 = Release|Any CPU
{4A4110EE-21CA-4715-AF67-0C8B7CE0642F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4A4110EE-21CA-4715-AF67-0C8B7CE0642F}.Debug_DX|Any CPU.Build.0 = Debug|Any CPU
{4A4110EE-21CA-4715-AF67-0C8B7CE0642F}.Debug_DX|Any CPU.ActiveCfg = Debug|Any CPU
{4A4110EE-21CA-4715-AF67-0C8B7CE0642F}.Release_DX|Any CPU.Build.0 = Release|Any CPU
{4A4110EE-21CA-4715-AF67-0C8B7CE0642F}.Release_DX|Any CPU.ActiveCfg = Release|Any CPU
{35FEE071-2DE6-48A1-9343-B5C1F202A12B}.Release_DX|Any CPU.Build.0 = Release|Any CPU
{35FEE071-2DE6-48A1-9343-B5C1F202A12B}.Release_DX|Any CPU.ActiveCfg = Release_D3D|Any CPU
{23B9BDA8-4330-46AB-9012-08D87430391A}.Release_DX|Any CPU.Build.0 = Release|Any CPU
{23B9BDA8-4330-46AB-9012-08D87430391A}.Release_DX|Any CPU.ActiveCfg = Release|Any CPU
{BEB1C785-5CAD-48FF-A886-876BF0A318D4}.Release_DX|Any CPU.Build.0 = Release|Any CPU
{BEB1C785-5CAD-48FF-A886-876BF0A318D4}.Release_DX|Any CPU.ActiveCfg = Release_D3D|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View file

@ -46,7 +46,7 @@
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
<StartAction>Project</StartAction>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug_DX' ">
<PropertyGroup Condition=" '$(Configuration)' == 'Debug_D3D' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<OutputPath>..\output\debug\</OutputPath>
<DebugSymbols>true</DebugSymbols>
@ -58,6 +58,16 @@
<StartArguments>wwwf null 127.0.0.1 25566</StartArguments>
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release_D3D' ">
<OutputPath>..\output\release\</OutputPath>
<DebugSymbols>false</DebugSymbols>
<DebugType>None</DebugType>
<Optimize>True</Optimize>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<DefineConstants>TRACE;USE_DX</DefineConstants>
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
<StartAction>Project</StartAction>
</PropertyGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
<ItemGroup>
<Reference Include="System" />

View file

@ -44,6 +44,25 @@
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
<StartAction>Project</StartAction>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug_D3D' ">
<OutputPath>..\output\debug\</OutputPath>
<DebugSymbols>True</DebugSymbols>
<DebugType>None</DebugType>
<Optimize>True</Optimize>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<DefineConstants>DEBUG;TRACE;USE_DX</DefineConstants>
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Release_D3D' ">
<OutputPath>..\output\release\</OutputPath>
<DebugSymbols>False</DebugSymbols>
<DebugType>None</DebugType>
<Optimize>True</Optimize>
<CheckForOverflowUnderflow>False</CheckForOverflowUnderflow>
<DefineConstants>TRACE;USE_DX</DefineConstants>
<BaseIntermediateOutputPath>obj\</BaseIntermediateOutputPath>
<StartAction>Project</StartAction>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Drawing" />

View file

@ -79,8 +79,11 @@ namespace OpenTK.Platform.Windows {
}
public IGraphicsContext CreateGLContext(GraphicsMode mode, IWindowInfo window) {
//return new WinDXContext( mode, (WinWindowInfo)window );
#if USE_DX
return new WinDXContext( mode, (WinWindowInfo)window );
#else
return new WinGLContext(mode, (WinWindowInfo)window);
#endif
}
}
}