[gtk/wip/otte/nodeeditor2: 54/57] gsk: Export gsk_vulkan_renderer_new()



commit 3f24ad741a2b592594bfdbd41376f36a37356445
Author: Benjamin Otte <otte redhat com>
Date:   Thu May 2 02:57:23 2019 +0200

    gsk: Export gsk_vulkan_renderer_new()

 docs/reference/gsk/gsk4-sections.txt  |  1 +
 gsk/gsk.h                             |  1 +
 gsk/gskrenderer.c                     |  2 +-
 gsk/meson.build                       |  6 +++++
 gsk/vulkan/gskvulkanrenderer.c        | 19 +++++++++++++
 gsk/vulkan/gskvulkanrenderer.h        | 51 +++++++++++++++++++++++++++++++++++
 gsk/vulkan/gskvulkanrendererprivate.h | 17 +-----------
 7 files changed, 80 insertions(+), 17 deletions(-)
---
diff --git a/docs/reference/gsk/gsk4-sections.txt b/docs/reference/gsk/gsk4-sections.txt
index 3573f8cb31..c81fdfeb56 100644
--- a/docs/reference/gsk/gsk4-sections.txt
+++ b/docs/reference/gsk/gsk4-sections.txt
@@ -10,6 +10,7 @@ gsk_renderer_render_texture
 gsk_renderer_new_for_surface
 gsk_gl_renderer_new
 gsk_cairo_renderer_new
+gsk_vulkan_renderer_new
 gsk_broadway_renderer_new
 <SUBSECTION Standard>
 GSK_IS_RENDERER
diff --git a/gsk/gsk.h b/gsk/gsk.h
index b8f6d58ee9..b1ae837946 100644
--- a/gsk/gsk.h
+++ b/gsk/gsk.h
@@ -29,6 +29,7 @@
 #include <gsk/gskcairorenderer.h>
 #include <gsk/gl/gskglrenderer.h>
 #include <gsk/broadway/gskbroadwayrenderer.h>
+#include <gsk/vulkan/gskvulkanrenderer.h>
 
 #include <gsk/gsktypes.h>
 #include <gsk/gskenumtypes.h>
diff --git a/gsk/gskrenderer.c b/gsk/gskrenderer.c
index 73c3247b19..6598bf479a 100644
--- a/gsk/gskrenderer.c
+++ b/gsk/gskrenderer.c
@@ -58,7 +58,7 @@
 #include "broadway/gskbroadwayrenderer.h"
 #endif
 #ifdef GDK_RENDERING_VULKAN
-#include "vulkan/gskvulkanrendererprivate.h"
+#include "vulkan/gskvulkanrenderer.h"
 #endif
 
 typedef struct
diff --git a/gsk/meson.build b/gsk/meson.build
index c28d931932..a3b3ba002b 100644
--- a/gsk/meson.build
+++ b/gsk/meson.build
@@ -71,6 +71,12 @@ gsk_public_broadway_headers = files([
 install_headers(gsk_public_broadway_headers, subdir: 'gtk-4.0/gsk/broadway')
 gsk_public_headers += gsk_public_broadway_headers
 
+gsk_public_vulkan_headers = files([
+  'vulkan/gskvulkanrenderer.h'
+])
+install_headers(gsk_public_vulkan_headers, subdir: 'gtk-4.0/gsk/vulkan')
+gsk_public_headers += gsk_public_vulkan_headers
+
 gsk_private_vulkan_shaders = []
 # This is an odd split because we use configure_file() below to workaround
 # a limitation in meson preventing using custom_target() with gnome.compile_resources()
diff --git a/gsk/vulkan/gskvulkanrenderer.c b/gsk/vulkan/gskvulkanrenderer.c
index 80bb845b37..e84efcdb47 100644
--- a/gsk/vulkan/gskvulkanrenderer.c
+++ b/gsk/vulkan/gskvulkanrenderer.c
@@ -364,3 +364,22 @@ gsk_vulkan_renderer_get_cached_glyph (GskVulkanRenderer *self,
 {
   return gsk_vulkan_glyph_cache_lookup (self->glyph_cache, FALSE, font, glyph, scale);
 }
+
+/**
+ * gsk_vulkan_renderer_new:
+ *
+ * Creates a new Vulkan renderer.
+ *
+ * The Vulkan renderer is a renderer that uses the Vulkan library for
+ * rendering.
+ *
+ * This function is only available when GTK was compiled with Vulkan
+ * support.
+ *
+ * Returns: a new Vulkan renderer
+ **/
+GskRenderer *
+gsk_vulkan_renderer_new (void)
+{
+  return g_object_new (GSK_TYPE_VULKAN_RENDERER, NULL);
+}
diff --git a/gsk/vulkan/gskvulkanrenderer.h b/gsk/vulkan/gskvulkanrenderer.h
new file mode 100644
index 0000000000..ff3f361f49
--- /dev/null
+++ b/gsk/vulkan/gskvulkanrenderer.h
@@ -0,0 +1,51 @@
+/*
+ * Copyright © 2016  Benjamin Otte
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef __GSK_VULKAN_RENDERER_H__
+#define __GSK_VULKAN_RENDERER_H__
+
+#include <gdk/gdk.h>
+#include <gsk/gskrenderer.h>
+
+#ifdef GDK_RENDERING_VULKAN
+
+#include <vulkan/vulkan.h>
+
+G_BEGIN_DECLS
+
+#define GSK_TYPE_VULKAN_RENDERER (gsk_vulkan_renderer_get_type ())
+
+#define GSK_VULKAN_RENDERER(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GSK_TYPE_VULKAN_RENDERER, GskVulkanRenderer))
+#define GSK_IS_VULKAN_RENDERER(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GSK_TYPE_VULKAN_RENDERER))
+#define GSK_VULKAN_RENDERER_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), 
GSK_TYPE_VULKAN_RENDERER, GskVulkanRendererClass))
+#define GSK_IS_VULKAN_RENDERER_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), 
GSK_TYPE_VULKAN_RENDERER))
+#define GSK_VULKAN_RENDERER_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), 
GSK_TYPE_VULKAN_RENDERER, GskVulkanRendererClass))
+
+typedef struct _GskVulkanRenderer                GskVulkanRenderer;
+typedef struct _GskVulkanRendererClass           GskVulkanRendererClass;
+
+GDK_AVAILABLE_IN_ALL
+GType                   gsk_vulkan_renderer_get_type            (void) G_GNUC_CONST;
+
+GDK_AVAILABLE_IN_ALL
+GskRenderer *           gsk_vulkan_renderer_new                 (void);
+
+G_END_DECLS
+
+#endif /* GDK_WINDOWING_VULKAN */
+
+#endif /* __GSK_VULKAN_RENDERER_H__ */
diff --git a/gsk/vulkan/gskvulkanrendererprivate.h b/gsk/vulkan/gskvulkanrendererprivate.h
index 1e7d78a7ed..d492a85b1f 100644
--- a/gsk/vulkan/gskvulkanrendererprivate.h
+++ b/gsk/vulkan/gskvulkanrendererprivate.h
@@ -1,26 +1,11 @@
 #ifndef __GSK_VULKAN_RENDERER_PRIVATE_H__
 #define __GSK_VULKAN_RENDERER_PRIVATE_H__
 
-#include <vulkan/vulkan.h>
-#include <gsk/gskrenderer.h>
-
+#include "gskvulkanrenderer.h"
 #include "gskvulkanimageprivate.h"
 
 G_BEGIN_DECLS
 
-#define GSK_TYPE_VULKAN_RENDERER (gsk_vulkan_renderer_get_type ())
-
-#define GSK_VULKAN_RENDERER(obj)                 (G_TYPE_CHECK_INSTANCE_CAST ((obj), 
GSK_TYPE_VULKAN_RENDERER, GskVulkanRenderer))
-#define GSK_IS_VULKAN_RENDERER(obj)              (G_TYPE_CHECK_INSTANCE_TYPE ((obj), 
GSK_TYPE_VULKAN_RENDERER))
-#define GSK_VULKAN_RENDERER_CLASS(klass)         (G_TYPE_CHECK_CLASS_CAST ((klass), 
GSK_TYPE_VULKAN_RENDERER, GskVulkanRendererClass))
-#define GSK_IS_VULKAN_RENDERER_CLASS(klass)      (G_TYPE_CHECK_CLASS_TYPE ((klass), 
GSK_TYPE_VULKAN_RENDERER))
-#define GSK_VULKAN_RENDERER_GET_CLASS(obj)       (G_TYPE_INSTANCE_GET_CLASS ((obj), 
GSK_TYPE_VULKAN_RENDERER, GskVulkanRendererClass))
-
-typedef struct _GskVulkanRenderer                GskVulkanRenderer;
-typedef struct _GskVulkanRendererClass           GskVulkanRendererClass;
-
-GType gsk_vulkan_renderer_get_type (void) G_GNUC_CONST;
-
 GskVulkanImage *        gsk_vulkan_renderer_ref_texture_image           (GskVulkanRenderer      *self,
                                                                          GdkTexture             *texture,
                                                                          GskVulkanUploader      *uploader);


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