wined3d: Rename "fogmode" to "wined3d_ffp_ps_fog_mode".

This is mostly for consistency with wined3d_ffp_vs_fog_mode.
This commit is contained in:
Henri Verbeet 2013-05-30 10:05:34 +02:00 committed by Alexandre Julliard
parent e4816996c3
commit 8352d45da5
5 changed files with 45 additions and 41 deletions

View File

@ -3662,16 +3662,17 @@ static GLuint shader_arb_generate_pshader(const struct wined3d_shader *shader,
if (reg_maps->shader_version.major < 3) if (reg_maps->shader_version.major < 3)
{ {
switch(args->super.fog) { switch (args->super.fog)
case FOG_OFF: {
case WINED3D_FFP_PS_FOG_OFF:
break; break;
case FOG_LINEAR: case WINED3D_FFP_PS_FOG_LINEAR:
shader_addline(buffer, "OPTION ARB_fog_linear;\n"); shader_addline(buffer, "OPTION ARB_fog_linear;\n");
break; break;
case FOG_EXP: case WINED3D_FFP_PS_FOG_EXP:
shader_addline(buffer, "OPTION ARB_fog_exp;\n"); shader_addline(buffer, "OPTION ARB_fog_exp;\n");
break; break;
case FOG_EXP2: case WINED3D_FFP_PS_FOG_EXP2:
shader_addline(buffer, "OPTION ARB_fog_exp2;\n"); shader_addline(buffer, "OPTION ARB_fog_exp2;\n");
break; break;
} }
@ -6208,11 +6209,12 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, con
shader_addline(&buffer, "!!ARBfp1.0\n"); shader_addline(&buffer, "!!ARBfp1.0\n");
switch(settings->fog) { switch (settings->fog)
case FOG_OFF: break; {
case FOG_LINEAR: shader_addline(&buffer, "OPTION ARB_fog_linear;\n"); break; case WINED3D_FFP_PS_FOG_OFF: break;
case FOG_EXP: shader_addline(&buffer, "OPTION ARB_fog_exp;\n"); break; case WINED3D_FFP_PS_FOG_LINEAR: shader_addline(&buffer, "OPTION ARB_fog_linear;\n"); break;
case FOG_EXP2: shader_addline(&buffer, "OPTION ARB_fog_exp2;\n"); break; case WINED3D_FFP_PS_FOG_EXP: shader_addline(&buffer, "OPTION ARB_fog_exp;\n"); break;
case WINED3D_FFP_PS_FOG_EXP2: shader_addline(&buffer, "OPTION ARB_fog_exp2;\n"); break;
default: FIXME("Unexpected fog setting %d\n", settings->fog); default: FIXME("Unexpected fog setting %d\n", settings->fog);
} }

View File

@ -4420,24 +4420,24 @@ static void shader_glsl_generate_srgb_write_correction(struct wined3d_shader_buf
shader_addline(buffer, "gl_FragData[0] = clamp(gl_FragData[0], 0.0, 1.0);\n"); shader_addline(buffer, "gl_FragData[0] = clamp(gl_FragData[0], 0.0, 1.0);\n");
} }
static void shader_glsl_generate_fog_code(struct wined3d_shader_buffer *buffer, enum fogmode mode) static void shader_glsl_generate_fog_code(struct wined3d_shader_buffer *buffer, enum wined3d_ffp_ps_fog_mode mode)
{ {
switch (mode) switch (mode)
{ {
case FOG_OFF: case WINED3D_FFP_PS_FOG_OFF:
return; return;
case FOG_LINEAR: case WINED3D_FFP_PS_FOG_LINEAR:
/* Fog = (gl_Fog.end - gl_FogFragCoord) / (gl_Fog.end - gl_Fog.start) */ /* Fog = (gl_Fog.end - gl_FogFragCoord) / (gl_Fog.end - gl_Fog.start) */
shader_addline(buffer, "float Fog = (gl_Fog.end - gl_FogFragCoord) / (gl_Fog.end - gl_Fog.start);\n"); shader_addline(buffer, "float Fog = (gl_Fog.end - gl_FogFragCoord) / (gl_Fog.end - gl_Fog.start);\n");
break; break;
case FOG_EXP: case WINED3D_FFP_PS_FOG_EXP:
/* Fog = e^-(gl_Fog.density * gl_FogFragCoord) */ /* Fog = e^-(gl_Fog.density * gl_FogFragCoord) */
shader_addline(buffer, "float Fog = exp(-gl_Fog.density * gl_FogFragCoord);\n"); shader_addline(buffer, "float Fog = exp(-gl_Fog.density * gl_FogFragCoord);\n");
break; break;
case FOG_EXP2: case WINED3D_FFP_PS_FOG_EXP2:
/* Fog = e^-((gl_Fog.density * gl_FogFragCoord)^2) */ /* Fog = e^-((gl_Fog.density * gl_FogFragCoord)^2) */
shader_addline(buffer, "float Fog = exp(-gl_Fog.density * gl_Fog.density * gl_FogFragCoord * gl_FogFragCoord);\n"); shader_addline(buffer, "float Fog = exp(-gl_Fog.density * gl_Fog.density * gl_FogFragCoord * gl_FogFragCoord);\n");
break; break;

View File

@ -2154,7 +2154,7 @@ void find_ps_compile_args(const struct wined3d_state *state,
args->vp_mode = vertexshader; args->vp_mode = vertexshader;
else else
args->vp_mode = fixedfunction; args->vp_mode = fixedfunction;
args->fog = FOG_OFF; args->fog = WINED3D_FFP_PS_FOG_OFF;
} }
else else
{ {
@ -2166,27 +2166,27 @@ void find_ps_compile_args(const struct wined3d_state *state,
case WINED3D_FOG_NONE: case WINED3D_FOG_NONE:
if (device->stream_info.position_transformed || use_vs(state)) if (device->stream_info.position_transformed || use_vs(state))
{ {
args->fog = FOG_LINEAR; args->fog = WINED3D_FFP_PS_FOG_LINEAR;
break; break;
} }
switch (state->render_states[WINED3D_RS_FOGVERTEXMODE]) switch (state->render_states[WINED3D_RS_FOGVERTEXMODE])
{ {
case WINED3D_FOG_NONE: /* Fall through. */ case WINED3D_FOG_NONE: /* Fall through. */
case WINED3D_FOG_LINEAR: args->fog = FOG_LINEAR; break; case WINED3D_FOG_LINEAR: args->fog = WINED3D_FFP_PS_FOG_LINEAR; break;
case WINED3D_FOG_EXP: args->fog = FOG_EXP; break; case WINED3D_FOG_EXP: args->fog = WINED3D_FFP_PS_FOG_EXP; break;
case WINED3D_FOG_EXP2: args->fog = FOG_EXP2; break; case WINED3D_FOG_EXP2: args->fog = WINED3D_FFP_PS_FOG_EXP2; break;
} }
break; break;
case WINED3D_FOG_LINEAR: args->fog = FOG_LINEAR; break; case WINED3D_FOG_LINEAR: args->fog = WINED3D_FFP_PS_FOG_LINEAR; break;
case WINED3D_FOG_EXP: args->fog = FOG_EXP; break; case WINED3D_FOG_EXP: args->fog = WINED3D_FFP_PS_FOG_EXP; break;
case WINED3D_FOG_EXP2: args->fog = FOG_EXP2; break; case WINED3D_FOG_EXP2: args->fog = WINED3D_FFP_PS_FOG_EXP2; break;
} }
} }
else else
{ {
args->fog = FOG_OFF; args->fog = WINED3D_FFP_PS_FOG_OFF;
} }
} }
} }

View File

@ -3307,13 +3307,13 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d
if (!state->render_states[WINED3D_RS_FOGENABLE]) if (!state->render_states[WINED3D_RS_FOGENABLE])
{ {
settings->fog = FOG_OFF; settings->fog = WINED3D_FFP_PS_FOG_OFF;
} }
else if (state->render_states[WINED3D_RS_FOGTABLEMODE] == WINED3D_FOG_NONE) else if (state->render_states[WINED3D_RS_FOGTABLEMODE] == WINED3D_FOG_NONE)
{ {
if (use_vs(state) || state->vertex_declaration->position_transformed) if (use_vs(state) || state->vertex_declaration->position_transformed)
{ {
settings->fog = FOG_LINEAR; settings->fog = WINED3D_FFP_PS_FOG_LINEAR;
} }
else else
{ {
@ -3321,13 +3321,13 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d
{ {
case WINED3D_FOG_NONE: case WINED3D_FOG_NONE:
case WINED3D_FOG_LINEAR: case WINED3D_FOG_LINEAR:
settings->fog = FOG_LINEAR; settings->fog = WINED3D_FFP_PS_FOG_LINEAR;
break; break;
case WINED3D_FOG_EXP: case WINED3D_FOG_EXP:
settings->fog = FOG_EXP; settings->fog = WINED3D_FFP_PS_FOG_EXP;
break; break;
case WINED3D_FOG_EXP2: case WINED3D_FOG_EXP2:
settings->fog = FOG_EXP2; settings->fog = WINED3D_FFP_PS_FOG_EXP2;
break; break;
} }
} }
@ -3337,13 +3337,13 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d
switch (state->render_states[WINED3D_RS_FOGTABLEMODE]) switch (state->render_states[WINED3D_RS_FOGTABLEMODE])
{ {
case WINED3D_FOG_LINEAR: case WINED3D_FOG_LINEAR:
settings->fog = FOG_LINEAR; settings->fog = WINED3D_FFP_PS_FOG_LINEAR;
break; break;
case WINED3D_FOG_EXP: case WINED3D_FOG_EXP:
settings->fog = FOG_EXP; settings->fog = WINED3D_FFP_PS_FOG_EXP;
break; break;
case WINED3D_FOG_EXP2: case WINED3D_FOG_EXP2:
settings->fog = FOG_EXP2; settings->fog = WINED3D_FFP_PS_FOG_EXP2;
break; break;
} }
} }

View File

@ -734,11 +734,12 @@ enum vertexprocessing_mode {
#define WINED3D_CONST_NUM_UNUSED ~0U #define WINED3D_CONST_NUM_UNUSED ~0U
enum fogmode { enum wined3d_ffp_ps_fog_mode
FOG_OFF, {
FOG_LINEAR, WINED3D_FFP_PS_FOG_OFF,
FOG_EXP, WINED3D_FFP_PS_FOG_LINEAR,
FOG_EXP2 WINED3D_FFP_PS_FOG_EXP,
WINED3D_FFP_PS_FOG_EXP2,
}; };
/* Stateblock dependent parameters which have to be hardcoded /* Stateblock dependent parameters which have to be hardcoded
@ -764,7 +765,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 vertexprocessing_mode vp_mode;
enum fogmode 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 */
WORD srgb_correction; WORD srgb_correction;
@ -1672,9 +1673,10 @@ struct texture_stage_op
unsigned padding : 10; unsigned padding : 10;
}; };
struct ffp_frag_settings { struct ffp_frag_settings
struct texture_stage_op op[MAX_TEXTURES]; {
enum fogmode fog; struct texture_stage_op op[MAX_TEXTURES];
enum wined3d_ffp_ps_fog_mode fog;
/* Use shorts instead of chars to get dword alignment */ /* Use shorts instead of chars to get dword alignment */
unsigned short sRGB_write; unsigned short sRGB_write;
unsigned short emul_clipplanes; unsigned short emul_clipplanes;