From 1ec609670f712ec16c60a8997f41e48820ad12e8 Mon Sep 17 00:00:00 2001 From: Henri Verbeet Date: Tue, 20 Dec 2011 21:42:14 +0100 Subject: [PATCH] wined3d: Get rid of the WINED3DCMPFUNC typedef. --- dlls/wined3d/state.c | 34 ++++++++++++++++++++++++++++++---- dlls/wined3d/stateblock.c | 8 ++++---- dlls/wined3d/utils.c | 16 ---------------- dlls/wined3d/wined3d_private.h | 1 - include/wine/wined3d.h | 21 ++++++++++----------- 5 files changed, 44 insertions(+), 36 deletions(-) diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c index b03a4b86479..4f3b74b98ae 100644 --- a/dlls/wined3d/state.c +++ b/dlls/wined3d/state.c @@ -202,9 +202,35 @@ static void state_zwritenable(struct wined3d_context *context, const struct wine } } +static GLenum gl_compare_func(enum wined3d_cmp_func f) +{ + switch (f) + { + case WINED3D_CMP_NEVER: + return GL_NEVER; + case WINED3D_CMP_LESS: + return GL_LESS; + case WINED3D_CMP_EQUAL: + return GL_EQUAL; + case WINED3D_CMP_LESSEQUAL: + return GL_LEQUAL; + case WINED3D_CMP_GREATER: + return GL_GREATER; + case WINED3D_CMP_NOTEQUAL: + return GL_NOTEQUAL; + case WINED3D_CMP_GREATEREQUAL: + return GL_GEQUAL; + case WINED3D_CMP_ALWAYS: + return GL_ALWAYS; + default: + FIXME("Unrecognized compare function %#x.\n", f); + return GL_NONE; + } +} + static void state_zfunc(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id) { - GLenum depth_func = CompareFunc(state->render_states[WINED3D_RS_ZFUNC]); + GLenum depth_func = gl_compare_func(state->render_states[WINED3D_RS_ZFUNC]); if (!depth_func) return; @@ -530,7 +556,7 @@ static void state_alpha(struct wined3d_context *context, const struct wined3d_st else { ref = ((float)state->render_states[WINED3D_RS_ALPHAREF]) / 255.0f; - glParm = CompareFunc(state->render_states[WINED3D_RS_ALPHAFUNC]); + glParm = gl_compare_func(state->render_states[WINED3D_RS_ALPHAFUNC]); } if(glParm) { glAlphaFunc(glParm, ref); @@ -801,9 +827,9 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_ onesided_enable = state->render_states[WINED3D_RS_STENCILENABLE]; twosided_enable = state->render_states[WINED3D_RS_TWOSIDEDSTENCILMODE]; - if (!(func = CompareFunc(state->render_states[WINED3D_RS_STENCILFUNC]))) + if (!(func = gl_compare_func(state->render_states[WINED3D_RS_STENCILFUNC]))) func = GL_ALWAYS; - if (!(func_ccw = CompareFunc(state->render_states[WINED3D_RS_CCW_STENCILFUNC]))) + if (!(func_ccw = gl_compare_func(state->render_states[WINED3D_RS_CCW_STENCILFUNC]))) func_ccw = GL_ALWAYS; ref = state->render_states[WINED3D_RS_STENCILREF]; mask = state->render_states[WINED3D_RS_STENCILMASK]; diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c index ea605c5bbbf..c9ee958684a 100644 --- a/dlls/wined3d/stateblock.c +++ b/dlls/wined3d/stateblock.c @@ -1134,8 +1134,8 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock) state->render_states[WINED3D_RS_SRCBLEND] = WINED3D_BLEND_ONE; state->render_states[WINED3D_RS_DESTBLEND] = WINED3D_BLEND_ZERO; state->render_states[WINED3D_RS_CULLMODE] = WINED3DCULL_CCW; - state->render_states[WINED3D_RS_ZFUNC] = WINED3DCMP_LESSEQUAL; - state->render_states[WINED3D_RS_ALPHAFUNC] = WINED3DCMP_ALWAYS; + state->render_states[WINED3D_RS_ZFUNC] = WINED3D_CMP_LESSEQUAL; + state->render_states[WINED3D_RS_ALPHAFUNC] = WINED3D_CMP_ALWAYS; state->render_states[WINED3D_RS_ALPHAREF] = 0; state->render_states[WINED3D_RS_DITHERENABLE] = FALSE; state->render_states[WINED3D_RS_ALPHABLENDENABLE] = FALSE; @@ -1158,7 +1158,7 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock) state->render_states[WINED3D_RS_STENCILPASS] = WINED3DSTENCILOP_KEEP; state->render_states[WINED3D_RS_STENCILREF] = 0; state->render_states[WINED3D_RS_STENCILMASK] = 0xffffffff; - state->render_states[WINED3D_RS_STENCILFUNC] = WINED3DCMP_ALWAYS; + state->render_states[WINED3D_RS_STENCILFUNC] = WINED3D_CMP_ALWAYS; state->render_states[WINED3D_RS_STENCILWRITEMASK] = 0xffffffff; state->render_states[WINED3D_RS_TEXTUREFACTOR] = 0xffffffff; state->render_states[WINED3D_RS_WRAP0] = 0; @@ -1229,7 +1229,7 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock) state->render_states[WINED3D_RS_CCW_STENCILFAIL] = WINED3DSTENCILOP_KEEP; state->render_states[WINED3D_RS_CCW_STENCILZFAIL] = WINED3DSTENCILOP_KEEP; state->render_states[WINED3D_RS_CCW_STENCILPASS] = WINED3DSTENCILOP_KEEP; - state->render_states[WINED3D_RS_CCW_STENCILFUNC] = WINED3DCMP_ALWAYS; + state->render_states[WINED3D_RS_CCW_STENCILFUNC] = WINED3D_CMP_ALWAYS; state->render_states[WINED3D_RS_COLORWRITEENABLE1] = 0x0000000f; state->render_states[WINED3D_RS_COLORWRITEENABLE2] = 0x0000000f; state->render_states[WINED3D_RS_COLORWRITEENABLE3] = 0x0000000f; diff --git a/dlls/wined3d/utils.c b/dlls/wined3d/utils.c index 206370186c2..10df1d10862 100644 --- a/dlls/wined3d/utils.c +++ b/dlls/wined3d/utils.c @@ -2496,22 +2496,6 @@ GLenum StencilOp(DWORD op) { } } -GLenum CompareFunc(DWORD func) { - switch ((WINED3DCMPFUNC)func) { - case WINED3DCMP_NEVER : return GL_NEVER; - case WINED3DCMP_LESS : return GL_LESS; - case WINED3DCMP_EQUAL : return GL_EQUAL; - case WINED3DCMP_LESSEQUAL : return GL_LEQUAL; - case WINED3DCMP_GREATER : return GL_GREATER; - case WINED3DCMP_NOTEQUAL : return GL_NOTEQUAL; - case WINED3DCMP_GREATEREQUAL : return GL_GEQUAL; - case WINED3DCMP_ALWAYS : return GL_ALWAYS; - default: - FIXME("Unrecognized WINED3DCMPFUNC value %d\n", func); - return 0; - } -} - BOOL is_invalid_op(const struct wined3d_state *state, int stage, WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3) { diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 82060268443..dd83d1ff4b2 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -2492,7 +2492,6 @@ const char *debug_surflocation(DWORD flag) DECLSPEC_HIDDEN; /* Routines for GL <-> D3D values */ GLenum StencilOp(DWORD op) DECLSPEC_HIDDEN; -GLenum CompareFunc(DWORD func) DECLSPEC_HIDDEN; BOOL is_invalid_op(const struct wined3d_state *state, int stage, WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3) DECLSPEC_HIDDEN; void set_tex_op_nvrc(const struct wined3d_gl_info *gl_info, const struct wined3d_state *state, diff --git a/include/wine/wined3d.h b/include/wine/wined3d.h index 2296d313f25..2005eaa2169 100644 --- a/include/wine/wined3d.h +++ b/include/wine/wined3d.h @@ -421,18 +421,17 @@ enum wined3d_vertex_blend_flags WINED3D_VBF_0WEIGHTS = 256, }; -typedef enum _WINED3DCMPFUNC +enum wined3d_cmp_func { - WINED3DCMP_NEVER = 1, - WINED3DCMP_LESS = 2, - WINED3DCMP_EQUAL = 3, - WINED3DCMP_LESSEQUAL = 4, - WINED3DCMP_GREATER = 5, - WINED3DCMP_NOTEQUAL = 6, - WINED3DCMP_GREATEREQUAL = 7, - WINED3DCMP_ALWAYS = 8, - WINED3DCMP_FORCE_DWORD = 0x7fffffff -} WINED3DCMPFUNC; + WINED3D_CMP_NEVER = 1, + WINED3D_CMP_LESS = 2, + WINED3D_CMP_EQUAL = 3, + WINED3D_CMP_LESSEQUAL = 4, + WINED3D_CMP_GREATER = 5, + WINED3D_CMP_NOTEQUAL = 6, + WINED3D_CMP_GREATEREQUAL = 7, + WINED3D_CMP_ALWAYS = 8, +}; typedef enum _WINED3DZBUFFERTYPE {