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     boolean ex;
53     boolean 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     boolean is_recording;
92     boolean 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     uint16_t max_ps_const_f;
99 
100     struct pipe_resource *dummy_texture;
101     struct pipe_sampler_view *dummy_sampler_view;
102     struct pipe_sampler_state dummy_sampler_state;
103 
104     struct gen_mipmap_state *gen_mipmap;
105 
106     struct {
107         struct hash_table *ht_vs;
108         struct hash_table *ht_ps;
109         struct NineVertexShader9 *vs;
110         struct NinePixelShader9 *ps;
111         unsigned num_vs;
112         unsigned num_ps;
113         float *vs_const;
114         float *ps_const;
115 
116         struct hash_table *ht_fvf;
117     } ff;
118 
119     struct {
120         struct pipe_resource *image;
121         unsigned w;
122         unsigned h;
123         POINT hotspot; /* -1, -1 if no cursor image set */
124         POINT pos;
125         BOOL visible;
126         boolean software;
127         void *hw_upload_temp;
128     } cursor;
129 
130     struct {
131         boolean user_sw_vbufs;
132         boolean window_space_position_support;
133         boolean vs_integer;
134         boolean ps_integer;
135         boolean offset_units_unscaled;
136     } driver_caps;
137 
138     struct {
139         boolean buggy_barycentrics;
140     } driver_bugs;
141 
142     struct {
143         boolean dynamic_texture_workaround;
144     } workarounds;
145 
146     struct u_upload_mgr *vertex_uploader;
147 
148     struct nine_range_pool range_pool;
149 
150     struct hud_context *hud; /* NULL if hud is disabled */
151 
152     struct nine_allocator *allocator;
153 
154     /* dummy vbo (containing 0 0 0 0) to bind if vertex shader input
155      * is not bound to anything by the vertex declaration */
156     struct pipe_resource *dummy_vbo;
157     BOOL device_needs_reset;
158     int minor_version_num;
159     long long available_texture_mem;
160     long long available_texture_limit;
161 
162     /* software vertex processing */
163     boolean swvp;
164     /* pure device */
165     boolean pure;
166 
167     unsigned frame_count; /* It's ok if we overflow */
168 
169     /* Ex */
170     int gpu_priority;
171     unsigned max_frame_latency;
172 };
173 static inline struct NineDevice9 *
NineDevice9(void * data)174 NineDevice9( void *data )
175 {
176     return (struct NineDevice9 *)data;
177 }
178 
179 HRESULT
180 NineDevice9_new( struct pipe_screen *pScreen,
181                  D3DDEVICE_CREATION_PARAMETERS *pCreationParameters,
182                  D3DCAPS9 *pCaps,
183                  D3DPRESENT_PARAMETERS *pPresentationParameters,
184                  IDirect3D9 *pD3D9,
185                  ID3DPresentGroup *pPresentationGroup,
186                  struct d3dadapter9_context *pCTX,
187                  boolean ex,
188                  D3DDISPLAYMODEEX *pFullscreenDisplayMode,
189                  struct NineDevice9 **ppOut,
190                  int minorVersionNum );
191 
192 HRESULT
193 NineDevice9_ctor( struct NineDevice9 *This,
194                   struct NineUnknownParams *pParams,
195                   struct pipe_screen *pScreen,
196                   D3DDEVICE_CREATION_PARAMETERS *pCreationParameters,
197                   D3DCAPS9 *pCaps,
198                   D3DPRESENT_PARAMETERS *pPresentationParameters,
199                   IDirect3D9 *pD3D9,
200                   ID3DPresentGroup *pPresentationGroup,
201                   struct d3dadapter9_context *pCTX,
202                   boolean ex,
203                   D3DDISPLAYMODEEX *pFullscreenDisplayMode,
204                   int minorVersionNum );
205 
206 void
207 NineDevice9_dtor( struct NineDevice9 *This );
208 
209 /*** Nine private ***/
210 struct pipe_resource *
211 nine_resource_create_with_retry( struct NineDevice9 *This,
212                                  struct pipe_screen *screen,
213                                  const struct pipe_resource *templat );
214 
215 void
216 NineDevice9_SetDefaultState( struct NineDevice9 *This, boolean is_reset );
217 
218 struct pipe_screen *
219 NineDevice9_GetScreen( struct NineDevice9 *This );
220 
221 struct pipe_context *
222 NineDevice9_GetPipe( struct NineDevice9 *This );
223 
224 const D3DCAPS9 *
225 NineDevice9_GetCaps( struct NineDevice9 *This );
226 
227 void
228 NineDevice9_EvictManagedResourcesInternal( struct NineDevice9 *This );
229 
230 /*** Direct3D public ***/
231 
232 HRESULT NINE_WINAPI
233 NineDevice9_TestCooperativeLevel( struct NineDevice9 *This );
234 
235 UINT NINE_WINAPI
236 NineDevice9_GetAvailableTextureMem( struct NineDevice9 *This );
237 
238 HRESULT NINE_WINAPI
239 NineDevice9_EvictManagedResources( struct NineDevice9 *This );
240 
241 HRESULT NINE_WINAPI
242 NineDevice9_GetDirect3D( struct NineDevice9 *This,
243                          IDirect3D9 **ppD3D9 );
244 
245 HRESULT NINE_WINAPI
246 NineDevice9_GetDeviceCaps( struct NineDevice9 *This,
247                            D3DCAPS9 *pCaps );
248 
249 HRESULT NINE_WINAPI
250 NineDevice9_GetDisplayMode( struct NineDevice9 *This,
251                             UINT iSwapChain,
252                             D3DDISPLAYMODE *pMode );
253 
254 HRESULT NINE_WINAPI
255 NineDevice9_GetCreationParameters( struct NineDevice9 *This,
256                                    D3DDEVICE_CREATION_PARAMETERS *pParameters );
257 
258 HRESULT NINE_WINAPI
259 NineDevice9_SetCursorProperties( struct NineDevice9 *This,
260                                  UINT XHotSpot,
261                                  UINT YHotSpot,
262                                  IDirect3DSurface9 *pCursorBitmap );
263 
264 void NINE_WINAPI
265 NineDevice9_SetCursorPosition( struct NineDevice9 *This,
266                                int X,
267                                int Y,
268                                DWORD Flags );
269 
270 BOOL NINE_WINAPI
271 NineDevice9_ShowCursor( struct NineDevice9 *This,
272                         BOOL bShow );
273 
274 HRESULT NINE_WINAPI
275 NineDevice9_CreateAdditionalSwapChain( struct NineDevice9 *This,
276                                        D3DPRESENT_PARAMETERS *pPresentationParameters,
277                                        IDirect3DSwapChain9 **pSwapChain );
278 
279 HRESULT NINE_WINAPI
280 NineDevice9_GetSwapChain( struct NineDevice9 *This,
281                           UINT iSwapChain,
282                           IDirect3DSwapChain9 **pSwapChain );
283 
284 UINT NINE_WINAPI
285 NineDevice9_GetNumberOfSwapChains( struct NineDevice9 *This );
286 
287 HRESULT NINE_WINAPI
288 NineDevice9_Reset( struct NineDevice9 *This,
289                    D3DPRESENT_PARAMETERS *pPresentationParameters );
290 
291 HRESULT NINE_WINAPI
292 NineDevice9_Present( struct NineDevice9 *This,
293                      const RECT *pSourceRect,
294                      const RECT *pDestRect,
295                      HWND hDestWindowOverride,
296                      const RGNDATA *pDirtyRegion );
297 
298 HRESULT NINE_WINAPI
299 NineDevice9_GetBackBuffer( struct NineDevice9 *This,
300                            UINT iSwapChain,
301                            UINT iBackBuffer,
302                            D3DBACKBUFFER_TYPE Type,
303                            IDirect3DSurface9 **ppBackBuffer );
304 
305 HRESULT NINE_WINAPI
306 NineDevice9_GetRasterStatus( struct NineDevice9 *This,
307                              UINT iSwapChain,
308                              D3DRASTER_STATUS *pRasterStatus );
309 
310 HRESULT NINE_WINAPI
311 NineDevice9_SetDialogBoxMode( struct NineDevice9 *This,
312                               BOOL bEnableDialogs );
313 
314 void NINE_WINAPI
315 NineDevice9_SetGammaRamp( struct NineDevice9 *This,
316                           UINT iSwapChain,
317                           DWORD Flags,
318                           const D3DGAMMARAMP *pRamp );
319 
320 void NINE_WINAPI
321 NineDevice9_GetGammaRamp( struct NineDevice9 *This,
322                           UINT iSwapChain,
323                           D3DGAMMARAMP *pRamp );
324 
325 HRESULT NINE_WINAPI
326 NineDevice9_CreateTexture( struct NineDevice9 *This,
327                            UINT Width,
328                            UINT Height,
329                            UINT Levels,
330                            DWORD Usage,
331                            D3DFORMAT Format,
332                            D3DPOOL Pool,
333                            IDirect3DTexture9 **ppTexture,
334                            HANDLE *pSharedHandle );
335 
336 HRESULT NINE_WINAPI
337 NineDevice9_CreateVolumeTexture( struct NineDevice9 *This,
338                                  UINT Width,
339                                  UINT Height,
340                                  UINT Depth,
341                                  UINT Levels,
342                                  DWORD Usage,
343                                  D3DFORMAT Format,
344                                  D3DPOOL Pool,
345                                  IDirect3DVolumeTexture9 **ppVolumeTexture,
346                                  HANDLE *pSharedHandle );
347 
348 HRESULT NINE_WINAPI
349 NineDevice9_CreateCubeTexture( struct NineDevice9 *This,
350                                UINT EdgeLength,
351                                UINT Levels,
352                                DWORD Usage,
353                                D3DFORMAT Format,
354                                D3DPOOL Pool,
355                                IDirect3DCubeTexture9 **ppCubeTexture,
356                                HANDLE *pSharedHandle );
357 
358 HRESULT NINE_WINAPI
359 NineDevice9_CreateVertexBuffer( struct NineDevice9 *This,
360                                 UINT Length,
361                                 DWORD Usage,
362                                 DWORD FVF,
363                                 D3DPOOL Pool,
364                                 IDirect3DVertexBuffer9 **ppVertexBuffer,
365                                 HANDLE *pSharedHandle );
366 
367 HRESULT NINE_WINAPI
368 NineDevice9_CreateIndexBuffer( struct NineDevice9 *This,
369                                UINT Length,
370                                DWORD Usage,
371                                D3DFORMAT Format,
372                                D3DPOOL Pool,
373                                IDirect3DIndexBuffer9 **ppIndexBuffer,
374                                HANDLE *pSharedHandle );
375 
376 HRESULT NINE_WINAPI
377 NineDevice9_CreateRenderTarget( struct NineDevice9 *This,
378                                 UINT Width,
379                                 UINT Height,
380                                 D3DFORMAT Format,
381                                 D3DMULTISAMPLE_TYPE MultiSample,
382                                 DWORD MultisampleQuality,
383                                 BOOL Lockable,
384                                 IDirect3DSurface9 **ppSurface,
385                                 HANDLE *pSharedHandle );
386 
387 HRESULT NINE_WINAPI
388 NineDevice9_CreateDepthStencilSurface( struct NineDevice9 *This,
389                                        UINT Width,
390                                        UINT Height,
391                                        D3DFORMAT Format,
392                                        D3DMULTISAMPLE_TYPE MultiSample,
393                                        DWORD MultisampleQuality,
394                                        BOOL Discard,
395                                        IDirect3DSurface9 **ppSurface,
396                                        HANDLE *pSharedHandle );
397 
398 HRESULT NINE_WINAPI
399 NineDevice9_UpdateSurface( struct NineDevice9 *This,
400                            IDirect3DSurface9 *pSourceSurface,
401                            const RECT *pSourceRect,
402                            IDirect3DSurface9 *pDestinationSurface,
403                            const POINT *pDestPoint );
404 
405 HRESULT NINE_WINAPI
406 NineDevice9_UpdateTexture( struct NineDevice9 *This,
407                            IDirect3DBaseTexture9 *pSourceTexture,
408                            IDirect3DBaseTexture9 *pDestinationTexture );
409 
410 HRESULT NINE_WINAPI
411 NineDevice9_GetRenderTargetData( struct NineDevice9 *This,
412                                  IDirect3DSurface9 *pRenderTarget,
413                                  IDirect3DSurface9 *pDestSurface );
414 
415 HRESULT NINE_WINAPI
416 NineDevice9_GetFrontBufferData( struct NineDevice9 *This,
417                                 UINT iSwapChain,
418                                 IDirect3DSurface9 *pDestSurface );
419 
420 HRESULT NINE_WINAPI
421 NineDevice9_StretchRect( struct NineDevice9 *This,
422                          IDirect3DSurface9 *pSourceSurface,
423                          const RECT *pSourceRect,
424                          IDirect3DSurface9 *pDestSurface,
425                          const RECT *pDestRect,
426                          D3DTEXTUREFILTERTYPE Filter );
427 
428 HRESULT NINE_WINAPI
429 NineDevice9_ColorFill( struct NineDevice9 *This,
430                        IDirect3DSurface9 *pSurface,
431                        const RECT *pRect,
432                        D3DCOLOR color );
433 
434 HRESULT NINE_WINAPI
435 NineDevice9_CreateOffscreenPlainSurface( struct NineDevice9 *This,
436                                          UINT Width,
437                                          UINT Height,
438                                          D3DFORMAT Format,
439                                          D3DPOOL Pool,
440                                          IDirect3DSurface9 **ppSurface,
441                                          HANDLE *pSharedHandle );
442 
443 HRESULT NINE_WINAPI
444 NineDevice9_SetRenderTarget( struct NineDevice9 *This,
445                              DWORD RenderTargetIndex,
446                              IDirect3DSurface9 *pRenderTarget );
447 
448 HRESULT NINE_WINAPI
449 NineDevice9_GetRenderTarget( struct NineDevice9 *This,
450                              DWORD RenderTargetIndex,
451                              IDirect3DSurface9 **ppRenderTarget );
452 
453 HRESULT NINE_WINAPI
454 NineDevice9_SetDepthStencilSurface( struct NineDevice9 *This,
455                                     IDirect3DSurface9 *pNewZStencil );
456 
457 HRESULT NINE_WINAPI
458 NineDevice9_GetDepthStencilSurface( struct NineDevice9 *This,
459                                     IDirect3DSurface9 **ppZStencilSurface );
460 
461 HRESULT NINE_WINAPI
462 NineDevice9_BeginScene( struct NineDevice9 *This );
463 
464 HRESULT NINE_WINAPI
465 NineDevice9_EndScene( struct NineDevice9 *This );
466 
467 HRESULT NINE_WINAPI
468 NineDevice9_Clear( struct NineDevice9 *This,
469                    DWORD Count,
470                    const D3DRECT *pRects,
471                    DWORD Flags,
472                    D3DCOLOR Color,
473                    float Z,
474                    DWORD Stencil );
475 
476 HRESULT NINE_WINAPI
477 NineDevice9_SetTransform( struct NineDevice9 *This,
478                           D3DTRANSFORMSTATETYPE State,
479                           const D3DMATRIX *pMatrix );
480 
481 HRESULT NINE_WINAPI
482 NineDevice9_GetTransform( struct NineDevice9 *This,
483                           D3DTRANSFORMSTATETYPE State,
484                           D3DMATRIX *pMatrix );
485 
486 HRESULT NINE_WINAPI
487 NineDevice9_MultiplyTransform( struct NineDevice9 *This,
488                                D3DTRANSFORMSTATETYPE State,
489                                const D3DMATRIX *pMatrix );
490 
491 HRESULT NINE_WINAPI
492 NineDevice9_SetViewport( struct NineDevice9 *This,
493                          const D3DVIEWPORT9 *pViewport );
494 
495 HRESULT NINE_WINAPI
496 NineDevice9_GetViewport( struct NineDevice9 *This,
497                          D3DVIEWPORT9 *pViewport );
498 
499 HRESULT NINE_WINAPI
500 NineDevice9_SetMaterial( struct NineDevice9 *This,
501                          const D3DMATERIAL9 *pMaterial );
502 
503 HRESULT NINE_WINAPI
504 NineDevice9_GetMaterial( struct NineDevice9 *This,
505                          D3DMATERIAL9 *pMaterial );
506 
507 HRESULT NINE_WINAPI
508 NineDevice9_SetLight( struct NineDevice9 *This,
509                       DWORD Index,
510                       const D3DLIGHT9 *pLight );
511 
512 HRESULT NINE_WINAPI
513 NineDevice9_GetLight( struct NineDevice9 *This,
514                       DWORD Index,
515                       D3DLIGHT9 *pLight );
516 
517 HRESULT NINE_WINAPI
518 NineDevice9_LightEnable( struct NineDevice9 *This,
519                          DWORD Index,
520                          BOOL Enable );
521 
522 HRESULT NINE_WINAPI
523 NineDevice9_GetLightEnable( struct NineDevice9 *This,
524                             DWORD Index,
525                             BOOL *pEnable );
526 
527 HRESULT NINE_WINAPI
528 NineDevice9_SetClipPlane( struct NineDevice9 *This,
529                           DWORD Index,
530                           const float *pPlane );
531 
532 HRESULT NINE_WINAPI
533 NineDevice9_GetClipPlane( struct NineDevice9 *This,
534                           DWORD Index,
535                           float *pPlane );
536 
537 HRESULT NINE_WINAPI
538 NineDevice9_SetRenderState( struct NineDevice9 *This,
539                             D3DRENDERSTATETYPE State,
540                             DWORD Value );
541 
542 HRESULT NINE_WINAPI
543 NineDevice9_GetRenderState( struct NineDevice9 *This,
544                             D3DRENDERSTATETYPE State,
545                             DWORD *pValue );
546 
547 HRESULT NINE_WINAPI
548 NineDevice9_CreateStateBlock( struct NineDevice9 *This,
549                               D3DSTATEBLOCKTYPE Type,
550                               IDirect3DStateBlock9 **ppSB );
551 
552 HRESULT NINE_WINAPI
553 NineDevice9_BeginStateBlock( struct NineDevice9 *This );
554 
555 HRESULT NINE_WINAPI
556 NineDevice9_EndStateBlock( struct NineDevice9 *This,
557                            IDirect3DStateBlock9 **ppSB );
558 
559 HRESULT NINE_WINAPI
560 NineDevice9_SetClipStatus( struct NineDevice9 *This,
561                            const D3DCLIPSTATUS9 *pClipStatus );
562 
563 HRESULT NINE_WINAPI
564 NineDevice9_GetClipStatus( struct NineDevice9 *This,
565                            D3DCLIPSTATUS9 *pClipStatus );
566 
567 HRESULT NINE_WINAPI
568 NineDevice9_GetTexture( struct NineDevice9 *This,
569                         DWORD Stage,
570                         IDirect3DBaseTexture9 **ppTexture );
571 
572 HRESULT NINE_WINAPI
573 NineDevice9_SetTexture( struct NineDevice9 *This,
574                         DWORD Stage,
575                         IDirect3DBaseTexture9 *pTexture );
576 
577 HRESULT NINE_WINAPI
578 NineDevice9_GetTextureStageState( struct NineDevice9 *This,
579                                   DWORD Stage,
580                                   D3DTEXTURESTAGESTATETYPE Type,
581                                   DWORD *pValue );
582 
583 HRESULT NINE_WINAPI
584 NineDevice9_SetTextureStageState( struct NineDevice9 *This,
585                                   DWORD Stage,
586                                   D3DTEXTURESTAGESTATETYPE Type,
587                                   DWORD Value );
588 
589 HRESULT NINE_WINAPI
590 NineDevice9_GetSamplerState( struct NineDevice9 *This,
591                              DWORD Sampler,
592                              D3DSAMPLERSTATETYPE Type,
593                              DWORD *pValue );
594 
595 HRESULT NINE_WINAPI
596 NineDevice9_SetSamplerState( struct NineDevice9 *This,
597                              DWORD Sampler,
598                              D3DSAMPLERSTATETYPE Type,
599                              DWORD Value );
600 
601 HRESULT NINE_WINAPI
602 NineDevice9_ValidateDevice( struct NineDevice9 *This,
603                             DWORD *pNumPasses );
604 
605 HRESULT NINE_WINAPI
606 NineDevice9_SetPaletteEntries( struct NineDevice9 *This,
607                                UINT PaletteNumber,
608                                const PALETTEENTRY *pEntries );
609 
610 HRESULT NINE_WINAPI
611 NineDevice9_GetPaletteEntries( struct NineDevice9 *This,
612                                UINT PaletteNumber,
613                                PALETTEENTRY *pEntries );
614 
615 HRESULT NINE_WINAPI
616 NineDevice9_SetCurrentTexturePalette( struct NineDevice9 *This,
617                                       UINT PaletteNumber );
618 
619 HRESULT NINE_WINAPI
620 NineDevice9_GetCurrentTexturePalette( struct NineDevice9 *This,
621                                       UINT *PaletteNumber );
622 
623 HRESULT NINE_WINAPI
624 NineDevice9_SetScissorRect( struct NineDevice9 *This,
625                             const RECT *pRect );
626 
627 HRESULT NINE_WINAPI
628 NineDevice9_GetScissorRect( struct NineDevice9 *This,
629                             RECT *pRect );
630 
631 HRESULT NINE_WINAPI
632 NineDevice9_SetSoftwareVertexProcessing( struct NineDevice9 *This,
633                                          BOOL bSoftware );
634 
635 BOOL NINE_WINAPI
636 NineDevice9_GetSoftwareVertexProcessing( struct NineDevice9 *This );
637 
638 HRESULT NINE_WINAPI
639 NineDevice9_SetNPatchMode( struct NineDevice9 *This,
640                            float nSegments );
641 
642 float NINE_WINAPI
643 NineDevice9_GetNPatchMode( struct NineDevice9 *This );
644 
645 HRESULT NINE_WINAPI
646 NineDevice9_DrawPrimitive( struct NineDevice9 *This,
647                            D3DPRIMITIVETYPE PrimitiveType,
648                            UINT StartVertex,
649                            UINT PrimitiveCount );
650 
651 HRESULT NINE_WINAPI
652 NineDevice9_DrawIndexedPrimitive( struct NineDevice9 *This,
653                                   D3DPRIMITIVETYPE PrimitiveType,
654                                   INT BaseVertexIndex,
655                                   UINT MinVertexIndex,
656                                   UINT NumVertices,
657                                   UINT startIndex,
658                                   UINT primCount );
659 
660 HRESULT NINE_WINAPI
661 NineDevice9_DrawPrimitiveUP( struct NineDevice9 *This,
662                              D3DPRIMITIVETYPE PrimitiveType,
663                              UINT PrimitiveCount,
664                              const void *pVertexStreamZeroData,
665                              UINT VertexStreamZeroStride );
666 
667 HRESULT NINE_WINAPI
668 NineDevice9_DrawIndexedPrimitiveUP( struct NineDevice9 *This,
669                                     D3DPRIMITIVETYPE PrimitiveType,
670                                     UINT MinVertexIndex,
671                                     UINT NumVertices,
672                                     UINT PrimitiveCount,
673                                     const void *pIndexData,
674                                     D3DFORMAT IndexDataFormat,
675                                     const void *pVertexStreamZeroData,
676                                     UINT VertexStreamZeroStride );
677 
678 HRESULT NINE_WINAPI
679 NineDevice9_ProcessVertices( struct NineDevice9 *This,
680                              UINT SrcStartIndex,
681                              UINT DestIndex,
682                              UINT VertexCount,
683                              IDirect3DVertexBuffer9 *pDestBuffer,
684                              IDirect3DVertexDeclaration9 *pVertexDecl,
685                              DWORD Flags );
686 
687 HRESULT NINE_WINAPI
688 NineDevice9_CreateVertexDeclaration( struct NineDevice9 *This,
689                                      const D3DVERTEXELEMENT9 *pVertexElements,
690                                      IDirect3DVertexDeclaration9 **ppDecl );
691 
692 HRESULT NINE_WINAPI
693 NineDevice9_SetVertexDeclaration( struct NineDevice9 *This,
694                                   IDirect3DVertexDeclaration9 *pDecl );
695 
696 HRESULT NINE_WINAPI
697 NineDevice9_GetVertexDeclaration( struct NineDevice9 *This,
698                                   IDirect3DVertexDeclaration9 **ppDecl );
699 
700 HRESULT NINE_WINAPI
701 NineDevice9_SetFVF( struct NineDevice9 *This,
702                     DWORD FVF );
703 
704 HRESULT NINE_WINAPI
705 NineDevice9_GetFVF( struct NineDevice9 *This,
706                     DWORD *pFVF );
707 
708 HRESULT NINE_WINAPI
709 NineDevice9_CreateVertexShader( struct NineDevice9 *This,
710                                 const DWORD *pFunction,
711                                 IDirect3DVertexShader9 **ppShader );
712 
713 HRESULT NINE_WINAPI
714 NineDevice9_SetVertexShader( struct NineDevice9 *This,
715                              IDirect3DVertexShader9 *pShader );
716 
717 HRESULT NINE_WINAPI
718 NineDevice9_GetVertexShader( struct NineDevice9 *This,
719                              IDirect3DVertexShader9 **ppShader );
720 
721 HRESULT NINE_WINAPI
722 NineDevice9_SetVertexShaderConstantF( struct NineDevice9 *This,
723                                       UINT StartRegister,
724                                       const float *pConstantData,
725                                       UINT Vector4fCount );
726 
727 HRESULT NINE_WINAPI
728 NineDevice9_GetVertexShaderConstantF( struct NineDevice9 *This,
729                                       UINT StartRegister,
730                                       float *pConstantData,
731                                       UINT Vector4fCount );
732 
733 HRESULT NINE_WINAPI
734 NineDevice9_SetVertexShaderConstantI( struct NineDevice9 *This,
735                                       UINT StartRegister,
736                                       const int *pConstantData,
737                                       UINT Vector4iCount );
738 
739 HRESULT NINE_WINAPI
740 NineDevice9_GetVertexShaderConstantI( struct NineDevice9 *This,
741                                       UINT StartRegister,
742                                       int *pConstantData,
743                                       UINT Vector4iCount );
744 
745 HRESULT NINE_WINAPI
746 NineDevice9_SetVertexShaderConstantB( struct NineDevice9 *This,
747                                       UINT StartRegister,
748                                       const BOOL *pConstantData,
749                                       UINT BoolCount );
750 
751 HRESULT NINE_WINAPI
752 NineDevice9_GetVertexShaderConstantB( struct NineDevice9 *This,
753                                       UINT StartRegister,
754                                       BOOL *pConstantData,
755                                       UINT BoolCount );
756 
757 HRESULT NINE_WINAPI
758 NineDevice9_SetStreamSource( struct NineDevice9 *This,
759                              UINT StreamNumber,
760                              IDirect3DVertexBuffer9 *pStreamData,
761                              UINT OffsetInBytes,
762                              UINT Stride );
763 
764 HRESULT NINE_WINAPI
765 NineDevice9_GetStreamSource( struct NineDevice9 *This,
766                              UINT StreamNumber,
767                              IDirect3DVertexBuffer9 **ppStreamData,
768                              UINT *pOffsetInBytes,
769                              UINT *pStride );
770 
771 HRESULT NINE_WINAPI
772 NineDevice9_SetStreamSourceFreq( struct NineDevice9 *This,
773                                  UINT StreamNumber,
774                                  UINT Setting );
775 
776 HRESULT NINE_WINAPI
777 NineDevice9_GetStreamSourceFreq( struct NineDevice9 *This,
778                                  UINT StreamNumber,
779                                  UINT *pSetting );
780 
781 HRESULT NINE_WINAPI
782 NineDevice9_SetIndices( struct NineDevice9 *This,
783                         IDirect3DIndexBuffer9 *pIndexData );
784 
785 HRESULT NINE_WINAPI
786 NineDevice9_GetIndices( struct NineDevice9 *This,
787                         IDirect3DIndexBuffer9 **ppIndexData /*,
788                         UINT *pBaseVertexIndex */ );
789 
790 HRESULT NINE_WINAPI
791 NineDevice9_CreatePixelShader( struct NineDevice9 *This,
792                                const DWORD *pFunction,
793                                IDirect3DPixelShader9 **ppShader );
794 
795 HRESULT NINE_WINAPI
796 NineDevice9_SetPixelShader( struct NineDevice9 *This,
797                             IDirect3DPixelShader9 *pShader );
798 
799 HRESULT NINE_WINAPI
800 NineDevice9_GetPixelShader( struct NineDevice9 *This,
801                             IDirect3DPixelShader9 **ppShader );
802 
803 HRESULT NINE_WINAPI
804 NineDevice9_SetPixelShaderConstantF( struct NineDevice9 *This,
805                                      UINT StartRegister,
806                                      const float *pConstantData,
807                                      UINT Vector4fCount );
808 
809 HRESULT NINE_WINAPI
810 NineDevice9_GetPixelShaderConstantF( struct NineDevice9 *This,
811                                      UINT StartRegister,
812                                      float *pConstantData,
813                                      UINT Vector4fCount );
814 
815 HRESULT NINE_WINAPI
816 NineDevice9_SetPixelShaderConstantI( struct NineDevice9 *This,
817                                      UINT StartRegister,
818                                      const int *pConstantData,
819                                      UINT Vector4iCount );
820 
821 HRESULT NINE_WINAPI
822 NineDevice9_GetPixelShaderConstantI( struct NineDevice9 *This,
823                                      UINT StartRegister,
824                                      int *pConstantData,
825                                      UINT Vector4iCount );
826 
827 HRESULT NINE_WINAPI
828 NineDevice9_SetPixelShaderConstantB( struct NineDevice9 *This,
829                                      UINT StartRegister,
830                                      const BOOL *pConstantData,
831                                      UINT BoolCount );
832 
833 HRESULT NINE_WINAPI
834 NineDevice9_GetPixelShaderConstantB( struct NineDevice9 *This,
835                                      UINT StartRegister,
836                                      BOOL *pConstantData,
837                                      UINT BoolCount );
838 
839 HRESULT NINE_WINAPI
840 NineDevice9_DrawRectPatch( struct NineDevice9 *This,
841                            UINT Handle,
842                            const float *pNumSegs,
843                            const D3DRECTPATCH_INFO *pRectPatchInfo );
844 
845 HRESULT NINE_WINAPI
846 NineDevice9_DrawTriPatch( struct NineDevice9 *This,
847                           UINT Handle,
848                           const float *pNumSegs,
849                           const D3DTRIPATCH_INFO *pTriPatchInfo );
850 
851 HRESULT NINE_WINAPI
852 NineDevice9_DeletePatch( struct NineDevice9 *This,
853                          UINT Handle );
854 
855 HRESULT NINE_WINAPI
856 NineDevice9_CreateQuery( struct NineDevice9 *This,
857                          D3DQUERYTYPE Type,
858                          IDirect3DQuery9 **ppQuery );
859 
860 #endif /* _NINE_DEVICE9_H_ */
861