本文整理匯總了C#中SharpDX.Direct3D11.Device.CheckThreadingSupport方法的典型用法代碼示例。如果您正苦於以下問題:C# Device.CheckThreadingSupport方法的具體用法?C# Device.CheckThreadingSupport怎麽用?C# Device.CheckThreadingSupport使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SharpDX.Direct3D11.Device
的用法示例。
在下文中一共展示了Device.CheckThreadingSupport方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: CreateAdaptersList
unsafe static MyAdapterInfo[] CreateAdaptersList()
{
List<MyAdapterInfo> adaptersList = new List<MyAdapterInfo>();
var factory = GetFactory();
FeatureLevel[] featureLevels = { FeatureLevel.Level_11_0 };
int adapterIndex = 0;
LogInfoFromWMI();
for(int i=0; i<factory.Adapters.Length; i++)
{
var adapter = factory.Adapters[i];
Device adapterTestDevice = null;
try
{
adapterTestDevice = new Device(adapter, DeviceCreationFlags.None, featureLevels);
}
catch(SharpDXException e)
{
}
bool supportedDevice = adapterTestDevice != null;
bool supportsConcurrentResources = false;
bool supportsCommandLists = false;
if (supportedDevice)
{
adapterTestDevice.CheckThreadingSupport(out supportsConcurrentResources, out supportsCommandLists);
}
void* ptr = ((IntPtr)adapter.Description.DedicatedVideoMemory).ToPointer();
ulong vram = (ulong)ptr;
var deviceDesc = String.Format("{0}, dev id: {1}, shared mem: {2}, Luid: {3}, rev: {4}, subsys id: {5}, vendor id: {6}",
adapter.Description.Description,
adapter.Description.DeviceId,
vram,
adapter.Description.Luid,
adapter.Description.Revision,
adapter.Description.SubsystemId,
adapter.Description.VendorId
);
var info = new MyAdapterInfo
{
Name = adapter.Description.Description,
DeviceName = adapter.Description.Description,
Description = deviceDesc,
IsSupported = supportedDevice,
AdapterDeviceId = i,
Has512MBRam = vram > 500000000,
HDRSupported = true,
MaxTextureSize = SharpDX.Direct3D11.Texture2D.MaximumTexture2DSize,
VRAM = vram,
MultithreadedRenderingSupported = supportsCommandLists
};
if(vram >= 2000000000)
{
info.MaxTextureQualitySupported = MyTextureQuality.HIGH;
}
else if (vram >= 1000000000)
{
info.MaxTextureQualitySupported = MyTextureQuality.MEDIUM;
}
else
{
info.MaxTextureQualitySupported = MyTextureQuality.LOW;
}
info.MaxAntialiasingModeSupported = MyAntialiasingMode.FXAA;
if (supportedDevice)
{
if (adapterTestDevice.CheckMultisampleQualityLevels(Format.R11G11B10_Float, 2) > 0)
{
info.MaxAntialiasingModeSupported = MyAntialiasingMode.MSAA_2;
}
if (adapterTestDevice.CheckMultisampleQualityLevels(Format.R11G11B10_Float, 4) > 0)
{
info.MaxAntialiasingModeSupported = MyAntialiasingMode.MSAA_4;
}
if (adapterTestDevice.CheckMultisampleQualityLevels(Format.R11G11B10_Float, 8) > 0)
{
info.MaxAntialiasingModeSupported = MyAntialiasingMode.MSAA_8;
}
}
LogAdapterInfoBegin(ref info);
if(supportedDevice)
{
for(int j=0; j<factory.Adapters[i].Outputs.Length; j++)
{
var output = factory.Adapters[i].Outputs[j];
//.........這裏部分代碼省略.........
示例2: CreateAdaptersList
unsafe static MyAdapterInfo[] CreateAdaptersList()
{
List<MyAdapterInfo> adaptersList = new List<MyAdapterInfo>();
var factory = GetFactory();
FeatureLevel[] featureLevels = { FeatureLevel.Level_11_0 };
int adapterIndex = 0;
LogInfoFromWMI();
for(int i=0; i<factory.Adapters.Length; i++)
{
var adapter = factory.Adapters[i];
Device adapterTestDevice = null;
try
{
adapterTestDevice = new Device(adapter, DeviceCreationFlags.None, featureLevels);
}
catch(SharpDXException e)
{
}
bool supportedDevice = adapterTestDevice != null;
bool supportsConcurrentResources = false;
bool supportsCommandLists = false;
if (supportedDevice)
{
adapterTestDevice.CheckThreadingSupport(out supportsConcurrentResources, out supportsCommandLists);
}
// DedicatedSystemMemory = bios or DVMT preallocated video memory, that cannot be used by OS - need retest on pc with only cpu/chipset based graphic
// DedicatedVideoMemory = discrete graphic video memory
// SharedSystemMemory = aditional video memory, that can be taken from OS RAM when needed
void * vramptr = ((IntPtr)(adapter.Description.DedicatedSystemMemory != 0 ? adapter.Description.DedicatedSystemMemory : adapter.Description.DedicatedVideoMemory)).ToPointer();
UInt64 vram = (UInt64)vramptr;
void * svramptr = ((IntPtr)adapter.Description.SharedSystemMemory).ToPointer();
UInt64 svram = (UInt64)svramptr;
// microsoft software renderer allocates 256MB shared memory, cpu integrated graphic on notebooks has 0 preallocated, all shared
supportedDevice = supportedDevice && (vram > 500000000 || svram > 500000000);
var deviceDesc = String.Format("{0}, dev id: {1}, mem: {2}, shared mem: {3}, Luid: {4}, rev: {5}, subsys id: {6}, vendor id: {7}",
adapter.Description.Description,
adapter.Description.DeviceId,
vram,
svram,
adapter.Description.Luid,
adapter.Description.Revision,
adapter.Description.SubsystemId,
adapter.Description.VendorId
);
var info = new MyAdapterInfo
{
Name = adapter.Description.Description,
DeviceName = adapter.Description.Description,
Description = deviceDesc,
IsDx11Supported = supportedDevice,
AdapterDeviceId = i,
Priority = VendorPriority(adapter.Description.VendorId),
HDRSupported = true,
MaxTextureSize = SharpDX.Direct3D11.Texture2D.MaximumTexture2DSize,
VRAM = vram > 0 ? vram : svram,
Has512MBRam = (vram > 500000000 || svram > 500000000),
MultithreadedRenderingSupported = supportsCommandLists
};
if(info.VRAM >= 2000000000)
{
info.MaxTextureQualitySupported = MyTextureQuality.HIGH;
}
else if (info.VRAM >= 1000000000)
{
info.MaxTextureQualitySupported = MyTextureQuality.MEDIUM;
}
else
{
info.MaxTextureQualitySupported = MyTextureQuality.LOW;
}
info.MaxAntialiasingModeSupported = MyAntialiasingMode.FXAA;
if (supportedDevice)
{
if (adapterTestDevice.CheckMultisampleQualityLevels(Format.R11G11B10_Float, 2) > 0)
{
info.MaxAntialiasingModeSupported = MyAntialiasingMode.MSAA_2;
}
if (adapterTestDevice.CheckMultisampleQualityLevels(Format.R11G11B10_Float, 4) > 0)
{
info.MaxAntialiasingModeSupported = MyAntialiasingMode.MSAA_4;
}
if (adapterTestDevice.CheckMultisampleQualityLevels(Format.R11G11B10_Float, 8) > 0)
{
info.MaxAntialiasingModeSupported = MyAntialiasingMode.MSAA_8;
}
}
//.........這裏部分代碼省略.........
示例3: GetAdapters
unsafe static MyAdapterInfo[] GetAdapters()
{
List<MyAdapterInfo> adaptersList = new List<MyAdapterInfo>();
var factory = GetFactory();
FeatureLevel[] featureLevels = { FeatureLevel.Level_11_0 };
int adapterIndex = 0;
LogInfoFromWMI(Log);
LogInfoFromWMI(MyLog.Default);
for (int i = 0; i < factory.Adapters.Length; i++)
{
var adapter = factory.Adapters[i];
Device adapterTestDevice = null;
try
{
adapterTestDevice = new Device(adapter, DeviceCreationFlags.None, featureLevels);
}
catch (SharpDXException)
{
}
bool supportedDevice = adapterTestDevice != null;
bool supportsConcurrentResources = false;
bool supportsCommandLists = false;
if (supportedDevice)
{
adapterTestDevice.CheckThreadingSupport(out supportsConcurrentResources, out supportsCommandLists);
}
// DedicatedSystemMemory = bios or DVMT preallocated video memory, that cannot be used by OS - need retest on pc with only cpu/chipset based graphic
// DedicatedVideoMemory = discrete graphic video memory
// SharedSystemMemory = aditional video memory, that can be taken from OS RAM when needed
void* vramptr =
((IntPtr)
(adapter.Description.DedicatedSystemMemory != 0
? adapter.Description.DedicatedSystemMemory
: adapter.Description.DedicatedVideoMemory)).ToPointer();
UInt64 vram = (UInt64) vramptr;
void* svramptr = ((IntPtr) adapter.Description.SharedSystemMemory).ToPointer();
UInt64 svram = (UInt64) svramptr;
// microsoft software renderer allocates 256MB shared memory, cpu integrated graphic on notebooks has 0 preallocated, all shared
supportedDevice = supportedDevice && (vram > 500000000 || svram > 500000000);
var deviceDesc =
String.Format(
"{0}, dev id: {1}, mem: {2}, shared mem: {3}, Luid: {4}, rev: {5}, subsys id: {6}, vendor id: {7}",
adapter.Description.Description,
adapter.Description.DeviceId,
vram,
svram,
adapter.Description.Luid,
adapter.Description.Revision,
adapter.Description.SubsystemId,
adapter.Description.VendorId
);
var info = new MyAdapterInfo
{
Name = adapter.Description.Description,
DeviceName = adapter.Description.Description,
VendorId = adapter.Description.VendorId,
DeviceId = adapter.Description.DeviceId,
Description = deviceDesc,
IsDx11Supported = supportedDevice,
AdapterDeviceId = i,
Priority = VendorPriority(adapter.Description.VendorId),
HDRSupported = true,
MaxTextureSize = SharpDX.Direct3D11.Texture2D.MaximumTexture2DSize,
VRAM = vram > 0 ? vram : svram,
Has512MBRam = (vram > 500000000 || svram > 500000000),
MultithreadedRenderingSupported = supportsCommandLists
};
adaptersList.Add(info);
adapterIndex++;
}
return adaptersList.ToArray();
}