static void EnumerateDevices(AdapterInfo9 info, List <Format> adapterFormats)
        {
            DeviceType[] deviceTypes = { DeviceType.Hardware, DeviceType.Reference };

            foreach (DeviceType deviceType in deviceTypes)
            {
                if (MinimumSettings != null && MinimumSettings.DeviceType != deviceType)
                {
                    continue;
                }

                DeviceInfo9 deviceInfo = new DeviceInfo9();
                deviceInfo.DeviceType = deviceType;
                try
                {
                    deviceInfo.Capabilities = GraphicsDeviceManager.Direct3D9Object.GetDeviceCaps(info.AdapterOrdinal, deviceInfo.DeviceType);

                    EnumerateSettingsCombos(info, deviceInfo, adapterFormats);

                    if (deviceInfo.DeviceSettings.Count > 0)
                    {
                        info.Devices.Add(deviceInfo);
                    }
                }
                catch
                {
                    // #23681 2010.11.17 yyagi: GetDeviceCaps()で例外が発生するモニタに対しては、enumerateをスキップする。
                }
            }
        }
        static void EnumerateSettingsCombos(AdapterInfo9 adapterInfo, DeviceInfo9 deviceInfo, List <Format> adapterFormats)
        {
            Format[] backBufferFormats = { Format.A8R8G8B8, Format.X8R8G8B8, Format.A2R10G10B10,
                                           Format.R5G6B5,   Format.A1R5G5B5, Format.X1R5G5B5 };

            foreach (Format adapterFormat in adapterFormats)
            {
                foreach (Format backBufferFormat in backBufferFormats)
                {
                    for (int windowed = 0; windowed < 2; windowed++)
                    {
                        if (windowed == 0 && adapterInfo.DisplayModes.Count == 0)
                        {
                            continue;
                        }

                        if (!GraphicsDeviceManager.Direct3D9Object.CheckDeviceType(adapterInfo.AdapterOrdinal, deviceInfo.DeviceType,
                                                                                   adapterFormat, backBufferFormat, (windowed == 1)))
                        {
                            continue;
                        }

                        if (!GraphicsDeviceManager.Direct3D9Object.CheckDeviceFormat(adapterInfo.AdapterOrdinal,
                                                                                     deviceInfo.DeviceType, adapterFormat, Usage.QueryPostPixelShaderBlending,
                                                                                     ResourceType.Texture, backBufferFormat))
                        {
                            continue;
                        }

                        SettingsCombo9 combo = new SettingsCombo9();
                        combo.AdapterOrdinal   = adapterInfo.AdapterOrdinal;
                        combo.DeviceType       = deviceInfo.DeviceType;
                        combo.AdapterFormat    = adapterFormat;
                        combo.BackBufferFormat = backBufferFormat;
                        combo.Windowed         = (windowed == 1);
                        combo.AdapterInfo      = adapterInfo;
                        combo.DeviceInfo       = deviceInfo;

                        BuildDepthStencilFormatList(combo);
                        BuildMultisampleTypeList(combo);

                        if (combo.MultisampleTypes.Count == 0)
                        {
                            continue;
                        }

                        BuildPresentIntervalList(combo);

                        if (MinimumSettings != null)
                        {
                            if (MinimumSettings.BackBufferFormat != Format.Unknown &&
                                MinimumSettings.BackBufferFormat != backBufferFormat)
                            {
                                continue;
                            }

                            if (MinimumSettings.DepthStencilFormat != Format.Unknown &&
                                !combo.DepthStencilFormats.Contains(MinimumSettings.DepthStencilFormat))
                            {
                                continue;
                            }

                            if (!combo.MultisampleTypes.Contains(MinimumSettings.MultisampleType))
                            {
                                continue;
                            }
                        }

                        deviceInfo.DeviceSettings.Add(combo);
                    }
                }
            }
        }