1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
// This file was generated by gir (https://github.com/gtk-rs/gir)
// from gir-files (https://github.com/gtk-rs/gir-files)
// from gst-gir-files (https://gitlab.freedesktop.org/gstreamer/gir-files-rs.git)
// DO NOT EDIT

use crate::{GLContext, GLSLStage};
#[cfg(feature = "v1_16")]
#[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
use crate::{GLSLProfile, GLSLVersion};
use glib::{
    prelude::*,
    signal::{connect_raw, SignalHandlerId},
    translate::*,
};
use std::boxed::Box as Box_;

glib::wrapper! {
    ///
    ///
    /// ## Properties
    ///
    ///
    /// #### `linked`
    ///  Readable
    /// <details><summary><h4>Object</h4></summary>
    ///
    ///
    /// #### `name`
    ///  Readable | Writeable | Construct
    ///
    ///
    /// #### `parent`
    ///  The parent of the object. Please note, that when changing the 'parent'
    /// property, we don't emit [`notify`][struct@crate::glib::Object#notify] and [`deep-notify`][struct@crate::gst::Object#deep-notify]
    /// signals due to locking issues. In some cases one can use
    /// `GstBin::element-added` or `GstBin::element-removed` signals on the parent to
    /// achieve a similar effect.
    ///
    /// Readable | Writeable
    /// </details>
    ///
    /// # Implements
    ///
    /// [`trait@gst::prelude::ObjectExt`], [`trait@glib::ObjectExt`]
    #[doc(alias = "GstGLShader")]
    pub struct GLShader(Object<ffi::GstGLShader, ffi::GstGLShaderClass>) @extends gst::Object;

    match fn {
        type_ => || ffi::gst_gl_shader_get_type(),
    }
}

impl GLShader {
    /// Note: must be called in the GL thread
    /// ## `context`
    /// a [`GLContext`][crate::GLContext]
    ///
    /// # Returns
    ///
    /// a new empty `shader`
    #[doc(alias = "gst_gl_shader_new")]
    pub fn new(context: &impl IsA<GLContext>) -> GLShader {
        skip_assert_initialized!();
        unsafe { from_glib_full(ffi::gst_gl_shader_new(context.as_ref().to_glib_none().0)) }
    }

    /// Note: must be called in the GL thread
    /// ## `context`
    /// a [`GLContext`][crate::GLContext]
    ///
    /// # Returns
    ///
    /// a default `shader` or [`None`] on failure
    #[doc(alias = "gst_gl_shader_new_default")]
    pub fn new_default(context: &impl IsA<GLContext>) -> Result<GLShader, glib::Error> {
        skip_assert_initialized!();
        unsafe {
            let mut error = std::ptr::null_mut();
            let ret = ffi::gst_gl_shader_new_default(context.as_ref().to_glib_none().0, &mut error);
            if error.is_null() {
                Ok(from_glib_full(ret))
            } else {
                Err(from_glib_full(error))
            }
        }
    }

    //#[doc(alias = "gst_gl_shader_new_link_with_stages")]
    //pub fn new_link_with_stages(context: &impl IsA<GLContext>, error: &mut glib::Error, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> GLShader {
    //    unsafe { TODO: call ffi:gst_gl_shader_new_link_with_stages() }
    //}

    //#[doc(alias = "gst_gl_shader_new_with_stages")]
    //#[doc(alias = "new_with_stages")]
    //pub fn with_stages(context: &impl IsA<GLContext>, error: &mut glib::Error, : /*Unknown conversion*//*Unimplemented*/Basic: VarArgs) -> GLShader {
    //    unsafe { TODO: call ffi:gst_gl_shader_new_with_stages() }
    //}

    /// Attaches `stage` to `self`. `stage` must have been successfully compiled
    /// with [`GLSLStage::compile()`][crate::GLSLStage::compile()].
    ///
    /// Note: must be called in the GL thread
    /// ## `stage`
    /// a [`GLSLStage`][crate::GLSLStage] to attach
    ///
    /// # Returns
    ///
    /// whether `stage` could be attached to `self`
    #[doc(alias = "gst_gl_shader_attach")]
    pub fn attach(&self, stage: &GLSLStage) -> Result<(), glib::error::BoolError> {
        unsafe {
            glib::result_from_gboolean!(
                ffi::gst_gl_shader_attach(self.to_glib_none().0, stage.to_glib_none().0),
                "Failed to attach stage to shader"
            )
        }
    }

    /// Attaches `stage` to `self`. `stage` must have been successfully compiled
    /// with [`GLSLStage::compile()`][crate::GLSLStage::compile()].
    ///
    /// Note: must be called in the GL thread
    /// ## `stage`
    /// a [`GLSLStage`][crate::GLSLStage] to attach
    ///
    /// # Returns
    ///
    /// whether `stage` could be attached to `self`
    #[doc(alias = "gst_gl_shader_attach_unlocked")]
    pub fn attach_unlocked(&self, stage: &GLSLStage) -> Result<(), glib::error::BoolError> {
        unsafe {
            glib::result_from_gboolean!(
                ffi::gst_gl_shader_attach_unlocked(self.to_glib_none().0, stage.to_glib_none().0),
                "Failed to attach stage to shader"
            )
        }
    }

    /// Bind attribute `name` to the specified location `index` using
    /// `glBindAttributeLocation()`.
    /// ## `index`
    /// attribute index to set
    /// ## `name`
    /// name of the attribute
    #[doc(alias = "gst_gl_shader_bind_attribute_location")]
    pub fn bind_attribute_location(&self, index: u32, name: &str) {
        unsafe {
            ffi::gst_gl_shader_bind_attribute_location(
                self.to_glib_none().0,
                index,
                name.to_glib_none().0,
            );
        }
    }

    /// Bind attribute `name` to the specified location `index` using
    /// `glBindFragDataLocation()`.
    /// ## `index`
    /// attribute index to set
    /// ## `name`
    /// name of the attribute
    #[doc(alias = "gst_gl_shader_bind_frag_data_location")]
    pub fn bind_frag_data_location(&self, index: u32, name: &str) {
        unsafe {
            ffi::gst_gl_shader_bind_frag_data_location(
                self.to_glib_none().0,
                index,
                name.to_glib_none().0,
            );
        }
    }

    /// Compiles `stage` and attaches it to `self`.
    ///
    /// Note: must be called in the GL thread
    /// ## `stage`
    /// a [`GLSLStage`][crate::GLSLStage] to attach
    ///
    /// # Returns
    ///
    /// whether `stage` could be compiled and attached to `self`
    #[doc(alias = "gst_gl_shader_compile_attach_stage")]
    pub fn compile_attach_stage(&self, stage: &GLSLStage) -> Result<(), glib::Error> {
        unsafe {
            let mut error = std::ptr::null_mut();
            let is_ok = ffi::gst_gl_shader_compile_attach_stage(
                self.to_glib_none().0,
                stage.to_glib_none().0,
                &mut error,
            );
            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
            if error.is_null() {
                Ok(())
            } else {
                Err(from_glib_full(error))
            }
        }
    }

    /// Detaches `stage` from `self`. `stage` must have been successfully attached
    /// to `self` with [`attach()`][Self::attach()] or [`attach_unlocked()`][Self::attach_unlocked()].
    ///
    /// Note: must be called in the GL thread
    /// ## `stage`
    /// a [`GLSLStage`][crate::GLSLStage] to attach
    #[doc(alias = "gst_gl_shader_detach")]
    pub fn detach(&self, stage: &GLSLStage) {
        unsafe {
            ffi::gst_gl_shader_detach(self.to_glib_none().0, stage.to_glib_none().0);
        }
    }

    /// Detaches `stage` from `self`. `stage` must have been successfully attached
    /// to `self` with [`attach()`][Self::attach()] or [`attach_unlocked()`][Self::attach_unlocked()].
    ///
    /// Note: must be called in the GL thread
    /// ## `stage`
    /// a [`GLSLStage`][crate::GLSLStage] to attach
    #[doc(alias = "gst_gl_shader_detach_unlocked")]
    pub fn detach_unlocked(&self, stage: &GLSLStage) {
        unsafe {
            ffi::gst_gl_shader_detach_unlocked(self.to_glib_none().0, stage.to_glib_none().0);
        }
    }

    /// ## `name`
    /// name of the attribute
    ///
    /// # Returns
    ///
    /// the attribute index for `name` in `self` or -1 on failure
    #[doc(alias = "gst_gl_shader_get_attribute_location")]
    #[doc(alias = "get_attribute_location")]
    pub fn attribute_location(&self, name: &str) -> i32 {
        unsafe {
            ffi::gst_gl_shader_get_attribute_location(self.to_glib_none().0, name.to_glib_none().0)
        }
    }

    ///
    /// # Returns
    ///
    /// the GL program handle for this shader
    #[doc(alias = "gst_gl_shader_get_program_handle")]
    #[doc(alias = "get_program_handle")]
    pub fn program_handle(&self) -> i32 {
        unsafe { ffi::gst_gl_shader_get_program_handle(self.to_glib_none().0) }
    }

    /// Note: must be called in the GL thread
    ///
    /// # Returns
    ///
    /// whether `self` has been successfully linked
    #[doc(alias = "gst_gl_shader_is_linked")]
    pub fn is_linked(&self) -> bool {
        unsafe { from_glib(ffi::gst_gl_shader_is_linked(self.to_glib_none().0)) }
    }

    /// Links the current list of [`GLSLStage`][crate::GLSLStage]'s in `self`.
    ///
    /// Note: must be called in the GL thread
    ///
    /// # Returns
    ///
    /// whether `self` could be linked together.
    #[doc(alias = "gst_gl_shader_link")]
    pub fn link(&self) -> Result<(), glib::Error> {
        unsafe {
            let mut error = std::ptr::null_mut();
            let is_ok = ffi::gst_gl_shader_link(self.to_glib_none().0, &mut error);
            debug_assert_eq!(is_ok == glib::ffi::GFALSE, !error.is_null());
            if error.is_null() {
                Ok(())
            } else {
                Err(from_glib_full(error))
            }
        }
    }

    /// Releases the shader and stages.
    ///
    /// Note: must be called in the GL thread
    #[doc(alias = "gst_gl_shader_release")]
    pub fn release(&self) {
        unsafe {
            ffi::gst_gl_shader_release(self.to_glib_none().0);
        }
    }

    /// Releases the shader and stages.
    ///
    /// Note: must be called in the GL thread
    #[doc(alias = "gst_gl_shader_release_unlocked")]
    pub fn release_unlocked(&self) {
        unsafe {
            ffi::gst_gl_shader_release_unlocked(self.to_glib_none().0);
        }
    }

    /// Perform `glUniform1f()` for `name` on `self`
    /// ## `name`
    /// name of the uniform
    /// ## `value`
    /// value to set
    #[doc(alias = "gst_gl_shader_set_uniform_1f")]
    pub fn set_uniform_1f(&self, name: &str, value: f32) {
        unsafe {
            ffi::gst_gl_shader_set_uniform_1f(self.to_glib_none().0, name.to_glib_none().0, value);
        }
    }

    /// Perform `glUniform1fv()` for `name` on `self`
    /// ## `name`
    /// name of the uniform
    /// ## `value`
    /// values to set
    #[doc(alias = "gst_gl_shader_set_uniform_1fv")]
    pub fn set_uniform_1fv(&self, name: &str, value: &[f32]) {
        let count = value.len() as _;
        unsafe {
            ffi::gst_gl_shader_set_uniform_1fv(
                self.to_glib_none().0,
                name.to_glib_none().0,
                count,
                value.to_glib_none().0,
            );
        }
    }

    /// Perform `glUniform1i()` for `name` on `self`
    /// ## `name`
    /// name of the uniform
    /// ## `value`
    /// value to set
    #[doc(alias = "gst_gl_shader_set_uniform_1i")]
    pub fn set_uniform_1i(&self, name: &str, value: i32) {
        unsafe {
            ffi::gst_gl_shader_set_uniform_1i(self.to_glib_none().0, name.to_glib_none().0, value);
        }
    }

    /// Perform `glUniform1iv()` for `name` on `self`
    /// ## `name`
    /// name of the uniform
    /// ## `value`
    /// values to set
    #[doc(alias = "gst_gl_shader_set_uniform_1iv")]
    pub fn set_uniform_1iv(&self, name: &str, value: &[i32]) {
        let count = value.len() as _;
        unsafe {
            ffi::gst_gl_shader_set_uniform_1iv(
                self.to_glib_none().0,
                name.to_glib_none().0,
                count,
                value.to_glib_none().0,
            );
        }
    }

    /// Perform `glUniform2f()` for `name` on `self`
    /// ## `name`
    /// name of the uniform
    /// ## `v0`
    /// first value to set
    /// ## `v1`
    /// second value to set
    #[doc(alias = "gst_gl_shader_set_uniform_2f")]
    pub fn set_uniform_2f(&self, name: &str, v0: f32, v1: f32) {
        unsafe {
            ffi::gst_gl_shader_set_uniform_2f(self.to_glib_none().0, name.to_glib_none().0, v0, v1);
        }
    }

    /// Perform `glUniform2fv()` for `name` on `self`
    /// ## `name`
    /// name of the uniform
    /// ## `value`
    /// values to set
    #[doc(alias = "gst_gl_shader_set_uniform_2fv")]
    pub fn set_uniform_2fv(&self, name: &str, value: &[f32]) {
        let count = value.len() as _;
        unsafe {
            ffi::gst_gl_shader_set_uniform_2fv(
                self.to_glib_none().0,
                name.to_glib_none().0,
                count,
                value.to_glib_none().0,
            );
        }
    }

    /// Perform `glUniform2i()` for `name` on `self`
    /// ## `name`
    /// name of the uniform
    /// ## `v0`
    /// first value to set
    /// ## `v1`
    /// second value to set
    #[doc(alias = "gst_gl_shader_set_uniform_2i")]
    pub fn set_uniform_2i(&self, name: &str, v0: i32, v1: i32) {
        unsafe {
            ffi::gst_gl_shader_set_uniform_2i(self.to_glib_none().0, name.to_glib_none().0, v0, v1);
        }
    }

    /// Perform `glUniform2iv()` for `name` on `self`
    /// ## `name`
    /// name of the uniform
    /// ## `value`
    /// values to set
    #[doc(alias = "gst_gl_shader_set_uniform_2iv")]
    pub fn set_uniform_2iv(&self, name: &str, value: &[i32]) {
        let count = value.len() as _;
        unsafe {
            ffi::gst_gl_shader_set_uniform_2iv(
                self.to_glib_none().0,
                name.to_glib_none().0,
                count,
                value.to_glib_none().0,
            );
        }
    }

    /// Perform `glUniform3f()` for `name` on `self`
    /// ## `name`
    /// name of the uniform
    /// ## `v0`
    /// first value to set
    /// ## `v1`
    /// second value to set
    /// ## `v2`
    /// third value to set
    #[doc(alias = "gst_gl_shader_set_uniform_3f")]
    pub fn set_uniform_3f(&self, name: &str, v0: f32, v1: f32, v2: f32) {
        unsafe {
            ffi::gst_gl_shader_set_uniform_3f(
                self.to_glib_none().0,
                name.to_glib_none().0,
                v0,
                v1,
                v2,
            );
        }
    }

    /// Perform `glUniform3fv()` for `name` on `self`
    /// ## `name`
    /// name of the uniform
    /// ## `value`
    /// values to set
    #[doc(alias = "gst_gl_shader_set_uniform_3fv")]
    pub fn set_uniform_3fv(&self, name: &str, value: &[f32]) {
        let count = value.len() as _;
        unsafe {
            ffi::gst_gl_shader_set_uniform_3fv(
                self.to_glib_none().0,
                name.to_glib_none().0,
                count,
                value.to_glib_none().0,
            );
        }
    }

    /// Perform `glUniform3i()` for `name` on `self`
    /// ## `name`
    /// name of the uniform
    /// ## `v0`
    /// first value to set
    /// ## `v1`
    /// second value to set
    /// ## `v2`
    /// third value to set
    #[doc(alias = "gst_gl_shader_set_uniform_3i")]
    pub fn set_uniform_3i(&self, name: &str, v0: i32, v1: i32, v2: i32) {
        unsafe {
            ffi::gst_gl_shader_set_uniform_3i(
                self.to_glib_none().0,
                name.to_glib_none().0,
                v0,
                v1,
                v2,
            );
        }
    }

    /// Perform `glUniform3iv()` for `name` on `self`
    /// ## `name`
    /// name of the uniform
    /// ## `value`
    /// values to set
    #[doc(alias = "gst_gl_shader_set_uniform_3iv")]
    pub fn set_uniform_3iv(&self, name: &str, value: &[i32]) {
        let count = value.len() as _;
        unsafe {
            ffi::gst_gl_shader_set_uniform_3iv(
                self.to_glib_none().0,
                name.to_glib_none().0,
                count,
                value.to_glib_none().0,
            );
        }
    }

    /// Perform `glUniform4f()` for `name` on `self`
    /// ## `name`
    /// name of the uniform
    /// ## `v0`
    /// first value to set
    /// ## `v1`
    /// second value to set
    /// ## `v2`
    /// third value to set
    /// ## `v3`
    /// fourth value to set
    #[doc(alias = "gst_gl_shader_set_uniform_4f")]
    pub fn set_uniform_4f(&self, name: &str, v0: f32, v1: f32, v2: f32, v3: f32) {
        unsafe {
            ffi::gst_gl_shader_set_uniform_4f(
                self.to_glib_none().0,
                name.to_glib_none().0,
                v0,
                v1,
                v2,
                v3,
            );
        }
    }

    /// Perform `glUniform4fv()` for `name` on `self`
    /// ## `name`
    /// name of the uniform
    /// ## `value`
    /// values to set
    #[doc(alias = "gst_gl_shader_set_uniform_4fv")]
    pub fn set_uniform_4fv(&self, name: &str, value: &[f32]) {
        let count = value.len() as _;
        unsafe {
            ffi::gst_gl_shader_set_uniform_4fv(
                self.to_glib_none().0,
                name.to_glib_none().0,
                count,
                value.to_glib_none().0,
            );
        }
    }

    /// Perform `glUniform4i()` for `name` on `self`
    /// ## `name`
    /// name of the uniform
    /// ## `v0`
    /// first value to set
    /// ## `v1`
    /// second value to set
    /// ## `v2`
    /// third value to set
    /// ## `v3`
    /// fourth value to set
    #[doc(alias = "gst_gl_shader_set_uniform_4i")]
    pub fn set_uniform_4i(&self, name: &str, v0: i32, v1: i32, v2: i32, v3: i32) {
        unsafe {
            ffi::gst_gl_shader_set_uniform_4i(
                self.to_glib_none().0,
                name.to_glib_none().0,
                v0,
                v1,
                v2,
                v3,
            );
        }
    }

    /// Perform `glUniform4iv()` for `name` on `self`
    /// ## `name`
    /// name of the uniform
    /// ## `value`
    /// values to set
    #[doc(alias = "gst_gl_shader_set_uniform_4iv")]
    pub fn set_uniform_4iv(&self, name: &str, value: &[i32]) {
        let count = value.len() as _;
        unsafe {
            ffi::gst_gl_shader_set_uniform_4iv(
                self.to_glib_none().0,
                name.to_glib_none().0,
                count,
                value.to_glib_none().0,
            );
        }
    }

    #[doc(alias = "gst_gl_shader_use")]
    #[doc(alias = "use")]
    pub fn use_(&self) {
        unsafe {
            ffi::gst_gl_shader_use(self.to_glib_none().0);
        }
    }

    /// ## `context`
    /// a [`GLContext`][crate::GLContext]
    /// ## `version`
    /// a [`GLSLVersion`][crate::GLSLVersion]
    /// ## `profile`
    /// a [`GLSLProfile`][crate::GLSLProfile]
    ///
    /// # Returns
    ///
    /// a passthrough shader string for copying an input external-oes
    ///  texture to the output
    #[cfg(feature = "v1_16")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
    #[doc(alias = "gst_gl_shader_string_fragment_external_oes_get_default")]
    pub fn string_fragment_external_oes_get_default(
        context: &impl IsA<GLContext>,
        version: GLSLVersion,
        profile: GLSLProfile,
    ) -> glib::GString {
        skip_assert_initialized!();
        unsafe {
            from_glib_full(ffi::gst_gl_shader_string_fragment_external_oes_get_default(
                context.as_ref().to_glib_none().0,
                version.into_glib(),
                profile.into_glib(),
            ))
        }
    }

    /// ## `context`
    /// a [`GLContext`][crate::GLContext]
    /// ## `version`
    /// a [`GLSLVersion`][crate::GLSLVersion]
    /// ## `profile`
    /// a [`GLSLProfile`][crate::GLSLProfile]
    ///
    /// # Returns
    ///
    /// a passthrough shader string for copying an input texture to
    ///  the output
    #[cfg(feature = "v1_16")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
    #[doc(alias = "gst_gl_shader_string_fragment_get_default")]
    pub fn string_fragment_get_default(
        context: &impl IsA<GLContext>,
        version: GLSLVersion,
        profile: GLSLProfile,
    ) -> glib::GString {
        skip_assert_initialized!();
        unsafe {
            from_glib_full(ffi::gst_gl_shader_string_fragment_get_default(
                context.as_ref().to_glib_none().0,
                version.into_glib(),
                profile.into_glib(),
            ))
        }
    }

    /// Generates a shader string that defines the precision of float types in
    /// GLSL shaders. This is particularly needed for fragment shaders in a
    /// GLSL ES context where there is no default precision specified.
    ///
    /// Practically, this will return the string 'precision mediump float'
    /// or 'precision highp float' depending on if high precision floats are
    /// determined to be supported.
    /// ## `context`
    /// a [`GLContext`][crate::GLContext]
    /// ## `version`
    /// a [`GLSLVersion`][crate::GLSLVersion]
    /// ## `profile`
    /// a [`GLSLProfile`][crate::GLSLProfile]
    ///
    /// # Returns
    ///
    /// a shader string defining the precision of float types based on
    ///  `context`, `version` and `profile`
    #[cfg(feature = "v1_16")]
    #[cfg_attr(docsrs, doc(cfg(feature = "v1_16")))]
    #[doc(alias = "gst_gl_shader_string_get_highest_precision")]
    pub fn string_get_highest_precision(
        context: &impl IsA<GLContext>,
        version: GLSLVersion,
        profile: GLSLProfile,
    ) -> glib::GString {
        skip_assert_initialized!();
        unsafe {
            from_glib_none(ffi::gst_gl_shader_string_get_highest_precision(
                context.as_ref().to_glib_none().0,
                version.into_glib(),
                profile.into_glib(),
            ))
        }
    }

    #[doc(alias = "linked")]
    pub fn connect_linked_notify<F: Fn(&Self) + Send + Sync + 'static>(
        &self,
        f: F,
    ) -> SignalHandlerId {
        unsafe extern "C" fn notify_linked_trampoline<F: Fn(&GLShader) + Send + Sync + 'static>(
            this: *mut ffi::GstGLShader,
            _param_spec: glib::ffi::gpointer,
            f: glib::ffi::gpointer,
        ) {
            let f: &F = &*(f as *const F);
            f(&from_glib_borrow(this))
        }
        unsafe {
            let f: Box_<F> = Box_::new(f);
            connect_raw(
                self.as_ptr() as *mut _,
                b"notify::linked\0".as_ptr() as *const _,
                Some(std::mem::transmute::<_, unsafe extern "C" fn()>(
                    notify_linked_trampoline::<F> as *const (),
                )),
                Box_::into_raw(f),
            )
        }
    }
}

unsafe impl Send for GLShader {}
unsafe impl Sync for GLShader {}