ReactOS  0.4.15-dev-1068-g467feb9
query.c File Reference
#include "config.h"
#include "d3d9_private.h"
Include dependency graph for query.c:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (d3d9)
 
static struct d3d9_queryimpl_from_IDirect3DQuery9 (IDirect3DQuery9 *iface)
 
static HRESULT WINAPI d3d9_query_QueryInterface (IDirect3DQuery9 *iface, REFIID riid, void **out)
 
static ULONG WINAPI d3d9_query_AddRef (IDirect3DQuery9 *iface)
 
static ULONG WINAPI d3d9_query_Release (IDirect3DQuery9 *iface)
 
static HRESULT WINAPI d3d9_query_GetDevice (IDirect3DQuery9 *iface, IDirect3DDevice9 **device)
 
static D3DQUERYTYPE WINAPI d3d9_query_GetType (IDirect3DQuery9 *iface)
 
static DWORD WINAPI d3d9_query_GetDataSize (IDirect3DQuery9 *iface)
 
static HRESULT WINAPI d3d9_query_Issue (IDirect3DQuery9 *iface, DWORD flags)
 
static HRESULT WINAPI d3d9_query_GetData (IDirect3DQuery9 *iface, void *data, DWORD size, DWORD flags)
 
HRESULT query_init (struct d3d9_query *query, struct d3d9_device *device, D3DQUERYTYPE type)
 

Variables

static const struct IDirect3DQuery9Vtbl d3d9_query_vtbl
 

Function Documentation

◆ d3d9_query_AddRef()

static ULONG WINAPI d3d9_query_AddRef ( IDirect3DQuery9 *  iface)
static

Definition at line 51 of file query.c.

52 {
55 
56  TRACE("%p increasing refcount to %u.\n", iface, refcount);
57 
58  return refcount;
59 }
static struct d3d9_query * impl_from_IDirect3DQuery9(IDirect3DQuery9 *iface)
Definition: query.c:28
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
unsigned int ULONG
Definition: retypes.h:1

◆ d3d9_query_GetData()

static HRESULT WINAPI d3d9_query_GetData ( IDirect3DQuery9 *  iface,
void data,
DWORD  size,
DWORD  flags 
)
static

Definition at line 131 of file query.c.

132 {
133  struct d3d9_query *query = impl_from_IDirect3DQuery9(iface);
135  HRESULT hr;
136 
137  TRACE("iface %p, data %p, size %u, flags %#x.\n",
138  iface, data, size, flags);
139 
141  type = wined3d_query_get_type(query->wined3d_query);
143  {
144  struct wined3d_query_data_timestamp_disjoint data_disjoint;
145 
146  if (size > sizeof(data_disjoint.disjoint))
147  size = sizeof(data_disjoint.disjoint);
148 
149  hr = wined3d_query_get_data(query->wined3d_query, &data_disjoint, sizeof(data_disjoint), flags);
150  if (SUCCEEDED(hr))
151  memcpy(data, &data_disjoint.disjoint, size);
152  }
153  else
154  {
155  hr = wined3d_query_get_data(query->wined3d_query, data, size, flags);
156  }
158 
159  if (hr == D3DERR_INVALIDCALL)
160  {
161  if (data)
162  {
163  memset(data, 0, size);
164  memset(data, 0xdd, min(size, query->data_size));
165  }
166  return S_OK;
167  }
168  return hr;
169 }
HRESULT hr
Definition: shlfolder.c:183
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
#define D3DERR_INVALIDCALL
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
HRESULT CDECL wined3d_query_get_data(struct wined3d_query *query, void *data, UINT data_size, DWORD flags)
Definition: query.c:364
wined3d_query_type
Definition: wined3d.h:704
static struct d3d9_query * impl_from_IDirect3DQuery9(IDirect3DQuery9 *iface)
Definition: query.c:28
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
LONG HRESULT
Definition: typedefs.h:79
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
GLbitfield flags
Definition: glext.h:7161
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define S_OK
Definition: intsafe.h:51
enum wined3d_query_type CDECL wined3d_query_get_type(const struct wined3d_query *query)
Definition: query.c:498
#define min(a, b)
Definition: monoChain.cc:55
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373
#define memset(x, y, z)
Definition: compat.h:39
#define SUCCEEDED(hr)
Definition: intsafe.h:49

◆ d3d9_query_GetDataSize()

static DWORD WINAPI d3d9_query_GetDataSize ( IDirect3DQuery9 *  iface)
static

Definition at line 108 of file query.c.

109 {
110  struct d3d9_query *query = impl_from_IDirect3DQuery9(iface);
111 
112  TRACE("iface %p.\n", iface);
113 
114  return query->data_size;
115 }
static struct d3d9_query * impl_from_IDirect3DQuery9(IDirect3DQuery9 *iface)
Definition: query.c:28
#define TRACE(s)
Definition: solgame.cpp:4

◆ d3d9_query_GetDevice()

static HRESULT WINAPI d3d9_query_GetDevice ( IDirect3DQuery9 *  iface,
IDirect3DDevice9 **  device 
)
static

Definition at line 80 of file query.c.

81 {
83 
84  TRACE("iface %p, device %p.\n", iface, device);
85 
86  *device = (IDirect3DDevice9 *)query->parent_device;
88 
89  TRACE("Returning device %p.\n", *device);
90 
91  return D3D_OK;
92 }
Definition: devices.h:37
static struct d3d9_query * impl_from_IDirect3DQuery9(IDirect3DQuery9 *iface)
Definition: query.c:28
#define TRACE(s)
Definition: solgame.cpp:4
#define IDirect3DDevice9_AddRef(p)
Definition: d3d9.h:1507
#define D3D_OK
Definition: d3d.h:106

◆ d3d9_query_GetType()

static D3DQUERYTYPE WINAPI d3d9_query_GetType ( IDirect3DQuery9 *  iface)
static

Definition at line 94 of file query.c.

95 {
98 
99  TRACE("iface %p.\n", iface);
100 
102  type = wined3d_query_get_type(query->wined3d_query);
104 
105  return type;
106 }
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
static struct d3d9_query * impl_from_IDirect3DQuery9(IDirect3DQuery9 *iface)
Definition: query.c:28
#define TRACE(s)
Definition: solgame.cpp:4
enum wined3d_query_type CDECL wined3d_query_get_type(const struct wined3d_query *query)
Definition: query.c:498
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373
enum _D3DQUERYTYPE D3DQUERYTYPE

◆ d3d9_query_Issue()

static HRESULT WINAPI d3d9_query_Issue ( IDirect3DQuery9 *  iface,
DWORD  flags 
)
static

Definition at line 117 of file query.c.

118 {
119  struct d3d9_query *query = impl_from_IDirect3DQuery9(iface);
120  HRESULT hr;
121 
122  TRACE("iface %p, flags %#x.\n", iface, flags);
123 
125  hr = wined3d_query_issue(query->wined3d_query, flags);
127 
128  return hr;
129 }
HRESULT hr
Definition: shlfolder.c:183
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
static struct d3d9_query * impl_from_IDirect3DQuery9(IDirect3DQuery9 *iface)
Definition: query.c:28
#define TRACE(s)
Definition: solgame.cpp:4
LONG HRESULT
Definition: typedefs.h:79
GLbitfield flags
Definition: glext.h:7161
HRESULT CDECL wined3d_query_issue(struct wined3d_query *query, DWORD flags)
Definition: query.c:410
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373

◆ d3d9_query_QueryInterface()

static HRESULT WINAPI d3d9_query_QueryInterface ( IDirect3DQuery9 *  iface,
REFIID  riid,
void **  out 
)
static

Definition at line 33 of file query.c.

34 {
35  TRACE("iface %p, riid %s, out %p.\n", iface, debugstr_guid(riid), out);
36 
37  if (IsEqualGUID(riid, &IID_IDirect3DQuery9)
39  {
41  *out = iface;
42  return S_OK;
43  }
44 
45  WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid));
46 
47  *out = NULL;
48  return E_NOINTERFACE;
49 }
#define E_NOINTERFACE
Definition: winerror.h:2364
#define IDirect3DQuery9_AddRef(p)
Definition: d3d9.h:1342
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:112
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
static FILE * out
Definition: regtests2xml.c:44
#define S_OK
Definition: intsafe.h:51
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4112

◆ d3d9_query_Release()

static ULONG WINAPI d3d9_query_Release ( IDirect3DQuery9 *  iface)
static

Definition at line 61 of file query.c.

62 {
65 
66  TRACE("%p decreasing refcount to %u.\n", iface, refcount);
67 
68  if (!refcount)
69  {
71  wined3d_query_decref(query->wined3d_query);
73 
74  IDirect3DDevice9Ex_Release(query->parent_device);
76  }
77  return refcount;
78 }
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
#define IDirect3DDevice9Ex_Release(p)
Definition: d3d9.h:1917
static struct d3d9_query * impl_from_IDirect3DQuery9(IDirect3DQuery9 *iface)
Definition: query.c:28
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
unsigned int ULONG
Definition: retypes.h:1
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373
ULONG CDECL wined3d_query_decref(struct wined3d_query *query)
Definition: query.c:349
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ impl_from_IDirect3DQuery9()

static struct d3d9_query* impl_from_IDirect3DQuery9 ( IDirect3DQuery9 *  iface)
inlinestatic

Definition at line 28 of file query.c.

29 {
30  return CONTAINING_RECORD(iface, struct d3d9_query, IDirect3DQuery9_iface);
31 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560
IDirect3DQuery9 IDirect3DQuery9_iface
Definition: d3d9_private.h:280

Referenced by d3d9_query_AddRef(), d3d9_query_GetData(), d3d9_query_GetDataSize(), d3d9_query_GetDevice(), d3d9_query_GetType(), d3d9_query_Issue(), and d3d9_query_Release().

◆ query_init()

HRESULT query_init ( struct d3d9_query query,
struct d3d9_device device,
D3DQUERYTYPE  type 
)

Definition at line 184 of file query.c.

185 {
186  HRESULT hr;
187 
189  {
190  if (type == 0x16)
191  FIXME("Undocumented query %#x created.\n", type);
192  else
193  WARN("Invalid query type %#x.\n", type);
194 
195  return D3DERR_NOTAVAILABLE;
196  }
197 
198  query->IDirect3DQuery9_iface.lpVtbl = &d3d9_query_vtbl;
199  query->refcount = 1;
200 
202  if (FAILED(hr = wined3d_query_create(device->wined3d_device, type,
203  query, &d3d9_null_wined3d_parent_ops, &query->wined3d_query)))
204  {
206  WARN("Failed to create wined3d query, hr %#x.\n", hr);
207  return hr;
208  }
209 
211  query->data_size = sizeof(DWORD);
213  query->data_size = sizeof(BOOL);
214  else
215  query->data_size = wined3d_query_get_data_size(query->wined3d_query);
217 
218  query->parent_device = &device->IDirect3DDevice9Ex_iface;
219  IDirect3DDevice9Ex_AddRef(query->parent_device);
220 
221  return D3D_OK;
222 }
HRESULT hr
Definition: shlfolder.c:183
#define WARN(fmt,...)
Definition: debug.h:112
void WINAPI wined3d_mutex_lock(void)
Definition: wined3d_main.c:368
UINT CDECL wined3d_query_get_data_size(const struct wined3d_query *query)
Definition: query.c:403
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
#define BOOL
Definition: nt_native.h:43
#define DWORD
Definition: nt_native.h:44
Definition: devices.h:37
#define FIXME(fmt,...)
Definition: debug.h:111
#define D3DERR_NOTAVAILABLE
Definition: d3d8.h:84
#define IDirect3DDevice9Ex_AddRef(p)
Definition: d3d9.h:1916
LONG HRESULT
Definition: typedefs.h:79
#define D3D_OK
Definition: d3d.h:106
HRESULT CDECL wined3d_query_create(struct wined3d_device *device, enum wined3d_query_type type, void *parent, const struct wined3d_parent_ops *parent_ops, struct wined3d_query **query)
Definition: query.c:1294
const struct wined3d_parent_ops d3d9_null_wined3d_parent_ops
Definition: device.c:30
static const struct IDirect3DQuery9Vtbl d3d9_query_vtbl
Definition: query.c:172
void WINAPI wined3d_mutex_unlock(void)
Definition: wined3d_main.c:373

Referenced by d3d9_device_CreateQuery().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( d3d9  )

Variable Documentation

◆ d3d9_query_vtbl

const struct IDirect3DQuery9Vtbl d3d9_query_vtbl
static
Initial value:
=
{
}
static HRESULT WINAPI d3d9_query_Issue(IDirect3DQuery9 *iface, DWORD flags)
Definition: query.c:117
static HRESULT WINAPI d3d9_query_GetDevice(IDirect3DQuery9 *iface, IDirect3DDevice9 **device)
Definition: query.c:80
static ULONG WINAPI d3d9_query_AddRef(IDirect3DQuery9 *iface)
Definition: query.c:51
static HRESULT WINAPI d3d9_query_GetData(IDirect3DQuery9 *iface, void *data, DWORD size, DWORD flags)
Definition: query.c:131
static DWORD WINAPI d3d9_query_GetDataSize(IDirect3DQuery9 *iface)
Definition: query.c:108
static ULONG WINAPI d3d9_query_Release(IDirect3DQuery9 *iface)
Definition: query.c:61
static HRESULT WINAPI d3d9_query_QueryInterface(IDirect3DQuery9 *iface, REFIID riid, void **out)
Definition: query.c:33
static D3DQUERYTYPE WINAPI d3d9_query_GetType(IDirect3DQuery9 *iface)
Definition: query.c:94

Definition at line 172 of file query.c.

Referenced by query_init().