wined3d: Get rid of the WINED3DDECLUSAGE typedef.

This commit is contained in:
Henri Verbeet 2012-01-18 21:46:22 +01:00 committed by Alexandre Julliard
parent c35c30fa68
commit bee9adbd05
9 changed files with 175 additions and 159 deletions

View File

@ -281,24 +281,25 @@ typedef struct {
BYTE usage_idx;
} wined3d_usage_t;
static const wined3d_usage_t wined3d_usage_lookup[] = {
/*D3DVSDE_POSITION*/ {WINED3DDECLUSAGE_POSITION, 0},
/*D3DVSDE_BLENDWEIGHT*/ {WINED3DDECLUSAGE_BLENDWEIGHT, 0},
/*D3DVSDE_BLENDINDICES*/ {WINED3DDECLUSAGE_BLENDINDICES, 0},
/*D3DVSDE_NORMAL*/ {WINED3DDECLUSAGE_NORMAL, 0},
/*D3DVSDE_PSIZE*/ {WINED3DDECLUSAGE_PSIZE, 0},
/*D3DVSDE_DIFFUSE*/ {WINED3DDECLUSAGE_COLOR, 0},
/*D3DVSDE_SPECULAR*/ {WINED3DDECLUSAGE_COLOR, 1},
/*D3DVSDE_TEXCOORD0*/ {WINED3DDECLUSAGE_TEXCOORD, 0},
/*D3DVSDE_TEXCOORD1*/ {WINED3DDECLUSAGE_TEXCOORD, 1},
/*D3DVSDE_TEXCOORD2*/ {WINED3DDECLUSAGE_TEXCOORD, 2},
/*D3DVSDE_TEXCOORD3*/ {WINED3DDECLUSAGE_TEXCOORD, 3},
/*D3DVSDE_TEXCOORD4*/ {WINED3DDECLUSAGE_TEXCOORD, 4},
/*D3DVSDE_TEXCOORD5*/ {WINED3DDECLUSAGE_TEXCOORD, 5},
/*D3DVSDE_TEXCOORD6*/ {WINED3DDECLUSAGE_TEXCOORD, 6},
/*D3DVSDE_TEXCOORD7*/ {WINED3DDECLUSAGE_TEXCOORD, 7},
/*D3DVSDE_POSITION2*/ {WINED3DDECLUSAGE_POSITION, 1},
/*D3DVSDE_NORMAL2*/ {WINED3DDECLUSAGE_NORMAL, 1},
static const wined3d_usage_t wined3d_usage_lookup[] =
{
/* D3DVSDE_POSITION */ {WINED3D_DECL_USAGE_POSITION, 0},
/* D3DVSDE_BLENDWEIGHT */ {WINED3D_DECL_USAGE_BLEND_WEIGHT, 0},
/* D3DVSDE_BLENDINDICES */ {WINED3D_DECL_USAGE_BLEND_INDICES, 0},
/* D3DVSDE_NORMAL */ {WINED3D_DECL_USAGE_NORMAL, 0},
/* D3DVSDE_PSIZE */ {WINED3D_DECL_USAGE_PSIZE, 0},
/* D3DVSDE_DIFFUSE */ {WINED3D_DECL_USAGE_COLOR, 0},
/* D3DVSDE_SPECULAR */ {WINED3D_DECL_USAGE_COLOR, 1},
/* D3DVSDE_TEXCOORD0 */ {WINED3D_DECL_USAGE_TEXCOORD, 0},
/* D3DVSDE_TEXCOORD1 */ {WINED3D_DECL_USAGE_TEXCOORD, 1},
/* D3DVSDE_TEXCOORD2 */ {WINED3D_DECL_USAGE_TEXCOORD, 2},
/* D3DVSDE_TEXCOORD3 */ {WINED3D_DECL_USAGE_TEXCOORD, 3},
/* D3DVSDE_TEXCOORD4 */ {WINED3D_DECL_USAGE_TEXCOORD, 4},
/* D3DVSDE_TEXCOORD5 */ {WINED3D_DECL_USAGE_TEXCOORD, 5},
/* D3DVSDE_TEXCOORD6 */ {WINED3D_DECL_USAGE_TEXCOORD, 6},
/* D3DVSDE_TEXCOORD7 */ {WINED3D_DECL_USAGE_TEXCOORD, 7},
/* D3DVSDE_POSITION2 */ {WINED3D_DECL_USAGE_POSITION, 1},
/* D3DVSDE_NORMAL2 */ {WINED3D_DECL_USAGE_NORMAL, 1},
};
/* TODO: find out where rhw (or positionT) is for declaration8 */

View File

@ -3474,7 +3474,7 @@ static void init_ps_input(const struct wined3d_shader *shader,
semantic_idx = sig[i].semantic_idx;
if (!semantic_name) continue;
if(shader_match_semantic(semantic_name, WINED3DDECLUSAGE_COLOR))
if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_COLOR))
{
if (!semantic_idx) priv->ps_input[i] = "fragment.color.primary";
else if(semantic_idx == 1) priv->ps_input[i] = "fragment.color.secondary";
@ -3484,12 +3484,12 @@ static void init_ps_input(const struct wined3d_shader *shader,
{
priv->ps_input[i] = "0.0";
}
else if(shader_match_semantic(semantic_name, WINED3DDECLUSAGE_TEXCOORD))
else if(shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_TEXCOORD))
{
if(semantic_idx < 8) priv->ps_input[i] = texcoords[semantic_idx];
else priv->ps_input[i] = "0.0";
}
else if(shader_match_semantic(semantic_name, WINED3DDECLUSAGE_FOG))
else if(shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_FOG))
{
if (!semantic_idx) priv->ps_input[i] = "fragment.fogcoord";
else priv->ps_input[i] = "0.0";
@ -3970,19 +3970,19 @@ static void init_output_registers(const struct wined3d_shader *shader, DWORD sig
semantic_name = shader->output_signature[i].semantic_name;
if (!semantic_name) continue;
if(shader_match_semantic(semantic_name, WINED3DDECLUSAGE_POSITION))
if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_POSITION))
{
TRACE("o%u is TMP_OUT\n", i);
if (!shader->output_signature[i].semantic_idx) priv_ctx->vs_output[i] = "TMP_OUT";
else priv_ctx->vs_output[i] = "TA";
}
else if(shader_match_semantic(semantic_name, WINED3DDECLUSAGE_PSIZE))
else if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_PSIZE))
{
TRACE("o%u is result.pointsize\n", i);
if (!shader->output_signature[i].semantic_idx) priv_ctx->vs_output[i] = "result.pointsize";
else priv_ctx->vs_output[i] = "TA";
}
else if(shader_match_semantic(semantic_name, WINED3DDECLUSAGE_COLOR))
else if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_COLOR))
{
TRACE("o%u is result.color.?, idx %u\n", i, shader->output_signature[i].semantic_idx);
if (!shader->output_signature[i].semantic_idx)
@ -3991,13 +3991,13 @@ static void init_output_registers(const struct wined3d_shader *shader, DWORD sig
priv_ctx->vs_output[i] = "result.color.secondary";
else priv_ctx->vs_output[i] = "TA";
}
else if(shader_match_semantic(semantic_name, WINED3DDECLUSAGE_TEXCOORD))
else if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_TEXCOORD))
{
TRACE("o%u is %s\n", i, texcoords[shader->output_signature[i].semantic_idx]);
if (shader->output_signature[i].semantic_idx >= 8) priv_ctx->vs_output[i] = "TA";
else priv_ctx->vs_output[i] = texcoords[shader->output_signature[i].semantic_idx];
}
else if(shader_match_semantic(semantic_name, WINED3DDECLUSAGE_FOG))
else if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_FOG))
{
TRACE("o%u is result.fogcoord\n", i);
if (shader->output_signature[i].semantic_idx > 0) priv_ctx->vs_output[i] = "TA";
@ -4039,17 +4039,20 @@ static void init_output_registers(const struct wined3d_shader *shader, DWORD sig
* Don't care about POSITION and PSIZE here - this is a builtin vertex shader, position goes
* to TMP_OUT in any case
*/
if(shader_match_semantic(semantic_name, WINED3DDECLUSAGE_TEXCOORD))
if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_TEXCOORD))
{
if(semantic_idx < 8) priv_ctx->texcrd_output[semantic_idx] = decl_idx_to_string[reg_idx];
if (semantic_idx < 8)
priv_ctx->texcrd_output[semantic_idx] = decl_idx_to_string[reg_idx];
}
else if(shader_match_semantic(semantic_name, WINED3DDECLUSAGE_COLOR))
else if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_COLOR))
{
if(semantic_idx < 2) priv_ctx->color_output[semantic_idx] = decl_idx_to_string[reg_idx];
if (semantic_idx < 2)
priv_ctx->color_output[semantic_idx] = decl_idx_to_string[reg_idx];
}
else if(shader_match_semantic(semantic_name, WINED3DDECLUSAGE_FOG))
else if(shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_FOG))
{
if (!semantic_idx) priv_ctx->fog_output = decl_idx_to_string[reg_idx];
if (!semantic_idx)
priv_ctx->fog_output = decl_idx_to_string[reg_idx];
}
else
{
@ -4071,13 +4074,13 @@ static void init_output_registers(const struct wined3d_shader *shader, DWORD sig
semantic_name = shader->output_signature[i].semantic_name;
if (!semantic_name) continue;
if (shader_match_semantic(semantic_name, WINED3DDECLUSAGE_POSITION)
if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_POSITION)
&& !shader->output_signature[i].semantic_idx)
{
priv_ctx->vs_output[i] = "TMP_OUT";
continue;
}
else if (shader_match_semantic(semantic_name, WINED3DDECLUSAGE_PSIZE)
else if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_PSIZE)
&& !shader->output_signature[i].semantic_idx)
{
priv_ctx->vs_output[i] = "result.pointsize";

View File

@ -144,21 +144,21 @@ static enum wined3d_primitive_type d3d_primitive_type_from_gl(GLenum primitive_t
static BOOL fixed_get_input(BYTE usage, BYTE usage_idx, unsigned int *regnum)
{
if ((usage == WINED3DDECLUSAGE_POSITION || usage == WINED3DDECLUSAGE_POSITIONT) && !usage_idx)
if ((usage == WINED3D_DECL_USAGE_POSITION || usage == WINED3D_DECL_USAGE_POSITIONT) && !usage_idx)
*regnum = WINED3D_FFP_POSITION;
else if (usage == WINED3DDECLUSAGE_BLENDWEIGHT && !usage_idx)
else if (usage == WINED3D_DECL_USAGE_BLEND_WEIGHT && !usage_idx)
*regnum = WINED3D_FFP_BLENDWEIGHT;
else if (usage == WINED3DDECLUSAGE_BLENDINDICES && !usage_idx)
else if (usage == WINED3D_DECL_USAGE_BLEND_INDICES && !usage_idx)
*regnum = WINED3D_FFP_BLENDINDICES;
else if (usage == WINED3DDECLUSAGE_NORMAL && !usage_idx)
else if (usage == WINED3D_DECL_USAGE_NORMAL && !usage_idx)
*regnum = WINED3D_FFP_NORMAL;
else if (usage == WINED3DDECLUSAGE_PSIZE && !usage_idx)
else if (usage == WINED3D_DECL_USAGE_PSIZE && !usage_idx)
*regnum = WINED3D_FFP_PSIZE;
else if (usage == WINED3DDECLUSAGE_COLOR && !usage_idx)
else if (usage == WINED3D_DECL_USAGE_COLOR && !usage_idx)
*regnum = WINED3D_FFP_DIFFUSE;
else if (usage == WINED3DDECLUSAGE_COLOR && usage_idx == 1)
else if (usage == WINED3D_DECL_USAGE_COLOR && usage_idx == 1)
*regnum = WINED3D_FFP_SPECULAR;
else if (usage == WINED3DDECLUSAGE_TEXCOORD && usage_idx < WINED3DDP_MAXTEXCOORD)
else if (usage == WINED3D_DECL_USAGE_TEXCOORD && usage_idx < WINED3DDP_MAXTEXCOORD)
*regnum = WINED3D_FFP_TEXCOORD0 + usage_idx;
else
{
@ -240,8 +240,8 @@ void device_stream_info_from_declaration(struct wined3d_device *device,
if (data.buffer_object)
*fixup = TRUE;
else if (*fixup && !use_vshader
&& (element->usage == WINED3DDECLUSAGE_COLOR
|| element->usage == WINED3DDECLUSAGE_POSITIONT))
&& (element->usage == WINED3D_DECL_USAGE_COLOR
|| element->usage == WINED3D_DECL_USAGE_POSITIONT))
{
static BOOL warned = FALSE;
if (!warned)

View File

@ -3685,7 +3685,7 @@ static void shader_glsl_input_pack(const struct wined3d_shader *shader, struct w
semantic_idx = input_signature[i].semantic_idx;
shader_glsl_write_mask_to_str(input_signature[i].mask, reg_mask);
if (shader_match_semantic(semantic_name, WINED3DDECLUSAGE_TEXCOORD))
if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_TEXCOORD))
{
if (semantic_idx < 8 && vertexprocessing == pretransformed)
shader_addline(buffer, "IN[%u]%s = gl_TexCoord[%u]%s;\n",
@ -3694,7 +3694,7 @@ static void shader_glsl_input_pack(const struct wined3d_shader *shader, struct w
shader_addline(buffer, "IN[%u]%s = vec4(0.0, 0.0, 0.0, 0.0)%s;\n",
shader->u.ps.input_reg_map[i], reg_mask, reg_mask);
}
else if (shader_match_semantic(semantic_name, WINED3DDECLUSAGE_COLOR))
else if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_COLOR))
{
if (!semantic_idx)
shader_addline(buffer, "IN[%u]%s = vec4(gl_Color)%s;\n",
@ -3893,7 +3893,7 @@ static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer
write_mask = output_signature[i].mask;
shader_glsl_write_mask_to_str(write_mask, reg_mask);
if (shader_match_semantic(semantic_name, WINED3DDECLUSAGE_COLOR))
if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_COLOR))
{
if (!semantic_idx)
shader_addline(buffer, "gl_FrontColor%s = OUT[%u]%s;\n",
@ -3902,12 +3902,12 @@ static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer
shader_addline(buffer, "gl_FrontSecondaryColor%s = OUT[%u]%s;\n",
reg_mask, i, reg_mask);
}
else if (shader_match_semantic(semantic_name, WINED3DDECLUSAGE_POSITION))
else if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_POSITION))
{
shader_addline(buffer, "gl_Position%s = OUT[%u]%s;\n",
reg_mask, i, reg_mask);
}
else if (shader_match_semantic(semantic_name, WINED3DDECLUSAGE_TEXCOORD))
else if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_TEXCOORD))
{
if (semantic_idx < 8)
{
@ -3920,11 +3920,11 @@ static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer
shader_addline(buffer, "gl_TexCoord[%u].w = 1.0;\n", semantic_idx);
}
}
else if (shader_match_semantic(semantic_name, WINED3DDECLUSAGE_PSIZE))
else if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_PSIZE))
{
shader_addline(buffer, "gl_PointSize = OUT[%u].%c;\n", i, reg_mask[1]);
}
else if (shader_match_semantic(semantic_name, WINED3DDECLUSAGE_FOG))
else if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_FOG))
{
shader_addline(buffer, "gl_FogFragCoord = OUT[%u].%c;\n", i, reg_mask[1]);
}
@ -3947,12 +3947,12 @@ static GLhandleARB generate_param_reorder_function(struct wined3d_shader_buffer
semantic_name = output_signature[i].semantic_name;
shader_glsl_write_mask_to_str(output_signature[i].mask, reg_mask);
if (shader_match_semantic(semantic_name, WINED3DDECLUSAGE_POSITION))
if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_POSITION))
{
shader_addline(buffer, "gl_Position%s = OUT[%u]%s;\n",
reg_mask, i, reg_mask);
}
else if (shader_match_semantic(semantic_name, WINED3DDECLUSAGE_PSIZE))
else if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_PSIZE))
{
shader_addline(buffer, "gl_PointSize = OUT[%u].%c;\n", i, reg_mask[1]);
}

View File

@ -146,23 +146,23 @@ static const char * const shader_opcode_names[] =
static const char * const semantic_names[] =
{
/* WINED3DDECLUSAGE_POSITION */ "SV_POSITION",
/* WINED3DDECLUSAGE_BLENDWEIGHT */ "BLENDWEIGHT",
/* WINED3DDECLUSAGE_BLENDINDICES */ "BLENDINDICES",
/* WINED3DDECLUSAGE_NORMAL */ "NORMAL",
/* WINED3DDECLUSAGE_PSIZE */ "PSIZE",
/* WINED3DDECLUSAGE_TEXCOORD */ "TEXCOORD",
/* WINED3DDECLUSAGE_TANGENT */ "TANGENT",
/* WINED3DDECLUSAGE_BINORMAL */ "BINORMAL",
/* WINED3DDECLUSAGE_TESSFACTOR */ "TESSFACTOR",
/* WINED3DDECLUSAGE_POSITIONT */ "POSITIONT",
/* WINED3DDECLUSAGE_COLOR */ "COLOR",
/* WINED3DDECLUSAGE_FOG */ "FOG",
/* WINED3DDECLUSAGE_DEPTH */ "DEPTH",
/* WINED3DDECLUSAGE_SAMPLE */ "SAMPLE",
/* WINED3D_DECL_USAGE_POSITION */ "SV_POSITION",
/* WINED3D_DECL_USAGE_BLEND_WEIGHT */ "BLENDWEIGHT",
/* WINED3D_DECL_USAGE_BLEND_INDICES */ "BLENDINDICES",
/* WINED3D_DECL_USAGE_NORMAL */ "NORMAL",
/* WINED3D_DECL_USAGE_PSIZE */ "PSIZE",
/* WINED3D_DECL_USAGE_TEXCOORD */ "TEXCOORD",
/* WINED3D_DECL_USAGE_TANGENT */ "TANGENT",
/* WINED3D_DECL_USAGE_BINORMAL */ "BINORMAL",
/* WINED3D_DECL_USAGE_TESS_FACTOR */ "TESSFACTOR",
/* WINED3D_DECL_USAGE_POSITIONT */ "POSITIONT",
/* WINED3D_DECL_USAGE_COLOR */ "COLOR",
/* WINED3D_DECL_USAGE_FOG */ "FOG",
/* WINED3D_DECL_USAGE_DEPTH */ "DEPTH",
/* WINED3D_DECL_USAGE_SAMPLE */ "SAMPLE",
};
static const char *shader_semantic_name_from_usage(WINED3DDECLUSAGE usage)
static const char *shader_semantic_name_from_usage(enum wined3d_decl_usage usage)
{
if (usage >= sizeof(semantic_names) / sizeof(*semantic_names))
{
@ -173,7 +173,7 @@ static const char *shader_semantic_name_from_usage(WINED3DDECLUSAGE usage)
return semantic_names[usage];
}
static WINED3DDECLUSAGE shader_usage_from_semantic_name(const char *name)
static enum wined3d_decl_usage shader_usage_from_semantic_name(const char *name)
{
unsigned int i;
@ -185,7 +185,7 @@ static WINED3DDECLUSAGE shader_usage_from_semantic_name(const char *name)
return ~0U;
}
BOOL shader_match_semantic(const char *semantic_name, WINED3DDECLUSAGE usage)
BOOL shader_match_semantic(const char *semantic_name, enum wined3d_decl_usage usage)
{
return !strcmp(semantic_name, shader_semantic_name_from_usage(usage));
}
@ -202,7 +202,7 @@ static void shader_signature_from_semantic(struct wined3d_shader_signature_eleme
}
static void shader_signature_from_usage(struct wined3d_shader_signature_element *e,
WINED3DDECLUSAGE usage, UINT usage_idx, UINT reg_idx, DWORD write_mask)
enum wined3d_decl_usage usage, UINT usage_idx, UINT reg_idx, DWORD write_mask)
{
e->semantic_name = shader_semantic_name_from_usage(usage);
e->semantic_idx = usage_idx;
@ -518,7 +518,8 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
case WINED3DSPR_OUTPUT:
reg_maps->output_registers |= 1 << semantic.reg.reg.idx;
shader_signature_from_semantic(&output_signature[semantic.reg.reg.idx], &semantic);
if (semantic.usage == WINED3DDECLUSAGE_FOG) reg_maps->fog = 1;
if (semantic.usage == WINED3D_DECL_USAGE_FOG)
reg_maps->fog = 1;
break;
/* Save sampler usage token. */
@ -639,19 +640,19 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
case 0: /* oPos */
reg_maps->output_registers |= 1 << 10;
shader_signature_from_usage(&output_signature[10],
WINED3DDECLUSAGE_POSITION, 0, 10, WINED3DSP_WRITEMASK_ALL);
WINED3D_DECL_USAGE_POSITION, 0, 10, WINED3DSP_WRITEMASK_ALL);
break;
case 1: /* oFog */
reg_maps->output_registers |= 1 << 11;
shader_signature_from_usage(&output_signature[11],
WINED3DDECLUSAGE_FOG, 0, 11, WINED3DSP_WRITEMASK_0);
WINED3D_DECL_USAGE_FOG, 0, 11, WINED3DSP_WRITEMASK_0);
break;
case 2: /* oPts */
reg_maps->output_registers |= 1 << 11;
shader_signature_from_usage(&output_signature[11],
WINED3DDECLUSAGE_PSIZE, 0, 11, WINED3DSP_WRITEMASK_1);
WINED3D_DECL_USAGE_PSIZE, 0, 11, WINED3DSP_WRITEMASK_1);
break;
}
break;
@ -668,7 +669,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
{
reg_maps->output_registers |= 1 << idx;
shader_signature_from_usage(&output_signature[idx],
WINED3DDECLUSAGE_COLOR, idx - 8, idx, dst_param.write_mask);
WINED3D_DECL_USAGE_COLOR, idx - 8, idx, dst_param.write_mask);
}
}
break;
@ -684,7 +685,7 @@ static HRESULT shader_get_registers_used(struct wined3d_shader *shader, const st
{
reg_maps->output_registers |= 1 << idx;
shader_signature_from_usage(&output_signature[idx],
WINED3DDECLUSAGE_TEXCOORD, idx, idx, dst_param.write_mask);
WINED3D_DECL_USAGE_TEXCOORD, idx, idx, dst_param.write_mask);
}
break;
@ -852,60 +853,60 @@ static void shader_dump_decl_usage(const struct wined3d_shader_semantic *semanti
switch (semantic->usage)
{
case WINED3DDECLUSAGE_POSITION:
case WINED3D_DECL_USAGE_POSITION:
TRACE("position%u", semantic->usage_idx);
break;
case WINED3DDECLUSAGE_BLENDINDICES:
case WINED3D_DECL_USAGE_BLEND_INDICES:
TRACE("blend");
break;
case WINED3DDECLUSAGE_BLENDWEIGHT:
case WINED3D_DECL_USAGE_BLEND_WEIGHT:
TRACE("weight");
break;
case WINED3DDECLUSAGE_NORMAL:
case WINED3D_DECL_USAGE_NORMAL:
TRACE("normal%u", semantic->usage_idx);
break;
case WINED3DDECLUSAGE_PSIZE:
case WINED3D_DECL_USAGE_PSIZE:
TRACE("psize");
break;
case WINED3DDECLUSAGE_COLOR:
case WINED3D_DECL_USAGE_COLOR:
if (!semantic->usage_idx) TRACE("color");
else TRACE("specular%u", (semantic->usage_idx - 1));
break;
case WINED3DDECLUSAGE_TEXCOORD:
case WINED3D_DECL_USAGE_TEXCOORD:
TRACE("texture%u", semantic->usage_idx);
break;
case WINED3DDECLUSAGE_TANGENT:
case WINED3D_DECL_USAGE_TANGENT:
TRACE("tangent");
break;
case WINED3DDECLUSAGE_BINORMAL:
case WINED3D_DECL_USAGE_BINORMAL:
TRACE("binormal");
break;
case WINED3DDECLUSAGE_TESSFACTOR:
case WINED3D_DECL_USAGE_TESS_FACTOR:
TRACE("tessfactor");
break;
case WINED3DDECLUSAGE_POSITIONT:
case WINED3D_DECL_USAGE_POSITIONT:
TRACE("positionT%u", semantic->usage_idx);
break;
case WINED3DDECLUSAGE_FOG:
case WINED3D_DECL_USAGE_FOG:
TRACE("fog");
break;
case WINED3DDECLUSAGE_DEPTH:
case WINED3D_DECL_USAGE_DEPTH:
TRACE("depth");
break;
case WINED3DDECLUSAGE_SAMPLE:
case WINED3D_DECL_USAGE_SAMPLE:
TRACE("sample");
break;
@ -1718,10 +1719,14 @@ void find_vs_compile_args(const struct wined3d_state *state,
static BOOL match_usage(BYTE usage1, BYTE usage_idx1, BYTE usage2, BYTE usage_idx2)
{
if (usage_idx1 != usage_idx2) return FALSE;
if (usage1 == usage2) return TRUE;
if (usage1 == WINED3DDECLUSAGE_POSITION && usage2 == WINED3DDECLUSAGE_POSITIONT) return TRUE;
if (usage2 == WINED3DDECLUSAGE_POSITION && usage1 == WINED3DDECLUSAGE_POSITIONT) return TRUE;
if (usage_idx1 != usage_idx2)
return FALSE;
if (usage1 == usage2)
return TRUE;
if (usage1 == WINED3D_DECL_USAGE_POSITION && usage2 == WINED3D_DECL_USAGE_POSITIONT)
return TRUE;
if (usage2 == WINED3D_DECL_USAGE_POSITION && usage1 == WINED3D_DECL_USAGE_POSITIONT)
return TRUE;
return FALSE;
}
@ -1927,7 +1932,7 @@ void find_ps_compile_args(const struct wined3d_state *state,
struct wined3d_vertex_declaration_element *element =
&state->vertex_declaration->elements[j];
if (element->usage == WINED3DDECLUSAGE_TEXCOORD
if (element->usage == WINED3D_DECL_USAGE_TEXCOORD
&& element->usage_idx == index)
{
max_valid = element->format->component_count;

View File

@ -1953,23 +1953,25 @@ const char *debug_d3ddeclmethod(enum wined3d_decl_method method)
}
}
const char* debug_d3ddeclusage(BYTE usage) {
switch (usage) {
const char *debug_d3ddeclusage(enum wined3d_decl_usage usage)
{
switch (usage)
{
#define WINED3DDECLUSAGE_TO_STR(u) case u: return #u
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);
WINED3DDECLUSAGE_TO_STR(WINED3D_DECL_USAGE_POSITION);
WINED3DDECLUSAGE_TO_STR(WINED3D_DECL_USAGE_BLEND_WEIGHT);
WINED3DDECLUSAGE_TO_STR(WINED3D_DECL_USAGE_BLEND_INDICES);
WINED3DDECLUSAGE_TO_STR(WINED3D_DECL_USAGE_NORMAL);
WINED3DDECLUSAGE_TO_STR(WINED3D_DECL_USAGE_PSIZE);
WINED3DDECLUSAGE_TO_STR(WINED3D_DECL_USAGE_TEXCOORD);
WINED3DDECLUSAGE_TO_STR(WINED3D_DECL_USAGE_TANGENT);
WINED3DDECLUSAGE_TO_STR(WINED3D_DECL_USAGE_BINORMAL);
WINED3DDECLUSAGE_TO_STR(WINED3D_DECL_USAGE_TESS_FACTOR);
WINED3DDECLUSAGE_TO_STR(WINED3D_DECL_USAGE_POSITIONT);
WINED3DDECLUSAGE_TO_STR(WINED3D_DECL_USAGE_COLOR);
WINED3DDECLUSAGE_TO_STR(WINED3D_DECL_USAGE_FOG);
WINED3DDECLUSAGE_TO_STR(WINED3D_DECL_USAGE_DEPTH);
WINED3DDECLUSAGE_TO_STR(WINED3D_DECL_USAGE_SAMPLE);
#undef WINED3DDECLUSAGE_TO_STR
default:
FIXME("Unrecognized %u declaration usage!\n", usage);

View File

@ -74,8 +74,8 @@ static BOOL declaration_element_valid_ffp(const struct wined3d_vertex_element *e
{
switch(element->usage)
{
case WINED3DDECLUSAGE_POSITION:
case WINED3DDECLUSAGE_POSITIONT:
case WINED3D_DECL_USAGE_POSITION:
case WINED3D_DECL_USAGE_POSITIONT:
switch(element->format)
{
case WINED3DFMT_R32G32_FLOAT:
@ -90,7 +90,7 @@ static BOOL declaration_element_valid_ffp(const struct wined3d_vertex_element *e
return FALSE;
}
case WINED3DDECLUSAGE_BLENDWEIGHT:
case WINED3D_DECL_USAGE_BLEND_WEIGHT:
switch(element->format)
{
case WINED3DFMT_R32_FLOAT:
@ -108,7 +108,7 @@ static BOOL declaration_element_valid_ffp(const struct wined3d_vertex_element *e
return FALSE;
}
case WINED3DDECLUSAGE_NORMAL:
case WINED3D_DECL_USAGE_NORMAL:
switch(element->format)
{
case WINED3DFMT_R32G32B32_FLOAT:
@ -120,7 +120,7 @@ static BOOL declaration_element_valid_ffp(const struct wined3d_vertex_element *e
return FALSE;
}
case WINED3DDECLUSAGE_TEXCOORD:
case WINED3D_DECL_USAGE_TEXCOORD:
switch(element->format)
{
case WINED3DFMT_R32_FLOAT:
@ -136,7 +136,7 @@ static BOOL declaration_element_valid_ffp(const struct wined3d_vertex_element *e
return FALSE;
}
case WINED3DDECLUSAGE_COLOR:
case WINED3D_DECL_USAGE_COLOR:
switch(element->format)
{
case WINED3DFMT_R32G32B32_FLOAT:
@ -201,7 +201,8 @@ static HRESULT vertexdeclaration_init(struct wined3d_vertex_declaration *declara
e->usage = elements[i].usage;
e->usage_idx = elements[i].usage_idx;
if (e->usage == WINED3DDECLUSAGE_POSITIONT) declaration->position_transformed = TRUE;
if (e->usage == WINED3D_DECL_USAGE_POSITIONT)
declaration->position_transformed = TRUE;
/* Find the streams used in the declaration. The vertex buffers have
* to be loaded when drawing, but filter tesselation pseudo streams. */
@ -278,7 +279,7 @@ struct wined3d_fvf_convert_state
};
static void append_decl_element(struct wined3d_fvf_convert_state *state,
enum wined3d_format_id format_id, WINED3DDECLUSAGE usage, UINT usage_idx)
enum wined3d_format_id format_id, enum wined3d_decl_usage usage, UINT usage_idx)
{
struct wined3d_vertex_element *elements = state->elements;
const struct wined3d_format *format;
@ -333,32 +334,32 @@ static unsigned int convert_fvf_to_declaration(const struct wined3d_gl_info *gl_
if (has_pos)
{
if (!has_blend && (fvf & WINED3DFVF_XYZRHW))
append_decl_element(&state, WINED3DFMT_R32G32B32A32_FLOAT, WINED3DDECLUSAGE_POSITIONT, 0);
append_decl_element(&state, WINED3DFMT_R32G32B32A32_FLOAT, WINED3D_DECL_USAGE_POSITIONT, 0);
else if ((fvf & WINED3DFVF_XYZW) == WINED3DFVF_XYZW)
append_decl_element(&state, WINED3DFMT_R32G32B32A32_FLOAT, WINED3DDECLUSAGE_POSITION, 0);
append_decl_element(&state, WINED3DFMT_R32G32B32A32_FLOAT, WINED3D_DECL_USAGE_POSITION, 0);
else
append_decl_element(&state, WINED3DFMT_R32G32B32_FLOAT, WINED3DDECLUSAGE_POSITION, 0);
append_decl_element(&state, WINED3DFMT_R32G32B32_FLOAT, WINED3D_DECL_USAGE_POSITION, 0);
}
if (has_blend && (num_blends > 0))
{
if ((fvf & WINED3DFVF_XYZB5) == WINED3DFVF_XYZB2 && (fvf & WINED3DFVF_LASTBETA_D3DCOLOR))
append_decl_element(&state, WINED3DFMT_B8G8R8A8_UNORM, WINED3DDECLUSAGE_BLENDWEIGHT, 0);
append_decl_element(&state, WINED3DFMT_B8G8R8A8_UNORM, WINED3D_DECL_USAGE_BLEND_WEIGHT, 0);
else
{
switch (num_blends)
{
case 1:
append_decl_element(&state, WINED3DFMT_R32_FLOAT, WINED3DDECLUSAGE_BLENDWEIGHT, 0);
append_decl_element(&state, WINED3DFMT_R32_FLOAT, WINED3D_DECL_USAGE_BLEND_WEIGHT, 0);
break;
case 2:
append_decl_element(&state, WINED3DFMT_R32G32_FLOAT, WINED3DDECLUSAGE_BLENDWEIGHT, 0);
append_decl_element(&state, WINED3DFMT_R32G32_FLOAT, WINED3D_DECL_USAGE_BLEND_WEIGHT, 0);
break;
case 3:
append_decl_element(&state, WINED3DFMT_R32G32B32_FLOAT, WINED3DDECLUSAGE_BLENDWEIGHT, 0);
append_decl_element(&state, WINED3DFMT_R32G32B32_FLOAT, WINED3D_DECL_USAGE_BLEND_WEIGHT, 0);
break;
case 4:
append_decl_element(&state, WINED3DFMT_R32G32B32A32_FLOAT, WINED3DDECLUSAGE_BLENDWEIGHT, 0);
append_decl_element(&state, WINED3DFMT_R32G32B32A32_FLOAT, WINED3D_DECL_USAGE_BLEND_WEIGHT, 0);
break;
default:
ERR("Unexpected amount of blend values: %u\n", num_blends);
@ -370,33 +371,37 @@ static unsigned int convert_fvf_to_declaration(const struct wined3d_gl_info *gl_
{
if ((fvf & WINED3DFVF_LASTBETA_UBYTE4)
|| ((fvf & WINED3DFVF_XYZB5) == WINED3DFVF_XYZB2 && (fvf & WINED3DFVF_LASTBETA_D3DCOLOR)))
append_decl_element(&state, WINED3DFMT_R8G8B8A8_UINT, WINED3DDECLUSAGE_BLENDINDICES, 0);
append_decl_element(&state, WINED3DFMT_R8G8B8A8_UINT, WINED3D_DECL_USAGE_BLEND_INDICES, 0);
else if (fvf & WINED3DFVF_LASTBETA_D3DCOLOR)
append_decl_element(&state, WINED3DFMT_B8G8R8A8_UNORM, WINED3DDECLUSAGE_BLENDINDICES, 0);
append_decl_element(&state, WINED3DFMT_B8G8R8A8_UNORM, WINED3D_DECL_USAGE_BLEND_INDICES, 0);
else
append_decl_element(&state, WINED3DFMT_R32_FLOAT, WINED3DDECLUSAGE_BLENDINDICES, 0);
append_decl_element(&state, WINED3DFMT_R32_FLOAT, WINED3D_DECL_USAGE_BLEND_INDICES, 0);
}
if (has_normal) append_decl_element(&state, WINED3DFMT_R32G32B32_FLOAT, WINED3DDECLUSAGE_NORMAL, 0);
if (has_psize) append_decl_element(&state, WINED3DFMT_R32_FLOAT, WINED3DDECLUSAGE_PSIZE, 0);
if (has_diffuse) append_decl_element(&state, WINED3DFMT_B8G8R8A8_UNORM, WINED3DDECLUSAGE_COLOR, 0);
if (has_specular) append_decl_element(&state, WINED3DFMT_B8G8R8A8_UNORM, WINED3DDECLUSAGE_COLOR, 1);
if (has_normal)
append_decl_element(&state, WINED3DFMT_R32G32B32_FLOAT, WINED3D_DECL_USAGE_NORMAL, 0);
if (has_psize)
append_decl_element(&state, WINED3DFMT_R32_FLOAT, WINED3D_DECL_USAGE_PSIZE, 0);
if (has_diffuse)
append_decl_element(&state, WINED3DFMT_B8G8R8A8_UNORM, WINED3D_DECL_USAGE_COLOR, 0);
if (has_specular)
append_decl_element(&state, WINED3DFMT_B8G8R8A8_UNORM, WINED3D_DECL_USAGE_COLOR, 1);
for (idx = 0; idx < num_textures; ++idx)
{
switch ((texcoords >> (idx * 2)) & 0x03)
{
case WINED3DFVF_TEXTUREFORMAT1:
append_decl_element(&state, WINED3DFMT_R32_FLOAT, WINED3DDECLUSAGE_TEXCOORD, idx);
append_decl_element(&state, WINED3DFMT_R32_FLOAT, WINED3D_DECL_USAGE_TEXCOORD, idx);
break;
case WINED3DFVF_TEXTUREFORMAT2:
append_decl_element(&state, WINED3DFMT_R32G32_FLOAT, WINED3DDECLUSAGE_TEXCOORD, idx);
append_decl_element(&state, WINED3DFMT_R32G32_FLOAT, WINED3D_DECL_USAGE_TEXCOORD, idx);
break;
case WINED3DFVF_TEXTUREFORMAT3:
append_decl_element(&state, WINED3DFMT_R32G32B32_FLOAT, WINED3DDECLUSAGE_TEXCOORD, idx);
append_decl_element(&state, WINED3DFMT_R32G32B32_FLOAT, WINED3D_DECL_USAGE_TEXCOORD, idx);
break;
case WINED3DFVF_TEXTUREFORMAT4:
append_decl_element(&state, WINED3DFMT_R32G32B32A32_FLOAT, WINED3DDECLUSAGE_TEXCOORD, idx);
append_decl_element(&state, WINED3DFMT_R32G32B32A32_FLOAT, WINED3D_DECL_USAGE_TEXCOORD, idx);
break;
}
}

View File

@ -641,7 +641,7 @@ struct wined3d_shader_instruction
struct wined3d_shader_semantic
{
WINED3DDECLUSAGE usage;
enum wined3d_decl_usage usage;
UINT usage_idx;
enum wined3d_sampler_texture_type sampler_type;
struct wined3d_shader_dst_param reg;
@ -649,7 +649,7 @@ struct wined3d_shader_semantic
struct wined3d_shader_attribute
{
WINED3DDECLUSAGE usage;
enum wined3d_decl_usage usage;
UINT usage_idx;
};
@ -2492,7 +2492,7 @@ const char *debug_d3dresourcetype(enum wined3d_resource_type resource_type) DECL
const char *debug_d3dusage(DWORD usage) DECLSPEC_HIDDEN;
const char *debug_d3dusagequery(DWORD usagequery) DECLSPEC_HIDDEN;
const char *debug_d3ddeclmethod(enum wined3d_decl_method method) DECLSPEC_HIDDEN;
const char *debug_d3ddeclusage(BYTE usage) DECLSPEC_HIDDEN;
const char *debug_d3ddeclusage(enum wined3d_decl_usage usage) DECLSPEC_HIDDEN;
const char *debug_d3dprimitivetype(enum wined3d_primitive_type primitive_type) DECLSPEC_HIDDEN;
const char *debug_d3drenderstate(enum wined3d_render_state state) DECLSPEC_HIDDEN;
const char *debug_d3dsamplerstate(enum wined3d_sampler_state state) DECLSPEC_HIDDEN;
@ -2655,7 +2655,7 @@ unsigned int shader_find_free_input_register(const struct wined3d_shader_reg_map
unsigned int max) DECLSPEC_HIDDEN;
void shader_generate_main(const struct wined3d_shader *shader, struct wined3d_shader_buffer *buffer,
const struct wined3d_shader_reg_maps *reg_maps, const DWORD *byte_code, void *backend_ctx) DECLSPEC_HIDDEN;
BOOL shader_match_semantic(const char *semantic_name, WINED3DDECLUSAGE usage) DECLSPEC_HIDDEN;
BOOL shader_match_semantic(const char *semantic_name, enum wined3d_decl_usage usage) DECLSPEC_HIDDEN;
static inline BOOL shader_is_pshader_version(enum wined3d_shader_type type)
{

View File

@ -730,23 +730,23 @@ enum wined3d_decl_method
WINED3D_DECL_METHOD_LOOKUP_PRESAMPLED = 6,
};
typedef enum _WINED3DDECLUSAGE
enum wined3d_decl_usage
{
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;
WINED3D_DECL_USAGE_POSITION = 0,
WINED3D_DECL_USAGE_BLEND_WEIGHT = 1,
WINED3D_DECL_USAGE_BLEND_INDICES = 2,
WINED3D_DECL_USAGE_NORMAL = 3,
WINED3D_DECL_USAGE_PSIZE = 4,
WINED3D_DECL_USAGE_TEXCOORD = 5,
WINED3D_DECL_USAGE_TANGENT = 6,
WINED3D_DECL_USAGE_BINORMAL = 7,
WINED3D_DECL_USAGE_TESS_FACTOR = 8,
WINED3D_DECL_USAGE_POSITIONT = 9,
WINED3D_DECL_USAGE_COLOR = 10,
WINED3D_DECL_USAGE_FOG = 11,
WINED3D_DECL_USAGE_DEPTH = 12,
WINED3D_DECL_USAGE_SAMPLE = 13
};
typedef enum _WINED3DSURFTYPE
{