summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/i965/brw_pipe_rast.c
blob: ff64dbd48d4912ce9b9c550f1757878feea65cab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46

static void
calculate_clip_key_rast()
{
   if (BRW_IS_IGDNG(brw))
       key.clip_mode = BRW_CLIPMODE_KERNEL_CLIP;
   else
       key.clip_mode = BRW_CLIPMODE_NORMAL;

   key.do_flat_shading = brw->rast->templ.flatshade;

   if (key.primitive == PIPE_PRIM_TRIANGLES) {
      if (brw->rast->templ.cull_mode = PIPE_WINDING_BOTH)
	 key.clip_mode = BRW_CLIPMODE_REJECT_ALL;
      else {
	 key.fill_ccw = CLIP_CULL;
	 key.fill_cw = CLIP_CULL;

	 if (!(brw->rast->templ.cull_mode & PIPE_WINDING_CCW)) {
	    key.fill_ccw = translate_fill(brw->rast.fill_ccw);
	 }

	 if (!(brw->rast->templ.cull_mode & PIPE_WINDING_CW)) {
	    key.fill_cw = translate_fill(brw->rast.fill_cw);
	 }

	 if (key.fill_cw != CLIP_FILL ||
	     key.fill_ccw != CLIP_FILL) {
	    key.do_unfilled = 1;
	    key.clip_mode = BRW_CLIPMODE_CLIP_NON_REJECTED;
	 }

	 key.offset_ccw = brw->rast.templ.offset_ccw;
	 key.offset_cw = brw->rast.templ.offset_cw;

	 if (brw->rast.templ.light_twoside &&
	     key.fill_cw != CLIP_CULL) 
	    key.copy_bfc_cw = 1;

	 if (brw->rast.templ.light_twoside &&
	     key.fill_ccw != CLIP_CULL) 
	    key.copy_bfc_ccw = 1;
	 }
      }
   }
}