📄 d3d9types.h
字号:
// The miscellaneous register file (D3DSPR_MISCTYPES)
// contains register types for which there is only ever one
// register (i.e. the register # is not needed).
// Rather than use up additional register types for such
// registers, they are defined
// as particular offsets into the misc. register file:
typedef enum _D3DSHADER_MISCTYPE_OFFSETS
{
D3DSMO_POSITION = 0, // Input position x,y,z,rhw (PS)
D3DSMO_FACE = 1, // Floating point primitive area (PS)
} D3DSHADER_MISCTYPE_OFFSETS;
// Register offsets in the Rasterizer Register File
//
typedef enum _D3DVS_RASTOUT_OFFSETS
{
D3DSRO_POSITION = 0,
D3DSRO_FOG,
D3DSRO_POINT_SIZE,
D3DSRO_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum
} D3DVS_RASTOUT_OFFSETS;
// Source operand addressing modes
#define D3DVS_ADDRESSMODE_SHIFT 13
#define D3DVS_ADDRESSMODE_MASK (1 << D3DVS_ADDRESSMODE_SHIFT)
typedef enum _D3DVS_ADDRESSMODE_TYPE
{
D3DVS_ADDRMODE_ABSOLUTE = (0 << D3DVS_ADDRESSMODE_SHIFT),
D3DVS_ADDRMODE_RELATIVE = (1 << D3DVS_ADDRESSMODE_SHIFT),
D3DVS_ADDRMODE_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum
} D3DVS_ADDRESSMODE_TYPE;
#define D3DSHADER_ADDRESSMODE_SHIFT 13
#define D3DSHADER_ADDRESSMODE_MASK (1 << D3DSHADER_ADDRESSMODE_SHIFT)
typedef enum _D3DSHADER_ADDRESSMODE_TYPE
{
D3DSHADER_ADDRMODE_ABSOLUTE = (0 << D3DSHADER_ADDRESSMODE_SHIFT),
D3DSHADER_ADDRMODE_RELATIVE = (1 << D3DSHADER_ADDRESSMODE_SHIFT),
D3DSHADER_ADDRMODE_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum
} D3DSHADER_ADDRESSMODE_TYPE;
// Source operand swizzle definitions
//
#define D3DVS_SWIZZLE_SHIFT 16
#define D3DVS_SWIZZLE_MASK 0x00FF0000
// The following bits define where to take component X from:
#define D3DVS_X_X (0 << D3DVS_SWIZZLE_SHIFT)
#define D3DVS_X_Y (1 << D3DVS_SWIZZLE_SHIFT)
#define D3DVS_X_Z (2 << D3DVS_SWIZZLE_SHIFT)
#define D3DVS_X_W (3 << D3DVS_SWIZZLE_SHIFT)
// The following bits define where to take component Y from:
#define D3DVS_Y_X (0 << (D3DVS_SWIZZLE_SHIFT + 2))
#define D3DVS_Y_Y (1 << (D3DVS_SWIZZLE_SHIFT + 2))
#define D3DVS_Y_Z (2 << (D3DVS_SWIZZLE_SHIFT + 2))
#define D3DVS_Y_W (3 << (D3DVS_SWIZZLE_SHIFT + 2))
// The following bits define where to take component Z from:
#define D3DVS_Z_X (0 << (D3DVS_SWIZZLE_SHIFT + 4))
#define D3DVS_Z_Y (1 << (D3DVS_SWIZZLE_SHIFT + 4))
#define D3DVS_Z_Z (2 << (D3DVS_SWIZZLE_SHIFT + 4))
#define D3DVS_Z_W (3 << (D3DVS_SWIZZLE_SHIFT + 4))
// The following bits define where to take component W from:
#define D3DVS_W_X (0 << (D3DVS_SWIZZLE_SHIFT + 6))
#define D3DVS_W_Y (1 << (D3DVS_SWIZZLE_SHIFT + 6))
#define D3DVS_W_Z (2 << (D3DVS_SWIZZLE_SHIFT + 6))
#define D3DVS_W_W (3 << (D3DVS_SWIZZLE_SHIFT + 6))
// Value when there is no swizzle (X is taken from X, Y is taken from Y,
// Z is taken from Z, W is taken from W
//
#define D3DVS_NOSWIZZLE (D3DVS_X_X | D3DVS_Y_Y | D3DVS_Z_Z | D3DVS_W_W)
// source parameter swizzle
#define D3DSP_SWIZZLE_SHIFT 16
#define D3DSP_SWIZZLE_MASK 0x00FF0000
#define D3DSP_NOSWIZZLE \
( (0 << (D3DSP_SWIZZLE_SHIFT + 0)) | \
(1 << (D3DSP_SWIZZLE_SHIFT + 2)) | \
(2 << (D3DSP_SWIZZLE_SHIFT + 4)) | \
(3 << (D3DSP_SWIZZLE_SHIFT + 6)) )
// pixel-shader swizzle ops
#define D3DSP_REPLICATERED \
( (0 << (D3DSP_SWIZZLE_SHIFT + 0)) | \
(0 << (D3DSP_SWIZZLE_SHIFT + 2)) | \
(0 << (D3DSP_SWIZZLE_SHIFT + 4)) | \
(0 << (D3DSP_SWIZZLE_SHIFT + 6)) )
#define D3DSP_REPLICATEGREEN \
( (1 << (D3DSP_SWIZZLE_SHIFT + 0)) | \
(1 << (D3DSP_SWIZZLE_SHIFT + 2)) | \
(1 << (D3DSP_SWIZZLE_SHIFT + 4)) | \
(1 << (D3DSP_SWIZZLE_SHIFT + 6)) )
#define D3DSP_REPLICATEBLUE \
( (2 << (D3DSP_SWIZZLE_SHIFT + 0)) | \
(2 << (D3DSP_SWIZZLE_SHIFT + 2)) | \
(2 << (D3DSP_SWIZZLE_SHIFT + 4)) | \
(2 << (D3DSP_SWIZZLE_SHIFT + 6)) )
#define D3DSP_REPLICATEALPHA \
( (3 << (D3DSP_SWIZZLE_SHIFT + 0)) | \
(3 << (D3DSP_SWIZZLE_SHIFT + 2)) | \
(3 << (D3DSP_SWIZZLE_SHIFT + 4)) | \
(3 << (D3DSP_SWIZZLE_SHIFT + 6)) )
// source parameter modifiers
#define D3DSP_SRCMOD_SHIFT 24
#define D3DSP_SRCMOD_MASK 0x0F000000
typedef enum _D3DSHADER_PARAM_SRCMOD_TYPE
{
D3DSPSM_NONE = 0<<D3DSP_SRCMOD_SHIFT, // nop
D3DSPSM_NEG = 1<<D3DSP_SRCMOD_SHIFT, // negate
D3DSPSM_BIAS = 2<<D3DSP_SRCMOD_SHIFT, // bias
D3DSPSM_BIASNEG = 3<<D3DSP_SRCMOD_SHIFT, // bias and negate
D3DSPSM_SIGN = 4<<D3DSP_SRCMOD_SHIFT, // sign
D3DSPSM_SIGNNEG = 5<<D3DSP_SRCMOD_SHIFT, // sign and negate
D3DSPSM_COMP = 6<<D3DSP_SRCMOD_SHIFT, // complement
D3DSPSM_X2 = 7<<D3DSP_SRCMOD_SHIFT, // *2
D3DSPSM_X2NEG = 8<<D3DSP_SRCMOD_SHIFT, // *2 and negate
D3DSPSM_DZ = 9<<D3DSP_SRCMOD_SHIFT, // divide through by z component
D3DSPSM_DW = 10<<D3DSP_SRCMOD_SHIFT, // divide through by w component
D3DSPSM_ABS = 11<<D3DSP_SRCMOD_SHIFT, // abs()
D3DSPSM_ABSNEG = 12<<D3DSP_SRCMOD_SHIFT, // -abs()
D3DSPSM_NOT = 13<<D3DSP_SRCMOD_SHIFT, // for predicate register: "!p0"
D3DSPSM_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum
} D3DSHADER_PARAM_SRCMOD_TYPE;
// pixel shader version token
#define D3DPS_VERSION(_Major,_Minor) (0xFFFF0000|((_Major)<<8)|(_Minor))
// vertex shader version token
#define D3DVS_VERSION(_Major,_Minor) (0xFFFE0000|((_Major)<<8)|(_Minor))
// extract major/minor from version cap
#define D3DSHADER_VERSION_MAJOR(_Version) (((_Version)>>8)&0xFF)
#define D3DSHADER_VERSION_MINOR(_Version) (((_Version)>>0)&0xFF)
// destination/source parameter register type
#define D3DSI_COMMENTSIZE_SHIFT 16
#define D3DSI_COMMENTSIZE_MASK 0x7FFF0000
#define D3DSHADER_COMMENT(_DWordSize) \
((((_DWordSize)<<D3DSI_COMMENTSIZE_SHIFT)&D3DSI_COMMENTSIZE_MASK)|D3DSIO_COMMENT)
// pixel/vertex shader end token
#define D3DPS_END() 0x0000FFFF
#define D3DVS_END() 0x0000FFFF
//---------------------------------------------------------------------
// High order surfaces
//
typedef enum _D3DBASISTYPE
{
D3DBASIS_BEZIER = 0,
D3DBASIS_BSPLINE = 1,
D3DBASIS_CATMULL_ROM = 2, /* In D3D8 this used to be D3DBASIS_INTERPOLATE */
D3DBASIS_FORCE_DWORD = 0x7fffffff,
} D3DBASISTYPE;
typedef enum _D3DDEGREETYPE
{
D3DDEGREE_LINEAR = 1,
D3DDEGREE_QUADRATIC = 2,
D3DDEGREE_CUBIC = 3,
D3DDEGREE_QUINTIC = 5,
D3DDEGREE_FORCE_DWORD = 0x7fffffff,
} D3DDEGREETYPE;
typedef enum _D3DPATCHEDGESTYLE
{
D3DPATCHEDGE_DISCRETE = 0,
D3DPATCHEDGE_CONTINUOUS = 1,
D3DPATCHEDGE_FORCE_DWORD = 0x7fffffff,
} D3DPATCHEDGESTYLE;
typedef enum _D3DSTATEBLOCKTYPE
{
D3DSBT_ALL = 1, // capture all state
D3DSBT_PIXELSTATE = 2, // capture pixel state
D3DSBT_VERTEXSTATE = 3, // capture vertex state
D3DSBT_FORCE_DWORD = 0x7fffffff,
} D3DSTATEBLOCKTYPE;
// The D3DVERTEXBLENDFLAGS type is used with D3DRS_VERTEXBLEND state.
//
typedef enum _D3DVERTEXBLENDFLAGS
{
D3DVBF_DISABLE = 0, // Disable vertex blending
D3DVBF_1WEIGHTS = 1, // 2 matrix blending
D3DVBF_2WEIGHTS = 2, // 3 matrix blending
D3DVBF_3WEIGHTS = 3, // 4 matrix blending
D3DVBF_TWEENING = 255, // blending using D3DRS_TWEENFACTOR
D3DVBF_0WEIGHTS = 256, // one matrix is used with weight 1.0
D3DVBF_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum
} D3DVERTEXBLENDFLAGS;
typedef enum _D3DTEXTURETRANSFORMFLAGS {
D3DTTFF_DISABLE = 0, // texture coordinates are passed directly
D3DTTFF_COUNT1 = 1, // rasterizer should expect 1-D texture coords
D3DTTFF_COUNT2 = 2, // rasterizer should expect 2-D texture coords
D3DTTFF_COUNT3 = 3, // rasterizer should expect 3-D texture coords
D3DTTFF_COUNT4 = 4, // rasterizer should expect 4-D texture coords
D3DTTFF_PROJECTED = 256, // texcoords to be divided by COUNTth element
D3DTTFF_FORCE_DWORD = 0x7fffffff,
} D3DTEXTURETRANSFORMFLAGS;
// Macros to set texture coordinate format bits in the FVF id
#define D3DFVF_TEXTUREFORMAT2 0 // Two floating point values
#define D3DFVF_TEXTUREFORMAT1 3 // One floating point value
#define D3DFVF_TEXTUREFORMAT3 1 // Three floating point values
#define D3DFVF_TEXTUREFORMAT4 2 // Four floating point values
#define D3DFVF_TEXCOORDSIZE3(CoordIndex) (D3DFVF_TEXTUREFORMAT3 << (CoordIndex*2 + 16))
#define D3DFVF_TEXCOORDSIZE2(CoordIndex) (D3DFVF_TEXTUREFORMAT2)
#define D3DFVF_TEXCOORDSIZE4(CoordIndex) (D3DFVF_TEXTUREFORMAT4 << (CoordIndex*2 + 16))
#define D3DFVF_TEXCOORDSIZE1(CoordIndex) (D3DFVF_TEXTUREFORMAT1 << (CoordIndex*2 + 16))
//---------------------------------------------------------------------
/* Direct3D9 Device types */
typedef enum _D3DDEVTYPE
{
D3DDEVTYPE_HAL = 1,
D3DDEVTYPE_REF = 2,
D3DDEVTYPE_SW = 3,
D3DDEVTYPE_NULLREF = 4,
D3DDEVTYPE_FORCE_DWORD = 0x7fffffff
} D3DDEVTYPE;
/* Multi-Sample buffer types */
typedef enum _D3DMULTISAMPLE_TYPE
{
D3DMULTISAMPLE_NONE = 0,
D3DMULTISAMPLE_NONMASKABLE = 1,
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
} D3DMULTISAMPLE_TYPE;
/* Formats
* Most of these names have the following convention:
* A = Alpha
* R = Red
* G = Green
* B = Blue
* X = Unused Bits
* P = Palette
* L = Luminance
* U = dU coordinate for BumpMap
* V = dV coordinate for BumpMap
* S = Stencil
* D = Depth (e.g. Z or W buffer)
* C = Computed from other channels (typically on certain read operations)
*
* Further, the order of the pieces are from MSB first; hence
* D3DFMT_A8L8 indicates that the high byte of this two byte
* format is alpha.
*
* D3DFMT_D16_LOCKABLE indicates:
* - An integer 16-bit value.
* - An app-lockable surface.
*
* D3DFMT_D32F_LOCKABLE indicates:
* - An IEEE 754 floating-point value.
* - An app-lockable surface.
*
* All Depth/Stencil formats except D3DFMT_D16_LOCKABLE and D3DFMT_D32F_LOCKABLE indicate:
* - no particular bit ordering per pixel, and
* - are not app lockable, and
* - the driver is allowed to consume more than the indicated
* number of bits per Depth channel (but not Stencil channel).
*/
#ifndef MAKEFOURCC
#define MAKEFOURCC(ch0, ch1, ch2, ch3) \
((DWORD)(BYTE)(ch0) | ((DWORD)(BYTE)(ch1) << 8) | \
((DWORD)(BYTE)(ch2) << 16) | ((DWORD)(BYTE)(ch3) << 24 ))
#endif /* defined(MAKEFOURCC) */
typedef 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_A8B8G8R8 = 32,
D3DFMT_X8B8G8R8 = 33,
D3DFMT_G16R16 = 34,
D3DFMT_A2R10G10B10 = 35,
D3DFMT_A16B16G16R16 = 36,
D3DFMT_A8P8 = 40,
D3DFMT_P8 = 41,
D3DFMT_L8 = 50,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -