• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2011 Joakim Sindholt <opensource@zhasha.com>
3  *
4  * Permission is hereby granted, free of charge, to any person obtaining a
5  * copy of this software and associated documentation files (the "Software"),
6  * to deal in the Software without restriction, including without limitation
7  * on the rights to use, copy, modify, merge, publish, distribute, sub
8  * license, and/or sell copies of the Software, and to permit persons to whom
9  * the Software is furnished to do so, subject to the following conditions:
10  *
11  * The above copyright notice and this permission notice (including the next
12  * paragraph) shall be included in all copies or substantial portions of the
13  * Software.
14  *
15  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17  * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
18  * THE AUTHOR(S) AND/OR THEIR SUPPLIERS BE LIABLE FOR ANY CLAIM,
19  * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
20  * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
21  * USE OR OTHER DEALINGS IN THE SOFTWARE. */
22 
23 #ifndef _NINE_DEVICE9_H_
24 #define _NINE_DEVICE9_H_
25 
26 #include "d3dadapter/d3dadapter9.h"
27 
28 #include "iunknown.h"
29 #include "adapter9.h"
30 
31 #include "nine_helpers.h"
32 #include "nine_memory_helper.h"
33 #include "nine_state.h"
34 
35 struct gen_mipmap_state;
36 struct hash_table;
37 struct pipe_screen;
38 struct pipe_context;
39 struct cso_context;
40 struct hud_context;
41 struct u_upload_mgr;
42 struct csmt_context;
43 
44 struct NineSwapChain9;
45 struct NineStateBlock9;
46 
47 #include "util/list.h"
48 
49 struct NineDevice9
50 {
51     struct NineUnknown base;
52     bool ex;
53     bool may_swvp;
54 
55     /* G3D context */
56     struct pipe_screen *screen;
57     /* For first time upload. No Sync with rendering thread */
58     struct pipe_context *pipe_secondary;
59     struct pipe_screen *screen_sw;
60     struct pipe_context *pipe_sw;
61     struct cso_context *cso_sw;
62 
63     /* CSMT context */
64     struct csmt_context *csmt_ctx;
65     BOOL csmt_active;
66 
67     /* For DISCARD/NOOVERWRITE */
68     struct nine_buffer_upload *buffer_upload;
69 
70     /* creation parameters */
71     D3DCAPS9 caps;
72     D3DDEVICE_CREATION_PARAMETERS params;
73     IDirect3D9 *d3d9;
74 
75     /* swapchain stuff */
76     ID3DPresentGroup *present;
77     struct NineSwapChain9 **swapchains;
78     unsigned nswapchains;
79 
80     struct NineStateBlock9 *record;
81     struct nine_state *update; /* state to update (&state / &record->state) */
82     struct nine_state state;   /* device state */
83     struct nine_context context;
84     struct nine_state_sw_internal state_sw_internal;
85 
86     struct list_head update_buffers;
87     struct list_head update_textures;
88     struct list_head managed_buffers;
89     struct list_head managed_textures;
90 
91     bool is_recording;
92     bool in_scene;
93     unsigned end_scene_since_present;
94 
95     uint16_t vs_const_size;
96     uint16_t ps_const_size;
97     uint16_t max_vs_const_f;
98 
99     struct pipe_resource *dummy_texture;
100     struct pipe_sampler_view *dummy_sampler_view;
101     struct pipe_sampler_state dummy_sampler_state;
102 
103     struct gen_mipmap_state *gen_mipmap;
104 
105     struct {
106         struct hash_table *ht_vs;
107         struct hash_table *ht_ps;
108         struct NineVertexShader9 *vs;
109         struct NinePixelShader9 *ps;
110         unsigned num_vs;
111         unsigned num_ps;
112         float *vs_const;
113         float *ps_const;
114 
115         struct hash_table *ht_fvf;
116     } ff;
117 
118     struct {
119         struct pipe_resource *image;
120         unsigned w;
121         unsigned h;
122         POINT hotspot; /* -1, -1 if no cursor image set */
123         POINT pos;
124         BOOL visible;
125         bool software;
126         void *hw_upload_temp;
127     } cursor;
128 
129     struct {
130         bool user_sw_vbufs;
131         bool window_space_position_support;
132         bool disabling_depth_clipping_support;
133         bool vs_integer;
134         bool ps_integer;
135         bool offset_units_unscaled;
136         bool alpha_test_emulation;
137         bool always_output_pointsize;
138         bool emulate_ucp;
139         bool shader_emulate_features;
140     } driver_caps;
141 
142     struct {
143         bool buggy_barycentrics;
144     } driver_bugs;
145 
146     struct {
147         bool dynamic_texture_workaround;
148     } workarounds;
149 
150     struct u_upload_mgr *vertex_uploader;
151 
152     struct nine_range_pool range_pool;
153 
154     struct hud_context *hud; /* NULL if hud is disabled */
155 
156     struct nine_allocator *allocator;
157 
158     /* dummy vbo (containing 0 0 0 0) to bind if vertex shader input
159      * is not bound to anything by the vertex declaration */
160     struct pipe_resource *dummy_vbo;
161     struct pipe_resource *dummy_vbo_sw;
162     BOOL device_needs_reset;
163     int minor_version_num;
164     long long available_texture_mem;
165     long long available_texture_limit;
166 
167     /* software vertex processing */
168     bool swvp;
169     /* pure device */
170     bool pure;
171 
172     unsigned frame_count; /* It's ok if we overflow */
173 
174     /* Ex */
175     int gpu_priority;
176     unsigned max_frame_latency;
177 };
178 static inline struct NineDevice9 *
NineDevice9(void * data)179 NineDevice9( void *data )
180 {
181     return (struct NineDevice9 *)data;
182 }
183 
184 HRESULT
185 NineDevice9_new( struct pipe_screen *pScreen,
186                  D3DDEVICE_CREATION_PARAMETERS *pCreationParameters,
187                  D3DCAPS9 *pCaps,
188                  D3DPRESENT_PARAMETERS *pPresentationParameters,
189                  IDirect3D9 *pD3D9,
190                  ID3DPresentGroup *pPresentationGroup,
191                  struct d3dadapter9_context *pCTX,
192                  bool ex,
193                  D3DDISPLAYMODEEX *pFullscreenDisplayMode,
194                  struct NineDevice9 **ppOut,
195                  int minorVersionNum );
196 
197 HRESULT
198 NineDevice9_ctor( struct NineDevice9 *This,
199                   struct NineUnknownParams *pParams,
200                   struct pipe_screen *pScreen,
201                   D3DDEVICE_CREATION_PARAMETERS *pCreationParameters,
202                   D3DCAPS9 *pCaps,
203                   D3DPRESENT_PARAMETERS *pPresentationParameters,
204                   IDirect3D9 *pD3D9,
205                   ID3DPresentGroup *pPresentationGroup,
206                   struct d3dadapter9_context *pCTX,
207                   bool ex,
208                   D3DDISPLAYMODEEX *pFullscreenDisplayMode,
209                   int minorVersionNum );
210 
211 void
212 NineDevice9_dtor( struct NineDevice9 *This );
213 
214 /*** Nine private ***/
215 struct pipe_resource *
216 nine_resource_create_with_retry( struct NineDevice9 *This,
217                                  struct pipe_screen *screen,
218                                  const struct pipe_resource *templat );
219 
220 void
221 NineDevice9_SetDefaultState( struct NineDevice9 *This, bool is_reset );
222 
223 struct pipe_screen *
224 NineDevice9_GetScreen( struct NineDevice9 *This );
225 
226 struct pipe_context *
227 NineDevice9_GetPipe( struct NineDevice9 *This );
228 
229 const D3DCAPS9 *
230 NineDevice9_GetCaps( struct NineDevice9 *This );
231 
232 void
233 NineDevice9_EvictManagedResourcesInternal( struct NineDevice9 *This );
234 
235 /*** Direct3D public ***/
236 
237 HRESULT NINE_WINAPI
238 NineDevice9_TestCooperativeLevel( struct NineDevice9 *This );
239 
240 UINT NINE_WINAPI
241 NineDevice9_GetAvailableTextureMem( struct NineDevice9 *This );
242 
243 HRESULT NINE_WINAPI
244 NineDevice9_EvictManagedResources( struct NineDevice9 *This );
245 
246 HRESULT NINE_WINAPI
247 NineDevice9_GetDirect3D( struct NineDevice9 *This,
248                          IDirect3D9 **ppD3D9 );
249 
250 HRESULT NINE_WINAPI
251 NineDevice9_GetDeviceCaps( struct NineDevice9 *This,
252                            D3DCAPS9 *pCaps );
253 
254 HRESULT NINE_WINAPI
255 NineDevice9_GetDisplayMode( struct NineDevice9 *This,
256                             UINT iSwapChain,
257                             D3DDISPLAYMODE *pMode );
258 
259 HRESULT NINE_WINAPI
260 NineDevice9_GetCreationParameters( struct NineDevice9 *This,
261                                    D3DDEVICE_CREATION_PARAMETERS *pParameters );
262 
263 HRESULT NINE_WINAPI
264 NineDevice9_SetCursorProperties( struct NineDevice9 *This,
265                                  UINT XHotSpot,
266                                  UINT YHotSpot,
267                                  IDirect3DSurface9 *pCursorBitmap );
268 
269 void NINE_WINAPI
270 NineDevice9_SetCursorPosition( struct NineDevice9 *This,
271                                int X,
272                                int Y,
273                                DWORD Flags );
274 
275 BOOL NINE_WINAPI
276 NineDevice9_ShowCursor( struct NineDevice9 *This,
277                         BOOL bShow );
278 
279 HRESULT NINE_WINAPI
280 NineDevice9_CreateAdditionalSwapChain( struct NineDevice9 *This,
281                                        D3DPRESENT_PARAMETERS *pPresentationParameters,
282                                        IDirect3DSwapChain9 **pSwapChain );
283 
284 HRESULT NINE_WINAPI
285 NineDevice9_GetSwapChain( struct NineDevice9 *This,
286                           UINT iSwapChain,
287                           IDirect3DSwapChain9 **pSwapChain );
288 
289 UINT NINE_WINAPI
290 NineDevice9_GetNumberOfSwapChains( struct NineDevice9 *This );
291 
292 HRESULT NINE_WINAPI
293 NineDevice9_Reset( struct NineDevice9 *This,
294                    D3DPRESENT_PARAMETERS *pPresentationParameters );
295 
296 HRESULT NINE_WINAPI
297 NineDevice9_Present( struct NineDevice9 *This,
298                      const RECT *pSourceRect,
299                      const RECT *pDestRect,
300                      HWND hDestWindowOverride,
301                      const RGNDATA *pDirtyRegion );
302 
303 HRESULT NINE_WINAPI
304 NineDevice9_GetBackBuffer( struct NineDevice9 *This,
305                            UINT iSwapChain,
306                            UINT iBackBuffer,
307                            D3DBACKBUFFER_TYPE Type,
308                            IDirect3DSurface9 **ppBackBuffer );
309 
310 HRESULT NINE_WINAPI
311 NineDevice9_GetRasterStatus( struct NineDevice9 *This,
312                              UINT iSwapChain,
313                              D3DRASTER_STATUS *pRasterStatus );
314 
315 HRESULT NINE_WINAPI
316 NineDevice9_SetDialogBoxMode( struct NineDevice9 *This,
317                               BOOL bEnableDialogs );
318 
319 void NINE_WINAPI
320 NineDevice9_SetGammaRamp( struct NineDevice9 *This,
321                           UINT iSwapChain,
322                           DWORD Flags,
323                           const D3DGAMMARAMP *pRamp );
324 
325 void NINE_WINAPI
326 NineDevice9_GetGammaRamp( struct NineDevice9 *This,
327                           UINT iSwapChain,
328                           D3DGAMMARAMP *pRamp );
329 
330 HRESULT NINE_WINAPI
331 NineDevice9_CreateTexture( struct NineDevice9 *This,
332                            UINT Width,
333                            UINT Height,
334                            UINT Levels,
335                            DWORD Usage,
336                            D3DFORMAT Format,
337                            D3DPOOL Pool,
338                            IDirect3DTexture9 **ppTexture,
339                            HANDLE *pSharedHandle );
340 
341 HRESULT NINE_WINAPI
342 NineDevice9_CreateVolumeTexture( struct NineDevice9 *This,
343                                  UINT Width,
344                                  UINT Height,
345                                  UINT Depth,
346                                  UINT Levels,
347                                  DWORD Usage,
348                                  D3DFORMAT Format,
349                                  D3DPOOL Pool,
350                                  IDirect3DVolumeTexture9 **ppVolumeTexture,
351                                  HANDLE *pSharedHandle );
352 
353 HRESULT NINE_WINAPI
354 NineDevice9_CreateCubeTexture( struct NineDevice9 *This,
355                                UINT EdgeLength,
356                                UINT Levels,
357                                DWORD Usage,
358                                D3DFORMAT Format,
359                                D3DPOOL Pool,
360                                IDirect3DCubeTexture9 **ppCubeTexture,
361                                HANDLE *pSharedHandle );
362 
363 HRESULT NINE_WINAPI
364 NineDevice9_CreateVertexBuffer( struct NineDevice9 *This,
365                                 UINT Length,
366                                 DWORD Usage,
367                                 DWORD FVF,
368                                 D3DPOOL Pool,
369                                 IDirect3DVertexBuffer9 **ppVertexBuffer,
370                                 HANDLE *pSharedHandle );
371 
372 HRESULT NINE_WINAPI
373 NineDevice9_CreateIndexBuffer( struct NineDevice9 *This,
374                                UINT Length,
375                                DWORD Usage,
376                                D3DFORMAT Format,
377                                D3DPOOL Pool,
378                                IDirect3DIndexBuffer9 **ppIndexBuffer,
379                                HANDLE *pSharedHandle );
380 
381 HRESULT NINE_WINAPI
382 NineDevice9_CreateRenderTarget( struct NineDevice9 *This,
383                                 UINT Width,
384                                 UINT Height,
385                                 D3DFORMAT Format,
386                                 D3DMULTISAMPLE_TYPE MultiSample,
387                                 DWORD MultisampleQuality,
388                                 BOOL Lockable,
389                                 IDirect3DSurface9 **ppSurface,
390                                 HANDLE *pSharedHandle );
391 
392 HRESULT NINE_WINAPI
393 NineDevice9_CreateDepthStencilSurface( struct NineDevice9 *This,
394                                        UINT Width,
395                                        UINT Height,
396                                        D3DFORMAT Format,
397                                        D3DMULTISAMPLE_TYPE MultiSample,
398                                        DWORD MultisampleQuality,
399                                        BOOL Discard,
400                                        IDirect3DSurface9 **ppSurface,
401                                        HANDLE *pSharedHandle );
402 
403 HRESULT NINE_WINAPI
404 NineDevice9_UpdateSurface( struct NineDevice9 *This,
405                            IDirect3DSurface9 *pSourceSurface,
406                            const RECT *pSourceRect,
407                            IDirect3DSurface9 *pDestinationSurface,
408                            const POINT *pDestPoint );
409 
410 HRESULT NINE_WINAPI
411 NineDevice9_UpdateTexture( struct NineDevice9 *This,
412                            IDirect3DBaseTexture9 *pSourceTexture,
413                            IDirect3DBaseTexture9 *pDestinationTexture );
414 
415 HRESULT NINE_WINAPI
416 NineDevice9_GetRenderTargetData( struct NineDevice9 *This,
417                                  IDirect3DSurface9 *pRenderTarget,
418                                  IDirect3DSurface9 *pDestSurface );
419 
420 HRESULT NINE_WINAPI
421 NineDevice9_GetFrontBufferData( struct NineDevice9 *This,
422                                 UINT iSwapChain,
423                                 IDirect3DSurface9 *pDestSurface );
424 
425 HRESULT NINE_WINAPI
426 NineDevice9_StretchRect( struct NineDevice9 *This,
427                          IDirect3DSurface9 *pSourceSurface,
428                          const RECT *pSourceRect,
429                          IDirect3DSurface9 *pDestSurface,
430                          const RECT *pDestRect,
431                          D3DTEXTUREFILTERTYPE Filter );
432 
433 HRESULT NINE_WINAPI
434 NineDevice9_ColorFill( struct NineDevice9 *This,
435                        IDirect3DSurface9 *pSurface,
436                        const RECT *pRect,
437                        D3DCOLOR color );
438 
439 HRESULT NINE_WINAPI
440 NineDevice9_CreateOffscreenPlainSurface( struct NineDevice9 *This,
441                                          UINT Width,
442                                          UINT Height,
443                                          D3DFORMAT Format,
444                                          D3DPOOL Pool,
445                                          IDirect3DSurface9 **ppSurface,
446                                          HANDLE *pSharedHandle );
447 
448 HRESULT NINE_WINAPI
449 NineDevice9_SetRenderTarget( struct NineDevice9 *This,
450                              DWORD RenderTargetIndex,
451                              IDirect3DSurface9 *pRenderTarget );
452 
453 HRESULT NINE_WINAPI
454 NineDevice9_GetRenderTarget( struct NineDevice9 *This,
455                              DWORD RenderTargetIndex,
456                              IDirect3DSurface9 **ppRenderTarget );
457 
458 HRESULT NINE_WINAPI
459 NineDevice9_SetDepthStencilSurface( struct NineDevice9 *This,
460                                     IDirect3DSurface9 *pNewZStencil );
461 
462 HRESULT NINE_WINAPI
463 NineDevice9_GetDepthStencilSurface( struct NineDevice9 *This,
464                                     IDirect3DSurface9 **ppZStencilSurface );
465 
466 HRESULT NINE_WINAPI
467 NineDevice9_BeginScene( struct NineDevice9 *This );
468 
469 HRESULT NINE_WINAPI
470 NineDevice9_EndScene( struct NineDevice9 *This );
471 
472 HRESULT NINE_WINAPI
473 NineDevice9_Clear( struct NineDevice9 *This,
474                    DWORD Count,
475                    const D3DRECT *pRects,
476                    DWORD Flags,
477                    D3DCOLOR Color,
478                    float Z,
479                    DWORD Stencil );
480 
481 HRESULT NINE_WINAPI
482 NineDevice9_SetTransform( struct NineDevice9 *This,
483                           D3DTRANSFORMSTATETYPE State,
484                           const D3DMATRIX *pMatrix );
485 
486 HRESULT NINE_WINAPI
487 NineDevice9_GetTransform( struct NineDevice9 *This,
488                           D3DTRANSFORMSTATETYPE State,
489                           D3DMATRIX *pMatrix );
490 
491 HRESULT NINE_WINAPI
492 NineDevice9_MultiplyTransform( struct NineDevice9 *This,
493                                D3DTRANSFORMSTATETYPE State,
494                                const D3DMATRIX *pMatrix );
495 
496 HRESULT NINE_WINAPI
497 NineDevice9_SetViewport( struct NineDevice9 *This,
498                          const D3DVIEWPORT9 *pViewport );
499 
500 HRESULT NINE_WINAPI
501 NineDevice9_GetViewport( struct NineDevice9 *This,
502                          D3DVIEWPORT9 *pViewport );
503 
504 HRESULT NINE_WINAPI
505 NineDevice9_SetMaterial( struct NineDevice9 *This,
506                          const D3DMATERIAL9 *pMaterial );
507 
508 HRESULT NINE_WINAPI
509 NineDevice9_GetMaterial( struct NineDevice9 *This,
510                          D3DMATERIAL9 *pMaterial );
511 
512 HRESULT NINE_WINAPI
513 NineDevice9_SetLight( struct NineDevice9 *This,
514                       DWORD Index,
515                       const D3DLIGHT9 *pLight );
516 
517 HRESULT NINE_WINAPI
518 NineDevice9_GetLight( struct NineDevice9 *This,
519                       DWORD Index,
520                       D3DLIGHT9 *pLight );
521 
522 HRESULT NINE_WINAPI
523 NineDevice9_LightEnable( struct NineDevice9 *This,
524                          DWORD Index,
525                          BOOL Enable );
526 
527 HRESULT NINE_WINAPI
528 NineDevice9_GetLightEnable( struct NineDevice9 *This,
529                             DWORD Index,
530                             BOOL *pEnable );
531 
532 HRESULT NINE_WINAPI
533 NineDevice9_SetClipPlane( struct NineDevice9 *This,
534                           DWORD Index,
535                           const float *pPlane );
536 
537 HRESULT NINE_WINAPI
538 NineDevice9_GetClipPlane( struct NineDevice9 *This,
539                           DWORD Index,
540                           float *pPlane );
541 
542 HRESULT NINE_WINAPI
543 NineDevice9_SetRenderState( struct NineDevice9 *This,
544                             D3DRENDERSTATETYPE State,
545                             DWORD Value );
546 
547 HRESULT NINE_WINAPI
548 NineDevice9_GetRenderState( struct NineDevice9 *This,
549                             D3DRENDERSTATETYPE State,
550                             DWORD *pValue );
551 
552 HRESULT NINE_WINAPI
553 NineDevice9_CreateStateBlock( struct NineDevice9 *This,
554                               D3DSTATEBLOCKTYPE Type,
555                               IDirect3DStateBlock9 **ppSB );
556 
557 HRESULT NINE_WINAPI
558 NineDevice9_BeginStateBlock( struct NineDevice9 *This );
559 
560 HRESULT NINE_WINAPI
561 NineDevice9_EndStateBlock( struct NineDevice9 *This,
562                            IDirect3DStateBlock9 **ppSB );
563 
564 HRESULT NINE_WINAPI
565 NineDevice9_SetClipStatus( struct NineDevice9 *This,
566                            const D3DCLIPSTATUS9 *pClipStatus );
567 
568 HRESULT NINE_WINAPI
569 NineDevice9_GetClipStatus( struct NineDevice9 *This,
570                            D3DCLIPSTATUS9 *pClipStatus );
571 
572 HRESULT NINE_WINAPI
573 NineDevice9_GetTexture( struct NineDevice9 *This,
574                         DWORD Stage,
575                         IDirect3DBaseTexture9 **ppTexture );
576 
577 HRESULT NINE_WINAPI
578 NineDevice9_SetTexture( struct NineDevice9 *This,
579                         DWORD Stage,
580                         IDirect3DBaseTexture9 *pTexture );
581 
582 HRESULT NINE_WINAPI
583 NineDevice9_GetTextureStageState( struct NineDevice9 *This,
584                                   DWORD Stage,
585                                   D3DTEXTURESTAGESTATETYPE Type,
586                                   DWORD *pValue );
587 
588 HRESULT NINE_WINAPI
589 NineDevice9_SetTextureStageState( struct NineDevice9 *This,
590                                   DWORD Stage,
591                                   D3DTEXTURESTAGESTATETYPE Type,
592                                   DWORD Value );
593 
594 HRESULT NINE_WINAPI
595 NineDevice9_GetSamplerState( struct NineDevice9 *This,
596                              DWORD Sampler,
597                              D3DSAMPLERSTATETYPE Type,
598                              DWORD *pValue );
599 
600 HRESULT NINE_WINAPI
601 NineDevice9_SetSamplerState( struct NineDevice9 *This,
602                              DWORD Sampler,
603                              D3DSAMPLERSTATETYPE Type,
604                              DWORD Value );
605 
606 HRESULT NINE_WINAPI
607 NineDevice9_ValidateDevice( struct NineDevice9 *This,
608                             DWORD *pNumPasses );
609 
610 HRESULT NINE_WINAPI
611 NineDevice9_SetPaletteEntries( struct NineDevice9 *This,
612                                UINT PaletteNumber,
613                                const PALETTEENTRY *pEntries );
614 
615 HRESULT NINE_WINAPI
616 NineDevice9_GetPaletteEntries( struct NineDevice9 *This,
617                                UINT PaletteNumber,
618                                PALETTEENTRY *pEntries );
619 
620 HRESULT NINE_WINAPI
621 NineDevice9_SetCurrentTexturePalette( struct NineDevice9 *This,
622                                       UINT PaletteNumber );
623 
624 HRESULT NINE_WINAPI
625 NineDevice9_GetCurrentTexturePalette( struct NineDevice9 *This,
626                                       UINT *PaletteNumber );
627 
628 HRESULT NINE_WINAPI
629 NineDevice9_SetScissorRect( struct NineDevice9 *This,
630                             const RECT *pRect );
631 
632 HRESULT NINE_WINAPI
633 NineDevice9_GetScissorRect( struct NineDevice9 *This,
634                             RECT *pRect );
635 
636 HRESULT NINE_WINAPI
637 NineDevice9_SetSoftwareVertexProcessing( struct NineDevice9 *This,
638                                          BOOL bSoftware );
639 
640 BOOL NINE_WINAPI
641 NineDevice9_GetSoftwareVertexProcessing( struct NineDevice9 *This );
642 
643 HRESULT NINE_WINAPI
644 NineDevice9_SetNPatchMode( struct NineDevice9 *This,
645                            float nSegments );
646 
647 float NINE_WINAPI
648 NineDevice9_GetNPatchMode( struct NineDevice9 *This );
649 
650 HRESULT NINE_WINAPI
651 NineDevice9_DrawPrimitive( struct NineDevice9 *This,
652                            D3DPRIMITIVETYPE PrimitiveType,
653                            UINT StartVertex,
654                            UINT PrimitiveCount );
655 
656 HRESULT NINE_WINAPI
657 NineDevice9_DrawIndexedPrimitive( struct NineDevice9 *This,
658                                   D3DPRIMITIVETYPE PrimitiveType,
659                                   INT BaseVertexIndex,
660                                   UINT MinVertexIndex,
661                                   UINT NumVertices,
662                                   UINT startIndex,
663                                   UINT primCount );
664 
665 HRESULT NINE_WINAPI
666 NineDevice9_DrawPrimitiveUP( struct NineDevice9 *This,
667                              D3DPRIMITIVETYPE PrimitiveType,
668                              UINT PrimitiveCount,
669                              const void *pVertexStreamZeroData,
670                              UINT VertexStreamZeroStride );
671 
672 HRESULT NINE_WINAPI
673 NineDevice9_DrawIndexedPrimitiveUP( struct NineDevice9 *This,
674                                     D3DPRIMITIVETYPE PrimitiveType,
675                                     UINT MinVertexIndex,
676                                     UINT NumVertices,
677                                     UINT PrimitiveCount,
678                                     const void *pIndexData,
679                                     D3DFORMAT IndexDataFormat,
680                                     const void *pVertexStreamZeroData,
681                                     UINT VertexStreamZeroStride );
682 
683 HRESULT NINE_WINAPI
684 NineDevice9_ProcessVertices( struct NineDevice9 *This,
685                              UINT SrcStartIndex,
686                              UINT DestIndex,
687                              UINT VertexCount,
688                              IDirect3DVertexBuffer9 *pDestBuffer,
689                              IDirect3DVertexDeclaration9 *pVertexDecl,
690                              DWORD Flags );
691 
692 HRESULT NINE_WINAPI
693 NineDevice9_CreateVertexDeclaration( struct NineDevice9 *This,
694                                      const D3DVERTEXELEMENT9 *pVertexElements,
695                                      IDirect3DVertexDeclaration9 **ppDecl );
696 
697 HRESULT NINE_WINAPI
698 NineDevice9_SetVertexDeclaration( struct NineDevice9 *This,
699                                   IDirect3DVertexDeclaration9 *pDecl );
700 
701 HRESULT NINE_WINAPI
702 NineDevice9_GetVertexDeclaration( struct NineDevice9 *This,
703                                   IDirect3DVertexDeclaration9 **ppDecl );
704 
705 HRESULT NINE_WINAPI
706 NineDevice9_SetFVF( struct NineDevice9 *This,
707                     DWORD FVF );
708 
709 HRESULT NINE_WINAPI
710 NineDevice9_GetFVF( struct NineDevice9 *This,
711                     DWORD *pFVF );
712 
713 HRESULT NINE_WINAPI
714 NineDevice9_CreateVertexShader( struct NineDevice9 *This,
715                                 const DWORD *pFunction,
716                                 IDirect3DVertexShader9 **ppShader );
717 
718 HRESULT NINE_WINAPI
719 NineDevice9_SetVertexShader( struct NineDevice9 *This,
720                              IDirect3DVertexShader9 *pShader );
721 
722 HRESULT NINE_WINAPI
723 NineDevice9_GetVertexShader( struct NineDevice9 *This,
724                              IDirect3DVertexShader9 **ppShader );
725 
726 HRESULT NINE_WINAPI
727 NineDevice9_SetVertexShaderConstantF( struct NineDevice9 *This,
728                                       UINT StartRegister,
729                                       const float *pConstantData,
730                                       UINT Vector4fCount );
731 
732 HRESULT NINE_WINAPI
733 NineDevice9_GetVertexShaderConstantF( struct NineDevice9 *This,
734                                       UINT StartRegister,
735                                       float *pConstantData,
736                                       UINT Vector4fCount );
737 
738 HRESULT NINE_WINAPI
739 NineDevice9_SetVertexShaderConstantI( struct NineDevice9 *This,
740                                       UINT StartRegister,
741                                       const int *pConstantData,
742                                       UINT Vector4iCount );
743 
744 HRESULT NINE_WINAPI
745 NineDevice9_GetVertexShaderConstantI( struct NineDevice9 *This,
746                                       UINT StartRegister,
747                                       int *pConstantData,
748                                       UINT Vector4iCount );
749 
750 HRESULT NINE_WINAPI
751 NineDevice9_SetVertexShaderConstantB( struct NineDevice9 *This,
752                                       UINT StartRegister,
753                                       const BOOL *pConstantData,
754                                       UINT BoolCount );
755 
756 HRESULT NINE_WINAPI
757 NineDevice9_GetVertexShaderConstantB( struct NineDevice9 *This,
758                                       UINT StartRegister,
759                                       BOOL *pConstantData,
760                                       UINT BoolCount );
761 
762 HRESULT NINE_WINAPI
763 NineDevice9_SetStreamSource( struct NineDevice9 *This,
764                              UINT StreamNumber,
765                              IDirect3DVertexBuffer9 *pStreamData,
766                              UINT OffsetInBytes,
767                              UINT Stride );
768 
769 HRESULT NINE_WINAPI
770 NineDevice9_GetStreamSource( struct NineDevice9 *This,
771                              UINT StreamNumber,
772                              IDirect3DVertexBuffer9 **ppStreamData,
773                              UINT *pOffsetInBytes,
774                              UINT *pStride );
775 
776 HRESULT NINE_WINAPI
777 NineDevice9_SetStreamSourceFreq( struct NineDevice9 *This,
778                                  UINT StreamNumber,
779                                  UINT Setting );
780 
781 HRESULT NINE_WINAPI
782 NineDevice9_GetStreamSourceFreq( struct NineDevice9 *This,
783                                  UINT StreamNumber,
784                                  UINT *pSetting );
785 
786 HRESULT NINE_WINAPI
787 NineDevice9_SetIndices( struct NineDevice9 *This,
788                         IDirect3DIndexBuffer9 *pIndexData );
789 
790 HRESULT NINE_WINAPI
791 NineDevice9_GetIndices( struct NineDevice9 *This,
792                         IDirect3DIndexBuffer9 **ppIndexData /*,
793                         UINT *pBaseVertexIndex */ );
794 
795 HRESULT NINE_WINAPI
796 NineDevice9_CreatePixelShader( struct NineDevice9 *This,
797                                const DWORD *pFunction,
798                                IDirect3DPixelShader9 **ppShader );
799 
800 HRESULT NINE_WINAPI
801 NineDevice9_SetPixelShader( struct NineDevice9 *This,
802                             IDirect3DPixelShader9 *pShader );
803 
804 HRESULT NINE_WINAPI
805 NineDevice9_GetPixelShader( struct NineDevice9 *This,
806                             IDirect3DPixelShader9 **ppShader );
807 
808 HRESULT NINE_WINAPI
809 NineDevice9_SetPixelShaderConstantF( struct NineDevice9 *This,
810                                      UINT StartRegister,
811                                      const float *pConstantData,
812                                      UINT Vector4fCount );
813 
814 HRESULT NINE_WINAPI
815 NineDevice9_GetPixelShaderConstantF( struct NineDevice9 *This,
816                                      UINT StartRegister,
817                                      float *pConstantData,
818                                      UINT Vector4fCount );
819 
820 HRESULT NINE_WINAPI
821 NineDevice9_SetPixelShaderConstantI( struct NineDevice9 *This,
822                                      UINT StartRegister,
823                                      const int *pConstantData,
824                                      UINT Vector4iCount );
825 
826 HRESULT NINE_WINAPI
827 NineDevice9_GetPixelShaderConstantI( struct NineDevice9 *This,
828                                      UINT StartRegister,
829                                      int *pConstantData,
830                                      UINT Vector4iCount );
831 
832 HRESULT NINE_WINAPI
833 NineDevice9_SetPixelShaderConstantB( struct NineDevice9 *This,
834                                      UINT StartRegister,
835                                      const BOOL *pConstantData,
836                                      UINT BoolCount );
837 
838 HRESULT NINE_WINAPI
839 NineDevice9_GetPixelShaderConstantB( struct NineDevice9 *This,
840                                      UINT StartRegister,
841                                      BOOL *pConstantData,
842                                      UINT BoolCount );
843 
844 HRESULT NINE_WINAPI
845 NineDevice9_DrawRectPatch( struct NineDevice9 *This,
846                            UINT Handle,
847                            const float *pNumSegs,
848                            const D3DRECTPATCH_INFO *pRectPatchInfo );
849 
850 HRESULT NINE_WINAPI
851 NineDevice9_DrawTriPatch( struct NineDevice9 *This,
852                           UINT Handle,
853                           const float *pNumSegs,
854                           const D3DTRIPATCH_INFO *pTriPatchInfo );
855 
856 HRESULT NINE_WINAPI
857 NineDevice9_DeletePatch( struct NineDevice9 *This,
858                          UINT Handle );
859 
860 HRESULT NINE_WINAPI
861 NineDevice9_CreateQuery( struct NineDevice9 *This,
862                          D3DQUERYTYPE Type,
863                          IDirect3DQuery9 **ppQuery );
864 
865 #endif /* _NINE_DEVICE9_H_ */
866