gsk: Move the buffer upload counter
Move the sysprof counter for buffer uploads to the generic
code, so it works for both ngl and Vulkan. This partially
reverts commit ecf1b7c18a.
This commit is contained in:
@@ -1,7 +1,5 @@
|
||||
#include "config.h"
|
||||
|
||||
#include <gdk/gdkprofilerprivate.h>
|
||||
|
||||
#include "gskglbufferprivate.h"
|
||||
|
||||
struct _GskGLBuffer
|
||||
@@ -16,9 +14,6 @@ struct _GskGLBuffer
|
||||
|
||||
G_DEFINE_TYPE (GskGLBuffer, gsk_gl_buffer, GSK_TYPE_GPU_BUFFER)
|
||||
|
||||
static guint profiler_buffer_uploads_id;
|
||||
static gint64 profiler_buffer_uploads;
|
||||
|
||||
static void
|
||||
gsk_gl_buffer_finalize (GObject *object)
|
||||
{
|
||||
@@ -49,9 +44,7 @@ gsk_gl_buffer_unmap (GskGpuBuffer *buffer,
|
||||
|
||||
gsk_gl_buffer_bind (self);
|
||||
|
||||
profiler_buffer_uploads += used;
|
||||
glBufferSubData (self->target, 0, used, self->data);
|
||||
gdk_profiler_set_int_counter (profiler_buffer_uploads_id, profiler_buffer_uploads);
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -64,8 +57,6 @@ gsk_gl_buffer_class_init (GskGLBufferClass *klass)
|
||||
buffer_class->unmap = gsk_gl_buffer_unmap;
|
||||
|
||||
gobject_class->finalize = gsk_gl_buffer_finalize;
|
||||
|
||||
profiler_buffer_uploads_id = gdk_profiler_define_int_counter ("ngl-buffer-uploads", "Number of bytes uploaded to GPU");
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
#include "gskgpubufferprivate.h"
|
||||
|
||||
#include <gdk/gdkprofilerprivate.h>
|
||||
|
||||
typedef struct _GskGpuBufferPrivate GskGpuBufferPrivate;
|
||||
|
||||
struct _GskGpuBufferPrivate
|
||||
@@ -11,9 +13,13 @@ struct _GskGpuBufferPrivate
|
||||
|
||||
G_DEFINE_TYPE_WITH_PRIVATE (GskGpuBuffer, gsk_gpu_buffer, G_TYPE_OBJECT)
|
||||
|
||||
static guint profiler_buffer_uploads_id;
|
||||
static gint64 profiler_buffer_uploads;
|
||||
|
||||
static void
|
||||
gsk_gpu_buffer_class_init (GskGpuBufferClass *klass)
|
||||
{
|
||||
profiler_buffer_uploads_id = gdk_profiler_define_int_counter ("ngl-buffer-uploads", "Number of bytes uploaded to GPU");
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -29,7 +35,7 @@ gsk_gpu_buffer_setup (GskGpuBuffer *self,
|
||||
|
||||
priv->size = size;
|
||||
}
|
||||
|
||||
|
||||
gsize
|
||||
gsk_gpu_buffer_get_size (GskGpuBuffer *self)
|
||||
{
|
||||
@@ -49,5 +55,8 @@ gsk_gpu_buffer_unmap (GskGpuBuffer *self,
|
||||
gsize size)
|
||||
{
|
||||
GSK_GPU_BUFFER_GET_CLASS (self)->unmap (self, size);
|
||||
|
||||
profiler_buffer_uploads += size;
|
||||
gdk_profiler_set_int_counter (profiler_buffer_uploads_id, profiler_buffer_uploads);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user