From: Marek Olšák Date: Mon, 22 Aug 2022 04:43:36 +0000 (-0400) Subject: mesa: reorder and pack gl_buffer_object X-Git-Tag: upstream/22.3.5~2322 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=b4de8c834e99254013b8a6f481e5be17701a420c;p=platform%2Fupstream%2Fmesa.git mesa: reorder and pack gl_buffer_object The frequently-accessed fields are at the beginning, hoping we only need to load 1 cache line to get them all. Reviewed-by: Pierre-Eric Pelloux-Prayer Part-of: --- diff --git a/src/mesa/main/mtypes.h b/src/mesa/main/mtypes.h index a671f58..7b3d30e 100644 --- a/src/mesa/main/mtypes.h +++ b/src/mesa/main/mtypes.h @@ -1408,7 +1408,6 @@ struct gl_buffer_object { GLint RefCount; GLuint Name; - GLchar *Label; /**< GL_KHR_debug */ /** * The context that holds a global buffer reference for the lifetime of @@ -1438,28 +1437,8 @@ struct gl_buffer_object struct gl_context *Ctx; GLint CtxRefCount; /**< Non-atomic references held by Ctx. */ - GLenum16 Usage; /**< GL_STREAM_DRAW_ARB, GL_STREAM_READ_ARB, etc. */ - GLbitfield StorageFlags; /**< GL_MAP_PERSISTENT_BIT, etc. */ - GLsizeiptrARB Size; /**< Size of buffer storage in bytes */ - GLboolean DeletePending; /**< true if buffer object is removed from the hash */ - GLboolean Immutable; /**< GL_ARB_buffer_storage */ gl_buffer_usage UsageHistory; /**< How has this buffer been used so far? */ - /** Counters used for buffer usage warnings */ - GLuint NumSubDataCalls; - GLuint NumMapBufferWriteCalls; - - struct gl_buffer_mapping Mappings[MAP_COUNT]; - - /** Memoization of min/max index computations for static index buffers */ - simple_mtx_t MinMaxCacheMutex; - struct hash_table *MinMaxCache; - unsigned MinMaxCacheHitIndices; - unsigned MinMaxCacheMissIndices; - bool MinMaxCacheDirty; - - bool HandleAllocated; /**< GL_ARB_bindless_texture */ - struct pipe_resource *buffer; struct gl_context *private_refcount_ctx; /* This mechanism allows passing buffer references to the driver without @@ -1478,6 +1457,27 @@ struct gl_buffer_object */ int private_refcount; + GLbitfield StorageFlags; /**< GL_MAP_PERSISTENT_BIT, etc. */ + + /** Memoization of min/max index computations for static index buffers */ + unsigned MinMaxCacheHitIndices; + unsigned MinMaxCacheMissIndices; + struct hash_table *MinMaxCache; + simple_mtx_t MinMaxCacheMutex; + bool MinMaxCacheDirty:1; + + bool DeletePending:1; /**< true if buffer object is removed from the hash */ + bool Immutable:1; /**< GL_ARB_buffer_storage */ + bool HandleAllocated:1; /**< GL_ARB_bindless_texture */ + GLenum16 Usage; /**< GL_STREAM_DRAW_ARB, GL_STREAM_READ_ARB, etc. */ + GLchar *Label; /**< GL_KHR_debug */ + GLsizeiptrARB Size; /**< Size of buffer storage in bytes */ + + /** Counters used for buffer usage warnings */ + GLuint NumSubDataCalls; + GLuint NumMapBufferWriteCalls; + + struct gl_buffer_mapping Mappings[MAP_COUNT]; struct pipe_transfer *transfer[MAP_COUNT]; };