From 6ab7e0d465d30a68bf24a0cafeea9b3366dd3e99 Mon Sep 17 00:00:00 2001 From: James Ross-Gowan Date: Sat, 9 Dec 2017 00:45:00 +1100 Subject: 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 --- video/out/d3d11/ra_d3d11.c | 9 +++++++++ 1 file changed, 9 insertions(+) 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 -- cgit v1.2.3