Commit 8352d45d authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Rename "fogmode" to "wined3d_ffp_ps_fog_mode".

This is mostly for consistency with wined3d_ffp_vs_fog_mode.
parent e4816996
......@@ -3662,16 +3662,17 @@ static GLuint shader_arb_generate_pshader(const struct wined3d_shader *shader,
if (reg_maps->shader_version.major < 3)
{
switch(args->super.fog) {
case FOG_OFF:
switch (args->super.fog)
{
case WINED3D_FFP_PS_FOG_OFF:
break;
case FOG_LINEAR:
case WINED3D_FFP_PS_FOG_LINEAR:
shader_addline(buffer, "OPTION ARB_fog_linear;\n");
break;
case FOG_EXP:
case WINED3D_FFP_PS_FOG_EXP:
shader_addline(buffer, "OPTION ARB_fog_exp;\n");
break;
case FOG_EXP2:
case WINED3D_FFP_PS_FOG_EXP2:
shader_addline(buffer, "OPTION ARB_fog_exp2;\n");
break;
}
......@@ -6208,11 +6209,12 @@ static GLuint gen_arbfp_ffp_shader(const struct ffp_frag_settings *settings, con
shader_addline(&buffer, "!!ARBfp1.0\n");
switch(settings->fog) {
case FOG_OFF: break;
case FOG_LINEAR: shader_addline(&buffer, "OPTION ARB_fog_linear;\n"); break;
case FOG_EXP: shader_addline(&buffer, "OPTION ARB_fog_exp;\n"); break;
case FOG_EXP2: shader_addline(&buffer, "OPTION ARB_fog_exp2;\n"); break;
switch (settings->fog)
{
case WINED3D_FFP_PS_FOG_OFF: break;
case WINED3D_FFP_PS_FOG_LINEAR: shader_addline(&buffer, "OPTION ARB_fog_linear;\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);
}
......
......@@ -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");
}
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)
{
case FOG_OFF:
case WINED3D_FFP_PS_FOG_OFF:
return;
case FOG_LINEAR:
case WINED3D_FFP_PS_FOG_LINEAR:
/* 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");
break;
case FOG_EXP:
case WINED3D_FFP_PS_FOG_EXP:
/* Fog = e^-(gl_Fog.density * gl_FogFragCoord) */
shader_addline(buffer, "float Fog = exp(-gl_Fog.density * gl_FogFragCoord);\n");
break;
case FOG_EXP2:
case WINED3D_FFP_PS_FOG_EXP2:
/* 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");
break;
......
......@@ -2154,7 +2154,7 @@ void find_ps_compile_args(const struct wined3d_state *state,
args->vp_mode = vertexshader;
else
args->vp_mode = fixedfunction;
args->fog = FOG_OFF;
args->fog = WINED3D_FFP_PS_FOG_OFF;
}
else
{
......@@ -2166,27 +2166,27 @@ void find_ps_compile_args(const struct wined3d_state *state,
case WINED3D_FOG_NONE:
if (device->stream_info.position_transformed || use_vs(state))
{
args->fog = FOG_LINEAR;
args->fog = WINED3D_FFP_PS_FOG_LINEAR;
break;
}
switch (state->render_states[WINED3D_RS_FOGVERTEXMODE])
{
case WINED3D_FOG_NONE: /* Fall through. */
case WINED3D_FOG_LINEAR: args->fog = FOG_LINEAR; break;
case WINED3D_FOG_EXP: args->fog = FOG_EXP; break;
case WINED3D_FOG_EXP2: args->fog = FOG_EXP2; break;
case WINED3D_FOG_LINEAR: args->fog = WINED3D_FFP_PS_FOG_LINEAR; break;
case WINED3D_FOG_EXP: args->fog = WINED3D_FFP_PS_FOG_EXP; break;
case WINED3D_FOG_EXP2: args->fog = WINED3D_FFP_PS_FOG_EXP2; break;
}
break;
case WINED3D_FOG_LINEAR: args->fog = FOG_LINEAR; break;
case WINED3D_FOG_EXP: args->fog = FOG_EXP; break;
case WINED3D_FOG_EXP2: args->fog = FOG_EXP2; break;
case WINED3D_FOG_LINEAR: args->fog = WINED3D_FFP_PS_FOG_LINEAR; break;
case WINED3D_FOG_EXP: args->fog = WINED3D_FFP_PS_FOG_EXP; break;
case WINED3D_FOG_EXP2: args->fog = WINED3D_FFP_PS_FOG_EXP2; break;
}
}
else
{
args->fog = FOG_OFF;
args->fog = WINED3D_FFP_PS_FOG_OFF;
}
}
}
......
......@@ -3307,13 +3307,13 @@ void gen_ffp_frag_op(const struct wined3d_context *context, const struct wined3d
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)
{
if (use_vs(state) || state->vertex_declaration->position_transformed)
{
settings->fog = FOG_LINEAR;
settings->fog = WINED3D_FFP_PS_FOG_LINEAR;
}
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_LINEAR:
settings->fog = FOG_LINEAR;
settings->fog = WINED3D_FFP_PS_FOG_LINEAR;
break;
case WINED3D_FOG_EXP:
settings->fog = FOG_EXP;
settings->fog = WINED3D_FFP_PS_FOG_EXP;
break;
case WINED3D_FOG_EXP2:
settings->fog = FOG_EXP2;
settings->fog = WINED3D_FFP_PS_FOG_EXP2;
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])
{
case WINED3D_FOG_LINEAR:
settings->fog = FOG_LINEAR;
settings->fog = WINED3D_FFP_PS_FOG_LINEAR;
break;
case WINED3D_FOG_EXP:
settings->fog = FOG_EXP;
settings->fog = WINED3D_FFP_PS_FOG_EXP;
break;
case WINED3D_FOG_EXP2:
settings->fog = FOG_EXP2;
settings->fog = WINED3D_FFP_PS_FOG_EXP2;
break;
}
}
......
......@@ -734,11 +734,12 @@ enum vertexprocessing_mode {
#define WINED3D_CONST_NUM_UNUSED ~0U
enum fogmode {
FOG_OFF,
FOG_LINEAR,
FOG_EXP,
FOG_EXP2
enum wined3d_ffp_ps_fog_mode
{
WINED3D_FFP_PS_FOG_OFF,
WINED3D_FFP_PS_FOG_LINEAR,
WINED3D_FFP_PS_FOG_EXP,
WINED3D_FFP_PS_FOG_EXP2,
};
/* Stateblock dependent parameters which have to be hardcoded
......@@ -764,7 +765,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 fogmode fog;
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 */
WORD srgb_correction;
......@@ -1672,9 +1673,10 @@ struct texture_stage_op
unsigned padding : 10;
};
struct ffp_frag_settings {
struct texture_stage_op op[MAX_TEXTURES];
enum fogmode fog;
struct ffp_frag_settings
{
struct texture_stage_op op[MAX_TEXTURES];
enum wined3d_ffp_ps_fog_mode fog;
/* Use shorts instead of chars to get dword alignment */
unsigned short sRGB_write;
unsigned short emul_clipplanes;
......
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