ifndef _D3D8TYPES_H_
define _D3D8TYPES_H_

ifndef DIRECT3D_VERSION
DIRECT3D_VERSION	equ 0x0800
endif

if(DIRECT3D_VERSION GE 0x0800)

include float.inc

if defined(_X86_) OR defined(_IA64_)
.pragma pack(push, 8)
endif

ifndef D3DCOLOR_DEFINED
D3DCOLOR typedef DWORD
D3DCOLOR_DEFINED equ 1
endif

D3DCOLOR_ARGB macro a,r,g,b
	exitm<>
	endm
D3DCOLOR_RGBA macro r,g,b,a
	exitm<D3DCOLOR_ARGB(a,r,g,b)>
	endm
D3DCOLOR_XRGB macro r,g,b
	exitm<D3DCOLOR_ARGB(0xff,r,g,b)>
	endm

D3DCOLOR_COLORVALUE macro r,g,b,a
	exitm<>
	endm


ifndef D3DVECTOR_DEFINED
D3DVECTOR		STRUC
x			real4 ?
y			real4 ?
z			real4 ?
D3DVECTOR		ENDS
D3DVECTOR_DEFINED equ 1
endif

ifndef D3DCOLORVALUE_DEFINED
D3DCOLORVALUE		STRUC
r			real4 ?
g			real4 ?
b			real4 ?
a			real4 ?
D3DCOLORVALUE		ENDS
D3DCOLORVALUE_DEFINED equ 1
endif

ifndef D3DRECT_DEFINED
D3DRECT			STRUC
x1			SDWORD ?
y1			SDWORD ?
x2			SDWORD ?
y2			SDWORD ?
D3DRECT			ENDS
D3DRECT_DEFINED equ 1
endif

ifndef D3DMATRIX_DEFINED
D3DMATRIX		STRUC
UNION ; {
STRUC
_11			real4 ?
_12			real4 ?
_13			real4 ?
_14			real4 ?
_21			real4 ?
_22			real4 ?
_23			real4 ?
_24			real4 ?
_31			real4 ?
_32			real4 ?
_33			real4 ?
_34			real4 ?
_41			real4 ?
_42			real4 ?
_43			real4 ?
_44			real4 ?
ENDS ;
m			real4 4 dup(?)
ENDS
D3DMATRIX		ENDS
D3DMATRIX_DEFINED equ 1
endif

D3DVIEWPORT8		STRUC
X			dd ?
Y			dd ?
Width			dd ?
Height			dd ?
MinZ			real4 ?
MaxZ			real4 ?
D3DVIEWPORT8		ENDS


D3DMAXUSERCLIPPLANES	equ 32

D3DCLIPPLANE0		equ (1 SHL 0)
D3DCLIPPLANE1		equ (1 SHL 1)
D3DCLIPPLANE2		equ (1 SHL 2)
D3DCLIPPLANE3		equ (1 SHL 3)
D3DCLIPPLANE4		equ (1 SHL 4)
D3DCLIPPLANE5		equ (1 SHL 5)


D3DCS_LEFT		equ 0x00000001
D3DCS_RIGHT		equ 0x00000002
D3DCS_TOP		equ 0x00000004
D3DCS_BOTTOM		equ 0x00000008
D3DCS_FRONT		equ 0x00000010
D3DCS_BACK		equ 0x00000020
D3DCS_PLANE0		equ 0x00000040
D3DCS_PLANE1		equ 0x00000080
D3DCS_PLANE2		equ 0x00000100
D3DCS_PLANE3		equ 0x00000200
D3DCS_PLANE4		equ 0x00000400
D3DCS_PLANE5		equ 0x00000800

D3DCS_ALL		equ (D3DCS_LEFT OR \
			D3DCS_RIGHT OR \
			D3DCS_TOP OR \
			D3DCS_BOTTOM OR \
			D3DCS_FRONT OR \
			D3DCS_BACK OR \
			D3DCS_PLANE0 OR \
			D3DCS_PLANE1 OR \
			D3DCS_PLANE2 OR \
			D3DCS_PLANE3 OR \
			D3DCS_PLANE4 OR \
			D3DCS_PLANE5)

D3DCLIPSTATUS8		STRUC
ClipUnion		dd ?
ClipIntersection	dd ?
D3DCLIPSTATUS8		ENDS

D3DMATERIAL8		STRUC
Diffuse			D3DCOLORVALUE <>
Ambient			D3DCOLORVALUE <>
Specular		D3DCOLORVALUE <>
Emissive		D3DCOLORVALUE <>
Power			real4 ?
D3DMATERIAL8		ENDS

.enum D3DLIGHTTYPE {
    D3DLIGHT_POINT	    = 1,
    D3DLIGHT_SPOT	    = 2,
    D3DLIGHT_DIRECTIONAL    = 3,
    D3DLIGHT_FORCE_DWORD    = 0x7fffffff,
    }

D3DLIGHT8		STRUC
Type			D3DLIGHTTYPE ?
Diffuse			D3DCOLORVALUE <>
Specular		D3DCOLORVALUE <>
Ambient			D3DCOLORVALUE <>
Position		D3DVECTOR <>
Direction		D3DVECTOR <>
Range			real4 ?
Falloff			real4 ?
Attenuation0		real4 ?
Attenuation1		real4 ?
Attenuation2		real4 ?
Theta			real4 ?
Phi			real4 ?
D3DLIGHT8		ENDS

D3DCLEAR_TARGET		equ 0x00000001
D3DCLEAR_ZBUFFER	equ 0x00000002
D3DCLEAR_STENCIL	equ 0x00000004


.enum D3DSHADEMODE {
    D3DSHADE_FLAT		= 1,
    D3DSHADE_GOURAUD		= 2,
    D3DSHADE_PHONG		= 3,
    D3DSHADE_FORCE_DWORD	= 0x7fffffff,
    }

.enum D3DFILLMODE {
    D3DFILL_POINT		= 1,
    D3DFILL_WIREFRAME		= 2,
    D3DFILL_SOLID		= 3,
    D3DFILL_FORCE_DWORD		= 0x7fffffff,
    }

D3DLINEPATTERN		STRUC
wRepeatFactor		dw ?
wLinePattern		dw ?
D3DLINEPATTERN		ENDS

.enum D3DBLEND {
    D3DBLEND_ZERO		= 1,
    D3DBLEND_ONE		= 2,
    D3DBLEND_SRCCOLOR		= 3,
    D3DBLEND_INVSRCCOLOR	= 4,
    D3DBLEND_SRCALPHA		= 5,
    D3DBLEND_INVSRCALPHA	= 6,
    D3DBLEND_DESTALPHA		= 7,
    D3DBLEND_INVDESTALPHA	= 8,
    D3DBLEND_DESTCOLOR		= 9,
    D3DBLEND_INVDESTCOLOR	= 10,
    D3DBLEND_SRCALPHASAT	= 11,
    D3DBLEND_BOTHSRCALPHA	= 12,
    D3DBLEND_BOTHINVSRCALPHA	= 13,
    D3DBLEND_FORCE_DWORD	= 0x7fffffff,
    }

.enum D3DBLENDOP {
    D3DBLENDOP_ADD		= 1,
    D3DBLENDOP_SUBTRACT		= 2,
    D3DBLENDOP_REVSUBTRACT	= 3,
    D3DBLENDOP_MIN		= 4,
    D3DBLENDOP_MAX		= 5,
    D3DBLENDOP_FORCE_DWORD	= 0x7fffffff,
    }

.enum D3DTEXTUREADDRESS {
    D3DTADDRESS_WRAP		= 1,
    D3DTADDRESS_MIRROR		= 2,
    D3DTADDRESS_CLAMP		= 3,
    D3DTADDRESS_BORDER		= 4,
    D3DTADDRESS_MIRRORONCE	= 5,
    D3DTADDRESS_FORCE_DWORD	= 0x7fffffff,
    }

.enum D3DCULL {
    D3DCULL_NONE		= 1,
    D3DCULL_CW			= 2,
    D3DCULL_CCW			= 3,
    D3DCULL_FORCE_DWORD		= 0x7fffffff,
    }

.enum D3DCMPFUNC {
    D3DCMP_NEVER		= 1,
    D3DCMP_LESS			= 2,
    D3DCMP_EQUAL		= 3,
    D3DCMP_LESSEQUAL		= 4,
    D3DCMP_GREATER		= 5,
    D3DCMP_NOTEQUAL		= 6,
    D3DCMP_GREATEREQUAL		= 7,
    D3DCMP_ALWAYS		= 8,
    D3DCMP_FORCE_DWORD		= 0x7fffffff,
    }

.enum D3DSTENCILOP {
    D3DSTENCILOP_KEEP		= 1,
    D3DSTENCILOP_ZERO		= 2,
    D3DSTENCILOP_REPLACE	= 3,
    D3DSTENCILOP_INCRSAT	= 4,
    D3DSTENCILOP_DECRSAT	= 5,
    D3DSTENCILOP_INVERT		= 6,
    D3DSTENCILOP_INCR		= 7,
    D3DSTENCILOP_DECR		= 8,
    D3DSTENCILOP_FORCE_DWORD	= 0x7fffffff,
    }

.enum D3DFOGMODE {
    D3DFOG_NONE			= 0,
    D3DFOG_EXP			= 1,
    D3DFOG_EXP2			= 2,
    D3DFOG_LINEAR		= 3,
    D3DFOG_FORCE_DWORD		= 0x7fffffff,
    }

.enum D3DZBUFFERTYPE {
    D3DZB_FALSE			= 0,
    D3DZB_TRUE			= 1,
    D3DZB_USEW			= 2,
    D3DZB_FORCE_DWORD		= 0x7fffffff,
    }

.enum D3DPRIMITIVETYPE {
    D3DPT_POINTLIST		= 1,
    D3DPT_LINELIST		= 2,
    D3DPT_LINESTRIP		= 3,
    D3DPT_TRIANGLELIST		= 4,
    D3DPT_TRIANGLESTRIP		= 5,
    D3DPT_TRIANGLEFAN		= 6,
    D3DPT_FORCE_DWORD		= 0x7fffffff,
    }

.enum D3DTRANSFORMSTATETYPE {
    D3DTS_VIEW		= 2,
    D3DTS_PROJECTION	= 3,
    D3DTS_TEXTURE0	= 16,
    D3DTS_TEXTURE1	= 17,
    D3DTS_TEXTURE2	= 18,
    D3DTS_TEXTURE3	= 19,
    D3DTS_TEXTURE4	= 20,
    D3DTS_TEXTURE5	= 21,
    D3DTS_TEXTURE6	= 22,
    D3DTS_TEXTURE7	= 23,
    D3DTS_FORCE_DWORD	  = 0x7fffffff,
    }

D3DTS_WORLDMATRIX macro index
	exitm<(index + 256)>
	endm
D3DTS_WORLD		equ D3DTS_WORLDMATRIX(0)
D3DTS_WORLD1		equ D3DTS_WORLDMATRIX(1)
D3DTS_WORLD2		equ D3DTS_WORLDMATRIX(2)
D3DTS_WORLD3		equ D3DTS_WORLDMATRIX(3)

.enum D3DRENDERSTATETYPE {
    D3DRS_ZENABLE		    = 7,
    D3DRS_FILLMODE		    = 8,
    D3DRS_SHADEMODE		    = 9,
    D3DRS_LINEPATTERN		    = 10,
    D3DRS_ZWRITEENABLE		    = 14,
    D3DRS_ALPHATESTENABLE	    = 15,
    D3DRS_LASTPIXEL		    = 16,
    D3DRS_SRCBLEND		    = 19,
    D3DRS_DESTBLEND		    = 20,
    D3DRS_CULLMODE		    = 22,
    D3DRS_ZFUNC			    = 23,
    D3DRS_ALPHAREF		    = 24,
    D3DRS_ALPHAFUNC		    = 25,
    D3DRS_DITHERENABLE		    = 26,
    D3DRS_ALPHABLENDENABLE	    = 27,
    D3DRS_FOGENABLE		    = 28,
    D3DRS_SPECULARENABLE	    = 29,
    D3DRS_ZVISIBLE		    = 30,
    D3DRS_FOGCOLOR		    = 34,
    D3DRS_FOGTABLEMODE		    = 35,
    D3DRS_FOGSTART		    = 36,
    D3DRS_FOGEND		    = 37,
    D3DRS_FOGDENSITY		    = 38,
    D3DRS_EDGEANTIALIAS		    = 40,
    D3DRS_ZBIAS			    = 47,
    D3DRS_RANGEFOGENABLE	    = 48,
    D3DRS_STENCILENABLE		    = 52,
    D3DRS_STENCILFAIL		    = 53,
    D3DRS_STENCILZFAIL		    = 54,
    D3DRS_STENCILPASS		    = 55,
    D3DRS_STENCILFUNC		    = 56,
    D3DRS_STENCILREF		    = 57,
    D3DRS_STENCILMASK		    = 58,
    D3DRS_STENCILWRITEMASK	    = 59,
    D3DRS_TEXTUREFACTOR		    = 60,
    D3DRS_WRAP0			    = 128,
    D3DRS_WRAP1			    = 129,
    D3DRS_WRAP2			    = 130,
    D3DRS_WRAP3			    = 131,
    D3DRS_WRAP4			    = 132,
    D3DRS_WRAP5			    = 133,
    D3DRS_WRAP6			    = 134,
    D3DRS_WRAP7			    = 135,
    D3DRS_CLIPPING		    = 136,
    D3DRS_LIGHTING		    = 137,
    D3DRS_AMBIENT		    = 139,
    D3DRS_FOGVERTEXMODE		    = 140,
    D3DRS_COLORVERTEX		    = 141,
    D3DRS_LOCALVIEWER		    = 142,
    D3DRS_NORMALIZENORMALS	    = 143,
    D3DRS_DIFFUSEMATERIALSOURCE	    = 145,
    D3DRS_SPECULARMATERIALSOURCE    = 146,
    D3DRS_AMBIENTMATERIALSOURCE	    = 147,
    D3DRS_EMISSIVEMATERIALSOURCE    = 148,
    D3DRS_VERTEXBLEND		    = 151,
    D3DRS_CLIPPLANEENABLE	    = 152,
    D3DRS_SOFTWAREVERTEXPROCESSING  = 153,
    D3DRS_POINTSIZE		    = 154,
    D3DRS_POINTSIZE_MIN		    = 155,
    D3DRS_POINTSPRITEENABLE	    = 156,
    D3DRS_POINTSCALEENABLE	    = 157,
    D3DRS_POINTSCALE_A		    = 158,
    D3DRS_POINTSCALE_B		    = 159,
    D3DRS_POINTSCALE_C		    = 160,
    D3DRS_MULTISAMPLEANTIALIAS	    = 161,
    D3DRS_MULTISAMPLEMASK	    = 162,
    D3DRS_PATCHEDGESTYLE	    = 163,
    D3DRS_PATCHSEGMENTS		    = 164,
    D3DRS_DEBUGMONITORTOKEN	    = 165,
    D3DRS_POINTSIZE_MAX		    = 166,
    D3DRS_INDEXEDVERTEXBLENDENABLE  = 167,
    D3DRS_COLORWRITEENABLE	    = 168,
    D3DRS_TWEENFACTOR		    = 170,
    D3DRS_BLENDOP		    = 171,
    D3DRS_POSITIONORDER		    = 172,
    D3DRS_NORMALORDER		    = 173,
    D3DRS_FORCE_DWORD		    = 0x7fffffff,
    }

.enum D3DMATERIALCOLORSOURCE {
    D3DMCS_MATERIAL	    = 0,
    D3DMCS_COLOR1	    = 1,
    D3DMCS_COLOR2	    = 2,
    D3DMCS_FORCE_DWORD	    = 0x7fffffff,
    }

D3DRENDERSTATE_WRAPBIAS equ 128UL

D3DWRAP_U		equ 0x00000001
D3DWRAP_V		equ 0x00000002
D3DWRAP_W		equ 0x00000004

D3DWRAPCOORD_0		equ 0x00000001
D3DWRAPCOORD_1		equ 0x00000002
D3DWRAPCOORD_2		equ 0x00000004
D3DWRAPCOORD_3		equ 0x00000008

D3DCOLORWRITEENABLE_RED equ (1 SHL 0)
D3DCOLORWRITEENABLE_GREEN equ (1 SHL 1)
D3DCOLORWRITEENABLE_BLUE equ (1 SHL 2)
D3DCOLORWRITEENABLE_ALPHA equ (1 SHL 3)

.enum D3DTEXTURESTAGESTATETYPE {
    D3DTSS_COLOROP	  =  1,
    D3DTSS_COLORARG1	  =  2,
    D3DTSS_COLORARG2	  =  3,
    D3DTSS_ALPHAOP	  =  4,
    D3DTSS_ALPHAARG1	  =  5,
    D3DTSS_ALPHAARG2	  =  6,
    D3DTSS_BUMPENVMAT00	  =  7,
    D3DTSS_BUMPENVMAT01	  =  8,
    D3DTSS_BUMPENVMAT10	  =  9,
    D3DTSS_BUMPENVMAT11	  = 10,
    D3DTSS_TEXCOORDINDEX  = 11,
    D3DTSS_ADDRESSU	  = 13,
    D3DTSS_ADDRESSV	  = 14,
    D3DTSS_BORDERCOLOR	  = 15,
    D3DTSS_MAGFILTER	  = 16,
    D3DTSS_MINFILTER	  = 17,
    D3DTSS_MIPFILTER	  = 18,
    D3DTSS_MIPMAPLODBIAS  = 19,
    D3DTSS_MAXMIPLEVEL	  = 20,
    D3DTSS_MAXANISOTROPY  = 21,
    D3DTSS_BUMPENVLSCALE  = 22,
    D3DTSS_BUMPENVLOFFSET = 23,
    D3DTSS_TEXTURETRANSFORMFLAGS = 24,
    D3DTSS_ADDRESSW	  = 25,
    D3DTSS_COLORARG0	  = 26,
    D3DTSS_ALPHAARG0	  = 27,
    D3DTSS_RESULTARG	  = 28,
    D3DTSS_FORCE_DWORD	 = 0x7fffffff,
    }

D3DTSS_TCI_PASSTHRU	equ 0x00000000
D3DTSS_TCI_CAMERASPACENORMAL equ 0x00010000
D3DTSS_TCI_CAMERASPACEPOSITION equ 0x00020000
D3DTSS_TCI_CAMERASPACEREFLECTIONVECTOR equ 0x00030000

.enum D3DTEXTUREOP {
    D3DTOP_DISABLE		= 1,
    D3DTOP_SELECTARG1		= 2,
    D3DTOP_SELECTARG2		= 3,
    D3DTOP_MODULATE		= 4,
    D3DTOP_MODULATE2X		= 5,
    D3DTOP_MODULATE4X		= 6,
    D3DTOP_ADD			= 7,
    D3DTOP_ADDSIGNED		= 8,
    D3DTOP_ADDSIGNED2X		= 9,
    D3DTOP_SUBTRACT		= 10,
    D3DTOP_ADDSMOOTH		= 11,
    D3DTOP_BLENDDIFFUSEALPHA	= 12,
    D3DTOP_BLENDTEXTUREALPHA	= 13,
    D3DTOP_BLENDFACTORALPHA	= 14,
    D3DTOP_BLENDTEXTUREALPHAPM	= 15,
    D3DTOP_BLENDCURRENTALPHA	= 16,
    D3DTOP_PREMODULATE		  = 17,
    D3DTOP_MODULATEALPHA_ADDCOLOR = 18,
    D3DTOP_MODULATECOLOR_ADDALPHA = 19,
    D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20,
    D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21,
    D3DTOP_BUMPENVMAP		= 22,
    D3DTOP_BUMPENVMAPLUMINANCE	= 23,
    D3DTOP_DOTPRODUCT3		= 24,
    D3DTOP_MULTIPLYADD		= 25,
    D3DTOP_LERP			= 26,
    D3DTOP_FORCE_DWORD		= 0x7fffffff,
    }

D3DTA_SELECTMASK	equ 0x0000000f
D3DTA_DIFFUSE		equ 0x00000000
D3DTA_CURRENT		equ 0x00000001
D3DTA_TEXTURE		equ 0x00000002
D3DTA_TFACTOR		equ 0x00000003
D3DTA_SPECULAR		equ 0x00000004
D3DTA_TEMP		equ 0x00000005
D3DTA_COMPLEMENT	equ 0x00000010
D3DTA_ALPHAREPLICATE	equ 0x00000020

.enum D3DTEXTUREFILTERTYPE {

    D3DTEXF_NONE	    = 0,
    D3DTEXF_POINT	    = 1,
    D3DTEXF_LINEAR	    = 2,
    D3DTEXF_ANISOTROPIC	    = 3,
    D3DTEXF_FLATCUBIC	    = 4,
    D3DTEXF_GAUSSIANCUBIC   = 5,
    D3DTEXF_FORCE_DWORD	    = 0x7fffffff,
    }

D3DPV_DONOTCOPYDATA	equ (1 shl 0)

D3DFVF_RESERVED0	equ 0x001
D3DFVF_POSITION_MASK	equ 0x00E
D3DFVF_XYZ		equ 0x002
D3DFVF_XYZRHW		equ 0x004
D3DFVF_XYZB1		equ 0x006
D3DFVF_XYZB2		equ 0x008
D3DFVF_XYZB3		equ 0x00a
D3DFVF_XYZB4		equ 0x00c
D3DFVF_XYZB5		equ 0x00e

D3DFVF_NORMAL		equ 0x010
D3DFVF_PSIZE		equ 0x020
D3DFVF_DIFFUSE		equ 0x040
D3DFVF_SPECULAR		equ 0x080

D3DFVF_TEXCOUNT_MASK	equ 0xf00
D3DFVF_TEXCOUNT_SHIFT	equ 8
D3DFVF_TEX0		equ 0x000
D3DFVF_TEX1		equ 0x100
D3DFVF_TEX2		equ 0x200
D3DFVF_TEX3		equ 0x300
D3DFVF_TEX4		equ 0x400
D3DFVF_TEX5		equ 0x500
D3DFVF_TEX6		equ 0x600
D3DFVF_TEX7		equ 0x700
D3DFVF_TEX8		equ 0x800

D3DFVF_LASTBETA_UBYTE4	equ 0x1000

D3DFVF_RESERVED2	equ 0xE000

.enum D3DVSD_TOKENTYPE {
    D3DVSD_TOKEN_NOP	    = 0,
    D3DVSD_TOKEN_STREAM,
    D3DVSD_TOKEN_STREAMDATA,
    D3DVSD_TOKEN_TESSELLATOR,
    D3DVSD_TOKEN_CONSTMEM,
    D3DVSD_TOKEN_EXT,
    D3DVSD_TOKEN_END = 7,
    D3DVSD_FORCE_DWORD = 0x7fffffff,
    }

D3DVSD_TOKENTYPESHIFT	equ 29
D3DVSD_TOKENTYPEMASK	equ (7 shl D3DVSD_TOKENTYPESHIFT)
D3DVSD_STREAMNUMBERSHIFT equ 0
D3DVSD_STREAMNUMBERMASK equ (0xF shl D3DVSD_STREAMNUMBERSHIFT)
D3DVSD_DATALOADTYPESHIFT equ 28
D3DVSD_DATALOADTYPEMASK equ (0x1 shl D3DVSD_DATALOADTYPESHIFT)
D3DVSD_DATATYPESHIFT	equ 16
D3DVSD_DATATYPEMASK	equ (0xF shl D3DVSD_DATATYPESHIFT)
D3DVSD_SKIPCOUNTSHIFT	equ 16
D3DVSD_SKIPCOUNTMASK	equ (0xF shl D3DVSD_SKIPCOUNTSHIFT)
D3DVSD_VERTEXREGSHIFT	equ 0
D3DVSD_VERTEXREGMASK	equ (0x1F shl D3DVSD_VERTEXREGSHIFT)
D3DVSD_VERTEXREGINSHIFT equ 20
D3DVSD_VERTEXREGINMASK	equ (0xF shl D3DVSD_VERTEXREGINSHIFT)
D3DVSD_CONSTCOUNTSHIFT	equ 25
D3DVSD_CONSTCOUNTMASK	equ (0xF shl D3DVSD_CONSTCOUNTSHIFT)
D3DVSD_CONSTADDRESSSHIFT equ 0
D3DVSD_CONSTADDRESSMASK equ (0x7F shl D3DVSD_CONSTADDRESSSHIFT)
D3DVSD_CONSTRSSHIFT	equ 16
D3DVSD_CONSTRSMASK	equ (0x1FFF shl D3DVSD_CONSTRSSHIFT)
D3DVSD_EXTCOUNTSHIFT	equ 24
D3DVSD_EXTCOUNTMASK	equ (0x1F shl D3DVSD_EXTCOUNTSHIFT)
D3DVSD_EXTINFOSHIFT	equ 0
D3DVSD_EXTINFOMASK	equ (0xFFFFFF shl D3DVSD_EXTINFOSHIFT)

D3DVSD_MAKETOKENTYPE macro tokenType
	exitm<((tokenType shl D3DVSD_TOKENTYPESHIFT) and D3DVSD_TOKENTYPEMASK)>
	endm

D3DVSD_STREAM macro _StreamNumber
	exitm<(D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAM) or (_StreamNumber))>
	endm

D3DVSD_STREAMTESSSHIFT	equ 28
D3DVSD_STREAMTESSMASK	equ (1 shl D3DVSD_STREAMTESSSHIFT)
D3DVSD_STREAM_TESS	equ \
    (D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAM) or (D3DVSD_STREAMTESSMASK))

D3DVSD_REG macro _VertexRegister, _Type
	exitm<(D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) or \
	((_Type) shl D3DVSD_DATATYPESHIFT) or (_VertexRegister))>
	endm

D3DVSD_SKIP macro _DWORDCount
	exitm<(D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_STREAMDATA) or 0x10000000 or \
		((_DWORDCount) shl D3DVSD_SKIPCOUNTSHIFT))>
	endm

D3DVSD_CONST macro _ConstantAddress, _Count
	exitm<(D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_CONSTMEM) or \
		((_Count) shl D3DVSD_CONSTCOUNTSHIFT) or (_ConstantAddress))>
	endm

D3DVSD_TESSNORMAL macro _VertexRegisterIn, _VertexRegisterOut
	exitm<(D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) or \
		((_VertexRegisterIn) shl D3DVSD_VERTEXREGINSHIFT) or \
		((0x02) shl D3DVSD_DATATYPESHIFT) or (_VertexRegisterOut))>
	endm

D3DVSD_TESSUV macro _VertexRegister
	exitm<(D3DVSD_MAKETOKENTYPE(D3DVSD_TOKEN_TESSELLATOR) or 0x10000000 or \
		((0x01) shl D3DVSD_DATATYPESHIFT) or (_VertexRegister))>
	endm

D3DVSD_END macro
	exitm<0xFFFFFFFF>
	endm

D3DVSD_NOP macro
	exitm<nop>
	endm


D3DVSDT_FLOAT1		equ 0x00
D3DVSDT_FLOAT2		equ 0x01
D3DVSDT_FLOAT3		equ 0x02
D3DVSDT_FLOAT4		equ 0x03
D3DVSDT_D3DCOLOR	equ 0x04

D3DVSDT_UBYTE4		equ 0x05
D3DVSDT_SHORT2		equ 0x06
D3DVSDT_SHORT4		equ 0x07

D3DVSDE_POSITION	equ 0
D3DVSDE_BLENDWEIGHT	equ 1
D3DVSDE_BLENDINDICES	equ 2
D3DVSDE_NORMAL		equ 3
D3DVSDE_PSIZE		equ 4
D3DVSDE_DIFFUSE		equ 5
D3DVSDE_SPECULAR	equ 6
D3DVSDE_TEXCOORD0	equ 7
D3DVSDE_TEXCOORD1	equ 8
D3DVSDE_TEXCOORD2	equ 9
D3DVSDE_TEXCOORD3	equ 10
D3DVSDE_TEXCOORD4	equ 11
D3DVSDE_TEXCOORD5	equ 12
D3DVSDE_TEXCOORD6	equ 13
D3DVSDE_TEXCOORD7	equ 14
D3DVSDE_POSITION2	equ 15
D3DVSDE_NORMAL2		equ 16

D3DDP_MAXTEXCOORD	equ 8


D3DSI_OPCODE_MASK	equ 0x0000FFFF

.enum D3DSHADER_INSTRUCTION_OPCODE_TYPE {

    D3DSIO_NOP		= 0,
    D3DSIO_MOV		,
    D3DSIO_ADD		,
    D3DSIO_SUB		,
    D3DSIO_MAD		,
    D3DSIO_MUL		,
    D3DSIO_RCP		,
    D3DSIO_RSQ		,
    D3DSIO_DP3		,
    D3DSIO_DP4		,
    D3DSIO_MIN		,
    D3DSIO_MAX		,
    D3DSIO_SLT		,
    D3DSIO_SGE		,
    D3DSIO_EXP		,
    D3DSIO_LOG		,
    D3DSIO_LIT		,
    D3DSIO_DST		,
    D3DSIO_LRP		,
    D3DSIO_FRC		,
    D3DSIO_M4x4		,
    D3DSIO_M4x3		,
    D3DSIO_M3x4		,
    D3DSIO_M3x3		,
    D3DSIO_M3x2		,

    D3DSIO_TEXCOORD	= 64,
    D3DSIO_TEXKILL	,
    D3DSIO_TEX		,
    D3DSIO_TEXBEM	,
    D3DSIO_TEXBEML	,
    D3DSIO_TEXREG2AR	,
    D3DSIO_TEXREG2GB	,
    D3DSIO_TEXM3x2PAD	,
    D3DSIO_TEXM3x2TEX	,
    D3DSIO_TEXM3x3PAD	,
    D3DSIO_TEXM3x3TEX	,
    D3DSIO_TEXM3x3DIFF	,
    D3DSIO_TEXM3x3SPEC	,
    D3DSIO_TEXM3x3VSPEC ,
    D3DSIO_EXPP		,
    D3DSIO_LOGP		,
    D3DSIO_CND		,
    D3DSIO_DEF		,
    D3DSIO_TEXREG2RGB	,
    D3DSIO_TEXDP3TEX	,
    D3DSIO_TEXM3x2DEPTH ,
    D3DSIO_TEXDP3	,
    D3DSIO_TEXM3x3	,
    D3DSIO_TEXDEPTH	,
    D3DSIO_CMP		,
    D3DSIO_BEM		,

    D3DSIO_PHASE	= 0xFFFD,
    D3DSIO_COMMENT	= 0xFFFE,
    D3DSIO_END		= 0xFFFF,

    D3DSIO_FORCE_DWORD	= 0x7fffffff
    }


D3DSI_COISSUE		equ 0x40000000

D3DSP_REGNUM_MASK	equ 0x00001FFF

D3DSP_WRITEMASK_0	equ 0x00010000
D3DSP_WRITEMASK_1	equ 0x00020000
D3DSP_WRITEMASK_2	equ 0x00040000
D3DSP_WRITEMASK_3	equ 0x00080000
D3DSP_WRITEMASK_ALL	equ 0x000F0000

D3DSP_DSTMOD_SHIFT	equ 20
D3DSP_DSTMOD_MASK	equ 0x00F00000

.enum D3DSHADER_PARAM_DSTMOD_TYPE {
    D3DSPDM_NONE    = 0 shl D3DSP_DSTMOD_SHIFT,
    D3DSPDM_SATURATE= 1 shl D3DSP_DSTMOD_SHIFT,
    D3DSPDM_FORCE_DWORD	 = 0x7fffffff,
    }

D3DSP_DSTSHIFT_SHIFT	equ 24
D3DSP_DSTSHIFT_MASK	equ 0x0F000000

D3DSP_REGTYPE_SHIFT	equ 28
D3DSP_REGTYPE_MASK	equ 0x70000000

.enum D3DSHADER_PARAM_REGISTER_TYPE {

    D3DSPR_TEMP	    = 0 shl D3DSP_REGTYPE_SHIFT,
    D3DSPR_INPUT    = 1 shl D3DSP_REGTYPE_SHIFT,
    D3DSPR_CONST    = 2 shl D3DSP_REGTYPE_SHIFT,
    D3DSPR_ADDR	    = 3 shl D3DSP_REGTYPE_SHIFT,
    D3DSPR_TEXTURE  = 3 shl D3DSP_REGTYPE_SHIFT,
    D3DSPR_RASTOUT  = 4 shl D3DSP_REGTYPE_SHIFT,
    D3DSPR_ATTROUT  = 5 shl D3DSP_REGTYPE_SHIFT,
    D3DSPR_TEXCRDOUT= 6 shl D3DSP_REGTYPE_SHIFT,
    D3DSPR_FORCE_DWORD	= 0x7fffffff,
    }

.enum D3DVS_RASTOUT_OFFSETS {
    D3DSRO_POSITION = 0,
    D3DSRO_FOG,
    D3DSRO_POINT_SIZE,
    D3DSRO_FORCE_DWORD	= 0x7fffffff,
    }

D3DVS_ADDRESSMODE_SHIFT equ 13
D3DVS_ADDRESSMODE_MASK	equ (1 shl D3DVS_ADDRESSMODE_SHIFT)

.enum _D3DVS_ADDRESSMODE_TYPE {
    D3DVS_ADDRMODE_ABSOLUTE  = (0 shl D3DVS_ADDRESSMODE_SHIFT),
    D3DVS_ADDRMODE_RELATIVE  = (1 shl D3DVS_ADDRESSMODE_SHIFT),
    D3DVS_ADDRMODE_FORCE_DWORD = 0x7fffffff,
    }

D3DVS_SWIZZLE_SHIFT	equ 16
D3DVS_SWIZZLE_MASK	equ 0x00FF0000

D3DVS_X_X	equ (0 shl D3DVS_SWIZZLE_SHIFT)
D3DVS_X_Y	equ (1 shl D3DVS_SWIZZLE_SHIFT)
D3DVS_X_Z	equ (2 shl D3DVS_SWIZZLE_SHIFT)
D3DVS_X_W	equ (3 shl D3DVS_SWIZZLE_SHIFT)

D3DVS_Y_X	equ (0 shl (D3DVS_SWIZZLE_SHIFT + 2))
D3DVS_Y_Y	equ (1 shl (D3DVS_SWIZZLE_SHIFT + 2))
D3DVS_Y_Z	equ (2 shl (D3DVS_SWIZZLE_SHIFT + 2))
D3DVS_Y_W	equ (3 shl (D3DVS_SWIZZLE_SHIFT + 2))

D3DVS_Z_X	equ (0 shl (D3DVS_SWIZZLE_SHIFT + 4))
D3DVS_Z_Y	equ (1 shl (D3DVS_SWIZZLE_SHIFT + 4))
D3DVS_Z_Z	equ (2 shl (D3DVS_SWIZZLE_SHIFT + 4))
D3DVS_Z_W	equ (3 shl (D3DVS_SWIZZLE_SHIFT + 4))

D3DVS_W_X	equ (0 shl (D3DVS_SWIZZLE_SHIFT + 6))
D3DVS_W_Y	equ (1 shl (D3DVS_SWIZZLE_SHIFT + 6))
D3DVS_W_Z	equ (2 shl (D3DVS_SWIZZLE_SHIFT + 6))
D3DVS_W_W	equ (3 shl (D3DVS_SWIZZLE_SHIFT + 6))

D3DVS_NOSWIZZLE equ (D3DVS_X_X or D3DVS_Y_Y or D3DVS_Z_Z or D3DVS_W_W)

D3DSP_SWIZZLE_SHIFT	equ 16
D3DSP_SWIZZLE_MASK	equ 0x00FF0000

D3DSP_NOSWIZZLE equ \
    ( (0 shl (D3DSP_SWIZZLE_SHIFT + 0)) or \
      (1 shl (D3DSP_SWIZZLE_SHIFT + 2)) or \
      (2 shl (D3DSP_SWIZZLE_SHIFT + 4)) or \
      (3 shl (D3DSP_SWIZZLE_SHIFT + 6)) )

D3DSP_REPLICATERED equ \
    ( (0 shl (D3DSP_SWIZZLE_SHIFT + 0)) or \
      (0 shl (D3DSP_SWIZZLE_SHIFT + 2)) or \
      (0 shl (D3DSP_SWIZZLE_SHIFT + 4)) or \
      (0 shl (D3DSP_SWIZZLE_SHIFT + 6)) )

D3DSP_REPLICATEGREEN equ \
    ( (1 shl (D3DSP_SWIZZLE_SHIFT + 0)) or \
      (1 shl (D3DSP_SWIZZLE_SHIFT + 2)) or \
      (1 shl (D3DSP_SWIZZLE_SHIFT + 4)) or \
      (1 shl (D3DSP_SWIZZLE_SHIFT + 6)) )

D3DSP_REPLICATEBLUE equ \
    ( (2 shl (D3DSP_SWIZZLE_SHIFT + 0)) or \
      (2 shl (D3DSP_SWIZZLE_SHIFT + 2)) or \
      (2 shl (D3DSP_SWIZZLE_SHIFT + 4)) or \
      (2 shl (D3DSP_SWIZZLE_SHIFT + 6)) )

D3DSP_REPLICATEALPHA equ \
    ( (3 shl (D3DSP_SWIZZLE_SHIFT + 0)) or \
      (3 shl (D3DSP_SWIZZLE_SHIFT + 2)) or \
      (3 shl (D3DSP_SWIZZLE_SHIFT + 4)) or \
      (3 shl (D3DSP_SWIZZLE_SHIFT + 6)) )

D3DSP_SRCMOD_SHIFT	equ 24
D3DSP_SRCMOD_MASK	equ 0x0F000000

.enum D3DSHADER_PARAM_SRCMOD_TYPE {
    D3DSPSM_NONE    = 0 shl D3DSP_SRCMOD_SHIFT,
    D3DSPSM_NEG	    = 1 shl D3DSP_SRCMOD_SHIFT,
    D3DSPSM_BIAS    = 2 shl D3DSP_SRCMOD_SHIFT,
    D3DSPSM_BIASNEG = 3 shl D3DSP_SRCMOD_SHIFT,
    D3DSPSM_SIGN    = 4 shl D3DSP_SRCMOD_SHIFT,
    D3DSPSM_SIGNNEG = 5 shl D3DSP_SRCMOD_SHIFT,
    D3DSPSM_COMP    = 6 shl D3DSP_SRCMOD_SHIFT,
    D3DSPSM_X2	    = 7 shl D3DSP_SRCMOD_SHIFT,
    D3DSPSM_X2NEG   = 8 shl D3DSP_SRCMOD_SHIFT,
    D3DSPSM_DZ	    = 9 shl D3DSP_SRCMOD_SHIFT,
    D3DSPSM_DW	    = 10 shl D3DSP_SRCMOD_SHIFT,
    D3DSPSM_FORCE_DWORD = 0x7fffffff,
    }

D3DPS_VERSION macro _Major,_Minor
	exitm<(0xFFFF0000 or ((_Major) shl 8) or (_Minor))>
	endm

D3DVS_VERSION macro _Major,_Minor
	exitm<(0xFFFE0000 or ((_Major) shl 8) or (_Minor))
	endm

D3DSHADER_VERSION_MAJOR macro _Version
	exitm<(((_Version) shr 8) and 0xFF)>
	endm

D3DSHADER_VERSION_MINOR macro _Version
	exitm<(((_Version) shr 0) and 0xFF)>
	endm

D3DSI_COMMENTSIZE_SHIFT	    equ 16
D3DSI_COMMENTSIZE_MASK	    equ 0x7FFF0000
D3DSHADER_COMMENT macro _DWordSize
    exitm<((((_DWordSize) shl D3DSI_COMMENTSIZE_SHIFT) and D3DSI_COMMENTSIZE_MASK) or D3DSIO_COMMENT)>
    endm

D3DPS_END macro
	exitm<0x0000FFFF>
	endm
D3DVS_END macro
	exitm<0x0000FFFF>
	endm

.enum D3DBASISTYPE {
   D3DBASIS_BEZIER	= 0,
   D3DBASIS_BSPLINE	= 1,
   D3DBASIS_INTERPOLATE = 2,
   D3DBASIS_FORCE_DWORD = 0x7fffffff,
   }

.enum D3DORDERTYPE {
   D3DORDER_LINEAR	= 1,
   D3DORDER_QUADRATIC	= 2,
   D3DORDER_CUBIC	= 3,
   D3DORDER_QUINTIC	= 5,
   D3DORDER_FORCE_DWORD = 0x7fffffff,
   }

.enum D3DPATCHEDGESTYLE {
   D3DPATCHEDGE_DISCRETE    = 0,
   D3DPATCHEDGE_CONTINUOUS  = 1,
   D3DPATCHEDGE_FORCE_DWORD = 0x7fffffff,
   }

.enum D3DSTATEBLOCKTYPE {
    D3DSBT_ALL		 = 1,
    D3DSBT_PIXELSTATE	 = 2,
    D3DSBT_VERTEXSTATE	 = 3,
    D3DSBT_FORCE_DWORD	 = 0x7fffffff,
    }


.enum D3DVERTEXBLENDFLAGS {
    D3DVBF_DISABLE  = 0,
    D3DVBF_1WEIGHTS = 1,
    D3DVBF_2WEIGHTS = 2,
    D3DVBF_3WEIGHTS = 3,
    D3DVBF_TWEENING = 255,
    D3DVBF_0WEIGHTS = 256,
    D3DVBF_FORCE_DWORD = 0x7fffffff,
    }

.enum D3DTEXTURETRANSFORMFLAGS {
    D3DTTFF_DISABLE	    = 0,
    D3DTTFF_COUNT1	    = 1,
    D3DTTFF_COUNT2	    = 2,
    D3DTTFF_COUNT3	    = 3,
    D3DTTFF_COUNT4	    = 4,
    D3DTTFF_PROJECTED	    = 256,
    D3DTTFF_FORCE_DWORD	    = 0x7fffffff,
    }

D3DFVF_TEXTUREFORMAT2 equ 0
D3DFVF_TEXTUREFORMAT1 equ 3
D3DFVF_TEXTUREFORMAT3 equ 1
D3DFVF_TEXTUREFORMAT4 equ 2

D3DFVF_TEXCOORDSIZE3 macro CoordIndex
	exitm<(D3DFVF_TEXTUREFORMAT3 shl (CoordIndex*2 + 16))>
	endm
D3DFVF_TEXCOORDSIZE2 macro CoordIndex
	exitm<(D3DFVF_TEXTUREFORMAT2)>
	endm
D3DFVF_TEXCOORDSIZE4 macro CoordIndex
	exitm<(D3DFVF_TEXTUREFORMAT4 shl (CoordIndex*2 + 16))>
	endm
D3DFVF_TEXCOORDSIZE1 macro CoordIndex
	exitm<(D3DFVF_TEXTUREFORMAT1 shl (CoordIndex*2 + 16))>
	endm


.enum D3DDEVTYPE {
    D3DDEVTYPE_HAL	   = 1,
    D3DDEVTYPE_REF	   = 2,
    D3DDEVTYPE_SW	   = 3,
    D3DDEVTYPE_FORCE_DWORD  = 0x7fffffff
    }

.enum D3DMULTISAMPLE_TYPE {
    D3DMULTISAMPLE_NONE		   =  0,
    D3DMULTISAMPLE_2_SAMPLES	   =  2,
    D3DMULTISAMPLE_3_SAMPLES	   =  3,
    D3DMULTISAMPLE_4_SAMPLES	   =  4,
    D3DMULTISAMPLE_5_SAMPLES	   =  5,
    D3DMULTISAMPLE_6_SAMPLES	   =  6,
    D3DMULTISAMPLE_7_SAMPLES	   =  7,
    D3DMULTISAMPLE_8_SAMPLES	   =  8,
    D3DMULTISAMPLE_9_SAMPLES	   =  9,
    D3DMULTISAMPLE_10_SAMPLES	   = 10,
    D3DMULTISAMPLE_11_SAMPLES	   = 11,
    D3DMULTISAMPLE_12_SAMPLES	   = 12,
    D3DMULTISAMPLE_13_SAMPLES	   = 13,
    D3DMULTISAMPLE_14_SAMPLES	   = 14,
    D3DMULTISAMPLE_15_SAMPLES	   = 15,
    D3DMULTISAMPLE_16_SAMPLES	   = 16,

    D3DMULTISAMPLE_FORCE_DWORD	   = 0x7fffffff
    }

ifndef MAKEFOURCC
MAKEFOURCC macro ch0, ch1, ch2, ch3
    exitm<@CatStr(%((ch0) or ((ch1) shl 8) or ((ch2) shl 16) or ((ch3) shl 24 )))>
    endm
endif


.enum D3DFORMAT {
    D3DFMT_UNKNOWN		=  0,

    D3DFMT_R8G8B8		= 20,
    D3DFMT_A8R8G8B8		= 21,
    D3DFMT_X8R8G8B8		= 22,
    D3DFMT_R5G6B5		= 23,
    D3DFMT_X1R5G5B5		= 24,
    D3DFMT_A1R5G5B5		= 25,
    D3DFMT_A4R4G4B4		= 26,
    D3DFMT_R3G3B2		= 27,
    D3DFMT_A8			= 28,
    D3DFMT_A8R3G3B2		= 29,
    D3DFMT_X4R4G4B4		= 30,
    D3DFMT_A2B10G10R10		= 31,
    D3DFMT_G16R16		= 34,

    D3DFMT_A8P8			= 40,
    D3DFMT_P8			= 41,

    D3DFMT_L8			= 50,
    D3DFMT_A8L8			= 51,
    D3DFMT_A4L4			= 52,

    D3DFMT_V8U8			= 60,
    D3DFMT_L6V5U5		= 61,
    D3DFMT_X8L8V8U8		= 62,
    D3DFMT_Q8W8V8U8		= 63,
    D3DFMT_V16U16		= 64,
    D3DFMT_W11V11U10		= 65,
    D3DFMT_A2W10V10U10		= 67,

    D3DFMT_UYVY			= MAKEFOURCC('U', 'Y', 'V', 'Y'),
    D3DFMT_YUY2			= MAKEFOURCC('Y', 'U', 'Y', '2'),
    D3DFMT_DXT1			= MAKEFOURCC('D', 'X', 'T', '1'),
    D3DFMT_DXT2			= MAKEFOURCC('D', 'X', 'T', '2'),
    D3DFMT_DXT3			= MAKEFOURCC('D', 'X', 'T', '3'),
    D3DFMT_DXT4			= MAKEFOURCC('D', 'X', 'T', '4'),
    D3DFMT_DXT5			= MAKEFOURCC('D', 'X', 'T', '5'),

    D3DFMT_D16_LOCKABLE		= 70,
    D3DFMT_D32			= 71,
    D3DFMT_D15S1		= 73,
    D3DFMT_D24S8		= 75,
    D3DFMT_D16			= 80,
    D3DFMT_D24X8		= 77,
    D3DFMT_D24X4S4		= 79,


    D3DFMT_VERTEXDATA		=100,
    D3DFMT_INDEX16		=101,
    D3DFMT_INDEX32		=102,

    D3DFMT_FORCE_DWORD		=0x7fffffff
    }

D3DDISPLAYMODE		STRUC
Width			UINT ?
Height			UINT ?
RefreshRate		UINT ?
Format			D3DFORMAT ?
D3DDISPLAYMODE		ENDS

D3DDEVICE_CREATION_PARAMETERS STRUC
AdapterOrdinal		UINT ?
DeviceType		D3DDEVTYPE ?
hFocusWindow		HWND ?
BehaviorFlags		DWORD ?
D3DDEVICE_CREATION_PARAMETERS ENDS


.enum D3DSWAPEFFECT {
    D3DSWAPEFFECT_DISCARD	    = 1,
    D3DSWAPEFFECT_FLIP		    = 2,
    D3DSWAPEFFECT_COPY		    = 3,
    D3DSWAPEFFECT_COPY_VSYNC	    = 4,
    D3DSWAPEFFECT_FORCE_DWORD	    = 0x7fffffff
    }

.enum D3DPOOL {
    D3DPOOL_DEFAULT		    = 0,
    D3DPOOL_MANAGED		    = 1,
    D3DPOOL_SYSTEMMEM		    = 2,
    D3DPOOL_SCRATCH		    = 3,
    D3DPOOL_FORCE_DWORD		    = 0x7fffffff
    }


D3DPRESENT_RATE_DEFAULT		equ 0x00000000
D3DPRESENT_RATE_UNLIMITED	equ 0x7fffffff


D3DPRESENT_PARAMETERS	STRUC
BackBufferWidth		UINT ?
BackBufferHeight	UINT ?
BackBufferFormat	D3DFORMAT ?
BackBufferCount		UINT ?
MultiSampleType		D3DMULTISAMPLE_TYPE ?
SwapEffect		D3DSWAPEFFECT ?
hDeviceWindow		HWND ?
Windowed		BOOL ?
EnableAutoDepthStencil	BOOL ?
AutoDepthStencilFormat	D3DFORMAT ?
Flags			DWORD ?
FullScreen_RefreshRateInHz UINT ?
FullScreen_PresentationInterval UINT ?
D3DPRESENT_PARAMETERS	ENDS

D3DPRESENTFLAG_LOCKABLE_BACKBUFFER  0x00000001


D3DGAMMARAMP		STRUC
red			WORD 256 dup(?)
green			WORD 256 dup(?)
blue			WORD 256 dup(?)
D3DGAMMARAMP		ENDS

.enum D3DBACKBUFFER_TYPE {
    D3DBACKBUFFER_TYPE_MONO	    = 0,
    D3DBACKBUFFER_TYPE_LEFT	    = 1,
    D3DBACKBUFFER_TYPE_RIGHT	    = 2,
    D3DBACKBUFFER_TYPE_FORCE_DWORD  = 0x7fffffff
    }

.enum D3DRESOURCETYPE {
    D3DRTYPE_SURFACE		    =  1,
    D3DRTYPE_VOLUME		    =  2,
    D3DRTYPE_TEXTURE		    =  3,
    D3DRTYPE_VOLUMETEXTURE	    =  4,
    D3DRTYPE_CUBETEXTURE	    =  5,
    D3DRTYPE_VERTEXBUFFER	    =  6,
    D3DRTYPE_INDEXBUFFER	    =  7,
    D3DRTYPE_FORCE_DWORD	    = 0x7fffffff
    }

D3DUSAGE_RENDERTARGET	    equ 0x00000001
D3DUSAGE_DEPTHSTENCIL	    equ 0x00000002

D3DUSAGE_WRITEONLY	    equ 0x00000008
D3DUSAGE_SOFTWAREPROCESSING equ 0x00000010
D3DUSAGE_DONOTCLIP	    equ 0x00000020
D3DUSAGE_POINTS		    equ 0x00000040
D3DUSAGE_RTPATCHES	    equ 0x00000080
D3DUSAGE_NPATCHES	    equ 0x00000100
D3DUSAGE_DYNAMIC	    equ 0x00000200


.enum D3DCUBEMAP_FACES {
    D3DCUBEMAP_FACE_POSITIVE_X	   = 0,
    D3DCUBEMAP_FACE_NEGATIVE_X	   = 1,
    D3DCUBEMAP_FACE_POSITIVE_Y	   = 2,
    D3DCUBEMAP_FACE_NEGATIVE_Y	   = 3,
    D3DCUBEMAP_FACE_POSITIVE_Z	   = 4,
    D3DCUBEMAP_FACE_NEGATIVE_Z	   = 5,
    D3DCUBEMAP_FACE_FORCE_DWORD	   = 0x7fffffff
    }


D3DLOCK_READONLY	    equ 0x00000010
D3DLOCK_DISCARD		    equ 0x00002000
D3DLOCK_NOOVERWRITE	    equ 0x00001000
D3DLOCK_NOSYSLOCK	    equ 0x00000800

D3DLOCK_NO_DIRTY_UPDATE	    equ 0x00008000

D3DVERTEXBUFFER_DESC	STRUC
Format			D3DFORMAT ?
Type			D3DRESOURCETYPE ?
Usage			DWORD ?
Pool			D3DPOOL ?
Size			UINT ?
FVF			DWORD ?
D3DVERTEXBUFFER_DESC	ENDS

D3DINDEXBUFFER_DESC	STRUC
Format			D3DFORMAT ?
Type			D3DRESOURCETYPE ?
Usage			DWORD ?
Pool			D3DPOOL ?
Size			UINT ?
D3DINDEXBUFFER_DESC	ENDS


D3DSURFACE_DESC		PROC
Format			D3DFORMAT ?
Type			D3DRESOURCETYPE ?
Usage			DWORD ?
Pool			D3DPOOL ?
Size			UINT ?
MultiSampleType		D3DMULTISAMPLE_TYPE ?
Width			UINT ?
Height			UINT ?
D3DSURFACE_DESC		ENDS

D3DVOLUME_DESC		STRUC
Format			D3DFORMAT ?
Type			D3DRESOURCETYPE ?
Usage			DWORD ?
Pool			D3DPOOL ?
Size			UINT ?
Width			UINT ?
Height			UINT ?
Depth			UINT ?
D3DVOLUME_DESC		ENDS

D3DLOCKED_RECT		STRUC
Pitch			SINT ?
pBits			PVOID ?
D3DLOCKED_RECT		ENDS

D3DBOX			STRUC
Left			UINT ?
Top			UINT ?
Right			UINT ?
Bottom			UINT ?
Front			UINT ?
Back			UINT ?
D3DBOX			ENDS

D3DLOCKED_BOX		STRUC
RowPitch		SINT ?
SlicePitch		SINT ?
pBits			PVOID ?
D3DLOCKED_BOX		ENDS

D3DRANGE		STRUC
Offs			UINT ?
Size			UINT ?
D3DRANGE		ENDS

D3DRECTPATCH_INFO	STRUC
StartVertexOffsetWidth	UINT ?
StartVertexOffsetHeight UINT ?
Width			UINT ?
Height			UINT ?
Stride			UINT ?
Basis			D3DBASISTYPE ?
Order			D3DORDERTYPE ?
D3DRECTPATCH_INFO	ENDS

D3DTRIPATCH_INFO	STRUC
StartVertexOffset	UINT ?
NumVertices		UINT ?
Basis			D3DBASISTYPE ?
Order			D3DORDERTYPE ?
D3DTRIPATCH_INFO	ENDS

MAX_DEVICE_IDENTIFIER_STRING equ 512

D3DADAPTER_IDENTIFIER8	STRUC
Driver			MAX_DEVICE_IDENTIFIER_STRING SBYTE dup(?)
Description		MAX_DEVICE_IDENTIFIER_STRING SBYTE dup(?)
DriverVersion		LARGE_INTEGER ?
VendorId		DWORD ?
DeviceId		DWORD ?
SubSysId		DWORD ?
Revision		DWORD ?
DeviceIdentifier	GUID <>
WHQLLevel		DWORD ?
D3DADAPTER_IDENTIFIER8	ENDS

D3DRASTER_STATUS	STRUC
InVBlank		BOOL ?
ScanLine		UINT ?
D3DRASTER_STATUS	ENDS


.enum D3DDEBUGMONITORTOKENS {
    D3DDMT_ENABLE	= 0,
    D3DDMT_DISABLE	= 1,
    D3DDMT_FORCE_DWORD	= 0x7fffffff,
    }

D3DDEVINFOID_RESOURCEMANAGER equ 5
D3DDEVINFOID_VERTEXSTATS     equ 6

D3DRESOURCESTATS	STRUC
bThrashing		BOOL ?
ApproxBytesDownloaded	DWORD ?
NumEvicts		DWORD ?
NumVidCreates		DWORD ?
LastPri			DWORD ?
NumUsed			DWORD ?
NumUsedInVidMem		DWORD ?
WorkingSet		DWORD ?
WorkingSetBytes		DWORD ?
TotalManaged		DWORD ?
TotalBytes		DWORD ?
D3DRESOURCESTATS	ENDS

D3DRTYPECOUNT equ (D3DRTYPE_INDEXBUFFER+1)

D3DDEVINFO_RESOURCEMANAGER STRUC
stats			D3DRESOURCESTATS D3DRTYPECOUNT dup(?)
D3DDEVINFO_RESOURCEMANAGER ENDS
LPD3DDEVINFO_RESOURCEMANAGER typedef ptr D3DDEVINFO_RESOURCEMANAGER

D3DDEVINFO_D3DVERTEXSTATS STRUC
NumRenderedTriangles	DWORD ?
NumExtraClippingTriangles DWORD ?
D3DDEVINFO_D3DVERTEXSTATS ENDS
LPD3DDEVINFO_D3DVERTEXSTATS


.pragma pack(pop)

endif ;; (DIRECT3D_VERSION >= 0x0800)
endif ;; _D3D8TYPES(P)_H_

