vbo: use int16_t for vbo_save_vertex_list::gallium::private_refcount
authorMarek Olšák <marek.olsak@amd.com>
Sat, 23 Oct 2021 04:55:12 +0000 (00:55 -0400)
committerMarge Bot <emma+marge@anholt.net>
Fri, 29 Oct 2021 07:33:50 +0000 (07:33 +0000)
We never use more than 16 bits.

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13506>

src/mesa/vbo/vbo_save.h
src/mesa/vbo/vbo_save_draw.c

index eb9b0e3..5af82f2 100644 (file)
@@ -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;
index 6062969..a4e10c3 100644 (file)
@@ -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;
       }