📄 d3dhal.h
字号:
/*==========================================================================;
*
* Copyright (C) 1995-1998 Microsoft Corporation. All Rights Reserved.
*
* File: d3dhal.h
* Content: Direct3D HAL include file
*@@BEGIN_MSINTERNAL
* History:
* Date By Reason
* ==== == ======
* 03/11/95 stevela Initial revision.
* servank
* 04/11/95 stevela Context added to call blocks.
* Materials added. Required as lighting references
* handles.
* SetViewportData HAL function added.
* 10/11/95 stevela Pack structures for driver -p4 option...
* 11/11/95 stevela Remove definition of D3DHALCreateDriver.
* Add lpDDSZ to D3DHAL_CONTEXTCREATEDATA.
* Definition of lpLocalVertexBuffer changed to
* LPD3DTLVERTEX.
* 07/12/95 stevela Added texture swapping.
* 18/12/95 stevela Added GetState and GetMatrix.
* 17/02/95 stevela Use execute buffers for tl and h vertex buffers
* 23/02/95 dougrab Change all handles to DWORD
* 02/03/96 colinmc Minor build fix
* 17/04/96 stevela Use ddraw.h externally and ddrawp.h internally
*@@END_MSINTERNAL
*
***************************************************************************/
#ifndef _D3DHAL_H_
#define _D3DHAL_H_
//@@BEGIN_MSINTERNAL
#if 0 //needed for DDK
//@@END_MSINTERNAL
#include "ddraw.h"
//@@BEGIN_MSINTERNAL
#endif //0
//@@END_MSINTERNAL
#include "d3dtypes.h"
#include "d3dcaps.h"
//@@BEGIN_MSINTERNAL
#if 0 //needed for DDK
//@@END_MSINTERNAL
#include "ddrawi.h"
//@@BEGIN_MSINTERNAL
#endif //0
//@@END_MSINTERNAL
struct _D3DHAL_CALLBACKS;
typedef struct _D3DHAL_CALLBACKS D3DHAL_CALLBACKS, *LPD3DHAL_CALLBACKS;
struct _D3DHAL_CALLBACKS2;
typedef struct _D3DHAL_CALLBACKS2 D3DHAL_CALLBACKS2, *LPD3DHAL_CALLBACKS2;
struct _D3DHAL_CALLBACKS3;
typedef struct _D3DHAL_CALLBACKS3 D3DHAL_CALLBACKS3, *LPD3DHAL_CALLBACKS3;
typedef struct _DDRAWI_DIRECTDRAW_GBL FAR *LPDDRAWI_DIRECTDRAW_GBL;
struct _DDRAWI_DDRAWSURFACE_LCL;
typedef struct _DDRAWI_DDRAWSURFACE_LCL FAR *LPDDRAWI_DDRAWSURFACE_LCL;
/*
* If the HAL driver does not implement clipping, it must reserve at least
* this much space at the end of the LocalVertexBuffer for use by the HEL
* clipping. I.e. the vertex buffer contain dwNumVertices+dwNumClipVertices
* vertices. No extra space is needed by the HEL clipping in the
* LocalHVertexBuffer.
*/
#define D3DHAL_NUMCLIPVERTICES 20
//@@BEGIN_MSINTERNAL
/*
* These are a few special internal renderstates etc. that would
* logically be in d3dtypes.h, but that file is external, so they are
* here.
*/
#define D3DRENDERSTATE_OLDALPHABLENDENABLE ((D3DRENDERSTATETYPE)42)
#define D3DRENDERSTATE_EVICTMANAGEDTEXTURES ((D3DRENDERSTATETYPE)61)
#define D3DTSS_MAX ((D3DTEXTURESTAGESTATETYPE)24)
//@@END_MSINTERNAL
/*
* Generally needed maximum state structure sizes. Note that the copy of
* these in refrasti.hpp must be kept in sync with these.
*/
#define D3DHAL_MAX_RSTATES (D3DRENDERSTATE_WRAPBIAS + 128)
/* Last state offset for combined render state and texture stage array + 1 */
#define D3DHAL_MAX_RSTATES_AND_STAGES \
(D3DHAL_TSS_RENDERSTATEBASE + \
D3DHAL_TSS_MAXSTAGES * D3DHAL_TSS_STATESPERSTAGE)
/* Last texture state ID */
#define D3DHAL_MAX_TEXTURESTATES (13)
/* Last texture state ID + 1 */
#define D3DHAL_TEXTURESTATEBUF_SIZE (D3DHAL_MAX_TEXTURESTATES+1)
/*
* If no dwNumVertices is given, this is what will be used.
*/
#define D3DHAL_DEFAULT_TL_NUM ((32 * 1024) / sizeof (D3DTLVERTEX))
#define D3DHAL_DEFAULT_H_NUM ((32 * 1024) / sizeof (D3DHVERTEX))
/*
* Description for a device.
* This is used to describe a device that is to be created or to query
* the current device.
*
* For DX5 and subsequent runtimes, D3DDEVICEDESC is a user-visible
* structure that is not seen by the device drivers. The runtime
* stitches a D3DDEVICEDESC together using the D3DDEVICEDESC_V1
* embedded in the GLOBALDRIVERDATA and the extended caps queried
* from the driver using GetDriverInfo.
*/
typedef struct _D3DDeviceDesc_V1 {
DWORD dwSize; /* Size of D3DDEVICEDESC structure */
DWORD dwFlags; /* Indicates which fields have valid data */
D3DCOLORMODEL dcmColorModel; /* Color model of device */
DWORD dwDevCaps; /* Capabilities of device */
D3DTRANSFORMCAPS dtcTransformCaps; /* Capabilities of transform */
BOOL bClipping; /* Device can do 3D clipping */
D3DLIGHTINGCAPS dlcLightingCaps; /* Capabilities of lighting */
D3DPRIMCAPS dpcLineCaps;
D3DPRIMCAPS dpcTriCaps;
DWORD dwDeviceRenderBitDepth; /* One of DDBD_16, etc.. */
DWORD dwDeviceZBufferBitDepth;/* One of DDBD_16, 32, etc.. */
DWORD dwMaxBufferSize; /* Maximum execute buffer size */
DWORD dwMaxVertexCount; /* Maximum vertex count */
} D3DDEVICEDESC_V1, *LPD3DDEVICEDESC_V1;
#define D3DDEVICEDESCSIZE_V1 (sizeof(D3DDEVICEDESC_V1))
/*
* This is equivalent to the D3DDEVICEDESC understood by DX5, available only
* from DX6. It is the same as D3DDEVICEDESC structure in DX5.
* D3DDEVICEDESC is still the user-visible structure that is not seen by the
* device drivers. The runtime stitches a D3DDEVICEDESC together using the
* D3DDEVICEDESC_V1 embedded in the GLOBALDRIVERDATA and the extended caps
* queried from the driver using GetDriverInfo.
*/
typedef struct _D3DDeviceDesc_V2 {
DWORD dwSize; /* Size of D3DDEVICEDESC structure */
DWORD dwFlags; /* Indicates which fields have valid data */
D3DCOLORMODEL dcmColorModel; /* Color model of device */
DWORD dwDevCaps; /* Capabilities of device */
D3DTRANSFORMCAPS dtcTransformCaps; /* Capabilities of transform */
BOOL bClipping; /* Device can do 3D clipping */
D3DLIGHTINGCAPS dlcLightingCaps; /* Capabilities of lighting */
D3DPRIMCAPS dpcLineCaps;
D3DPRIMCAPS dpcTriCaps;
DWORD dwDeviceRenderBitDepth; /* One of DDBD_16, etc.. */
DWORD dwDeviceZBufferBitDepth;/* One of DDBD_16, 32, etc.. */
DWORD dwMaxBufferSize; /* Maximum execute buffer size */
DWORD dwMaxVertexCount; /* Maximum vertex count */
DWORD dwMinTextureWidth, dwMinTextureHeight;
DWORD dwMaxTextureWidth, dwMaxTextureHeight;
DWORD dwMinStippleWidth, dwMaxStippleWidth;
DWORD dwMinStippleHeight, dwMaxStippleHeight;
} D3DDEVICEDESC_V2, *LPD3DDEVICEDESC_V2;
#define D3DDEVICEDESCSIZE_V2 (sizeof(D3DDEVICEDESC_V2))
/* --------------------------------------------------------------
* Instantiated by the HAL driver on driver connection.
*/
typedef struct _D3DHAL_GLOBALDRIVERDATA {
DWORD dwSize; // Size of this structure
D3DDEVICEDESC_V1 hwCaps; // Capabilities of the hardware
DWORD dwNumVertices; // see following comment
DWORD dwNumClipVertices; // see following comment
DWORD dwNumTextureFormats; // Number of texture formats
LPDDSURFACEDESC lpTextureFormats; // Pointer to texture formats
} D3DHAL_GLOBALDRIVERDATA;
typedef D3DHAL_GLOBALDRIVERDATA *LPD3DHAL_GLOBALDRIVERDATA;
#define D3DHAL_GLOBALDRIVERDATASIZE (sizeof(D3DHAL_GLOBALDRIVERDATA))
/* --------------------------------------------------------------
* Extended caps introduced with DX5 and queried with
* GetDriverInfo (GUID_D3DExtendedCaps).
*/
typedef struct _D3DHAL_D3DEXTENDEDCAPS {
DWORD dwSize; // Size of this structure
DWORD dwMinTextureWidth, dwMaxTextureWidth;
DWORD dwMinTextureHeight, dwMaxTextureHeight;
DWORD dwMinStippleWidth, dwMaxStippleWidth;
DWORD dwMinStippleHeight, dwMaxStippleHeight;
/* fields added for DX6 */
DWORD dwMaxTextureRepeat;
DWORD dwMaxTextureAspectRatio;
DWORD dwMaxAnisotropy;
D3DVALUE dvGuardBandLeft;
D3DVALUE dvGuardBandTop;
D3DVALUE dvGuardBandRight;
D3DVALUE dvGuardBandBottom;
D3DVALUE dvExtentsAdjust;
DWORD dwStencilCaps;
DWORD dwFVFCaps; /* low 4 bits: 0 implies TLVERTEX only, 1..8 imply FVF aware */
DWORD dwTextureOpCaps;
WORD wMaxTextureBlendStages;
WORD wMaxSimultaneousTextures;
} D3DHAL_D3DEXTENDEDCAPS;
typedef D3DHAL_D3DEXTENDEDCAPS *LPD3DHAL_D3DEXTENDEDCAPS;
#define D3DHAL_D3DEXTENDEDCAPSSIZE (sizeof(D3DHAL_D3DEXTENDEDCAPS))
//@@BEGIN_MSINTERNAL
// Copy and convert a potentially old D3DDEVICEDESC to the
// current runtime's version of D3DDEVICEDESC
extern void D3DDeviceDescConvert(LPD3DDEVICEDESC, LPD3DDEVICEDESC_V1, LPD3DHAL_D3DEXTENDEDCAPS);
//@@END_MSINTERNAL
/* --------------------------------------------------------------
* Argument to the HAL functions.
*/
//@@BEGIN_MSINTERNAL
#if 0 //FOR DDK
//@@END_MSINTERNAL
#include "d3di.h"
//@@BEGIN_MSINTERNAL
#endif //1
//@@END_MSINTERNAL
typedef struct _D3DHAL_CONTEXTCREATEDATA
{
LPDDRAWI_DIRECTDRAW_GBL lpDDGbl; // in: Driver struct
LPDIRECTDRAWSURFACE lpDDS; // in: Surface to be used as target
LPDIRECTDRAWSURFACE lpDDSZ; // in: Surface to be used as Z
DWORD dwPID; // in: Current process id
DWORD dwhContext; // out: Context handle
HRESULT ddrval; // out: Return value
} D3DHAL_CONTEXTCREATEDATA;
typedef D3DHAL_CONTEXTCREATEDATA *LPD3DHAL_CONTEXTCREATEDATA;
typedef struct _D3DHAL_CONTEXTDESTROYDATA
{
DWORD dwhContext; // in: Context handle
HRESULT ddrval; // out: Return value
} D3DHAL_CONTEXTDESTROYDATA;
typedef D3DHAL_CONTEXTDESTROYDATA *LPD3DHAL_CONTEXTDESTROYDATA;
typedef struct _D3DHAL_CONTEXTDESTROYALLDATA
{
DWORD dwPID; // in: Process id to destroy contexts for
HRESULT ddrval; // out: Return value
} D3DHAL_CONTEXTDESTROYALLDATA;
typedef D3DHAL_CONTEXTDESTROYALLDATA *LPD3DHAL_CONTEXTDESTROYALLDATA;
typedef struct _D3DHAL_SCENECAPTUREDATA
{
DWORD dwhContext; // in: Context handle
DWORD dwFlag; // in: Indicates beginning or end
HRESULT ddrval; // out: Return value
} D3DHAL_SCENECAPTUREDATA;
typedef D3DHAL_SCENECAPTUREDATA *LPD3DHAL_SCENECAPTUREDATA;
typedef struct _D3DHAL_RENDERSTATEDATA
{
DWORD dwhContext; // in: Context handle
DWORD dwOffset; // in: Where to find states in buffer
DWORD dwCount; // in: How many states to process
LPDIRECTDRAWSURFACE lpExeBuf; // in: Execute buffer containing data
HRESULT ddrval; // out: Return value
} D3DHAL_RENDERSTATEDATA;
typedef D3DHAL_RENDERSTATEDATA *LPD3DHAL_RENDERSTATEDATA;
typedef struct _D3DHAL_RENDERPRIMITIVEDATA
{
DWORD dwhContext; // in: Context handle
DWORD dwOffset; // in: Where to find primitive data in buffer
DWORD dwStatus; // in/out: Condition branch status
LPDIRECTDRAWSURFACE lpExeBuf; // in: Execute buffer containing data
DWORD dwTLOffset; // in: Byte offset in lpTLBuf for start of vertex data
LPDIRECTDRAWSURFACE lpTLBuf; // in: Execute buffer containing TLVertex data
D3DINSTRUCTION diInstruction; // in: Primitive instruction
HRESULT ddrval; // out: Return value
} D3DHAL_RENDERPRIMITIVEDATA;
typedef D3DHAL_RENDERPRIMITIVEDATA *LPD3DHAL_RENDERPRIMITIVEDATA;
typedef struct _D3DHAL_TEXTURECREATEDATA
{
DWORD dwhContext; // in: Context handle
LPDIRECTDRAWSURFACE lpDDS; // in: Pointer to surface object
DWORD dwHandle; // out: Handle to texture
HRESULT ddrval; // out: Return value
} D3DHAL_TEXTURECREATEDATA;
typedef D3DHAL_TEXTURECREATEDATA *LPD3DHAL_TEXTURECREATEDATA;
typedef struct _D3DHAL_TEXTUREDESTROYDATA
{
DWORD dwhContext; // in: Context handle
DWORD dwHandle; // in: Handle to texture
HRESULT ddrval; // out: Return value
} D3DHAL_TEXTUREDESTROYDATA;
typedef D3DHAL_TEXTUREDESTROYDATA *LPD3DHAL_TEXTUREDESTROYDATA;
typedef struct _D3DHAL_TEXTURESWAPDATA
{
DWORD dwhContext; // in: Context handle
DWORD dwHandle1; // in: Handle to texture 1
DWORD dwHandle2; // in: Handle to texture 2
HRESULT ddrval; // out: Return value
} D3DHAL_TEXTURESWAPDATA;
typedef D3DHAL_TEXTURESWAPDATA *LPD3DHAL_TEXTURESWAPDATA;
typedef struct _D3DHAL_TEXTUREGETSURFDATA
{
DWORD dwhContext; // in: Context handle
ULONG_PTR lpDDS; // out: Pointer to surface object
DWORD dwHandle; // in: Handle to texture
HRESULT ddrval; // out: Return value
} D3DHAL_TEXTUREGETSURFDATA;
typedef D3DHAL_TEXTUREGETSURFDATA *LPD3DHAL_TEXTUREGETSURFDATA;
typedef struct _D3DHAL_GETSTATEDATA
{
DWORD dwhContext; // in: Context handle
DWORD dwWhich; // in: Transform, lighting or render?
D3DSTATE ddState; // in/out: State.
HRESULT ddrval; // out: Return value
} D3DHAL_GETSTATEDATA;
typedef D3DHAL_GETSTATEDATA *LPD3DHAL_GETSTATEDATA;
/* --------------------------------------------------------------
* Direct3D HAL Table.
* Instantiated by the HAL driver on connection.
*
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -