using SharpDX;
using D2D = SharpDX.Direct2D1;
using DW = SharpDX.DirectWrite;
-using D3D10 = SharpDX.Direct3D10;
+using D3D11 = SharpDX.Direct3D11;
using D3D9 = SharpDX.Direct3D9;
using DXGI = SharpDX.DXGI;
sealed class D2DRender : D2DRenderCommon, IEditorRender
{
DotNetTextStore.TextStore store;
- D3D10.Texture2D texture;
+ D3D11.Texture2D texture;
DXGI.Surface surface;
- D3D10.Device device;
+ D3D11.Device device;
D3D9.Device device9;
D3D9.Surface surface9;
new D2D.RenderTarget render;
else
this.FillBackground(updateRect);
base.EndDraw();
- this.device.Flush();
+ this.device.ImmediateContext.Flush();
this.imageSource.AddDirtyRect(new Int32Rect(0, 0, (int)this.imageSource.Width, (int)this.imageSource.Height));
this.imageSource.Unlock();
void CreateDevice()
{
- D3D10.FeatureLevel[] levels = new D3D10.FeatureLevel[]{D3D10.FeatureLevel.Level_10_1,
- D3D10.FeatureLevel.Level_10_0,
- D3D10.FeatureLevel.Level_9_3,
- D3D10.FeatureLevel.Level_9_2,
- D3D10.FeatureLevel.Level_9_1};
- foreach (D3D10.FeatureLevel level in levels)
+ SharpDX.Direct3D.FeatureLevel[] levels = new SharpDX.Direct3D.FeatureLevel[]{
+ SharpDX.Direct3D.FeatureLevel.Level_11_0,
+ SharpDX.Direct3D.FeatureLevel.Level_10_1,
+ SharpDX.Direct3D.FeatureLevel.Level_10_0,
+ SharpDX.Direct3D.FeatureLevel.Level_9_3,
+ SharpDX.Direct3D.FeatureLevel.Level_9_2,
+ SharpDX.Direct3D.FeatureLevel.Level_9_1};
+ foreach (var level in levels)
{
try
{
- this.device = new D3D10.Device1(D3D10.DriverType.Hardware, D3D10.DeviceCreationFlags.BgraSupport,level);
+ this.device = new D3D11.Device(SharpDX.Direct3D.DriverType.Hardware, D3D11.DeviceCreationFlags.BgraSupport, level);
break;
}
catch
protected override D2D.RenderTarget ConstructRender(D2D.Factory factory, D2D.RenderTargetProperties prop, double width, double height)
{
- D3D10.Texture2DDescription desc = new D3D10.Texture2DDescription();
+ D3D11.Texture2DDescription desc = new D3D11.Texture2DDescription();
desc.Width = (int)width;
desc.Height = (int)height;
desc.MipLevels = 1;
desc.ArraySize = 1;
desc.Format = DXGI.Format.B8G8R8A8_UNorm;
desc.SampleDescription = new DXGI.SampleDescription(1, 0);
- desc.Usage = D3D10.ResourceUsage.Default;
- desc.BindFlags = D3D10.BindFlags.RenderTarget | D3D10.BindFlags.ShaderResource;
- desc.CpuAccessFlags = D3D10.CpuAccessFlags.None;
- desc.OptionFlags = D3D10.ResourceOptionFlags.Shared;
- this.texture = new D3D10.Texture2D(this.device, desc);
+ desc.Usage = D3D11.ResourceUsage.Default;
+ desc.BindFlags = D3D11.BindFlags.RenderTarget | D3D11.BindFlags.ShaderResource;
+ desc.CpuAccessFlags = D3D11.CpuAccessFlags.None;
+ desc.OptionFlags = D3D11.ResourceOptionFlags.Shared;
+ this.texture = new D3D11.Texture2D(this.device, desc);
this.surface = this.texture.QueryInterface<DXGI.Surface>();