gsk4/
gl_shader.rs

1// Take a look at the license at the top of the repository in the LICENSE file.
2
3use glib::translate::*;
4
5use crate::{ffi, GLShader};
6
7impl GLShader {
8    /// Gets the value of the uniform @idx in the @args block.
9    ///
10    /// The uniform must be of vec2 type.
11    ///
12    /// # Deprecated since 4.16
13    ///
14    /// GTK's new Vulkan-focused rendering
15    ///   does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
16    ///   for OpenGL rendering.
17    /// ## `args`
18    /// uniform arguments
19    /// ## `idx`
20    /// index of the uniform
21    /// ## `out_value`
22    /// location to store the uniform value in
23    #[doc(alias = "gsk_gl_shader_get_arg_vec2")]
24    #[doc(alias = "get_arg_vec2")]
25    pub fn arg_vec2(&self, args: &glib::Bytes, idx: i32) -> graphene::Vec2 {
26        unsafe {
27            let mut out_value = graphene::Vec2::uninitialized();
28            ffi::gsk_gl_shader_get_arg_vec2(
29                self.to_glib_none().0,
30                args.to_glib_none().0,
31                idx,
32                out_value.to_glib_none_mut().0,
33            );
34            out_value
35        }
36    }
37
38    /// Gets the value of the uniform @idx in the @args block.
39    ///
40    /// The uniform must be of vec3 type.
41    ///
42    /// # Deprecated since 4.16
43    ///
44    /// GTK's new Vulkan-focused rendering
45    ///   does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
46    ///   for OpenGL rendering.
47    /// ## `args`
48    /// uniform arguments
49    /// ## `idx`
50    /// index of the uniform
51    /// ## `out_value`
52    /// location to store the uniform value in
53    #[doc(alias = "gsk_gl_shader_get_arg_vec3")]
54    #[doc(alias = "get_arg_vec3")]
55    pub fn arg_vec3(&self, args: &glib::Bytes, idx: i32) -> graphene::Vec3 {
56        unsafe {
57            let mut out_value = graphene::Vec3::uninitialized();
58            ffi::gsk_gl_shader_get_arg_vec3(
59                self.to_glib_none().0,
60                args.to_glib_none().0,
61                idx,
62                out_value.to_glib_none_mut().0,
63            );
64            out_value
65        }
66    }
67
68    /// Gets the value of the uniform @idx in the @args block.
69    ///
70    /// The uniform must be of vec4 type.
71    ///
72    /// # Deprecated since 4.16
73    ///
74    /// GTK's new Vulkan-focused rendering
75    ///   does not support this feature. Use [GtkGLArea](../gtk4/class.GLArea.html)
76    ///   for OpenGL rendering.
77    /// ## `args`
78    /// uniform arguments
79    /// ## `idx`
80    /// index of the uniform
81    /// ## `out_value`
82    /// location to store set the uniform value in
83    #[doc(alias = "gsk_gl_shader_get_arg_vec4")]
84    #[doc(alias = "get_arg_vec4")]
85    pub fn arg_vec4(&self, args: &glib::Bytes, idx: i32) -> graphene::Vec4 {
86        unsafe {
87            let mut out_value = graphene::Vec4::uninitialized();
88            ffi::gsk_gl_shader_get_arg_vec4(
89                self.to_glib_none().0,
90                args.to_glib_none().0,
91                idx,
92                out_value.to_glib_none_mut().0,
93            );
94            out_value
95        }
96    }
97}