r600g: avoid dynamic allocation of states
[mesa.git] / src / gallium / drivers / svga / svga_pipe_clear.c
index 409b3b41cbc9d142ef976d468ea196599cee58d3..41f239c1a85ce63b10baa372fee01cf68577eedf 100644 (file)
@@ -31,7 +31,7 @@
 
 #include "svga_context.h"
 #include "svga_state.h"
-#include "svga_screen_texture.h"
+#include "svga_surface.h"
 
 
 static enum pipe_error
@@ -54,16 +54,18 @@ try_clear(struct svga_context *svga,
 
    if ((buffers & PIPE_CLEAR_COLOR) && fb->cbufs[0]) {
       flags |= SVGA3D_CLEAR_COLOR;
-      util_pack_color(rgba, PIPE_FORMAT_A8R8G8B8_UNORM, &uc);
+      util_pack_color(rgba, PIPE_FORMAT_B8G8R8A8_UNORM, &uc);
 
       rect.w = fb->cbufs[0]->width;
       rect.h = fb->cbufs[0]->height;
    }
 
    if ((buffers & PIPE_CLEAR_DEPTHSTENCIL) && fb->zsbuf) {
-      flags |= SVGA3D_CLEAR_DEPTH;
+      if (buffers & PIPE_CLEAR_DEPTH)
+         flags |= SVGA3D_CLEAR_DEPTH;
 
-      if (svga->curr.framebuffer.zsbuf->format == PIPE_FORMAT_Z24S8_UNORM)
+      if ((svga->curr.framebuffer.zsbuf->format == PIPE_FORMAT_S8_USCALED_Z24_UNORM) &&
+          (buffers & PIPE_CLEAR_STENCIL))
          flags |= SVGA3D_CLEAR_STENCIL;
 
       rect.w = MAX2(rect.w, fb->zsbuf->width);
@@ -100,7 +102,7 @@ svga_clear(struct pipe_context *pipe, unsigned buffers, const float *rgba,
 {
    struct svga_context *svga = svga_context( pipe );
    int ret;
-   
+
    if (buffers & PIPE_CLEAR_COLOR)
       SVGA_DBG(DEBUG_DMA, "clear sid %p\n",
                svga_surface(svga->curr.framebuffer.cbufs[0])->handle);