From 6623a8cfa90a9ecb773714d26105d1f2ad527436 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Wed, 21 Dec 2011 21:35:00 +0100 Subject: [PATCH] wined3d: Get rid of the WINED3DFOGMODE typedef. --- dlls/wined3d/arb_program_shader.c | 4 ++-- dlls/wined3d/drawprim.c | 4 ++-- dlls/wined3d/shader.c | 18 +++++++++--------- dlls/wined3d/state.c | 31 +++++++++++++++++-------------- dlls/wined3d/stateblock.c | 4 ++-- dlls/wined3d/utils.c | 16 ++++++++-------- include/wine/wined3d.h | 13 ++++++------- 7 files changed, 46 insertions(+), 44 deletions(-) diff --git a/dlls/wined3d/arb_program_shader.c b/dlls/wined3d/arb_program_shader.c index 00998572d65..d6ef6327fcd 100644 --- a/dlls/wined3d/arb_program_shader.c +++ b/dlls/wined3d/arb_program_shader.c @@ -6411,7 +6411,7 @@ static void state_arbfp_fog(struct wined3d_context *context, const struct wined3 if (!state->render_states[WINED3D_RS_FOGENABLE]) return; - if (state->render_states[WINED3D_RS_FOGTABLEMODE] == WINED3DFOG_NONE) + if (state->render_states[WINED3D_RS_FOGTABLEMODE] == WINED3D_FOG_NONE) { if (use_vs(state)) { @@ -6419,7 +6419,7 @@ static void state_arbfp_fog(struct wined3d_context *context, const struct wined3 } else { - if (state->render_states[WINED3D_RS_FOGVERTEXMODE] == WINED3DFOG_NONE || context->last_was_rhw) + if (state->render_states[WINED3D_RS_FOGVERTEXMODE] == WINED3D_FOG_NONE || context->last_was_rhw) new_source = FOGSOURCE_COORD; else new_source = FOGSOURCE_FFP; diff --git a/dlls/wined3d/drawprim.c b/dlls/wined3d/drawprim.c index f9116a04ad8..e5daef3a13e 100644 --- a/dlls/wined3d/drawprim.c +++ b/dlls/wined3d/drawprim.c @@ -144,9 +144,9 @@ static void drawStridedSlow(const struct wined3d_device *device, const struct wi /* special case where the fog density is stored in the specular alpha channel */ if (state->render_states[WINED3D_RS_FOGENABLE] - && (state->render_states[WINED3D_RS_FOGVERTEXMODE] == WINED3DFOG_NONE + && (state->render_states[WINED3D_RS_FOGVERTEXMODE] == WINED3D_FOG_NONE || si->elements[WINED3D_FFP_POSITION].format->id == WINED3DFMT_R32G32B32A32_FLOAT) - && state->render_states[WINED3D_RS_FOGTABLEMODE] == WINED3DFOG_NONE) + && state->render_states[WINED3D_RS_FOGTABLEMODE] == WINED3D_FOG_NONE) { if (gl_info->supported[EXT_FOG_COORD]) { diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c index 240ba8b67bd..313ed9b1292 100644 --- a/dlls/wined3d/shader.c +++ b/dlls/wined3d/shader.c @@ -1710,7 +1710,7 @@ void find_vs_compile_args(const struct wined3d_state *state, const struct wined3d_shader *shader, struct vs_compile_args *args) { args->fog_src = state->render_states[WINED3D_RS_FOGTABLEMODE] - == WINED3DFOG_NONE ? VS_FOG_COORD : VS_FOG_Z; + == WINED3D_FOG_NONE ? VS_FOG_COORD : VS_FOG_Z; args->clip_enabled = state->render_states[WINED3D_RS_CLIPPING] && state->render_states[WINED3D_RS_CLIPPLANEENABLE]; args->swizzle_map = shader->device->strided_streams.swizzle_map; @@ -1980,7 +1980,7 @@ void find_ps_compile_args(const struct wined3d_state *state, { switch (state->render_states[WINED3D_RS_FOGTABLEMODE]) { - case WINED3DFOG_NONE: + case WINED3D_FOG_NONE: if (device->strided_streams.position_transformed || use_vs(state)) { args->fog = FOG_LINEAR; @@ -1989,16 +1989,16 @@ void find_ps_compile_args(const struct wined3d_state *state, switch (state->render_states[WINED3D_RS_FOGVERTEXMODE]) { - case WINED3DFOG_NONE: /* Fall through. */ - case WINED3DFOG_LINEAR: args->fog = FOG_LINEAR; break; - case WINED3DFOG_EXP: args->fog = FOG_EXP; break; - case WINED3DFOG_EXP2: args->fog = FOG_EXP2; break; + 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; } break; - case WINED3DFOG_LINEAR: args->fog = FOG_LINEAR; break; - case WINED3DFOG_EXP: args->fog = FOG_EXP; break; - case WINED3DFOG_EXP2: args->fog = FOG_EXP2; 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; } } else diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index 950125b55de..4c642619dbf 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -931,7 +931,7 @@ static void state_fog_vertexpart(struct wined3d_context *context, const struct w return; /* Table fog on: Never use fog coords, and use per-fragment fog */ - if (state->render_states[WINED3D_RS_FOGTABLEMODE] != WINED3DFOG_NONE) + if (state->render_states[WINED3D_RS_FOGTABLEMODE] != WINED3D_FOG_NONE) { glHint(GL_FOG_HINT, GL_NICEST); if(context->fog_coord) { @@ -952,7 +952,7 @@ static void state_fog_vertexpart(struct wined3d_context *context, const struct w /* Otherwise use per-vertex fog in any case */ glHint(GL_FOG_HINT, GL_FASTEST); - if (state->render_states[WINED3D_RS_FOGVERTEXMODE] == WINED3DFOG_NONE || context->last_was_rhw) + if (state->render_states[WINED3D_RS_FOGVERTEXMODE] == WINED3D_FOG_NONE || context->last_was_rhw) { /* No fog at all, or transformed vertices: Use fog coord */ if(!context->fog_coord) { @@ -1099,7 +1099,7 @@ void state_fog_fragpart(struct wined3d_context *context, const struct wined3d_st /* DX 7 sdk: "If both render states(vertex and table fog) are set to valid modes, * the system will apply only pixel(=table) fog effects." */ - if (state->render_states[WINED3D_RS_FOGTABLEMODE] == WINED3DFOG_NONE) + if (state->render_states[WINED3D_RS_FOGTABLEMODE] == WINED3D_FOG_NONE) { if (use_vs(state)) { @@ -1112,8 +1112,9 @@ void state_fog_fragpart(struct wined3d_context *context, const struct wined3d_st switch (state->render_states[WINED3D_RS_FOGVERTEXMODE]) { /* If processed vertices are used, fall through to the NONE case */ - case WINED3DFOG_EXP: - if(!context->last_was_rhw) { + case WINED3D_FOG_EXP: + if (!context->last_was_rhw) + { glFogi(GL_FOG_MODE, GL_EXP); checkGLcall("glFogi(GL_FOG_MODE, GL_EXP)"); new_source = FOGSOURCE_FFP; @@ -1121,8 +1122,9 @@ void state_fog_fragpart(struct wined3d_context *context, const struct wined3d_st } /* drop through */ - case WINED3DFOG_EXP2: - if(!context->last_was_rhw) { + case WINED3D_FOG_EXP2: + if (!context->last_was_rhw) + { glFogi(GL_FOG_MODE, GL_EXP2); checkGLcall("glFogi(GL_FOG_MODE, GL_EXP2)"); new_source = FOGSOURCE_FFP; @@ -1130,8 +1132,9 @@ void state_fog_fragpart(struct wined3d_context *context, const struct wined3d_st } /* drop through */ - case WINED3DFOG_LINEAR: - if(!context->last_was_rhw) { + case WINED3D_FOG_LINEAR: + if (!context->last_was_rhw) + { glFogi(GL_FOG_MODE, GL_LINEAR); checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR)"); new_source = FOGSOURCE_FFP; @@ -1139,7 +1142,7 @@ void state_fog_fragpart(struct wined3d_context *context, const struct wined3d_st } /* drop through */ - case WINED3DFOG_NONE: + case WINED3D_FOG_NONE: /* Both are none? According to msdn the alpha channel of the specular * color contains a fog factor. Set it in drawStridedSlow. * Same happens with Vertexfog on transformed vertices @@ -1160,22 +1163,22 @@ void state_fog_fragpart(struct wined3d_context *context, const struct wined3d_st switch (state->render_states[WINED3D_RS_FOGTABLEMODE]) { - case WINED3DFOG_EXP: + case WINED3D_FOG_EXP: glFogi(GL_FOG_MODE, GL_EXP); checkGLcall("glFogi(GL_FOG_MODE, GL_EXP)"); break; - case WINED3DFOG_EXP2: + case WINED3D_FOG_EXP2: glFogi(GL_FOG_MODE, GL_EXP2); checkGLcall("glFogi(GL_FOG_MODE, GL_EXP2)"); break; - case WINED3DFOG_LINEAR: + case WINED3D_FOG_LINEAR: glFogi(GL_FOG_MODE, GL_LINEAR); checkGLcall("glFogi(GL_FOG_MODE, GL_LINEAR)"); break; - case WINED3DFOG_NONE: /* Won't happen */ + case WINED3D_FOG_NONE: /* Won't happen */ default: FIXME("Unexpected WINED3D_RS_FOGTABLEMODE %#x.\n", state->render_states[WINED3D_RS_FOGTABLEMODE]); diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index fa3a286e89c..8a6bad8e208 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1143,7 +1143,7 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock) state->render_states[WINED3D_RS_SPECULARENABLE] = FALSE; state->render_states[WINED3D_RS_ZVISIBLE] = 0; state->render_states[WINED3D_RS_FOGCOLOR] = 0; - state->render_states[WINED3D_RS_FOGTABLEMODE] = WINED3DFOG_NONE; + state->render_states[WINED3D_RS_FOGTABLEMODE] = WINED3D_FOG_NONE; tmpfloat.f = 0.0f; state->render_states[WINED3D_RS_FOGSTART] = tmpfloat.d; tmpfloat.f = 1.0f; @@ -1172,7 +1172,7 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock) state->render_states[WINED3D_RS_CLIPPING] = TRUE; state->render_states[WINED3D_RS_LIGHTING] = TRUE; state->render_states[WINED3D_RS_AMBIENT] = 0; - state->render_states[WINED3D_RS_FOGVERTEXMODE] = WINED3DFOG_NONE; + state->render_states[WINED3D_RS_FOGVERTEXMODE] = WINED3D_FOG_NONE; state->render_states[WINED3D_RS_COLORVERTEX] = TRUE; state->render_states[WINED3D_RS_LOCALVIEWER] = TRUE; state->render_states[WINED3D_RS_NORMALIZENORMALS] = FALSE; diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 10df1d10862..77867880175 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -3070,7 +3070,7 @@ void gen_ffp_frag_op(const struct wined3d_device *device, const struct wined3d_s { settings->fog = FOG_OFF; } - else if (state->render_states[WINED3D_RS_FOGTABLEMODE] == WINED3DFOG_NONE) + else if (state->render_states[WINED3D_RS_FOGTABLEMODE] == WINED3D_FOG_NONE) { if (use_vs(state) || state->vertex_declaration->position_transformed) { @@ -3080,14 +3080,14 @@ void gen_ffp_frag_op(const struct wined3d_device *device, const struct wined3d_s { switch (state->render_states[WINED3D_RS_FOGVERTEXMODE]) { - case WINED3DFOG_NONE: - case WINED3DFOG_LINEAR: + case WINED3D_FOG_NONE: + case WINED3D_FOG_LINEAR: settings->fog = FOG_LINEAR; break; - case WINED3DFOG_EXP: + case WINED3D_FOG_EXP: settings->fog = FOG_EXP; break; - case WINED3DFOG_EXP2: + case WINED3D_FOG_EXP2: settings->fog = FOG_EXP2; break; } @@ -3097,13 +3097,13 @@ void gen_ffp_frag_op(const struct wined3d_device *device, const struct wined3d_s { switch (state->render_states[WINED3D_RS_FOGTABLEMODE]) { - case WINED3DFOG_LINEAR: + case WINED3D_FOG_LINEAR: settings->fog = FOG_LINEAR; break; - case WINED3DFOG_EXP: + case WINED3D_FOG_EXP: settings->fog = FOG_EXP; break; - case WINED3DFOG_EXP2: + case WINED3D_FOG_EXP2: settings->fog = FOG_EXP2; break; } diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index d27ef2adca2..312f97850c1 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -440,14 +440,13 @@ enum wined3d_depth_buffer_type WINED3D_ZB_USEW = 2, }; -typedef enum _WINED3DFOGMODE +enum wined3d_fog_mode { - WINED3DFOG_NONE = 0, - WINED3DFOG_EXP = 1, - WINED3DFOG_EXP2 = 2, - WINED3DFOG_LINEAR = 3, - WINED3DFOG_FORCE_DWORD = 0x7fffffff -} WINED3DFOGMODE; + WINED3D_FOG_NONE = 0, + WINED3D_FOG_EXP = 1, + WINED3D_FOG_EXP2 = 2, + WINED3D_FOG_LINEAR = 3, +}; typedef enum _WINED3DSHADEMODE {