[Mesa-dev] [PATCH 1/2] mesa/marshal: extract ClearBuffer helpers
Matt Turner
mattst88 at gmail.com
Sun Jul 9 16:52:54 UTC 2017
On Sun, Jul 9, 2017 at 9:21 AM, Grigori Goronzy <greg at chown.ath.cx> wrote:
> Extract clear buffer helper functions in preparation for adding
> marshal/unmarshal functions for the various glClearBuffer variants.
> ---
> src/mesa/main/marshal.c | 74 +++++++++++++++++++++++++++++++------------------
> src/mesa/main/marshal.h | 5 ++--
> 2 files changed, 50 insertions(+), 29 deletions(-)
>
> diff --git a/src/mesa/main/marshal.c b/src/mesa/main/marshal.c
> index 8db4531..1edc580 100644
> --- a/src/mesa/main/marshal.c
> +++ b/src/mesa/main/marshal.c
> @@ -517,7 +517,7 @@ _mesa_marshal_NamedBufferSubData(GLuint buffer, GLintptr offset,
> }
>
> /* ClearBufferfv: marshalled asynchronously */
> -struct marshal_cmd_ClearBufferfv
> +struct marshal_cmd_ClearBuffer
> {
> struct marshal_cmd_base cmd_base;
> GLenum buffer;
> @@ -526,7 +526,7 @@ struct marshal_cmd_ClearBufferfv
>
> void
> _mesa_unmarshal_ClearBufferfv(struct gl_context *ctx,
> - const struct marshal_cmd_ClearBufferfv *cmd)
> + const struct marshal_cmd_ClearBuffer *cmd)
> {
> const GLenum buffer = cmd->buffer;
> const GLint drawbuffer = cmd->drawbuffer;
> @@ -537,6 +537,47 @@ _mesa_unmarshal_ClearBufferfv(struct gl_context *ctx,
> (buffer, drawbuffer, value));
> }
>
> +static inline size_t buffer_to_size(GLenum buffer)
> +{
> + switch (buffer) {
> + case GL_COLOR:
> + return 4;
> + case GL_DEPTH_STENCIL:
> + return 2;
> + case GL_STENCIL:
> + case GL_DEPTH:
> + return 1;
> + default:
> + return 0;
> + }
> +}
> +
> +static inline bool clear_buffer_add_command(struct gl_context *ctx, uint16_t id,
Please don't use 'inline'. The compiler is capable of making this
decision for itself, based on the data it has available.
More information about the mesa-dev
mailing list