summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorJames Ross-Gowan <rossy@jrg.systems>2017-12-09 00:45:00 +1100
committerJames Ross-Gowan <rossy@jrg.systems>2017-12-09 19:53:53 +1100
commit6ab7e0d465d30a68bf24a0cafeea9b3366dd3e99 (patch)
tree88b460e5de6df91ddae4c364786ae665445be22f /video
parent3723e611fc55f0d79e6574d3ae9646e7892244da (diff)
downloadmpv-6ab7e0d465d30a68bf24a0cafeea9b3366dd3e99.tar.bz2
mpv-6ab7e0d465d30a68bf24a0cafeea9b3366dd3e99.tar.xz
vo_gpu: d3d11: check for timestamp query support
Apparently timestamp queries are optional for 10level9 devices. Check for support when creating the device rather than spamming error messages during rendering. CreateQuery can be used to check for support by passing NULL as the final parameter. See: https://msdn.microsoft.com/en-us/library/windows/desktop/ff476150.aspx#ID3D11Device_CreateQuery
Diffstat (limited to 'video')
-rw-r--r--video/out/d3d11/ra_d3d11.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/video/out/d3d11/ra_d3d11.c b/video/out/d3d11/ra_d3d11.c
index a260b3b3d0..63dc5b9509 100644
--- a/video/out/d3d11/ra_d3d11.c
+++ b/video/out/d3d11/ra_d3d11.c
@@ -45,6 +45,7 @@ struct ra_d3d11 {
// Device capabilities
D3D_FEATURE_LEVEL fl;
bool has_clear_view;
+ bool has_timestamp_queries;
int max_uavs;
// Streaming dynamic vertex buffer, which is used for all renderpasses
@@ -1878,6 +1879,9 @@ static void timer_destroy(struct ra *ra, ra_timer *ratimer)
static ra_timer *timer_create(struct ra *ra)
{
struct ra_d3d11 *p = ra->priv;
+ if (!p->has_timestamp_queries)
+ return NULL;
+
struct d3d_timer *timer = talloc_zero(NULL, struct d3d_timer);
HRESULT hr;
@@ -2299,6 +2303,11 @@ struct ra *ra_d3d11_create(ID3D11Device *dev, struct mp_log *log,
if (ID3D11Device_GetCreationFlags(p->dev) & D3D11_CREATE_DEVICE_DEBUG)
init_debug_layer(ra);
+ // Some level 9_x devices don't have timestamp queries
+ hr = ID3D11Device_CreateQuery(p->dev,
+ &(D3D11_QUERY_DESC) { D3D11_QUERY_TIMESTAMP }, NULL);
+ p->has_timestamp_queries = SUCCEEDED(hr);
+
// According to MSDN, the above texture sizes are just minimums and drivers
// may support larger textures. See:
// https://msdn.microsoft.com/en-us/library/windows/desktop/ff476874.aspx