From 747c3ddb9dcd0e27acb1274ae2d35ae1eed4398a Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Mon, 13 Mar 2023 11:29:08 -0400 Subject: [PATCH] glthread: align small buffer uploads to 4 bytes MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit some apps (e.g., supertuxkart) use a ton of 4 byte subdata calls, and this halves their memory consumption Reviewed-by: Marek Olšák Part-of: --- src/mesa/main/glthread_bufferobj.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mesa/main/glthread_bufferobj.c b/src/mesa/main/glthread_bufferobj.c index e81f5c4..118657c 100644 --- a/src/mesa/main/glthread_bufferobj.c +++ b/src/mesa/main/glthread_bufferobj.c @@ -88,7 +88,7 @@ _mesa_glthread_upload(struct gl_context *ctx, const void *data, return; /* The alignment was chosen arbitrarily. */ - unsigned offset = align(glthread->upload_offset, 8) + start_offset; + unsigned offset = align(glthread->upload_offset, size <= 4 ? 4 : 8) + start_offset; /* Allocate a new buffer if needed. */ if (unlikely(!glthread->upload_buffer || offset + size > default_size)) { -- 2.7.4