- if (hwtnl->api_fillmode != PIPE_POLYGON_MODE_FILL &&
- prim >= PIPE_PRIM_TRIANGLES)
- {
- gen_type = u_unfilled_generator( prim,
- start,
- count,
- hwtnl->api_fillmode,
- &gen_prim,
- &gen_size,
- &gen_nr,
- &gen_func );
+ if (svga->curr.rast->templ.fill_front !=
+ svga->curr.rast->templ.fill_back) {
+ assert(hwtnl->api_fillmode == PIPE_POLYGON_MODE_FILL);
+ }
+
+ if (svga->curr.rast->templ.flatshade &&
+ svga_fs_variant(svga->state.hw_draw.fs)->constant_color_output) {
+ /* The fragment color is a constant, not per-vertex so the whole
+ * primitive will be the same color (except for possible blending).
+ * We can ignore the current provoking vertex state and use whatever
+ * the hardware wants.
+ */
+ api_pv = hwtnl->hw_pv;
+
+ if (hwtnl->api_fillmode == PIPE_POLYGON_MODE_FILL) {
+ /* Do some simple primitive conversions to avoid index buffer
+ * generation below. Note that polygons and quads are not directly
+ * supported by the svga device. Also note, we can only do this
+ * for flat/constant-colored rendering because of provoking vertex.
+ */
+ if (prim == PIPE_PRIM_POLYGON) {
+ prim = PIPE_PRIM_TRIANGLE_FAN;
+ }
+ else if (prim == PIPE_PRIM_QUADS && count == 4) {
+ prim = PIPE_PRIM_TRIANGLE_FAN;
+ }
+ }
+ }
+
+ if (svga_need_unfilled_fallback(hwtnl, prim)) {
+ /* Convert unfilled polygons into points, lines, triangles */
+ gen_type = u_unfilled_generator(prim,
+ start,
+ count,
+ hwtnl->api_fillmode,
+ &gen_prim,
+ &gen_size, &gen_nr, &gen_func);