wined3d: Get rid of the WINED3DSTENCILOP typedef.

This commit is contained in:
Henri Verbeet 2012-01-03 23:06:55 +01:00 committed by Alexandre Julliard
parent 808e926783
commit fd8597b2bf
5 changed files with 48 additions and 44 deletions

View File

@ -801,6 +801,32 @@ static void renderstate_stencil_twosided(struct wined3d_context *context, GLint
checkGLcall("glStencilOp(...)");
}
static GLenum gl_stencil_op(enum wined3d_stencil_op op)
{
switch (op)
{
case WINED3D_STENCIL_OP_KEEP:
return GL_KEEP;
case WINED3D_STENCIL_OP_ZERO:
return GL_ZERO;
case WINED3D_STENCIL_OP_REPLACE:
return GL_REPLACE;
case WINED3D_STENCIL_OP_INCR_SAT:
return GL_INCR;
case WINED3D_STENCIL_OP_DECR_SAT:
return GL_DECR;
case WINED3D_STENCIL_OP_INVERT:
return GL_INVERT;
case WINED3D_STENCIL_OP_INCR:
return GL_INCR_WRAP_EXT;
case WINED3D_STENCIL_OP_DECR:
return GL_DECR_WRAP_EXT;
default:
FIXME("Unrecognized stencil op %#x.\n", op);
return GL_KEEP;
}
}
static void state_stencil(struct wined3d_context *context, const struct wined3d_state *state, DWORD state_id)
{
const struct wined3d_gl_info *gl_info = context->gl_info;
@ -833,12 +859,12 @@ static void state_stencil(struct wined3d_context *context, const struct wined3d_
func_ccw = GL_ALWAYS;
ref = state->render_states[WINED3D_RS_STENCILREF];
mask = state->render_states[WINED3D_RS_STENCILMASK];
stencilFail = StencilOp(state->render_states[WINED3D_RS_STENCILFAIL]);
depthFail = StencilOp(state->render_states[WINED3D_RS_STENCILZFAIL]);
stencilPass = StencilOp(state->render_states[WINED3D_RS_STENCILPASS]);
stencilFail_ccw = StencilOp(state->render_states[WINED3D_RS_CCW_STENCILFAIL]);
depthFail_ccw = StencilOp(state->render_states[WINED3D_RS_CCW_STENCILZFAIL]);
stencilPass_ccw = StencilOp(state->render_states[WINED3D_RS_CCW_STENCILPASS]);
stencilFail = gl_stencil_op(state->render_states[WINED3D_RS_STENCILFAIL]);
depthFail = gl_stencil_op(state->render_states[WINED3D_RS_STENCILZFAIL]);
stencilPass = gl_stencil_op(state->render_states[WINED3D_RS_STENCILPASS]);
stencilFail_ccw = gl_stencil_op(state->render_states[WINED3D_RS_CCW_STENCILFAIL]);
depthFail_ccw = gl_stencil_op(state->render_states[WINED3D_RS_CCW_STENCILZFAIL]);
stencilPass_ccw = gl_stencil_op(state->render_states[WINED3D_RS_CCW_STENCILPASS]);
TRACE("(onesided %d, twosided %d, ref %x, mask %x, "
"GL_FRONT: func: %x, fail %x, zfail %x, zpass %x "

View File

@ -1153,9 +1153,9 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock)
state->render_states[WINED3D_RS_EDGEANTIALIAS] = FALSE;
state->render_states[WINED3D_RS_RANGEFOGENABLE] = FALSE;
state->render_states[WINED3D_RS_STENCILENABLE] = FALSE;
state->render_states[WINED3D_RS_STENCILFAIL] = WINED3DSTENCILOP_KEEP;
state->render_states[WINED3D_RS_STENCILZFAIL] = WINED3DSTENCILOP_KEEP;
state->render_states[WINED3D_RS_STENCILPASS] = WINED3DSTENCILOP_KEEP;
state->render_states[WINED3D_RS_STENCILFAIL] = WINED3D_STENCIL_OP_KEEP;
state->render_states[WINED3D_RS_STENCILZFAIL] = WINED3D_STENCIL_OP_KEEP;
state->render_states[WINED3D_RS_STENCILPASS] = WINED3D_STENCIL_OP_KEEP;
state->render_states[WINED3D_RS_STENCILREF] = 0;
state->render_states[WINED3D_RS_STENCILMASK] = 0xffffffff;
state->render_states[WINED3D_RS_STENCILFUNC] = WINED3D_CMP_ALWAYS;
@ -1226,9 +1226,9 @@ void stateblock_init_default_state(struct wined3d_stateblock *stateblock)
state->render_states[WINED3D_RS_ADAPTIVETESS_W] = tmpfloat.d;
state->render_states[WINED3D_RS_ENABLEADAPTIVETESSELLATION] = FALSE;
state->render_states[WINED3D_RS_TWOSIDEDSTENCILMODE] = FALSE;
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_STENCILFAIL] = WINED3D_STENCIL_OP_KEEP;
state->render_states[WINED3D_RS_CCW_STENCILZFAIL] = WINED3D_STENCIL_OP_KEEP;
state->render_states[WINED3D_RS_CCW_STENCILPASS] = WINED3D_STENCIL_OP_KEEP;
state->render_states[WINED3D_RS_CCW_STENCILFUNC] = WINED3D_CMP_ALWAYS;
state->render_states[WINED3D_RS_COLORWRITEENABLE1] = 0x0000000f;
state->render_states[WINED3D_RS_COLORWRITEENABLE2] = 0x0000000f;

View File

@ -2477,25 +2477,6 @@ const char *debug_surflocation(DWORD flag) {
return wine_dbg_sprintf("%s", buf[0] ? buf + 3 : "0");
}
/*****************************************************************************
* Useful functions mapping GL <-> D3D values
*/
GLenum StencilOp(DWORD op) {
switch(op) {
case WINED3DSTENCILOP_KEEP : return GL_KEEP;
case WINED3DSTENCILOP_ZERO : return GL_ZERO;
case WINED3DSTENCILOP_REPLACE : return GL_REPLACE;
case WINED3DSTENCILOP_INCRSAT : return GL_INCR;
case WINED3DSTENCILOP_DECRSAT : return GL_DECR;
case WINED3DSTENCILOP_INVERT : return GL_INVERT;
case WINED3DSTENCILOP_INCR : return GL_INCR_WRAP_EXT;
case WINED3DSTENCILOP_DECR : return GL_DECR_WRAP_EXT;
default:
FIXME("Unrecognized stencil op %d\n", op);
return GL_KEEP;
}
}
BOOL is_invalid_op(const struct wined3d_state *state, int stage,
WINED3DTEXTUREOP op, DWORD arg1, DWORD arg2, DWORD arg3)
{

View File

@ -2515,8 +2515,6 @@ const char *debug_d3dtop(WINED3DTEXTUREOP d3dtop) DECLSPEC_HIDDEN;
void dump_color_fixup_desc(struct color_fixup_desc fixup) DECLSPEC_HIDDEN;
const char *debug_surflocation(DWORD flag) DECLSPEC_HIDDEN;
/* Routines for GL <-> D3D values */
GLenum StencilOp(DWORD op) 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,

View File

@ -469,18 +469,17 @@ enum wined3d_cull
WINED3D_CULL_CCW = 3,
};
typedef enum _WINED3DSTENCILOP
enum wined3d_stencil_op
{
WINED3DSTENCILOP_KEEP = 1,
WINED3DSTENCILOP_ZERO = 2,
WINED3DSTENCILOP_REPLACE = 3,
WINED3DSTENCILOP_INCRSAT = 4,
WINED3DSTENCILOP_DECRSAT = 5,
WINED3DSTENCILOP_INVERT = 6,
WINED3DSTENCILOP_INCR = 7,
WINED3DSTENCILOP_DECR = 8,
WINED3DSTENCILOP_FORCE_DWORD = 0x7fffffff
} WINED3DSTENCILOP;
WINED3D_STENCIL_OP_KEEP = 1,
WINED3D_STENCIL_OP_ZERO = 2,
WINED3D_STENCIL_OP_REPLACE = 3,
WINED3D_STENCIL_OP_INCR_SAT = 4,
WINED3D_STENCIL_OP_DECR_SAT = 5,
WINED3D_STENCIL_OP_INVERT = 6,
WINED3D_STENCIL_OP_INCR = 7,
WINED3D_STENCIL_OP_DECR = 8,
};
typedef enum _WINED3DMATERIALCOLORSOURCE
{