Commit 1ec60967 authored by Henri Verbeet's avatar Henri Verbeet Committed by Alexandre Julliard

wined3d: Get rid of the WINED3DCMPFUNC typedef.

parent b79dc388
......@@ -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];
......
......@@ -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;
......
......@@ -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)
{
......
......@@ -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,
......
......@@ -421,18 +421,17 @@ enum wined3d_vertex_blend_flags
WINED3D_VBF_0WEIGHTS = 256,
};
typedef enum _WINED3DCMPFUNC
{
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;
enum wined3d_cmp_func
{
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
{
......
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