mesa: merge the driver functions DrawBuffers and DrawBuffer

The extra params we unused by the drivers that used DrawBuffers.

Tested-by: Dieter Nützel <Dieter@nuetzel-hh.de>
Reviewed-by: Brian Paul <brianp@vmware.com>
This commit is contained in:
Timothy Arceri
2018-04-14 13:42:31 +10:00
parent 268d8f244b
commit d3cafc18fc
5 changed files with 8 additions and 16 deletions
-1
View File
@@ -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;
+2 -2
View File
@@ -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;
+2 -6
View File
@@ -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);
}
}
-2
View File
@@ -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 */
+4 -5
View File
@@ -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;