Mesa (master): gallium: add interface to clear buffers

Ilia Mirkin imirkin at kemper.freedesktop.org
Tue Apr 1 01:59:44 UTC 2014


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

Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date:   Tue Mar 25 17:10:54 2014 -0400

gallium: add interface to clear buffers

Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Reviewed-by: Marek Olšák <marek.olsak at amd.com>

---

 src/gallium/docs/source/context.rst  |    5 +++++
 src/gallium/include/pipe/p_context.h |   11 +++++++++++
 2 files changed, 16 insertions(+)

diff --git a/src/gallium/docs/source/context.rst b/src/gallium/docs/source/context.rst
index 8e14522..efa2a1c 100644
--- a/src/gallium/docs/source/context.rst
+++ b/src/gallium/docs/source/context.rst
@@ -218,6 +218,11 @@ is is also possible to only clear one or the other part). While it is only
 possible to clear one surface at a time (which can include several layers),
 this surface need not be bound to the framebuffer.
 
+``clear_buffer`` clears a PIPE_BUFFER resource with the specified clear value
+(which may be multiple bytes in length). Logically this is a memset with a
+multi-byte element value starting at offset bytes from resource start, going
+for size bytes. It is guaranteed that size % clear_value_size == 0.
+
 
 Drawing
 ^^^^^^^
diff --git a/src/gallium/include/pipe/p_context.h b/src/gallium/include/pipe/p_context.h
index fe3045a..bf27285 100644
--- a/src/gallium/include/pipe/p_context.h
+++ b/src/gallium/include/pipe/p_context.h
@@ -332,6 +332,17 @@ struct pipe_context {
                                unsigned dstx, unsigned dsty,
                                unsigned width, unsigned height);
 
+   /**
+    * Clear a buffer. Runs a memset over the specified region with the element
+    * value passed in through clear_value of size clear_value_size.
+    */
+   void (*clear_buffer)(struct pipe_context *pipe,
+                        struct pipe_resource *res,
+                        unsigned offset,
+                        unsigned size,
+                        const void *clear_value,
+                        int clear_value_size);
+
    /** Flush draw commands
     *
     * \param flags  bitfield of enum pipe_flush_flags values.




More information about the mesa-commit mailing list