var creationFlags = SharpDX.Direct3D11.DeviceCreationFlags.BgraSupport; // D2Dをサポートするなら BgraSupport フラグが必須。
#if DEBUG
// D3D11 Debugメッセージは、プロジェクトプロパティで「ネイティブコードのデバッグを有効にする」を ON にしないと表示されないので注意。
- creationFlags |= SharpDX.Direct3D11.DeviceCreationFlags.Debug;
+ //creationFlags |= SharpDX.Direct3D11.DeviceCreationFlags.Debug; // デバッグ レイヤーを有効にしてアプリケーションを実行すると、速度が大幅に低下します。(MSDN)
#endif
d3dDevice = new SharpDX.Direct3D11.Device(
SharpDX.Direct3D.DriverType.Hardware,
SampleDescription = new SharpDX.DXGI.SampleDescription( 1, 0 ),
SwapEffect = SharpDX.DXGI.SwapEffect.FlipSequential, // ストアアプリの認定要件
Usage = SharpDX.DXGI.Usage.RenderTargetOutput,
- //Flags = SharpDX.DXGI.SwapChainFlags.None,
- Flags = SharpDX.DXGI.SwapChainFlags.AllowModeSwitch,
+ Flags = SharpDX.DXGI.SwapChainFlags.None,
+ //Flags = SharpDX.DXGI.SwapChainFlags.AllowModeSwitch,
};
this.bs_SwapChain1 = new SharpDX.DXGI.SwapChain1(
dxgiFactory2,
width: (int) this.物理画面サイズpx.Width,
height: (int) this.物理画面サイズpx.Height,
newFormat: SharpDX.DXGI.Format.B8G8R8A8_UNorm,
- //swapChainFlags: SharpDX.DXGI.SwapChainFlags.None );
- swapChainFlags: SharpDX.DXGI.SwapChainFlags.AllowModeSwitch );
+ swapChainFlags: SharpDX.DXGI.SwapChainFlags.None );
+ //swapChainFlags: SharpDX.DXGI.SwapChainFlags.AllowModeSwitch );
//----------------
#endregion
{
#region " D2DDevice を作成する。"
//-----------------
- using( var dxgiDevice = d3dDevice.QueryInterfaceOrNull<SharpDX.DXGI.Device>() )
+ using( var dxgiDevice2 = d3dDevice.QueryInterfaceOrNull<SharpDX.DXGI.Device2>() )
{
- if( null == dxgiDevice )
- throw new FDKException( "Direct3D11デバイスが、IDXGIDevice3 をサポートしていません。" );
+ if( null == dxgiDevice2 )
+ throw new FDKException( "Direct3D11デバイスが、IDXGIDevice2 をサポートしていません。" );
- this.bs_D2DDevice1 = new SharpDX.Direct2D1.Device1( this.D2DFactory2, dxgiDevice );
+ this.bs_D2DDevice1 = new SharpDX.Direct2D1.Device1( this.D2DFactory2, dxgiDevice2 );
}
//-----------------
#endregion
#region " D2Dの既定のデバイスコンテキストを作成する。"
//-----------------
- this.bs_D2DContext1 = new SharpDX.Direct2D1.DeviceContext1( this.D2DDevice1, SharpDX.Direct2D1.DeviceContextOptions.None );
+ this.bs_D2DContext1 = new SharpDX.Direct2D1.DeviceContext1( this.D2DDevice1, SharpDX.Direct2D1.DeviceContextOptions.EnableMultithreadedOptimizations );
// 現在のディスプレイDPI を取得し、D2DContext に設定する。
//this.D2DContext1.DotsPerInch = this.D2DFactory2.DesktopDpi;