1bf215546Sopenharmony_ci/**************************************************************************
2bf215546Sopenharmony_ci *
3bf215546Sopenharmony_ci * Copyright 2012-2021 VMware, Inc.
4bf215546Sopenharmony_ci * All Rights Reserved.
5bf215546Sopenharmony_ci *
6bf215546Sopenharmony_ci * Permission is hereby granted, free of charge, to any person obtaining a
7bf215546Sopenharmony_ci * copy of this software and associated documentation files (the
8bf215546Sopenharmony_ci * "Software"), to deal in the Software without restriction, including
9bf215546Sopenharmony_ci * without limitation the rights to use, copy, modify, merge, publish,
10bf215546Sopenharmony_ci * distribute, sub license, and/or sell copies of the Software, and to
11bf215546Sopenharmony_ci * permit persons to whom the Software is furnished to do so, subject to
12bf215546Sopenharmony_ci * the following conditions:
13bf215546Sopenharmony_ci *
14bf215546Sopenharmony_ci * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15bf215546Sopenharmony_ci * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16bf215546Sopenharmony_ci * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
17bf215546Sopenharmony_ci * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM,
18bf215546Sopenharmony_ci * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19bf215546Sopenharmony_ci * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20bf215546Sopenharmony_ci * USE OR OTHER DEALINGS IN THE SOFTWARE.
21bf215546Sopenharmony_ci *
22bf215546Sopenharmony_ci * The above copyright notice and this permission notice (including the
23bf215546Sopenharmony_ci * next paragraph) shall be included in all copies or substantial portions
24bf215546Sopenharmony_ci * of the Software.
25bf215546Sopenharmony_ci *
26bf215546Sopenharmony_ci **************************************************************************/
27bf215546Sopenharmony_ci
28bf215546Sopenharmony_ci/*
29bf215546Sopenharmony_ci * State.h --
30bf215546Sopenharmony_ci *    State declarations.
31bf215546Sopenharmony_ci */
32bf215546Sopenharmony_ci
33bf215546Sopenharmony_ci
34bf215546Sopenharmony_ci#include "DriverIncludes.h"
35bf215546Sopenharmony_ci#include "util/u_hash_table.h"
36bf215546Sopenharmony_ci
37bf215546Sopenharmony_ci
38bf215546Sopenharmony_ci#define SUPPORT_MSAA 0
39bf215546Sopenharmony_ci#define SUPPORT_D3D10_1 0
40bf215546Sopenharmony_ci#define SUPPORT_D3D11 0
41bf215546Sopenharmony_ci
42bf215546Sopenharmony_ci
43bf215546Sopenharmony_cistruct Adapter
44bf215546Sopenharmony_ci{
45bf215546Sopenharmony_ci   struct pipe_screen *screen;
46bf215546Sopenharmony_ci};
47bf215546Sopenharmony_ci
48bf215546Sopenharmony_ci
49bf215546Sopenharmony_cistatic inline Adapter *
50bf215546Sopenharmony_ciCastAdapter(D3D10DDI_HADAPTER hAdapter)
51bf215546Sopenharmony_ci{
52bf215546Sopenharmony_ci   return static_cast<Adapter *>(hAdapter.pDrvPrivate);
53bf215546Sopenharmony_ci}
54bf215546Sopenharmony_ci
55bf215546Sopenharmony_cistruct Shader
56bf215546Sopenharmony_ci{
57bf215546Sopenharmony_ci   void *handle;
58bf215546Sopenharmony_ci   uint type;
59bf215546Sopenharmony_ci   struct pipe_shader_state state;
60bf215546Sopenharmony_ci   unsigned output_mapping[PIPE_MAX_SHADER_OUTPUTS];
61bf215546Sopenharmony_ci   boolean output_resolved;
62bf215546Sopenharmony_ci};
63bf215546Sopenharmony_ci
64bf215546Sopenharmony_cistruct Query;
65bf215546Sopenharmony_ci
66bf215546Sopenharmony_cistruct Device
67bf215546Sopenharmony_ci{
68bf215546Sopenharmony_ci   struct pipe_context *pipe;
69bf215546Sopenharmony_ci
70bf215546Sopenharmony_ci   struct pipe_framebuffer_state fb;
71bf215546Sopenharmony_ci   struct pipe_vertex_buffer vertex_buffers[PIPE_MAX_ATTRIBS];
72bf215546Sopenharmony_ci   struct pipe_resource *index_buffer;
73bf215546Sopenharmony_ci   unsigned restart_index;
74bf215546Sopenharmony_ci   unsigned index_size;
75bf215546Sopenharmony_ci   unsigned ib_offset;
76bf215546Sopenharmony_ci   void *samplers[PIPE_SHADER_TYPES][PIPE_MAX_SAMPLERS];
77bf215546Sopenharmony_ci   struct pipe_sampler_view *sampler_views[PIPE_SHADER_TYPES][PIPE_MAX_SHADER_SAMPLER_VIEWS];
78bf215546Sopenharmony_ci
79bf215546Sopenharmony_ci   void *empty_fs;
80bf215546Sopenharmony_ci   void *empty_vs;
81bf215546Sopenharmony_ci
82bf215546Sopenharmony_ci   enum pipe_prim_type primitive;
83bf215546Sopenharmony_ci
84bf215546Sopenharmony_ci   struct pipe_stream_output_target *so_targets[PIPE_MAX_SO_BUFFERS];
85bf215546Sopenharmony_ci   struct pipe_stream_output_target *draw_so_target;
86bf215546Sopenharmony_ci   Shader *bound_empty_gs;
87bf215546Sopenharmony_ci   Shader *bound_vs;
88bf215546Sopenharmony_ci
89bf215546Sopenharmony_ci   unsigned max_dual_source_render_targets;
90bf215546Sopenharmony_ci
91bf215546Sopenharmony_ci   D3D10DDI_HRTCORELAYER  hRTCoreLayer;
92bf215546Sopenharmony_ci
93bf215546Sopenharmony_ci   HANDLE hDevice;
94bf215546Sopenharmony_ci   HANDLE hContext;
95bf215546Sopenharmony_ci
96bf215546Sopenharmony_ci   D3DDDI_DEVICECALLBACKS KTCallbacks;
97bf215546Sopenharmony_ci   D3D10DDI_CORELAYER_DEVICECALLBACKS UMCallbacks;
98bf215546Sopenharmony_ci   DXGI_DDI_BASE_CALLBACKS *pDXGIBaseCallbacks;
99bf215546Sopenharmony_ci
100bf215546Sopenharmony_ci   INT LastEmittedQuerySeqNo;
101bf215546Sopenharmony_ci   INT LastFinishedQuerySeqNo;
102bf215546Sopenharmony_ci
103bf215546Sopenharmony_ci   Query *pPredicate;
104bf215546Sopenharmony_ci   BOOL PredicateValue;
105bf215546Sopenharmony_ci};
106bf215546Sopenharmony_ci
107bf215546Sopenharmony_ci
108bf215546Sopenharmony_cistatic inline Device *
109bf215546Sopenharmony_ciCastDevice(D3D10DDI_HDEVICE hDevice)
110bf215546Sopenharmony_ci{
111bf215546Sopenharmony_ci   return static_cast<Device *>(hDevice.pDrvPrivate);
112bf215546Sopenharmony_ci}
113bf215546Sopenharmony_ci
114bf215546Sopenharmony_ci
115bf215546Sopenharmony_cistatic inline struct pipe_context *
116bf215546Sopenharmony_ciCastPipeContext(D3D10DDI_HDEVICE hDevice)
117bf215546Sopenharmony_ci{
118bf215546Sopenharmony_ci   Device *pDevice = CastDevice(hDevice);
119bf215546Sopenharmony_ci   return pDevice ? pDevice->pipe : NULL;
120bf215546Sopenharmony_ci}
121bf215546Sopenharmony_ci
122bf215546Sopenharmony_ci
123bf215546Sopenharmony_cistatic inline Device *
124bf215546Sopenharmony_ciCastDevice(DXGI_DDI_HDEVICE hDevice)
125bf215546Sopenharmony_ci{
126bf215546Sopenharmony_ci   return reinterpret_cast<Device *>(hDevice);
127bf215546Sopenharmony_ci}
128bf215546Sopenharmony_ci
129bf215546Sopenharmony_ci
130bf215546Sopenharmony_cistatic inline struct pipe_context *
131bf215546Sopenharmony_ciCastPipeDevice(DXGI_DDI_HDEVICE hDevice)
132bf215546Sopenharmony_ci{
133bf215546Sopenharmony_ci   Device *pDevice = CastDevice(hDevice);
134bf215546Sopenharmony_ci   return pDevice ? pDevice->pipe : NULL;
135bf215546Sopenharmony_ci}
136bf215546Sopenharmony_ci
137bf215546Sopenharmony_ci
138bf215546Sopenharmony_cistatic inline void
139bf215546Sopenharmony_ciSetError(D3D10DDI_HDEVICE hDevice, HRESULT hr)
140bf215546Sopenharmony_ci{
141bf215546Sopenharmony_ci   if (FAILED(hr)) {
142bf215546Sopenharmony_ci      Device *pDevice = CastDevice(hDevice);
143bf215546Sopenharmony_ci      pDevice->UMCallbacks.pfnSetErrorCb(pDevice->hRTCoreLayer, hr);
144bf215546Sopenharmony_ci   }
145bf215546Sopenharmony_ci}
146bf215546Sopenharmony_ci
147bf215546Sopenharmony_ci
148bf215546Sopenharmony_cistruct Resource
149bf215546Sopenharmony_ci{
150bf215546Sopenharmony_ci   DXGI_FORMAT Format;
151bf215546Sopenharmony_ci   UINT MipLevels;
152bf215546Sopenharmony_ci   UINT NumSubResources;
153bf215546Sopenharmony_ci   bool buffer;
154bf215546Sopenharmony_ci   struct pipe_resource *resource;
155bf215546Sopenharmony_ci   struct pipe_transfer **transfers;
156bf215546Sopenharmony_ci   struct pipe_stream_output_target *so_target;
157bf215546Sopenharmony_ci};
158bf215546Sopenharmony_ci
159bf215546Sopenharmony_ci
160bf215546Sopenharmony_cistatic inline Resource *
161bf215546Sopenharmony_ciCastResource(D3D10DDI_HRESOURCE hResource)
162bf215546Sopenharmony_ci{
163bf215546Sopenharmony_ci   return static_cast<Resource *>(hResource.pDrvPrivate);
164bf215546Sopenharmony_ci}
165bf215546Sopenharmony_ci
166bf215546Sopenharmony_ci
167bf215546Sopenharmony_cistatic inline Resource *
168bf215546Sopenharmony_ciCastResource(DXGI_DDI_HRESOURCE hResource)
169bf215546Sopenharmony_ci{
170bf215546Sopenharmony_ci   return reinterpret_cast<Resource *>(hResource);
171bf215546Sopenharmony_ci}
172bf215546Sopenharmony_ci
173bf215546Sopenharmony_ci
174bf215546Sopenharmony_cistatic inline struct pipe_resource *
175bf215546Sopenharmony_ciCastPipeResource(D3D10DDI_HRESOURCE hResource)
176bf215546Sopenharmony_ci{
177bf215546Sopenharmony_ci   Resource *pResource = CastResource(hResource);
178bf215546Sopenharmony_ci   return pResource ? pResource->resource : NULL;
179bf215546Sopenharmony_ci}
180bf215546Sopenharmony_ci
181bf215546Sopenharmony_ci
182bf215546Sopenharmony_cistatic inline struct pipe_resource *
183bf215546Sopenharmony_ciCastPipeResource(DXGI_DDI_HRESOURCE hResource)
184bf215546Sopenharmony_ci{
185bf215546Sopenharmony_ci   Resource *pResource = CastResource(hResource);
186bf215546Sopenharmony_ci   return pResource ? pResource->resource : NULL;
187bf215546Sopenharmony_ci}
188bf215546Sopenharmony_ci
189bf215546Sopenharmony_ci
190bf215546Sopenharmony_cistatic inline struct pipe_resource *
191bf215546Sopenharmony_ciCastPipeBuffer(D3D10DDI_HRESOURCE hResource)
192bf215546Sopenharmony_ci{
193bf215546Sopenharmony_ci   Resource *pResource = CastResource(hResource);
194bf215546Sopenharmony_ci   if (!pResource) {
195bf215546Sopenharmony_ci      return NULL;
196bf215546Sopenharmony_ci   }
197bf215546Sopenharmony_ci   return static_cast<struct pipe_resource *>(pResource->resource);
198bf215546Sopenharmony_ci}
199bf215546Sopenharmony_ci
200bf215546Sopenharmony_ci
201bf215546Sopenharmony_cistruct RenderTargetView
202bf215546Sopenharmony_ci{
203bf215546Sopenharmony_ci   struct pipe_surface *surface;
204bf215546Sopenharmony_ci   D3D10DDI_HRTRENDERTARGETVIEW hRTRenderTargetView;
205bf215546Sopenharmony_ci};
206bf215546Sopenharmony_ci
207bf215546Sopenharmony_ci
208bf215546Sopenharmony_cistatic inline RenderTargetView *
209bf215546Sopenharmony_ciCastRenderTargetView(D3D10DDI_HRENDERTARGETVIEW hRenderTargetView)
210bf215546Sopenharmony_ci{
211bf215546Sopenharmony_ci   return static_cast<RenderTargetView *>(hRenderTargetView.pDrvPrivate);
212bf215546Sopenharmony_ci}
213bf215546Sopenharmony_ci
214bf215546Sopenharmony_ci
215bf215546Sopenharmony_cistatic inline struct pipe_surface *
216bf215546Sopenharmony_ciCastPipeRenderTargetView(D3D10DDI_HRENDERTARGETVIEW hRenderTargetView)
217bf215546Sopenharmony_ci{
218bf215546Sopenharmony_ci   RenderTargetView *pRenderTargetView = CastRenderTargetView(hRenderTargetView);
219bf215546Sopenharmony_ci   return pRenderTargetView ? pRenderTargetView->surface : NULL;
220bf215546Sopenharmony_ci}
221bf215546Sopenharmony_ci
222bf215546Sopenharmony_ci
223bf215546Sopenharmony_cistruct DepthStencilView
224bf215546Sopenharmony_ci{
225bf215546Sopenharmony_ci   struct pipe_surface *surface;
226bf215546Sopenharmony_ci   D3D10DDI_HRTDEPTHSTENCILVIEW hRTDepthStencilView;
227bf215546Sopenharmony_ci};
228bf215546Sopenharmony_ci
229bf215546Sopenharmony_ci
230bf215546Sopenharmony_cistatic inline DepthStencilView *
231bf215546Sopenharmony_ciCastDepthStencilView(D3D10DDI_HDEPTHSTENCILVIEW hDepthStencilView)
232bf215546Sopenharmony_ci{
233bf215546Sopenharmony_ci   return static_cast<DepthStencilView *>(hDepthStencilView.pDrvPrivate);
234bf215546Sopenharmony_ci}
235bf215546Sopenharmony_ci
236bf215546Sopenharmony_ci
237bf215546Sopenharmony_cistatic inline struct pipe_surface *
238bf215546Sopenharmony_ciCastPipeDepthStencilView(D3D10DDI_HDEPTHSTENCILVIEW hDepthStencilView)
239bf215546Sopenharmony_ci{
240bf215546Sopenharmony_ci   DepthStencilView *pDepthStencilView = CastDepthStencilView(hDepthStencilView);
241bf215546Sopenharmony_ci   return pDepthStencilView ? pDepthStencilView->surface : NULL;
242bf215546Sopenharmony_ci}
243bf215546Sopenharmony_ci
244bf215546Sopenharmony_ci
245bf215546Sopenharmony_cistruct BlendState
246bf215546Sopenharmony_ci{
247bf215546Sopenharmony_ci   void *handle;
248bf215546Sopenharmony_ci};
249bf215546Sopenharmony_ci
250bf215546Sopenharmony_ci
251bf215546Sopenharmony_cistatic inline BlendState *
252bf215546Sopenharmony_ciCastBlendState(D3D10DDI_HBLENDSTATE hBlendState)
253bf215546Sopenharmony_ci{
254bf215546Sopenharmony_ci   return static_cast<BlendState *>(hBlendState.pDrvPrivate);
255bf215546Sopenharmony_ci}
256bf215546Sopenharmony_ci
257bf215546Sopenharmony_ci
258bf215546Sopenharmony_cistatic inline void *
259bf215546Sopenharmony_ciCastPipeBlendState(D3D10DDI_HBLENDSTATE hBlendState)
260bf215546Sopenharmony_ci{
261bf215546Sopenharmony_ci   BlendState *pBlendState = CastBlendState(hBlendState);
262bf215546Sopenharmony_ci   return pBlendState ? pBlendState->handle : NULL;
263bf215546Sopenharmony_ci}
264bf215546Sopenharmony_ci
265bf215546Sopenharmony_ci
266bf215546Sopenharmony_cistruct DepthStencilState
267bf215546Sopenharmony_ci{
268bf215546Sopenharmony_ci   void *handle;
269bf215546Sopenharmony_ci};
270bf215546Sopenharmony_ci
271bf215546Sopenharmony_ci
272bf215546Sopenharmony_cistatic inline DepthStencilState *
273bf215546Sopenharmony_ciCastDepthStencilState(D3D10DDI_HDEPTHSTENCILSTATE hDepthStencilState)
274bf215546Sopenharmony_ci{
275bf215546Sopenharmony_ci   return static_cast<DepthStencilState *>(hDepthStencilState.pDrvPrivate);
276bf215546Sopenharmony_ci}
277bf215546Sopenharmony_ci
278bf215546Sopenharmony_ci
279bf215546Sopenharmony_cistatic inline void *
280bf215546Sopenharmony_ciCastPipeDepthStencilState(D3D10DDI_HDEPTHSTENCILSTATE hDepthStencilState)
281bf215546Sopenharmony_ci{
282bf215546Sopenharmony_ci   DepthStencilState *pDepthStencilState = CastDepthStencilState(hDepthStencilState);
283bf215546Sopenharmony_ci   return pDepthStencilState ? pDepthStencilState->handle : NULL;
284bf215546Sopenharmony_ci}
285bf215546Sopenharmony_ci
286bf215546Sopenharmony_ci
287bf215546Sopenharmony_cistruct RasterizerState
288bf215546Sopenharmony_ci{
289bf215546Sopenharmony_ci   void *handle;
290bf215546Sopenharmony_ci};
291bf215546Sopenharmony_ci
292bf215546Sopenharmony_ci
293bf215546Sopenharmony_cistatic inline RasterizerState *
294bf215546Sopenharmony_ciCastRasterizerState(D3D10DDI_HRASTERIZERSTATE hRasterizerState)
295bf215546Sopenharmony_ci{
296bf215546Sopenharmony_ci   return static_cast<RasterizerState *>(hRasterizerState.pDrvPrivate);
297bf215546Sopenharmony_ci}
298bf215546Sopenharmony_ci
299bf215546Sopenharmony_ci
300bf215546Sopenharmony_cistatic inline void *
301bf215546Sopenharmony_ciCastPipeRasterizerState(D3D10DDI_HRASTERIZERSTATE hRasterizerState)
302bf215546Sopenharmony_ci{
303bf215546Sopenharmony_ci   RasterizerState *pRasterizerState = CastRasterizerState(hRasterizerState);
304bf215546Sopenharmony_ci   return pRasterizerState ? pRasterizerState->handle : NULL;
305bf215546Sopenharmony_ci}
306bf215546Sopenharmony_ci
307bf215546Sopenharmony_ci
308bf215546Sopenharmony_cistatic inline Shader *
309bf215546Sopenharmony_ciCastShader(D3D10DDI_HSHADER hShader)
310bf215546Sopenharmony_ci{
311bf215546Sopenharmony_ci   return static_cast<Shader *>(hShader.pDrvPrivate);
312bf215546Sopenharmony_ci}
313bf215546Sopenharmony_ci
314bf215546Sopenharmony_ci
315bf215546Sopenharmony_cistatic inline void *
316bf215546Sopenharmony_ciCastPipeShader(D3D10DDI_HSHADER hShader)
317bf215546Sopenharmony_ci{
318bf215546Sopenharmony_ci   Shader *pShader = static_cast<Shader *>(hShader.pDrvPrivate);
319bf215546Sopenharmony_ci   return pShader ? pShader->handle : NULL;
320bf215546Sopenharmony_ci}
321bf215546Sopenharmony_ci
322bf215546Sopenharmony_ci
323bf215546Sopenharmony_cistruct ElementLayout
324bf215546Sopenharmony_ci{
325bf215546Sopenharmony_ci   void *handle;
326bf215546Sopenharmony_ci};
327bf215546Sopenharmony_ci
328bf215546Sopenharmony_ci
329bf215546Sopenharmony_cistatic inline ElementLayout *
330bf215546Sopenharmony_ciCastElementLayout(D3D10DDI_HELEMENTLAYOUT hElementLayout)
331bf215546Sopenharmony_ci{
332bf215546Sopenharmony_ci   return static_cast<ElementLayout *>(hElementLayout.pDrvPrivate);
333bf215546Sopenharmony_ci}
334bf215546Sopenharmony_ci
335bf215546Sopenharmony_cistatic inline void *
336bf215546Sopenharmony_ciCastPipeInputLayout(D3D10DDI_HELEMENTLAYOUT hElementLayout)
337bf215546Sopenharmony_ci{
338bf215546Sopenharmony_ci   ElementLayout *pElementLayout = CastElementLayout(hElementLayout);
339bf215546Sopenharmony_ci   return pElementLayout ? pElementLayout->handle : NULL;
340bf215546Sopenharmony_ci}
341bf215546Sopenharmony_ci
342bf215546Sopenharmony_ci
343bf215546Sopenharmony_cistruct SamplerState
344bf215546Sopenharmony_ci{
345bf215546Sopenharmony_ci   void *handle;
346bf215546Sopenharmony_ci};
347bf215546Sopenharmony_ci
348bf215546Sopenharmony_ci
349bf215546Sopenharmony_cistatic inline SamplerState *
350bf215546Sopenharmony_ciCastSamplerState(D3D10DDI_HSAMPLER hSampler)
351bf215546Sopenharmony_ci{
352bf215546Sopenharmony_ci   return static_cast<SamplerState *>(hSampler.pDrvPrivate);
353bf215546Sopenharmony_ci}
354bf215546Sopenharmony_ci
355bf215546Sopenharmony_ci
356bf215546Sopenharmony_cistatic inline void *
357bf215546Sopenharmony_ciCastPipeSamplerState(D3D10DDI_HSAMPLER hSampler)
358bf215546Sopenharmony_ci{
359bf215546Sopenharmony_ci   SamplerState *pSamplerState = CastSamplerState(hSampler);
360bf215546Sopenharmony_ci   return pSamplerState ? pSamplerState->handle : NULL;
361bf215546Sopenharmony_ci}
362bf215546Sopenharmony_ci
363bf215546Sopenharmony_ci
364bf215546Sopenharmony_cistruct ShaderResourceView
365bf215546Sopenharmony_ci{
366bf215546Sopenharmony_ci   struct pipe_sampler_view *handle;
367bf215546Sopenharmony_ci};
368bf215546Sopenharmony_ci
369bf215546Sopenharmony_ci
370bf215546Sopenharmony_cistatic inline ShaderResourceView *
371bf215546Sopenharmony_ciCastShaderResourceView(D3D10DDI_HSHADERRESOURCEVIEW hShaderResourceView)
372bf215546Sopenharmony_ci{
373bf215546Sopenharmony_ci   return static_cast<ShaderResourceView *>(hShaderResourceView.pDrvPrivate);
374bf215546Sopenharmony_ci}
375bf215546Sopenharmony_ci
376bf215546Sopenharmony_ci
377bf215546Sopenharmony_cistatic inline struct pipe_sampler_view *
378bf215546Sopenharmony_ciCastPipeShaderResourceView(D3D10DDI_HSHADERRESOURCEVIEW hShaderResourceView)
379bf215546Sopenharmony_ci{
380bf215546Sopenharmony_ci   ShaderResourceView *pSRView = CastShaderResourceView(hShaderResourceView);
381bf215546Sopenharmony_ci   return pSRView ? pSRView->handle : NULL;
382bf215546Sopenharmony_ci}
383bf215546Sopenharmony_ci
384bf215546Sopenharmony_ci
385bf215546Sopenharmony_cistruct Query
386bf215546Sopenharmony_ci{
387bf215546Sopenharmony_ci   D3D10DDI_QUERY Type;
388bf215546Sopenharmony_ci   UINT Flags;
389bf215546Sopenharmony_ci
390bf215546Sopenharmony_ci   unsigned pipe_type;
391bf215546Sopenharmony_ci   struct pipe_query *handle;
392bf215546Sopenharmony_ci   INT SeqNo;
393bf215546Sopenharmony_ci   UINT GetDataCount;
394bf215546Sopenharmony_ci
395bf215546Sopenharmony_ci   D3D10_DDI_QUERY_DATA_PIPELINE_STATISTICS Statistics;
396bf215546Sopenharmony_ci};
397bf215546Sopenharmony_ci
398bf215546Sopenharmony_ci
399bf215546Sopenharmony_cistatic inline Query *
400bf215546Sopenharmony_ciCastQuery(D3D10DDI_HQUERY hQuery)
401bf215546Sopenharmony_ci{
402bf215546Sopenharmony_ci   return static_cast<Query *>(hQuery.pDrvPrivate);
403bf215546Sopenharmony_ci}
404bf215546Sopenharmony_ci
405bf215546Sopenharmony_ci
406bf215546Sopenharmony_cistatic inline struct pipe_query *
407bf215546Sopenharmony_ciCastPipeQuery(D3D10DDI_HQUERY hQuery)
408bf215546Sopenharmony_ci{
409bf215546Sopenharmony_ci   Query *pQuery = CastQuery(hQuery);
410bf215546Sopenharmony_ci   return pQuery ? pQuery->handle : NULL;
411bf215546Sopenharmony_ci}
412bf215546Sopenharmony_ci
413