protected DeviceResources(D3D11FeatureLevel featureLevel, bool useHighestFeatureLevel, bool preferMultisampling) { this.d3dFeatureLevel = featureLevel; this.useHighestFeatureLevel = useHighestFeatureLevel; this.preferMultisampling = preferMultisampling; this.CreateDeviceIndependentResources(); this.CreateDeviceResources(); }
public SwapChainDeviceResources(WindowBase window, D3D11FeatureLevel featureLevel, bool useHighestFeatureLevel, bool preferMultisampling) : base(featureLevel, useHighestFeatureLevel, preferMultisampling) { if (window == null) { throw new ArgumentNullException("window"); } this.window = window; }
public static extern void D3D11CreateDevice( [In, MarshalAs(UnmanagedType.IUnknown)] object adapter, [In] D3D11DriverType driverType, [In] IntPtr software, [In] D3D11CreateDeviceOptions options, [In, MarshalAs(UnmanagedType.LPArray)] D3D11FeatureLevel[] featureLevels, [In] uint numFeatureLevels, [In] uint sdkVersion, [Out] out ID3D11Device device, [Out] out D3D11FeatureLevel featureLevel, [Out] out ID3D11DeviceContext immediateContext);
public RenderTargetDeviceResources(uint width, uint height, D3D11FeatureLevel featureLevel, bool useHighestFeatureLevel, bool preferMultisampling) : base(featureLevel, useHighestFeatureLevel, preferMultisampling) { if (width < 0) { throw new ArgumentOutOfRangeException("width"); } if (height < 0) { throw new ArgumentOutOfRangeException("height"); } this.width = width; this.height = height; this.OnSizeChanged(); }
public Sample(D3D11FeatureLevel minimalFeatureLevel, string repository, string category, string name) { this.MinimalFeatureLevel = minimalFeatureLevel; this.Repository = repository; this.Category = category; this.Name = name; this.Title = this.Name; this.Description = "Description of " + this.Name + "."; string directory = this.SampleDirectory; string readmePath = Path.Combine(directory, "readme.txt"); if (File.Exists(readmePath)) { string[] lines = File.ReadAllLines(readmePath); if (lines.Length >= 3) { this.Title = lines[0]; this.Description = lines[2]; } } }
private void CreateDeviceResources() { D3D11FeatureLevel[] featureLevels; if (this.useHighestFeatureLevel) { if (this.d3dFeatureLevel == D3D11FeatureLevel.FeatureLevel91) { featureLevels = new D3D11FeatureLevel[] { D3D11FeatureLevel.FeatureLevel111, D3D11FeatureLevel.FeatureLevel110, D3D11FeatureLevel.FeatureLevel101, D3D11FeatureLevel.FeatureLevel100, D3D11FeatureLevel.FeatureLevel93, D3D11FeatureLevel.FeatureLevel92, D3D11FeatureLevel.FeatureLevel91 }; } else { featureLevels = Enum.GetValues(typeof(D3D11FeatureLevel)) .Cast <D3D11FeatureLevel>() .Where(t => t >= this.d3dFeatureLevel) .OrderByDescending(t => t) .ToArray(); } } else { featureLevels = new D3D11FeatureLevel[] { this.d3dFeatureLevel }; } D3D11CreateDeviceOptions options = D3D11CreateDeviceOptions.BgraSupport; try { this.d3dDriverType = D3D11DriverType.Hardware; D3D11Device.CreateDevice( null, this.d3dDriverType, options, featureLevels, out this.d3dDevice, out this.d3dFeatureLevel, out this.d3dContext); } catch (Exception ex) { if (ex.HResult == DxgiError.Unsupported) { this.d3dDriverType = D3D11DriverType.Warp; D3D11Device.CreateDevice( null, this.d3dDriverType, options, featureLevels, out this.d3dDevice, out this.d3dFeatureLevel, out this.d3dContext); } else { throw; } } if (this.preferMultisampling) { this.d3dSampleDesc = this.CheckMultisamplingSupport(); } else { this.d3dSampleDesc = new DxgiSampleDesc(1, 0); } }