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
This commit is contained in:
James Ross-Gowan 2017-12-09 00:45:00 +11:00
parent 3723e611fc
commit 6ab7e0d465
1 changed files with 9 additions and 0 deletions

View File

@ -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