Mesa (master): r300g: adapt to clear interface changes

Roland Scheidegger sroland at kemper.freedesktop.org
Thu Jun 3 08:47:35 PDT 2010


Module: Mesa
Branch: master
Commit: 10baf7ec1d31552a268c38422619abc131a37e2b
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=10baf7ec1d31552a268c38422619abc131a37e2b

Author: Roland Scheidegger <sroland at vmware.com>
Date:   Sat May 29 01:26:22 2010 +0200

r300g: adapt to clear interface changes

should support separate depth/stencil clears just fine with changed u_blitter.

---

 src/gallium/drivers/r300/r300_blit.c   |   38 +++++++++++++++++++++++--------
 src/gallium/drivers/r300/r300_screen.c |    3 ++
 2 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/src/gallium/drivers/r300/r300_blit.c b/src/gallium/drivers/r300/r300_blit.c
index 66ca4e0..3acd074 100644
--- a/src/gallium/drivers/r300/r300_blit.c
+++ b/src/gallium/drivers/r300/r300_blit.c
@@ -188,26 +188,44 @@ static void r300_resource_copy_region(struct pipe_context *pipe,
     }
 }
 
-/* Fill a region of a surface with a constant value. */
-static void r300_resource_fill_region(struct pipe_context *pipe,
-                                      struct pipe_resource *dst,
-                                      struct pipe_subresource subdst,
-                                      unsigned dstx, unsigned dsty, unsigned dstz,
-                                      unsigned width, unsigned height,
-                                      unsigned value)
+/* Clear a region of a color surface to a constant value. */
+static void r300_clearRT(struct pipe_context *pipe,
+                         struct pipe_surface *dst,
+                         const float *rgba,
+                         unsigned dstx, unsigned dsty,
+                         unsigned width, unsigned height)
+{
+    struct r300_context *r300 = r300_context(pipe);
+
+    r300_blitter_save_states(r300);
+    util_blitter_save_framebuffer(r300->blitter, r300->fb_state.state);
+
+    util_blitter_clearRT(r300->blitter, dst, rgba,
+                         dstx, dsty, width, height);
+}
+
+/* Clear a region of a depth stencil surface. */
+static void r300_clearDS(struct pipe_context *pipe,
+                         struct pipe_surface *dst,
+                         unsigned clear_flags,
+                         double depth,
+                         unsigned stencil,
+                         unsigned dstx, unsigned dsty,
+                         unsigned width, unsigned height)
 {
     struct r300_context *r300 = r300_context(pipe);
 
     r300_blitter_save_states(r300);
     util_blitter_save_framebuffer(r300->blitter, r300->fb_state.state);
 
-    util_blitter_fill_region(r300->blitter, dst, subdst,
-                             dstx, dsty, dstz, width, height, value);
+    util_blitter_clearDS(r300->blitter, dst, clear_flags, depth, stencil,
+                         dstx, dsty, width, height);
 }
 
 void r300_init_blit_functions(struct r300_context *r300)
 {
     r300->context.clear = r300_clear;
+    r300->context.clearRT = r300_clearRT;
+    r300->context.clearDS = r300_clearDS;
     r300->context.resource_copy_region = r300_resource_copy_region;
-    r300->context.resource_fill_region = r300_resource_fill_region;
 }
diff --git a/src/gallium/drivers/r300/r300_screen.c b/src/gallium/drivers/r300/r300_screen.c
index 4859db5..a5ad6d9 100644
--- a/src/gallium/drivers/r300/r300_screen.c
+++ b/src/gallium/drivers/r300/r300_screen.c
@@ -146,6 +146,9 @@ static int r300_get_param(struct pipe_screen* pscreen, enum pipe_cap param)
         case PIPE_CAP_MAX_CONST_BUFFER_SIZE:
             return 256;
 
+        case PIPE_CAP_DEPTHSTENCIL_CLEAR_SEPARATE:
+            return 1;
+
         /* Fragment coordinate conventions. */
         case PIPE_CAP_TGSI_FS_COORD_ORIGIN_UPPER_LEFT:
         case PIPE_CAP_TGSI_FS_COORD_PIXEL_CENTER_HALF_INTEGER:



More information about the mesa-commit mailing list