From e9f5a3e9e26b2d26c17e670a95454c3af109b8fa Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 5 May 2023 09:42:54 -0400 Subject: [PATCH] gsk: Introduce a constant We need this number in a couple of places, so pull it out as a constant. --- gsk/gl/gskglattachmentstateprivate.h | 6 ++++-- gsk/gl/gskglcommandqueue.c | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gsk/gl/gskglattachmentstateprivate.h b/gsk/gl/gskglattachmentstateprivate.h index 67141b0452..f65d7641a9 100644 --- a/gsk/gl/gskglattachmentstateprivate.h +++ b/gsk/gl/gskglattachmentstateprivate.h @@ -73,11 +73,13 @@ struct _GskGLBindFramebuffer G_STATIC_ASSERT (sizeof (GskGLBindFramebuffer) == 4); +/* Increase if shaders add more textures */ +#define GSK_GL_MAX_TEXTURES_PER_PROGRAM 4 + struct _GskGLAttachmentState { GskGLBindFramebuffer fbo; - /* Increase if shaders add more textures */ - GskGLBindTexture textures[4]; + GskGLBindTexture textures[GSK_GL_MAX_TEXTURES_PER_PROGRAM]; guint n_changed; }; diff --git a/gsk/gl/gskglcommandqueue.c b/gsk/gl/gskglcommandqueue.c index 50c9c3908c..30e3c83ba5 100644 --- a/gsk/gl/gskglcommandqueue.c +++ b/gsk/gl/gskglcommandqueue.c @@ -1028,8 +1028,8 @@ gsk_gl_command_queue_execute (GskGLCommandQueue *self, G_GNUC_UNUSED unsigned int n_programs = 0; guint vao_id; guint vbo_id; - int textures[4]; - int samplers[4]; + int textures[GSK_GL_MAX_TEXTURES_PER_PROGRAM]; + int samplers[GSK_GL_MAX_TEXTURES_PER_PROGRAM]; int framebuffer = -1; int next_batch_index; int active = -1; -- 2.30.2