[gtk/wip/otte/for-main: 1/3] glrenderer: Don't return NULL form render_texture()




commit a2548ed5fdd8778bccbd496dcc7fc611063c650e
Author: Benjamin Otte <otte redhat com>
Date:   Fri Feb 25 03:40:57 2022 +0100

    glrenderer: Don't return NULL form render_texture()
    
    The correct approach here would be to draw multiple tiles and
    assemble them into a memory texture.
    
    But I wasn't up to the task, I just was annoyed again when my debugging
    code silently failed because I exceeded max texture size again.

 gsk/gl/gskglrenderer.c | 10 ++++++++++
 1 file changed, 10 insertions(+)
---
diff --git a/gsk/gl/gskglrenderer.c b/gsk/gl/gskglrenderer.c
index fe244a7a4f..39a0a9bb06 100644
--- a/gsk/gl/gskglrenderer.c
+++ b/gsk/gl/gskglrenderer.c
@@ -317,6 +317,16 @@ gsk_gl_renderer_render_texture (GskRenderer           *renderer,
 
   width = ceilf (viewport->size.width);
   height = ceilf (viewport->size.height);
+  if (width > self->command_queue->max_texture_size ||
+      height > self->command_queue->max_texture_size)
+    {
+      g_warning ("requested %dx%d texture, but GL can only do %dx%d",
+                 width, height,
+                 self->command_queue->max_texture_size,
+                 self->command_queue->max_texture_size);
+      width = MIN (width, self->command_queue->max_texture_size);
+      height = MIN (height, self->command_queue->max_texture_size);
+    }
 
   format = gsk_render_node_prefers_high_depth (root) ? GL_RGBA32F : GL_RGBA8;
 


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