Mesa (master): glthread: change sizes to unsigned or size_t where needed
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Dec 8 18:06:43 UTC 2020
Module: Mesa
Branch: master
Commit: 4b2445916e6ae6b586bbde53310a411db084e67a
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=4b2445916e6ae6b586bbde53310a411db084e67a
Author: Marek Olšák <marek.olsak at amd.com>
Date: Fri Oct 9 23:05:08 2020 -0400
glthread: change sizes to unsigned or size_t where needed
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer at amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7719>
---
src/mesa/main/glthread.c | 4 ++--
src/mesa/main/glthread.h | 4 ++--
src/mesa/main/glthread_bufferobj.c | 2 +-
src/mesa/main/glthread_marshal.h | 4 ++--
4 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/mesa/main/glthread.c b/src/mesa/main/glthread.c
index c1cd08d7c72..456722ac044 100644
--- a/src/mesa/main/glthread.c
+++ b/src/mesa/main/glthread.c
@@ -46,8 +46,8 @@ glthread_unmarshal_batch(void *job, int thread_index)
{
struct glthread_batch *batch = (struct glthread_batch*)job;
struct gl_context *ctx = batch->ctx;
- int pos = 0;
- int used = batch->used;
+ unsigned pos = 0;
+ unsigned used = batch->used;
uint64_t *buffer = batch->buffer;
_glapi_set_dispatch(ctx->CurrentServerDispatch);
diff --git a/src/mesa/main/glthread.h b/src/mesa/main/glthread.h
index 1a952155042..9abc4045815 100644
--- a/src/mesa/main/glthread.h
+++ b/src/mesa/main/glthread.h
@@ -106,7 +106,7 @@ struct glthread_batch
* value temporarily, and glthread::used is copied to this variable when
* the batch is submitted.
*/
- int used;
+ unsigned used;
/** Data contained in the command buffer. */
uint64_t buffer[MARSHAL_MAX_CMD_SIZE / 8];
@@ -154,7 +154,7 @@ struct glthread_state
unsigned next;
/** Amount of data filled in next_batch, in bytes. */
- int used;
+ unsigned used;
/** Upload buffer. */
struct gl_buffer_object *upload_buffer;
diff --git a/src/mesa/main/glthread_bufferobj.c b/src/mesa/main/glthread_bufferobj.c
index 52828308052..2df10421b98 100644
--- a/src/mesa/main/glthread_bufferobj.c
+++ b/src/mesa/main/glthread_bufferobj.c
@@ -278,7 +278,7 @@ _mesa_marshal_BufferData_merged(GLuint target_or_name, GLsizeiptr size,
bool external_mem = !named &&
target_or_name == GL_EXTERNAL_VIRTUAL_MEMORY_BUFFER_AMD;
bool copy_data = data && !external_mem;
- int cmd_size = sizeof(struct marshal_cmd_BufferData) + (copy_data ? size : 0);
+ size_t cmd_size = sizeof(struct marshal_cmd_BufferData) + (copy_data ? size : 0);
if (unlikely(size < 0 || size > INT_MAX || cmd_size < 0 ||
cmd_size > MARSHAL_MAX_CMD_SIZE ||
diff --git a/src/mesa/main/glthread_marshal.h b/src/mesa/main/glthread_marshal.h
index d24b85eee76..cd303f62d9d 100644
--- a/src/mesa/main/glthread_marshal.h
+++ b/src/mesa/main/glthread_marshal.h
@@ -54,7 +54,7 @@ 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,
- int size)
+ unsigned size)
{
struct glthread_state *glthread = &ctx->GLThread;
@@ -62,7 +62,7 @@ _mesa_glthread_allocate_command(struct gl_context *ctx,
_mesa_glthread_flush_batch(ctx);
struct glthread_batch *next = glthread->next_batch;
- const int aligned_size = align(size, 8);
+ const unsigned aligned_size = align(size, 8);
struct marshal_cmd_base *cmd_base =
(struct marshal_cmd_base *)&next->buffer[glthread->used / 8];
glthread->used += aligned_size;
More information about the mesa-commit
mailing list