Merge branch 'mesa_7_7_branch'
[mesa.git] / src / gallium / drivers / i965 / brw_swtnl.c
1
2 #include "brw_context.h"
3 #include "brw_pipe_rast.h"
4
5
6 static GLboolean need_swtnl( struct brw_context *brw )
7 {
8 const struct pipe_rasterizer_state *rast = &brw->curr.rast->templ;
9
10 /* If we don't require strict OpenGL conformance, never
11 * use fallbacks. If we're forcing fallbacks, always
12 * use fallfacks.
13 */
14 if (brw->flags.no_swtnl)
15 return FALSE;
16
17 if (brw->flags.force_swtnl)
18 return TRUE;
19
20 /* Exceeding hw limits on number of VS inputs?
21 */
22 if (brw->curr.num_vertex_elements == 0 ||
23 brw->curr.num_vertex_elements >= BRW_VEP_MAX) {
24 return TRUE;
25 }
26
27 /* Position array with zero stride?
28 *
29 * XXX: position isn't always at zero...
30 * XXX: eliminate zero-stride arrays
31 */
32 {
33 int ve0_vb = brw->curr.vertex_element[0].vertex_buffer_index;
34
35 if (brw->curr.vertex_buffer[ve0_vb].stride == 0)
36 return TRUE;
37 }
38
39 /* XXX: short-circuit
40 */
41 return FALSE;
42
43 if (brw->reduced_primitive == PIPE_PRIM_TRIANGLES) {
44 if (rast->poly_smooth)
45 return TRUE;
46
47 }
48
49 if (brw->reduced_primitive == PIPE_PRIM_LINES ||
50 (brw->reduced_primitive == PIPE_PRIM_TRIANGLES &&
51 (rast->fill_cw == PIPE_POLYGON_MODE_LINE ||
52 rast->fill_ccw == PIPE_POLYGON_MODE_LINE)))
53 {
54 /* BRW hardware will do AA lines, but they are non-conformant it
55 * seems. TBD whether we keep this fallback:
56 */
57 if (rast->line_smooth)
58 return TRUE;
59
60 /* XXX: was a fallback in mesa (gs doesn't get enough
61 * information to know when to reset stipple counter), but there
62 * must be a way around it.
63 */
64 if (rast->line_stipple_enable &&
65 (brw->reduced_primitive == PIPE_PRIM_TRIANGLES ||
66 brw->primitive == PIPE_PRIM_LINE_LOOP ||
67 brw->primitive == PIPE_PRIM_LINE_STRIP))
68 return TRUE;
69 }
70
71
72 if (brw->reduced_primitive == PIPE_PRIM_POINTS ||
73 (brw->reduced_primitive == PIPE_PRIM_TRIANGLES &&
74 (rast->fill_cw == PIPE_POLYGON_MODE_POINT ||
75 rast->fill_ccw == PIPE_POLYGON_MODE_POINT)))
76 {
77 if (rast->point_smooth)
78 return TRUE;
79 }
80
81 /* BRW hardware doesn't handle CLAMP texturing correctly;
82 * brw_wm_sampler_state:translate_wrap_mode() treats CLAMP
83 * as CLAMP_TO_EDGE instead. If we're using CLAMP, and
84 * we want strict conformance, force the fallback.
85 *
86 * XXX: need a workaround for this.
87 */
88
89 /* Nothing stopping us from the fast path now */
90 return FALSE;
91 }
92
93
94
95