mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-13 20:30:11 +00:00
gsk: make logging per-renderer
Add a setter for per-renderer debug flags, and use them where possible. Some places don't have easy access to a renderer, so this is not complete. Also, use g_message instead of g_print throughout.
This commit is contained in:
parent
782c76c146
commit
c56419818f
@ -154,7 +154,7 @@ gsk_gl_driver_begin_frame (GskGLDriver *self)
|
||||
if (self->max_texture_size < 0)
|
||||
{
|
||||
glGetIntegerv (GL_MAX_TEXTURE_SIZE, (GLint *) &self->max_texture_size);
|
||||
GSK_NOTE (OPENGL, g_print ("GL max texture size: %d\n", self->max_texture_size));
|
||||
GSK_NOTE (OPENGL, g_message ("GL max texture size: %d", self->max_texture_size));
|
||||
}
|
||||
|
||||
glBindFramebuffer (GL_FRAMEBUFFER, 0);
|
||||
@ -189,16 +189,16 @@ gsk_gl_driver_end_frame (GskGLDriver *self)
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
GSK_NOTE (OPENGL,
|
||||
g_print ("Textures created: %ld\n"
|
||||
g_message ("Textures created: %ld\n"
|
||||
" Textures reused: %ld\n"
|
||||
" Surface uploads: %ld\n",
|
||||
" Surface uploads: %ld",
|
||||
gsk_profiler_counter_get (self->profiler, self->counters.created_textures),
|
||||
gsk_profiler_counter_get (self->profiler, self->counters.reused_textures),
|
||||
gsk_profiler_counter_get (self->profiler, self->counters.surface_uploads)));
|
||||
#endif
|
||||
|
||||
GSK_NOTE (OPENGL,
|
||||
g_print ("*** Frame end: textures=%d\n",
|
||||
g_message ("*** Frame end: textures=%d",
|
||||
g_hash_table_size (self->textures)));
|
||||
|
||||
self->in_frame = FALSE;
|
||||
@ -326,7 +326,7 @@ create_texture (GskGLDriver *self,
|
||||
t = find_texture_by_size (self->textures, width, height);
|
||||
if (t != NULL && !t->in_use && t->user == NULL)
|
||||
{
|
||||
GSK_NOTE (OPENGL, g_print ("Reusing Texture(%d) for size %dx%d\n",
|
||||
GSK_NOTE (OPENGL, g_message ("Reusing Texture(%d) for size %dx%d",
|
||||
t->texture_id, t->width, t->height));
|
||||
t->in_use = TRUE;
|
||||
|
||||
|
@ -80,6 +80,7 @@ free_atlas (gpointer v)
|
||||
|
||||
void
|
||||
gsk_gl_glyph_cache_init (GskGLGlyphCache *self,
|
||||
GskRenderer *renderer,
|
||||
GskGLDriver *gl_driver)
|
||||
{
|
||||
self->hash_table = g_hash_table_new_full (glyph_cache_hash, glyph_cache_equal,
|
||||
@ -87,6 +88,7 @@ gsk_gl_glyph_cache_init (GskGLGlyphCache *self,
|
||||
self->atlases = g_ptr_array_new_with_free_func (free_atlas);
|
||||
g_ptr_array_add (self->atlases, create_atlas (self));
|
||||
|
||||
self->renderer = renderer;
|
||||
self->gl_driver = gl_driver;
|
||||
}
|
||||
|
||||
@ -214,7 +216,7 @@ add_to_cache (GskGLGlyphCache *cache,
|
||||
atlas->num_glyphs++;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GSK_DEBUG_CHECK(GLYPH_CACHE))
|
||||
if (GSK_RENDERER_DEBUG_CHECK (cache->renderer, GLYPH_CACHE))
|
||||
{
|
||||
g_print ("Glyph cache:\n");
|
||||
for (i = 0; i < cache->atlases->len; i++)
|
||||
@ -296,8 +298,8 @@ upload_dirty_glyphs (GskGLGlyphCache *self,
|
||||
for (l = atlas->dirty_glyphs, i = 0; l; l = l->next, i++)
|
||||
render_glyph (atlas, (DirtyGlyph *)l->data, ®ions[i]);
|
||||
|
||||
GSK_NOTE (GLYPH_CACHE,
|
||||
g_print ("uploading %d glyphs to cache\n", num_regions));
|
||||
GSK_RENDERER_NOTE (self->renderer, GLYPH_CACHE,
|
||||
g_message ("uploading %d glyphs to cache", num_regions));
|
||||
|
||||
|
||||
gsk_gl_image_upload_regions (atlas->image, self->gl_driver, num_regions, regions);
|
||||
@ -425,8 +427,8 @@ gsk_gl_glyph_cache_begin_frame (GskGLGlyphCache *self)
|
||||
|
||||
if (atlas->old_pixels > MAX_OLD * atlas->width * atlas->height)
|
||||
{
|
||||
GSK_NOTE(GLYPH_CACHE,
|
||||
g_print ("Dropping atlas %d (%g.2%% old)\n",
|
||||
GSK_RENDERER_NOTE(self->renderer, GLYPH_CACHE,
|
||||
g_message ("Dropping atlas %d (%g.2%% old)",
|
||||
i, 100.0 * (double)atlas->old_pixels / (double)(atlas->width * atlas->height)));
|
||||
|
||||
if (atlas->image)
|
||||
@ -448,5 +450,5 @@ gsk_gl_glyph_cache_begin_frame (GskGLGlyphCache *self)
|
||||
}
|
||||
}
|
||||
|
||||
GSK_NOTE(GLYPH_CACHE, g_print ("Dropped %d glyphs\n", dropped));
|
||||
GSK_RENDERER_NOTE(self->renderer, GLYPH_CACHE, g_message ("Dropped %d glyphs", dropped));
|
||||
}
|
||||
|
@ -3,12 +3,14 @@
|
||||
|
||||
#include "gskgldriverprivate.h"
|
||||
#include "gskglimageprivate.h"
|
||||
#include "gskrendererprivate.h"
|
||||
#include <pango/pango.h>
|
||||
#include <gdk/gdk.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
GskGLDriver *gl_driver;
|
||||
GskRenderer *renderer;
|
||||
|
||||
GHashTable *hash_table;
|
||||
GPtrArray *atlases;
|
||||
@ -45,6 +47,7 @@ typedef struct
|
||||
} GskGLCachedGlyph;
|
||||
|
||||
void gsk_gl_glyph_cache_init (GskGLGlyphCache *self,
|
||||
GskRenderer *renderer,
|
||||
GskGLDriver *gl_driver);
|
||||
void gsk_gl_glyph_cache_free (GskGLGlyphCache *self);
|
||||
void gsk_gl_glyph_cache_begin_frame (GskGLGlyphCache *self);
|
||||
|
@ -1624,7 +1624,7 @@ gsk_gl_renderer_create_buffers (GskGLRenderer *self,
|
||||
if (self->has_buffers)
|
||||
return;
|
||||
|
||||
GSK_NOTE (OPENGL, g_print ("Creating buffers (w:%d, h:%d, scale:%d)\n", width, height, scale_factor));
|
||||
GSK_RENDERER_NOTE (GSK_RENDERER (self), OPENGL, g_message ("Creating buffers (w:%d, h:%d, scale:%d)", width, height, scale_factor));
|
||||
|
||||
if (self->texture_id == 0)
|
||||
{
|
||||
@ -1650,7 +1650,7 @@ gsk_gl_renderer_destroy_buffers (GskGLRenderer *self)
|
||||
if (!self->has_buffers)
|
||||
return;
|
||||
|
||||
GSK_NOTE (OPENGL, g_print ("Destroying buffers\n"));
|
||||
GSK_RENDERER_NOTE (GSK_RENDERER (self), OPENGL, g_message ("Destroying buffers"));
|
||||
|
||||
gdk_gl_context_make_current (self->gl_context);
|
||||
|
||||
@ -1838,11 +1838,11 @@ gsk_gl_renderer_realize (GskRenderer *renderer,
|
||||
self->gl_profiler = gsk_gl_profiler_new (self->gl_context);
|
||||
self->gl_driver = gsk_gl_driver_new (self->gl_context);
|
||||
|
||||
GSK_NOTE (OPENGL, g_print ("Creating buffers and programs\n"));
|
||||
GSK_RENDERER_NOTE (renderer, OPENGL, g_message ("Creating buffers and programs"));
|
||||
if (!gsk_gl_renderer_create_programs (self, error))
|
||||
return FALSE;
|
||||
|
||||
gsk_gl_glyph_cache_init (&self->glyph_cache, self->gl_driver);
|
||||
gsk_gl_glyph_cache_init (&self->glyph_cache, renderer, self->gl_driver);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@ -1931,7 +1931,7 @@ gsk_gl_renderer_resize_viewport (GskGLRenderer *self,
|
||||
int width = viewport->size.width;
|
||||
int height = viewport->size.height;
|
||||
|
||||
GSK_NOTE (OPENGL, g_print ("glViewport(0, 0, %d, %d) [scale:%d]\n",
|
||||
GSK_RENDERER_NOTE (GSK_RENDERER (self), OPENGL, g_message ("glViewport(0, 0, %d, %d) [scale:%d]",
|
||||
width,
|
||||
height,
|
||||
self->scale_factor));
|
||||
@ -1955,13 +1955,13 @@ gsk_gl_renderer_clear_tree (GskGLRenderer *self)
|
||||
g_array_remove_range (self->render_ops, 0, self->render_ops->len);
|
||||
removed_textures = gsk_gl_driver_collect_textures (self->gl_driver);
|
||||
|
||||
GSK_NOTE (OPENGL, g_print ("Collected: %d textures\n", removed_textures));
|
||||
GSK_RENDERER_NOTE (GSK_RENDERER (self), OPENGL, g_message ("Collected: %d textures", removed_textures));
|
||||
}
|
||||
|
||||
static void
|
||||
gsk_gl_renderer_clear (GskGLRenderer *self)
|
||||
{
|
||||
GSK_NOTE (OPENGL, g_print ("Clearing viewport\n"));
|
||||
GSK_RENDERER_NOTE (GSK_RENDERER (self), OPENGL, g_message ("Clearing viewport"));
|
||||
glClearColor (0, 0, 0, 0);
|
||||
glClear (GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT | GL_STENCIL_BUFFER_BIT);
|
||||
}
|
||||
@ -2386,7 +2386,7 @@ gsk_gl_renderer_do_render (GskRenderer *renderer,
|
||||
|
||||
if (self->gl_context == NULL)
|
||||
{
|
||||
GSK_NOTE (OPENGL, g_print ("No valid GL context associated to the renderer"));
|
||||
GSK_RENDERER_NOTE (renderer, OPENGL, g_message ("No valid GL context associated to the renderer"));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -22,12 +22,13 @@ static const GDebugKey gsk_rendering_keys[] = {
|
||||
{ "staging-buffer", GSK_RENDERING_MODE_STAGING_BUFFER }
|
||||
};
|
||||
|
||||
gboolean
|
||||
gsk_check_debug_flags (GskDebugFlags flags)
|
||||
static guint gsk_debug_flags;
|
||||
|
||||
static void
|
||||
init_debug_flags (void)
|
||||
{
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
static volatile gsize gsk_debug_flags__set;
|
||||
static guint gsk_debug_flags;
|
||||
|
||||
if (g_once_init_enter (&gsk_debug_flags__set))
|
||||
{
|
||||
@ -39,11 +40,23 @@ gsk_check_debug_flags (GskDebugFlags flags)
|
||||
|
||||
g_once_init_leave (&gsk_debug_flags__set, TRUE);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
gboolean
|
||||
gsk_check_debug_flags (GskDebugFlags flags)
|
||||
{
|
||||
init_debug_flags ();
|
||||
|
||||
return (gsk_debug_flags & flags) != 0;
|
||||
#else
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
|
||||
GskDebugFlags
|
||||
gsk_get_debug_flags (void)
|
||||
{
|
||||
init_debug_flags ();
|
||||
|
||||
return gsk_debug_flags;
|
||||
}
|
||||
|
||||
gboolean
|
||||
|
@ -16,7 +16,7 @@ typedef enum {
|
||||
GSK_DEBUG_GLYPH_CACHE = 1 << 7
|
||||
} GskDebugFlags;
|
||||
|
||||
#define GSK_DEBUG_ANY ((1 << 9) - 1)
|
||||
#define GSK_DEBUG_ANY ((1 << 8) - 1)
|
||||
|
||||
typedef enum {
|
||||
GSK_RENDERING_MODE_GEOMETRY = 1 << 0,
|
||||
@ -27,6 +27,7 @@ typedef enum {
|
||||
GSK_RENDERING_MODE_STAGING_BUFFER = 1 << 5
|
||||
} GskRenderingMode;
|
||||
|
||||
GskDebugFlags gsk_get_debug_flags (void);
|
||||
gboolean gsk_check_debug_flags (GskDebugFlags flags);
|
||||
|
||||
gboolean gsk_check_rendering_flags (GskRenderingMode flags);
|
||||
@ -34,25 +35,26 @@ gboolean gsk_check_rendering_flags (GskRenderingMode flags);
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
|
||||
#define GSK_DEBUG_CHECK(type) G_UNLIKELY (gsk_check_debug_flags (GSK_DEBUG_ ## type))
|
||||
#define GSK_DEBUG_CHECK2(type1,type2) G_UNLIKELY (gsk_check_debug_flags (GSK_DEBUG_ ## type1 | GSK_DEBUG_ ## type2))
|
||||
#define GSK_RENDER_MODE_CHECK(type) G_UNLIKELY (gsk_check_rendering_flags (GSK_RENDERING_MODE_ ## type))
|
||||
#define GSK_RENDERER_DEBUG_CHECK(renderer,type) \
|
||||
G_UNLIKELY ((gsk_renderer_get_debug_flags (renderer) & GSK_DEBUG_ ## type) != 0)
|
||||
|
||||
#define GSK_NOTE(type,action) G_STMT_START { \
|
||||
if (GSK_DEBUG_CHECK (type)) { \
|
||||
action; \
|
||||
} } G_STMT_END
|
||||
|
||||
#define GSK_NOTE2(type1,type2,action) G_STMT_START { \
|
||||
if (GSK_DEBUG_CHECK2 (type1, type2)) { \
|
||||
action; \
|
||||
#define GSK_RENDERER_NOTE(renderer,type,action) G_STMT_START { \
|
||||
if (GSK_RENDERER_DEBUG_CHECK (renderer,type)) { \
|
||||
action; \
|
||||
} } G_STMT_END
|
||||
|
||||
#else
|
||||
|
||||
#define GSK_RENDER_MODE_CHECK(type) 0
|
||||
#define GSK_DEBUG_CHECK(type) 0
|
||||
#define GSK_DEBUG_CHECK2(type1,type2) 0
|
||||
#define GSK_RENDERER_DEBUG_CHECK(renderer,type) 0
|
||||
#define GSK_NOTE(type,action)
|
||||
#define GSK_NOTE2(type1,type2,action)
|
||||
#define GSK_RENDERER_NOTE(renderer,type,action)
|
||||
|
||||
#endif
|
||||
|
||||
|
@ -76,6 +76,8 @@ typedef struct
|
||||
|
||||
GskProfiler *profiler;
|
||||
|
||||
GskDebugFlags debug_flags;
|
||||
|
||||
gboolean is_realized : 1;
|
||||
} GskRendererPrivate;
|
||||
|
||||
@ -314,6 +316,7 @@ gsk_renderer_init (GskRenderer *self)
|
||||
GskRendererPrivate *priv = gsk_renderer_get_instance_private (self);
|
||||
|
||||
priv->profiler = gsk_profiler_new ();
|
||||
priv->debug_flags = gsk_get_debug_flags ();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -515,7 +518,7 @@ gsk_renderer_render_texture (GskRenderer *renderer,
|
||||
texture = GSK_RENDERER_GET_CLASS (renderer)->render_texture (renderer, root, viewport);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GSK_DEBUG_CHECK (RENDERER))
|
||||
if (GSK_RENDERER_DEBUG_CHECK (renderer, RENDERER))
|
||||
{
|
||||
GString *buf = g_string_new ("*** Texture stats ***\n\n");
|
||||
|
||||
@ -569,7 +572,7 @@ gsk_renderer_render (GskRenderer *renderer,
|
||||
GSK_RENDERER_GET_CLASS (renderer)->render (renderer, root);
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GSK_DEBUG_CHECK (RENDERER))
|
||||
if (GSK_RENDERER_DEBUG_CHECK (renderer, RENDERER))
|
||||
{
|
||||
GString *buf = g_string_new ("*** Frame stats ***\n\n");
|
||||
|
||||
@ -737,7 +740,7 @@ gsk_renderer_new_for_window (GdkWindow *window)
|
||||
|
||||
if (gsk_renderer_realize (renderer, window, &error))
|
||||
{
|
||||
if (verbose || GSK_DEBUG_CHECK (RENDERER))
|
||||
if (verbose || GSK_RENDERER_DEBUG_CHECK (renderer, RENDERER))
|
||||
{
|
||||
g_print ("Using renderer of type '%s' for window '%s'\n",
|
||||
G_OBJECT_TYPE_NAME (renderer),
|
||||
@ -746,7 +749,7 @@ gsk_renderer_new_for_window (GdkWindow *window)
|
||||
return renderer;
|
||||
}
|
||||
|
||||
if (verbose || GSK_DEBUG_CHECK (RENDERER))
|
||||
if (verbose || GSK_RENDERER_DEBUG_CHECK (renderer, RENDERER))
|
||||
{
|
||||
g_print ("Failed to realize renderer of type '%s' for window '%s': %s\n",
|
||||
G_OBJECT_TYPE_NAME (renderer),
|
||||
@ -846,3 +849,23 @@ gsk_renderer_end_draw_frame (GskRenderer *renderer,
|
||||
GSK_RENDERER_GET_CLASS (renderer)->end_draw_frame (renderer, context);
|
||||
}
|
||||
|
||||
GskDebugFlags
|
||||
gsk_renderer_get_debug_flags (GskRenderer *renderer)
|
||||
{
|
||||
GskRendererPrivate *priv = gsk_renderer_get_instance_private (renderer);
|
||||
|
||||
g_return_val_if_fail (GSK_IS_RENDERER (renderer), 0);
|
||||
|
||||
return priv->debug_flags;
|
||||
}
|
||||
|
||||
void
|
||||
gsk_renderer_set_debug_flags (GskRenderer *renderer,
|
||||
GskDebugFlags flags)
|
||||
{
|
||||
GskRendererPrivate *priv = gsk_renderer_get_instance_private (renderer);
|
||||
|
||||
g_return_if_fail (GSK_IS_RENDERER (renderer));
|
||||
|
||||
priv->debug_flags = flags;
|
||||
}
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include "gskrenderer.h"
|
||||
#include "gskprofilerprivate.h"
|
||||
#include "gskdebugprivate.h"
|
||||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
@ -69,6 +70,10 @@ cairo_surface_t * gsk_renderer_create_cairo_surface (GskRenderer
|
||||
|
||||
GskProfiler * gsk_renderer_get_profiler (GskRenderer *renderer);
|
||||
|
||||
GskDebugFlags gsk_renderer_get_debug_flags (GskRenderer *renderer);
|
||||
void gsk_renderer_set_debug_flags (GskRenderer *renderer,
|
||||
GskDebugFlags flags);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GSK_RENDERER_PRIVATE_H__ */
|
||||
|
@ -241,7 +241,7 @@ gsk_render_node_draw (GskRenderNode *node,
|
||||
|
||||
if (!GSK_RENDER_MODE_CHECK (GEOMETRY))
|
||||
{
|
||||
GSK_NOTE (CAIRO, g_print ("CLIP = { .x = %g, .y = %g, .width = %g, .height = %g }\n",
|
||||
GSK_NOTE (CAIRO, g_message ("CLIP = { .x = %g, .y = %g, .width = %g, .height = %g }",
|
||||
node->bounds.origin.x, node->bounds.origin.y,
|
||||
node->bounds.size.width, node->bounds.size.height));
|
||||
|
||||
@ -249,7 +249,7 @@ gsk_render_node_draw (GskRenderNode *node,
|
||||
cairo_clip (cr);
|
||||
}
|
||||
|
||||
GSK_NOTE (CAIRO, g_print ("Rendering node %s[%p]\n",
|
||||
GSK_NOTE (CAIRO, g_message ("Rendering node %s[%p]",
|
||||
node->name ? node->name : node->node_class->type_name,
|
||||
node));
|
||||
|
||||
|
@ -1953,7 +1953,7 @@ gsk_cairo_node_get_draw_context (GskRenderNode *node,
|
||||
node->bounds.size.width, node->bounds.size.height);
|
||||
cairo_clip (res);
|
||||
|
||||
if (GSK_DEBUG_CHECK (SURFACE))
|
||||
if (GSK_RENDERER_DEBUG_CHECK (renderer, SURFACE))
|
||||
{
|
||||
const char *prefix;
|
||||
prefix = g_getenv ("GSK_DEBUG_PREFIX");
|
||||
@ -2198,7 +2198,7 @@ gsk_transform_node_draw (GskRenderNode *node,
|
||||
|
||||
if (graphene_matrix_to_2d (&self->transform, &ctm.xx, &ctm.yx, &ctm.xy, &ctm.yy, &ctm.x0, &ctm.y0))
|
||||
{
|
||||
GSK_NOTE (CAIRO, g_print ("CTM = { .xx = %g, .yx = %g, .xy = %g, .yy = %g, .x0 = %g, .y0 = %g }\n",
|
||||
GSK_NOTE (CAIRO, g_message ("CTM = { .xx = %g, .yx = %g, .xy = %g, .yy = %g, .x0 = %g, .y0 = %g }",
|
||||
ctm.xx, ctm.yx,
|
||||
ctm.xy, ctm.yy,
|
||||
ctm.x0, ctm.y0));
|
||||
|
@ -5,6 +5,7 @@
|
||||
#include "gskvulkanimageprivate.h"
|
||||
#include "gskdebugprivate.h"
|
||||
#include "gskprivate.h"
|
||||
#include "gskrendererprivate.h"
|
||||
|
||||
#include <graphene.h>
|
||||
|
||||
@ -35,6 +36,7 @@ struct _GskVulkanGlyphCache {
|
||||
GObject parent_instance;
|
||||
|
||||
GdkVulkanContext *vulkan;
|
||||
GskRenderer *renderer;
|
||||
|
||||
GHashTable *hash_table;
|
||||
GPtrArray *atlases;
|
||||
@ -226,7 +228,7 @@ add_to_cache (GskVulkanGlyphCache *cache,
|
||||
atlas->num_glyphs++;
|
||||
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
if (GSK_DEBUG_CHECK(GLYPH_CACHE))
|
||||
if (GSK_RENDERER_DEBUG_CHECK (cache->renderer, GLYPH_CACHE))
|
||||
{
|
||||
g_print ("Glyph cache:\n");
|
||||
for (i = 0; i < cache->atlases->len; i++)
|
||||
@ -288,8 +290,9 @@ render_glyph (Atlas *atlas,
|
||||
}
|
||||
|
||||
static void
|
||||
upload_dirty_glyphs (Atlas *atlas,
|
||||
GskVulkanUploader *uploader)
|
||||
upload_dirty_glyphs (GskVulkanGlyphCache *cache,
|
||||
Atlas *atlas,
|
||||
GskVulkanUploader *uploader)
|
||||
{
|
||||
GList *l;
|
||||
guint num_regions;
|
||||
@ -302,8 +305,8 @@ upload_dirty_glyphs (Atlas *atlas,
|
||||
for (l = atlas->dirty_glyphs, i = 0; l; l = l->next, i++)
|
||||
render_glyph (atlas, (DirtyGlyph *)l->data, ®ions[i]);
|
||||
|
||||
GSK_NOTE (GLYPH_CACHE,
|
||||
g_print ("uploading %d glyphs to cache\n", num_regions));
|
||||
GSK_RENDERER_NOTE (cache->renderer, GLYPH_CACHE,
|
||||
g_message ("uploading %d glyphs to cache", num_regions));
|
||||
|
||||
gsk_vulkan_image_upload_regions (atlas->image, uploader, num_regions, regions);
|
||||
|
||||
@ -312,11 +315,13 @@ upload_dirty_glyphs (Atlas *atlas,
|
||||
}
|
||||
|
||||
GskVulkanGlyphCache *
|
||||
gsk_vulkan_glyph_cache_new (GdkVulkanContext *vulkan)
|
||||
gsk_vulkan_glyph_cache_new (GskRenderer *renderer,
|
||||
GdkVulkanContext *vulkan)
|
||||
{
|
||||
GskVulkanGlyphCache *cache;
|
||||
|
||||
cache = GSK_VULKAN_GLYPH_CACHE (g_object_new (GSK_TYPE_VULKAN_GLYPH_CACHE, NULL));
|
||||
cache->renderer = renderer;
|
||||
cache->vulkan = vulkan;
|
||||
g_ptr_array_add (cache->atlases, create_atlas (cache));
|
||||
|
||||
@ -395,7 +400,7 @@ gsk_vulkan_glyph_cache_get_glyph_image (GskVulkanGlyphCache *cache,
|
||||
atlas->image = gsk_vulkan_image_new_for_atlas (cache->vulkan, atlas->width, atlas->height);
|
||||
|
||||
if (atlas->dirty_glyphs)
|
||||
upload_dirty_glyphs (atlas, uploader);
|
||||
upload_dirty_glyphs (cache, atlas, uploader);
|
||||
|
||||
return atlas->image;
|
||||
}
|
||||
@ -449,8 +454,8 @@ gsk_vulkan_glyph_cache_begin_frame (GskVulkanGlyphCache *cache)
|
||||
|
||||
if (atlas->old_pixels > MAX_OLD * atlas->width * atlas->height)
|
||||
{
|
||||
GSK_NOTE(GLYPH_CACHE,
|
||||
g_print ("Dropping atlas %d (%g.2%% old)\n", i, 100.0 * (double)atlas->old_pixels / (double)(atlas->width * atlas->height)));
|
||||
GSK_RENDERER_NOTE(cache->renderer, GLYPH_CACHE,
|
||||
g_message ("Dropping atlas %d (%g.2%% old)", i, 100.0 * (double)atlas->old_pixels / (double)(atlas->width * atlas->height)));
|
||||
g_ptr_array_remove_index (cache->atlases, i);
|
||||
|
||||
drops[i] = 1;
|
||||
@ -479,5 +484,5 @@ gsk_vulkan_glyph_cache_begin_frame (GskVulkanGlyphCache *cache)
|
||||
}
|
||||
}
|
||||
|
||||
GSK_NOTE(GLYPH_CACHE, g_print ("Dropped %d glyphs\n", dropped));
|
||||
GSK_RENDERER_NOTE(cache->renderer, GLYPH_CACHE, g_message ("Dropped %d glyphs", dropped));
|
||||
}
|
||||
|
@ -11,7 +11,8 @@ G_BEGIN_DECLS
|
||||
|
||||
G_DECLARE_FINAL_TYPE(GskVulkanGlyphCache, gsk_vulkan_glyph_cache, GSK, VULKAN_GLYPH_CACHE, GObject)
|
||||
|
||||
GskVulkanGlyphCache *gsk_vulkan_glyph_cache_new (GdkVulkanContext *vulkan);
|
||||
GskVulkanGlyphCache *gsk_vulkan_glyph_cache_new (GskRenderer *renderer,
|
||||
GdkVulkanContext *vulkan);
|
||||
|
||||
GskVulkanImage * gsk_vulkan_glyph_cache_get_glyph_image (GskVulkanGlyphCache *cache,
|
||||
GskVulkanUploader *uploader,
|
||||
|
@ -127,7 +127,7 @@ gsk_vulkan_renderer_realize (GskRenderer *renderer,
|
||||
|
||||
self->render = gsk_vulkan_render_new (renderer, self->vulkan);
|
||||
|
||||
self->glyph_cache = gsk_vulkan_glyph_cache_new (self->vulkan);
|
||||
self->glyph_cache = gsk_vulkan_glyph_cache_new (renderer, self->vulkan);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
@ -254,7 +254,7 @@ font_has_color_glyphs (const PangoFont *font)
|
||||
}
|
||||
|
||||
#define FALLBACK(...) G_STMT_START { \
|
||||
GSK_NOTE (FALLBACK, g_print (__VA_ARGS__)); \
|
||||
GSK_RENDERER_NOTE (gsk_vulkan_render_get_renderer (render), FALLBACK, g_message (__VA_ARGS__)); \
|
||||
goto fallback; \
|
||||
}G_STMT_END
|
||||
|
||||
@ -277,7 +277,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
|
||||
return;
|
||||
case GSK_SHADOW_NODE:
|
||||
default:
|
||||
FALLBACK ("Unsupported node '%s'\n", node->node_class->type_name);
|
||||
FALLBACK ("Unsupported node '%s'", node->node_class->type_name);
|
||||
|
||||
case GSK_REPEAT_NODE:
|
||||
if (gsk_vulkan_clip_contains_rect (&constants->clip, &node->bounds))
|
||||
@ -287,7 +287,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
|
||||
else if (constants->clip.type == GSK_VULKAN_CLIP_ROUNDED_CIRCULAR)
|
||||
pipeline_type = GSK_VULKAN_PIPELINE_TEXTURE_CLIP_ROUNDED;
|
||||
else
|
||||
FALLBACK ("Repeat nodes can't deal with clip type %u\n", constants->clip.type);
|
||||
FALLBACK ("Repeat nodes can't deal with clip type %u", constants->clip.type);
|
||||
op.type = GSK_VULKAN_OP_REPEAT;
|
||||
op.render.pipeline = gsk_vulkan_render_get_pipeline (render, pipeline_type);
|
||||
g_array_append_val (self->render_ops, op);
|
||||
@ -301,7 +301,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
|
||||
else if (constants->clip.type == GSK_VULKAN_CLIP_ROUNDED_CIRCULAR)
|
||||
pipeline_type = GSK_VULKAN_PIPELINE_BLEND_MODE_CLIP_ROUNDED;
|
||||
else
|
||||
FALLBACK ("Blend nodes can't deal with clip type %u\n", constants->clip.type);
|
||||
FALLBACK ("Blend nodes can't deal with clip type %u", constants->clip.type);
|
||||
op.type = GSK_VULKAN_OP_BLEND_MODE;
|
||||
op.render.pipeline = gsk_vulkan_render_get_pipeline (render, pipeline_type);
|
||||
g_array_append_val (self->render_ops, op);
|
||||
@ -315,7 +315,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
|
||||
else if (constants->clip.type == GSK_VULKAN_CLIP_ROUNDED_CIRCULAR)
|
||||
pipeline_type = GSK_VULKAN_PIPELINE_CROSS_FADE_CLIP_ROUNDED;
|
||||
else
|
||||
FALLBACK ("Cross fade nodes can't deal with clip type %u\n", constants->clip.type);
|
||||
FALLBACK ("Cross fade nodes can't deal with clip type %u", constants->clip.type);
|
||||
op.type = GSK_VULKAN_OP_CROSS_FADE;
|
||||
op.render.pipeline = gsk_vulkan_render_get_pipeline (render, pipeline_type);
|
||||
g_array_append_val (self->render_ops, op);
|
||||
@ -323,7 +323,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
|
||||
|
||||
case GSK_INSET_SHADOW_NODE:
|
||||
if (gsk_inset_shadow_node_get_blur_radius (node) > 0)
|
||||
FALLBACK ("Blur support not implemented for inset shadows\n");
|
||||
FALLBACK ("Blur support not implemented for inset shadows");
|
||||
else if (gsk_vulkan_clip_contains_rect (&constants->clip, &node->bounds))
|
||||
pipeline_type = GSK_VULKAN_PIPELINE_INSET_SHADOW;
|
||||
else if (constants->clip.type == GSK_VULKAN_CLIP_RECT)
|
||||
@ -331,7 +331,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
|
||||
else if (constants->clip.type == GSK_VULKAN_CLIP_ROUNDED_CIRCULAR)
|
||||
pipeline_type = GSK_VULKAN_PIPELINE_INSET_SHADOW_CLIP_ROUNDED;
|
||||
else
|
||||
FALLBACK ("Inset shadow nodes can't deal with clip type %u\n", constants->clip.type);
|
||||
FALLBACK ("Inset shadow nodes can't deal with clip type %u", constants->clip.type);
|
||||
op.type = GSK_VULKAN_OP_INSET_SHADOW;
|
||||
op.render.pipeline = gsk_vulkan_render_get_pipeline (render, pipeline_type);
|
||||
g_array_append_val (self->render_ops, op);
|
||||
@ -339,7 +339,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
|
||||
|
||||
case GSK_OUTSET_SHADOW_NODE:
|
||||
if (gsk_outset_shadow_node_get_blur_radius (node) > 0)
|
||||
FALLBACK ("Blur support not implemented for outset shadows\n");
|
||||
FALLBACK ("Blur support not implemented for outset shadows");
|
||||
else if (gsk_vulkan_clip_contains_rect (&constants->clip, &node->bounds))
|
||||
pipeline_type = GSK_VULKAN_PIPELINE_OUTSET_SHADOW;
|
||||
else if (constants->clip.type == GSK_VULKAN_CLIP_RECT)
|
||||
@ -347,7 +347,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
|
||||
else if (constants->clip.type == GSK_VULKAN_CLIP_ROUNDED_CIRCULAR)
|
||||
pipeline_type = GSK_VULKAN_PIPELINE_OUTSET_SHADOW_CLIP_ROUNDED;
|
||||
else
|
||||
FALLBACK ("Outset shadow nodes can't deal with clip type %u\n", constants->clip.type);
|
||||
FALLBACK ("Outset shadow nodes can't deal with clip type %u", constants->clip.type);
|
||||
op.type = GSK_VULKAN_OP_OUTSET_SHADOW;
|
||||
op.render.pipeline = gsk_vulkan_render_get_pipeline (render, pipeline_type);
|
||||
g_array_append_val (self->render_ops, op);
|
||||
@ -363,7 +363,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
|
||||
else if (constants->clip.type == GSK_VULKAN_CLIP_ROUNDED_CIRCULAR)
|
||||
pipeline_type = GSK_VULKAN_PIPELINE_TEXTURE_CLIP_ROUNDED;
|
||||
else
|
||||
FALLBACK ("Cairo nodes can't deal with clip type %u\n", constants->clip.type);
|
||||
FALLBACK ("Cairo nodes can't deal with clip type %u", constants->clip.type);
|
||||
op.type = GSK_VULKAN_OP_SURFACE;
|
||||
op.render.pipeline = gsk_vulkan_render_get_pipeline (render, pipeline_type);
|
||||
g_array_append_val (self->render_ops, op);
|
||||
@ -388,7 +388,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
|
||||
else if (constants->clip.type == GSK_VULKAN_CLIP_ROUNDED_CIRCULAR)
|
||||
pipeline_type = GSK_VULKAN_PIPELINE_COLOR_TEXT_CLIP_ROUNDED;
|
||||
else
|
||||
FALLBACK ("Text nodes can't deal with clip type %u\n", constants->clip.type);
|
||||
FALLBACK ("Text nodes can't deal with clip type %u", constants->clip.type);
|
||||
op.type = GSK_VULKAN_OP_COLOR_TEXT;
|
||||
}
|
||||
else
|
||||
@ -400,7 +400,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
|
||||
else if (constants->clip.type == GSK_VULKAN_CLIP_ROUNDED_CIRCULAR)
|
||||
pipeline_type = GSK_VULKAN_PIPELINE_TEXT_CLIP_ROUNDED;
|
||||
else
|
||||
FALLBACK ("Text nodes can't deal with clip type %u\n", constants->clip.type);
|
||||
FALLBACK ("Text nodes can't deal with clip type %u", constants->clip.type);
|
||||
op.type = GSK_VULKAN_OP_TEXT;
|
||||
}
|
||||
op.text.pipeline = gsk_vulkan_render_get_pipeline (render, pipeline_type);
|
||||
@ -447,7 +447,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
|
||||
else if (constants->clip.type == GSK_VULKAN_CLIP_ROUNDED_CIRCULAR)
|
||||
pipeline_type = GSK_VULKAN_PIPELINE_TEXTURE_CLIP_ROUNDED;
|
||||
else
|
||||
FALLBACK ("Texture nodes can't deal with clip type %u\n", constants->clip.type);
|
||||
FALLBACK ("Texture nodes can't deal with clip type %u", constants->clip.type);
|
||||
op.type = GSK_VULKAN_OP_TEXTURE;
|
||||
op.render.pipeline = gsk_vulkan_render_get_pipeline (render, pipeline_type);
|
||||
g_array_append_val (self->render_ops, op);
|
||||
@ -461,7 +461,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
|
||||
else if (constants->clip.type == GSK_VULKAN_CLIP_ROUNDED_CIRCULAR)
|
||||
pipeline_type = GSK_VULKAN_PIPELINE_COLOR_CLIP_ROUNDED;
|
||||
else
|
||||
FALLBACK ("Color nodes can't deal with clip type %u\n", constants->clip.type);
|
||||
FALLBACK ("Color nodes can't deal with clip type %u", constants->clip.type);
|
||||
op.type = GSK_VULKAN_OP_COLOR;
|
||||
op.render.pipeline = gsk_vulkan_render_get_pipeline (render, pipeline_type);
|
||||
g_array_append_val (self->render_ops, op);
|
||||
@ -470,7 +470,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
|
||||
case GSK_LINEAR_GRADIENT_NODE:
|
||||
case GSK_REPEATING_LINEAR_GRADIENT_NODE:
|
||||
if (gsk_linear_gradient_node_get_n_color_stops (node) > GSK_VULKAN_LINEAR_GRADIENT_PIPELINE_MAX_COLOR_STOPS)
|
||||
FALLBACK ("Linear gradient with %zu color stops, hardcoded limit is %u\n",
|
||||
FALLBACK ("Linear gradient with %zu color stops, hardcoded limit is %u",
|
||||
gsk_linear_gradient_node_get_n_color_stops (node),
|
||||
GSK_VULKAN_LINEAR_GRADIENT_PIPELINE_MAX_COLOR_STOPS);
|
||||
if (gsk_vulkan_clip_contains_rect (&constants->clip, &node->bounds))
|
||||
@ -480,7 +480,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
|
||||
else if (constants->clip.type == GSK_VULKAN_CLIP_ROUNDED_CIRCULAR)
|
||||
pipeline_type = GSK_VULKAN_PIPELINE_LINEAR_GRADIENT_CLIP_ROUNDED;
|
||||
else
|
||||
FALLBACK ("Linear gradient nodes can't deal with clip type %u\n", constants->clip.type);
|
||||
FALLBACK ("Linear gradient nodes can't deal with clip type %u", constants->clip.type);
|
||||
op.type = GSK_VULKAN_OP_LINEAR_GRADIENT;
|
||||
op.render.pipeline = gsk_vulkan_render_get_pipeline (render, pipeline_type);
|
||||
g_array_append_val (self->render_ops, op);
|
||||
@ -494,7 +494,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
|
||||
else if (constants->clip.type == GSK_VULKAN_CLIP_ROUNDED_CIRCULAR)
|
||||
pipeline_type = GSK_VULKAN_PIPELINE_COLOR_MATRIX_CLIP_ROUNDED;
|
||||
else
|
||||
FALLBACK ("Opacity nodes can't deal with clip type %u\n", constants->clip.type);
|
||||
FALLBACK ("Opacity nodes can't deal with clip type %u", constants->clip.type);
|
||||
op.type = GSK_VULKAN_OP_OPACITY;
|
||||
op.render.pipeline = gsk_vulkan_render_get_pipeline (render, pipeline_type);
|
||||
g_array_append_val (self->render_ops, op);
|
||||
@ -508,7 +508,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
|
||||
else if (constants->clip.type == GSK_VULKAN_CLIP_ROUNDED_CIRCULAR)
|
||||
pipeline_type = GSK_VULKAN_PIPELINE_BLUR_CLIP_ROUNDED;
|
||||
else
|
||||
FALLBACK ("Blur nodes can't deal with clip type %u\n", constants->clip.type);
|
||||
FALLBACK ("Blur nodes can't deal with clip type %u", constants->clip.type);
|
||||
op.type = GSK_VULKAN_OP_BLUR;
|
||||
op.render.pipeline = gsk_vulkan_render_get_pipeline (render, pipeline_type);
|
||||
g_array_append_val (self->render_ops, op);
|
||||
@ -522,7 +522,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
|
||||
else if (constants->clip.type == GSK_VULKAN_CLIP_ROUNDED_CIRCULAR)
|
||||
pipeline_type = GSK_VULKAN_PIPELINE_COLOR_MATRIX_CLIP_ROUNDED;
|
||||
else
|
||||
FALLBACK ("Color matrix nodes can't deal with clip type %u\n", constants->clip.type);
|
||||
FALLBACK ("Color matrix nodes can't deal with clip type %u", constants->clip.type);
|
||||
op.type = GSK_VULKAN_OP_COLOR_MATRIX;
|
||||
op.render.pipeline = gsk_vulkan_render_get_pipeline (render, pipeline_type);
|
||||
g_array_append_val (self->render_ops, op);
|
||||
@ -536,7 +536,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
|
||||
else if (constants->clip.type == GSK_VULKAN_CLIP_ROUNDED_CIRCULAR)
|
||||
pipeline_type = GSK_VULKAN_PIPELINE_BORDER_CLIP_ROUNDED;
|
||||
else
|
||||
FALLBACK ("Border nodes can't deal with clip type %u\n", constants->clip.type);
|
||||
FALLBACK ("Border nodes can't deal with clip type %u", constants->clip.type);
|
||||
op.type = GSK_VULKAN_OP_BORDER;
|
||||
op.render.pipeline = gsk_vulkan_render_get_pipeline (render, pipeline_type);
|
||||
g_array_append_val (self->render_ops, op);
|
||||
@ -568,7 +568,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
|
||||
graphene_matrix_multiply (&transform, &mv, &self->mv);
|
||||
child = gsk_transform_node_get_child (node);
|
||||
if (!gsk_vulkan_push_constants_transform (&op.constants.constants, constants, &transform, &child->bounds))
|
||||
FALLBACK ("Transform nodes can't deal with clip type %u\n", constants->clip.type);
|
||||
FALLBACK ("Transform nodes can't deal with clip type %u", constants->clip.type);
|
||||
op.type = GSK_VULKAN_OP_PUSH_VERTEX_CONSTANTS;
|
||||
g_array_append_val (self->render_ops, op);
|
||||
|
||||
@ -582,7 +582,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
|
||||
case GSK_CLIP_NODE:
|
||||
{
|
||||
if (!gsk_vulkan_push_constants_intersect_rect (&op.constants.constants, constants, gsk_clip_node_peek_clip (node)))
|
||||
FALLBACK ("Failed to find intersection between clip of type %u and rectangle\n", constants->clip.type);
|
||||
FALLBACK ("Failed to find intersection between clip of type %u and rectangle", constants->clip.type);
|
||||
if (op.constants.constants.clip.type == GSK_VULKAN_CLIP_ALL_CLIPPED)
|
||||
return;
|
||||
|
||||
@ -601,7 +601,7 @@ gsk_vulkan_render_pass_add_node (GskVulkanRenderPass *self,
|
||||
if (!gsk_vulkan_push_constants_intersect_rounded (&op.constants.constants,
|
||||
constants,
|
||||
gsk_rounded_clip_node_peek_clip (node)))
|
||||
FALLBACK ("Failed to find intersection between clip of type %u and rounded rectangle\n", constants->clip.type);
|
||||
FALLBACK ("Failed to find intersection between clip of type %u and rounded rectangle", constants->clip.type);
|
||||
if (op.constants.constants.clip.type == GSK_VULKAN_CLIP_ALL_CLIPPED)
|
||||
return;
|
||||
|
||||
@ -773,7 +773,7 @@ gsk_vulkan_render_pass_get_node_as_texture (GskVulkanRenderPass *self,
|
||||
}
|
||||
}
|
||||
|
||||
GSK_NOTE (FALLBACK, g_print ("Node as texture not implemented for this case. Using %gx%g fallback surface\n",
|
||||
GSK_RENDERER_NOTE (gsk_vulkan_render_get_renderer (render), FALLBACK, g_message ("Node as texture not implemented for this case. Using %gx%g fallback surface",
|
||||
ceil (bounds->size.width),
|
||||
ceil (bounds->size.height)));
|
||||
#ifdef G_ENABLE_DEBUG
|
||||
@ -827,8 +827,8 @@ gsk_vulkan_render_pass_upload_fallback (GskVulkanRenderPass *self,
|
||||
|
||||
node = op->node;
|
||||
|
||||
GSK_NOTE (FALLBACK,
|
||||
g_print ("Upload op=%s, node %s[%p], bounds %gx%g\n",
|
||||
GSK_RENDERER_NOTE (gsk_vulkan_render_get_renderer (render), FALLBACK,
|
||||
g_message ("Upload op=%s, node %s[%p], bounds %gx%g",
|
||||
op->type == GSK_VULKAN_OP_FALLBACK_CLIP ? "fallback-clip" :
|
||||
(op->type == GSK_VULKAN_OP_FALLBACK_ROUNDED_CLIP ? "fallback-rounded-clip" : "fallback"),
|
||||
node->name ? node->name : node->node_class->type_name, node,
|
||||
|
@ -65,7 +65,7 @@ gsk_vulkan_shader_new_from_resource (GdkVulkanContext *context,
|
||||
g_free (path);
|
||||
if (bytes == NULL)
|
||||
{
|
||||
GSK_NOTE (VULKAN, g_printerr ("Error loading shader data: %s\n", local_error->message));
|
||||
GSK_NOTE (VULKAN, g_message ("Error loading shader data: %s", local_error->message));
|
||||
g_propagate_error (error, local_error);
|
||||
return NULL;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user