📄 d3dhal.h
字号:
typedef D3DHAL_GETSTATEDATA *LPD3DHAL_GETSTATEDATA;
/* --------------------------------------------------------------
* Direct3D HAL Table.
* Instantiated by the HAL driver on connection.
*
* Calls take the form of:
* retcode = HalCall(HalCallData* lpData);
*/
typedef DWORD (__stdcall *LPD3DHAL_CONTEXTCREATECB) (LPD3DHAL_CONTEXTCREATEDATA);
typedef DWORD (__stdcall *LPD3DHAL_CONTEXTDESTROYCB) (LPD3DHAL_CONTEXTDESTROYDATA);
typedef DWORD (__stdcall *LPD3DHAL_CONTEXTDESTROYALLCB) (LPD3DHAL_CONTEXTDESTROYALLDATA);
typedef DWORD (__stdcall *LPD3DHAL_SCENECAPTURECB) (LPD3DHAL_SCENECAPTUREDATA);
typedef DWORD (__stdcall *LPD3DHAL_RENDERSTATECB) (LPD3DHAL_RENDERSTATEDATA);
typedef DWORD (__stdcall *LPD3DHAL_RENDERPRIMITIVECB) (LPD3DHAL_RENDERPRIMITIVEDATA);
typedef DWORD (__stdcall *LPD3DHAL_TEXTURECREATECB) (LPD3DHAL_TEXTURECREATEDATA);
typedef DWORD (__stdcall *LPD3DHAL_TEXTUREDESTROYCB) (LPD3DHAL_TEXTUREDESTROYDATA);
typedef DWORD (__stdcall *LPD3DHAL_TEXTURESWAPCB) (LPD3DHAL_TEXTURESWAPDATA);
typedef DWORD (__stdcall *LPD3DHAL_TEXTUREGETSURFCB) (LPD3DHAL_TEXTUREGETSURFDATA);
typedef DWORD (__stdcall *LPD3DHAL_GETSTATECB) (LPD3DHAL_GETSTATEDATA);
/*
* Regarding dwNumVertices, specify 0 if you are relying on the HEL to do
* everything and you do not need the resultant TLVertex buffer to reside
* in device memory.
* The HAL driver will be asked to allocate dwNumVertices + dwNumClipVertices
* in the case described above.
*/
typedef struct _D3DHAL_CALLBACKS
{
DWORD dwSize;
// Device context
LPD3DHAL_CONTEXTCREATECB ContextCreate;
LPD3DHAL_CONTEXTDESTROYCB ContextDestroy;
LPD3DHAL_CONTEXTDESTROYALLCB ContextDestroyAll;
// Scene Capture
LPD3DHAL_SCENECAPTURECB SceneCapture;
LPVOID lpReserved10; // Must be zero
LPVOID lpReserved11; // Must be zero
// Execution
LPD3DHAL_RENDERSTATECB RenderState;
LPD3DHAL_RENDERPRIMITIVECB RenderPrimitive;
DWORD dwReserved; // Must be zero
// Textures
LPD3DHAL_TEXTURECREATECB TextureCreate;
LPD3DHAL_TEXTUREDESTROYCB TextureDestroy;
LPD3DHAL_TEXTURESWAPCB TextureSwap;
LPD3DHAL_TEXTUREGETSURFCB TextureGetSurf;
LPVOID lpReserved12; // Must be zero
LPVOID lpReserved13; // Must be zero
LPVOID lpReserved14; // Must be zero
LPVOID lpReserved15; // Must be zero
LPVOID lpReserved16; // Must be zero
LPVOID lpReserved17; // Must be zero
LPVOID lpReserved18; // Must be zero
LPVOID lpReserved19; // Must be zero
LPVOID lpReserved20; // Must be zero
LPVOID lpReserved21; // Must be zero
// Pipeline state
LPD3DHAL_GETSTATECB GetState;
DWORD dwReserved0; // Must be zero
DWORD dwReserved1; // Must be zero
DWORD dwReserved2; // Must be zero
DWORD dwReserved3; // Must be zero
DWORD dwReserved4; // Must be zero
DWORD dwReserved5; // Must be zero
DWORD dwReserved6; // Must be zero
DWORD dwReserved7; // Must be zero
DWORD dwReserved8; // Must be zero
DWORD dwReserved9; // Must be zero
} D3DHAL_CALLBACKS;
typedef D3DHAL_CALLBACKS *LPD3DHAL_CALLBACKS;
#define D3DHAL_SIZE_V1 sizeof( D3DHAL_CALLBACKS )
typedef struct _D3DHAL_SETRENDERTARGETDATA
{
ULONG_PTR dwhContext; // in: Context handle
union
{
LPDIRECTDRAWSURFACE lpDDS; // in: new render target
LPDDRAWI_DDRAWSURFACE_LCL lpDDSLcl;
};
union
{
LPDIRECTDRAWSURFACE lpDDSZ; // in: new Z buffer
LPDDRAWI_DDRAWSURFACE_LCL lpDDSZLcl;
};
HRESULT ddrval; // out: Return value
} D3DHAL_SETRENDERTARGETDATA;
typedef D3DHAL_SETRENDERTARGETDATA FAR *LPD3DHAL_SETRENDERTARGETDATA;
typedef struct _D3DHAL_CLEARDATA
{
ULONG_PTR dwhContext; // in: Context handle
// dwFlags can contain D3DCLEAR_TARGET or D3DCLEAR_ZBUFFER
DWORD dwFlags; // in: surfaces to clear
DWORD dwFillColor; // in: Color value for rtarget
DWORD dwFillDepth; // in: Depth value for Z buffer
LPD3DRECT lpRects; // in: Rectangles to clear
DWORD dwNumRects; // in: Number of rectangles
HRESULT ddrval; // out: Return value
} D3DHAL_CLEARDATA;
typedef D3DHAL_CLEARDATA FAR *LPD3DHAL_CLEARDATA;
typedef struct _D3DHAL_DRAWONEPRIMITIVEDATA
{
ULONG_PTR dwhContext; // in: Context handle
DWORD dwFlags; // in: flags
D3DPRIMITIVETYPE PrimitiveType; // in: type of primitive to draw
union{
D3DVERTEXTYPE VertexType; // in: type of vertices
DWORD dwFVFControl; // in: FVF control DWORD
};
LPVOID lpvVertices; // in: pointer to vertices
DWORD dwNumVertices; // in: number of vertices
DWORD dwReserved; // in: reserved
HRESULT ddrval; // out: Return value
} D3DHAL_DRAWONEPRIMITIVEDATA;
typedef D3DHAL_DRAWONEPRIMITIVEDATA *LPD3DHAL_DRAWONEPRIMITIVEDATA;
typedef struct _D3DHAL_DRAWONEINDEXEDPRIMITIVEDATA
{
ULONG_PTR dwhContext; // in: Context handle
DWORD dwFlags; // in: flags word
// Primitive and vertex type
D3DPRIMITIVETYPE PrimitiveType; // in: primitive type
union{
D3DVERTEXTYPE VertexType; // in: vertex type
DWORD dwFVFControl; // in: FVF control DWORD
};
// Vertices
LPVOID lpvVertices; // in: vertex data
DWORD dwNumVertices; // in: vertex count
// Indices
LPWORD lpwIndices; // in: index data
DWORD dwNumIndices; // in: index count
HRESULT ddrval; // out: Return value
} D3DHAL_DRAWONEINDEXEDPRIMITIVEDATA;
typedef D3DHAL_DRAWONEINDEXEDPRIMITIVEDATA *LPD3DHAL_DRAWONEINDEXEDPRIMITIVEDATA;
typedef struct _D3DHAL_DRAWPRIMCOUNTS
{
WORD wNumStateChanges;
WORD wPrimitiveType;
WORD wVertexType;
WORD wNumVertices;
} D3DHAL_DRAWPRIMCOUNTS, *LPD3DHAL_DRAWPRIMCOUNTS;
typedef struct _D3DHAL_DRAWPRIMITIVESDATA
{
ULONG_PTR dwhContext; // in: Context handle
DWORD dwFlags;
//
// Data block:
//
// Consists of interleaved D3DHAL_DRAWPRIMCOUNTS, state change pairs,
// and primitive drawing commands.
//
// D3DHAL_DRAWPRIMCOUNTS: gives number of state change pairs and
// the information on the primitive to draw.
// wPrimitiveType is of type D3DPRIMITIVETYPE. Drivers
// must support all 7 of the primitive types specified
// in the DrawPrimitive API.
// Currently, wVertexType will always be D3DVT_TLVERTEX.
// If the wNumVertices member is 0, then the driver should
// return after doing the state changing. This is the
// terminator for the command stream.
// state change pairs: DWORD pairs specify the state changes that
// the driver should effect before drawing the primitive.
// wNumStateChanges can be 0, in which case the next primitive
// should be drawn without any state changes in between.
// If present, the state change pairs are NOT aligned, they
// immediately follow the PRIMCOUNTS structure.
// vertex data (if any): is 32-byte aligned.
//
// If a primcounts structure follows (i.e. if wNumVertices was nonzero
// in the previous one), then it will immediately follow the state
// changes or vertex data with no alignment padding.
//
LPVOID lpvData;
DWORD dwFVFControl; // in: FVF control DWORD
HRESULT ddrval; // out: Return value
} D3DHAL_DRAWPRIMITIVESDATA;
typedef D3DHAL_DRAWPRIMITIVESDATA *LPD3DHAL_DRAWPRIMITIVESDATA;
typedef DWORD (CALLBACK *LPD3DHAL_SETRENDERTARGETCB) (LPD3DHAL_SETRENDERTARGETDATA);
typedef DWORD (CALLBACK *LPD3DHAL_CLEARCB) (LPD3DHAL_CLEARDATA);
typedef DWORD (CALLBACK *LPD3DHAL_DRAWONEPRIMITIVECB) (LPD3DHAL_DRAWONEPRIMITIVEDATA);
typedef DWORD (CALLBACK *LPD3DHAL_DRAWONEINDEXEDPRIMITIVECB) (LPD3DHAL_DRAWONEINDEXEDPRIMITIVEDATA);
typedef DWORD (CALLBACK *LPD3DHAL_DRAWPRIMITIVESCB) (LPD3DHAL_DRAWPRIMITIVESDATA);
typedef struct _D3DHAL_CALLBACKS2
{
DWORD dwSize; // size of struct
DWORD dwFlags; // flags for callbacks
LPD3DHAL_SETRENDERTARGETCB SetRenderTarget;
LPD3DHAL_CLEARCB Clear;
LPD3DHAL_DRAWONEPRIMITIVECB DrawOnePrimitive;
LPD3DHAL_DRAWONEINDEXEDPRIMITIVECB DrawOneIndexedPrimitive;
LPD3DHAL_DRAWPRIMITIVESCB DrawPrimitives;
} D3DHAL_CALLBACKS2;
typedef D3DHAL_CALLBACKS2 *LPD3DHAL_CALLBACKS2;
#define D3DHAL_CALLBACKS2SIZE sizeof(D3DHAL_CALLBACKS2)
#define D3DHAL2_CB32_SETRENDERTARGET 0x00000001L
#define D3DHAL2_CB32_CLEAR 0x00000002L
#define D3DHAL2_CB32_DRAWONEPRIMITIVE 0x00000004L
#define D3DHAL2_CB32_DRAWONEINDEXEDPRIMITIVE 0x00000008L
#define D3DHAL2_CB32_DRAWPRIMITIVES 0x00000010L
/* --------------------------------------------------------------
* D3DCallbacks3 - queried with GetDriverInfo (GUID_D3DCallbacks3).
*
* Clear2 - enables stencil clears (exposed to the API in
* IDirect3DViewport3::Clear2
* ValidateTextureStageState - evaluates the context's current state (including
* multitexture) and returns an error if the hardware cannot
* accelerate the current state vector.
* DrawPrimitives2 - Renders primitives, and changes device state specified
* in the command buffer.
*
* Multitexture-aware drivers must implement both ValidateTextureStageState.
*/
typedef struct _D3DHAL_CLEAR2DATA
{
ULONG_PTR dwhContext; // in: Context handle
// dwFlags can contain D3DCLEAR_TARGET, D3DCLEAR_ZBUFFER, and/or D3DCLEAR_STENCIL
DWORD dwFlags; // in: surfaces to clear
DWORD dwFillColor; // in: Color value for rtarget
D3DVALUE dvFillDepth; // in: Depth value for Z buffer (0.0-1.0)
DWORD dwFillStencil; // in: value used to clear stencil buffer
LPD3DRECT lpRects; // in: Rectangles to clear
DWORD dwNumRects; // in: Number of rectangles
HRESULT ddrval; // out: Return value
} D3DHAL_CLEAR2DATA;
typedef D3DHAL_CLEAR2DATA FAR *LPD3DHAL_CLEAR2DATA;
typedef struct _D3DHAL_VALIDATETEXTURESTAGESTATEDATA
{
ULONG_PTR dwhContext; // in: Context handle
DWORD dwFlags; // in: Flags, currently set to 0
DWORD dwReserved; //
DWORD dwNumPasses;// out: Number of passes the hardware
// can perform the operation in
HRESULT ddrval; // out: return value
} D3DHAL_VALIDATETEXTURESTAGESTATEDATA;
typedef D3DHAL_VALIDATETEXTURESTAGESTATEDATA *LPD3DHAL_VALIDATETEXTURESTAGESTATEDATA;
//-----------------------------------------------------------------------------
// DrawPrimitives2 DDI
//-----------------------------------------------------------------------------
//
// Command structure for vertex buffer rendering
//
typedef struct _D3DHAL_DP2COMMAND
{
BYTE bCommand; // vertex command
BYTE bReserved;
union
{
WORD wPrimitiveCount; // primitive count for unconnected primitives
WORD wStateCount; // count of render states to follow
};
} D3DHAL_DP2COMMAND, *LPD3DHAL_DP2COMMAND;
//
// DrawPrimitives2 commands:
//
typedef enum _D3DHAL_DP2OPERATION
{
D3DDP2OP_POINTS = 1,
D3DDP2OP_INDEXEDLINELIST = 2,
D3DDP2OP_INDEXEDTRIANGLELIST = 3,
D3DDP2OP_RESERVED0 = 4, // Used by the front-end only
D3DDP2OP_RENDERSTATE = 8,
D3DDP2OP_LINELIST = 15,
D3DDP2OP_LINESTRIP = 16,
D3DDP2OP_INDEXEDLINESTRIP = 17,
D3DDP2OP_TRIANGLELIST = 18,
D3DDP2OP_TRIANGLESTRIP = 19,
D3DDP2OP_INDEXEDTRIANGLESTRIP = 20,
D3DDP2OP_TRIANGLEFAN = 21,
D3DDP2OP_INDEXEDTRIANGLEFAN = 22,
D3DDP2OP_TRIANGLEFAN_IMM = 23,
D3DDP2OP_LINELIST_IMM = 24,
D3DDP2OP_TEXTURESTAGESTATE = 25, // Has edge flags and called from Execute
D3DDP2OP_INDEXEDTRIANGLELIST2 = 26,
D3DDP2OP_INDEXEDLINELIST2 = 27,
D3DDP2OP_VIEWPORTINFO = 28,
D3DDP2OP_WINFO = 29,
// two below are for pre-DX7 interface apps running DX7 driver
D3DDP2OP_SETPALETTE = 30,
D3DDP2OP_UPDATEPALETTE = 31,
#if(DIRECT3D_VERSION >= 0x0700)
// New for DX7
D3DDP2OP_ZRANGE = 32,
D3DDP2OP_SETMATERIAL = 33,
D3DDP2OP_SETLIGHT = 34,
D3DDP2OP_CREATELIGHT = 35,
D3DDP2OP_SETTRANSFORM = 36,
D3DDP2OP_EXT = 37,
D3DDP2OP_TEXBLT = 38,
D3DDP2OP_STATESET = 39,
D3DDP2OP_SETPRIORITY = 40,
#endif /* DIRECT3D_VERSION >= 0x0700 */
D3DDP2OP_SETRENDERTARGET = 41,
D3DDP2OP_CLEAR = 42,
#if(DIRECT3D_VERSION >= 0x0700)
D3DDP2OP_SETTEXLOD = 43,
D3DDP2OP_SETCLIPPLANE = 44
#endif /* DIRECT3D_VERSION >= 0x0700 */
} D3DHAL_DP2OPERATION;
//
// DrawPrimitives2 point primitives
//
typedef struct _D3DHAL_DP2POINTS
{
WORD wCount;
WORD wVStart;
} D3DHAL_DP2POINTS, *LPD3DHAL_DP2POINTS;
//
// DrawPrimitives2 line primitives
//
typedef struct _D3DHAL_DP2STARTVERTEX
{
WORD wVStart;
} D3DHAL_DP2STARTVERTEX, *LPD3DHAL_DP2STARTVERTEX;
typedef struct _D3DHAL_DP2LINELIST
{
WORD wVStart;
} D3DHAL_DP2LINELIST, *LPD3DHAL_DP2LINELIST;
typedef struct _D3DHAL_DP2INDEXEDLINELIST
{
WORD wV1;
WORD wV2;
} D3DHAL_DP2INDEXEDLINELIST, *LPD3DHAL_DP2INDEXEDLINELIST;
typedef struct _D3DHAL_DP2LINESTRIP
{
WORD wVStart;
} D3DHAL_DP2LINESTRIP, *LPD3DHAL_DP2LINESTRIP;
typedef struct _D3DHAL_DP2INDEXEDLINESTRIP
{
WORD wV[2];
} D3DHAL_DP2INDEXEDLINESTRIP, *LPD3DHAL_DP2INDEXEDLINESTRIP;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -