d3d10core: Implement d3d10_device_GetPredication().

This commit is contained in:
Henri Verbeet 2014-09-19 10:41:47 +02:00 committed by Alexandre Julliard
parent fdf60e51fc
commit a3daed9604
8 changed files with 46 additions and 9 deletions

View File

@ -209,7 +209,7 @@ HRESULT d3d10_query_init(struct d3d10_query *query, struct d3d10_device *device,
query->refcount = 1;
if (FAILED(hr = wined3d_query_create(device->wined3d_device,
query_type_map[desc->Query], &query->wined3d_query)))
query_type_map[desc->Query], query, &query->wined3d_query)))
{
WARN("Failed to create wined3d query, hr %#x.\n", hr);
return hr;

View File

@ -980,7 +980,21 @@ static void STDMETHODCALLTYPE d3d10_device_VSGetSamplers(ID3D10Device1 *iface,
static void STDMETHODCALLTYPE d3d10_device_GetPredication(ID3D10Device1 *iface,
ID3D10Predicate **predicate, BOOL *value)
{
FIXME("iface %p, predicate %p, value %p stub!\n", iface, predicate, value);
struct d3d10_device *device = impl_from_ID3D10Device(iface);
struct wined3d_query *wined3d_predicate;
struct d3d10_query *predicate_impl;
TRACE("iface %p, predicate %p, value %p.\n", iface, predicate, value);
if (!(wined3d_predicate = wined3d_device_get_predication(device->wined3d_device, value)))
{
*predicate = NULL;
return;
}
predicate_impl = wined3d_query_get_parent(wined3d_predicate);
*predicate = (ID3D10Predicate *)&predicate_impl->ID3D10Query_iface;
ID3D10Predicate_AddRef(*predicate);
}
static void STDMETHODCALLTYPE d3d10_device_GSGetShaderResources(ID3D10Device1 *iface,

View File

@ -189,7 +189,7 @@ HRESULT query_init(struct d3d9_query *query, struct d3d9_device *device, D3DQUER
query->refcount = 1;
wined3d_mutex_lock();
hr = wined3d_query_create(device->wined3d_device, type, &query->wined3d_query);
hr = wined3d_query_create(device->wined3d_device, type, query, &query->wined3d_query);
wined3d_mutex_unlock();
if (FAILED(hr))
{

View File

@ -3354,6 +3354,14 @@ void CDECL wined3d_device_set_predication(struct wined3d_device *device,
wined3d_query_decref(prev);
}
struct wined3d_query * CDECL wined3d_device_get_predication(struct wined3d_device *device, BOOL *value)
{
TRACE("device %p, value %p.\n", device, value);
*value = device->state.predicate_value;
return device->state.predicate;
}
void CDECL wined3d_device_set_primitive_type(struct wined3d_device *device,
enum wined3d_primitive_type primitive_type)
{

View File

@ -421,6 +421,13 @@ static HRESULT wined3d_event_query_ops_get_data(struct wined3d_query *query,
return S_OK;
}
void * CDECL wined3d_query_get_parent(const struct wined3d_query *query)
{
TRACE("query %p.\n", query);
return query->parent;
}
enum wined3d_query_type CDECL wined3d_query_get_type(const struct wined3d_query *query)
{
TRACE("query %p.\n", query);
@ -698,10 +705,13 @@ static const struct wined3d_query_ops timestamp_disjoint_query_ops =
wined3d_timestamp_disjoint_query_ops_issue,
};
static HRESULT query_init(struct wined3d_query *query, struct wined3d_device *device, enum wined3d_query_type type)
static HRESULT query_init(struct wined3d_query *query, struct wined3d_device *device,
enum wined3d_query_type type, void *parent)
{
const struct wined3d_gl_info *gl_info = &device->adapter->gl_info;
query->parent = parent;
switch (type)
{
case WINED3D_QUERY_TYPE_OCCLUSION:
@ -797,7 +807,7 @@ static HRESULT query_init(struct wined3d_query *query, struct wined3d_device *de
}
HRESULT CDECL wined3d_query_create(struct wined3d_device *device,
enum wined3d_query_type type, struct wined3d_query **query)
enum wined3d_query_type type, void *parent, struct wined3d_query **query)
{
struct wined3d_query *object;
HRESULT hr;
@ -808,8 +818,7 @@ HRESULT CDECL wined3d_query_create(struct wined3d_device *device,
if (!object)
return E_OUTOFMEMORY;
hr = query_init(object, device, type);
if (FAILED(hr))
if (FAILED(hr = query_init(object, device, type, parent)))
{
WARN("Failed to initialize query, hr %#x.\n", hr);
HeapFree(GetProcessHeap(), 0, object);

View File

@ -67,6 +67,7 @@
@ cdecl wined3d_device_get_material(ptr ptr)
@ cdecl wined3d_device_get_npatch_mode(ptr)
@ cdecl wined3d_device_get_pixel_shader(ptr)
@ cdecl wined3d_device_get_predication(ptr ptr)
@ cdecl wined3d_device_get_primitive_type(ptr ptr)
@ cdecl wined3d_device_get_ps_cb(ptr long)
@ cdecl wined3d_device_get_ps_consts_b(ptr long ptr long)
@ -169,10 +170,11 @@
@ cdecl wined3d_palette_incref(ptr)
@ cdecl wined3d_palette_set_entries(ptr long long long ptr)
@ cdecl wined3d_query_create(ptr long ptr)
@ cdecl wined3d_query_create(ptr long ptr ptr)
@ cdecl wined3d_query_decref(ptr)
@ cdecl wined3d_query_get_data(ptr ptr long long)
@ cdecl wined3d_query_get_data_size(ptr)
@ cdecl wined3d_query_get_parent(ptr)
@ cdecl wined3d_query_get_type(ptr)
@ cdecl wined3d_query_incref(ptr)
@ cdecl wined3d_query_issue(ptr long)

View File

@ -2559,6 +2559,8 @@ struct wined3d_query_ops
struct wined3d_query
{
LONG ref;
void *parent;
const struct wined3d_query_ops *query_ops;
struct wined3d_device *device;
enum query_state state;

View File

@ -2145,6 +2145,7 @@ HRESULT __cdecl wined3d_device_get_light_enable(const struct wined3d_device *dev
void __cdecl wined3d_device_get_material(const struct wined3d_device *device, struct wined3d_material *material);
float __cdecl wined3d_device_get_npatch_mode(const struct wined3d_device *device);
struct wined3d_shader * __cdecl wined3d_device_get_pixel_shader(const struct wined3d_device *device);
struct wined3d_query * __cdecl wined3d_device_get_predication(struct wined3d_device *device, BOOL *value);
void __cdecl wined3d_device_get_primitive_type(const struct wined3d_device *device,
enum wined3d_primitive_type *primitive_topology);
struct wined3d_buffer * __cdecl wined3d_device_get_ps_cb(const struct wined3d_device *device, UINT idx);
@ -2304,10 +2305,11 @@ HRESULT __cdecl wined3d_palette_set_entries(struct wined3d_palette *palette,
DWORD flags, DWORD start, DWORD count, const PALETTEENTRY *entries);
HRESULT __cdecl wined3d_query_create(struct wined3d_device *device,
enum wined3d_query_type type, struct wined3d_query **query);
enum wined3d_query_type type, void *parent, struct wined3d_query **query);
ULONG __cdecl wined3d_query_decref(struct wined3d_query *query);
HRESULT __cdecl wined3d_query_get_data(struct wined3d_query *query, void *data, UINT data_size, DWORD flags);
UINT __cdecl wined3d_query_get_data_size(const struct wined3d_query *query);
void * __cdecl wined3d_query_get_parent(const struct wined3d_query *query);
enum wined3d_query_type __cdecl wined3d_query_get_type(const struct wined3d_query *query);
ULONG __cdecl wined3d_query_incref(struct wined3d_query *query);
HRESULT __cdecl wined3d_query_issue(struct wined3d_query *query, DWORD flags);