Subversion Repositories Kolibri OS

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
3770 Serge 1
 
2
 * quad polygon stipple stage
3
 */
4
5
 
6
#include "sp_quad.h"
7
#include "sp_quad_pipe.h"
8
#include "pipe/p_defines.h"
9
#include "util/u_memory.h"
10
11
 
12
 
13
 * Apply polygon stipple to quads produced by triangle rasterization
14
 */
15
static void
16
stipple_quad(struct quad_stage *qs, struct quad_header *quads[], unsigned nr)
17
{
18
   static const uint bit31 = 1 << 31;
19
   static const uint bit30 = 1 << 30;
20
   unsigned pass = nr;
21
22
 
23
   unsigned q;
24
25
 
26
27
 
28
      struct quad_header *quad = quads[q];
29
30
 
31
      const int y0 = quad->input.y0;
32
      const int y1 = y0 + 1;
33
      const uint stipple0 = softpipe->poly_stipple.stipple[y0 % 32];
34
      const uint stipple1 = softpipe->poly_stipple.stipple[y1 % 32];
35
36
 
37
      if ((stipple0 & (bit31 >> col0)) == 0)
38
         quad->inout.mask &= ~MASK_TOP_LEFT;
39
40
 
41
         quad->inout.mask &= ~MASK_TOP_RIGHT;
42
43
 
44
         quad->inout.mask &= ~MASK_BOTTOM_LEFT;
45
46
 
47
         quad->inout.mask &= ~MASK_BOTTOM_RIGHT;
48
49
 
50
         quads[pass++] = quad;
51
   }
52
53
 
54
}
55
56
 
57
 
58
{
59
   qs->next->begin(qs->next);
60
}
61
62
 
63
 
64
{
65
   FREE( qs );
66
}
67
68
 
69
 
70
sp_quad_polygon_stipple_stage( struct softpipe_context *softpipe )
71
{
72
   struct quad_stage *stage = CALLOC_STRUCT(quad_stage);
73
74
 
75
   stage->begin = stipple_begin;
76
   stage->run = stipple_quad;
77
   stage->destroy = stipple_destroy;
78
79
 
80
}
81