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
35struct gen_mipmap_state;
36struct hash_table;
37struct pipe_screen;
38struct pipe_context;
39struct cso_context;
40struct hud_context;
41struct u_upload_mgr;
42struct csmt_context;
43
44struct NineSwapChain9;
45struct NineStateBlock9;
46
47#include "util/list.h"
48
49struct 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};
173static inline struct NineDevice9 *
174NineDevice9( void *data )
175{
176    return (struct NineDevice9 *)data;
177}
178
179HRESULT
180NineDevice9_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
192HRESULT
193NineDevice9_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
206void
207NineDevice9_dtor( struct NineDevice9 *This );
208
209/*** Nine private ***/
210struct pipe_resource *
211nine_resource_create_with_retry( struct NineDevice9 *This,
212                                 struct pipe_screen *screen,
213                                 const struct pipe_resource *templat );
214
215void
216NineDevice9_SetDefaultState( struct NineDevice9 *This, boolean is_reset );
217
218struct pipe_screen *
219NineDevice9_GetScreen( struct NineDevice9 *This );
220
221struct pipe_context *
222NineDevice9_GetPipe( struct NineDevice9 *This );
223
224const D3DCAPS9 *
225NineDevice9_GetCaps( struct NineDevice9 *This );
226
227void
228NineDevice9_EvictManagedResourcesInternal( struct NineDevice9 *This );
229
230/*** Direct3D public ***/
231
232HRESULT NINE_WINAPI
233NineDevice9_TestCooperativeLevel( struct NineDevice9 *This );
234
235UINT NINE_WINAPI
236NineDevice9_GetAvailableTextureMem( struct NineDevice9 *This );
237
238HRESULT NINE_WINAPI
239NineDevice9_EvictManagedResources( struct NineDevice9 *This );
240
241HRESULT NINE_WINAPI
242NineDevice9_GetDirect3D( struct NineDevice9 *This,
243                         IDirect3D9 **ppD3D9 );
244
245HRESULT NINE_WINAPI
246NineDevice9_GetDeviceCaps( struct NineDevice9 *This,
247                           D3DCAPS9 *pCaps );
248
249HRESULT NINE_WINAPI
250NineDevice9_GetDisplayMode( struct NineDevice9 *This,
251                            UINT iSwapChain,
252                            D3DDISPLAYMODE *pMode );
253
254HRESULT NINE_WINAPI
255NineDevice9_GetCreationParameters( struct NineDevice9 *This,
256                                   D3DDEVICE_CREATION_PARAMETERS *pParameters );
257
258HRESULT NINE_WINAPI
259NineDevice9_SetCursorProperties( struct NineDevice9 *This,
260                                 UINT XHotSpot,
261                                 UINT YHotSpot,
262                                 IDirect3DSurface9 *pCursorBitmap );
263
264void NINE_WINAPI
265NineDevice9_SetCursorPosition( struct NineDevice9 *This,
266                               int X,
267                               int Y,
268                               DWORD Flags );
269
270BOOL NINE_WINAPI
271NineDevice9_ShowCursor( struct NineDevice9 *This,
272                        BOOL bShow );
273
274HRESULT NINE_WINAPI
275NineDevice9_CreateAdditionalSwapChain( struct NineDevice9 *This,
276                                       D3DPRESENT_PARAMETERS *pPresentationParameters,
277                                       IDirect3DSwapChain9 **pSwapChain );
278
279HRESULT NINE_WINAPI
280NineDevice9_GetSwapChain( struct NineDevice9 *This,
281                          UINT iSwapChain,
282                          IDirect3DSwapChain9 **pSwapChain );
283
284UINT NINE_WINAPI
285NineDevice9_GetNumberOfSwapChains( struct NineDevice9 *This );
286
287HRESULT NINE_WINAPI
288NineDevice9_Reset( struct NineDevice9 *This,
289                   D3DPRESENT_PARAMETERS *pPresentationParameters );
290
291HRESULT NINE_WINAPI
292NineDevice9_Present( struct NineDevice9 *This,
293                     const RECT *pSourceRect,
294                     const RECT *pDestRect,
295                     HWND hDestWindowOverride,
296                     const RGNDATA *pDirtyRegion );
297
298HRESULT NINE_WINAPI
299NineDevice9_GetBackBuffer( struct NineDevice9 *This,
300                           UINT iSwapChain,
301                           UINT iBackBuffer,
302                           D3DBACKBUFFER_TYPE Type,
303                           IDirect3DSurface9 **ppBackBuffer );
304
305HRESULT NINE_WINAPI
306NineDevice9_GetRasterStatus( struct NineDevice9 *This,
307                             UINT iSwapChain,
308                             D3DRASTER_STATUS *pRasterStatus );
309
310HRESULT NINE_WINAPI
311NineDevice9_SetDialogBoxMode( struct NineDevice9 *This,
312                              BOOL bEnableDialogs );
313
314void NINE_WINAPI
315NineDevice9_SetGammaRamp( struct NineDevice9 *This,
316                          UINT iSwapChain,
317                          DWORD Flags,
318                          const D3DGAMMARAMP *pRamp );
319
320void NINE_WINAPI
321NineDevice9_GetGammaRamp( struct NineDevice9 *This,
322                          UINT iSwapChain,
323                          D3DGAMMARAMP *pRamp );
324
325HRESULT NINE_WINAPI
326NineDevice9_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
336HRESULT NINE_WINAPI
337NineDevice9_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
348HRESULT NINE_WINAPI
349NineDevice9_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
358HRESULT NINE_WINAPI
359NineDevice9_CreateVertexBuffer( struct NineDevice9 *This,
360                                UINT Length,
361                                DWORD Usage,
362                                DWORD FVF,
363                                D3DPOOL Pool,
364                                IDirect3DVertexBuffer9 **ppVertexBuffer,
365                                HANDLE *pSharedHandle );
366
367HRESULT NINE_WINAPI
368NineDevice9_CreateIndexBuffer( struct NineDevice9 *This,
369                               UINT Length,
370                               DWORD Usage,
371                               D3DFORMAT Format,
372                               D3DPOOL Pool,
373                               IDirect3DIndexBuffer9 **ppIndexBuffer,
374                               HANDLE *pSharedHandle );
375
376HRESULT NINE_WINAPI
377NineDevice9_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
387HRESULT NINE_WINAPI
388NineDevice9_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
398HRESULT NINE_WINAPI
399NineDevice9_UpdateSurface( struct NineDevice9 *This,
400                           IDirect3DSurface9 *pSourceSurface,
401                           const RECT *pSourceRect,
402                           IDirect3DSurface9 *pDestinationSurface,
403                           const POINT *pDestPoint );
404
405HRESULT NINE_WINAPI
406NineDevice9_UpdateTexture( struct NineDevice9 *This,
407                           IDirect3DBaseTexture9 *pSourceTexture,
408                           IDirect3DBaseTexture9 *pDestinationTexture );
409
410HRESULT NINE_WINAPI
411NineDevice9_GetRenderTargetData( struct NineDevice9 *This,
412                                 IDirect3DSurface9 *pRenderTarget,
413                                 IDirect3DSurface9 *pDestSurface );
414
415HRESULT NINE_WINAPI
416NineDevice9_GetFrontBufferData( struct NineDevice9 *This,
417                                UINT iSwapChain,
418                                IDirect3DSurface9 *pDestSurface );
419
420HRESULT NINE_WINAPI
421NineDevice9_StretchRect( struct NineDevice9 *This,
422                         IDirect3DSurface9 *pSourceSurface,
423                         const RECT *pSourceRect,
424                         IDirect3DSurface9 *pDestSurface,
425                         const RECT *pDestRect,
426                         D3DTEXTUREFILTERTYPE Filter );
427
428HRESULT NINE_WINAPI
429NineDevice9_ColorFill( struct NineDevice9 *This,
430                       IDirect3DSurface9 *pSurface,
431                       const RECT *pRect,
432                       D3DCOLOR color );
433
434HRESULT NINE_WINAPI
435NineDevice9_CreateOffscreenPlainSurface( struct NineDevice9 *This,
436                                         UINT Width,
437                                         UINT Height,
438                                         D3DFORMAT Format,
439                                         D3DPOOL Pool,
440                                         IDirect3DSurface9 **ppSurface,
441                                         HANDLE *pSharedHandle );
442
443HRESULT NINE_WINAPI
444NineDevice9_SetRenderTarget( struct NineDevice9 *This,
445                             DWORD RenderTargetIndex,
446                             IDirect3DSurface9 *pRenderTarget );
447
448HRESULT NINE_WINAPI
449NineDevice9_GetRenderTarget( struct NineDevice9 *This,
450                             DWORD RenderTargetIndex,
451                             IDirect3DSurface9 **ppRenderTarget );
452
453HRESULT NINE_WINAPI
454NineDevice9_SetDepthStencilSurface( struct NineDevice9 *This,
455                                    IDirect3DSurface9 *pNewZStencil );
456
457HRESULT NINE_WINAPI
458NineDevice9_GetDepthStencilSurface( struct NineDevice9 *This,
459                                    IDirect3DSurface9 **ppZStencilSurface );
460
461HRESULT NINE_WINAPI
462NineDevice9_BeginScene( struct NineDevice9 *This );
463
464HRESULT NINE_WINAPI
465NineDevice9_EndScene( struct NineDevice9 *This );
466
467HRESULT NINE_WINAPI
468NineDevice9_Clear( struct NineDevice9 *This,
469                   DWORD Count,
470                   const D3DRECT *pRects,
471                   DWORD Flags,
472                   D3DCOLOR Color,
473                   float Z,
474                   DWORD Stencil );
475
476HRESULT NINE_WINAPI
477NineDevice9_SetTransform( struct NineDevice9 *This,
478                          D3DTRANSFORMSTATETYPE State,
479                          const D3DMATRIX *pMatrix );
480
481HRESULT NINE_WINAPI
482NineDevice9_GetTransform( struct NineDevice9 *This,
483                          D3DTRANSFORMSTATETYPE State,
484                          D3DMATRIX *pMatrix );
485
486HRESULT NINE_WINAPI
487NineDevice9_MultiplyTransform( struct NineDevice9 *This,
488                               D3DTRANSFORMSTATETYPE State,
489                               const D3DMATRIX *pMatrix );
490
491HRESULT NINE_WINAPI
492NineDevice9_SetViewport( struct NineDevice9 *This,
493                         const D3DVIEWPORT9 *pViewport );
494
495HRESULT NINE_WINAPI
496NineDevice9_GetViewport( struct NineDevice9 *This,
497                         D3DVIEWPORT9 *pViewport );
498
499HRESULT NINE_WINAPI
500NineDevice9_SetMaterial( struct NineDevice9 *This,
501                         const D3DMATERIAL9 *pMaterial );
502
503HRESULT NINE_WINAPI
504NineDevice9_GetMaterial( struct NineDevice9 *This,
505                         D3DMATERIAL9 *pMaterial );
506
507HRESULT NINE_WINAPI
508NineDevice9_SetLight( struct NineDevice9 *This,
509                      DWORD Index,
510                      const D3DLIGHT9 *pLight );
511
512HRESULT NINE_WINAPI
513NineDevice9_GetLight( struct NineDevice9 *This,
514                      DWORD Index,
515                      D3DLIGHT9 *pLight );
516
517HRESULT NINE_WINAPI
518NineDevice9_LightEnable( struct NineDevice9 *This,
519                         DWORD Index,
520                         BOOL Enable );
521
522HRESULT NINE_WINAPI
523NineDevice9_GetLightEnable( struct NineDevice9 *This,
524                            DWORD Index,
525                            BOOL *pEnable );
526
527HRESULT NINE_WINAPI
528NineDevice9_SetClipPlane( struct NineDevice9 *This,
529                          DWORD Index,
530                          const float *pPlane );
531
532HRESULT NINE_WINAPI
533NineDevice9_GetClipPlane( struct NineDevice9 *This,
534                          DWORD Index,
535                          float *pPlane );
536
537HRESULT NINE_WINAPI
538NineDevice9_SetRenderState( struct NineDevice9 *This,
539                            D3DRENDERSTATETYPE State,
540                            DWORD Value );
541
542HRESULT NINE_WINAPI
543NineDevice9_GetRenderState( struct NineDevice9 *This,
544                            D3DRENDERSTATETYPE State,
545                            DWORD *pValue );
546
547HRESULT NINE_WINAPI
548NineDevice9_CreateStateBlock( struct NineDevice9 *This,
549                              D3DSTATEBLOCKTYPE Type,
550                              IDirect3DStateBlock9 **ppSB );
551
552HRESULT NINE_WINAPI
553NineDevice9_BeginStateBlock( struct NineDevice9 *This );
554
555HRESULT NINE_WINAPI
556NineDevice9_EndStateBlock( struct NineDevice9 *This,
557                           IDirect3DStateBlock9 **ppSB );
558
559HRESULT NINE_WINAPI
560NineDevice9_SetClipStatus( struct NineDevice9 *This,
561                           const D3DCLIPSTATUS9 *pClipStatus );
562
563HRESULT NINE_WINAPI
564NineDevice9_GetClipStatus( struct NineDevice9 *This,
565                           D3DCLIPSTATUS9 *pClipStatus );
566
567HRESULT NINE_WINAPI
568NineDevice9_GetTexture( struct NineDevice9 *This,
569                        DWORD Stage,
570                        IDirect3DBaseTexture9 **ppTexture );
571
572HRESULT NINE_WINAPI
573NineDevice9_SetTexture( struct NineDevice9 *This,
574                        DWORD Stage,
575                        IDirect3DBaseTexture9 *pTexture );
576
577HRESULT NINE_WINAPI
578NineDevice9_GetTextureStageState( struct NineDevice9 *This,
579                                  DWORD Stage,
580                                  D3DTEXTURESTAGESTATETYPE Type,
581                                  DWORD *pValue );
582
583HRESULT NINE_WINAPI
584NineDevice9_SetTextureStageState( struct NineDevice9 *This,
585                                  DWORD Stage,
586                                  D3DTEXTURESTAGESTATETYPE Type,
587                                  DWORD Value );
588
589HRESULT NINE_WINAPI
590NineDevice9_GetSamplerState( struct NineDevice9 *This,
591                             DWORD Sampler,
592                             D3DSAMPLERSTATETYPE Type,
593                             DWORD *pValue );
594
595HRESULT NINE_WINAPI
596NineDevice9_SetSamplerState( struct NineDevice9 *This,
597                             DWORD Sampler,
598                             D3DSAMPLERSTATETYPE Type,
599                             DWORD Value );
600
601HRESULT NINE_WINAPI
602NineDevice9_ValidateDevice( struct NineDevice9 *This,
603                            DWORD *pNumPasses );
604
605HRESULT NINE_WINAPI
606NineDevice9_SetPaletteEntries( struct NineDevice9 *This,
607                               UINT PaletteNumber,
608                               const PALETTEENTRY *pEntries );
609
610HRESULT NINE_WINAPI
611NineDevice9_GetPaletteEntries( struct NineDevice9 *This,
612                               UINT PaletteNumber,
613                               PALETTEENTRY *pEntries );
614
615HRESULT NINE_WINAPI
616NineDevice9_SetCurrentTexturePalette( struct NineDevice9 *This,
617                                      UINT PaletteNumber );
618
619HRESULT NINE_WINAPI
620NineDevice9_GetCurrentTexturePalette( struct NineDevice9 *This,
621                                      UINT *PaletteNumber );
622
623HRESULT NINE_WINAPI
624NineDevice9_SetScissorRect( struct NineDevice9 *This,
625                            const RECT *pRect );
626
627HRESULT NINE_WINAPI
628NineDevice9_GetScissorRect( struct NineDevice9 *This,
629                            RECT *pRect );
630
631HRESULT NINE_WINAPI
632NineDevice9_SetSoftwareVertexProcessing( struct NineDevice9 *This,
633                                         BOOL bSoftware );
634
635BOOL NINE_WINAPI
636NineDevice9_GetSoftwareVertexProcessing( struct NineDevice9 *This );
637
638HRESULT NINE_WINAPI
639NineDevice9_SetNPatchMode( struct NineDevice9 *This,
640                           float nSegments );
641
642float NINE_WINAPI
643NineDevice9_GetNPatchMode( struct NineDevice9 *This );
644
645HRESULT NINE_WINAPI
646NineDevice9_DrawPrimitive( struct NineDevice9 *This,
647                           D3DPRIMITIVETYPE PrimitiveType,
648                           UINT StartVertex,
649                           UINT PrimitiveCount );
650
651HRESULT NINE_WINAPI
652NineDevice9_DrawIndexedPrimitive( struct NineDevice9 *This,
653                                  D3DPRIMITIVETYPE PrimitiveType,
654                                  INT BaseVertexIndex,
655                                  UINT MinVertexIndex,
656                                  UINT NumVertices,
657                                  UINT startIndex,
658                                  UINT primCount );
659
660HRESULT NINE_WINAPI
661NineDevice9_DrawPrimitiveUP( struct NineDevice9 *This,
662                             D3DPRIMITIVETYPE PrimitiveType,
663                             UINT PrimitiveCount,
664                             const void *pVertexStreamZeroData,
665                             UINT VertexStreamZeroStride );
666
667HRESULT NINE_WINAPI
668NineDevice9_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
678HRESULT NINE_WINAPI
679NineDevice9_ProcessVertices( struct NineDevice9 *This,
680                             UINT SrcStartIndex,
681                             UINT DestIndex,
682                             UINT VertexCount,
683                             IDirect3DVertexBuffer9 *pDestBuffer,
684                             IDirect3DVertexDeclaration9 *pVertexDecl,
685                             DWORD Flags );
686
687HRESULT NINE_WINAPI
688NineDevice9_CreateVertexDeclaration( struct NineDevice9 *This,
689                                     const D3DVERTEXELEMENT9 *pVertexElements,
690                                     IDirect3DVertexDeclaration9 **ppDecl );
691
692HRESULT NINE_WINAPI
693NineDevice9_SetVertexDeclaration( struct NineDevice9 *This,
694                                  IDirect3DVertexDeclaration9 *pDecl );
695
696HRESULT NINE_WINAPI
697NineDevice9_GetVertexDeclaration( struct NineDevice9 *This,
698                                  IDirect3DVertexDeclaration9 **ppDecl );
699
700HRESULT NINE_WINAPI
701NineDevice9_SetFVF( struct NineDevice9 *This,
702                    DWORD FVF );
703
704HRESULT NINE_WINAPI
705NineDevice9_GetFVF( struct NineDevice9 *This,
706                    DWORD *pFVF );
707
708HRESULT NINE_WINAPI
709NineDevice9_CreateVertexShader( struct NineDevice9 *This,
710                                const DWORD *pFunction,
711                                IDirect3DVertexShader9 **ppShader );
712
713HRESULT NINE_WINAPI
714NineDevice9_SetVertexShader( struct NineDevice9 *This,
715                             IDirect3DVertexShader9 *pShader );
716
717HRESULT NINE_WINAPI
718NineDevice9_GetVertexShader( struct NineDevice9 *This,
719                             IDirect3DVertexShader9 **ppShader );
720
721HRESULT NINE_WINAPI
722NineDevice9_SetVertexShaderConstantF( struct NineDevice9 *This,
723                                      UINT StartRegister,
724                                      const float *pConstantData,
725                                      UINT Vector4fCount );
726
727HRESULT NINE_WINAPI
728NineDevice9_GetVertexShaderConstantF( struct NineDevice9 *This,
729                                      UINT StartRegister,
730                                      float *pConstantData,
731                                      UINT Vector4fCount );
732
733HRESULT NINE_WINAPI
734NineDevice9_SetVertexShaderConstantI( struct NineDevice9 *This,
735                                      UINT StartRegister,
736                                      const int *pConstantData,
737                                      UINT Vector4iCount );
738
739HRESULT NINE_WINAPI
740NineDevice9_GetVertexShaderConstantI( struct NineDevice9 *This,
741                                      UINT StartRegister,
742                                      int *pConstantData,
743                                      UINT Vector4iCount );
744
745HRESULT NINE_WINAPI
746NineDevice9_SetVertexShaderConstantB( struct NineDevice9 *This,
747                                      UINT StartRegister,
748                                      const BOOL *pConstantData,
749                                      UINT BoolCount );
750
751HRESULT NINE_WINAPI
752NineDevice9_GetVertexShaderConstantB( struct NineDevice9 *This,
753                                      UINT StartRegister,
754                                      BOOL *pConstantData,
755                                      UINT BoolCount );
756
757HRESULT NINE_WINAPI
758NineDevice9_SetStreamSource( struct NineDevice9 *This,
759                             UINT StreamNumber,
760                             IDirect3DVertexBuffer9 *pStreamData,
761                             UINT OffsetInBytes,
762                             UINT Stride );
763
764HRESULT NINE_WINAPI
765NineDevice9_GetStreamSource( struct NineDevice9 *This,
766                             UINT StreamNumber,
767                             IDirect3DVertexBuffer9 **ppStreamData,
768                             UINT *pOffsetInBytes,
769                             UINT *pStride );
770
771HRESULT NINE_WINAPI
772NineDevice9_SetStreamSourceFreq( struct NineDevice9 *This,
773                                 UINT StreamNumber,
774                                 UINT Setting );
775
776HRESULT NINE_WINAPI
777NineDevice9_GetStreamSourceFreq( struct NineDevice9 *This,
778                                 UINT StreamNumber,
779                                 UINT *pSetting );
780
781HRESULT NINE_WINAPI
782NineDevice9_SetIndices( struct NineDevice9 *This,
783                        IDirect3DIndexBuffer9 *pIndexData );
784
785HRESULT NINE_WINAPI
786NineDevice9_GetIndices( struct NineDevice9 *This,
787                        IDirect3DIndexBuffer9 **ppIndexData /*,
788                        UINT *pBaseVertexIndex */ );
789
790HRESULT NINE_WINAPI
791NineDevice9_CreatePixelShader( struct NineDevice9 *This,
792                               const DWORD *pFunction,
793                               IDirect3DPixelShader9 **ppShader );
794
795HRESULT NINE_WINAPI
796NineDevice9_SetPixelShader( struct NineDevice9 *This,
797                            IDirect3DPixelShader9 *pShader );
798
799HRESULT NINE_WINAPI
800NineDevice9_GetPixelShader( struct NineDevice9 *This,
801                            IDirect3DPixelShader9 **ppShader );
802
803HRESULT NINE_WINAPI
804NineDevice9_SetPixelShaderConstantF( struct NineDevice9 *This,
805                                     UINT StartRegister,
806                                     const float *pConstantData,
807                                     UINT Vector4fCount );
808
809HRESULT NINE_WINAPI
810NineDevice9_GetPixelShaderConstantF( struct NineDevice9 *This,
811                                     UINT StartRegister,
812                                     float *pConstantData,
813                                     UINT Vector4fCount );
814
815HRESULT NINE_WINAPI
816NineDevice9_SetPixelShaderConstantI( struct NineDevice9 *This,
817                                     UINT StartRegister,
818                                     const int *pConstantData,
819                                     UINT Vector4iCount );
820
821HRESULT NINE_WINAPI
822NineDevice9_GetPixelShaderConstantI( struct NineDevice9 *This,
823                                     UINT StartRegister,
824                                     int *pConstantData,
825                                     UINT Vector4iCount );
826
827HRESULT NINE_WINAPI
828NineDevice9_SetPixelShaderConstantB( struct NineDevice9 *This,
829                                     UINT StartRegister,
830                                     const BOOL *pConstantData,
831                                     UINT BoolCount );
832
833HRESULT NINE_WINAPI
834NineDevice9_GetPixelShaderConstantB( struct NineDevice9 *This,
835                                     UINT StartRegister,
836                                     BOOL *pConstantData,
837                                     UINT BoolCount );
838
839HRESULT NINE_WINAPI
840NineDevice9_DrawRectPatch( struct NineDevice9 *This,
841                           UINT Handle,
842                           const float *pNumSegs,
843                           const D3DRECTPATCH_INFO *pRectPatchInfo );
844
845HRESULT NINE_WINAPI
846NineDevice9_DrawTriPatch( struct NineDevice9 *This,
847                          UINT Handle,
848                          const float *pNumSegs,
849                          const D3DTRIPATCH_INFO *pTriPatchInfo );
850
851HRESULT NINE_WINAPI
852NineDevice9_DeletePatch( struct NineDevice9 *This,
853                         UINT Handle );
854
855HRESULT NINE_WINAPI
856NineDevice9_CreateQuery( struct NineDevice9 *This,
857                         D3DQUERYTYPE Type,
858                         IDirect3DQuery9 **ppQuery );
859
860#endif /* _NINE_DEVICE9_H_ */
861