Commit bee9adbd authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Get rid of the WINED3DDECLUSAGE typedef.

parent c35c30fa
......@@ -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 */
......
......@@ -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";
......
......@@ -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)
......
......@@ -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]);
}
......
......@@ -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);
......
......@@ -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;
}
}
......
......@@ -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)
{
......
......@@ -730,23 +730,23 @@ enum wined3d_decl_method
WINED3D_DECL_METHOD_LOOKUP_PRESAMPLED = 6,
};
typedef enum _WINED3DDECLUSAGE
{
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;
enum wined3d_decl_usage
{
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
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment