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

Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Henri Verbeet 2018-03-23 15:14:29 +04:30 committed by Alexandre Julliard
parent 678c5544c1
commit 9cdc8876b0
4 changed files with 74 additions and 78 deletions

View File

@ -1061,7 +1061,7 @@ static void shader_arb_get_register_name(const struct wined3d_shader_instruction
/* This is better than nothing for now */ /* This is better than nothing for now */
sprintf(register_name, "fragment.texcoord[%s + %u]", rel_reg, reg->idx[0].offset); 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 /* 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 * for where to find the varying. Some may be "0.0", others can be texcoords or
@ -3415,18 +3415,27 @@ static void init_ps_input(const struct wined3d_shader *shader,
const char *semantic_name; const char *semantic_name;
DWORD semantic_idx; DWORD semantic_idx;
switch(args->super.vp_mode) if (args->super.vp_mode == WINED3D_VP_MODE_SHADER)
{ {
case pretransformed: /* That one is easy. The vertex shaders provide v0-v7 in
case fixedfunction: * fragment.texcoord and v8 and v9 in fragment.color. */
/* The pixelshader has to collect the varyings on its own. In any case properly load for (i = 0; i < 8; ++i)
* color0 and color1. In the case of pretransformed vertices also load texcoords. Set {
* other attribs to 0.0. priv->ps_input[i] = texcoords[i];
}
priv->ps_input[8] = "fragment.color.primary";
priv->ps_input[9] = "fragment.color.secondary";
return;
}
/* 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 fixedfunction this behavior is correct, according to the tests. For pretransformed * For fixed-function this behavior is correct, according to the tests.
* we'd either need a replacement shader that can load other attribs like BINORMAL, or * For pre-transformed we'd either need a replacement shader that can load
* load the texcoord attrib pointers to match the pixel shader signature * 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) for (i = 0; i < shader->input_signature.element_count; ++i)
{ {
input = &shader->input_signature.elements[i]; input = &shader->input_signature.elements[i];
@ -3443,7 +3452,7 @@ static void init_ps_input(const struct wined3d_shader *shader,
else else
priv->ps_input[input->register_idx] = "0.0"; priv->ps_input[input->register_idx] = "0.0";
} }
else if (args->super.vp_mode == fixedfunction) else if (args->super.vp_mode == WINED3D_VP_MODE_FF)
{ {
priv->ps_input[input->register_idx] = "0.0"; priv->ps_input[input->register_idx] = "0.0";
} }
@ -3469,20 +3478,6 @@ static void init_ps_input(const struct wined3d_shader *shader,
TRACE("v%u, semantic %s%u is %s\n", input->register_idx, TRACE("v%u, semantic %s%u is %s\n", input->register_idx,
semantic_name, semantic_idx, priv->ps_input[input->register_idx]); semantic_name, semantic_idx, priv->ps_input[input->register_idx]);
} }
break;
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;
}
} }
static void arbfp_add_linear_fog(struct wined3d_string_buffer *buffer, static void arbfp_add_linear_fog(struct wined3d_string_buffer *buffer,

View File

@ -6735,7 +6735,7 @@ static void shader_glsl_input_pack(const struct wined3d_shader *shader, struct w
semantic_idx = input->semantic_idx; semantic_idx = input->semantic_idx;
shader_glsl_write_mask_to_str(input->mask, reg_mask); 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) 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) if (args->pointsprite)
shader_addline(buffer, "ps_in[%u] = vec4(gl_PointCoord.xy, 0.0, 0.0);\n", shader_addline(buffer, "ps_in[%u] = vec4(gl_PointCoord.xy, 0.0, 0.0);\n",
shader->u.ps.input_reg_map[input->register_idx]); 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_addline(buffer, "ps_in[%u]%s = %s[%u]%s;\n",
shader->u.ps.input_reg_map[input->register_idx], reg_mask, shader->u.ps.input_reg_map[input->register_idx], reg_mask,
needs_legacy_glsl_syntax(gl_info) 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); 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, "uniform struct\n{\n");
shader_addline(buffer, " vec4 color;\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); 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_glsl_declare_shader_inputs(gl_info, buffer, in_count,
shader->u.ps.interpolation_mode, version->major >= 4); shader->u.ps.interpolation_mode, version->major >= 4);
shader_addline(buffer, "vec4 %s_in[%u];\n", prefix, in_count); 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"); "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; unsigned int i;
WORD map = reg_maps->texcoord; WORD map = reg_maps->texcoord;

View File

@ -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 (shader->reg_maps.shader_version.major >= 3)
{ {
if (position_transformed) if (position_transformed)
args->vp_mode = pretransformed; args->vp_mode = WINED3D_VP_MODE_NONE;
else if (use_vs(state)) else if (use_vs(state))
args->vp_mode = vertexshader; args->vp_mode = WINED3D_VP_MODE_SHADER;
else else
args->vp_mode = fixedfunction; args->vp_mode = WINED3D_VP_MODE_FF;
args->fog = WINED3D_FFP_PS_FOG_OFF; args->fog = WINED3D_FFP_PS_FOG_OFF;
} }
else else
{ {
args->vp_mode = vertexshader; args->vp_mode = WINED3D_VP_MODE_SHADER;
if (state->render_states[WINED3D_RS_FOGENABLE]) if (state->render_states[WINED3D_RS_FOGENABLE])
{ {
switch (state->render_states[WINED3D_RS_FOGTABLEMODE]) switch (state->render_states[WINED3D_RS_FOGTABLEMODE])

View File

@ -1300,10 +1300,11 @@ enum wined3d_gl_resource_type
WINED3D_GL_RES_TYPE_COUNT = 7, WINED3D_GL_RES_TYPE_COUNT = 7,
}; };
enum vertexprocessing_mode { enum wined3d_vertex_processing_mode
fixedfunction, {
vertexshader, WINED3D_VP_MODE_FF,
pretransformed WINED3D_VP_MODE_SHADER,
WINED3D_VP_MODE_NONE,
}; };
#define WINED3D_CONST_NUM_UNUSED ~0U #define WINED3D_CONST_NUM_UNUSED ~0U
@ -1338,7 +1339,7 @@ enum wined3d_shader_tex_types
struct ps_compile_args struct ps_compile_args
{ {
struct color_fixup_desc color_fixup[MAX_FRAGMENT_SAMPLERS]; 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; enum wined3d_ffp_ps_fog_mode fog;
WORD tex_transform; /* ps 1.0-1.3, 4 textures */ WORD tex_transform; /* ps 1.0-1.3, 4 textures */
WORD tex_types; /* ps 1.0 - 1.4, 6 textures */ WORD tex_types; /* ps 1.0 - 1.4, 6 textures */