📄 d3d9types.h
字号:
// Vertex shader declaration
// Vertex element semantics
//
typedef enum _D3DDECLUSAGE
{
D3DDECLUSAGE_POSITION = 0,
D3DDECLUSAGE_BLENDWEIGHT, // 1
D3DDECLUSAGE_BLENDINDICES, // 2
D3DDECLUSAGE_NORMAL, // 3
D3DDECLUSAGE_PSIZE, // 4
D3DDECLUSAGE_TEXCOORD, // 5
D3DDECLUSAGE_TANGENT, // 6
D3DDECLUSAGE_BINORMAL, // 7
D3DDECLUSAGE_TESSFACTOR, // 8
D3DDECLUSAGE_POSITIONT, // 9
D3DDECLUSAGE_COLOR, // 10
D3DDECLUSAGE_FOG, // 11
D3DDECLUSAGE_DEPTH, // 12
D3DDECLUSAGE_SAMPLE, // 13
} D3DDECLUSAGE;
#define MAXD3DDECLUSAGE D3DDECLUSAGE_SAMPLE
#define MAXD3DDECLUSAGEINDEX 15
#define MAXD3DDECLLENGTH 64 // does not include "end" marker vertex element
typedef enum _D3DDECLMETHOD
{
D3DDECLMETHOD_DEFAULT = 0,
D3DDECLMETHOD_PARTIALU,
D3DDECLMETHOD_PARTIALV,
D3DDECLMETHOD_CROSSUV, // Normal
D3DDECLMETHOD_UV,
D3DDECLMETHOD_LOOKUP, // Lookup a displacement map
D3DDECLMETHOD_LOOKUPPRESAMPLED, // Lookup a pre-sampled displacement map
} D3DDECLMETHOD;
#define MAXD3DDECLMETHOD D3DDECLMETHOD_LOOKUPPRESAMPLED
// Declarations for _Type fields
//
typedef enum _D3DDECLTYPE
{
D3DDECLTYPE_FLOAT1 = 0, // 1D float expanded to (value, 0., 0., 1.)
D3DDECLTYPE_FLOAT2 = 1, // 2D float expanded to (value, value, 0., 1.)
D3DDECLTYPE_FLOAT3 = 2, // 3D float expanded to (value, value, value, 1.)
D3DDECLTYPE_FLOAT4 = 3, // 4D float
D3DDECLTYPE_D3DCOLOR = 4, // 4D packed unsigned bytes mapped to 0. to 1. range
// Input is in D3DCOLOR format (ARGB) expanded to (R, G, B, A)
D3DDECLTYPE_UBYTE4 = 5, // 4D unsigned byte
D3DDECLTYPE_SHORT2 = 6, // 2D signed short expanded to (value, value, 0., 1.)
D3DDECLTYPE_SHORT4 = 7, // 4D signed short
// The following types are valid only with vertex shaders >= 2.0
D3DDECLTYPE_UBYTE4N = 8, // Each of 4 bytes is normalized by dividing to 255.0
D3DDECLTYPE_SHORT2N = 9, // 2D signed short normalized (v[0]/32767.0,v[1]/32767.0,0,1)
D3DDECLTYPE_SHORT4N = 10, // 4D signed short normalized (v[0]/32767.0,v[1]/32767.0,v[2]/32767.0,v[3]/32767.0)
D3DDECLTYPE_USHORT2N = 11, // 2D unsigned short normalized (v[0]/65535.0,v[1]/65535.0,0,1)
D3DDECLTYPE_USHORT4N = 12, // 4D unsigned short normalized (v[0]/65535.0,v[1]/65535.0,v[2]/65535.0,v[3]/65535.0)
D3DDECLTYPE_UDEC3 = 13, // 3D unsigned 10 10 10 format expanded to (value, value, value, 1)
D3DDECLTYPE_DEC3N = 14, // 3D signed 10 10 10 format normalized and expanded to (v[0]/511.0, v[1]/511.0, v[2]/511.0, 1)
D3DDECLTYPE_FLOAT16_2 = 15, // Two 16-bit floating point values, expanded to (value, value, 0, 1)
D3DDECLTYPE_FLOAT16_4 = 16, // Four 16-bit floating point values
D3DDECLTYPE_UNUSED = 17, // When the type field in a decl is unused.
} D3DDECLTYPE;
#define MAXD3DDECLTYPE D3DDECLTYPE_UNUSED
typedef struct _D3DVERTEXELEMENT9
{
WORD Stream; // Stream index
WORD Offset; // Offset in the stream in bytes
BYTE Type; // Data type
BYTE Method; // Processing method
BYTE Usage; // Semantics
BYTE UsageIndex; // Semantic index
} D3DVERTEXELEMENT9, *LPD3DVERTEXELEMENT9;
// This is used to initialize the last vertex element in a vertex declaration
// array
//
#define D3DDECL_END() {0xFF,0,D3DDECLTYPE_UNUSED,0,0,0}
// Maximum supported number of texture coordinate sets
#define D3DDP_MAXTEXCOORD 8
//---------------------------------------------------------------------
// Values for IDirect3DDevice9::SetStreamSourceFreq's Setting parameter
//---------------------------------------------------------------------
#define D3DSTREAMSOURCE_INDEXEDDATA (1<<30)
#define D3DSTREAMSOURCE_INSTANCEDATA (2<<30)
//---------------------------------------------------------------------
//
// The internal format of Pixel Shader (PS) & Vertex Shader (VS)
// Instruction Tokens is defined in the Direct3D Device Driver Kit
//
//---------------------------------------------------------------------
//
// Instruction Token Bit Definitions
//
#define D3DSI_OPCODE_MASK 0x0000FFFF
#define D3DSI_INSTLENGTH_MASK 0x0F000000
#define D3DSI_INSTLENGTH_SHIFT 24
typedef 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_CALL ,
D3DSIO_CALLNZ ,
D3DSIO_LOOP ,
D3DSIO_RET ,
D3DSIO_ENDLOOP ,
D3DSIO_LABEL ,
D3DSIO_DCL ,
D3DSIO_POW ,
D3DSIO_CRS ,
D3DSIO_SGN ,
D3DSIO_ABS ,
D3DSIO_NRM ,
D3DSIO_SINCOS ,
D3DSIO_REP ,
D3DSIO_ENDREP ,
D3DSIO_IF ,
D3DSIO_IFC ,
D3DSIO_ELSE ,
D3DSIO_ENDIF ,
D3DSIO_BREAK ,
D3DSIO_BREAKC ,
D3DSIO_MOVA ,
D3DSIO_DEFB ,
D3DSIO_DEFI ,
D3DSIO_TEXCOORD = 64,
D3DSIO_TEXKILL ,
D3DSIO_TEX ,
D3DSIO_TEXBEM ,
D3DSIO_TEXBEML ,
D3DSIO_TEXREG2AR ,
D3DSIO_TEXREG2GB ,
D3DSIO_TEXM3x2PAD ,
D3DSIO_TEXM3x2TEX ,
D3DSIO_TEXM3x3PAD ,
D3DSIO_TEXM3x3TEX ,
D3DSIO_RESERVED0 ,
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_DP2ADD ,
D3DSIO_DSX ,
D3DSIO_DSY ,
D3DSIO_TEXLDD ,
D3DSIO_SETP ,
D3DSIO_TEXLDL ,
D3DSIO_BREAKP ,
D3DSIO_PHASE = 0xFFFD,
D3DSIO_COMMENT = 0xFFFE,
D3DSIO_END = 0xFFFF,
D3DSIO_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum
} D3DSHADER_INSTRUCTION_OPCODE_TYPE;
//---------------------------------------------------------------------
// Use these constants with D3DSIO_SINCOS macro as SRC2, SRC3
//
#define D3DSINCOSCONST1 -1.5500992e-006f, -2.1701389e-005f, 0.0026041667f, 0.00026041668f
#define D3DSINCOSCONST2 -0.020833334f, -0.12500000f, 1.0f, 0.50000000f
//---------------------------------------------------------------------
// Co-Issue Instruction Modifier - if set then this instruction is to be
// issued in parallel with the previous instruction(s) for which this bit
// is not set.
//
#define D3DSI_COISSUE 0x40000000
//---------------------------------------------------------------------
// Opcode specific controls
#define D3DSP_OPCODESPECIFICCONTROL_MASK 0x00ff0000
#define D3DSP_OPCODESPECIFICCONTROL_SHIFT 16
// ps_2_0 texld controls
#define D3DSI_TEXLD_PROJECT (0x01 << D3DSP_OPCODESPECIFICCONTROL_SHIFT)
#define D3DSI_TEXLD_BIAS (0x02 << D3DSP_OPCODESPECIFICCONTROL_SHIFT)
// Comparison for dynamic conditional instruction opcodes (i.e. if, breakc)
typedef enum _D3DSHADER_COMPARISON
{
// < = >
D3DSPC_RESERVED0= 0, // 0 0 0
D3DSPC_GT = 1, // 0 0 1
D3DSPC_EQ = 2, // 0 1 0
D3DSPC_GE = 3, // 0 1 1
D3DSPC_LT = 4, // 1 0 0
D3DSPC_NE = 5, // 1 0 1
D3DSPC_LE = 6, // 1 1 0
D3DSPC_RESERVED1= 7 // 1 1 1
} D3DSHADER_COMPARISON;
// Comparison is part of instruction opcode token:
#define D3DSHADER_COMPARISON_SHIFT D3DSP_OPCODESPECIFICCONTROL_SHIFT
#define D3DSHADER_COMPARISON_MASK (0x7<<D3DSHADER_COMPARISON_SHIFT)
//---------------------------------------------------------------------
// Predication flags on instruction token
#define D3DSHADER_INSTRUCTION_PREDICATED (0x1 << 28)
//---------------------------------------------------------------------
// DCL Info Token Controls
// For dcl info tokens requiring a semantic (usage + index)
#define D3DSP_DCL_USAGE_SHIFT 0
#define D3DSP_DCL_USAGE_MASK 0x0000000f
#define D3DSP_DCL_USAGEINDEX_SHIFT 16
#define D3DSP_DCL_USAGEINDEX_MASK 0x000f0000
// DCL pixel shader sampler info token.
#define D3DSP_TEXTURETYPE_SHIFT 27
#define D3DSP_TEXTURETYPE_MASK 0x78000000
typedef enum _D3DSAMPLER_TEXTURE_TYPE
{
D3DSTT_UNKNOWN = 0<<D3DSP_TEXTURETYPE_SHIFT, // uninitialized value
D3DSTT_2D = 2<<D3DSP_TEXTURETYPE_SHIFT, // dcl_2d s# (for declaring a 2-D texture)
D3DSTT_CUBE = 3<<D3DSP_TEXTURETYPE_SHIFT, // dcl_cube s# (for declaring a cube texture)
D3DSTT_VOLUME = 4<<D3DSP_TEXTURETYPE_SHIFT, // dcl_volume s# (for declaring a volume texture)
D3DSTT_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum
} D3DSAMPLER_TEXTURE_TYPE;
//---------------------------------------------------------------------
// Parameter Token Bit Definitions
//
#define D3DSP_REGNUM_MASK 0x000007FF
// destination parameter write mask
#define D3DSP_WRITEMASK_0 0x00010000 // Component 0 (X;Red)
#define D3DSP_WRITEMASK_1 0x00020000 // Component 1 (Y;Green)
#define D3DSP_WRITEMASK_2 0x00040000 // Component 2 (Z;Blue)
#define D3DSP_WRITEMASK_3 0x00080000 // Component 3 (W;Alpha)
#define D3DSP_WRITEMASK_ALL 0x000F0000 // All Components
// destination parameter modifiers
#define D3DSP_DSTMOD_SHIFT 20
#define D3DSP_DSTMOD_MASK 0x00F00000
// Bit masks for destination parameter modifiers
#define D3DSPDM_NONE (0<<D3DSP_DSTMOD_SHIFT) // nop
#define D3DSPDM_SATURATE (1<<D3DSP_DSTMOD_SHIFT) // clamp to 0. to 1. range
#define D3DSPDM_PARTIALPRECISION (2<<D3DSP_DSTMOD_SHIFT) // Partial precision hint
#define D3DSPDM_MSAMPCENTROID (4<<D3DSP_DSTMOD_SHIFT) // Relevant to multisampling only:
// When the pixel center is not covered, sample
// attribute or compute gradients/LOD
// using multisample "centroid" location.
// "Centroid" is some location within the covered
// region of the pixel.
// destination parameter
#define D3DSP_DSTSHIFT_SHIFT 24
#define D3DSP_DSTSHIFT_MASK 0x0F000000
// destination/source parameter register type
#define D3DSP_REGTYPE_SHIFT 28
#define D3DSP_REGTYPE_SHIFT2 8
#define D3DSP_REGTYPE_MASK 0x70000000
#define D3DSP_REGTYPE_MASK2 0x00001800
typedef enum _D3DSHADER_PARAM_REGISTER_TYPE
{
D3DSPR_TEMP = 0, // Temporary Register File
D3DSPR_INPUT = 1, // Input Register File
D3DSPR_CONST = 2, // Constant Register File
D3DSPR_ADDR = 3, // Address Register (VS)
D3DSPR_TEXTURE = 3, // Texture Register File (PS)
D3DSPR_RASTOUT = 4, // Rasterizer Register File
D3DSPR_ATTROUT = 5, // Attribute Output Register File
D3DSPR_TEXCRDOUT = 6, // Texture Coordinate Output Register File
D3DSPR_OUTPUT = 6, // Output register file for VS3.0+
D3DSPR_CONSTINT = 7, // Constant Integer Vector Register File
D3DSPR_COLOROUT = 8, // Color Output Register File
D3DSPR_DEPTHOUT = 9, // Depth Output Register File
D3DSPR_SAMPLER = 10, // Sampler State Register File
D3DSPR_CONST2 = 11, // Constant Register File 2048 - 4095
D3DSPR_CONST3 = 12, // Constant Register File 4096 - 6143
D3DSPR_CONST4 = 13, // Constant Register File 6144 - 8191
D3DSPR_CONSTBOOL = 14, // Constant Boolean register file
D3DSPR_LOOP = 15, // Loop counter register file
D3DSPR_TEMPFLOAT16 = 16, // 16-bit float temp register file
D3DSPR_MISCTYPE = 17, // Miscellaneous (single) registers.
D3DSPR_LABEL = 18, // Label
D3DSPR_PREDICATE = 19, // Predicate register
D3DSPR_FORCE_DWORD = 0x7fffffff, // force 32-bit size enum
} D3DSHADER_PARAM_REGISTER_TYPE;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -