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