Exemplo n.º 1
0
        internal GraphicsDeviceFeatures(Direct3D11.Device device)
        {
            mapFeaturesPerFormat = new FeaturesPerFormat[256];

            // Check global features
            Level = device.FeatureLevel;
            HasComputeShaders = device.CheckFeatureSupport(Feature.ComputeShaders);
            HasDoublePrecision = device.CheckFeatureSupport(Feature.ShaderDoubles);
            device.CheckThreadingSupport(out HasMultiThreadingConcurrentResources, out this.HasDriverCommandLists);

            // Check features for each DXGI.Format
            foreach (var format in Enum.GetValues(typeof(DXGI.Format)))
            {
                var dxgiFormat = (DXGI.Format) format;
                var maximumMSAA = MSAALevel.None;
                var computeShaderFormatSupport = ComputeShaderFormatSupport.None;
                var formatSupport = FormatSupport.None;

                if (!ObsoleteFormatToExcludes.Contains(dxgiFormat))
                {
                    maximumMSAA = GetMaximumMSAASampleCount(device, dxgiFormat);
                    if (HasComputeShaders)
                        computeShaderFormatSupport = device.CheckComputeShaderFormatSupport(dxgiFormat);

                    formatSupport = device.CheckFormatSupport(dxgiFormat);
                }

                mapFeaturesPerFormat[(int)dxgiFormat] = new FeaturesPerFormat(dxgiFormat, maximumMSAA, computeShaderFormatSupport, formatSupport);
            }
        }