Mesa (main): vbo: use int16_t for vbo_save_vertex_list::gallium::private_refcount
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Fri Oct 29 08:01:51 UTC 2021
Module: Mesa
Branch: main
Commit: 3835205a0ec1d0b46830911c015d27986c1a5212
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3835205a0ec1d0b46830911c015d27986c1a5212
Author: Marek Olšák <marek.olsak at amd.com>
Date: Sat Oct 23 00:55:12 2021 -0400
vbo: use int16_t for vbo_save_vertex_list::gallium::private_refcount
We never use more than 16 bits.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13506>
---
src/mesa/vbo/vbo_save.h | 2 +-
src/mesa/vbo/vbo_save_draw.c | 4 ++--
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/mesa/vbo/vbo_save.h b/src/mesa/vbo/vbo_save.h
index eb9b0e392ab..5af82f2e64f 100644
--- a/src/mesa/vbo/vbo_save.h
+++ b/src/mesa/vbo/vbo_save.h
@@ -71,7 +71,7 @@ struct vbo_save_vertex_list {
struct {
struct gl_context *ctx;
struct pipe_vertex_state *state[VP_MODE_MAX];
- int private_refcount[VP_MODE_MAX];
+ int16_t private_refcount[VP_MODE_MAX];
GLbitfield enabled_attribs[VP_MODE_MAX];
struct pipe_draw_vertex_state_info info;
} gallium;
diff --git a/src/mesa/vbo/vbo_save_draw.c b/src/mesa/vbo/vbo_save_draw.c
index 6062969ccd7..a4e10c3db3b 100644
--- a/src/mesa/vbo/vbo_save_draw.c
+++ b/src/mesa/vbo/vbo_save_draw.c
@@ -248,7 +248,7 @@ vbo_save_playback_vertex_list_gallium(struct gl_context *ctx,
* possibly turn a million atomic increments into 1 add and 1 subtract
* atomic op over the whole lifetime of an app.
*/
- int * const private_refcount = (int*)&node->merged.gallium.private_refcount[mode];
+ int16_t * const private_refcount = (int16_t*)&node->merged.gallium.private_refcount[mode];
assert(*private_refcount >= 0);
if (unlikely(*private_refcount == 0)) {
@@ -260,7 +260,7 @@ vbo_save_playback_vertex_list_gallium(struct gl_context *ctx,
* lists, so one display list can only increment it by
* INT_MAX / N.
*/
- const int add_refs = INT_MAX / 500000;
+ const int16_t add_refs = INT_MAX / 500000;
p_atomic_add(&state->reference.count, add_refs);
*private_refcount = add_refs;
}
More information about the mesa-commit
mailing list