Mesa (master): mesa: display list support for GL_ARB_draw_buffers_blend functions

Brian Paul brianp at kemper.freedesktop.org
Sun Jan 16 01:43:45 UTC 2011


Module: Mesa
Branch: master
Commit: 44c2122a737569e78af18c54994c3aa4035882ee
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=44c2122a737569e78af18c54994c3aa4035882ee

Author: Brian Paul <brianp at vmware.com>
Date:   Sat Jan 15 18:25:19 2011 -0700

mesa: display list support for GL_ARB_draw_buffers_blend functions

---

 src/mesa/main/dlist.c |  108 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 108 insertions(+), 0 deletions(-)

diff --git a/src/mesa/main/dlist.c b/src/mesa/main/dlist.c
index b28e36a..cdf3491 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;
 }
 




More information about the mesa-commit mailing list