ifndef _d3d9TYPES_H_
define _d3d9TYPES_H_
.pragma pack(push, 8)

ifndef DIRECT3D_VERSION
DIRECT3D_VERSION equ 0x0900
endif

if (DIRECT3D_VERSION GE 0x0900)

include float.inc

ifndef D3DCOLOR_DEFINED
define D3DCOLOR_DEFINED
D3DCOLOR typedef DWORD
endif

D3DCOLOR_ARGB macro a,r,g,b
	exitm<(((((a) and 0xff) shl 24) or (((r) and 0xff) shl 16) or (((g) and 0xff) shl 8) or ((b) and 0xff)))>
	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_XYUV macro y,u,v
	exitm<D3DCOLOR_ARGB(0xff,y,u,v)>
	endm
D3DCOLOR_AYUV macro a,y,u,v
	exitm<D3DCOLOR_ARGB(a,y,u,v)>
	endm

D3DCOLOR_COLORVALUE macro r,g,b,a
	exitm<D3DCOLOR_RGBA(r*255.0,g*255.0,b*255.0,a*255.0)>
	endm

ifndef D3DVECTOR_DEFINED
define D3DVECTOR_DEFINED
.template D3DVECTOR
    x	real4 ?
    y	real4 ?
    z	real4 ?
    .static D3DVECTOR :abs=<0.0>, :abs=<0.0>, :abs=<0.0> {
	mov this.x,_1
	mov this.y,_2
	mov this.z,_3
	}
    .ENDS
endif

ifndef D3DCOLORVALUE_DEFINED
define D3DCOLORVALUE_DEFINED

sc_redShift	equ 16
sc_greenShift	equ 8
sc_blueShift	equ 0

sc_redMask	equ (0xff shl sc_redShift)
sc_greenMask	equ (0xff shl sc_greenShift)
sc_blueMask	equ (0xff shl sc_blueShift)

.template D3DCOLORVALUE

    r real4 ?
    g real4 ?
    b real4 ?
    a real4 ?

    .inline D3DCOLORVALUE :vararg {
	ifidn typeid(this),<D3DCOLORVALUE>
	    this.Init(_1)
	else
	    [rcx].D3DCOLORVALUE.typeid(D3DCOLORVALUE_, this)(_1)
	endif
	}

    .inline D3DCOLORVALUE_imm :vararg {
      local n
       .new n:D3DCOLORVALUE
	n.Init(_1)
	}

    .inline Init :abs, :abs, :vararg {
	ifidn typeid(this),<D3DCOLORVALUE>
	    lea rcx,this
	endif
	ifnb <_2>
	    ifidn typeid(_2),<oword>
		movss [rcx].D3DCOLORVALUE.a,_2
	    else
		mov [rcx].D3DCOLORVALUE.a,_2
	    endif
	endif
	ifnb <_1>
	    ifidn typeid(_1),<imm>
	       %mov [rcx].D3DCOLORVALUE.r, @CatStr(%((_1 and sc_redMask) shr sc_redShift),     <.0>) / 255.0
	       %mov [rcx].D3DCOLORVALUE.g, @CatStr(%((_1 and sc_greenMask) shr sc_greenShift), <.0>) / 255.0
	       %mov [rcx].D3DCOLORVALUE.b, @CatStr(%((_1 and sc_blueMask) shr sc_blueShift),   <.0>) / 255.0
	    else
		mov	 eax,_1
		and	 eax,sc_redMask
		shr	 eax,sc_redShift
		cvtsi2ss xmm0,eax
		divss	 xmm0,255.0
		movss	 [rcx].D3DCOLORVALUE.r,xmm0
		mov	 eax,_1
		and	 eax,sc_greenMask
		shr	 eax,sc_greenShift
		cvtsi2ss xmm0,eax
		divss	 xmm0,255.0
		movss	 [rcx].D3DCOLORVALUE.g,xmm0
		mov	 eax,_1
		and	 eax,sc_blueMask
		shr	 eax,sc_blueShift
		cvtsi2ss xmm0,eax
		divss	 xmm0,255.0
		movss	 [rcx].D3DCOLORVALUE.b,xmm0
	    endif
	endif
	mov rax,rcx
	}
    .ends
endif

ifndef D3DRECT_DEFINED
D3DRECT			STRUC
x1			LONG ?
y1			LONG ?
x2			LONG ?
y2			LONG ?
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*4 dup(?)
ENDS
D3DMATRIX		ENDS
D3DMATRIX_DEFINED equ 1
endif

D3DVIEWPORT9		STRUC
X			dd ?
Y			dd ?
Width			dd ?
Height			dd ?
MinZ			REAL4 ?
MaxZ			REAL4 ?
D3DVIEWPORT9		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

D3DCLIPSTATUS9		STRUC
ClipUnion		dd ?
ClipIntersection	dd ?
D3DCLIPSTATUS9		ENDS

D3DMATERIAL9		STRUC
Diffuse			D3DCOLORVALUE <>
Ambient			D3DCOLORVALUE <>
Specular		D3DCOLORVALUE <>
Emissive		D3DCOLORVALUE <>
Power			REAL4 ?
D3DMATERIAL9		ENDS

D3DLIGHTTYPE		typedef SDWORD
D3DLIGHT_POINT		equ 1
D3DLIGHT_SPOT		equ 2
D3DLIGHT_DIRECTIONAL	equ 3
D3DLIGHT_FORCE_DWORD	equ 0x7fffffff


D3DLIGHT9		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 ?
D3DLIGHT9		ENDS

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

D3DSHADEMODE		typedef SDWORD
D3DSHADE_FLAT		equ 1
D3DSHADE_GOURAUD	equ 2
D3DSHADE_PHONG		equ 3
D3DSHADE_FORCE_DWORD	equ 0x7fffffff

D3DFILLMODE		typedef SDWORD
D3DFILL_POINT		equ 1
D3DFILL_WIREFRAME	equ 2
D3DFILL_SOLID		equ 3
D3DFILL_FORCE_DWORD	equ 0x7fffffff

D3DBLEND		typedef SDWORD
D3DBLEND_ZERO		equ 1
D3DBLEND_ONE		equ 2
D3DBLEND_SRCCOLOR	equ 3
D3DBLEND_INVSRCCOLOR	equ 4
D3DBLEND_SRCALPHA	equ 5
D3DBLEND_INVSRCALPHA	equ 6
D3DBLEND_DESTALPHA	equ 7
D3DBLEND_INVDESTALPHA	equ 8
D3DBLEND_DESTCOLOR	equ 9
D3DBLEND_INVDESTCOLOR	equ 10
D3DBLEND_SRCALPHASAT	equ 11
D3DBLEND_BOTHSRCALPHA	equ 12
D3DBLEND_BOTHINVSRCALPHA equ 13
D3DBLEND_BLENDFACTOR	equ 14
D3DBLEND_INVBLENDFACTOR equ 15
ifndef D3D_DISABLE_9EX
D3DBLEND_SRCCOLOR2	equ 16
D3DBLEND_INVSRCCOLOR2	equ 17
endif
D3DBLEND_FORCE_DWORD	equ 0x7fffffff

D3DBLENDOP		typedef SDWORD
D3DBLENDOP_ADD		equ 1
D3DBLENDOP_SUBTRACT	equ 2
D3DBLENDOP_REVSUBTRACT	equ 3
D3DBLENDOP_MIN		equ 4
D3DBLENDOP_MAX		equ 5
D3DBLENDOP_FORCE_DWORD	equ 0x7fffffff

D3DTEXTUREADDRESS	typedef SDWORD
D3DTADDRESS_WRAP	equ 1
D3DTADDRESS_MIRROR	equ 2
D3DTADDRESS_CLAMP	equ 3
D3DTADDRESS_BORDER	equ 4
D3DTADDRESS_MIRRORONCE	equ 5
D3DTADDRESS_FORCE_DWORD equ 0x7fffffff

D3DCULL			typedef SDWORD
D3DCULL_NONE		equ 1
D3DCULL_CW		equ 2
D3DCULL_CCW		equ 3
D3DCULL_FORCE_DWORD	equ 0x7fffffff

D3DCMPFUNC		typedef SDWORD
D3DCMP_NEVER		equ 1
D3DCMP_LESS		equ 2
D3DCMP_EQUAL		equ 3
D3DCMP_LESSEQUAL	equ 4
D3DCMP_GREATER		equ 5
D3DCMP_NOTEQUAL		equ 6
D3DCMP_GREATEREQUAL	equ 7
D3DCMP_ALWAYS		equ 8
D3DCMP_FORCE_DWORD	equ 0x7fffffff

D3DSTENCILOP		typedef SDWORD
D3DSTENCILOP_KEEP	equ 1
D3DSTENCILOP_ZERO	equ 2
D3DSTENCILOP_REPLACE	equ 3
D3DSTENCILOP_INCRSAT	equ 4
D3DSTENCILOP_DECRSAT	equ 5
D3DSTENCILOP_INVERT	equ 6
D3DSTENCILOP_INCR	equ 7
D3DSTENCILOP_DECR	equ 8
D3DSTENCILOP_FORCE_DWORD equ 0x7fffffff

D3DFOGMODE		typedef SDWORD
D3DFOG_NONE		equ 0
D3DFOG_EXP		equ 1
D3DFOG_EXP2		equ 2
D3DFOG_LINEAR		equ 3
D3DFOG_FORCE_DWORD	equ 0x7fffffff

D3DZBUFFERTYPE		typedef SDWORD
D3DZB_FALSE		equ 0
D3DZB_TRUE		equ 1
D3DZB_USEW		equ 2
D3DZB_FORCE_DWORD	equ 0x7fffffff

D3DPRIMITIVETYPE	typedef SDWORD
D3DPT_POINTLIST		equ 1
D3DPT_LINELIST		equ 2
D3DPT_LINESTRIP		equ 3
D3DPT_TRIANGLELIST	equ 4
D3DPT_TRIANGLESTRIP	equ 5
D3DPT_TRIANGLEFAN	equ 6
D3DPT_FORCE_DWORD	equ 0x7fffffff

D3DTRANSFORMSTATETYPE	typedef SDWORD
D3DTS_VIEW		equ 2
D3DTS_PROJECTION	equ 3
D3DTS_TEXTURE0		equ 16
D3DTS_TEXTURE1		equ 17
D3DTS_TEXTURE2		equ 18
D3DTS_TEXTURE3		equ 19
D3DTS_TEXTURE4		equ 20
D3DTS_TEXTURE5		equ 21
D3DTS_TEXTURE6		equ 22
D3DTS_TEXTURE7		equ 23
D3DTS_FORCE_DWORD	equ 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)

D3DRENDERSTATETYPE	typedef SDWORD
D3DRS_ZENABLE			equ 7
D3DRS_FILLMODE			equ 8
D3DRS_SHADEMODE			equ 9
D3DRS_ZWRITEENABLE		equ 14
D3DRS_ALPHATESTENABLE		equ 15
D3DRS_LASTPIXEL			equ 16
D3DRS_SRCBLEND			equ 19
D3DRS_DESTBLEND			equ 20
D3DRS_CULLMODE			equ 22
D3DRS_ZFUNC			equ 23
D3DRS_ALPHAREF			equ 24
D3DRS_ALPHAFUNC			equ 25
D3DRS_DITHERENABLE		equ 26
D3DRS_ALPHABLENDENABLE		equ 27
D3DRS_FOGENABLE			equ 28
D3DRS_SPECULARENABLE		equ 29
D3DRS_FOGCOLOR			equ 34
D3DRS_FOGTABLEMODE		equ 35
D3DRS_FOGSTART			equ 36
D3DRS_FOGEND			equ 37
D3DRS_FOGDENSITY		equ 38
D3DRS_RANGEFOGENABLE		equ 48
D3DRS_STENCILENABLE		equ 52
D3DRS_STENCILFAIL		equ 53
D3DRS_STENCILZFAIL		equ 54
D3DRS_STENCILPASS		equ 55
D3DRS_STENCILFUNC		equ 56
D3DRS_STENCILREF		equ 57
D3DRS_STENCILMASK		equ 58
D3DRS_STENCILWRITEMASK		equ 59
D3DRS_TEXTUREFACTOR		equ 60
D3DRS_WRAP0			equ 128
D3DRS_WRAP1			equ 129
D3DRS_WRAP2			equ 130
D3DRS_WRAP3			equ 131
D3DRS_WRAP4			equ 132
D3DRS_WRAP5			equ 133
D3DRS_WRAP6			equ 134
D3DRS_WRAP7			equ 135
D3DRS_CLIPPING			equ 136
D3DRS_LIGHTING			equ 137
D3DRS_AMBIENT			equ 139
D3DRS_FOGVERTEXMODE		equ 140
D3DRS_COLORVERTEX		equ 141
D3DRS_LOCALVIEWER		equ 142
D3DRS_NORMALIZENORMALS		equ 143
D3DRS_DIFFUSEMATERIALSOURCE	equ 145
D3DRS_SPECULARMATERIALSOURCE	equ 146
D3DRS_AMBIENTMATERIALSOURCE	equ 147
D3DRS_EMISSIVEMATERIALSOURCE	equ 148
D3DRS_VERTEXBLEND		equ 151
D3DRS_CLIPPLANEENABLE		equ 152
D3DRS_POINTSIZE			equ 154
D3DRS_POINTSIZE_MIN		equ 155
D3DRS_POINTSPRITEENABLE		equ 156
D3DRS_POINTSCALEENABLE		equ 157
D3DRS_POINTSCALE_A		equ 158
D3DRS_POINTSCALE_B		equ 159
D3DRS_POINTSCALE_C		equ 160
D3DRS_MULTISAMPLEANTIALIAS	equ 161
D3DRS_MULTISAMPLEMASK		equ 162
D3DRS_PATCHEDGESTYLE		equ 163
D3DRS_DEBUGMONITORTOKEN		equ 165
D3DRS_POINTSIZE_MAX		equ 166
D3DRS_INDEXEDVERTEXBLENDENABLE	equ 167
D3DRS_COLORWRITEENABLE		equ 168
D3DRS_TWEENFACTOR		equ 170
D3DRS_BLENDOP			equ 171
D3DRS_POSITIONDEGREE		equ 172
D3DRS_NORMALDEGREE		equ 173
D3DRS_SCISSORTESTENABLE		equ 174
D3DRS_SLOPESCALEDEPTHBIAS	equ 175
D3DRS_ANTIALIASEDLINEENABLE	equ 176
D3DRS_MINTESSELLATIONLEVEL	equ 178
D3DRS_MAXTESSELLATIONLEVEL	equ 179
D3DRS_ADAPTIVETESS_X		equ 180
D3DRS_ADAPTIVETESS_Y		equ 181
D3DRS_ADAPTIVETESS_Z		equ 182
D3DRS_ADAPTIVETESS_W		equ 183
D3DRS_ENABLEADAPTIVETESSELLATION equ 184
D3DRS_TWOSIDEDSTENCILMODE	equ 185
D3DRS_CCW_STENCILFAIL		equ 186
D3DRS_CCW_STENCILZFAIL		equ 187
D3DRS_CCW_STENCILPASS		equ 188
D3DRS_CCW_STENCILFUNC		equ 189
D3DRS_COLORWRITEENABLE1		equ 190
D3DRS_COLORWRITEENABLE2		equ 191
D3DRS_COLORWRITEENABLE3		equ 192
D3DRS_BLENDFACTOR		equ 193
D3DRS_SRGBWRITEENABLE		equ 194
D3DRS_DEPTHBIAS			equ 195
D3DRS_WRAP8			equ 198
D3DRS_WRAP9			equ 199
D3DRS_WRAP10			equ 200
D3DRS_WRAP11			equ 201
D3DRS_WRAP12			equ 202
D3DRS_WRAP13			equ 203
D3DRS_WRAP14			equ 204
D3DRS_WRAP15			equ 205
D3DRS_SEPARATEALPHABLENDENABLE	equ 206
D3DRS_SRCBLENDALPHA		equ 207
D3DRS_DESTBLENDALPHA		equ 208
D3DRS_BLENDOPALPHA		equ 209

D3DRS_FORCE_DWORD		equ 0x7fffffff

D3D_MAX_SIMULTANEOUS_RENDERTARGETS equ 4

D3DMATERIALCOLORSOURCE	typedef SDWORD
D3DMCS_MATERIAL		equ 0
D3DMCS_COLOR1		equ 1
D3DMCS_COLOR2		equ 2
D3DMCS_FORCE_DWORD	equ 0x7fffffff

D3DRENDERSTATE_WRAPBIAS equ 128

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)

D3DTEXTURESTAGESTATETYPE typedef SDWORD
D3DTSS_COLOROP		equ  1
D3DTSS_COLORARG1	equ  2
D3DTSS_COLORARG2	equ  3
D3DTSS_ALPHAOP		equ  4
D3DTSS_ALPHAARG1	equ  5
D3DTSS_ALPHAARG2	equ  6
D3DTSS_BUMPENVMAT00	equ  7
D3DTSS_BUMPENVMAT01	equ  8
D3DTSS_BUMPENVMAT10	equ  9
D3DTSS_BUMPENVMAT11	equ 10
D3DTSS_TEXCOORDINDEX	equ 11
D3DTSS_BUMPENVLSCALE	equ 22
D3DTSS_BUMPENVLOFFSET	equ 23
D3DTSS_TEXTURETRANSFORMFLAGS equ 24
D3DTSS_COLORARG0	equ 26
D3DTSS_ALPHAARG0	equ 27
D3DTSS_RESULTARG	equ 28
D3DTSS_CONSTANT		equ 32
D3DTSS_FORCE_DWORD	equ 0x7fffffff


D3DSAMPLERSTATETYPE	typedef SDWORD
D3DSAMP_ADDRESSU	equ  1
D3DSAMP_ADDRESSV	equ  2
D3DSAMP_ADDRESSW	equ  3
D3DSAMP_BORDERCOLOR	equ  4
D3DSAMP_MAGFILTER	equ  5
D3DSAMP_MINFILTER	equ  6
D3DSAMP_MIPFILTER	equ  7
D3DSAMP_MIPMAPLODBIAS	equ  8
D3DSAMP_MAXMIPLEVEL	equ  9
D3DSAMP_MAXANISOTROPY	equ 10
D3DSAMP_SRGBTEXTURE	equ 11
D3DSAMP_ELEMENTINDEX	equ 12
D3DSAMP_DMAPOFFSET	equ 13
D3DSAMP_FORCE_DWORD	equ 0x7fffffff

D3DDMAPSAMPLER		equ 256

D3DVERTEXTEXTURESAMPLER0 equ (D3DDMAPSAMPLER+1)
D3DVERTEXTEXTURESAMPLER1 equ (D3DDMAPSAMPLER+2)
D3DVERTEXTEXTURESAMPLER2 equ (D3DDMAPSAMPLER+3)
D3DVERTEXTEXTURESAMPLER3 equ (D3DDMAPSAMPLER+4)

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

D3DTEXTUREOP		typedef SDWORD

D3DTOP_DISABLE			equ 1
D3DTOP_SELECTARG1		equ 2
D3DTOP_SELECTARG2		equ 3

D3DTOP_MODULATE			equ 4
D3DTOP_MODULATE2X		equ 5
D3DTOP_MODULATE4X		equ 6

D3DTOP_ADD			equ  7
D3DTOP_ADDSIGNED		equ  8
D3DTOP_ADDSIGNED2X		equ  9
D3DTOP_SUBTRACT			equ 10
D3DTOP_ADDSMOOTH		equ 11

D3DTOP_BLENDDIFFUSEALPHA	equ 12
D3DTOP_BLENDTEXTUREALPHA	equ 13
D3DTOP_BLENDFACTORALPHA		equ 14

D3DTOP_BLENDTEXTUREALPHAPM	equ 15
D3DTOP_BLENDCURRENTALPHA	equ 16

D3DTOP_PREMODULATE		equ 17
D3DTOP_MODULATEALPHA_ADDCOLOR	equ 18
D3DTOP_MODULATECOLOR_ADDALPHA	equ 19
D3DTOP_MODULATEINVALPHA_ADDCOLOR equ 20
D3DTOP_MODULATEINVCOLOR_ADDALPHA equ 21

D3DTOP_BUMPENVMAP		equ 22
D3DTOP_BUMPENVMAPLUMINANCE	equ 23

D3DTOP_DOTPRODUCT3		equ 24

D3DTOP_MULTIPLYADD		equ 25
D3DTOP_LERP			equ 26
D3DTOP_FORCE_DWORD		equ 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_CONSTANT		equ 0x00000006
D3DTA_COMPLEMENT	equ 0x00000010
D3DTA_ALPHAREPLICATE	equ 0x00000020

D3DTEXTUREFILTERTYPE	typedef SDWORD
D3DTEXF_NONE		equ 0
D3DTEXF_POINT		equ 1
D3DTEXF_LINEAR		equ 2
D3DTEXF_ANISOTROPIC	equ 3
D3DTEXF_PYRAMIDALQUAD	equ 6
D3DTEXF_GAUSSIANQUAD	equ 7
ifndef D3D_DISABLE_9EX
D3DTEXF_CONVOLUTIONMONO equ 8
endif
D3DTEXF_FORCE_DWORD	equ 0x7fffffff

D3DPV_DONOTCOPYDATA	equ (1 SHL 0)

D3DFVF_RESERVED0	equ 0x001
D3DFVF_POSITION_MASK	equ 0x400E
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_XYZW		equ 0x4002

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_LASTBETA_D3DCOLOR equ 0x8000

D3DFVF_RESERVED2	equ 0x6000

D3DDECLUSAGE		typedef SDWORD
D3DDECLUSAGE_POSITION	equ 0
D3DDECLUSAGE_BLENDWEIGHT equ 1
D3DDECLUSAGE_BLENDINDICES equ 2
D3DDECLUSAGE_NORMAL	equ 3
D3DDECLUSAGE_PSIZE	equ 4
D3DDECLUSAGE_TEXCOORD	equ 5
D3DDECLUSAGE_TANGENT	equ 6
D3DDECLUSAGE_BINORMAL	equ 7
D3DDECLUSAGE_TESSFACTOR equ 8
D3DDECLUSAGE_POSITIONT	equ 9
D3DDECLUSAGE_COLOR	equ 10
D3DDECLUSAGE_FOG	equ 11
D3DDECLUSAGE_DEPTH	equ 12
D3DDECLUSAGE_SAMPLE	equ 13

MAXD3DDECLUSAGE		equ D3DDECLUSAGE_SAMPLE
MAXD3DDECLUSAGEINDEX	equ 15
MAXD3DDECLLENGTH	equ 64

D3DDECLMETHOD		typedef SDWORD
D3DDECLMETHOD_DEFAULT	equ 0
D3DDECLMETHOD_PARTIALU	equ 2
D3DDECLMETHOD_PARTIALV	equ 3
D3DDECLMETHOD_CROSSUV	equ 4
D3DDECLMETHOD_LOOKUP	equ 5
D3DDECLMETHOD_LOOKUPPRESAMPLED equ 6

MAXD3DDECLMETHOD	equ D3DDECLMETHOD_LOOKUPPRESAMPLED

D3DDECLTYPE		typedef SDWORD
D3DDECLTYPE_FLOAT1	equ 0
D3DDECLTYPE_FLOAT2	equ 1
D3DDECLTYPE_FLOAT3	equ 2
D3DDECLTYPE_FLOAT4	equ 3
D3DDECLTYPE_D3DCOLOR	equ 4
D3DDECLTYPE_UBYTE4	equ 5
D3DDECLTYPE_SHORT2	equ 6
D3DDECLTYPE_SHORT4	equ 7

D3DDECLTYPE_UBYTE4N	equ 8
D3DDECLTYPE_SHORT2N	equ 9
D3DDECLTYPE_SHORT4N	equ 10
D3DDECLTYPE_USHORT2N	equ 11
D3DDECLTYPE_USHORT4N	equ 12
D3DDECLTYPE_UDEC3	equ 13
D3DDECLTYPE_DEC3N	equ 14
D3DDECLTYPE_FLOAT16_2	equ 15
D3DDECLTYPE_FLOAT16_4	equ 16
D3DDECLTYPE_UNUSED	equ 17


MAXD3DDECLTYPE		equ D3DDECTYPE_UNUSED

D3DVERTEXELEMENT9	STRUC
Stream			dw ?
_Offset			dw ?
Type			db ?
Method			db ?
Usage			db ?
UsageIndex		db ?
D3DVERTEXELEMENT9	ENDS
LPD3DVERTEXELEMENT9	typedef ptr D3DVERTEXELEMENT9

D3DDECL_END macro
	exitm<{0xFF,0,D3DDECTYPE_UNUSED,0,0,0}>
	endm

D3DDP_MAXTEXCOORD	equ 8

D3DSTREAMSOURCE_INDEXEDDATA equ (1 SHL 30)
D3DSTREAMSOURCE_INSTANCEDATA equ (2 SHL 30)




D3DSI_OPCODE_MASK	equ 0x0000FFFF

D3DSI_INSTLENGTH_MASK	equ 0x0F000000
D3DSI_INSTLENGTH_SHIFT	equ 24

D3DSHADER_INSTRUCTION_OPCODE_TYPE typedef SDWORD
D3DSIO_NOP		equ 0
D3DSIO_MOV		equ 2
D3DSIO_ADD		equ 3
D3DSIO_SUB		equ 4
D3DSIO_MAD		equ 5
D3DSIO_MUL		equ 6
D3DSIO_RCP		equ 7
D3DSIO_RSQ		equ 8
D3DSIO_DP3		equ 9
D3DSIO_DP4		equ 10
D3DSIO_MIN		equ 11
D3DSIO_MAX		equ 12
D3DSIO_SLT		equ 13
D3DSIO_SGE		equ 14
D3DSIO_EXP		equ 15
D3DSIO_LOG		equ 16
D3DSIO_LIT		equ 17
D3DSIO_DST		equ 18
D3DSIO_LRP		equ 19
D3DSIO_FRC		equ 20
D3DSIO_M4x4		equ 21
D3DSIO_M4x3		equ 22
D3DSIO_M3x4		equ 23
D3DSIO_M3x3		equ 24
D3DSIO_M3x2		equ 25
D3DSIO_CALL		equ 26
D3DSIO_CALLNZ		equ 27
D3DSIO_LOOP		equ 28
D3DSIO_RET		equ 29
D3DSIO_ENDLOOP		equ 30
D3DSIO_LABEL		equ 31
D3DSIO_DCL		equ 32
D3DSIO_POW		equ 33
D3DSIO_CRS		equ 34
D3DSIO_SGN		equ 35
D3DSIO_ABS		equ 36
D3DSIO_NRM		equ 37
D3DSIO_SINCOS		equ 38
D3DSIO_REP		equ 39
D3DSIO_ENDREP		equ 40
D3DSIO_IF		equ 41
D3DSIO_IFC		equ 42
D3DSIO_ELSE		equ 43
D3DSIO_ENDIF		equ 44
D3DSIO_BREAK		equ 45
D3DSIO_BREAKC		equ 46
D3DSIO_MOVA		equ 47
D3DSIO_DEFB		equ 48
D3DSIO_DEFI		equ 49
D3DSIO_TEXCOORD		equ 64
D3DSIO_TEXKILL		equ 51
D3DSIO_TEX		equ 52
D3DSIO_TEXBEM		equ 53
D3DSIO_TEXBEML		equ 54
D3DSIO_TEXREG2AR	equ 55
D3DSIO_TEXREG2GB	equ 56
D3DSIO_TEXM3x2PAD	equ 57
D3DSIO_TEXM3x2TEX	equ 58
D3DSIO_TEXM3x3PAD	equ 59
D3DSIO_TEXM3x3TEX	equ 60
D3DSIO_RESERVED0	equ 61
D3DSIO_TEXM3x3SPEC	equ 62
D3DSIO_TEXM3x3VSPEC	equ 63
D3DSIO_EXPP		equ 64
D3DSIO_LOGP		equ 65
D3DSIO_CND		equ 66
D3DSIO_DEF		equ 67
D3DSIO_TEXREG2RGB	equ 68
D3DSIO_TEXDP3TEX	equ 69
D3DSIO_TEXM3x2DEPTH	equ 70
D3DSIO_TEXDP3		equ 71
D3DSIO_TEXM3x3		equ 72
D3DSIO_TEXDEPTH		equ 73
D3DSIO_CMP		equ 74
D3DSIO_BEM		equ 75
D3DSIO_DP2ADD		equ 76
D3DSIO_DSX		equ 77
D3DSIO_DSY		equ 78
D3DSIO_TEXLDD		equ 79
D3DSIO_SETP		equ 80
D3DSIO_TEXLDL		equ 81
D3DSIO_BREAKP		equ 82
D3DSIO_PHASE		equ 0xFFFD
D3DSIO_COMMENT		equ 0xFFFE
D3DSIO_END		equ 0xFFFF
D3DSIO_FORCE_DWORD	equ 0x7fffffff


D3DSINCOSCONST1		equ <-1.5500992e-006, -2.1701389e-005, 0.0026041667, 0.00026041668>
D3DSINCOSCONST2		equ <-0.020833334, -0.12500000, 1.0, 0.50000000>

D3DSI_COISSUE		equ 0x40000000


D3DSP_OPCODESPECIFICCONTROL_MASK equ 0x00ff0000
D3DSP_OPCODESPECIFICCONTROL_SHIFT equ 16

D3DSI_TEXLD_PROJECT	equ (0x01 SHL D3DSP_OPCODESPECIFICCONTROL_SHIFT)
D3DSI_TEXLD_BIAS	equ (0x02 SHL D3DSP_OPCODESPECIFICCONTROL_SHIFT)

D3DSHADER_COMPARISON	typedef SDWORD
D3DSPC_RESERVED0	equ 0
D3DSPC_GT		equ 1
D3DSPC_EQ		equ 2
D3DSPC_GE		equ 3
D3DSPC_LT		equ 4
D3DSPC_NE		equ 5
D3DSPC_LE		equ 6
D3DSPC_RESERVED1	equ 7


D3DSHADER_COMPARISON_SHIFT equ D3DSP_OPCODESPECIFICCONTROL_SHIFT
D3DSHADER_COMPARISON_MASK equ (0x7 SHL D3DSHADER_COMPARISON_SHIFT)

D3DSHADER_INSTRUCTION_PREDICATED equ (0x1 SHL 28)


D3DSP_DCL_USAGE_SHIFT	equ 0
D3DSP_DCL_USAGE_MASK	equ 0x0000000f

D3DSP_DCL_USAGEINDEX_SHIFT equ 16
D3DSP_DCL_USAGEINDEX_MASK equ 0x000f0000

D3DSP_TEXTURETYPE_SHIFT equ 27
D3DSP_TEXTURETYPE_MASK	equ 0x78000000

D3DSAMPLER_TEXTURE_TYPE typedef SDWORD
D3DSTT_UNKNOWN		equ (0 shl D3DSP_TEXTURETYPE_SHIFT)
D3DSTT_2D		equ (2 shl D3DSP_TEXTURETYPE_SHIFT)
D3DSTT_CUBE		equ (3 shl D3DSP_TEXTURETYPE_SHIFT)
D3DSTT_VOLUME		equ (4 shl D3DSP_TEXTURETYPE_SHIFT)
D3DSTT_FORCE_DWORD	equ 0x7fffffff


D3DSP_REGNUM_MASK	equ 0x000007FF

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

D3DSPDM_NONE		equ (0 SHL D3DSP_DSTMOD_SHIFT)
D3DSPDM_SATURATE	equ (1 SHL D3DSP_DSTMOD_SHIFT)
D3DSPDM_PARTIALPRECISION equ (2 SHL D3DSP_DSTMOD_SHIFT)
D3DSPDM_MSAMPCENTROID	equ (4 SHL D3DSP_DSTMOD_SHIFT)

D3DSP_DSTSHIFT_SHIFT	equ 24
D3DSP_DSTSHIFT_MASK	equ 0x0F000000

D3DSP_REGTYPE_SHIFT	equ 28
D3DSP_REGTYPE_SHIFT2	equ 8
D3DSP_REGTYPE_MASK	equ 0x70000000
D3DSP_REGTYPE_MASK2	equ 0x00001800

D3DSHADER_PARAM_REGISTER_TYPE typedef SDWORD
D3DSPR_TEMP		equ  0
D3DSPR_INPUT		equ  1
D3DSPR_CONST		equ  2
D3DSPR_ADDR		equ  3
D3DSPR_TEXTURE		equ  3
D3DSPR_RASTOUT		equ  4
D3DSPR_ATTROUT		equ  5
D3DSPR_TEXCRDOUT	equ  6
D3DSPR_OUTPUT		equ  6
D3DSPR_CONSTINT		equ  7
D3DSPR_COLOROUT		equ  8
D3DSPR_DEPTHOUT		equ  9
D3DSPR_SAMPLER		equ 10
D3DSPR_CONST2		equ 11
D3DSPR_CONST3		equ 12
D3DSPR_CONST4		equ 13
D3DSPR_CONSTBOOL	equ 14
D3DSPR_LOOP		equ 15
D3DSPR_TEMPFLOAT16	equ 16
D3DSPR_MISCTYPE		equ 17
D3DSPR_LABEL		equ 18
D3DSPR_PREDICATE	equ 19
D3DSPR_FORCE_DWORD	equ 0x7fffffff

D3DSHADER_MISCTYPE_OFFSETS typedef SDWORD
D3DSMO_POSITION		equ 0
D3DSMO_FACE		equ 1

D3DVS_RASTOUT_OFFSETS	typedef SDWORD
D3DSRO_POSITION		equ 0
D3DSRO_FOG		equ 2
D3DSRO_POINT_SIZE	equ 3
D3DSRO_FORCE_DWORD	equ 0x7fffffff

D3DVS_ADDRESSMODE_SHIFT equ 13
D3DVS_ADDRESSMODE_MASK	equ (1 SHL D3DVS_ADDRESSMODE_SHIFT)

D3DVS_ADDRESSMODE_TYPE	typedef SDWORD
D3DVS_ADDRMODE_ABSOLUTE equ (0 shl D3DVS_ADDRESSMODE_SHIFT)
D3DVS_ADDRMODE_RELATIVE equ (1 shl D3DVS_ADDRESSMODE_SHIFT)
D3DVS_ADDRMODE_FORCE_DWORD equ 0x7fffffff

D3DSHADER_ADDRESSMODE_SHIFT equ 13
D3DSHADER_ADDRESSMODE_MASK equ (1 SHL D3DSHADER_ADDRESSMODE_SHIFT)

D3DSHADER_ADDRESSMODE_TYPE typedef SDWORD
D3DSHADER_ADDRMODE_ABSOLUTE equ (0 shl D3DSHADER_ADDRESSMODE_SHIFT)
D3DSHADER_ADDRMODE_RELATIVE equ (1 shl D3DSHADER_ADDRESSMODE_SHIFT)
D3DSHADER_ADDRMODE_FORCE_DWORD equ 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

D3DSHADER_PARAM_SRCMOD_TYPE typedef SDWORD
D3DSPSM_NONE		equ 0 shl D3DSP_SRCMOD_SHIFT
D3DSPSM_NEG		equ 1 shl D3DSP_SRCMOD_SHIFT
D3DSPSM_BIAS		equ 2 shl D3DSP_SRCMOD_SHIFT
D3DSPSM_BIASNEG		equ 3 shl D3DSP_SRCMOD_SHIFT
D3DSPSM_SIGN		equ 4 shl D3DSP_SRCMOD_SHIFT
D3DSPSM_SIGNNEG		equ 5 shl D3DSP_SRCMOD_SHIFT
D3DSPSM_COMP		equ 6 shl D3DSP_SRCMOD_SHIFT
D3DSPSM_X2		equ 7 shl D3DSP_SRCMOD_SHIFT
D3DSPSM_X2NEG		equ 8 shl D3DSP_SRCMOD_SHIFT
D3DSPSM_DZ		equ 9 shl D3DSP_SRCMOD_SHIFT
D3DSPSM_DW		equ 10 shl D3DSP_SRCMOD_SHIFT
D3DSPSM_ABS		equ 11 shl D3DSP_SRCMOD_SHIFT
D3DSPSM_ABSNEG		equ 12 shl D3DSP_SRCMOD_SHIFT
D3DSPSM_NOT		equ 13 shl D3DSP_SRCMOD_SHIFT
D3DSPSM_FORCE_DWORD	equ 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



D3DBASISTYPE		typedef SDWORD
D3DBASIS_BEZIER		equ 0
D3DBASIS_BSPLINE	equ 1
D3DBASIS_CATMULL_ROM	equ 2
D3DBASIS_FORCE_DWORD	equ 0x7fffffff

D3DDEGREETYPE		typedef SDWORD
D3DDEGREE_LINEAR	equ 1
D3DDEGREE_QUADRATIC	equ 2
D3DDEGREE_CUBIC		equ 3
D3DDEGREE_QUINTIC	equ 5
D3DDEGREE_FORCE_DWORD	equ 0x7fffffff

D3DPATCHEDGESTYLE	typedef SDWORD
D3DPATCHEDGE_DISCRETE	equ 0
D3DPATCHEDGE_CONTINUOUS equ 1
D3DPATCHEDGE_FORCE_DWORD equ 0x7fffffff

D3DSTATEBLOCKTYPE	typedef SDWORD
D3DSBT_ALL		equ 1
D3DSBT_PIXELSTATE	equ 2
D3DSBT_VERTEXSTATE	equ 3
D3DSBT_FORCE_DWORD	equ 0x7fffffff

D3DVERTEXBLENDFLAGS	typedef SDWORD
D3DVBF_DISABLE		equ 0
D3DVBF_1WEIGHTS		equ 1
D3DVBF_2WEIGHTS		equ 2
D3DVBF_3WEIGHTS		equ 3
D3DVBF_TWEENING		equ 255
D3DVBF_0WEIGHTS		equ 256
D3DVBF_FORCE_DWORD	equ 0x7fffffff


D3DTEXTURETRANSFORMFLAGS typedef SDWORD
D3DTTFF_DISABLE		equ 0
D3DTTFF_COUNT1		equ 1
D3DTTFF_COUNT2		equ 2
D3DTTFF_COUNT3		equ 3
D3DTTFF_COUNT4		equ 4
D3DTTFF_PROJECTED	equ 256
D3DTTFF_FORCE_DWORD	equ 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



D3DDEVTYPE		typedef SDWORD
D3DDEVTYPE_HAL		equ 1
D3DDEVTYPE_REF		equ 2
D3DDEVTYPE_SW		equ 3
D3DDEVTYPE_NULLREF	equ 4
D3DDEVTYPE_FORCE_DWORD	equ 0x7fffffff

D3DMULTISAMPLE_TYPE	typedef SDWORD
D3DMULTISAMPLE_NONE	equ 0
D3DMULTISAMPLE_NONMASKABLE equ 1
D3DMULTISAMPLE_2_SAMPLES equ 2
D3DMULTISAMPLE_3_SAMPLES equ 3
D3DMULTISAMPLE_4_SAMPLES equ 4
D3DMULTISAMPLE_5_SAMPLES equ 5
D3DMULTISAMPLE_6_SAMPLES equ 6
D3DMULTISAMPLE_7_SAMPLES equ 7
D3DMULTISAMPLE_8_SAMPLES equ 8
D3DMULTISAMPLE_9_SAMPLES equ 9
D3DMULTISAMPLE_10_SAMPLES equ 10
D3DMULTISAMPLE_11_SAMPLES equ 11
D3DMULTISAMPLE_12_SAMPLES equ 12
D3DMULTISAMPLE_13_SAMPLES equ 13
D3DMULTISAMPLE_14_SAMPLES equ 14
D3DMULTISAMPLE_15_SAMPLES equ 15
D3DMULTISAMPLE_16_SAMPLES equ 16
D3DMULTISAMPLE_FORCE_DWORD equ 0x7fffffff

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


D3DFORMAT		typedef SDWORD
D3DFMT_UNKNOWN		equ 0
D3DFMT_R8G8B8		equ 20
D3DFMT_A8R8G8B8		equ 21
D3DFMT_X8R8G8B8		equ 22
D3DFMT_R5G6B5		equ 23
D3DFMT_X1R5G5B5		equ 24
D3DFMT_A1R5G5B5		equ 25
D3DFMT_A4R4G4B4		equ 26
D3DFMT_R3G3B2		equ 27
D3DFMT_A8		equ 28
D3DFMT_A8R3G3B2		equ 29
D3DFMT_X4R4G4B4		equ 30
D3DFMT_A2B10G10R10	equ 31
D3DFMT_A8B8G8R8		equ 32
D3DFMT_X8B8G8R8		equ 33
D3DFMT_G16R16		equ 34
D3DFMT_A2R10G10B10	equ 35
D3DFMT_A16B16G16R16	equ 36
D3DFMT_A8P8		equ 40
D3DFMT_P8		equ 41
D3DFMT_L8		equ 50
D3DFMT_A8L8		equ 51
D3DFMT_A4L4		equ 52
D3DFMT_V8U8		equ 60
D3DFMT_L6V5U5		equ 61
D3DFMT_X8L8V8U8		equ 62
D3DFMT_Q8W8V8U8		equ 63
D3DFMT_V16U16		equ 64
D3DFMT_A2W10V10U10	equ 67
D3DFMT_UYVY		equ MAKEFOURCC('U', 'Y', 'V', 'Y')
D3DFMT_R8G8_B8G8	equ MAKEFOURCC('R', 'G', 'B', 'G')
D3DFMT_YUY2		equ MAKEFOURCC('Y', 'U', 'Y', '2')
D3DFMT_G8R8_G8B8	equ MAKEFOURCC('G', 'R', 'G', 'B')
D3DFMT_DXT1		equ MAKEFOURCC('D', 'X', 'T', '1')
D3DFMT_DXT2		equ MAKEFOURCC('D', 'X', 'T', '2')
D3DFMT_DXT3		equ MAKEFOURCC('D', 'X', 'T', '3')
D3DFMT_DXT4		equ MAKEFOURCC('D', 'X', 'T', '4')
D3DFMT_DXT5		equ MAKEFOURCC('D', 'X', 'T', '5')
D3DFMT_D16_LOCKABLE	equ 70
D3DFMT_D32		equ 71
D3DFMT_D15S1		equ 73
D3DFMT_D24S8		equ 75
D3DFMT_D24X8		equ 77
D3DFMT_D24X4S4		equ 79
D3DFMT_D16		equ 80
D3DFMT_D32F_LOCKABLE	equ 82
D3DFMT_D24FS8		equ 83
ifndef D3D_DISABLE_9EX

D3DFMT_D32_LOCKABLE	equ 84
D3DFMT_S8_LOCKABLE	equ 85

endif

D3DFMT_L16		equ 81

D3DFMT_VERTEXDATA	equ 100
D3DFMT_INDEX16		equ 101
D3DFMT_INDEX32		equ 102

D3DFMT_Q16W16V16U16	equ 110

D3DFMT_MULTI2_ARGB8	equ MAKEFOURCC('M','E','T','1')


D3DFMT_R16F		equ 111
D3DFMT_G16R16F		equ 112
D3DFMT_A16B16G16R16F	equ 113

D3DFMT_R32F		equ 114
D3DFMT_G32R32F		equ 115
D3DFMT_A32B32G32R32F	equ 116

D3DFMT_CxV8U8		equ 117

ifndef D3D_DISABLE_9EX

D3DFMT_A1		equ 118

D3DFMT_A2B10G10R10_XR_BIAS equ 119


D3DFMT_BINARYBUFFER	equ 199

endif

D3DFMT_FORCE_DWORD	equ 0x7fffffff


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

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

D3DSWAPEFFECT		typedef SDWORD
D3DSWAPEFFECT_DISCARD	equ 1
D3DSWAPEFFECT_FLIP	equ 2
D3DSWAPEFFECT_COPY	equ 3
D3DSWAPEFFECT_OVERLAY	equ 4
D3DSWAPEFFECT_FLIPEX	equ 5
D3DSWAPEFFECT_FORCE_DWORD equ 0x7fffffff

D3DPOOL			typedef SDWORD
D3DPOOL_DEFAULT		equ 0
D3DPOOL_MANAGED		equ 1
D3DPOOL_SYSTEMMEM	equ 2
D3DPOOL_SCRATCH		equ 3
D3DPOOL_FORCE_DWORD	equ 0x7fffffff

D3DPRESENT_RATE_DEFAULT equ 0x00000000

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

D3DPRESENTFLAG_LOCKABLE_BACKBUFFER equ 0x00000001
D3DPRESENTFLAG_DISCARD_DEPTHSTENCIL equ 0x00000002
D3DPRESENTFLAG_DEVICECLIP equ 0x00000004
D3DPRESENTFLAG_VIDEO	equ 0x00000010

ifndef D3D_DISABLE_9EX

D3DPRESENTFLAG_NOAUTOROTATE equ 0x00000020
D3DPRESENTFLAG_UNPRUNEDMODE equ 0x00000040
D3DPRESENTFLAG_OVERLAY_LIMITEDRGB equ 0x00000080
D3DPRESENTFLAG_OVERLAY_YCbCr_BT709 equ 0x00000100
D3DPRESENTFLAG_OVERLAY_YCbCr_xvYCC equ 0x00000200
D3DPRESENTFLAG_RESTRICTED_CONTENT equ 0x00000400
D3DPRESENTFLAG_RESTRICT_SHARED_RESOURCE_DRIVER equ 0x00000800

endif

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

D3DBACKBUFFER_TYPE	typedef SDWORD
D3DBACKBUFFER_TYPE_MONO equ 0
D3DBACKBUFFER_TYPE_LEFT equ 1
D3DBACKBUFFER_TYPE_RIGHT equ 2
D3DBACKBUFFER_TYPE_FORCE_DWORD equ 0x7fffffff

D3DRESOURCETYPE		typedef SDWORD
D3DRTYPE_SURFACE	equ 1
D3DRTYPE_VOLUME		equ 2
D3DRTYPE_TEXTURE	equ 3
D3DRTYPE_VOLUMETEXTURE	equ 4
D3DRTYPE_CUBETEXTURE	equ 5
D3DRTYPE_VERTEXBUFFER	equ 6
D3DRTYPE_INDEXBUFFER	equ 7
D3DRTYPE_FORCE_DWORD	equ 0x7fffffff

D3DUSAGE_RENDERTARGET	equ (0x00000001)
D3DUSAGE_DEPTHSTENCIL	equ (0x00000002)
D3DUSAGE_DYNAMIC	equ (0x00000200)

ifndef D3D_DISABLE_9EX

D3DUSAGE_NONSECURE	equ (0x00800000)

endif

D3DUSAGE_AUTOGENMIPMAP	equ (0x00000400)
D3DUSAGE_DMAP		equ (0x00004000)

D3DUSAGE_QUERY_LEGACYBUMPMAP equ (0x00008000)
D3DUSAGE_QUERY_SRGBREAD equ (0x00010000)
D3DUSAGE_QUERY_FILTER	equ (0x00020000)
D3DUSAGE_QUERY_SRGBWRITE equ (0x00040000)
D3DUSAGE_QUERY_POSTPIXELSHADER_BLENDING equ (0x00080000)
D3DUSAGE_QUERY_VERTEXTEXTURE equ (0x00100000)
D3DUSAGE_QUERY_WRAPANDMIP equ (0x00200000)

D3DUSAGE_WRITEONLY	equ (0x00000008)
D3DUSAGE_SOFTWAREPROCESSING equ (0x00000010)
D3DUSAGE_DONOTCLIP	equ (0x00000020)
D3DUSAGE_POINTS		equ (0x00000040)
D3DUSAGE_RTPATCHES	equ (0x00000080)
D3DUSAGE_NPATCHES	equ (0x00000100)

ifndef D3D_DISABLE_9EX

D3DUSAGE_TEXTAPI	equ (0x10000000)
D3DUSAGE_RESTRICTED_CONTENT equ (0x00000800)
D3DUSAGE_RESTRICT_SHARED_RESOURCE equ (0x00002000)
D3DUSAGE_RESTRICT_SHARED_RESOURCE_DRIVER equ (0x00001000)

endif

D3DCUBEMAP_FACES	typedef SDWORD
D3DCUBEMAP_FACE_POSITIVE_X equ 0
D3DCUBEMAP_FACE_NEGATIVE_X equ 1
D3DCUBEMAP_FACE_POSITIVE_Y equ 2
D3DCUBEMAP_FACE_NEGATIVE_Y equ 3
D3DCUBEMAP_FACE_POSITIVE_Z equ 4
D3DCUBEMAP_FACE_NEGATIVE_Z equ 5
D3DCUBEMAP_FACE_FORCE_DWORD equ 0x7fffffff

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

D3DLOCK_NO_DIRTY_UPDATE equ 0x00008000

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

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

D3DSURFACE_DESC		STRUC
Format			D3DFORMAT ?
Type			D3DRESOURCETYPE ?
Usage			dd ?
Pool			D3DPOOL ?
MultiSampleType		D3DMULTISAMPLE_TYPE ?
MultiSampleQuality	dd ?
Width			UINT ?
Height			UINT ?
D3DSURFACE_DESC		ENDS

D3DVOLUME_DESC		STRUC
Format			D3DFORMAT ?
Type			D3DRESOURCETYPE ?
Usage			dd ?
Pool			D3DPOOL ?
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
_Offset			UINT ?
Size			UINT ?
D3DRANGE		ENDS

D3DRECTPATCH_INFO	STRUC
StartVertexOffsetWidth	UINT ?
StartVertexOffsetHeight UINT ?
Width			UINT ?
Height			UINT ?
Stride			UINT ?
Basis			D3DBASISTYPE ?
Degree			D3DDEGREETYPE ?
D3DRECTPATCH_INFO	ENDS

D3DTRIPATCH_INFO	STRUC
StartVertexOffset	UINT ?
NumVertices		UINT ?
Basis			D3DBASISTYPE ?
Degree			D3DDEGREETYPE ?
D3DTRIPATCH_INFO	ENDS

MAX_DEVICE_IDENTIFIER_STRING equ 512
D3DADAPTER_IDENTIFIER9	STRUC
Driver			db MAX_DEVICE_IDENTIFIER_STRING dup(?)
Description		db MAX_DEVICE_IDENTIFIER_STRING dup(?)
DeviceName		db 32 dup(?)
ifdef _WIN32
DriverVersion		LARGE_INTEGER <>
else
DriverVersionLowPart	dd ?
DriverVersionHighPart	dd ?
endif
VendorId		dd ?
DeviceId		dd ?
SubSysId		dd ?
Revision		dd ?
DeviceIdentifier	GUID <>
WHQLLevel		dd ?
D3DADAPTER_IDENTIFIER9	ENDS

D3DRASTER_STATUS	STRUC
InVBlank		BOOL ?
ScanLine		UINT ?
D3DRASTER_STATUS	ENDS

D3DDEBUGMONITORTOKENS	typedef SDWORD
D3DDMT_ENABLE		equ 0
D3DDMT_DISABLE		equ 1	; disable debug monitor
D3DDMT_FORCE_DWORD	equ 0x7fffffff

D3DQUERYTYPE		typedef SDWORD
D3DQUERYTYPE_VCACHE		equ 4
D3DQUERYTYPE_RESOURCEMANAGER	equ 5
D3DQUERYTYPE_VERTEXSTATS	equ 6
D3DQUERYTYPE_EVENT		equ 8
D3DQUERYTYPE_OCCLUSION		equ 9
D3DQUERYTYPE_TIMESTAMP		equ 10
D3DQUERYTYPE_TIMESTAMPDISJOINT	equ 11
D3DQUERYTYPE_TIMESTAMPFREQ	equ 12
D3DQUERYTYPE_PIPELINETIMINGS	equ 13
D3DQUERYTYPE_INTERFACETIMINGS	equ 14
D3DQUERYTYPE_VERTEXTIMINGS	equ 15
D3DQUERYTYPE_PIXELTIMINGS	equ 16
D3DQUERYTYPE_BANDWIDTHTIMINGS	equ 17
D3DQUERYTYPE_CACHEUTILIZATION	equ 18
ifndef D3D_DISABLE_9EX
D3DQUERYTYPE_MEMORYPRESSURE	equ 19
endif

D3DISSUE_END		equ (1 SHL 0)
D3DISSUE_BEGIN		equ (1 SHL 1)

D3DGETDATA_FLUSH	equ (1 SHL 0)

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

D3DRTYPECOUNT		equ (D3DRTYPE_INDEXBUFFER+1)

D3DDEVINFO_RESOURCEMANAGER STRUC
ifndef WOW64_ENUM_WORKAROUND
stats			D3DRESOURCESTATS D3DRTYPECOUNT dup(<?>)
else
stats			D3DRESOURCESTATS 8 dup(<?>)
endif
D3DDEVINFO_RESOURCEMANAGER ENDS
LPD3DDEVINFO_RESOURCEMANAGER typedef ptr D3DDEVINFO_RESOURCEMANAGER

D3DDEVINFO_D3DVERTEXSTATS STRUC
NumRenderedTriangles	dd ?
NumExtraClippingTriangles dd ?
D3DDEVINFO_D3DVERTEXSTATS ENDS
LPD3DDEVINFO_D3DVERTEXSTATS typedef ptr D3DDEVINFO_D3DVERTEXSTATS

D3DDEVINFO_VCACHE	STRUC
Pattern			dd ?
OptMethod		dd ?
CacheSize		dd ?
MagicNumber		dd ?
D3DDEVINFO_VCACHE	ENDS
LPD3DDEVINFO_VCACHE	typedef ptr D3DDEVINFO_VCACHE

D3DDEVINFO_D3D9PIPELINETIMINGS STRUC
VertexProcessingTimePercent FLOAT ?
PixelProcessingTimePercent FLOAT ?
OtherGPUProcessingTimePercent FLOAT ?
GPUIdleTimePercent	FLOAT ?
D3DDEVINFO_D3D9PIPELINETIMINGS ENDS

D3DDEVINFO_D3D9INTERFACETIMINGS STRUC
WaitingForGPUToUseApplicationResourceTimePercent FLOAT ?
WaitingForGPUToAcceptMoreCommandsTimePercent FLOAT ?
WaitingForGPUToStayWithinLatencyTimePercent FLOAT ?
WaitingForGPUExclusiveResourceTimePercent FLOAT ?
WaitingForGPUOtherTimePercent FLOAT ?
D3DDEVINFO_D3D9INTERFACETIMINGS ENDS

D3DDEVINFO_D3D9STAGETIMINGS STRUC
MemoryProcessingPercent FLOAT ?
ComputationProcessingPercent FLOAT ?
D3DDEVINFO_D3D9STAGETIMINGS ENDS

D3DDEVINFO_D3D9BANDWIDTHTIMINGS STRUC
MaxBandwidthUtilized	FLOAT ?
FrontEndUploadMemoryUtilizedPercent FLOAT ?
VertexRateUtilizedPercent FLOAT ?
TriangleSetupRateUtilizedPercent FLOAT ?
FillRateUtilizedPercent FLOAT ?
D3DDEVINFO_D3D9BANDWIDTHTIMINGS ENDS

D3DDEVINFO_D3D9CACHEUTILIZATION STRUC
TextureCacheHitRate	FLOAT ?
PostTransformVertexCacheHitRate FLOAT ?
D3DDEVINFO_D3D9CACHEUTILIZATION ENDS

ifndef D3D_DISABLE_9EX

D3DMEMORYPRESSURE	STRUC
BytesEvictedFromProcess UINT64 ?
SizeOfInefficientAllocation UINT64 ?
LevelOfEfficiency	dd ?
D3DMEMORYPRESSURE	ENDS

endif

ifndef D3D_DISABLE_9EX

D3DCOMPOSERECTSOP	typedef SDWORD
D3DCOMPOSERECTS_COPY	equ 1
D3DCOMPOSERECTS_OR	equ 2
D3DCOMPOSERECTS_AND	equ 3
D3DCOMPOSERECTS_NEG	equ 4
D3DCOMPOSERECTS_FORCE_DWORD equ 0x7fffffff

D3DCOMPOSERECTDESC	STRUC
X			USHORT ?
Y			USHORT ?
Width			USHORT ?
Height			USHORT ?
D3DCOMPOSERECTDESC	ENDS

D3DCOMPOSERECTDESTINATION STRUC
SrcRectIndex		USHORT ?
Reserved		USHORT ?
X			USHORT ?
Y			WORD ?
D3DCOMPOSERECTDESTINATION ENDS

D3DCOMPOSERECTS_MAXNUMRECTS	equ 0xFFFF
D3DCONVOLUTIONMONO_MAXWIDTH	equ 7
D3DCONVOLUTIONMONO_MAXHEIGHT	equ D3DCONVOLUTIONMONO_MAXWIDTH
D3DFMT_A1_SURFACE_MAXWIDTH	equ 8192
D3DFMT_A1_SURFACE_MAXHEIGHT	equ 2048

D3DPRESENTSTATS		STRUC
PresentCount		UINT ?
PresentRefreshCount	UINT ?
SyncRefreshCount	UINT ?
SyncQPCTime		LARGE_INTEGER <>
SyncGPUTime		LARGE_INTEGER <>
D3DPRESENTSTATS		ENDS

D3DSCANLINEORDERING	typedef SDWORD
D3DSCANLINEORDERING_UNKNOWN	equ 0
D3DSCANLINEORDERING_PROGRESSIVE equ 1
D3DSCANLINEORDERING_INTERLACED	equ 2

D3DDISPLAYMODEEX	STRUC
Size			UINT ?
Width			UINT ?
Height			UINT ?
RefreshRate		UINT ?
Format			D3DFORMAT ?
ScanLineOrdering	D3DSCANLINEORDERING ?
D3DDISPLAYMODEEX	ENDS

D3DDISPLAYMODEFILTER	STRUC
Size			UINT ?
Format			D3DFORMAT ?
ScanLineOrdering	D3DSCANLINEORDERING ?
D3DDISPLAYMODEFILTER	ENDS

D3DDISPLAYROTATION	typedef SDWORD
D3DDISPLAYROTATION_IDENTITY	equ 1
D3DDISPLAYROTATION_90		equ 2	; Rotated 90 degrees.
D3DDISPLAYROTATION_180		equ 3	; Rotated 180 degrees.
D3DDISPLAYROTATION_270		equ 4	; Rotated 270 degrees.

D3D9_RESOURCE_PRIORITY_MINIMUM	equ 0x28000000
D3D9_RESOURCE_PRIORITY_LOW	equ 0x50000000
D3D9_RESOURCE_PRIORITY_NORMAL	equ 0x78000000
D3D9_RESOURCE_PRIORITY_HIGH	equ 0xa0000000
D3D9_RESOURCE_PRIORITY_MAXIMUM	equ 0xc8000000

D3D_OMAC_SIZE		equ 16

D3D_OMAC		STRUC
Omac			db D3D_OMAC_SIZE dup(?)
D3D_OMAC		ENDS

D3DAUTHENTICATEDCHANNELTYPE typedef SDWORD
D3DAUTHENTICATEDCHANNEL_D3D9 equ 1
D3DAUTHENTICATEDCHANNEL_DRIVER_SOFTWARE equ 2
D3DAUTHENTICATEDCHANNEL_DRIVER_HARDWARE equ 3

D3DAUTHENTICATEDCHANNEL_QUERY_INPUT STRUC
QueryType		GUID <>
hChannel		HANDLE ?
SequenceNumber		UINT ?
D3DAUTHENTICATEDCHANNEL_QUERY_INPUT ENDS

D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT STRUC
omac			D3D_OMAC <>
QueryType		GUID <>
hChannel		HANDLE ?
SequenceNumber		UINT ?
ReturnCode		HRESULT ?
D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT ENDS

DEFINE_GUID(D3DAUTHENTICATEDQUERY_PROTECTION, 0xa84eb584, 0xc495, 0x48aa, 0xb9, 0x4d, 0x8b, 0xd2, 0xd6, 0xfb, 0xce, 0x5);

D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS STRUC
UNION
 STRUC
  ProtectionEnabled	UINT ? ; : 1 UINT ?
 ENDS
 Value			UINT ?
ENDS
D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS ENDS

D3DAUTHENTICATEDCHANNEL_QUERYPROTECTION_OUTPUT STRUC
Output			D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT <>
ProtectionFlags		D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS <>
D3DAUTHENTICATEDCHANNEL_QUERYPROTECTION_OUTPUT ENDS

DEFINE_GUID(D3DAUTHENTICATEDQUERY_CHANNELTYPE, 0xbc1b18a5, 0xb1fb, 0x42ab, 0xbd, 0x94, 0xb5, 0x82, 0x8b, 0x4b, 0xf7, 0xbe);

D3DAUTHENTICATEDCHANNEL_QUERYCHANNELTYPE_OUTPUT STRUC
Output			D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT <>
ChannelType		D3DAUTHENTICATEDCHANNELTYPE ?
D3DAUTHENTICATEDCHANNEL_QUERYCHANNELTYPE_OUTPUT ENDS

DEFINE_GUID(D3DAUTHENTICATEDQUERY_DEVICEHANDLE, 0xec1c539d, 0x8cff, 0x4e2a, 0xbc, 0xc4, 0xf5, 0x69, 0x2f, 0x99, 0xf4, 0x80);

D3DAUTHENTICATEDCHANNEL_QUERYDEVICEHANDLE_OUTPUT STRUC
Output			D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT <>
DeviceHandle		HANDLE ?
D3DAUTHENTICATEDCHANNEL_QUERYDEVICEHANDLE_OUTPUT ENDS

DEFINE_GUID(D3DAUTHENTICATEDQUERY_CRYPTOSESSION, 0x2634499e, 0xd018, 0x4d74, 0xac, 0x17, 0x7f, 0x72, 0x40, 0x59, 0x52, 0x8d);

D3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_INPUT STRUC
Input			D3DAUTHENTICATEDCHANNEL_QUERY_INPUT <>
DXVA2DecodeHandle	HANDLE ?
D3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_INPUT ENDS

D3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_OUTPUT STRUC
Output			D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT <>
DXVA2DecodeHandle	HANDLE ?
CryptoSessionHandle	HANDLE ?
DeviceHandle		HANDLE ?
D3DAUTHENTICATEDCHANNEL_QUERYCRYPTOSESSION_OUTPUT ENDS

DEFINE_GUID(D3DAUTHENTICATEDQUERY_RESTRICTEDSHAREDRESOURCEPROCESSCOUNT, 0xdb207b3, 0x9450, 0x46a6, 0x82, 0xde, 0x1b, 0x96, 0xd4, 0x4f, 0x9c, 0xf2);

D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESSCOUNT_OUTPUT STRUC
Output			D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT <>
NumRestrictedSharedResourceProcesses UINT ?
D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESSCOUNT_OUTPUT ENDS

DEFINE_GUID(D3DAUTHENTICATEDQUERY_RESTRICTEDSHAREDRESOURCEPROCESS, 0x649bbadb, 0xf0f4, 0x4639, 0xa1, 0x5b, 0x24, 0x39, 0x3f, 0xc3, 0xab, 0xac);

D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_INPUT STRUC
Input			D3DAUTHENTICATEDCHANNEL_QUERY_INPUT <>
ProcessIndex		UINT ?
D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_INPUT ENDS

D3DAUTHENTICATEDCHANNEL_PROCESSIDENTIFIERTYPE typedef SDWORD
PROCESSIDTYPE_UNKNOWN	equ 0
PROCESSIDTYPE_DWM	equ 1
PROCESSIDTYPE_HANDLE	equ 2

D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_OUTPUT STRUC
Output			D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT <>
ProcessIndex		UINT ?
ProcessIdentifer	D3DAUTHENTICATEDCHANNEL_PROCESSIDENTIFIERTYPE ?
ProcessHandle		HANDLE ?
D3DAUTHENTICATEDCHANNEL_QUERYRESTRICTEDSHAREDRESOURCEPROCESS_OUTPUT ENDS

DEFINE_GUID(D3DAUTHENTICATEDQUERY_UNRESTRICTEDPROTECTEDSHAREDRESOURCECOUNT, 0x12f0bd6, 0xe662, 0x4474, 0xbe, 0xfd, 0xaa, 0x53, 0xe5, 0x14, 0x3c, 0x6d)

D3DAUTHENTICATEDCHANNEL_QUERYUNRESTRICTEDPROTECTEDSHAREDRESOURCECOUNT_OUTPUT STRUC
Output			D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT <>
NumUnrestrictedProtectedSharedResources UINT ?
D3DAUTHENTICATEDCHANNEL_QUERYUNRESTRICTEDPROTECTEDSHAREDRESOURCECOUNT_OUTPUT ENDS

DEFINE_GUID(D3DAUTHENTICATEDQUERY_OUTPUTIDCOUNT, 0x2c042b5e, 0x8c07, 0x46d5, 0xaa, 0xbe, 0x8f, 0x75, 0xcb, 0xad, 0x4c, 0x31);

D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_INPUT STRUC
Input			D3DAUTHENTICATEDCHANNEL_QUERY_INPUT <>
DeviceHandle		HANDLE ?
CryptoSessionHandle	HANDLE ?
D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_INPUT ENDS

D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_OUTPUT STRUC
Output			D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT <>
DeviceHandle		HANDLE ?
CryptoSessionHandle	HANDLE ?
NumOutputIDs		UINT ?
D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTIDCOUNT_OUTPUT ENDS

DEFINE_GUID(D3DAUTHENTICATEDQUERY_OUTPUTID, 0x839ddca3, 0x9b4e, 0x41e4, 0xb0, 0x53, 0x89, 0x2b, 0xd2, 0xa1, 0x1e, 0xe7);

D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_INPUT STRUC
Input			D3DAUTHENTICATEDCHANNEL_QUERY_INPUT <>
DeviceHandle		HANDLE ?
CryptoSessionHandle	HANDLE ?
OutputIDIndex		UINT ?
D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_INPUT ENDS

D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_OUTPUT STRUC
Output			D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT <>
DeviceHandle		HANDLE ?
CryptoSessionHandle	HANDLE ?
OutputIDIndex		UINT ?
OutputID		UINT64 ?
D3DAUTHENTICATEDCHANNEL_QUERYOUTPUTID_OUTPUT ENDS

DEFINE_GUID(D3DAUTHENTICATEDQUERY_ACCESSIBILITYATTRIBUTES, 0x6214d9d2, 0x432c, 0x4abb, 0x9f, 0xce, 0x21, 0x6e, 0xea, 0x26, 0x9e, 0x3b);

D3DBUSTYPE		typedef SDWORD
D3DBUSTYPE_OTHER	equ 0x00000000
D3DBUSTYPE_PCI		equ 0x00000001
D3DBUSTYPE_PCIX		equ 0x00000002
D3DBUSTYPE_PCIEXPRESS	equ 0x00000003
D3DBUSTYPE_AGP		equ 0x00000004
D3DBUSIMPL_MODIFIER_INSIDE_OF_CHIPSET equ 0x00010000
D3DBUSIMPL_MODIFIER_TRACKS_ON_MOTHER_BOARD_TO_CHIP equ 0x00020000
D3DBUSIMPL_MODIFIER_TRACKS_ON_MOTHER_BOARD_TO_SOCKET equ 0x00030000
D3DBUSIMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR equ 0x00040000
D3DBUSIMPL_MODIFIER_DAUGHTER_BOARD_CONNECTOR_INSIDE_OF_NUAE equ 0x00050000
D3DBUSIMPL_MODIFIER_NON_STANDARD equ 0x80000000

D3DAUTHENTICATEDCHANNEL_QUERYINFOBUSTYPE_OUTPUT STRUC
Output			D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT <>
BusType			D3DBUSTYPE ?
bAccessibleInContiguousBlocks BOOL ?
bAccessibleInNonContiguousBlocks BOOL ?
D3DAUTHENTICATEDCHANNEL_QUERYINFOBUSTYPE_OUTPUT ENDS

DEFINE_GUID(D3DAUTHENTICATEDQUERY_ENCRYPTIONWHENACCESSIBLEGUIDCOUNT, 0xb30f7066, 0x203c, 0x4b07, 0x93, 0xfc, 0xce, 0xaa, 0xfd, 0x61, 0x24, 0x1e);

D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUIDCOUNT_OUTPUT STRUC
Output			D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT <>
NumEncryptionGuids	UINT ?
D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUIDCOUNT_OUTPUT ENDS

DEFINE_GUID(D3DAUTHENTICATEDQUERY_ENCRYPTIONWHENACCESSIBLEGUID, 0xf83a5958, 0xe986, 0x4bda, 0xbe, 0xb0, 0x41, 0x1f, 0x6a, 0x7a, 0x1, 0xb7);

D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_INPUT STRUC
Input			D3DAUTHENTICATEDCHANNEL_QUERY_INPUT <>
EncryptionGuidIndex	UINT ?
D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_INPUT ENDS

D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_OUTPUT STRUC
Output			D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT <>
EncryptionGuidIndex	UINT ?
EncryptionGuid		GUID <>
D3DAUTHENTICATEDCHANNEL_QUERYEVICTIONENCRYPTIONGUID_OUTPUT ENDS

DEFINE_GUID(D3DAUTHENTICATEDQUERY_CURRENTENCRYPTIONWHENACCESSIBLE, 0xec1791c7, 0xdad3, 0x4f15, 0x9e, 0xc3, 0xfa, 0xa9, 0x3d, 0x60, 0xd4, 0xf0);

D3DAUTHENTICATEDCHANNEL_QUERYUNCOMPRESSEDENCRYPTIONLEVEL_OUTPUT STRUC
Output			D3DAUTHENTICATEDCHANNEL_QUERY_OUTPUT <>
EncryptionGuid		GUID <>
D3DAUTHENTICATEDCHANNEL_QUERYUNCOMPRESSEDENCRYPTIONLEVEL_OUTPUT ENDS

D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT STRUC
omac			D3D_OMAC <>
ConfigureType		GUID <>
hChannel		HANDLE ?
SequenceNumber		UINT ?
D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT ENDS

D3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT STRUC
omac			D3D_OMAC <>
ConfigureType		GUID <>
hChannel		HANDLE ?
SequenceNumber		UINT ?
ReturnCode		HRESULT ?
D3DAUTHENTICATEDCHANNEL_CONFIGURE_OUTPUT ENDS

DEFINE_GUID(D3DAUTHENTICATEDCONFIGURE_INITIALIZE, 0x6114bdb, 0x3523, 0x470a, 0x8d, 0xca, 0xfb, 0xc2, 0x84, 0x51, 0x54, 0xf0)

D3DAUTHENTICATEDCHANNEL_CONFIGUREINITIALIZE STRUC
Parameters		D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT <>
StartSequenceQuery	UINT ?
StartSequenceConfigure	UINT ?
D3DAUTHENTICATEDCHANNEL_CONFIGUREINITIALIZE ENDS

DEFINE_GUID(D3DAUTHENTICATEDCONFIGURE_PROTECTION, 0x50455658, 0x3f47, 0x4362, 0xbf, 0x99, 0xbf, 0xdf, 0xcd, 0xe9, 0xed, 0x29);

D3DAUTHENTICATEDCHANNEL_CONFIGUREPROTECTION STRUC
Parameters		D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT <>
Protections		D3DAUTHENTICATEDCHANNEL_PROTECTION_FLAGS <>
D3DAUTHENTICATEDCHANNEL_CONFIGUREPROTECTION ENDS

DEFINE_GUID(D3DAUTHENTICATEDCONFIGURE_CRYPTOSESSION, 0x6346cc54, 0x2cfc, 0x4ad4, 0x82, 0x24, 0xd1, 0x58, 0x37, 0xde, 0x77, 0x0);

D3DAUTHENTICATEDCHANNEL_CONFIGURECRYPTOSESSION STRUC
Parameters		D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT <>
DXVA2DecodeHandle	HANDLE ?
CryptoSessionHandle	HANDLE ?
DeviceHandle		HANDLE ?
D3DAUTHENTICATEDCHANNEL_CONFIGURECRYPTOSESSION ENDS

DEFINE_GUID(D3DAUTHENTICATEDCONFIGURE_SHAREDRESOURCE, 0x772d047, 0x1b40, 0x48e8, 0x9c, 0xa6, 0xb5, 0xf5, 0x10, 0xde, 0x9f, 0x1);

D3DAUTHENTICATEDCHANNEL_CONFIGURESHAREDRESOURCE STRUC
Parameters		D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT <>
ProcessIdentiferType	D3DAUTHENTICATEDCHANNEL_PROCESSIDENTIFIERTYPE ?
ProcessHandle		HANDLE ?
AllowAccess		BOOL ?
D3DAUTHENTICATEDCHANNEL_CONFIGURESHAREDRESOURCE ENDS

DEFINE_GUID(D3DAUTHENTICATEDCONFIGURE_ENCRYPTIONWHENACCESSIBLE, 0x41fff286, 0x6ae0, 0x4d43, 0x9d, 0x55, 0xa4, 0x6e, 0x9e, 0xfd, 0x15, 0x8a);

D3DAUTHENTICATEDCHANNEL_CONFIGUREUNCOMPRESSEDENCRYPTION STRUC
Parameters		D3DAUTHENTICATEDCHANNEL_CONFIGURE_INPUT <>
EncryptionGuid		GUID <>
D3DAUTHENTICATEDCHANNEL_CONFIGUREUNCOMPRESSEDENCRYPTION ENDS

D3DENCRYPTED_BLOCK_INFO STRUC
NumEncryptedBytesAtBeginning UINT ?
NumBytesInSkipPattern	UINT ?
NumBytesInEncryptPattern UINT ?
D3DENCRYPTED_BLOCK_INFO ENDS

D3DAES_CTR_IV		STRUC
IV			UINT64 ?
Count			UINT64 ?
D3DAES_CTR_IV		ENDS

endif
endif
.pragma pack(pop)
endif
