summaryrefslogtreecommitdiff
path: root/src/gallium/drivers/i965/brw_swtnl.c
blob: f96301e99e6d04896c8207f051b513abc511401b (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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95

#include "brw_context.h"
#include "brw_pipe_rast.h"


#if 0

static GLboolean need_swtnl( struct brw_context *brw )
{
   const struct pipe_rasterizer_state *rast = &brw->curr.rast->templ;

   /* If we don't require strict OpenGL conformance, never 
    * use fallbacks.  If we're forcing fallbacks, always
    * use fallfacks.
    */
   if (brw->flags.no_swtnl)
      return FALSE;

   if (brw->flags.force_swtnl)
      return TRUE;

   /* Exceeding hw limits on number of VS inputs?
    */
   if (brw->curr.num_vertex_elements == 0 ||
       brw->curr.num_vertex_elements >= BRW_VEP_MAX) {
      return TRUE;
   }

   /* Position array with zero stride?
    *
    * XXX: position isn't always at zero...
    * XXX: eliminate zero-stride arrays
    */
   {
      int ve0_vb = brw->curr.vertex_element[0].vertex_buffer_index;
      
      if (brw->curr.vertex_buffer[ve0_vb].stride == 0)
	 return TRUE;
   }

   /* XXX: short-circuit
    */
   return FALSE;

   if (brw->reduced_primitive == PIPE_PRIM_TRIANGLES) {
      if (rast->poly_smooth)
	 return TRUE;

   }
   
   if (brw->reduced_primitive == PIPE_PRIM_LINES ||
       (brw->reduced_primitive == PIPE_PRIM_TRIANGLES &&
	(rast->fill_cw == PIPE_POLYGON_MODE_LINE ||
	 rast->fill_ccw == PIPE_POLYGON_MODE_LINE)))
   {
      /* BRW hardware will do AA lines, but they are non-conformant it
       * seems.  TBD whether we keep this fallback:
       */
      if (rast->line_smooth)
	 return TRUE;

      /* XXX: was a fallback in mesa (gs doesn't get enough
       * information to know when to reset stipple counter), but there
       * must be a way around it.
       */
      if (rast->line_stipple_enable &&
	  (brw->reduced_primitive == PIPE_PRIM_TRIANGLES ||
	   brw->primitive == PIPE_PRIM_LINE_LOOP || 
	   brw->primitive == PIPE_PRIM_LINE_STRIP))
	 return TRUE;
   }

   
   if (brw->reduced_primitive == PIPE_PRIM_POINTS ||
       (brw->reduced_primitive == PIPE_PRIM_TRIANGLES &&
	(rast->fill_cw == PIPE_POLYGON_MODE_POINT ||
	 rast->fill_ccw == PIPE_POLYGON_MODE_POINT)))
   {
      if (rast->point_smooth)
	 return TRUE;
   }

   /* BRW hardware doesn't handle CLAMP texturing correctly;
    * brw_wm_sampler_state:translate_wrap_mode() treats CLAMP
    * as CLAMP_TO_EDGE instead.  If we're using CLAMP, and
    * we want strict conformance, force the fallback.
    *
    * XXX: need a workaround for this.
    */
      
   /* Nothing stopping us from the fast path now */
   return FALSE;
}

#endif