d3d11: Allow to query ID3D11Predicate interface when predicate was created by CreateQuery().

Signed-off-by: Józef Kucia <jkucia@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Józef Kucia 2016-04-05 10:22:03 +02:00 committed by Alexandre Julliard
parent 87f34ee566
commit 24e8cf64f1
1 changed files with 12 additions and 7 deletions

View File

@ -364,23 +364,28 @@ HRESULT d3d_query_create(struct d3d_device *device, const D3D11_QUERY_DESC *desc
struct d3d_query **query)
{
struct d3d_query *object;
BOOL is_predicate_type;
HRESULT hr;
if (!desc)
return E_INVALIDARG;
if (predicate
&& desc->Query != D3D11_QUERY_OCCLUSION_PREDICATE
&& desc->Query != D3D11_QUERY_SO_OVERFLOW_PREDICATE
&& desc->Query != D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0
&& desc->Query != D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1
&& desc->Query != D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2
&& desc->Query != D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM3)
is_predicate_type = desc->Query == D3D11_QUERY_OCCLUSION_PREDICATE
|| desc->Query == D3D11_QUERY_SO_OVERFLOW_PREDICATE
|| desc->Query == D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM0
|| desc->Query == D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM1
|| desc->Query == D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM2
|| desc->Query == D3D11_QUERY_SO_OVERFLOW_PREDICATE_STREAM3;
if (!is_predicate_type && predicate)
{
WARN("Query type %u is not a predicate.\n", desc->Query);
return E_INVALIDARG;
}
if (is_predicate_type)
predicate = TRUE;
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
return E_OUTOFMEMORY;