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