mirror of
https://github.com/mpv-player/mpv
synced 2025-03-18 17:40:30 +00:00
d3d11: add mp_get_dxgi_output_desc
This commit is contained in:
parent
3afcaeb71a
commit
2b0c7b1aa4
@ -287,28 +287,8 @@ static bool query_output_format_and_colorspace(struct mp_log *log,
|
||||
if (!out_fmt || !out_cspace)
|
||||
return false;
|
||||
|
||||
HRESULT hr = IDXGISwapChain_GetContainingOutput(swapchain, &output);
|
||||
if (FAILED(hr)) {
|
||||
mp_err(log, "Failed to get swap chain's containing output: %s!\n",
|
||||
mp_HRESULT_to_str(hr));
|
||||
goto done;
|
||||
}
|
||||
|
||||
hr = IDXGIOutput_QueryInterface(output, &IID_IDXGIOutput6,
|
||||
(void**)&output6);
|
||||
if (FAILED(hr)) {
|
||||
// point where systems older than Windows 10 would fail,
|
||||
// thus utilizing error log level only with windows 10+
|
||||
mp_msg(log, IsWindows10OrGreater() ? MSGL_ERR : MSGL_V,
|
||||
"Failed to create a DXGI 1.6 output interface: %s\n",
|
||||
mp_HRESULT_to_str(hr));
|
||||
goto done;
|
||||
}
|
||||
|
||||
hr = IDXGIOutput6_GetDesc1(output6, &desc);
|
||||
if (FAILED(hr)) {
|
||||
mp_err(log, "Failed to query swap chain's output information: %s\n",
|
||||
mp_HRESULT_to_str(hr));
|
||||
if (!mp_get_dxgi_output_desc(swapchain, &desc)) {
|
||||
mp_err(log, "Failed to query swap chain's output information\n");
|
||||
goto done;
|
||||
}
|
||||
|
||||
@ -995,3 +975,23 @@ done:
|
||||
SAFE_RELEASE(dxgi_dev);
|
||||
return success;
|
||||
}
|
||||
|
||||
bool mp_get_dxgi_output_desc(IDXGISwapChain *swapchain, DXGI_OUTPUT_DESC1 *desc)
|
||||
{
|
||||
bool ret = false;
|
||||
IDXGIOutput *output = NULL;
|
||||
IDXGIOutput6 *output6 = NULL;
|
||||
|
||||
if (FAILED(IDXGISwapChain_GetContainingOutput(swapchain, &output)))
|
||||
goto done;
|
||||
|
||||
if (FAILED(IDXGIOutput_QueryInterface(output, &IID_IDXGIOutput6, (void**)&output6)))
|
||||
goto done;
|
||||
|
||||
ret = SUCCEEDED(IDXGIOutput6_GetDesc1(output6, desc));
|
||||
|
||||
done:
|
||||
SAFE_RELEASE(output);
|
||||
SAFE_RELEASE(output6);
|
||||
return ret;
|
||||
}
|
||||
|
@ -22,6 +22,7 @@
|
||||
#include <windows.h>
|
||||
#include <d3d11.h>
|
||||
#include <dxgi1_2.h>
|
||||
#include <dxgi1_6.h>
|
||||
|
||||
#include "video/mp_image.h"
|
||||
|
||||
@ -69,6 +70,8 @@ IDXGIAdapter1 *mp_get_dxgi_adapter(struct mp_log *log,
|
||||
bstr requested_adapter_name,
|
||||
bstr *listing);
|
||||
|
||||
bool mp_get_dxgi_output_desc(IDXGISwapChain *swapchain, DXGI_OUTPUT_DESC1 *desc);
|
||||
|
||||
OPT_STRING_VALIDATE_FUNC(mp_dxgi_validate_adapter);
|
||||
|
||||
bool mp_dxgi_list_or_verify_adapters(struct mp_log *log,
|
||||
|
Loading…
Reference in New Issue
Block a user