📄 d3dhal.h
字号:
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;
//
// DrawPrimitives2 triangle primitives
//
typedef struct _D3DHAL_DP2TRIANGLELIST {
WORD wVStart;
} D3DHAL_DP2TRIANGLELIST, *LPD3DHAL_DP2TRIANGLELIST;
typedef struct _D3DHAL_DP2INDEXEDTRIANGLELIST {
WORD wV1;
WORD wV2;
WORD wV3;
WORD wFlags;
} D3DHAL_DP2INDEXEDTRIANGLELIST, *LPD3DHAL_DP2INDEXEDTRIANGLELIST;
typedef struct _D3DHAL_DP2INDEXEDTRIANGLELIST2 {
WORD wV1;
WORD wV2;
WORD wV3;
} D3DHAL_DP2INDEXEDTRIANGLELIST2, *LPD3DHAL_DP2INDEXEDTRIANGLELIST2;
typedef struct _D3DHAL_DP2TRIANGLESTRIP {
WORD wVStart;
} D3DHAL_DP2TRIANGLESTRIP, *LPD3DHAL_DP2TRIANGLESTRIP;
typedef struct _D3DHAL_DP2INDEXEDTRIANGLESTRIP {
WORD wV[3];
} D3DHAL_DP2INDEXEDTRIANGLESTRIP, *LPD3DHAL_DP2INDEXEDTRIANGLESTRIP;
typedef struct _D3DHAL_DP2TRIANGLEFAN {
WORD wVStart;
} D3DHAL_DP2TRIANGLEFAN, *LPD3DHAL_DP2TRIANGLEFAN;
typedef struct _D3DHAL_DP2INDEXEDTRIANGLEFAN {
WORD wV[3];
} D3DHAL_DP2INDEXEDTRIANGLEFAN, *LPD3DHAL_DP2INDEXEDTRIANGLEFAN;
typedef struct _D3DHAL_DP2TRIANGLEFAN_IMM {
DWORD dwEdgeFlags;
} D3DHAL_DP2TRIANGLEFAN_IMM, *LPD3DHAL_DP2TRIANGLEFAN_IMM;
//
// DrawPrimitives2 Renderstate changes
//
typedef struct _D3DHAL_DP2RENDERSTATE {
D3DRENDERSTATETYPE RenderState;
union {
D3DVALUE dvState;
DWORD dwState;
};
} D3DHAL_DP2RENDERSTATE, *LPD3DHAL_DP2RENDERSTATE;
typedef struct _D3DHAL_DP2TEXTURESTAGESTATE {
WORD wStage;
WORD TSState;
DWORD dwValue;
} D3DHAL_DP2TEXTURESTAGESTATE, *LPD3DHAL_DP2TEXTURESTAGESTATE;
typedef struct _D3DHAL_DP2VIEWPORTINFO {
DWORD dwX;
DWORD dwY;
DWORD dwWidth;
DWORD dwHeight;
} D3DHAL_DP2VIEWPORTINFO, *LPD3DHAL_DP2VIEWPORTINFO;
typedef struct _D3DHAL_DP2WINFO {
D3DVALUE dvWNear;
D3DVALUE dvWFar;
} D3DHAL_DP2WINFO, *LPD3DHAL_DP2WINFO;
typedef struct _D3DHAL_DRAWPRIMITIVES2DATA {
DWORD dwhContext; // in: Context handle
DWORD dwFlags; // in: flags
DWORD dwVertexType; // in: vertex type
LPDDRAWI_DDRAWSURFACE_LCL lpDDCommands; // in: vertex buffer command data
DWORD dwCommandOffset; // in: offset to start of vertex buffer commands
DWORD dwCommandLength; // in: number of bytes of command data
union
{ // based on D3DHALDP2_USERMEMVERTICES flag
LPDDRAWI_DDRAWSURFACE_LCL lpDDVertex;// in: surface containing vertex data
LPVOID lpVertices; // in: User mode pointer to vertices
};
DWORD dwVertexOffset; // in: offset to start of vertex data
DWORD dwVertexLength; // in: number of vertices of vertex data
DWORD dwReqVertexBufSize; // in: number of bytes required for the next vertex buffer
DWORD dwReqCommandBufSize; // in: number of bytes required for the next commnand buffer
LPDWORD lpdwRStates; // in: Pointer to the array where render states are updated
HRESULT ddrval; // out: return value
DWORD dwErrorOffset; // out: offset in lpDDCommands to
// first D3DHAL_COMMAND not handled
} D3DHAL_DRAWPRIMITIVES2DATA, *LPD3DHAL_DRAWPRIMITIVES2DATA;
// Indicates that the lpVertices field in the DrawPrimitives2 data is
// valid, i.e. user allocated memory.
#define D3DHALDP2_USERMEMVERTICES 0x00000001L
// Indicates that the command buffer and vertex buffer are a system memory execute buffer
// resulting from the use of the Execute buffer API.
#define D3DHALDP2_EXECUTEBUFFER 0x00000002L
// The swap flags indicate if it is OK for the driver to swap the submitted buffers with new
// buffers and asyncronously work on the submitted buffers.
#define D3DHALDP2_SWAPVERTEXBUFFER 0x00000004L
#define D3DHALDP2_SWAPCOMMANDBUFFER 0x00000008L
// The requested flags are present if the new buffers which the driver can allocate need to be
// of atleast a given size. If any of these flags are set, the corresponding dwReq* field in
// D3DHAL_DRAWPRIMITIVES2DATA will also be set with the requested size in bytes.
#define D3DHALDP2_REQVERTEXBUFSIZE 0x00000010L
#define D3DHALDP2_REQCOMMANDBUFSIZE 0x00000020L
// These flags are set by the driver upon return from DrawPrimitives2 indicating if the new
// buffers are not in system memory.
#define D3DHALDP2_VIDMEMVERTEXBUF 0x00000040L
#define D3DHALDP2_VIDMEMCOMMANDBUF 0x00000080L
// Used by the driver to ask runtime to parse the execute buffer
#define D3DERR_COMMAND_UNPARSED MAKE_DDHRESULT(3000)
typedef DWORD (CALLBACK *LPD3DHAL_CLEAR2CB) (LPD3DHAL_CLEAR2DATA);
typedef DWORD (CALLBACK *LPD3DHAL_VALIDATETEXTURESTAGESTATECB)(LPD3DHAL_VALIDATETEXTURESTAGESTATEDATA);
typedef DWORD (CALLBACK *LPD3DHAL_DRAWPRIMITIVES2CB) (LPD3DHAL_DRAWPRIMITIVES2DATA);
typedef struct _D3DHAL_CALLBACKS3
{
DWORD dwSize; // size of struct
DWORD dwFlags; // flags for callbacks
LPD3DHAL_CLEAR2CB Clear2;
LPVOID lpvReserved;
LPD3DHAL_VALIDATETEXTURESTAGESTATECB ValidateTextureStageState;
LPD3DHAL_DRAWPRIMITIVES2CB DrawPrimitives2;
} D3DHAL_CALLBACKS3;
typedef D3DHAL_CALLBACKS3 *LPD3DHAL_CALLBACKS3;
#define D3DHAL_CALLBACKS3SIZE sizeof(D3DHAL_CALLBACKS3)
// bit definitions for D3DHAL
#define D3DHAL3_CB32_CLEAR2 0x00000001L
#define D3DHAL3_CB32_RESERVED 0x00000002L
#define D3DHAL3_CB32_VALIDATETEXTURESTAGESTATE 0x00000004L
#define D3DHAL3_CB32_DRAWPRIMITIVES2 0x00000008L
/* --------------------------------------------------------------
* Texture stage renderstate mapping definitions.
*
* 256 renderstate slots [256, 511] are reserved for texture processing
* stage controls, which provides for 8 texture processing stages each
* with 32 DWORD controls.
*
* The renderstates within each stage are indexed by the
* D3DTEXTURESTAGESTATETYPE enumerants by adding the appropriate
* enumerant to the base for a given texture stage.
*
* Note, "state overrides" bias the renderstate by 256, so the two
* ranges overlap. Overrides are enabled for exebufs only, so all
* this means is that Texture3 cannot be used with exebufs.
*/
/*
* Base of all texture stage state values in renderstate array.
*/
#define D3DHAL_TSS_RENDERSTATEBASE 256UL
/*
* Maximum number of stages allowed.
*/
#define D3DHAL_TSS_MAXSTAGES 8
/*
* Number of state DWORDS per stage.
*/
#define D3DHAL_TSS_STATESPERSTAGE 64
/*
* Texture handle's offset into the 32-DWORD cascade state vector
*/
//@@BEGIN_MSINTERNAL
#ifndef D3DTSS_TEXTUREMAP
//@@END_MSINTERNAL
#define D3DTSS_TEXTUREMAP 0
//@@BEGIN_MSINTERNAL
#endif
//@@END_MSINTERNAL
#if 0 // D3DHAL_TSS_OFFSET is gone
/*
* Macro to compute D3DRENDERSTATE offset for a particular per-stage state.
*/
#define D3DHAL_TSS_OFFSET( _Stage, _State ) \
((D3DRENDERSTATETYPE) \
(D3DHAL_TSS_RENDERSTATEBASE + \
((_Stage) * D3DHAL_TSS_STATESPERSTAGE) + (_State)))
/*
* Macro to split TSS offset into stage and state.
* Currently STATESPERSTAGE is a power of two so the compiler optimizes
* the mul/div out.
*/
#define D3DHAL_TSS_STAGE_AND_STATE( _Offset, _Stage, _State ) \
((_Stage) = ((_Offset) - D3DHAL_TSS_RENDERSTATEBASE) / \
D3DHAL_TSS_STATESPERSTAGE, \
(_State) = (D3DTEXTURESTAGESTATETYPE) \
((_Offset) - D3DHAL_TSS_RENDERSTATEBASE - \
(_Stage) * D3DHAL_TSS_STATESPERSTAGE))
/*
* Base offsets for stages.
*/
#define D3DHAL_TSS_STAGE0 (D3DHAL_TSS_RENDERSTATEBASE + \
0 * D3DHAL_TSS_STATESPERSTAGE)
#define D3DHAL_TSS_STAGE1 (D3DHAL_TSS_RENDERSTATEBASE + \
1 * D3DHAL_TSS_STATESPERSTAGE)
#define D3DHAL_TSS_STAGE2 (D3DHAL_TSS_RENDERSTATEBASE + \
2 * D3DHAL_TSS_STATESPERSTAGE)
#define D3DHAL_TSS_STAGE3 (D3DHAL_TSS_RENDERSTATEBASE + \
3 * D3DHAL_TSS_STATESPERSTAGE)
#define D3DHAL_TSS_STAGE4 (D3DHAL_TSS_RENDERSTATEBASE + \
4 * D3DHAL_TSS_STATESPERSTAGE)
#define D3DHAL_TSS_STAGE5 (D3DHAL_TSS_RENDERSTATEBASE + \
5 * D3DHAL_TSS_STATESPERSTAGE)
#define D3DHAL_TSS_STAGE6 (D3DHAL_TSS_RENDERSTATEBASE + \
6 * D3DHAL_TSS_STATESPERSTAGE)
#define D3DHAL_TSS_STAGE7 (D3DHAL_TSS_RENDERSTATEBASE + \
7 * D3DHAL_TSS_STATESPERSTAGE)
/*
* Convenience texture map offsets for stages.
*/
#define D3DHAL_TSS_TEXTUREMAP0 D3DHAL_TSS_OFFSET(0, D3DTSS_TEXTUREMAP)
#define D3DHAL_TSS_TEXTUREMAP1 D3DHAL_TSS_OFFSET(1, D3DTSS_TEXTUREMAP)
#define D3DHAL_TSS_TEXTUREMAP2 D3DHAL_TSS_OFFSET(2, D3DTSS_TEXTUREMAP)
#define D3DHAL_TSS_TEXTUREMAP3 D3DHAL_TSS_OFFSET(3, D3DTSS_TEXTUREMAP)
#define D3DHAL_TSS_TEXTUREMAP4 D3DHAL_TSS_OFFSET(4, D3DTSS_TEXTUREMAP)
#define D3DHAL_TSS_TEXTUREMAP5 D3DHAL_TSS_OFFSET(5, D3DTSS_TEXTUREMAP)
#define D3DHAL_TSS_TEXTUREMAP6 D3DHAL_TSS_OFFSET(6, D3DTSS_TEXTUREMAP)
#define D3DHAL_TSS_TEXTUREMAP7 D3DHAL_TSS_OFFSET(7, D3DTSS_TEXTUREMAP)
#endif // 0
/* --------------------------------------------------------------
* Flags for the data parameters.
*/
/*
* SceneCapture()
* This is used as an indication to the driver that a scene is about to
* start or end, and that it should capture data if required.
*/
#define D3DHAL_SCENE_CAPTURE_START 0x00000000L
#define D3DHAL_SCENE_CAPTURE_END 0x00000001L
/*
* Execute()
*/
/*
* Use the instruction stream starting at dwOffset.
*/
#define D3DHAL_EXECUTE_NORMAL 0x00000000L
/*
* Use the optional instruction override (diInstruction) and return
* after completion. dwOffset is the offset to the first primitive.
*/
#define D3DHAL_EXECUTE_OVERRIDE 0x00000001L
/*
* GetState()
* The driver will get passed a flag in dwWhich specifying which module
* the state must come from. The driver then fills in ulArg[1] with the
* appropriate value depending on the state type given in ddState.
*/
/*
* The following are used to get the state of a particular stage of the
* pipeline.
*/
#define D3DHALSTATE_GET_TRANSFORM 0x00000001L
#define D3DHALSTATE_GET_LIGHT 0x00000002L
#define D3DHALSTATE_GET_RENDER 0x00000004L
/* --------------------------------------------------------------
* Return values from HAL functions.
*/
/*
* The context passed in was bad.
*/
#define D3DHAL_CONTEXT_BAD 0x000000200L
/*
* No more contexts left.
*/
#define D3DHAL_OUTOFCONTEXTS 0x000000201L
/*
* Execute() and ExecuteClipped()
*/
/*
* Executed to completion via early out.
* (e.g. totally clipped)
*/
#define D3DHAL_EXECUTE_ABORT 0x00000210L
/*
* An unhandled instruction code was found (e.g. D3DOP_TRANSFORM).
* The dwOffset parameter must be set to the offset of the unhandled
* instruction.
*
* Only valid from Execute()
*/
#define D3DHAL_EXECUTE_UNHANDLED 0x00000211L
// typedef for the Callback that the drivers can use to parse unknown commands
// passed to them via the DrawPrimitives2 callback. The driver obtains this
// callback thru a GetDriverInfo call with GUID_D3DParseUnknownCommandCallback
// made by ddraw somewhere around the initialization time.
typedef HRESULT (CALLBACK *PFND3DPARSEUNKNOWNCOMMAND) (LPVOID lpvCommands,
LPVOID *lplpvReturnedCommand);
#endif /* _D3DHAL_H */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -