glthread: use int instead of size_t where it's OK
authorMarek Olšák <marek.olsak@amd.com>
Wed, 19 Feb 2020 21:00:53 +0000 (16:00 -0500)
committerMarge Bot <eric+marge@anholt.net>
Fri, 6 Mar 2020 01:06:14 +0000 (01:06 +0000)
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3948>

src/mapi/glapi/gen/gl_marshal.py
src/mesa/main/glthread.h
src/mesa/main/marshal.h

index 1e5f75da399404c02ec51a940117a3bef4680bf4..c12a086942bb93405a3fbf8a80f6b6be609d14ec 100644 (file)
@@ -237,7 +237,7 @@ class PrintCode(gl_XML.gl_print_base):
                 if p.img_null_flag:
                     size = '({0} ? {1} : 0)'.format(p.name, size)
                 size_terms.append(size)
-            out('size_t cmd_size = {0};'.format(' + '.join(size_terms)))
+            out('int cmd_size = {0};'.format(' + '.join(size_terms)))
             out('{0} *cmd;'.format(struct))
 
             out('debug_print_marshal("{0}");'.format(func.name))
index 59cb95feb4a0bc4a09c0ac3de757c12423e49a19..3d1c3ef198308e6e10cf7c419133471638c1979a 100644 (file)
@@ -60,7 +60,7 @@ struct glthread_batch
    struct gl_context *ctx;
 
    /** Amount of data used by batch commands, in bytes. */
-   size_t used;
+   int used;
 
    /** Data contained in the command buffer. */
    uint8_t buffer[MARSHAL_MAX_CMD_SIZE];
index b2556ca98415ea9a4e0c135e7801a10fa3717a6a..10c508327a7301483048ea5e545dc210919104da 100644 (file)
@@ -54,12 +54,12 @@ extern const _mesa_unmarshal_func _mesa_unmarshal_dispatch[NUM_DISPATCH_CMD];
 static inline void *
 _mesa_glthread_allocate_command(struct gl_context *ctx,
                                 uint16_t cmd_id,
-                                size_t size)
+                                int size)
 {
    struct glthread_state *glthread = ctx->GLThread;
    struct glthread_batch *next = &glthread->batches[glthread->next];
    struct marshal_cmd_base *cmd_base;
-   const size_t aligned_size = ALIGN(size, 8);
+   const int aligned_size = ALIGN(size, 8);
 
    if (unlikely(next->used + size > MARSHAL_MAX_CMD_SIZE)) {
       _mesa_glthread_flush_batch(ctx);