//----------------------------------------------------------------------------- // Static functions //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // FindAdapter // // Given a handle to a monitor, returns the ordinal number that D3D uses to // identify the adapter. //----------------------------------------------------------------------------- protected static void FindAdapter(IDirect3D9 pD3D9, IntPtr hMonitor, out int puAdapterID) { int cAdapters = 0; puAdapterID = -1; cAdapters = pD3D9.GetAdapterCount(); for (int i = 0; i < cAdapters; i++) { IntPtr hMonitorTmp = pD3D9.GetAdapterMonitor(i); if (hMonitorTmp == IntPtr.Zero) { break; } if (hMonitorTmp == hMonitor) { puAdapterID = i; break; } } if (puAdapterID == -1) { throw new COMException("D3DPresentEngine::FindAdapter", (int)HResult.E_FAIL); } }
/// <summary> /// Gets the pointer to the adapter monitor /// </summary> /// <param name="adapterOrdinal">The ordinal of the adapter</param> /// <returns>A pointer to the adaptor monitor</returns> private IntPtr GetAdapterMonitor(uint adapterOrdinal) { IntPtr pMonitor = IsVistaOrBetter ? m_d3dEx.GetAdapterMonitor(adapterOrdinal) : m_d3d.GetAdapterMonitor(adapterOrdinal); return(pMonitor); }
//----------------------------------------------------------------------------- // Static functions //----------------------------------------------------------------------------- //----------------------------------------------------------------------------- // FindAdapter // // Given a handle to a monitor, returns the ordinal number that D3D uses to // identify the adapter. //----------------------------------------------------------------------------- protected static void FindAdapter(IDirect3D9 pD3D9, IntPtr hMonitor, out int puAdapterID) { int cAdapters = 0; puAdapterID = -1; cAdapters = pD3D9.GetAdapterCount(); for (int i = 0; i < cAdapters; i++) { IntPtr hMonitorTmp = pD3D9.GetAdapterMonitor(i); if (hMonitorTmp == IntPtr.Zero) { break; } if (hMonitorTmp == hMonitor) { puAdapterID = i; break; } } if (puAdapterID == -1) { throw new COMException("D3DPresentEngine::FindAdapter", E_Fail); } }
/// <summary> /// Gets the pointer to the adapter monitor /// </summary> /// <param name="adapterOrdinal">The ordinal of the adapter</param> /// <returns>A pointer to the adaptor monitor</returns> private IntPtr GetAdapterMonitor(uint adapterOrdinal) { IntPtr pMonitor = m_d3dEx != null?m_d3dEx.GetAdapterMonitor(adapterOrdinal) : m_d3d.GetAdapterMonitor(adapterOrdinal); return(pMonitor); }