[Mesa-dev] [PATCH 1/3] mesa: merge the driver functions DrawBuffers and DrawBuffer

Brian Paul brianp at vmware.com
Sun Apr 15 16:16:44 UTC 2018


The series looks OK to me.

Reviewed-by: Brian Paul <brianp at vmware.com>

On 04/13/2018 10:45 PM, Timothy Arceri wrote:
> The extra params we unused by the drivers that used DrawBuffers.
> ---
>   src/mesa/drivers/common/driverfuncs.c        | 1 -
>   src/mesa/drivers/dri/nouveau/nouveau_state.c | 4 ++--
>   src/mesa/main/buffers.c                      | 8 ++------
>   src/mesa/main/dd.h                           | 2 --
>   src/mesa/state_tracker/st_cb_fbo.c           | 9 ++++-----
>   5 files changed, 8 insertions(+), 16 deletions(-)
> 
> diff --git a/src/mesa/drivers/common/driverfuncs.c b/src/mesa/drivers/common/driverfuncs.c
> index 11134b69e94..b7ac2b5b434 100644
> --- a/src/mesa/drivers/common/driverfuncs.c
> +++ b/src/mesa/drivers/common/driverfuncs.c
> @@ -134,7 +134,6 @@ _mesa_init_driver_functions(struct dd_function_table *driver)
>      driver->ColorMaterial = NULL;
>      driver->CullFace = NULL;
>      driver->DrawBuffer = NULL;
> -   driver->DrawBuffers = NULL;
>      driver->FrontFace = NULL;
>      driver->DepthFunc = NULL;
>      driver->DepthMask = NULL;
> diff --git a/src/mesa/drivers/dri/nouveau/nouveau_state.c b/src/mesa/drivers/dri/nouveau/nouveau_state.c
> index e2b01043675..91ca95b5907 100644
> --- a/src/mesa/drivers/dri/nouveau/nouveau_state.c
> +++ b/src/mesa/drivers/dri/nouveau/nouveau_state.c
> @@ -115,7 +115,7 @@ nouveau_read_buffer(struct gl_context *ctx, GLenum buffer)
>   }
>   
>   static void
> -nouveau_draw_buffers(struct gl_context *ctx, GLsizei n, const GLenum *buffers)
> +nouveau_draw_buffer(struct gl_context *ctx, GLenum buffers)
>   {
>   	nouveau_validate_framebuffer(ctx);
>   	context_dirty(ctx, FRAMEBUFFER);
> @@ -519,7 +519,7 @@ nouveau_state_init(struct gl_context *ctx)
>   	ctx->Driver.DepthFunc = nouveau_depth_func;
>   	ctx->Driver.DepthMask = nouveau_depth_mask;
>   	ctx->Driver.ReadBuffer = nouveau_read_buffer;
> -	ctx->Driver.DrawBuffers = nouveau_draw_buffers;
> +	ctx->Driver.DrawBuffer = nouveau_draw_buffer;
>   	ctx->Driver.Enable = nouveau_enable;
>   	ctx->Driver.Fogfv = nouveau_fog;
>   	ctx->Driver.Lightfv = nouveau_light;
> diff --git a/src/mesa/main/buffers.c b/src/mesa/main/buffers.c
> index 5492227de08..7bb5725d085 100644
> --- a/src/mesa/main/buffers.c
> +++ b/src/mesa/main/buffers.c
> @@ -304,9 +304,7 @@ draw_buffer(struct gl_context *ctx, struct gl_framebuffer *fb,
>   
>      /* Call device driver function only if fb is the bound draw buffer */
>      if (fb == ctx->DrawBuffer) {
> -      if (ctx->Driver.DrawBuffers)
> -         ctx->Driver.DrawBuffers(ctx, 1, &buffer);
> -      else if (ctx->Driver.DrawBuffer)
> +      if (ctx->Driver.DrawBuffer)
>            ctx->Driver.DrawBuffer(ctx, buffer);
>      }
>   }
> @@ -587,9 +585,7 @@ draw_buffers(struct gl_context *ctx, struct gl_framebuffer *fb, GLsizei n,
>       * may not be valid.
>       */
>      if (fb == ctx->DrawBuffer) {
> -      if (ctx->Driver.DrawBuffers)
> -         ctx->Driver.DrawBuffers(ctx, n, buffers);
> -      else if (ctx->Driver.DrawBuffer)
> +      if (ctx->Driver.DrawBuffer)
>            ctx->Driver.DrawBuffer(ctx, n > 0 ? buffers[0] : GL_NONE);
>      }
>   }
> diff --git a/src/mesa/main/dd.h b/src/mesa/main/dd.h
> index 64ddd818835..d85d89ef50c 100644
> --- a/src/mesa/main/dd.h
> +++ b/src/mesa/main/dd.h
> @@ -612,8 +612,6 @@ struct dd_function_table {
>      void (*DepthRange)(struct gl_context *ctx);
>      /** Specify the current buffer for writing */
>      void (*DrawBuffer)( struct gl_context *ctx, GLenum buffer );
> -   /** Specify the buffers for writing for fragment programs*/
> -   void (*DrawBuffers)(struct gl_context *ctx, GLsizei n, const GLenum *buffers);
>      /** Enable or disable server-side gl capabilities */
>      void (*Enable)(struct gl_context *ctx, GLenum cap, GLboolean state);
>      /** Specify fog parameters */
> diff --git a/src/mesa/state_tracker/st_cb_fbo.c b/src/mesa/state_tracker/st_cb_fbo.c
> index f859133e399..696a08fd65b 100644
> --- a/src/mesa/state_tracker/st_cb_fbo.c
> +++ b/src/mesa/state_tracker/st_cb_fbo.c
> @@ -714,13 +714,12 @@ st_validate_framebuffer(struct gl_context *ctx, struct gl_framebuffer *fb)
>    * created FBOs.
>    */
>   static void
> -st_DrawBuffers(struct gl_context *ctx, GLsizei count, const GLenum *buffers)
> +st_DrawBuffer(struct gl_context *ctx, GLenum buffer)
>   {
>      struct st_context *st = st_context(ctx);
>      struct gl_framebuffer *fb = ctx->DrawBuffer;
>   
> -   (void) count;
> -   (void) buffers;
> +   (void) buffer;
>   
>      if (_mesa_is_winsys_fbo(fb)) {
>         GLuint i;
> @@ -737,7 +736,7 @@ st_DrawBuffers(struct gl_context *ctx, GLsizei count, const GLenum *buffers)
>   
>   
>   /**
> - * Called via glReadBuffer.  As with st_DrawBuffers, we use this function
> + * Called via glReadBuffer.  As with st_DrawBuffer, we use this function
>    * to check if we need to allocate a renderbuffer on demand.
>    */
>   static void
> @@ -869,7 +868,7 @@ st_init_fbo_functions(struct dd_function_table *functions)
>      functions->FinishRenderTexture = st_finish_render_texture;
>      functions->ValidateFramebuffer = st_validate_framebuffer;
>   
> -   functions->DrawBuffers = st_DrawBuffers;
> +   functions->DrawBuffer = st_DrawBuffer;
>      functions->ReadBuffer = st_ReadBuffer;
>   
>      functions->MapRenderbuffer = st_MapRenderbuffer;
> 



More information about the mesa-dev mailing list