Commit 7b84e323 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

d3d10core: Implement d3d10_device_CreatePredicate().

parent e4f50de3
......@@ -33,9 +33,12 @@ static inline struct d3d10_query *impl_from_ID3D10Query(ID3D10Query *iface)
static HRESULT STDMETHODCALLTYPE d3d10_query_QueryInterface(ID3D10Query *iface, REFIID riid, void **object)
{
struct d3d10_query *query = impl_from_ID3D10Query(iface);
TRACE("iface %p, riid %s, object %p.\n", iface, debugstr_guid(riid), object);
if (IsEqualGUID(riid, &IID_ID3D10Query)
if ((IsEqualGUID(riid, &IID_ID3D10Predicate) && query->predicate)
|| IsEqualGUID(riid, &IID_ID3D10Query)
|| IsEqualGUID(riid, &IID_ID3D10Asynchronous)
|| IsEqualGUID(riid, &IID_ID3D10DeviceChild)
|| IsEqualGUID(riid, &IID_IUnknown))
......@@ -162,10 +165,11 @@ static const struct ID3D10QueryVtbl d3d10_query_vtbl =
d3d10_query_GetDesc,
};
HRESULT d3d10_query_init(struct d3d10_query *query)
HRESULT d3d10_query_init(struct d3d10_query *query, BOOL predicate)
{
query->ID3D10Query_iface.lpVtbl = &d3d10_query_vtbl;
query->refcount = 1;
query->predicate = predicate;
return S_OK;
}
......@@ -278,9 +278,11 @@ struct d3d10_query
{
ID3D10Query ID3D10Query_iface;
LONG refcount;
BOOL predicate;
};
HRESULT d3d10_query_init(struct d3d10_query *query) DECLSPEC_HIDDEN;
HRESULT d3d10_query_init(struct d3d10_query *query, BOOL predicate) DECLSPEC_HIDDEN;
/* IDirect3D10Device */
struct d3d10_device
......
......@@ -1532,8 +1532,7 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateQuery(ID3D10Device *iface,
if (!object)
return E_OUTOFMEMORY;
hr = d3d10_query_init(object);
if (FAILED(hr))
if (FAILED(hr = d3d10_query_init(object, FALSE)))
{
WARN("Failed to initialize query, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
......@@ -1549,9 +1548,34 @@ static HRESULT STDMETHODCALLTYPE d3d10_device_CreateQuery(ID3D10Device *iface,
static HRESULT STDMETHODCALLTYPE d3d10_device_CreatePredicate(ID3D10Device *iface,
const D3D10_QUERY_DESC *desc, ID3D10Predicate **predicate)
{
FIXME("iface %p, desc %p, predicate %p stub!\n", iface, desc, predicate);
struct d3d10_query *object;
HRESULT hr;
return E_NOTIMPL;
TRACE("iface %p, desc %p, predicate %p.\n", iface, desc, predicate);
if (!desc)
return E_INVALIDARG;
if (desc->Query != D3D10_QUERY_OCCLUSION_PREDICATE && desc->Query != D3D10_QUERY_SO_OVERFLOW_PREDICATE)
{
WARN("Query type %#x is not a predicate.\n", desc->Query);
return E_INVALIDARG;
}
if (!(object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object))))
return E_OUTOFMEMORY;
if (FAILED(hr = d3d10_query_init(object, TRUE)))
{
WARN("Failed to initialize predicate, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);
return hr;
}
TRACE("Created predicate %p.\n", object);
*predicate = (ID3D10Predicate *)&object->ID3D10Query_iface;
return S_OK;
}
static HRESULT STDMETHODCALLTYPE d3d10_device_CreateCounter(ID3D10Device *iface,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment