41560be5288db45e5b81507213176b0109c85377
6 #include "sp_context.h"
7 #include "sp_headers.h"
8 #include "sp_quad_pipe.h"
9 #include "pipe/p_defines.h"
10 #include "util/u_memory.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_value
;
18 unsigned passMask
= 0x0, j
;
19 const uint cbuf
= 0; /* only output[0].alpha is tested */
20 const float *aaaa
= quad
->output
.color
[cbuf
][3];
22 switch (softpipe
->depth_stencil
->alpha
.func
) {
27 * If mask were an array [4] we could do this SIMD-style:
28 * passMask = (quad->outputs.color[0][3] <= vec4(ref));
30 for (j
= 0; j
< QUAD_SIZE
; j
++) {
37 for (j
= 0; j
< QUAD_SIZE
; j
++) {
43 case PIPE_FUNC_LEQUAL
:
44 for (j
= 0; j
< QUAD_SIZE
; j
++) {
50 case PIPE_FUNC_GREATER
:
51 for (j
= 0; j
< QUAD_SIZE
; j
++) {
57 case PIPE_FUNC_NOTEQUAL
:
58 for (j
= 0; j
< QUAD_SIZE
; j
++) {
64 case PIPE_FUNC_GEQUAL
:
65 for (j
= 0; j
< QUAD_SIZE
; j
++) {
71 case PIPE_FUNC_ALWAYS
:
78 quad
->inout
.mask
&= passMask
;
81 qs
->next
->run(qs
->next
, quad
);
85 static void alpha_test_begin(struct quad_stage
*qs
)
87 qs
->next
->begin(qs
->next
);
91 static void alpha_test_destroy(struct quad_stage
*qs
)
98 sp_quad_alpha_test_stage( struct softpipe_context
*softpipe
)
100 struct quad_stage
*stage
= CALLOC_STRUCT(quad_stage
);
102 stage
->softpipe
= softpipe
;
103 stage
->begin
= alpha_test_begin
;
104 stage
->run
= alpha_test_quad
;
105 stage
->destroy
= alpha_test_destroy
;