[gnome-shell] glsl-effect: Allow to set uniform matrices
- From: Marge Bot <marge-bot src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-shell] glsl-effect: Allow to set uniform matrices
- Date: Tue, 8 Feb 2022 21:24:47 +0000 (UTC)
commit 170f3ee08944fb4b80e4bbbfdbbfb3250d301cc7
Author: Sebastian Wick <sebastian wick redhat com>
Date: Tue Feb 8 21:22:58 2022 +0100
glsl-effect: Allow to set uniform matrices
Add support for setting a uniform matrix on GLSLEffect because the color
vision deficiency simulation extension requires it.
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/2164>
src/shell-glsl-effect.c | 24 ++++++++++++++++++++++++
src/shell-glsl-effect.h | 6 ++++++
2 files changed, 30 insertions(+)
---
diff --git a/src/shell-glsl-effect.c b/src/shell-glsl-effect.c
index ee6f5eefe2..3051e0af9d 100644
--- a/src/shell-glsl-effect.c
+++ b/src/shell-glsl-effect.c
@@ -179,3 +179,27 @@ shell_glsl_effect_set_uniform_float (ShellGLSLEffect *effect,
n_components, total_count / n_components,
value);
}
+
+/**
+ * shell_glsl_effect_set_uniform_matrix:
+ * @effect: a #ShellGLSLEffect
+ * @uniform: the uniform location (as returned by shell_glsl_effect_get_uniform_location())
+ * @transpose: Whether to transpose the matrix
+ * @dimensions: the number of components in the uniform (eg. 3 for a vec3)
+ * @total_count: the total number of floats in @value
+ * @value: (array length=total_count): the array of floats to set @uniform
+ */
+void
+shell_glsl_effect_set_uniform_matrix (ShellGLSLEffect *effect,
+ int uniform,
+ gboolean transpose,
+ int dimensions,
+ int total_count,
+ const float *value)
+{
+ ShellGLSLEffectPrivate *priv = shell_glsl_effect_get_instance_private (effect);
+ cogl_pipeline_set_uniform_matrix (priv->pipeline, uniform,
+ dimensions,
+ total_count / (dimensions * dimensions),
+ transpose, value);
+}
diff --git a/src/shell-glsl-effect.h b/src/shell-glsl-effect.h
index d943cefb8a..3759e7172d 100644
--- a/src/shell-glsl-effect.h
+++ b/src/shell-glsl-effect.h
@@ -52,5 +52,11 @@ void shell_glsl_effect_set_uniform_float (ShellGLSLEffect *effect,
int n_components,
int total_count,
const float *value);
+void shell_glsl_effect_set_uniform_matrix (ShellGLSLEffect *effect,
+ int uniform,
+ gboolean transpose,
+ int dimensions,
+ int total_count,
+ const float *value);
#endif /* __SHELL_GLSL_EFFECT_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]