6 #include "sp_context.h"
7 #include "sp_headers.h"
9 #include "pipe/p_defines.h"
10 #include "pipe/p_util.h"
14 alpha_test_quad(struct quad_stage
*qs
, struct quad_header
*quad
)
16 struct softpipe_context
*softpipe
= qs
->softpipe
;
17 const float ref
= softpipe
->depth_stencil
->alpha
.ref
;
18 unsigned passMask
= 0x0, j
;
19 const uint cbuf
= 0; /* only output[0].alpha is tested */
20 const float *aaaa
= quad
->outputs
.color
[cbuf
][3];
22 switch (softpipe
->depth_stencil
->alpha
.func
) {
28 * If mask were an array [4] we could do this SIMD-style:
29 * passMask = (quad->outputs.color[0][3] <= vec4(ref));
31 for (j
= 0; j
< QUAD_SIZE
; j
++) {
38 for (j
= 0; j
< QUAD_SIZE
; j
++) {
44 case PIPE_FUNC_LEQUAL
:
45 for (j
= 0; j
< QUAD_SIZE
; j
++) {
51 case PIPE_FUNC_GREATER
:
52 for (j
= 0; j
< QUAD_SIZE
; j
++) {
58 case PIPE_FUNC_NOTEQUAL
:
59 for (j
= 0; j
< QUAD_SIZE
; j
++) {
65 case PIPE_FUNC_GEQUAL
:
66 for (j
= 0; j
< QUAD_SIZE
; j
++) {
72 case PIPE_FUNC_ALWAYS
:
79 quad
->mask
&= passMask
;
82 qs
->next
->run(qs
->next
, quad
);
86 static void alpha_test_begin(struct quad_stage
*qs
)
88 qs
->next
->begin(qs
->next
);
92 static void alpha_test_destroy(struct quad_stage
*qs
)
99 sp_quad_alpha_test_stage( struct softpipe_context
*softpipe
)
101 struct quad_stage
*stage
= CALLOC_STRUCT(quad_stage
);
103 stage
->softpipe
= softpipe
;
104 stage
->begin
= alpha_test_begin
;
105 stage
->run
= alpha_test_quad
;
106 stage
->destroy
= alpha_test_destroy
;