[Mesa-dev] [PATCH 4/7] mesa/main: add USAGE_PERSISTENT_WRITE_MAP flag to buffer UsageHistory

Nicolai Hähnle nhaehnle at gmail.com
Thu Jan 7 16:57:08 PST 2016


From: Nicolai Hähnle <nicolai.haehnle at amd.com>

We will want to disable minmax index caching for buffers that are used in this
way.
---
 src/mesa/main/bufferobj.c | 6 +++++-
 src/mesa/main/mtypes.h    | 1 +
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
index 8fd9a06..ef2b495 100644
--- a/src/mesa/main/bufferobj.c
+++ b/src/mesa/main/bufferobj.c
@@ -2474,9 +2474,13 @@ _mesa_map_buffer_range(struct gl_context *ctx,
       assert(bufObj->Mappings[MAP_USER].AccessFlags == access);
    }
 
-   if (access & GL_MAP_WRITE_BIT)
+   if (access & GL_MAP_WRITE_BIT) {
       bufObj->Written = GL_TRUE;
 
+      if (access & GL_MAP_PERSISTENT_BIT)
+         bufObj->UsageHistory |= USAGE_PERSISTENT_WRITE_MAP;
+   }
+
 #ifdef VBO_DEBUG
    if (strstr(func, "Range") == NULL) { /* If not MapRange */
       printf("glMapBuffer(%u, sz %ld, access 0x%x)\n",
diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h
index 9e4b2c8..4d625da 100644
--- a/src/mesa/main/mtypes.h
+++ b/src/mesa/main/mtypes.h
@@ -1255,6 +1255,7 @@ typedef enum {
    USAGE_SHADER_STORAGE_BUFFER = 0x8,
    USAGE_TRANSFORM_FEEDBACK_BUFFER = 0x10,
    USAGE_PIXEL_PACK_BUFFER = 0x20,
+   USAGE_PERSISTENT_WRITE_MAP = 0x40,
 } gl_buffer_usage;
 
 
-- 
2.5.0



More information about the mesa-dev mailing list