MCPcopy Create free account
hub / github.com/Atarity/Lightpack / DXGIPresent

Function DXGIPresent

Software/hooks/DxgiFrameGrabber.cpp:229–269  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

227}
228
229HRESULT WINAPI DXGIPresent(IDXGISwapChain * sc, UINT b, UINT c) {
230
231 DxgiFrameGrabber *dxgiFrameGrabber = DxgiFrameGrabber::getInstance();
232
233 Logger *logger = dxgiFrameGrabber->m_logger;
234
235 DXGI_SWAP_CHAIN_DESC desc;
236 sc->GetDesc(&desc);
237 logger->reportLogDebug(L"d3d10 Buffers count: %u, Output hwnd: %u, %s", desc.BufferCount, desc.OutputWindow, desc.Windowed ? "windowed" : "fullscreen");
238
239 if (!desc.Windowed) {
240 if (dxgiDevice == DxgiDeviceUnknown || dxgiDevice == DxgiDeviceD3D10 ) {
241
242 ID3D10Texture2D *pBackBuffer;
243 HRESULT hr = sc->GetBuffer(0, IID_ID3D10Texture2D, reinterpret_cast<LPVOID*> (&pBackBuffer));
244
245 if (hr == S_OK) {
246 if (dxgiDevice == DxgiDeviceUnknown) dxgiDevice = DxgiDeviceD3D10;
247 D3D10Grab(pBackBuffer);
248 pBackBuffer->Release();
249 } else {
250 if (dxgiDevice != DxgiDeviceUnknown)
251 logger->reportLogError(L"couldn't get d3d10 buffer. returned 0x%x", hr);
252 }
253 }
254 if (dxgiDevice == DxgiDeviceUnknown || dxgiDevice == DxgiDeviceD3D11 ) {
255 ID3D11Texture2D *pBackBuffer;
256 HRESULT hr = sc->GetBuffer(0, IID_ID3D11Texture2D, reinterpret_cast<LPVOID*> (&pBackBuffer));
257 if(hr == S_OK) {
258 if (dxgiDevice == DxgiDeviceUnknown) dxgiDevice = DxgiDeviceD3D11;
259 D3D11Grab(pBackBuffer);
260 pBackBuffer->Release();
261 } else {
262 logger->reportLogError(L"couldn't get d3d11 buffer. returned 0x%x", hr);
263 }
264 }
265 }
266
267 DXGISCPresentFunc originalFunc = reinterpret_cast<DXGISCPresentFunc>(dxgiFrameGrabber->m_dxgiPresentProxyFuncVFTable->getOriginalFunc());
268 return originalFunc(sc,b,c);
269}

Callers

nothing calls this directly

Calls 6

D3D10GrabFunction · 0.85
D3D11GrabFunction · 0.85
reportLogDebugMethod · 0.80
reportLogErrorMethod · 0.80
getOriginalFuncMethod · 0.80
GetBufferMethod · 0.45

Tested by

no test coverage detected