本文整理汇总了C#中SharpDX.Direct3D11.Device.AddReference方法的典型用法代码示例。如果您正苦于以下问题:C# Device.AddReference方法的具体用法?C# Device.AddReference怎么用?C# Device.AddReference使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharpDX.Direct3D11.Device
的用法示例。
在下文中一共展示了Device.AddReference方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: D3D11_2D1
public D3D11_2D1(Device11 drawdevice, Device10 textdevice)
: base(false) // nothing!
{
if (drawdevice == null || textdevice == null)
{
using (var dg = new DisposeGroup())
{
if (drawdevice == null && textdevice == null)
{
Adapter a = null;
foreach (var item in DeviceUtil.GetAdapters(dg))
{
if (!item.IsInterfaceSupported<Device10>())
continue;
if (Device11.GetSupportedFeatureLevel(item) < Direct3D.FeatureLevel.Level_10_1)
continue;
a = item;
break;
}
device = new Device11(a, DeviceCreationFlags.BgraSupport | DeviceCreationFlags.SingleThreaded | DeviceCreationFlags.Debug);
device10 = new Device10(a, Direct3D10.DeviceCreationFlags.BgraSupport | Direct3D10.DeviceCreationFlags.Singlethreaded | Direct3D10.DeviceCreationFlags.Debug);
}
else
{
if (drawdevice == null)
{
using (var xgidtext = textdevice.QueryInterface<DeviceXGI>())
device = new Device11(xgidtext.Adapter, DeviceCreationFlags.BgraSupport | DeviceCreationFlags.SingleThreaded | DeviceCreationFlags.Debug);
textdevice.AddReference();
device10 = textdevice;
}
else
{
using (var xgiddraw = drawdevice.QueryInterface<DeviceXGI>())
device10 = new Device10(xgiddraw.Adapter, Direct3D10.DeviceCreationFlags.BgraSupport | Direct3D10.DeviceCreationFlags.Singlethreaded | Direct3D10.DeviceCreationFlags.Debug);
drawdevice.AddReference();
device = drawdevice;
}
}
}
}
else
{
using (var xgidev10 = device10.QueryInterface<DeviceXGI>())
using (var xgidev11 = device.QueryInterface<DeviceXGI>())
{
if (xgidev10.Adapter.NativePointer != xgidev11.Adapter.NativePointer)
throw new ArgumentException("drawdevice.Adapter.NativePointer != textdevice.Adapter.NativePointer");
}
textdevice.AddReference();
drawdevice.AddReference();
device = drawdevice;
device10 = textdevice;
}
factory2D = new SharpDX.Direct2D1.Factory();
factoryDW = new FactoryDW();
}