Commit 9cdc8876 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Use upper-case enum elements in the vertexprocessing_mode enum.

parent 678c5544
......@@ -1061,7 +1061,7 @@ static void shader_arb_get_register_name(const struct wined3d_shader_instruction
/* This is better than nothing for now */
sprintf(register_name, "fragment.texcoord[%s + %u]", rel_reg, reg->idx[0].offset);
}
else if(ctx->cur_ps_args->super.vp_mode != vertexshader)
else if(ctx->cur_ps_args->super.vp_mode != WINED3D_VP_MODE_SHADER)
{
/* This is problematic because we'd have to consult the ctx->ps_input strings
* for where to find the varying. Some may be "0.0", others can be texcoords or
......@@ -3415,73 +3415,68 @@ static void init_ps_input(const struct wined3d_shader *shader,
const char *semantic_name;
DWORD semantic_idx;
switch(args->super.vp_mode)
{
case pretransformed:
case fixedfunction:
/* The pixelshader has to collect the varyings on its own. In any case properly load
* color0 and color1. In the case of pretransformed vertices also load texcoords. Set
* other attribs to 0.0.
*
* For fixedfunction this behavior is correct, according to the tests. For pretransformed
* we'd either need a replacement shader that can load other attribs like BINORMAL, or
* load the texcoord attrib pointers to match the pixel shader signature
*/
for (i = 0; i < shader->input_signature.element_count; ++i)
{
input = &shader->input_signature.elements[i];
if (!(semantic_name = input->semantic_name))
continue;
semantic_idx = input->semantic_idx;
if (args->super.vp_mode == WINED3D_VP_MODE_SHADER)
{
/* That one is easy. The vertex shaders provide v0-v7 in
* fragment.texcoord and v8 and v9 in fragment.color. */
for (i = 0; i < 8; ++i)
{
priv->ps_input[i] = texcoords[i];
}
priv->ps_input[8] = "fragment.color.primary";
priv->ps_input[9] = "fragment.color.secondary";
return;
}
if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_COLOR))
{
if (!semantic_idx)
priv->ps_input[input->register_idx] = "fragment.color.primary";
else if (semantic_idx == 1)
priv->ps_input[input->register_idx] = "fragment.color.secondary";
else
priv->ps_input[input->register_idx] = "0.0";
}
else if (args->super.vp_mode == fixedfunction)
{
priv->ps_input[input->register_idx] = "0.0";
}
else if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_TEXCOORD))
{
if (semantic_idx < 8)
priv->ps_input[input->register_idx] = texcoords[semantic_idx];
else
priv->ps_input[input->register_idx] = "0.0";
}
else if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_FOG))
{
if (!semantic_idx)
priv->ps_input[input->register_idx] = "fragment.fogcoord";
else
priv->ps_input[input->register_idx] = "0.0";
}
else
{
priv->ps_input[input->register_idx] = "0.0";
}
/* The fragment shader has to collect the varyings on its own. In any case
* properly load color0 and color1. In the case of pre-transformed
* vertices also load texture coordinates. Set other attributes to 0.0.
*
* For fixed-function this behavior is correct, according to the tests.
* For pre-transformed we'd either need a replacement shader that can load
* other attributes like BINORMAL, or load the texture coordinate
* attribute pointers to match the fragment shader signature. */
for (i = 0; i < shader->input_signature.element_count; ++i)
{
input = &shader->input_signature.elements[i];
if (!(semantic_name = input->semantic_name))
continue;
semantic_idx = input->semantic_idx;
TRACE("v%u, semantic %s%u is %s\n", input->register_idx,
semantic_name, semantic_idx, priv->ps_input[input->register_idx]);
}
break;
if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_COLOR))
{
if (!semantic_idx)
priv->ps_input[input->register_idx] = "fragment.color.primary";
else if (semantic_idx == 1)
priv->ps_input[input->register_idx] = "fragment.color.secondary";
else
priv->ps_input[input->register_idx] = "0.0";
}
else if (args->super.vp_mode == WINED3D_VP_MODE_FF)
{
priv->ps_input[input->register_idx] = "0.0";
}
else if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_TEXCOORD))
{
if (semantic_idx < 8)
priv->ps_input[input->register_idx] = texcoords[semantic_idx];
else
priv->ps_input[input->register_idx] = "0.0";
}
else if (shader_match_semantic(semantic_name, WINED3D_DECL_USAGE_FOG))
{
if (!semantic_idx)
priv->ps_input[input->register_idx] = "fragment.fogcoord";
else
priv->ps_input[input->register_idx] = "0.0";
}
else
{
priv->ps_input[input->register_idx] = "0.0";
}
case vertexshader:
/* That one is easy. The vertex shaders provide v0-v7 in fragment.texcoord and v8 and v9 in
* fragment.color
*/
for(i = 0; i < 8; i++)
{
priv->ps_input[i] = texcoords[i];
}
priv->ps_input[8] = "fragment.color.primary";
priv->ps_input[9] = "fragment.color.secondary";
break;
TRACE("v%u, semantic %s%u is %s\n", input->register_idx,
semantic_name, semantic_idx, priv->ps_input[input->register_idx]);
}
}
......
......@@ -6735,7 +6735,7 @@ static void shader_glsl_input_pack(const struct wined3d_shader *shader, struct w
semantic_idx = input->semantic_idx;
shader_glsl_write_mask_to_str(input->mask, reg_mask);
if (args->vp_mode == vertexshader)
if (args->vp_mode == WINED3D_VP_MODE_SHADER)
{
if (input->sysval_semantic == WINED3D_SV_POSITION && !semantic_idx)
{
......@@ -6774,7 +6774,7 @@ static void shader_glsl_input_pack(const struct wined3d_shader *shader, struct w
if (args->pointsprite)
shader_addline(buffer, "ps_in[%u] = vec4(gl_PointCoord.xy, 0.0, 0.0);\n",
shader->u.ps.input_reg_map[input->register_idx]);
else if (args->vp_mode == pretransformed && args->texcoords_initialized & (1u << semantic_idx))
else if (args->vp_mode == WINED3D_VP_MODE_NONE && args->texcoords_initialized & (1u << semantic_idx))
shader_addline(buffer, "ps_in[%u]%s = %s[%u]%s;\n",
shader->u.ps.input_reg_map[input->register_idx], reg_mask,
needs_legacy_glsl_syntax(gl_info)
......@@ -7596,7 +7596,7 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
shader_addline(buffer, "uniform vec4 %s_samplerNP2Fixup[%u];\n", prefix, fixup->num_consts);
}
if (version->major < 3 || args->vp_mode != vertexshader)
if (version->major < 3 || args->vp_mode != WINED3D_VP_MODE_SHADER)
{
shader_addline(buffer, "uniform struct\n{\n");
shader_addline(buffer, " vec4 color;\n");
......@@ -7630,7 +7630,7 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
{
unsigned int in_count = min(vec4_varyings(version->major, gl_info), shader->limits->packed_input);
if (args->vp_mode == vertexshader && reg_maps->input_registers)
if (args->vp_mode == WINED3D_VP_MODE_SHADER && reg_maps->input_registers)
shader_glsl_declare_shader_inputs(gl_info, buffer, in_count,
shader->u.ps.interpolation_mode, version->major >= 4);
shader_addline(buffer, "vec4 %s_in[%u];\n", prefix, in_count);
......@@ -7729,7 +7729,7 @@ static GLuint shader_glsl_generate_pshader(const struct wined3d_context *context
"vpos = vec4(0, ycorrection[0], 0, 0) + gl_FragCoord * vec4(1, ycorrection[1], 1, 1);\n");
}
if (reg_maps->shader_version.major < 3 || args->vp_mode != vertexshader)
if (reg_maps->shader_version.major < 3 || args->vp_mode != WINED3D_VP_MODE_SHADER)
{
unsigned int i;
WORD map = reg_maps->texcoord;
......
......@@ -3926,16 +3926,16 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3
if (shader->reg_maps.shader_version.major >= 3)
{
if (position_transformed)
args->vp_mode = pretransformed;
args->vp_mode = WINED3D_VP_MODE_NONE;
else if (use_vs(state))
args->vp_mode = vertexshader;
args->vp_mode = WINED3D_VP_MODE_SHADER;
else
args->vp_mode = fixedfunction;
args->vp_mode = WINED3D_VP_MODE_FF;
args->fog = WINED3D_FFP_PS_FOG_OFF;
}
else
{
args->vp_mode = vertexshader;
args->vp_mode = WINED3D_VP_MODE_SHADER;
if (state->render_states[WINED3D_RS_FOGENABLE])
{
switch (state->render_states[WINED3D_RS_FOGTABLEMODE])
......
......@@ -1300,10 +1300,11 @@ enum wined3d_gl_resource_type
WINED3D_GL_RES_TYPE_COUNT = 7,
};
enum vertexprocessing_mode {
fixedfunction,
vertexshader,
pretransformed
enum wined3d_vertex_processing_mode
{
WINED3D_VP_MODE_FF,
WINED3D_VP_MODE_SHADER,
WINED3D_VP_MODE_NONE,
};
#define WINED3D_CONST_NUM_UNUSED ~0U
......@@ -1338,7 +1339,7 @@ enum wined3d_shader_tex_types
struct ps_compile_args
{
struct color_fixup_desc color_fixup[MAX_FRAGMENT_SAMPLERS];
enum vertexprocessing_mode vp_mode;
enum wined3d_vertex_processing_mode vp_mode;
enum wined3d_ffp_ps_fog_mode fog;
WORD tex_transform; /* ps 1.0-1.3, 4 textures */
WORD tex_types; /* ps 1.0 - 1.4, 6 textures */
......
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