diff options
author | Brian Paul <[email protected]> | 2017-03-27 08:30:43 -0600 |
---|---|---|
committer | Brian Paul <[email protected]> | 2017-03-27 08:30:43 -0600 |
commit | 804676f384d4a12e3cfbccf21e48464c4ba58704 (patch) | |
tree | 210509513d9a78f9eed9085dc062713f17f1d9ae /src/mesa/main/marshal.c | |
parent | b71ef173a5a61a667380dc77f5ae1f7e8c0c2fb8 (diff) |
mesa: simplify code around 'variable_data' in marshal.c
Remove needless pointer increments, unneeded vars, etc. Untested.
Plus, fix a couple comments.
Reviewed-by: Timothy Arceri <[email protected]>
Diffstat (limited to 'src/mesa/main/marshal.c')
-rw-r--r-- | src/mesa/main/marshal.c | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/src/mesa/main/marshal.c b/src/mesa/main/marshal.c index 03da140d876..b01c0739972 100644 --- a/src/mesa/main/marshal.c +++ b/src/mesa/main/marshal.c @@ -269,7 +269,7 @@ struct marshal_cmd_BufferData GLsizeiptr size; GLenum usage; bool data_null; /* If set, no data follows for "data" */ - /* Next size bytes are GLvoid data[size] */ + /* Next size bytes are GLubyte data[size] */ }; void @@ -279,13 +279,12 @@ _mesa_unmarshal_BufferData(struct gl_context *ctx, const GLenum target = cmd->target; const GLsizeiptr size = cmd->size; const GLenum usage = cmd->usage; - const char *variable_data = (const char *) (cmd + 1); - const GLvoid *data = (const GLvoid *) variable_data; + const void *data; if (cmd->data_null) data = NULL; else - variable_data += size; + data = (const void *) (cmd + 1); CALL_BufferData(ctx->CurrentServerDispatch, (target, size, data, usage)); } @@ -314,11 +313,10 @@ _mesa_marshal_BufferData(GLenum target, GLsizeiptr size, const GLvoid * data, cmd->target = target; cmd->size = size; cmd->usage = usage; - char *variable_data = (char *) (cmd + 1); cmd->data_null = !data; - if (!cmd->data_null) { + if (data) { + char *variable_data = (char *) (cmd + 1); memcpy(variable_data, data, size); - variable_data += size; } _mesa_post_marshal_hook(ctx); } else { @@ -335,7 +333,7 @@ struct marshal_cmd_BufferSubData GLenum target; GLintptr offset; GLsizeiptr size; - /* Next size bytes are GLvoid data[size] */ + /* Next size bytes are GLubyte data[size] */ }; void @@ -345,10 +343,8 @@ _mesa_unmarshal_BufferSubData(struct gl_context *ctx, const GLenum target = cmd->target; const GLintptr offset = cmd->offset; const GLsizeiptr size = cmd->size; - const char *variable_data = (const char *) (cmd + 1); - const GLvoid *data = (const GLvoid *) variable_data; + const void *data = (const void *) (cmd + 1); - variable_data += size; CALL_BufferSubData(ctx->CurrentServerDispatch, (target, offset, size, data)); } @@ -377,7 +373,6 @@ _mesa_marshal_BufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, cmd->size = size; char *variable_data = (char *) (cmd + 1); memcpy(variable_data, data, size); - variable_data += size; _mesa_post_marshal_hook(ctx); } else { _mesa_glthread_finish(ctx); |