[gtk/wip/chergert/glproto: 451/526] remove attachment save/restore
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/glproto: 451/526] remove attachment save/restore
- Date: Tue, 16 Feb 2021 01:14:38 +0000 (UTC)
commit 4b5d7b2c5e9278e303380e6900f1de9a6fbfb0e2
Author: Christian Hergert <chergert redhat com>
Date: Thu Feb 4 08:57:16 2021 -0800
remove attachment save/restore
we dont actually need this, so just delete it now
gsk/next/gskglattachmentstate.c | 58 ----------------------------------
gsk/next/gskglattachmentstateprivate.h | 2 --
gsk/next/gskglcommandqueue.c | 26 ---------------
gsk/next/gskglcommandqueueprivate.h | 7 ----
4 files changed, 93 deletions(-)
---
diff --git a/gsk/next/gskglattachmentstate.c b/gsk/next/gskglattachmentstate.c
index 5cb8f0b2d9..37d0c347fb 100644
--- a/gsk/next/gskglattachmentstate.c
+++ b/gsk/next/gskglattachmentstate.c
@@ -99,61 +99,3 @@ gsk_gl_attachment_state_bind_framebuffer (GskGLAttachmentState *self,
self->fbo.changed = TRUE;
}
}
-
-/**
- * gsk_gl_attachment_state_save:
- * @self: a #GskGLAttachmentState
- *
- * Creates a copy of @self that represents the current attachments
- * as known to @self.
- *
- * This can be used to restore state later, such as after running
- * various GL commands that are external to the GL renderer.
- *
- * This must be freed by calling either gsk_gl_attachment_state_unref()
- * or gsk_gl_attachment_state_restore().
- *
- * Returns: (transfer full): a new #GskGLAttachmentState or %NULL
- */
-GskGLAttachmentState *
-gsk_gl_attachment_state_save (GskGLAttachmentState *self)
-{
- GskGLAttachmentState *ret;
-
- if (self == NULL)
- return NULL;
-
- ret = g_slice_dup (GskGLAttachmentState, self);
- ret->fbo.changed = FALSE;
- for (guint i = 0; i < G_N_ELEMENTS (ret->textures); i++)
- ret->textures[i].changed = FALSE;
-
- return g_steal_pointer (&ret);
-}
-
-/**
- * gsk_gl_attachment_state_restore:
- * @self: (transfer full): the #GskGLAttachmentState
- *
- * Restores the attachment state and frees @self.
- */
-void
-gsk_gl_attachment_state_restore (GskGLAttachmentState *self)
-{
- if (self == NULL)
- return;
-
- glBindFramebuffer (GL_FRAMEBUFFER, self->fbo.id);
-
- for (guint i = 0; i < G_N_ELEMENTS (self->textures); i++)
- {
- if (!self->textures[i].initial)
- {
- glActiveTexture (GL_TEXTURE0 + i);
- glBindTexture (self->textures[i].target,
- self->textures[i].id);
- }
- }
-
- g_slice_free (GskGLAttachmentState, self);
-}
diff --git a/gsk/next/gskglattachmentstateprivate.h b/gsk/next/gskglattachmentstateprivate.h
index 5decdcd615..ef45119893 100644
--- a/gsk/next/gskglattachmentstateprivate.h
+++ b/gsk/next/gskglattachmentstateprivate.h
@@ -58,8 +58,6 @@ struct _GskGLAttachmentState
GskGLAttachmentState *gsk_gl_attachment_state_new (void);
GskGLAttachmentState *gsk_gl_attachment_state_ref (GskGLAttachmentState *self);
void gsk_gl_attachment_state_unref (GskGLAttachmentState *self);
-GskGLAttachmentState *gsk_gl_attachment_state_save (GskGLAttachmentState *self);
-void gsk_gl_attachment_state_restore (GskGLAttachmentState *self);
void gsk_gl_attachment_state_free (GskGLAttachmentState *self);
void gsk_gl_attachment_state_bind_texture (GskGLAttachmentState *self,
GLenum target,
diff --git a/gsk/next/gskglcommandqueue.c b/gsk/next/gskglcommandqueue.c
index 0f8433bfa7..7f5b441168 100644
--- a/gsk/next/gskglcommandqueue.c
+++ b/gsk/next/gskglcommandqueue.c
@@ -227,29 +227,6 @@ gsk_gl_command_queue_capture_png (GskGLCommandQueue *self,
g_free (data);
}
-static void
-gsk_gl_command_queue_save (GskGLCommandQueue *self)
-{
- g_assert (GSK_IS_GL_COMMAND_QUEUE (self));
-
- g_ptr_array_add (self->saved_state,
- gsk_gl_attachment_state_save (self->attachments));
-}
-
-static void
-gsk_gl_command_queue_restore (GskGLCommandQueue *self)
-{
- GskGLAttachmentState *saved;
-
- g_assert (GSK_IS_GL_COMMAND_QUEUE (self));
- g_assert (self->saved_state->len > 0);
-
- saved = g_ptr_array_steal_index (self->saved_state,
- self->saved_state->len - 1);
-
- gsk_gl_attachment_state_restore (saved);
-}
-
static void
gsk_gl_command_queue_dispose (GObject *object)
{
@@ -267,7 +244,6 @@ gsk_gl_command_queue_dispose (GObject *object)
g_clear_pointer (&self->batch_draws, g_array_unref);
g_clear_pointer (&self->batch_binds, g_array_unref);
g_clear_pointer (&self->batch_uniforms, g_array_unref);
- g_clear_pointer (&self->saved_state, g_ptr_array_unref);
G_OBJECT_CLASS (gsk_gl_command_queue_parent_class)->dispose (object);
}
@@ -290,7 +266,6 @@ gsk_gl_command_queue_init (GskGLCommandQueue *self)
self->batch_binds = g_array_new (FALSE, FALSE, sizeof (GskGLCommandBind));
self->batch_uniforms = g_array_new (FALSE, FALSE, sizeof (GskGLCommandUniform));
self->vertices = gsk_gl_buffer_new (GL_ARRAY_BUFFER, sizeof (GskGLDrawVertex));
- self->saved_state = g_ptr_array_new_with_free_func ((GDestroyNotify)gsk_gl_attachment_state_unref);
self->debug_groups = g_string_chunk_new (4096);
}
@@ -1025,7 +1000,6 @@ void
gsk_gl_command_queue_end_frame (GskGLCommandQueue *self)
{
g_assert (GSK_IS_GL_COMMAND_QUEUE (self));
- g_assert (self->saved_state->len == 0);
gsk_gl_command_queue_make_current (self);
gsk_gl_uniform_state_end_frame (self->uniforms);
diff --git a/gsk/next/gskglcommandqueueprivate.h b/gsk/next/gskglcommandqueueprivate.h
index 2c2e8904b9..3147fa33a8 100644
--- a/gsk/next/gskglcommandqueueprivate.h
+++ b/gsk/next/gskglcommandqueueprivate.h
@@ -221,13 +221,6 @@ struct _GskGLCommandQueue
*/
GArray *batch_uniforms;
- /* Sometimes we want to save attachment state so that operations we do
- * cannot affect anything that is known to the command queue. We call
- * gsk_gl_command_queue_save()/restore() which stashes attachment state
- * into this pointer array.
- */
- GPtrArray *saved_state;
-
/* String storage for debug groups */
GStringChunk *debug_groups;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]