[gtk/wip/chergert/glproto] give hook for glshader to compile on next renderer
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/wip/chergert/glproto] give hook for glshader to compile on next renderer
- Date: Fri, 29 Jan 2021 01:12:25 +0000 (UTC)
commit e565860f8f001ec05e24aecd8bbbaf7da583c164
Author: Christian Hergert <chergert redhat com>
Date: Thu Jan 28 17:22:03 2021 -0800
give hook for glshader to compile on next renderer
gsk/gskglshader.c | 7 +++++--
gsk/next/gskglcompiler.c | 2 +-
gsk/next/gskgldriver.c | 2 +-
gsk/next/gskglrenderer.c | 17 ++++++++++++++++-
gsk/next/gskglrenderer.h | 8 ++++----
gsk/next/gskglrendererprivate.h | 34 ++++++++++++++++++++++++++++++++++
6 files changed, 61 insertions(+), 9 deletions(-)
---
diff --git a/gsk/gskglshader.c b/gsk/gskglshader.c
index 181ae32a2d..e5c2786213 100644
--- a/gsk/gskglshader.c
+++ b/gsk/gskglshader.c
@@ -139,7 +139,9 @@
#include "gskglshader.h"
#include "gskglshaderprivate.h"
#include "gskdebugprivate.h"
+
#include "gl/gskglrendererprivate.h"
+#include "next/gskglrendererprivate.h"
static GskGLUniformType
uniform_type_from_glsl (const char *str)
@@ -542,8 +544,9 @@ gsk_gl_shader_compile (GskGLShader *shader,
g_return_val_if_fail (GSK_IS_GL_SHADER (shader), FALSE);
if (GSK_IS_GL_RENDERER (renderer))
- return gsk_gl_renderer_try_compile_gl_shader (GSK_GL_RENDERER (renderer),
- shader, error);
+ return gsk_gl_renderer_try_compile_gl_shader (GSK_GL_RENDERER (renderer), shader, error);
+ else if (GSK_IS_NEXT_RENDERER (renderer))
+ return gsk_next_renderer_try_compile_gl_shader (GSK_NEXT_RENDERER (renderer), shader, error);
g_set_error (error, G_IO_ERROR, G_IO_ERROR_NOT_SUPPORTED,
"The renderer does not support gl shaders");
diff --git a/gsk/next/gskglcompiler.c b/gsk/next/gskglcompiler.c
index 023b469a01..2ab1cfe5f3 100644
--- a/gsk/next/gskglcompiler.c
+++ b/gsk/next/gskglcompiler.c
@@ -618,7 +618,7 @@ gsk_gl_compiler_compile (GskGLCompiler *self,
{
glDeleteShader (vertex_id);
glDeleteShader (fragment_id);
- return 0;
+ return NULL;
}
print_shader_info ("Fragment shader", fragment_id, name);
diff --git a/gsk/next/gskgldriver.c b/gsk/next/gskgldriver.c
index bdee6867c9..c5b5619946 100644
--- a/gsk/next/gskgldriver.c
+++ b/gsk/next/gskgldriver.c
@@ -1134,7 +1134,7 @@ gsk_next_driver_lookup_shader (GskNextDriver *self,
g_object_unref (compiler);
}
- return g_steal_pointer (&program);
+ return program;
}
void
diff --git a/gsk/next/gskglrenderer.c b/gsk/next/gskglrenderer.c
index 6db031f161..8b9fbcd409 100644
--- a/gsk/next/gskglrenderer.c
+++ b/gsk/next/gskglrenderer.c
@@ -28,7 +28,7 @@
#include "gskgldriverprivate.h"
#include "gskglprogramprivate.h"
#include "gskglrenderjobprivate.h"
-#include "gskglrenderer.h"
+#include "gskglrendererprivate.h"
struct _GskNextRendererClass
{
@@ -328,3 +328,18 @@ static void
gsk_next_renderer_init (GskNextRenderer *self)
{
}
+
+gboolean
+gsk_next_renderer_try_compile_gl_shader (GskNextRenderer *renderer,
+ GskGLShader *shader,
+ GError **error)
+{
+ GskGLProgram *program;
+
+ g_return_val_if_fail (GSK_IS_NEXT_RENDERER (renderer), FALSE);
+ g_return_val_if_fail (shader != NULL, FALSE);
+
+ program = gsk_next_driver_lookup_shader (renderer->driver, shader, error);
+
+ return program != NULL;
+}
diff --git a/gsk/next/gskglrenderer.h b/gsk/next/gskglrenderer.h
index c2e2354f06..b8a09c1b86 100644
--- a/gsk/next/gskglrenderer.h
+++ b/gsk/next/gskglrenderer.h
@@ -1,4 +1,4 @@
-/* gskglrendererprivate.h
+/* gskglrenderer.h
*
* Copyright 2020 Christian Hergert <chergert redhat com>
*
@@ -18,8 +18,8 @@
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
-#ifndef __GSK_NEXT_RENDERER_PRIVATE_H__
-#define __GSK_NEXT_RENDERER_PRIVATE_H__
+#ifndef __GSK_NEXT_RENDERER_H__
+#define __GSK_NEXT_RENDERER_H__
#include <gsk/gskrenderer.h>
@@ -44,4 +44,4 @@ GskRenderer * gsk_next_renderer_new (void);
G_END_DECLS
-#endif /* __GSK_NEXT_RENDERER_PRIVATE_H__ */
+#endif /* __GSK_NEXT_RENDERER__ */
diff --git a/gsk/next/gskglrendererprivate.h b/gsk/next/gskglrendererprivate.h
new file mode 100644
index 0000000000..fc8ad12236
--- /dev/null
+++ b/gsk/next/gskglrendererprivate.h
@@ -0,0 +1,34 @@
+/* gskglrendererprivate.h
+ *
+ * Copyright 2021 Christian Hergert <chergert redhat com>
+ *
+ * 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 program. If not, see <http://www.gnu.org/licenses/>.
+ *
+ * SPDX-License-Identifier: LGPL-2.1-or-later
+ */
+
+#ifndef __GSK_NEXT_RENDERER_PRIVATE_H__
+#define __GSK_NEXT_RENDERER_PRIVATE_H__
+
+#include "gskglrenderer.h"
+
+G_BEGIN_DECLS
+
+gboolean gsk_next_renderer_try_compile_gl_shader (GskNextRenderer *renderer,
+ GskGLShader *shader,
+ GError **error);
+
+G_END_DECLS
+
+#endif /* __GSK_NEXT_RENDERER_PRIVATE_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]