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