[Mesa-dev] [PATCH] st/mesa: use PIPE_USAGE_STREAM for GL_CLIENT_STORAGE_BIT without READ_BIT (v2)

Marek Olšák maraeo at gmail.com
Sat Aug 6 21:53:36 UTC 2016


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

v2: keep STAGING for GL_MAP_READ_BIT
---
 src/mesa/state_tracker/st_cb_bufferobjects.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/src/mesa/state_tracker/st_cb_bufferobjects.c b/src/mesa/state_tracker/st_cb_bufferobjects.c
index 6d54326..2f56a55 100644
--- a/src/mesa/state_tracker/st_cb_bufferobjects.c
+++ b/src/mesa/state_tracker/st_cb_bufferobjects.c
@@ -241,24 +241,28 @@ st_bufferobj_data(struct gl_context *ctx,
    case GL_QUERY_BUFFER:
       bind = PIPE_BIND_QUERY_BUFFER;
       break;
    default:
       bind = 0;
    }
 
    /* Set usage. */
    if (st_obj->Base.Immutable) {
       /* BufferStorage */
-      if (storageFlags & GL_CLIENT_STORAGE_BIT)
-         pipe_usage = PIPE_USAGE_STAGING;
-      else
+      if (storageFlags & GL_CLIENT_STORAGE_BIT) {
+         if (storageFlags & GL_MAP_READ_BIT)
+            pipe_usage = PIPE_USAGE_STAGING;
+         else
+            pipe_usage = PIPE_USAGE_STREAM;
+      } else {
          pipe_usage = PIPE_USAGE_DEFAULT;
+      }
    }
    else {
       /* BufferData */
       switch (usage) {
       case GL_STATIC_DRAW:
       case GL_STATIC_COPY:
       default:
 	 pipe_usage = PIPE_USAGE_DEFAULT;
          break;
       case GL_DYNAMIC_DRAW:
-- 
2.7.4



More information about the mesa-dev mailing list