[Mesa-dev] [RFC PATCH 1/3] gallium: decrease the size of pipe_vertex_buffer - 24 -> 16 bytes

Marek Olšák maraeo at gmail.com
Tue Apr 11 20:15:03 UTC 2017


From: Marek Olšák <marek.olsak at amd.com>

New interface:

union pipe_buffer_binding {
   struct pipe_resource *buffer;  /**< the actual buffer */
   const void *user_buffer;  /**< pointer to a user buffer */
};

struct pipe_vertex_buffer
{
   uint16_t stride;    /**< stride to same attrib in next vertex, in bytes */
   bool is_user_buffer;
   unsigned buffer_offset;  /**< offset to start of data in buffer, in bytes */
   union pipe_buffer_binding u;
};
---
 src/gallium/include/pipe/p_state.h | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/src/gallium/include/pipe/p_state.h b/src/gallium/include/pipe/p_state.h
index ce9ca34..9576f18 100644
--- a/src/gallium/include/pipe/p_state.h
+++ b/src/gallium/include/pipe/p_state.h
@@ -534,6 +534,11 @@ struct pipe_transfer
 };
 
 
+union pipe_buffer_binding {
+   struct pipe_resource *buffer;  /**< the actual buffer */
+   const void *user_buffer;  /**< pointer to a user buffer */
+};
+
 
 /**
  * A vertex buffer.  Typically, all the vertex data/attributes for
@@ -542,10 +547,10 @@ struct pipe_transfer
  */
 struct pipe_vertex_buffer
 {
-   unsigned stride;    /**< stride to same attrib in next vertex, in bytes */
+   uint16_t stride;    /**< stride to same attrib in next vertex, in bytes */
+   bool is_user_buffer;
    unsigned buffer_offset;  /**< offset to start of data in buffer, in bytes */
-   struct pipe_resource *buffer;  /**< the actual buffer */
-   const void *user_buffer;  /**< pointer to a user buffer if buffer == NULL */
+   union pipe_buffer_binding u;
 };
 
 
-- 
2.7.4



More information about the mesa-dev mailing list