MCPcopy Create free account
hub / github.com/Aleksoid1978/VideoRenderer / GetAdapter

Function GetAdapter

Source/DX11Helper.cpp:81–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

79}
80
81UINT GetAdapter(HWND hWnd, IDXGIFactory1* pDXGIFactory, IDXGIAdapter** ppDXGIAdapter)
82{
83 *ppDXGIAdapter = nullptr;
84
85 CheckPointer(pDXGIFactory, 0);
86
87 const HMONITOR hMonitor = MonitorFromWindow(hWnd, MONITOR_DEFAULTTONEAREST);
88
89 UINT adapter = 0;
90 IDXGIAdapter* pDXGIAdapter = nullptr;
91 while (SUCCEEDED(pDXGIFactory->EnumAdapters(adapter, &pDXGIAdapter))) {
92 UINT output = 0;
93 IDXGIOutput* pDXGIOutput = nullptr;
94 while (SUCCEEDED(pDXGIAdapter->EnumOutputs(output, &pDXGIOutput))) {
95 DXGI_OUTPUT_DESC desc = {};
96 if (SUCCEEDED(pDXGIOutput->GetDesc(&desc))) {
97 if (desc.Monitor == hMonitor) {
98 SAFE_RELEASE(pDXGIOutput);
99 *ppDXGIAdapter = pDXGIAdapter;
100 return adapter;
101 }
102 }
103 SAFE_RELEASE(pDXGIOutput);
104 output++;
105 }
106
107 SAFE_RELEASE(pDXGIAdapter);
108 adapter++;
109 }
110
111 return 0;
112}
113
114HRESULT DumpTexture2D(ID3D11DeviceContext* pDeviceContext, ID3D11Texture2D* pTexture2D, const wchar_t* filename)
115{

Callers

nothing calls this directly

Calls 1

GetDescMethod · 0.45

Tested by

no test coverage detected