From 4c0c8424514d1d5d09482899629f6b6fe68acc12 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Wed, 27 Dec 2017 22:03:13 +0100 Subject: [PATCH] Make D3D headers more suitable for C89_BUILD --- gfx/include/d3d9types.h | 391 ++++++++++++++++++++-------------------- 1 file changed, 198 insertions(+), 193 deletions(-) diff --git a/gfx/include/d3d9types.h b/gfx/include/d3d9types.h index ef96fda496..c1c5573baa 100644 --- a/gfx/include/d3d9types.h +++ b/gfx/include/d3d9types.h @@ -168,7 +168,7 @@ typedef enum _D3DLIGHTTYPE { D3DLIGHT_POINT = 1, D3DLIGHT_SPOT = 2, D3DLIGHT_DIRECTIONAL = 3, - D3DLIGHT_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ + D3DLIGHT_FORCE_DWORD = 0x7fffffff /* force 32-bit size enum */ } D3DLIGHTTYPE; typedef struct _D3DLIGHT9 { @@ -202,14 +202,14 @@ typedef enum _D3DSHADEMODE { D3DSHADE_FLAT = 1, D3DSHADE_GOURAUD = 2, D3DSHADE_PHONG = 3, - D3DSHADE_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ + D3DSHADE_FORCE_DWORD = 0x7fffffff /* force 32-bit size enum */ } D3DSHADEMODE; typedef enum _D3DFILLMODE { D3DFILL_POINT = 1, D3DFILL_WIREFRAME = 2, D3DFILL_SOLID = 3, - D3DFILL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ + D3DFILL_FORCE_DWORD = 0x7fffffff /* force 32-bit size enum */ } D3DFILLMODE; typedef enum _D3DBLEND { @@ -236,7 +236,7 @@ typedef enum _D3DBLEND { #endif /* !D3D_DISABLE_9EX */ /* -- D3D9Ex only */ - D3DBLEND_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ + D3DBLEND_FORCE_DWORD = 0x7fffffff /* force 32-bit size enum */ } D3DBLEND; typedef enum _D3DBLENDOP { @@ -245,7 +245,7 @@ typedef enum _D3DBLENDOP { D3DBLENDOP_REVSUBTRACT = 3, D3DBLENDOP_MIN = 4, D3DBLENDOP_MAX = 5, - D3DBLENDOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ + D3DBLENDOP_FORCE_DWORD = 0x7fffffff /* force 32-bit size enum */ } D3DBLENDOP; typedef enum _D3DTEXTUREADDRESS { @@ -254,14 +254,14 @@ typedef enum _D3DTEXTUREADDRESS { D3DTADDRESS_CLAMP = 3, D3DTADDRESS_BORDER = 4, D3DTADDRESS_MIRRORONCE = 5, - D3DTADDRESS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ + D3DTADDRESS_FORCE_DWORD = 0x7fffffff /* force 32-bit size enum */ } D3DTEXTUREADDRESS; typedef enum _D3DCULL { D3DCULL_NONE = 1, D3DCULL_CW = 2, D3DCULL_CCW = 3, - D3DCULL_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ + D3DCULL_FORCE_DWORD = 0x7fffffff /* force 32-bit size enum */ } D3DCULL; typedef enum _D3DCMPFUNC { @@ -273,7 +273,7 @@ typedef enum _D3DCMPFUNC { D3DCMP_NOTEQUAL = 6, D3DCMP_GREATEREQUAL = 7, D3DCMP_ALWAYS = 8, - D3DCMP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ + D3DCMP_FORCE_DWORD = 0x7fffffff /* force 32-bit size enum */ } D3DCMPFUNC; typedef enum _D3DSTENCILOP { @@ -285,7 +285,7 @@ typedef enum _D3DSTENCILOP { D3DSTENCILOP_INVERT = 6, D3DSTENCILOP_INCR = 7, D3DSTENCILOP_DECR = 8, - D3DSTENCILOP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ + D3DSTENCILOP_FORCE_DWORD = 0x7fffffff /* force 32-bit size enum */ } D3DSTENCILOP; typedef enum _D3DFOGMODE { @@ -293,7 +293,7 @@ typedef enum _D3DFOGMODE { D3DFOG_EXP = 1, D3DFOG_EXP2 = 2, D3DFOG_LINEAR = 3, - D3DFOG_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ + D3DFOG_FORCE_DWORD = 0x7fffffff /* force 32-bit size enum */ } D3DFOGMODE; typedef enum _D3DZBUFFERTYPE { @@ -440,7 +440,7 @@ typedef enum _D3DRENDERSTATETYPE { D3DRS_BLENDOPALPHA = 209, /* Blending operation for the alpha channel when D3DRS_SEPARATEDESTALPHAENABLE is TRUE */ - D3DRS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ + D3DRS_FORCE_DWORD = 0x7fffffff /* force 32-bit size enum */ } D3DRENDERSTATETYPE; /* Maximum number of simultaneous render targets D3D supports */ @@ -501,7 +501,7 @@ typedef enum _D3DTEXTURESTAGESTATETYPE D3DTSS_CONSTANT = 32, /* Per-stage constant D3DTA_CONSTANT */ - D3DTSS_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ + D3DTSS_FORCE_DWORD = 0x7fffffff /* force 32-bit size enum */ } D3DTEXTURESTAGESTATETYPE; /* @@ -526,7 +526,7 @@ typedef enum _D3DSAMPLERSTATETYPE indicates which element index to use. Default = 0. */ D3DSAMP_DMAPOFFSET = 13, /* Offset in vertices in the pre-sampled displacement map. Only valid for D3DDMAPSAMPLER sampler */ - D3DSAMP_FORCE_DWORD = 0x7fffffff, /* force 32-bit size enum */ + D3DSAMP_FORCE_DWORD = 0x7fffffff /* force 32-bit size enum */ } D3DSAMPLERSTATETYPE; /* Special sampler which is used in the tesselator */ @@ -584,31 +584,32 @@ typedef enum _D3DTEXTUREOP /* Specular mapping */ D3DTOP_PREMODULATE = 17, /* modulate with next texture before use */ - D3DTOP_MODULATEALPHA_ADDCOLOR = 18, // Arg1.RGB + Arg1.A*Arg2.RGB - // COLOROP only - D3DTOP_MODULATECOLOR_ADDALPHA = 19, // Arg1.RGB*Arg2.RGB + Arg1.A - // COLOROP only - D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20, // (1-Arg1.A)*Arg2.RGB + Arg1.RGB - // COLOROP only - D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21, // (1-Arg1.RGB)*Arg2.RGB + Arg1.A - // COLOROP only + D3DTOP_MODULATEALPHA_ADDCOLOR = 18, /* Arg1.RGB + Arg1.A*Arg2.RGB + * COLOROP only */ + D3DTOP_MODULATECOLOR_ADDALPHA = 19, /* Arg1.RGB*Arg2.RGB + Arg1.A + * COLOROP only */ + D3DTOP_MODULATEINVALPHA_ADDCOLOR = 20, /* (1-Arg1.A)*Arg2.RGB + Arg1.RGB + * COLOROP only */ + D3DTOP_MODULATEINVCOLOR_ADDALPHA = 21, /* (1-Arg1.RGB)*Arg2.RGB + Arg1.A + * COLOROP only */ - // Bump mapping - D3DTOP_BUMPENVMAP = 22, // per pixel env map perturbation - D3DTOP_BUMPENVMAPLUMINANCE = 23, // with luminance channel + /* Bump mapping */ + D3DTOP_BUMPENVMAP = 22, /* per pixel env map perturbation */ + D3DTOP_BUMPENVMAPLUMINANCE = 23, /* with luminance channel */ - // This can do either diffuse or specular bump mapping with correct input. - // Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B) - // where each component has been scaled and offset to make it signed. - // The result is replicated into all four (including alpha) channels. - // This is a valid COLOROP only. + /* This can do either diffuse or specular bump mapping with correct input. + * Performs the function (Arg1.R*Arg2.R + Arg1.G*Arg2.G + Arg1.B*Arg2.B) + * where each component has been scaled and offset to make it signed. + * The result is replicated into all four (including alpha) channels. + * This is a valid COLOROP only. + */ D3DTOP_DOTPRODUCT3 = 24, /* Triadic ops */ D3DTOP_MULTIPLYADD = 25, /* Arg0 + Arg1*Arg2 */ D3DTOP_LERP = 26, /* (Arg0)*Arg1 + (1-Arg0)*Arg2 */ - D3DTOP_FORCE_DWORD = 0x7fffffff, + D3DTOP_FORCE_DWORD = 0x7fffffff } D3DTEXTUREOP; /* @@ -650,7 +651,7 @@ typedef enum _D3DTEXTUREFILTERTYPE #define D3DPV_DONOTCOPYDATA (1 << 0) -//------------------------------------------------------------------- +/*------------------------------------------------------------------- */ /* Flexible vertex format bits */ #define D3DFVF_RESERVED0 0x001 @@ -696,19 +697,19 @@ typedef enum _D3DTEXTUREFILTERTYPE 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_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 @@ -731,28 +732,28 @@ typedef enum _D3DDECLMETHOD /* 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 + 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_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 @@ -774,20 +775,22 @@ typedef struct _D3DVERTEXELEMENT9 /* Maximum supported number of texture coordinate sets */ #define D3DDP_MAXTEXCOORD 8 -//--------------------------------------------------------------------- -// Values for IDirect3DDevice9::SetStreamSourceFreq's Setting parameter -//--------------------------------------------------------------------- +/*--------------------------------------------------------------------- + * 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 -// -//--------------------------------------------------------------------- +/*--------------------------------------------------------------------- + * + * 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 @@ -888,100 +891,101 @@ typedef enum _D3DSHADER_INSTRUCTION_OPCODE_TYPE D3DSIO_FORCE_DWORD = 0x7fffffff /* force 32-bit size enum */ } D3DSHADER_INSTRUCTION_OPCODE_TYPE; -//--------------------------------------------------------------------- -// Use these constants with D3DSIO_SINCOS macro as SRC2, SRC3 -// +/*--------------------------------------------------------------------- + * 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. -// +/*--------------------------------------------------------------------- + * 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 +/*--------------------------------------------------------------------- + * Opcode specific controls + */ #define D3DSP_OPCODESPECIFICCONTROL_MASK 0x00ff0000 #define D3DSP_OPCODESPECIFICCONTROL_SHIFT 16 -// ps_2_0 texld controls +/* 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) +/* 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 + /* < = > */ + 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: +/* Comparison is part of instruction opcode token: */ #define D3DSHADER_COMPARISON_SHIFT D3DSP_OPCODESPECIFICCONTROL_SHIFT #define D3DSHADER_COMPARISON_MASK (0x7<>8)&0xFF) #define D3DSHADER_VERSION_MINOR(_Version) (((_Version)>>0)&0xFF) -// destination/source parameter register type +/* destination/source parameter register type */ #define D3DSI_COMMENTSIZE_SHIFT 16 #define D3DSI_COMMENTSIZE_MASK 0x7FFF0000 #define D3DSHADER_COMMENT(_DWordSize) \ ((((_DWordSize)<