Go to the source code of this file.
Functions | |
GLuint | st_compare_func_to_pipe (GLenum func) |
Convert an OpenGL compare mode to a pipe tokens. | |
static GLuint | gl_stencil_op_to_pipe (GLenum func) |
Convert GLenum stencil op tokens to pipe tokens. | |
static void | update_depth_stencil_alpha (struct st_context *st) |
Variables | |
struct st_tracked_state | st_update_depth_stencil_alpha |
static GLuint gl_stencil_op_to_pipe | ( | GLenum | func | ) | [static] |
Convert GLenum stencil op tokens to pipe tokens.
Definition at line 68 of file st_atom_depth.c.
References assert, PIPE_STENCIL_OP_DECR, PIPE_STENCIL_OP_DECR_WRAP, PIPE_STENCIL_OP_INCR, PIPE_STENCIL_OP_INCR_WRAP, PIPE_STENCIL_OP_INVERT, PIPE_STENCIL_OP_KEEP, PIPE_STENCIL_OP_REPLACE, and PIPE_STENCIL_OP_ZERO.
00069 { 00070 switch (func) { 00071 case GL_KEEP: 00072 return PIPE_STENCIL_OP_KEEP; 00073 case GL_ZERO: 00074 return PIPE_STENCIL_OP_ZERO; 00075 case GL_REPLACE: 00076 return PIPE_STENCIL_OP_REPLACE; 00077 case GL_INCR: 00078 return PIPE_STENCIL_OP_INCR; 00079 case GL_DECR: 00080 return PIPE_STENCIL_OP_DECR; 00081 case GL_INCR_WRAP: 00082 return PIPE_STENCIL_OP_INCR_WRAP; 00083 case GL_DECR_WRAP: 00084 return PIPE_STENCIL_OP_DECR_WRAP; 00085 case GL_INVERT: 00086 return PIPE_STENCIL_OP_INVERT; 00087 default: 00088 assert("invalid GL token in gl_stencil_op_to_pipe()" == NULL); 00089 return 0; 00090 } 00091 }
GLuint st_compare_func_to_pipe | ( | GLenum | func | ) |
Convert an OpenGL compare mode to a pipe tokens.
Definition at line 47 of file st_atom_depth.c.
References assert, PIPE_FUNC_ALWAYS, PIPE_FUNC_EQUAL, PIPE_FUNC_GEQUAL, PIPE_FUNC_GREATER, PIPE_FUNC_LEQUAL, PIPE_FUNC_LESS, PIPE_FUNC_NEVER, and PIPE_FUNC_NOTEQUAL.
00048 { 00049 /* Same values, just biased */ 00050 assert(PIPE_FUNC_NEVER == GL_NEVER - GL_NEVER); 00051 assert(PIPE_FUNC_LESS == GL_LESS - GL_NEVER); 00052 assert(PIPE_FUNC_EQUAL == GL_EQUAL - GL_NEVER); 00053 assert(PIPE_FUNC_LEQUAL == GL_LEQUAL - GL_NEVER); 00054 assert(PIPE_FUNC_GREATER == GL_GREATER - GL_NEVER); 00055 assert(PIPE_FUNC_NOTEQUAL == GL_NOTEQUAL - GL_NEVER); 00056 assert(PIPE_FUNC_GEQUAL == GL_GEQUAL - GL_NEVER); 00057 assert(PIPE_FUNC_ALWAYS == GL_ALWAYS - GL_NEVER); 00058 assert(func >= GL_NEVER); 00059 assert(func <= GL_ALWAYS); 00060 return func - GL_NEVER; 00061 }
static void update_depth_stencil_alpha | ( | struct st_context * | st | ) | [static] |
Definition at line 94 of file st_atom_depth.c.
References pipe_depth_stencil_alpha_state::alpha, st_context::cso_context, cso_set_depth_stencil_alpha(), st_context::ctx, pipe_depth_stencil_alpha_state::depth, st_context::depth_stencil, pipe_alpha_state::enabled, pipe_stencil_state::enabled, pipe_depth_state::enabled, pipe_stencil_state::fail_op, pipe_alpha_state::func, pipe_stencil_state::func, pipe_depth_state::func, gl_stencil_op_to_pipe(), pipe_depth_state::occlusion_count, pipe_alpha_state::ref, pipe_stencil_state::ref_value, st_compare_func_to_pipe(), st_context::state, pipe_depth_stencil_alpha_state::stencil, pipe_stencil_state::value_mask, pipe_stencil_state::write_mask, pipe_depth_state::writemask, pipe_stencil_state::zfail_op, and pipe_stencil_state::zpass_op.
00095 { 00096 struct pipe_depth_stencil_alpha_state *dsa = &st->state.depth_stencil; 00097 00098 memset(dsa, 0, sizeof(*dsa)); 00099 00100 dsa->depth.enabled = st->ctx->Depth.Test; 00101 dsa->depth.writemask = st->ctx->Depth.Mask; 00102 dsa->depth.func = st_compare_func_to_pipe(st->ctx->Depth.Func); 00103 00104 if (st->ctx->Query.CurrentOcclusionObject && 00105 st->ctx->Query.CurrentOcclusionObject->Active) 00106 dsa->depth.occlusion_count = 1; 00107 00108 if (st->ctx->Stencil.Enabled && st->ctx->Visual.stencilBits > 0) { 00109 dsa->stencil[0].enabled = 1; 00110 dsa->stencil[0].func = st_compare_func_to_pipe(st->ctx->Stencil.Function[0]); 00111 dsa->stencil[0].fail_op = gl_stencil_op_to_pipe(st->ctx->Stencil.FailFunc[0]); 00112 dsa->stencil[0].zfail_op = gl_stencil_op_to_pipe(st->ctx->Stencil.ZFailFunc[0]); 00113 dsa->stencil[0].zpass_op = gl_stencil_op_to_pipe(st->ctx->Stencil.ZPassFunc[0]); 00114 dsa->stencil[0].ref_value = st->ctx->Stencil.Ref[0] & 0xff; 00115 dsa->stencil[0].value_mask = st->ctx->Stencil.ValueMask[0] & 0xff; 00116 dsa->stencil[0].write_mask = st->ctx->Stencil.WriteMask[0] & 0xff; 00117 00118 if (st->ctx->Stencil._TestTwoSide) { 00119 dsa->stencil[1].enabled = 1; 00120 dsa->stencil[1].func = st_compare_func_to_pipe(st->ctx->Stencil.Function[1]); 00121 dsa->stencil[1].fail_op = gl_stencil_op_to_pipe(st->ctx->Stencil.FailFunc[1]); 00122 dsa->stencil[1].zfail_op = gl_stencil_op_to_pipe(st->ctx->Stencil.ZFailFunc[1]); 00123 dsa->stencil[1].zpass_op = gl_stencil_op_to_pipe(st->ctx->Stencil.ZPassFunc[1]); 00124 dsa->stencil[1].ref_value = st->ctx->Stencil.Ref[1] & 0xff; 00125 dsa->stencil[1].value_mask = st->ctx->Stencil.ValueMask[1] & 0xff; 00126 dsa->stencil[1].write_mask = st->ctx->Stencil.WriteMask[1] & 0xff; 00127 } 00128 else { 00129 dsa->stencil[1] = dsa->stencil[0]; 00130 dsa->stencil[1].enabled = 0; 00131 } 00132 } 00133 00134 if (st->ctx->Color.AlphaEnabled) { 00135 dsa->alpha.enabled = 1; 00136 dsa->alpha.func = st_compare_func_to_pipe(st->ctx->Color.AlphaFunc); 00137 dsa->alpha.ref = st->ctx->Color.AlphaRef; 00138 } 00139 00140 cso_set_depth_stencil_alpha(st->cso_context, dsa); 00141 }
Initial value:
{ "st_update_depth_stencil", { (_NEW_DEPTH|_NEW_STENCIL|_NEW_COLOR), 0, }, update_depth_stencil_alpha }
Definition at line 144 of file st_atom_depth.c.