wined3d: Add WINED3DDECLUSAGE, use it.

This commit is contained in:
H. Verbeet 2007-02-13 23:12:14 +01:00 committed by Alexandre Julliard
parent 942bef9e86
commit 8f0884066f
6 changed files with 89 additions and 72 deletions

View File

@ -419,50 +419,50 @@ static void shader_dump_decl_usage(
TRACE("_");
switch(usage) {
case D3DDECLUSAGE_POSITION:
case WINED3DDECLUSAGE_POSITION:
TRACE("position%d", idx);
break;
case D3DDECLUSAGE_BLENDINDICES:
case WINED3DDECLUSAGE_BLENDINDICES:
TRACE("blend");
break;
case D3DDECLUSAGE_BLENDWEIGHT:
case WINED3DDECLUSAGE_BLENDWEIGHT:
TRACE("weight");
break;
case D3DDECLUSAGE_NORMAL:
case WINED3DDECLUSAGE_NORMAL:
TRACE("normal%d", idx);
break;
case D3DDECLUSAGE_PSIZE:
case WINED3DDECLUSAGE_PSIZE:
TRACE("psize");
break;
case D3DDECLUSAGE_COLOR:
case WINED3DDECLUSAGE_COLOR:
if(idx == 0) {
TRACE("color");
} else {
TRACE("specular%d", (idx - 1));
}
break;
case D3DDECLUSAGE_TEXCOORD:
case WINED3DDECLUSAGE_TEXCOORD:
TRACE("texture%d", idx);
break;
case D3DDECLUSAGE_TANGENT:
case WINED3DDECLUSAGE_TANGENT:
TRACE("tangent");
break;
case D3DDECLUSAGE_BINORMAL:
case WINED3DDECLUSAGE_BINORMAL:
TRACE("binormal");
break;
case D3DDECLUSAGE_TESSFACTOR:
case WINED3DDECLUSAGE_TESSFACTOR:
TRACE("tessfactor");
break;
case D3DDECLUSAGE_POSITIONT:
case WINED3DDECLUSAGE_POSITIONT:
TRACE("positionT%d", idx);
break;
case D3DDECLUSAGE_FOG:
case WINED3DDECLUSAGE_FOG:
TRACE("fog");
break;
case D3DDECLUSAGE_DEPTH:
case WINED3DDECLUSAGE_DEPTH:
TRACE("depth");
break;
case D3DDECLUSAGE_SAMPLE:
case WINED3DDECLUSAGE_SAMPLE:
TRACE("sample");
break;
default:

View File

@ -99,37 +99,37 @@ static BOOL fixed_get_input(
/* Those positions must have the order in the
* named part of the strided data */
if ((usage == D3DDECLUSAGE_POSITION || usage == D3DDECLUSAGE_POSITIONT) && usage_idx == 0)
if ((usage == WINED3DDECLUSAGE_POSITION || usage == WINED3DDECLUSAGE_POSITIONT) && usage_idx == 0)
*regnum = 0;
else if (usage == D3DDECLUSAGE_BLENDWEIGHT && usage_idx == 0)
else if (usage == WINED3DDECLUSAGE_BLENDWEIGHT && usage_idx == 0)
*regnum = 1;
else if (usage == D3DDECLUSAGE_BLENDINDICES && usage_idx == 0)
else if (usage == WINED3DDECLUSAGE_BLENDINDICES && usage_idx == 0)
*regnum = 2;
else if (usage == D3DDECLUSAGE_NORMAL && usage_idx == 0)
else if (usage == WINED3DDECLUSAGE_NORMAL && usage_idx == 0)
*regnum = 3;
else if (usage == D3DDECLUSAGE_PSIZE && usage_idx == 0)
else if (usage == WINED3DDECLUSAGE_PSIZE && usage_idx == 0)
*regnum = 4;
else if (usage == D3DDECLUSAGE_COLOR && usage_idx == 0)
else if (usage == WINED3DDECLUSAGE_COLOR && usage_idx == 0)
*regnum = 5;
else if (usage == D3DDECLUSAGE_COLOR && usage_idx == 1)
else if (usage == WINED3DDECLUSAGE_COLOR && usage_idx == 1)
*regnum = 6;
else if (usage == D3DDECLUSAGE_TEXCOORD && usage_idx < WINED3DDP_MAXTEXCOORD)
else if (usage == WINED3DDECLUSAGE_TEXCOORD && usage_idx < WINED3DDP_MAXTEXCOORD)
*regnum = 7 + usage_idx;
else if ((usage == D3DDECLUSAGE_POSITION || usage == D3DDECLUSAGE_POSITIONT) && usage_idx == 1)
else if ((usage == WINED3DDECLUSAGE_POSITION || usage == WINED3DDECLUSAGE_POSITIONT) && usage_idx == 1)
*regnum = 7 + WINED3DDP_MAXTEXCOORD;
else if (usage == D3DDECLUSAGE_NORMAL && usage_idx == 1)
else if (usage == WINED3DDECLUSAGE_NORMAL && usage_idx == 1)
*regnum = 8 + WINED3DDP_MAXTEXCOORD;
else if (usage == D3DDECLUSAGE_TANGENT && usage_idx == 0)
else if (usage == WINED3DDECLUSAGE_TANGENT && usage_idx == 0)
*regnum = 9 + WINED3DDP_MAXTEXCOORD;
else if (usage == D3DDECLUSAGE_BINORMAL && usage_idx == 0)
else if (usage == WINED3DDECLUSAGE_BINORMAL && usage_idx == 0)
*regnum = 10 + WINED3DDP_MAXTEXCOORD;
else if (usage == D3DDECLUSAGE_TESSFACTOR && usage_idx == 0)
else if (usage == WINED3DDECLUSAGE_TESSFACTOR && usage_idx == 0)
*regnum = 11 + WINED3DDP_MAXTEXCOORD;
else if (usage == D3DDECLUSAGE_FOG && usage_idx == 0)
else if (usage == WINED3DDECLUSAGE_FOG && usage_idx == 0)
*regnum = 12 + WINED3DDP_MAXTEXCOORD;
else if (usage == D3DDECLUSAGE_DEPTH && usage_idx == 0)
else if (usage == WINED3DDECLUSAGE_DEPTH && usage_idx == 0)
*regnum = 13 + WINED3DDP_MAXTEXCOORD;
else if (usage == D3DDECLUSAGE_SAMPLE && usage_idx == 0)
else if (usage == WINED3DDECLUSAGE_SAMPLE && usage_idx == 0)
*regnum = 14 + WINED3DDP_MAXTEXCOORD;
if (*regnum < 0) {
@ -225,9 +225,9 @@ void primitiveDeclarationConvertToStridedData(
strided->u.input[idx].VBO = streamVBO;
strided->u.input[idx].streamNo = element->Stream;
if (!useVertexShaderFunction) {
if (element->Usage == D3DDECLUSAGE_POSITION)
if (element->Usage == WINED3DDECLUSAGE_POSITION)
strided->u.s.position_transformed = FALSE;
else if (element->Usage == D3DDECLUSAGE_POSITIONT)
else if (element->Usage == WINED3DDECLUSAGE_POSITIONT)
strided->u.s.position_transformed = TRUE;
}
}

View File

@ -1889,7 +1889,7 @@ void pshader_glsl_input_pack(
switch(usage) {
case D3DDECLUSAGE_COLOR:
case WINED3DDECLUSAGE_COLOR:
if (usage_idx == 0)
shader_addline(buffer, "IN%u%s = vec4(gl_Color)%s;\n",
i, reg_mask, reg_mask);
@ -1901,12 +1901,12 @@ void pshader_glsl_input_pack(
i, reg_mask, reg_mask);
break;
case D3DDECLUSAGE_TEXCOORD:
case WINED3DDECLUSAGE_TEXCOORD:
shader_addline(buffer, "IN%u%s = vec4(gl_TexCoord[%u])%s;\n",
i, reg_mask, usage_idx, reg_mask );
break;
case D3DDECLUSAGE_FOG:
case WINED3DDECLUSAGE_FOG:
shader_addline(buffer, "IN%u%s = vec4(gl_FogFragCoord)%s;\n",
i, reg_mask, reg_mask);
break;
@ -1944,7 +1944,7 @@ void vshader_glsl_output_unpack(
switch(usage) {
case D3DDECLUSAGE_COLOR:
case WINED3DDECLUSAGE_COLOR:
if (usage_idx == 0)
shader_addline(buffer, "gl_FrontColor%s = OUT%u%s;\n", reg_mask, i, reg_mask);
else if (usage_idx == 1)
@ -1953,20 +1953,20 @@ void vshader_glsl_output_unpack(
shader_addline(buffer, "unsupported_color_output%s = OUT%u%s;\n", reg_mask, i, reg_mask);
break;
case D3DDECLUSAGE_POSITION:
case WINED3DDECLUSAGE_POSITION:
shader_addline(buffer, "gl_Position%s = OUT%u%s;\n", reg_mask, i, reg_mask);
break;
case D3DDECLUSAGE_TEXCOORD:
case WINED3DDECLUSAGE_TEXCOORD:
shader_addline(buffer, "gl_TexCoord[%u]%s = OUT%u%s;\n",
usage_idx, reg_mask, i, reg_mask);
break;
case D3DDECLUSAGE_PSIZE:
case WINED3DDECLUSAGE_PSIZE:
shader_addline(buffer, "gl_PointSize = OUT%u.x;\n", i);
break;
case D3DDECLUSAGE_FOG:
case WINED3DDECLUSAGE_FOG:
shader_addline(buffer, "gl_FogFragCoord%s = OUT%u%s;\n", reg_mask, i, reg_mask);
break;

View File

@ -317,20 +317,20 @@ const char* debug_d3ddecltype(WINED3DDECLTYPE type) {
const char* debug_d3ddeclusage(BYTE usage) {
switch (usage) {
#define WINED3DDECLUSAGE_TO_STR(u) case u: return #u
WINED3DDECLUSAGE_TO_STR(D3DDECLUSAGE_POSITION);
WINED3DDECLUSAGE_TO_STR(D3DDECLUSAGE_BLENDWEIGHT);
WINED3DDECLUSAGE_TO_STR(D3DDECLUSAGE_BLENDINDICES);
WINED3DDECLUSAGE_TO_STR(D3DDECLUSAGE_NORMAL);
WINED3DDECLUSAGE_TO_STR(D3DDECLUSAGE_PSIZE);
WINED3DDECLUSAGE_TO_STR(D3DDECLUSAGE_TEXCOORD);
WINED3DDECLUSAGE_TO_STR(D3DDECLUSAGE_TANGENT);
WINED3DDECLUSAGE_TO_STR(D3DDECLUSAGE_BINORMAL);
WINED3DDECLUSAGE_TO_STR(D3DDECLUSAGE_TESSFACTOR);
WINED3DDECLUSAGE_TO_STR(D3DDECLUSAGE_POSITIONT);
WINED3DDECLUSAGE_TO_STR(D3DDECLUSAGE_COLOR);
WINED3DDECLUSAGE_TO_STR(D3DDECLUSAGE_FOG);
WINED3DDECLUSAGE_TO_STR(D3DDECLUSAGE_DEPTH);
WINED3DDECLUSAGE_TO_STR(D3DDECLUSAGE_SAMPLE);
WINED3DDECLUSAGE_TO_STR(WINED3DDECLUSAGE_POSITION);
WINED3DDECLUSAGE_TO_STR(WINED3DDECLUSAGE_BLENDWEIGHT);
WINED3DDECLUSAGE_TO_STR(WINED3DDECLUSAGE_BLENDINDICES);
WINED3DDECLUSAGE_TO_STR(WINED3DDECLUSAGE_NORMAL);
WINED3DDECLUSAGE_TO_STR(WINED3DDECLUSAGE_PSIZE);
WINED3DDECLUSAGE_TO_STR(WINED3DDECLUSAGE_TEXCOORD);
WINED3DDECLUSAGE_TO_STR(WINED3DDECLUSAGE_TANGENT);
WINED3DDECLUSAGE_TO_STR(WINED3DDECLUSAGE_BINORMAL);
WINED3DDECLUSAGE_TO_STR(WINED3DDECLUSAGE_TESSFACTOR);
WINED3DDECLUSAGE_TO_STR(WINED3DDECLUSAGE_POSITIONT);
WINED3DDECLUSAGE_TO_STR(WINED3DDECLUSAGE_COLOR);
WINED3DDECLUSAGE_TO_STR(WINED3DDECLUSAGE_FOG);
WINED3DDECLUSAGE_TO_STR(WINED3DDECLUSAGE_DEPTH);
WINED3DDECLUSAGE_TO_STR(WINED3DDECLUSAGE_SAMPLE);
#undef WINED3DDECLUSAGE_TO_STR
default:
FIXME("Unrecognized %u declaration usage!\n", usage);

View File

@ -263,23 +263,23 @@ IWineD3DVertexDeclarationImpl *This = (IWineD3DVertexDeclarationImpl *)iface;
WINED3DVERTEXELEMENT convToW[128];
/* TODO: find out where rhw (or positionT) is for declaration8 */
Decl8to9Lookup decl8to9Lookup[MAX_D3DVSDE];
MAKE_LOOKUP(D3DVSDE_POSITION, D3DDECLUSAGE_POSITION, 0);
MAKE_LOOKUP(D3DVSDE_POSITION2, D3DDECLUSAGE_POSITION, 1);
MAKE_LOOKUP(D3DVSDE_BLENDWEIGHT, D3DDECLUSAGE_BLENDWEIGHT, 0);
MAKE_LOOKUP(D3DVSDE_BLENDINDICES, D3DDECLUSAGE_BLENDINDICES, 0);
MAKE_LOOKUP(D3DVSDE_NORMAL, D3DDECLUSAGE_NORMAL, 0);
MAKE_LOOKUP(D3DVSDE_NORMAL2, D3DDECLUSAGE_NORMAL, 1);
MAKE_LOOKUP(D3DVSDE_DIFFUSE, D3DDECLUSAGE_COLOR, 0);
MAKE_LOOKUP(D3DVSDE_SPECULAR, D3DDECLUSAGE_COLOR, 1);
MAKE_LOOKUP(D3DVSDE_TEXCOORD0, D3DDECLUSAGE_TEXCOORD, 0);
MAKE_LOOKUP(D3DVSDE_TEXCOORD1, D3DDECLUSAGE_TEXCOORD, 1);
MAKE_LOOKUP(D3DVSDE_TEXCOORD2, D3DDECLUSAGE_TEXCOORD, 2);
MAKE_LOOKUP(D3DVSDE_TEXCOORD3, D3DDECLUSAGE_TEXCOORD, 3);
MAKE_LOOKUP(D3DVSDE_TEXCOORD4, D3DDECLUSAGE_TEXCOORD, 4);
MAKE_LOOKUP(D3DVSDE_TEXCOORD5, D3DDECLUSAGE_TEXCOORD, 5);
MAKE_LOOKUP(D3DVSDE_TEXCOORD6, D3DDECLUSAGE_TEXCOORD, 6);
MAKE_LOOKUP(D3DVSDE_TEXCOORD7, D3DDECLUSAGE_TEXCOORD, 7);
MAKE_LOOKUP(D3DVSDE_PSIZE, D3DDECLUSAGE_PSIZE, 0);
MAKE_LOOKUP(D3DVSDE_POSITION, WINED3DDECLUSAGE_POSITION, 0);
MAKE_LOOKUP(D3DVSDE_POSITION2, WINED3DDECLUSAGE_POSITION, 1);
MAKE_LOOKUP(D3DVSDE_BLENDWEIGHT, WINED3DDECLUSAGE_BLENDWEIGHT, 0);
MAKE_LOOKUP(D3DVSDE_BLENDINDICES, WINED3DDECLUSAGE_BLENDINDICES, 0);
MAKE_LOOKUP(D3DVSDE_NORMAL, WINED3DDECLUSAGE_NORMAL, 0);
MAKE_LOOKUP(D3DVSDE_NORMAL2, WINED3DDECLUSAGE_NORMAL, 1);
MAKE_LOOKUP(D3DVSDE_DIFFUSE, WINED3DDECLUSAGE_COLOR, 0);
MAKE_LOOKUP(D3DVSDE_SPECULAR, WINED3DDECLUSAGE_COLOR, 1);
MAKE_LOOKUP(D3DVSDE_TEXCOORD0, WINED3DDECLUSAGE_TEXCOORD, 0);
MAKE_LOOKUP(D3DVSDE_TEXCOORD1, WINED3DDECLUSAGE_TEXCOORD, 1);
MAKE_LOOKUP(D3DVSDE_TEXCOORD2, WINED3DDECLUSAGE_TEXCOORD, 2);
MAKE_LOOKUP(D3DVSDE_TEXCOORD3, WINED3DDECLUSAGE_TEXCOORD, 3);
MAKE_LOOKUP(D3DVSDE_TEXCOORD4, WINED3DDECLUSAGE_TEXCOORD, 4);
MAKE_LOOKUP(D3DVSDE_TEXCOORD5, WINED3DDECLUSAGE_TEXCOORD, 5);
MAKE_LOOKUP(D3DVSDE_TEXCOORD6, WINED3DDECLUSAGE_TEXCOORD, 6);
MAKE_LOOKUP(D3DVSDE_TEXCOORD7, WINED3DDECLUSAGE_TEXCOORD, 7);
MAKE_LOOKUP(D3DVSDE_PSIZE, WINED3DDECLUSAGE_PSIZE, 0);
#undef MAKE_LOOKUP
TRACE("(%p) : pDecl(%p)\n", This, pDecl);

View File

@ -1310,6 +1310,23 @@ typedef struct _WINEDDOVERLAYFX
DWORD dwFlags; /* flags */
} WINEDDOVERLAYFX;
typedef enum {
WINED3DDECLUSAGE_POSITION = 0,
WINED3DDECLUSAGE_BLENDWEIGHT = 1,
WINED3DDECLUSAGE_BLENDINDICES = 2,
WINED3DDECLUSAGE_NORMAL = 3,
WINED3DDECLUSAGE_PSIZE = 4,
WINED3DDECLUSAGE_TEXCOORD = 5,
WINED3DDECLUSAGE_TANGENT = 6,
WINED3DDECLUSAGE_BINORMAL = 7,
WINED3DDECLUSAGE_TESSFACTOR = 8,
WINED3DDECLUSAGE_POSITIONT = 9,
WINED3DDECLUSAGE_COLOR = 10,
WINED3DDECLUSAGE_FOG = 11,
WINED3DDECLUSAGE_DEPTH = 12,
WINED3DDECLUSAGE_SAMPLE = 13
} WINED3DDECLUSAGE;
#define WINED3DUSAGE_RENDERTARGET 0x00000001L
#define WINED3DUSAGE_DEPTHSTENCIL 0x00000002L
#define WINED3DUSAGE_WRITEONLY 0x00000008L