[gtk/wip/chergert/glproto] next: use width/height to begin draw



commit d36b8f07e837b3e6069c4fddc3c9c2135d8acda4
Author: Christian Hergert <chergert redhat com>
Date:   Tue Feb 23 11:50:51 2021 -0800

    next: use width/height to begin draw
    
    We don't need the graphene_rect_t here at all, since we only use the size
    of the area. Furthermore, we don't need to pass the pointer to the address
    either, just use registers for what they're good at.

 gsk/next/gskglcommandqueue.c        | 25 +++++++++++++------------
 gsk/next/gskglcommandqueueprivate.h |  3 ++-
 gsk/next/gskglrenderjob.c           |  3 ++-
 3 files changed, 17 insertions(+), 14 deletions(-)
---
diff --git a/gsk/next/gskglcommandqueue.c b/gsk/next/gskglcommandqueue.c
index a61109bfc6..583d43bbdc 100644
--- a/gsk/next/gskglcommandqueue.c
+++ b/gsk/next/gskglcommandqueue.c
@@ -521,15 +521,17 @@ discard_batch (GskGLCommandQueue *self)
 }
 
 void
-gsk_gl_command_queue_begin_draw (GskGLCommandQueue     *self,
-                                 GskGLUniformProgram   *program,
-                                 const graphene_rect_t *viewport)
+gsk_gl_command_queue_begin_draw (GskGLCommandQueue   *self,
+                                 GskGLUniformProgram *program,
+                                 guint                width,
+                                 guint                height)
 {
   GskGLCommandBatch *batch;
 
   g_assert (GSK_IS_GL_COMMAND_QUEUE (self));
   g_assert (self->in_draw == FALSE);
-  g_assert (viewport != NULL);
+  g_assert (width <= G_MAXUINT16);
+  g_assert (height <= G_MAXUINT16);
 
   /* Our internal links use 16-bits, so that is our max number
    * of batches we can have in one frame.
@@ -543,8 +545,8 @@ gsk_gl_command_queue_begin_draw (GskGLCommandQueue     *self,
   batch->any.kind = GSK_GL_COMMAND_KIND_DRAW;
   batch->any.program = program->program_id;
   batch->any.next_batch_index = -1;
-  batch->any.viewport.width = viewport->size.width;
-  batch->any.viewport.height = viewport->size.height;
+  batch->any.viewport.width = width;
+  batch->any.viewport.height = height;
   batch->draw.framebuffer = 0;
   batch->draw.uniform_count = 0;
   batch->draw.uniform_offset = self->batch_uniforms.len;
@@ -651,7 +653,8 @@ gsk_gl_command_queue_split_draw (GskGLCommandQueue *self)
 {
   GskGLCommandBatch *batch;
   GskGLUniformProgram *program;
-  graphene_rect_t viewport;
+  guint width;
+  guint height;
 
   g_assert (GSK_IS_GL_COMMAND_QUEUE (self));
   g_assert (self->batches.len > 0);
@@ -663,13 +666,11 @@ gsk_gl_command_queue_split_draw (GskGLCommandQueue *self)
 
   g_assert (batch->any.kind == GSK_GL_COMMAND_KIND_DRAW);
 
-  viewport.origin.x = 0;
-  viewport.origin.y = 0;
-  viewport.size.width = batch->any.viewport.width;
-  viewport.size.height = batch->any.viewport.height;
+  width = batch->any.viewport.width;
+  height = batch->any.viewport.height;
 
   gsk_gl_command_queue_end_draw (self);
-  gsk_gl_command_queue_begin_draw (self, program, &viewport);
+  gsk_gl_command_queue_begin_draw (self, program, width, height);
 }
 
 void
diff --git a/gsk/next/gskglcommandqueueprivate.h b/gsk/next/gskglcommandqueueprivate.h
index 2fd6145fc9..99fd47e9ca 100644
--- a/gsk/next/gskglcommandqueueprivate.h
+++ b/gsk/next/gskglcommandqueueprivate.h
@@ -309,7 +309,8 @@ void               gsk_gl_command_queue_clear                (GskGLCommandQueue
                                                               const graphene_rect_t    *viewport);
 void               gsk_gl_command_queue_begin_draw           (GskGLCommandQueue        *self,
                                                               GskGLUniformProgram      *program_info,
-                                                              const graphene_rect_t    *viewport);
+                                                              guint                     width,
+                                                              guint                     height);
 void               gsk_gl_command_queue_end_draw             (GskGLCommandQueue        *self);
 void               gsk_gl_command_queue_split_draw           (GskGLCommandQueue        *self);
 
diff --git a/gsk/next/gskglrenderjob.c b/gsk/next/gskglrenderjob.c
index ffae677f9a..f9df1e4f77 100644
--- a/gsk/next/gskglrenderjob.c
+++ b/gsk/next/gskglrenderjob.c
@@ -921,7 +921,8 @@ gsk_gl_render_job_begin_draw (GskGLRenderJob *job,
 {
   gsk_gl_command_queue_begin_draw (job->command_queue,
                                    program->program_info,
-                                   &job->viewport);
+                                   job->viewport.size.width,
+                                   job->viewport.size.height);
 
   if (program->uniform_locations[UNIFORM_SHARED_VIEWPORT] > -1)
     gsk_gl_uniform_state_set4fv (program->uniforms,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]