/* Copyright 2001 TransGaming Technologies Inc. */

#ifndef __WINE_D3D8_PRIVATE_H
#define __WINE_D3D8_PRIVATE_H

#ifdef DDRAW_SAVE_AND_RESTORE_FPU_HACK
#include "wine/d3d_fpuctl.h"
#endif

#include "winuser.h"
#include "ddrawi.h"

#include "d3dtypes.h"
#include "d3dcaps.h"
#include "d3dhal.h"
#include "wine/d3dhalp.h"

/* If you want to have experimental AGP memory allocation define this */
/* #define WINE_D3D8_ENABLE_HAL_ALLOCATE_AGP_MEM_FULL */
#define WINE_D3D8_ENABLE_HAL_ALLOCATE_AGP_MEM 

typedef struct IDirect3D8Impl IDirect3D8Impl;
typedef struct IDirect3DDevice8Impl IDirect3DDevice8Impl;
typedef struct IDirect3DResource8Impl IDirect3DResource8Impl;
typedef struct IDirect3DBaseTexture8Impl IDirect3DBaseTexture8Impl;
typedef struct IDirect3DTexture8Impl IDirect3DTexture8Impl;
typedef struct IDirect3DVolumeTexture8Impl IDirect3DVolumeTexture8Impl;
typedef struct IDirect3DCubeTexture8Impl IDirect3DCubeTexture8Impl;
typedef struct IDirect3DVertexBuffer8Impl IDirect3DVertexBuffer8Impl;
typedef struct IDirect3DIndexBuffer8Impl IDirect3DIndexBuffer8Impl;
typedef struct IDirect3DSurface8Impl IDirect3DSurface8Impl;

typedef struct D3D8StateBlock {
  DWORD state_block; /* driver's state block */
  DWORD dirty_tex, dirty_stream;
  BOOL dirty_indices;
  LPDIRECT3DBASETEXTURE8 tex[8];
  LPDIRECT3DVERTEXBUFFER8 streamsource[16];
  UINT streamstride[16];
  LPDIRECT3DINDEXBUFFER8 indices;
  UINT baseindex;
} D3D8StateBlock;

typedef struct D3D8Palette {
  DDRAWI_DDRAWPALETTE_LCL local;
  DDRAWI_DDRAWPALETTE_GBL global;
  DDRAWI_DDRAWPALETTE_INT inter;
} D3D8Palette;

struct IDirect3D8Impl {
  ICOM_VFIELD(IDirect3D8);

  DWORD ref;
};

struct IDirect3DDevice8Impl {
  ICOM_VFIELD(IDirect3DDevice8);

  DWORD ref;
  IDirect3D8Impl* parent;
  D3DCAPS8* caps;

  DDRAWI_DIRECTDRAW_LCL local;

  LPVOID ip_ctx;

  D3D_P d3dp;

  D3DDISPLAYMODE mode;

  D3D8StateBlock state, *current;

  DWORD curpalette, numpalettes;
  D3D8Palette **palette;

  BOOL dirty_textures;

  void WINAPI (*demolish_texture)(LPVOID ctx, DWORD dwTexture);

  HRESULT WINAPI (*alloc_state_block)(LPVOID ctx, LPDWORD lpdwBlock);
  HRESULT WINAPI (*free_state_block)(LPVOID ctx, DWORD dwBlock);

  HRESULT WINAPI (*start_dp2)(LPVOID ctx, DWORD dwFlags,
                              DWORD dwVertexType, LPVOID lpVertices,
                              DWORD dwVertexOffset, DWORD dwVertexLength,
                              DWORD dwReqVertexBufSize, DWORD dwReqCommandBufSize);
  HRESULT WINAPI (*start_dp2_sd)(LPVOID ctx, DWORD dwFlags,
                                 DWORD dwVertexType, LPVOID lpVertices,
                                 DWORD dwVertexOffset, DWORD dwVertexLength,
                                 DWORD dwReqVertexBufSize, DWORD dwReqCommandBufSize,
                                 LPD3DDRAWPRIMITIVESTRIDEDDATA lpStridedData);
  HRESULT WINAPI (*emit_dp2)(LPVOID ctx, LPD3DHAL_DP2COMMAND cmd,
                             LPVOID data1, DWORD dwSize1,
                             LPVOID data2, DWORD dwSize2);
  HRESULT WINAPI (*flush_dp2)(LPVOID ctx);

  HRESULT WINAPI (*validate_device)(LPVOID ctx, LPDWORD lpdwPasses);

  BOOL windowed, auto_zbuffer;
  WNDPROC old_wndproc;
  DWORD old_style;
  DWORD behavior;

  IDirect3DSurface8* primary;
  IDirect3DSurface8* backbuf;
  IDirect3DSurface8* zbuffer;
  IDirect3DSurface8* target;
  IDirect3DSurface8* ztarget;

  HDC mem_dc;
  HBITMAP old_bmp;

  D3DGAMMARAMP orig_gamma;

  IDirect3DBaseTexture8Impl *textures;
  VertexShader *vshaders;
  
#if defined( DDRAW_SAVE_AND_RESTORE_FPU_HACK )
  fpu_control_t fpucw; /* FPU control word - saved while in a scene */
#endif
};

struct IDirect3DResource8Impl {
  LPVOID fake_vtbl;
    
  DWORD ref;
  IDirect3DDevice8Impl* parent;
  DWORD intref;
}; 

struct IDirect3DBaseTexture8Impl {
  ICOM_VFIELD(IDirect3DBaseTexture8);

  DWORD ref;
  IDirect3DDevice8Impl* parent;
  DWORD intref;
  
  IDirect3DBaseTexture8Impl *prev_device;
  IDirect3DBaseTexture8Impl *next_device;

  BOOL IsDirty;
  LPDIRECT3DSURFACE8 main;
  HRESULT (*AddDirtyRect)(IDirect3DBaseTexture8Impl*, LPDIRECT3DSURFACE8, CONST RECT*);
  HRESULT (*UpdateTexture)(IDirect3DBaseTexture8Impl*, IDirect3DBaseTexture8Impl*);
  HRESULT (*UnloadTexture)(IDirect3DBaseTexture8Impl*);
};

#define TEXTURE_HANDLE(This) ((DWORD)&((IDirect3DSurface8Impl*)(This)->main)->t)

struct IDirect3DTexture8Impl {
  ICOM_VFIELD(IDirect3DTexture8);

  DWORD ref;
  IDirect3DDevice8Impl* parent;
  DWORD intref;

  IDirect3DBaseTexture8Impl *prev_device;
  IDirect3DBaseTexture8Impl *next_device;

  BOOL IsDirty;
  LPDIRECT3DSURFACE8 main;
  HRESULT (*AddDirtyRect)(IDirect3DTexture8Impl* This, LPDIRECT3DSURFACE8 surf, CONST RECT* pDirtyRect);
  HRESULT (*UpdateTexture)(IDirect3DTexture8Impl* This, IDirect3DTexture8Impl* pDest);
  HRESULT (*UnloadTexture)(IDirect3DTexture8Impl*);

  UINT Width, Height, Levels;
  DWORD Usage;
  D3DFORMAT Format;
  RECT DirtyRect;

  LPDIRECT3DSURFACE8 surf[1];
};

#if 0
struct IDirect3DVolumeTexture8Impl {
  ICOM_VFIELD(IDirect3DVolumeTexture8);

  DWORD ref;
  IDirect3DDevice8Impl* parent;
  DWORD intref;

  IDirect3DBaseTexture8Impl *prev_device;
  IDirect3DBaseTexture8Impl *next_device;

  BOOL IsDirty;
  LPDIRECT3DVOLUME8 main;
  HRESULT (*AddDirtyRect)(IDirect3DVolumeTexture8Impl* This, LPDIRECT3DSURFACE8 surf, CONST RECT* pDirtyRect);
  HRESULT (*UpdateTexture)(IDirect3DVolumeTexture8Impl* This, IDirect3DVolumeTexture8Impl* pDest);
  HRESULT (*UnloadTexture)(IDirect3DVolumeTexture8Impl*);

  UINT Width, Height, Depth, Levels;
  DWORD Usage;
  D3DFORMAT Format;
  D3DBOX DirtyBox;

  LPDIRECT3DVOLUME8 vol[1];
};
#endif

struct IDirect3DCubeTexture8Impl {
  ICOM_VFIELD(IDirect3DCubeTexture8);

  DWORD ref;
  IDirect3DDevice8Impl* parent;
  DWORD intref;

  IDirect3DBaseTexture8Impl *prev_device;
  IDirect3DBaseTexture8Impl *next_device;

  BOOL IsDirty;
  LPDIRECT3DSURFACE8 main;
  HRESULT (*AddDirtyRect)(IDirect3DCubeTexture8Impl* This, LPDIRECT3DSURFACE8 surf, CONST RECT* pDirtyRect);
  HRESULT (*UpdateTexture)(IDirect3DCubeTexture8Impl* This, IDirect3DCubeTexture8Impl* pDest);
  HRESULT (*UnloadTexture)(IDirect3DCubeTexture8Impl*);

  UINT EdgeLength, Levels;
  DWORD Usage;
  D3DFORMAT Format;
  RECT DirtyRect[6];

  LPDIRECT3DSURFACE8 surf[1];
};

struct IDirect3DVertexBuffer8Impl {
  ICOM_VFIELD(IDirect3DVertexBuffer8);

  DWORD ref;
  IDirect3DDevice8Impl* parent;
  DWORD intref;

  LPBYTE ptr;
  DWORD Usage;

  D3D_T t;

  DDSURFACEDESC2 surface_desc;
};

struct IDirect3DIndexBuffer8Impl {
  ICOM_VFIELD(IDirect3DIndexBuffer8);

  DWORD ref;
  IDirect3DDevice8Impl* parent;
  DWORD intref;

  LPBYTE ptr;
  D3DFORMAT Format;
  DWORD Usage;

  D3D_T t;
};

struct IDirect3DSurface8Impl {
  ICOM_VFIELD(IDirect3DSurface8);

  DWORD ref;
  IDirect3DDevice8Impl* parent;

  DWORD intref;
  LPUNKNOWN container;
  HBITMAP dib;
  BOOL own_memory;
  UINT Pitch;
  D3DFORMAT Format;

  D3D_T t;

  DDSURFACEDESC2 surface_desc;

  ATTACHLIST sibling;
};

extern HANDLE buffer_heap, surface_heap;
extern BOOL dx8_hal;

ULONG WINAPI IDirect3DResource8_AddRefInternal(LPDIRECT3DRESOURCE8 iface);
ULONG WINAPI IDirect3DResource8_ReleaseInternal(LPDIRECT3DRESOURCE8 iface);

/* surface.c */
D3DFORMAT D3D8_FindPixelFormat(LPDDPIXELFORMAT pfmt);
void D3D8_GetPixelFormat(LPDDPIXELFORMAT pfmt, D3DFORMAT fmt);
HRESULT WINAPI Direct3DDevice8_CreateSurface(LPDIRECT3DDEVICE8 iface,
					     LPUNKNOWN container,
					     UINT Width,
					     UINT Height,
					     D3DFORMAT Format,
					     DDSCAPS2* ddsCaps,
					     IDirect3DSurface8** ppSurface,
					     BOOL internal);
HRESULT WINAPI Direct3DDevice8_AttachSurface(IDirect3DSurface8* pParent,
					     IDirect3DSurface8* pChild);
HRESULT WINAPI Direct3DDevice8_CreateRenderTarget(LPDIRECT3DDEVICE8 iface,
						  UINT Width,
						  UINT Height,
						  D3DFORMAT Format,
						  D3DMULTISAMPLE_TYPE MultiSample,
						  BOOL Lockable,
						  IDirect3DSurface8** ppSurface);
HRESULT WINAPI Direct3DDevice8_CreateDepthStencilSurface(LPDIRECT3DDEVICE8 iface,
							 UINT Width,
							 UINT Height,
							 D3DFORMAT Format,
							 D3DMULTISAMPLE_TYPE MultiSample,
							 IDirect3DSurface8** ppSurface);
HRESULT WINAPI Direct3DDevice8_CreateImageSurface(LPDIRECT3DDEVICE8 iface,
						  UINT Width,
						  UINT Height,
						  D3DFORMAT Format,
						  IDirect3DSurface8** ppSurface);

/* texture.c */
HRESULT WINAPI Direct3DDevice8_CreateTexture(LPDIRECT3DDEVICE8 iface,
					     UINT Width,
					     UINT Height,
					     UINT Levels,
					     DWORD Usage,
					     D3DFORMAT Format,
					     D3DPOOL Pool,
					     IDirect3DTexture8** ppTexture);
HRESULT WINAPI Direct3DBaseTexture8_UpdateTexture(IDirect3DDevice8Impl* dev,
						  UINT Width, UINT Height, UINT Levels,
						  UINT Skip, RECT* pDirtyRect, BOOL force,
						  LPDIRECT3DSURFACE8* src, LPDIRECT3DSURFACE8* dst);

/* cubetex.c */
HRESULT WINAPI Direct3DDevice8_CreateCubeTexture(LPDIRECT3DDEVICE8 iface,
						 UINT EdgeLength,
						 UINT Levels,
						 DWORD Usage,
						 D3DFORMAT Format,
						 D3DPOOL Pool,
						 IDirect3DCubeTexture8** ppTexture);
VOID WINAPI Direct3DCubeTexture8_UpdateDirty(LPDIRECT3DCUBETEXTURE8 iface, BOOL force);

/* vbuffer.c */
HRESULT WINAPI Direct3DDevice8_CreateVertexBuffer(LPDIRECT3DDEVICE8 iface,
						  UINT Length,
						  DWORD Usage,
						  DWORD FVF,
						  D3DPOOL Pool,
						  IDirect3DVertexBuffer8** ppVertexBuffer);

/* ibuffer.c */
HRESULT WINAPI Direct3DDevice8_CreateIndexBuffer(LPDIRECT3DDEVICE8 iface,
						 UINT Length,
						 DWORD Usage,
						 D3DFORMAT Format,
						 D3DPOOL Pool,
						 IDirect3DIndexBuffer8** ppIndexBuffer);

/* vshader.c */
HRESULT WINAPI Direct3DDevice8_CreateVertexShader(LPDIRECT3DDEVICE8 iface,
						  CONST DWORD* pDeclaration,
						  CONST DWORD* pFunction,
						  DWORD* pHandle,
						  DWORD Usage);
HRESULT WINAPI Direct3DDevice8_SetVertexShader(LPDIRECT3DDEVICE8 iface,
					       DWORD Handle);
HRESULT WINAPI Direct3DDevice8_GetVertexShader(LPDIRECT3DDEVICE8 iface,
					       DWORD* pHandle);
HRESULT WINAPI Direct3DDevice8_DeleteVertexShader(LPDIRECT3DDEVICE8 iface,
						  DWORD Handle);
HRESULT WINAPI Direct3DDevice8_SetVertexShaderConstant(LPDIRECT3DDEVICE8 iface,
						       DWORD Register,
						       CONST void* pConstantData,
						       DWORD ConstantCount);
HRESULT WINAPI Direct3DDevice8_GetVertexShaderConstant(LPDIRECT3DDEVICE8 iface,
						       DWORD Register,
						       void * pConstantData,
						       DWORD ConstantCount);
HRESULT WINAPI Direct3DDevice8_GetVertexShaderDeclaration(LPDIRECT3DDEVICE8 iface,
							  DWORD Handle,
							  void* pData,
							  DWORD* pSizeOfData);
HRESULT WINAPI Direct3DDevice8_GetVertexShaderFunction(LPDIRECT3DDEVICE8 iface,
						       DWORD Handle,
						       void* pData,
						       DWORD* pSizeOfData);
HRESULT WINAPI Direct3DDevice8_GetStridedData(LPDIRECT3DDEVICE8 iface,
					      LPD3DDRAWPRIMITIVESTRIDEDDATA lpData);
HRESULT WINAPI Direct3DDevice8_GetStridedDataUP(LPDIRECT3DDEVICE8 iface,
						LPD3DDRAWPRIMITIVESTRIDEDDATA lpData,
						CONST void* vertex_data,
						UINT vertex_stride,
						BOOL verify_stride);

/* pshader.c */
HRESULT WINAPI Direct3DDevice8_SetPixelShader(LPDIRECT3DDEVICE8 iface,
					      DWORD Handle);
HRESULT WINAPI Direct3DDevice8_GetPixelShader(LPDIRECT3DDEVICE8 iface,
					      DWORD* pHandle);
HRESULT WINAPI Direct3DDevice8_SetPixelShaderConstant(LPDIRECT3DDEVICE8 iface,
						      DWORD Register,
						      CONST void* pConstantData,
						      DWORD ConstantCount);

/* state.c */
HRESULT WINAPI Direct3DDevice8_SetTransform(LPDIRECT3DDEVICE8 iface,
					    D3DTRANSFORMSTATETYPE dtstType,
					    CONST D3DMATRIX* lpD3DMatrix);
HRESULT WINAPI Direct3DDevice8_GetTransform(LPDIRECT3DDEVICE8 iface,
					    D3DTRANSFORMSTATETYPE dtstType,
					    D3DMATRIX* lpD3DMatrix);
HRESULT WINAPI Direct3DDevice8_SetViewport(LPDIRECT3DDEVICE8 iface,
					   CONST D3DVIEWPORT8* lpData);
HRESULT WINAPI Direct3DDevice8_GetViewport(LPDIRECT3DDEVICE8 iface,
					   D3DVIEWPORT8* lpData);
HRESULT WINAPI Direct3DDevice8_SetMaterial(LPDIRECT3DDEVICE8 iface,
					   CONST D3DMATERIAL8* lpMat);
HRESULT WINAPI Direct3DDevice8_GetMaterial(LPDIRECT3DDEVICE8 iface,
					   D3DMATERIAL8* lpMat);
HRESULT WINAPI Direct3DDevice8_SetLight(LPDIRECT3DDEVICE8 iface,
					DWORD dwIndex,
					CONST D3DLIGHT8* lpLight);
HRESULT WINAPI Direct3DDevice8_GetLight(LPDIRECT3DDEVICE8 iface,
					DWORD dwIndex,
					D3DLIGHT8* lpLight);
HRESULT WINAPI Direct3DDevice8_LightEnable(LPDIRECT3DDEVICE8 iface,
					   DWORD dwIndex,
					   BOOL bEnable);
HRESULT WINAPI Direct3DDevice8_GetLightEnable(LPDIRECT3DDEVICE8 iface,
					      DWORD dwIndex,
					      LPBOOL lpbEnable);
HRESULT WINAPI Direct3DDevice8_SetClipPlane(LPDIRECT3DDEVICE8 iface,
					    DWORD dwIndex,
					    CONST float* pPlane);
HRESULT WINAPI Direct3DDevice8_GetClipPlane(LPDIRECT3DDEVICE8 iface,
					    DWORD dwIndex,
					    float* pPlane);
HRESULT WINAPI Direct3DDevice8_SetRenderState(LPDIRECT3DDEVICE8 iface,
					      D3DRENDERSTATETYPE d3dType,
					      DWORD dwState);
HRESULT WINAPI Direct3DDevice8_GetRenderState(LPDIRECT3DDEVICE8 iface,
					      D3DRENDERSTATETYPE d3dType,
					      LPDWORD lpdwState);
HRESULT WINAPI Direct3DDevice8_BeginStateBlock(LPDIRECT3DDEVICE8 iface);
HRESULT WINAPI Direct3DDevice8_EndStateBlock(LPDIRECT3DDEVICE8 iface,
					     LPDWORD lpdwBlock);
HRESULT WINAPI Direct3DDevice8_ApplyStateBlock(LPDIRECT3DDEVICE8 iface,
					       DWORD dwBlock);
HRESULT WINAPI Direct3DDevice8_CaptureStateBlock(LPDIRECT3DDEVICE8 iface,
						 DWORD dwBlock);
HRESULT WINAPI Direct3DDevice8_DeleteStateBlock(LPDIRECT3DDEVICE8 iface,
						DWORD dwBlock);
HRESULT WINAPI Direct3DDevice8_CreateStateBlock(LPDIRECT3DDEVICE8 iface,
						D3DSTATEBLOCKTYPE type, DWORD *pToken);
HRESULT WINAPI Direct3DDevice8_GetTexture(LPDIRECT3DDEVICE8 iface,
					  DWORD dwStage,
					  LPDIRECT3DBASETEXTURE8* lplpTexture);
HRESULT WINAPI Direct3DDevice8_SetTexture(LPDIRECT3DDEVICE8 iface,
					  DWORD dwStage,
					  LPDIRECT3DBASETEXTURE8 lpTexture);
HRESULT WINAPI Direct3DDevice8_GetTextureStageState(LPDIRECT3DDEVICE8 iface,
						    DWORD dwStage,
						    D3DTEXTURESTAGESTATETYPE d3dType,
						    LPDWORD lpdwState);
HRESULT WINAPI Direct3DDevice8_SetTextureStageState(LPDIRECT3DDEVICE8 iface,
						    DWORD dwStage,
						    D3DTEXTURESTAGESTATETYPE d3dType,
						    DWORD dwState);
HRESULT WINAPI Direct3DDevice8_ValidateDevice(LPDIRECT3DDEVICE8 iface,
					      DWORD* pNumPasses);
HRESULT WINAPI Direct3DDevice8_SetStreamSource(LPDIRECT3DDEVICE8 iface,
					       UINT StreamNumber,
					       LPDIRECT3DVERTEXBUFFER8 pStreamData,
					       UINT Stride);
HRESULT WINAPI Direct3DDevice8_GetStreamSource(LPDIRECT3DDEVICE8 iface,
					       UINT StreamNumber,
					       LPDIRECT3DVERTEXBUFFER8* ppStreamData,
					       UINT* pStride);
HRESULT WINAPI Direct3DDevice8_SetIndices(LPDIRECT3DDEVICE8 iface,
					  LPDIRECT3DINDEXBUFFER8 pIndexData,
					  UINT BaseIndex);
HRESULT WINAPI Direct3DDevice8_GetIndices(LPDIRECT3DDEVICE8 iface,
					  LPDIRECT3DINDEXBUFFER8* ppIndexData,
					  UINT* pBaseIndex);

/* draw.c */
HRESULT WINAPI Direct3DDevice8_Present(LPDIRECT3DDEVICE8 iface,
				       CONST RECT* pSourceRect,
				       CONST RECT* pDestRect,
				       HWND hDestWindowOverride,
				       CONST RGNDATA* pDirtyRegion);
VOID WINAPI Direct3DDevice8_SetGammaRamp(LPDIRECT3DDEVICE8 iface,
					 DWORD Flags,
					 CONST D3DGAMMARAMP* pRamp);
VOID WINAPI Direct3DDevice8_GetGammaRamp(LPDIRECT3DDEVICE8 iface,
					 D3DGAMMARAMP* pRamp);
HRESULT WINAPI Direct3DDevice8_CopyRects(LPDIRECT3DDEVICE8 iface,
					 IDirect3DSurface8* pSourceSurface,
					 CONST RECT* pSourceRectsArray,
					 UINT cRects,
					 IDirect3DSurface8* pDestSurface,
					 CONST POINT* pDestPointsArray);
HRESULT WINAPI Direct3DDevice8_UpdateTexture(LPDIRECT3DDEVICE8 iface,
                                             IDirect3DBaseTexture8* pSourceTexture,
                                             IDirect3DBaseTexture8* pDestinationTexture);
HRESULT WINAPI Direct3DDevice8_BeginScene(LPDIRECT3DDEVICE8 iface);
HRESULT WINAPI Direct3DDevice8_EndScene(LPDIRECT3DDEVICE8 iface);
HRESULT WINAPI Direct3DDevice8_Clear(LPDIRECT3DDEVICE8 iface, DWORD dwCount,
				     CONST D3DRECT* lpRects, DWORD dwFlags,
				     D3DCOLOR dwColor, D3DVALUE dvZ,
				     DWORD dwStencil);
HRESULT WINAPI Direct3DDevice8_DrawPrimitive(LPDIRECT3DDEVICE8 iface,
					     D3DPRIMITIVETYPE PrimType,
					     UINT StartVertex,
					     UINT PrimitiveCount);
HRESULT WINAPI Direct3DDevice8_DrawIndexedPrimitive(LPDIRECT3DDEVICE8 iface,
						    D3DPRIMITIVETYPE PrimType,
						    UINT MinIndex,
						    UINT NumVertices,
						    UINT StartIndex,
						    UINT PrimitiveCount);
HRESULT WINAPI Direct3DDevice8_DrawPrimitiveUP(LPDIRECT3DDEVICE8 iface,
					       D3DPRIMITIVETYPE PrimType,
					       UINT PrimitiveCount,
					       CONST void* vertex_data,
					       UINT vertex_stride);
HRESULT WINAPI Direct3DDevice8_DrawIndexedPrimitiveUP(LPDIRECT3DDEVICE8 iface,
						      D3DPRIMITIVETYPE PrimType,
						      UINT MinIndex,
						      UINT NumVertices,
						      UINT PrimitiveCount,
						      CONST void* index_data,
						      D3DFORMAT index_format,
						      CONST void* vertex_data,
						      UINT vertex_stride);

/* palette.c */
HRESULT WINAPI Direct3DDevice8_SetPaletteEntries(LPDIRECT3DDEVICE8 iface,
						 UINT PaletteNumber,
						 CONST PALETTEENTRY* pEntries);
HRESULT WINAPI Direct3DDevice8_GetPaletteEntries(LPDIRECT3DDEVICE8 iface,
						 UINT PaletteNumber,
						 PALETTEENTRY* pEntries);
HRESULT WINAPI Direct3DDevice8_SetCurrentTexturePalette(LPDIRECT3DDEVICE8 iface,
							UINT PaletteNumber);
HRESULT WINAPI Direct3DDevice8_GetCurrentTexturePalette(LPDIRECT3DDEVICE8 iface,
							UINT* pPaletteNumber);
HRESULT WINAPI Direct3DDevice8_DestroyPalettes(LPDIRECT3DDEVICE8 iface);

/* cursor.c */
HRESULT WINAPI Direct3DDevice8_SetCursorProperties(LPDIRECT3DDEVICE8 iface,
						   UINT XHotSpot,
						   UINT YHotSpot,
						   IDirect3DSurface8* pCursorBitmap);
VOID WINAPI Direct3DDevice8_SetCursorPosition(LPDIRECT3DDEVICE8 iface,
					      UINT XScreenSpace,
					      UINT YScreenSpace,
					      DWORD Flags);
BOOL WINAPI Direct3DDevice8_ShowCursor(LPDIRECT3DDEVICE8 iface,
				       BOOL bShow);

#endif
