]> git.cworth.org Git - vogl/commitdiff
- Adding snapshot/restore support for indeded variants of GL_BLEND
authorRich Geldreich <richgel99@gmail.com>
Tue, 25 Mar 2014 23:48:58 +0000 (16:48 -0700)
committerCarl Worth <cworth@cworth.org>
Tue, 1 Apr 2014 19:37:32 +0000 (12:37 -0700)
src/voglcommon/gl_gets.inc
src/voglcommon/gl_pname_defs.h
src/voglcommon/vogl_general_context_state.cpp

index 69a5943660636b334dc5524cfd0aae0caee0985f..cd7211c09e6961dac4eaebf8d92ea42498b08805 100644 (file)
@@ -484,6 +484,8 @@ DEFINE_GL_GET(GL_MAX_COLOR_ATTACHMENTS, 0x0030, 0x99)
 // Not sure about the version of the VAO binding
 DEFINE_GL_GET(GL_VERTEX_ARRAY_BINDING, 0x0030, 0x99)
 
+DEFINE_GL_INDEXED_GET(GL_BLEND, 0x030, 0x99, GL_MAX_DRAW_BUFFERS)
+
 // Start of version 3.1 -
 DEFINE_GL_GET(GL_MAX_RECTANGLE_TEXTURE_SIZE, 0x0031, 0x99)
 DEFINE_GL_GET(GL_MAX_TEXTURE_BUFFER_SIZE, 0x0031, 0x99)
index c67e912b7d54b76f8c21f151a317191fe27045a3..da8fd5cf7dcd851a1848c797bc1bd0740b103f71 100644 (file)
@@ -191,7 +191,7 @@ struct gl_pname_def_t
                 { "glGet",     'B',    1,      "GL_DITHER",  0x0BD0},
                 { "glGet",     'E',    1,      "GL_BLEND_DST",  0x0BE0},
                 { "glGet",     'E',    1,      "GL_BLEND_SRC",  0x0BE1},
-                { "glGet",     'B',    1,      "GL_BLEND",  0x0BE2},
+                { "glGet,glGetI",      'B',    1,      "GL_BLEND",  0x0BE2},
                 { "glGet",     'E',    1,      "GL_LOGIC_OP_MODE",  0x0BF0},
                 { "glGet",     'B',    1,      "GL_INDEX_LOGIC_OP",  0x0BF1},
                 { "glGet",     'B',    1,      "GL_COLOR_LOGIC_OP",  0x0BF2},
index c47a298515247882807bce32bef2bbd76c24e51f..95ceaee2d1935a3bb470d048b7d2220923327ca2 100644 (file)
@@ -1862,6 +1862,25 @@ bool vogl_general_context_state::restore(const vogl_context_info &context_info,
     restore_buffer_binding(GL_UNIFORM_BUFFER_BINDING, GL_UNIFORM_BUFFER, remapper);
     ADD_PROCESSED_STATE(GL_UNIFORM_BUFFER_BINDING, 0);
 
+    // Restore indexed blending state (we've already restored the global state, which sets all the indexed states)
+    for (uint i = 0; i < context_info.get_max_draw_buffers(); i++)
+    {
+        GLint enabled = 0;
+        if (get(GL_BLEND, i, &enabled, 1, true))
+        {
+            if (enabled)
+            {
+                GL_ENTRYPOINT(glEnablei)(GL_BLEND, i);
+                VOGL_CHECK_GL_ERROR;
+            }
+            else
+            {
+                GL_ENTRYPOINT(glDisablei)(GL_BLEND, i);
+                VOGL_CHECK_GL_ERROR;
+            }
+        }
+    }
+
     // TODO: these GL4 guys have indexed and offset/size variants
     restore_buffer_binding(GL_ATOMIC_COUNTER_BUFFER_BINDING, GL_ATOMIC_COUNTER_BUFFER, remapper);
     ADD_PROCESSED_STATE(GL_ATOMIC_COUNTER_BUFFER_BINDING, 0);