[gtk/avoid-batch-size-overflow: 2/2] gsk: Don't overflow vbo_count




commit bd5e5beee00293e68c2b3f3c281b023958694880
Author: Matthias Clasen <mclasen redhat com>
Date:   Mon Jun 28 15:00:41 2021 -0400

    gsk: Don't overflow vbo_count
    
    We use 16 bits to store vbo_count, so we can't create
    batches that have more than 65535 vertices. Pay attention
    to that limit when merging batches.

 gsk/ngl/gsknglcommandqueue.c | 1 +
 1 file changed, 1 insertion(+)
---
diff --git a/gsk/ngl/gsknglcommandqueue.c b/gsk/ngl/gsknglcommandqueue.c
index 6d61dbaad6..5449fde9af 100644
--- a/gsk/ngl/gsknglcommandqueue.c
+++ b/gsk/ngl/gsknglcommandqueue.c
@@ -617,6 +617,7 @@ gsk_ngl_command_queue_end_draw (GskNglCommandQueue *self)
       last_batch->any.viewport.height == batch->any.viewport.height &&
       last_batch->draw.framebuffer == batch->draw.framebuffer &&
       last_batch->draw.vbo_offset + last_batch->draw.vbo_count == batch->draw.vbo_offset &&
+      last_batch->draw.vbo_count + batch->draw.vbo_count < G_MAXINT16 &&
       snapshots_equal (self, last_batch, batch))
     {
       last_batch->draw.vbo_count += batch->draw.vbo_count;


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