Browse Source

win-capture: Use IUnknown for getting swap backbuffers

Using IDXGIResource doesn't work with D3D12.  D3D12 textures are not a
subclass of that class.
jp9000 9 years ago
parent
commit
f49065b1e6
1 changed files with 3 additions and 3 deletions
  1. 3 3
      plugins/win-capture/graphics-hook/dxgi-capture.cpp

+ 3 - 3
plugins/win-capture/graphics-hook/dxgi-capture.cpp

@@ -87,12 +87,12 @@ static HRESULT STDMETHODCALLTYPE hook_resize_buffers(IDXGISwapChain *swap,
 	return hr;
 }
 
-static inline IDXGIResource *get_dxgi_backbuffer(IDXGISwapChain *swap)
+static inline IUnknown *get_dxgi_backbuffer(IDXGISwapChain *swap)
 {
 	IDXGIResource *res = nullptr;
 	HRESULT hr;
 
-	hr = swap->GetBuffer(0, __uuidof(ID3D11Resource), (void**)&res);
+	hr = swap->GetBuffer(0, __uuidof(IUnknown), (void**)&res);
 	if (FAILED(hr))
 		hlog_hr("get_dxgi_backbuffer: GetBuffer failed", hr);
 
@@ -102,7 +102,7 @@ static inline IDXGIResource *get_dxgi_backbuffer(IDXGISwapChain *swap)
 static HRESULT STDMETHODCALLTYPE hook_present(IDXGISwapChain *swap,
 		UINT sync_interval, UINT flags)
 {
-	IDXGIResource *backbuffer = nullptr;
+	IUnknown *backbuffer = nullptr;
 	bool capture_overlay = global_hook_info->capture_overlay;
 	bool test_draw = (flags & DXGI_PRESENT_TEST) != 0;
 	bool capture;