From: Brian Paul Date: Sun, 16 Jan 2011 01:25:19 +0000 (-0700) Subject: mesa: display list support for GL_ARB_draw_buffers_blend functions X-Git-Tag: android-x86-2.2-r2~1301 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=44c2122a737569e78af18c54994c3aa4035882ee;p=android-x86%2Fexternal-mesa.git mesa: display list support for GL_ARB_draw_buffers_blend functions --- diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c index b28e36ac096..cdf349104a4 100644 --- a/src/mesa/main/dlist.c +++ b/src/mesa/main/dlist.c @@ -188,6 +188,12 @@ typedef enum OPCODE_BLEND_EQUATION, OPCODE_BLEND_EQUATION_SEPARATE, OPCODE_BLEND_FUNC_SEPARATE, + + OPCODE_BLEND_EQUATION_I, + OPCODE_BLEND_EQUATION_SEPARATE_I, + OPCODE_BLEND_FUNC_I, + OPCODE_BLEND_FUNC_SEPARATE_I, + OPCODE_CALL_LIST, OPCODE_CALL_LIST_OFFSET, OPCODE_CLEAR, @@ -1146,6 +1152,82 @@ save_BlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) } } +/* GL_ARB_draw_buffers_blend */ +static void GLAPIENTRY +save_BlendFuncSeparatei(GLuint buf, GLenum sfactorRGB, GLenum dfactorRGB, + GLenum sfactorA, GLenum dfactorA) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE_I, 5); + if (n) { + n[1].ui = buf; + n[2].e = sfactorRGB; + n[3].e = dfactorRGB; + n[4].e = sfactorA; + n[5].e = dfactorA; + } + if (ctx->ExecuteFlag) { + CALL_BlendFuncSeparateiARB(ctx->Exec, (buf, sfactorRGB, dfactorRGB, + sfactorA, dfactorA)); + } +} + +/* GL_ARB_draw_buffers_blend */ +static void GLAPIENTRY +save_BlendFunci(GLuint buf, GLenum sfactor, GLenum dfactor) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_BLEND_FUNC_SEPARATE_I, 3); + if (n) { + n[1].ui = buf; + n[2].e = sfactor; + n[3].e = dfactor; + } + if (ctx->ExecuteFlag) { + CALL_BlendFunciARB(ctx->Exec, (buf, sfactor, dfactor)); + } +} + +/* GL_ARB_draw_buffers_blend */ +static void GLAPIENTRY +save_BlendEquationi(GLuint buf, GLenum mode) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_I, 2); + if (n) { + n[1].ui = buf; + n[2].e = mode; + } + if (ctx->ExecuteFlag) { + CALL_BlendEquationiARB(ctx->Exec, (buf, mode)); + } +} + +/* GL_ARB_draw_buffers_blend */ +static void GLAPIENTRY +save_BlendEquationSeparatei(GLuint buf, GLenum modeRGB, GLenum modeA) +{ + GET_CURRENT_CONTEXT(ctx); + Node *n; + ASSERT_OUTSIDE_SAVE_BEGIN_END_AND_FLUSH(ctx); + n = alloc_instruction(ctx, OPCODE_BLEND_EQUATION_SEPARATE_I, 3); + if (n) { + n[1].ui = buf; + n[2].e = modeRGB; + n[3].e = modeA; + } + if (ctx->ExecuteFlag) { + CALL_BlendEquationSeparateiARB(ctx->Exec, (buf, modeRGB, modeA)); + } +} + + static void invalidate_saved_current_state( struct gl_context *ctx ) { GLint i; @@ -7077,6 +7159,26 @@ execute_list(struct gl_context *ctx, GLuint list) CALL_BlendFuncSeparateEXT(ctx->Exec, (n[1].e, n[2].e, n[3].e, n[4].e)); break; + + case OPCODE_BLEND_FUNC_I: + /* GL_ARB_draw_buffers_blend */ + CALL_BlendFunciARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e)); + break; + case OPCODE_BLEND_FUNC_SEPARATE_I: + /* GL_ARB_draw_buffers_blend */ + CALL_BlendFuncSeparateiARB(ctx->Exec, (n[1].ui, n[2].e, n[3].e, + n[4].e, n[5].e)); + break; + case OPCODE_BLEND_EQUATION_I: + /* GL_ARB_draw_buffers_blend */ + CALL_BlendEquationiARB(ctx->Exec, (n[1].ui, n[2].e)); + break; + case OPCODE_BLEND_EQUATION_SEPARATE_I: + /* GL_ARB_draw_buffers_blend */ + CALL_BlendEquationSeparateiARB(ctx->Exec, + (n[1].ui, n[2].e, n[3].e)); + break; + case OPCODE_CALL_LIST: /* Generated by glCallList(), don't add ListBase */ if (ctx->ListState.CallDepth < MAX_LIST_NESTING) { @@ -9776,6 +9878,12 @@ _mesa_create_save_table(void) /* GL_ARB_instanced_arrays */ SET_VertexAttribDivisorARB(table, save_VertexAttribDivisor); + /* GL_ARB_draw_buffer_blend */ + SET_BlendFunciARB(table, save_BlendFunci); + SET_BlendFuncSeparateiARB(table, save_BlendFuncSeparatei); + SET_BlendEquationiARB(table, save_BlendEquationi); + SET_BlendEquationSeparateiARB(table, save_BlendEquationSeparatei); + return table; }