3 #if SILICONSTUDIO_PARADOX_GRAPHICS_API_DIRECT3D
25 using System.Collections.Generic;
27 using SharpDX.Direct3D;
28 using SharpDX.Direct3D11;
30 namespace SiliconStudio.
Paradox.Graphics
38 public partial
struct GraphicsDeviceFeatures
40 private readonly
static List<SharpDX.DXGI.Format> ObsoleteFormatToExcludes =
new List<SharpDX.DXGI.Format>() { Format.R1_UNorm, Format.B5G6R5_UNorm, Format.B5G5R5A1_UNorm };
42 internal GraphicsDeviceFeatures(GraphicsDevice deviceRoot)
44 var nativeDevice = deviceRoot.NativeDevice;
46 mapFeaturesPerFormat =
new FeaturesPerFormat[256];
49 Profile = GraphicsProfileHelper.FromFeatureLevel(nativeDevice.FeatureLevel);
51 #if SILICONSTUDIO_PLATFORM_WINDOWS_DESKTOP
52 IsProfiled = PixHelper.IsCurrentlyProfiled;
57 HasComputeShaders = nativeDevice.CheckFeatureSupport(Feature.ComputeShaders);
58 HasDoublePrecision = nativeDevice.CheckFeatureSupport(Feature.ShaderDoubles);
59 nativeDevice.CheckThreadingSupport(out HasMultiThreadingConcurrentResources, out this.HasDriverCommandLists);
62 foreach (var
format in Enum.GetValues(typeof(SharpDX.DXGI.Format)))
64 var dxgiFormat = (SharpDX.DXGI.Format)format;
65 var maximumMSAA = MSAALevel.None;
66 var computeShaderFormatSupport = ComputeShaderFormatSupport.None;
67 var formatSupport = FormatSupport.None;
69 if (!ObsoleteFormatToExcludes.Contains(dxgiFormat))
71 maximumMSAA = GetMaximumMSAASampleCount(nativeDevice, dxgiFormat);
72 if (HasComputeShaders)
73 computeShaderFormatSupport = nativeDevice.CheckComputeShaderFormatSupport(dxgiFormat);
75 formatSupport = (
FormatSupport)nativeDevice.CheckFormatSupport(dxgiFormat);
79 mapFeaturesPerFormat[(int)dxgiFormat] =
new FeaturesPerFormat((
PixelFormat)dxgiFormat, maximumMSAA, formatSupport);
89 private static
MSAALevel GetMaximumMSAASampleCount(SharpDX.Direct3D11.Device device, SharpDX.DXGI.Format pixelFormat)
92 for (
int i = 1; i <= 8; i *= 2)
94 if (device.CheckMultisampleQualityLevels(pixelFormat, i) != 0)
MSAALevel
Multisample count level.
_In_ size_t _In_ size_t _In_ DXGI_FORMAT format
PixelFormat
Defines various types of pixel formats.