From d3cafc18fced872ce60060e792f6faf2b97cc3a9 Mon Sep 17 00:00:00 2001 From: Timothy Arceri Date: Sat, 14 Apr 2018 13:42:31 +1000 Subject: [PATCH] mesa: merge the driver functions DrawBuffers and DrawBuffer MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The extra params we unused by the drivers that used DrawBuffers. Tested-by: Dieter Nützel Reviewed-by: Brian Paul --- 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 11134b6..b7ac2b5 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 e2b01043..debbd38 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 buffer) { 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 5492227..7bb5725d 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 64ddd81..d85d89e 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 f859133..696a08f 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; -- 2.7.4