sp_quad_alpha_test.c File Reference

Include dependency graph for sp_quad_alpha_test.c:

Go to the source code of this file.

Functions

static void alpha_test_quad (struct quad_stage *qs, struct quad_header *quad)
 quad alpha test
static void alpha_test_begin (struct quad_stage *qs)
static void alpha_test_destroy (struct quad_stage *qs)
struct quad_stagesp_quad_alpha_test_stage (struct softpipe_context *softpipe)


Function Documentation

static void alpha_test_begin ( struct quad_stage qs  )  [static]

Definition at line 85 of file sp_quad_alpha_test.c.

References quad_stage::begin, and quad_stage::next.

00086 {
00087    qs->next->begin(qs->next);
00088 }

static void alpha_test_destroy ( struct quad_stage qs  )  [static]

Definition at line 91 of file sp_quad_alpha_test.c.

References FREE.

00092 {
00093    FREE( qs );
00094 }

static void alpha_test_quad ( struct quad_stage qs,
struct quad_header quad 
) [static]

quad alpha test

Definition at line 14 of file sp_quad_alpha_test.c.

References pipe_depth_stencil_alpha_state::alpha, assert, quad_header_output::color, softpipe_context::depth_stencil, pipe_alpha_state::func, quad_header::inout, quad_header_inout::mask, MASK_ALL, quad_stage::next, quad_header::output, PIPE_FUNC_ALWAYS, PIPE_FUNC_EQUAL, PIPE_FUNC_GEQUAL, PIPE_FUNC_GREATER, PIPE_FUNC_LEQUAL, PIPE_FUNC_LESS, PIPE_FUNC_NEVER, PIPE_FUNC_NOTEQUAL, QUAD_SIZE, pipe_alpha_state::ref, quad_stage::run, and quad_stage::softpipe.

00015 {
00016    struct softpipe_context *softpipe = qs->softpipe;
00017    const float ref = softpipe->depth_stencil->alpha.ref;
00018    unsigned passMask = 0x0, j;
00019    const uint cbuf = 0; /* only output[0].alpha is tested */
00020    const float *aaaa = quad->output.color[cbuf][3];
00021 
00022    switch (softpipe->depth_stencil->alpha.func) {
00023    case PIPE_FUNC_NEVER:
00024       break;
00025    case PIPE_FUNC_LESS:
00026       /*
00027        * If mask were an array [4] we could do this SIMD-style:
00028        * passMask = (quad->outputs.color[0][3] <= vec4(ref));
00029        */
00030       for (j = 0; j < QUAD_SIZE; j++) {
00031          if (aaaa[j] < ref) {
00032             passMask |= (1 << j);
00033          }
00034       }
00035       break;
00036    case PIPE_FUNC_EQUAL:
00037       for (j = 0; j < QUAD_SIZE; j++) {
00038          if (aaaa[j] == ref) {
00039             passMask |= (1 << j);
00040          }
00041       }
00042       break;
00043    case PIPE_FUNC_LEQUAL:
00044       for (j = 0; j < QUAD_SIZE; j++) {
00045          if (aaaa[j] <= ref) {
00046             passMask |= (1 << j);
00047          }
00048       }
00049       break;
00050    case PIPE_FUNC_GREATER:
00051       for (j = 0; j < QUAD_SIZE; j++) {
00052          if (aaaa[j] > ref) {
00053             passMask |= (1 << j);
00054          }
00055       }
00056       break;
00057    case PIPE_FUNC_NOTEQUAL:
00058       for (j = 0; j < QUAD_SIZE; j++) {
00059          if (aaaa[j] != ref) {
00060             passMask |= (1 << j);
00061          }
00062       }
00063       break;
00064    case PIPE_FUNC_GEQUAL:
00065       for (j = 0; j < QUAD_SIZE; j++) {
00066          if (aaaa[j] >= ref) {
00067             passMask |= (1 << j);
00068          }
00069       }
00070       break;
00071    case PIPE_FUNC_ALWAYS:
00072       passMask = MASK_ALL;
00073       break;
00074    default:
00075       assert(0);
00076    }
00077 
00078    quad->inout.mask &= passMask;
00079 
00080    if (quad->inout.mask)
00081       qs->next->run(qs->next, quad);
00082 }

struct quad_stage* sp_quad_alpha_test_stage ( struct softpipe_context softpipe  )  [read]

Definition at line 98 of file sp_quad_alpha_test.c.

References alpha_test_begin(), alpha_test_destroy(), alpha_test_quad(), quad_stage::begin, CALLOC_STRUCT, quad_stage::destroy, quad_stage::run, and quad_stage::softpipe.

00099 {
00100    struct quad_stage *stage = CALLOC_STRUCT(quad_stage);
00101 
00102    stage->softpipe = softpipe;
00103    stage->begin = alpha_test_begin;
00104    stage->run = alpha_test_quad;
00105    stage->destroy = alpha_test_destroy;
00106 
00107    return stage;
00108 }


Generated on Tue Sep 29 06:25:40 2009 for Gallium3D by  doxygen 1.5.4