private void CheckMultiSamplingSupport() { D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS msaa = default; msaa.Format = DXGI_FORMAT_B8G8R8A8_UNORM; msaa.SampleCount = MsaaCount; ThrowIfFailed(nameof(ID3D12Device.CheckFeatureSupport), _device->CheckFeatureSupport(D3D12_FEATURE_MULTISAMPLE_QUALITY_LEVELS, &msaa, (uint)sizeof(D3D12_FEATURE_DATA_MULTISAMPLE_QUALITY_LEVELS))); if (msaa.NumQualityLevels == 0) { throw new PlatformNotSupportedException($"{msaa.SampleCount}x MSAA is not supported on your system"); } // CheckFeatureSupport returns the number of quality levels // The max level is one less than the number of levels // It is common to have 1 quality level, so _msaaQuality is 0. This can be confusing, but just means the lowest quality setting, // rather than meaning not supported // There are 2 special values for quality levels // * -1 means all samples should be evenly distributed among the pixel // * -2 means all samples should be in the centre of the pixel _msaaDesc = new DXGI_SAMPLE_DESC(count: MsaaCount, quality: msaa.NumQualityLevels - 1); }
public HelloMultiSampling12(string name) : base(name) { _msaaRenderTargets = new ID3D12Resource *[2]; _msaaDesc = new DXGI_SAMPLE_DESC(2, DXGI_STANDARD_MULTISAMPLE_QUALITY_PATTERN); }