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