Merge branch '7.8' into master
[mesa.git] / src / gallium / drivers / svga / svga_state_rss.c
index 15ead98483bb135483484098f36992efc8f7a819..b7195d246bc87c0b41b27aeb73b6948f964d69de 100644 (file)
@@ -26,7 +26,6 @@
 #include "util/u_inlines.h"
 #include "pipe/p_defines.h"
 #include "util/u_math.h"
-#include "util/u_pack_color.h"
 
 #include "svga_context.h"
 #include "svga_state.h"
@@ -102,16 +101,15 @@ static int emit_rss( struct svga_context *svga,
    }
 
    if (dirty & SVGA_NEW_BLEND_COLOR) {
-      union util_color uc;
-      ubyte r = float_to_ubyte(svga->curr.blend_color.color[0]);
-      ubyte g = float_to_ubyte(svga->curr.blend_color.color[1]);
-      ubyte b = float_to_ubyte(svga->curr.blend_color.color[2]);
-      ubyte a = float_to_ubyte(svga->curr.blend_color.color[3]);
+      uint32 color;
+      uint32 r = float_to_ubyte(svga->curr.blend_color.color[0]);
+      uint32 g = float_to_ubyte(svga->curr.blend_color.color[1]);
+      uint32 b = float_to_ubyte(svga->curr.blend_color.color[2]);
+      uint32 a = float_to_ubyte(svga->curr.blend_color.color[3]);
 
-      util_pack_color_ub( r, g, b, a,
-                          PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
+      color = (a << 24) | (r << 16) | (g << 8) | b;
 
-      EMIT_RS( svga, uc.ui, BLENDCOLOR, fail );
+      EMIT_RS( svga, color, BLENDCOLOR, fail );
    }
 
    if (dirty & (SVGA_NEW_DEPTH_STENCIL | SVGA_NEW_RAST)) {
@@ -193,15 +191,24 @@ static int emit_rss( struct svga_context *svga,
       EMIT_RS( svga, svga->curr.stencil_ref.ref_value[0], STENCILREF, fail );
    }
 
-   if (dirty & SVGA_NEW_RAST)
+   if (dirty & (SVGA_NEW_RAST | SVGA_NEW_NEED_PIPELINE))
    {
       const struct svga_rasterizer_state *curr = svga->curr.rast; 
+      unsigned cullmode = curr->cullmode;
 
       /* Shademode: still need to rearrange index list to move
        * flat-shading PV first vertex.
        */
       EMIT_RS( svga, curr->shademode, SHADEMODE, fail );
-      EMIT_RS( svga, curr->cullmode, CULLMODE, fail );
+
+      /* Don't do culling while the software pipeline is active.  It
+       * does it for us, and additionally introduces potentially
+       * back-facing triangles.
+       */
+      if (svga->state.sw.need_pipeline)
+         cullmode = SVGA3D_FACE_NONE;
+
+      EMIT_RS( svga, cullmode, CULLMODE, fail );
       EMIT_RS( svga, curr->scissortestenable, SCISSORTESTENABLE, fail );
       EMIT_RS( svga, curr->multisampleantialias, MULTISAMPLEANTIALIAS, fail );
       EMIT_RS( svga, curr->lastpixel, LASTPIXEL, fail );