summaryrefslogtreecommitdiffstats
path: root/video/out/opengl/context_angle.c
diff options
context:
space:
mode:
authorJames Ross-Gowan <rossymiles@gmail.com>2017-02-12 02:08:15 +1100
committerJames Ross-Gowan <rossymiles@gmail.com>2017-02-12 02:40:49 +1100
commit8bc335e3db2434ef594e49e8ddff3d6c89a6a009 (patch)
tree855c5e57053450a88d509998a0ec1cf38e367dc2 /video/out/opengl/context_angle.c
parent6ac3d77e908b9398f9f8c9b8be15a33be4ee67ea (diff)
downloadmpv-8bc335e3db2434ef594e49e8ddff3d6c89a6a009.tar.bz2
mpv-8bc335e3db2434ef594e49e8ddff3d6c89a6a009.tar.xz
vo_opengl: angle: log the device/surface implementation
This should be useful for debugging, since otherwise it's hard to tell which implementation has been auto-detected or if any failed to init.
Diffstat (limited to 'video/out/opengl/context_angle.c')
-rw-r--r--video/out/opengl/context_angle.c40
1 files changed, 27 insertions, 13 deletions
diff --git a/video/out/opengl/context_angle.c b/video/out/opengl/context_angle.c
index 9ea7fb43bb..7a011a80a4 100644
--- a/video/out/opengl/context_angle.c
+++ b/video/out/opengl/context_angle.c
@@ -104,6 +104,7 @@ struct priv {
ID3D11Device *d3d11_device;
ID3D11DeviceContext *d3d11_context;
ID3D11Texture2D *d3d11_backbuffer;
+ D3D_FEATURE_LEVEL d3d11_level;
EGLConfig egl_config;
EGLDisplay egl_display;
@@ -260,7 +261,6 @@ static bool d3d11_device_create(MPGLContext *ctx, int flags)
D3D_FEATURE_LEVEL_10_0,
D3D_FEATURE_LEVEL_9_3,
};
- D3D_FEATURE_LEVEL selected_level;
int level_count = 4;
// Only try feature levels less than or equal to the user specified level
@@ -273,13 +273,13 @@ static bool d3d11_device_create(MPGLContext *ctx, int flags)
hr = E_FAIL;
if ((FAILED(hr) && o->d3d11_warp == -1) || o->d3d11_warp == 0) {
hr = D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_HARDWARE, NULL, 0, levels,
- level_count, D3D11_SDK_VERSION, &p->d3d11_device, &selected_level,
+ level_count, D3D11_SDK_VERSION, &p->d3d11_device, &p->d3d11_level,
&p->d3d11_context);
}
// Try WARP if it is forced or if the HW adapter failed
if ((FAILED(hr) && o->d3d11_warp == -1) || o->d3d11_warp == 1) {
hr = D3D11CreateDevice(NULL, D3D_DRIVER_TYPE_WARP, NULL, 0, levels,
- level_count, D3D11_SDK_VERSION, &p->d3d11_device, &selected_level,
+ level_count, D3D11_SDK_VERSION, &p->d3d11_device, &p->d3d11_level,
&p->d3d11_context);
if (SUCCEEDED(hr))
show_sw_adapter_msg(ctx);
@@ -290,10 +290,6 @@ static bool d3d11_device_create(MPGLContext *ctx, int flags)
return false;
}
- MP_VERBOSE(vo, "Using Direct3D 11 feature level %u_%u\n",
- ((unsigned)selected_level) >> 12,
- (((unsigned)selected_level) >> 8) & 0xf);
-
hr = ID3D11Device_QueryInterface(p->d3d11_device, &IID_IDXGIDevice1,
(void**)&p->dxgi_device);
if (FAILED(hr)) {
@@ -452,12 +448,10 @@ static bool d3d11_swapchain_surface_create(MPGLContext *ctx, int flags)
// Create a DXGI 1.2+ (Windows 8+) swap chain if possible
if (!d3d11_swapchain_create_1_2(ctx, flags))
goto fail;
- MP_VERBOSE(vo, "Using DXGI 1.2+\n");
} else if (p->dxgi_factory) {
// Fall back to DXGI 1.1 (Windows 7)
if (!d3d11_swapchain_create_1_1(ctx, flags))
goto fail;
- MP_VERBOSE(vo, "Using DXGI 1.1\n");
} else {
goto fail;
}
@@ -634,10 +628,19 @@ static int angle_init(struct MPGLContext *ctx, int flags)
// Create the underlying EGL device implementation
bool device_ok = false;
- if ((!device_ok && !o->renderer) || o->renderer == RENDERER_D3D11)
+ if ((!device_ok && !o->renderer) || o->renderer == RENDERER_D3D11) {
device_ok = d3d11_device_create(ctx, flags);
- if ((!device_ok && !o->renderer) || o->renderer == RENDERER_D3D9)
+ if (device_ok) {
+ MP_VERBOSE(vo, "Using Direct3D 11 feature level %u_%u\n",
+ ((unsigned)p->d3d11_level) >> 12,
+ (((unsigned)p->d3d11_level) >> 8) & 0xf);
+ }
+ }
+ if ((!device_ok && !o->renderer) || o->renderer == RENDERER_D3D9) {
device_ok = d3d9_device_create(ctx, flags);
+ if (device_ok)
+ MP_VERBOSE(vo, "Using Direct3D 9\n");
+ }
if (!device_ok)
goto fail;
@@ -662,10 +665,21 @@ static int angle_init(struct MPGLContext *ctx, int flags)
// Create the underlying EGL surface implementation
bool surface_ok = false;
- if ((!surface_ok && o->egl_windowing == -1) || o->egl_windowing == 0)
+ if ((!surface_ok && o->egl_windowing == -1) || o->egl_windowing == 0) {
surface_ok = d3d11_swapchain_surface_create(ctx, flags);
- if ((!surface_ok && o->egl_windowing == -1) || o->egl_windowing == 1)
+ if (surface_ok) {
+ if (p->dxgi_swapchain1) {
+ MP_VERBOSE(vo, "Using DXGI 1.2+\n");
+ } else {
+ MP_VERBOSE(vo, "Using DXGI 1.1\n");
+ }
+ }
+ }
+ if ((!surface_ok && o->egl_windowing == -1) || o->egl_windowing == 1) {
surface_ok = egl_window_surface_create(ctx, flags);
+ if (surface_ok)
+ MP_VERBOSE(vo, "Using EGL windowing\n");
+ }
if (!surface_ok)
goto fail;