-
Notifications
You must be signed in to change notification settings - Fork 16
/
spirv.cxx
3013 lines (2714 loc) · 223 KB
/
spirv.cxx
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
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Forward declare D3D12_SHADER_BYTECODE.
// @dxil() returns const D3D12_SHADER_BYTECODE&.
struct D3D12_SHADER_BYTECODE;
#ifdef SPIRV_IMPLICIT_NAMESPACE
namespace SPIRV_IMPLICIT_NAMESPACE {
#endif
typedef float vec2 __attribute__((vector_size(8)));
typedef float vec3 __attribute__((vector_size(12)));
typedef float vec4 __attribute__((vector_size(16)));
typedef double dvec2 __attribute__((vector_size(16)));
typedef double dvec3 __attribute__((vector_size(24)));
typedef double dvec4 __attribute__((vector_size(32)));
typedef int ivec2 __attribute__((vector_size(8)));
typedef int ivec3 __attribute__((vector_size(12)));
typedef int ivec4 __attribute__((vector_size(16)));
typedef unsigned uvec2 __attribute__((vector_size(8)));
typedef unsigned uvec3 __attribute__((vector_size(12)));
typedef unsigned uvec4 __attribute__((vector_size(16)));
typedef int64_t i64vec2 __attribute__((vector_size(16)));
typedef int64_t i64vec3 __attribute__((vector_size(24)));
typedef int64_t i64vec4 __attribute__((vector_size(32)));
typedef uint64_t u64vec2 __attribute__((vector_size(16)));
typedef uint64_t u64vec3 __attribute__((vector_size(24)));
typedef uint64_t u64vec4 __attribute__((vector_size(32)));
typedef bool bvec2 __attribute__((vector_size(2)));
typedef bool bvec3 __attribute__((vector_size(3)));
typedef bool bvec4 __attribute__((vector_size(4)));
typedef vec2 mat2x2 __attribute__((matrix_size(16)));
typedef vec2 mat3x2 __attribute__((matrix_size(24)));
typedef vec2 mat4x2 __attribute__((matrix_size(32)));
typedef vec3 mat2x3 __attribute__((matrix_size(24)));
typedef vec3 mat3x3 __attribute__((matrix_size(36)));
typedef vec3 mat4x3 __attribute__((matrix_size(48)));
typedef vec4 mat2x4 __attribute__((matrix_size(32)));
typedef vec4 mat3x4 __attribute__((matrix_size(48)));
typedef vec4 mat4x4 __attribute__((matrix_size(64)));
typedef mat2x2 mat2;
typedef mat3x3 mat3;
typedef mat4x4 mat4;
typedef dvec2 dmat2x2 __attribute__((matrix_size(32)));
typedef dvec2 dmat3x2 __attribute__((matrix_size(48)));
typedef dvec2 dmat4x2 __attribute__((matrix_size(64)));
typedef dvec3 dmat2x3 __attribute__((matrix_size(48)));
typedef dvec3 dmat3x3 __attribute__((matrix_size(72)));
typedef dvec3 dmat4x3 __attribute__((matrix_size(96)));
typedef dvec4 dmat2x4 __attribute__((matrix_size(64)));
typedef dvec4 dmat3x4 __attribute__((matrix_size(96)));
typedef dvec4 dmat4x4 __attribute__((matrix_size(128)));
typedef dmat2x2 dmat2;
typedef dmat3x3 dmat3;
typedef dmat4x4 dmat4;
////////////////////////////////////////////////////////////////////////////////
#define __CORRECT_ISO_CPP_MATH_H_PROTO
#define GLSL_PREFIX inline constexpr
// https://www.khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.4.60.html#angle-and-trigonometry-functions
#define PI_F 3.14159265359f
#define PI_D 3.14159265359
GLSL_PREFIX float [[spirv::GLSLstd450(11)]] radians(float a) noexcept { return (PI_F / 180) * a; }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(11)]] radians(vec2 a) noexcept { return (PI_F / 180) * a; }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(11)]] radians(vec3 a) noexcept { return (PI_F / 180) * a; }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(11)]] radians(vec4 a) noexcept { return (PI_F / 180) * a; }
GLSL_PREFIX double [[spirv::GLSLstd450(11)]] radians(double a) noexcept { return (PI_D / 180) * a; }
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(11)]] radians(dvec2 a) noexcept { return (PI_D / 180) * a; }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(11)]] radians(dvec3 a) noexcept { return (PI_D / 180) * a; }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(11)]] radians(dvec4 a) noexcept { return (PI_D / 180) * a; }
GLSL_PREFIX float [[spirv::GLSLstd450(12)]] degrees(float a) noexcept { return (180 / PI_F) * a; }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(12)]] degrees(vec2 a) noexcept { return (180 / PI_F) * a; }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(12)]] degrees(vec3 a) noexcept { return (180 / PI_F) * a; }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(12)]] degrees(vec4 a) noexcept { return (180 / PI_F) * a; }
GLSL_PREFIX double [[spirv::GLSLstd450(12)]] degrees(double a) noexcept { return (180 / PI_D) * a; }
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(12)]] degrees(dvec2 a) noexcept { return (180 / PI_D) * a; }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(12)]] degrees(dvec3 a) noexcept { return (180 / PI_D) * a; }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(12)]] degrees(dvec4 a) noexcept { return (180 / PI_D) * a; }
#undef PI_F
#undef PI_D
GLSL_PREFIX float [[spirv::GLSLstd450(13)]] sin(float a) noexcept { return __builtin_sinf( a); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(13)]] sin(vec2 a) noexcept { return __vector_apply(__builtin_sinf, a); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(13)]] sin(vec3 a) noexcept { return __vector_apply(__builtin_sinf, a); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(13)]] sin(vec4 a) noexcept { return __vector_apply(__builtin_sinf, a); }
extern "C" double [[spirv::GLSLstd450(13)]] sin(double ) noexcept;
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(13)]] sin(dvec2 a) noexcept { return __vector_apply(__builtin_sin, a); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(13)]] sin(dvec3 a) noexcept { return __vector_apply(__builtin_sin, a); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(13)]] sin(dvec4 a) noexcept { return __vector_apply(__builtin_sin, a); }
GLSL_PREFIX long double sin(long double a) noexcept { return __builtin_sinl(a); }
GLSL_PREFIX float [[spirv::GLSLstd450(14)]] cos(float a) noexcept { return __builtin_cosf( a); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(14)]] cos(vec2 a) noexcept { return __vector_apply(__builtin_cosf, a); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(14)]] cos(vec3 a) noexcept { return __vector_apply(__builtin_cosf, a); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(14)]] cos(vec4 a) noexcept { return __vector_apply(__builtin_cosf, a); }
extern "C" double [[spirv::GLSLstd450(14)]] cos(double ) noexcept;
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(14)]] cos(dvec2 a) noexcept { return __vector_apply(__builtin_cos, a); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(14)]] cos(dvec3 a) noexcept { return __vector_apply(__builtin_cos, a); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(14)]] cos(dvec4 a) noexcept { return __vector_apply(__builtin_cos, a); }
GLSL_PREFIX long double cos(long double a) noexcept { return __builtin_cosl(a); }
GLSL_PREFIX float [[spirv::GLSLstd450(15)]] tan(float a) noexcept { return __builtin_tanf( a); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(15)]] tan(vec2 a) noexcept { return __vector_apply(__builtin_tanf, a); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(15)]] tan(vec3 a) noexcept { return __vector_apply(__builtin_tanf, a); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(15)]] tan(vec4 a) noexcept { return __vector_apply(__builtin_tanf, a); }
extern "C" double [[spirv::GLSLstd450(15)]] tan(double ) noexcept;
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(15)]] tan(dvec2 a) noexcept { return __vector_apply(__builtin_tan, a); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(15)]] tan(dvec3 a) noexcept { return __vector_apply(__builtin_tan, a); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(15)]] tan(dvec4 a) noexcept { return __vector_apply(__builtin_tan, a); }
GLSL_PREFIX long double tan(long double a) noexcept { return __builtin_tanl(a); }
GLSL_PREFIX float [[spirv::GLSLstd450(16)]] asin(float a) noexcept { return __builtin_asinf( a); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(16)]] asin(vec2 a) noexcept { return __vector_apply(__builtin_asinf, a); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(16)]] asin(vec3 a) noexcept { return __vector_apply(__builtin_asinf, a); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(16)]] asin(vec4 a) noexcept { return __vector_apply(__builtin_asinf, a); }
extern "C" double [[spirv::GLSLstd450(16)]] asin(double ) noexcept;
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(16)]] asin(dvec2 a) noexcept { return __vector_apply(__builtin_asin, a); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(16)]] asin(dvec3 a) noexcept { return __vector_apply(__builtin_asin, a); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(16)]] asin(dvec4 a) noexcept { return __vector_apply(__builtin_asin, a); }
GLSL_PREFIX long double aasin(long double a) noexcept { return __builtin_asinl(a); }
GLSL_PREFIX float [[spirv::GLSLstd450(17)]] acos(float a) noexcept { return __builtin_acosf( a); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(17)]] acos(vec2 a) noexcept { return __vector_apply(__builtin_acosf, a); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(17)]] acos(vec3 a) noexcept { return __vector_apply(__builtin_acosf, a); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(17)]] acos(vec4 a) noexcept { return __vector_apply(__builtin_acosf, a); }
extern "C" double [[spirv::GLSLstd450(17)]] acos(double ) noexcept;
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(17)]] acos(dvec2 a) noexcept { return __vector_apply(__builtin_acos, a); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(17)]] acos(dvec3 a) noexcept { return __vector_apply(__builtin_acos, a); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(17)]] acos(dvec4 a) noexcept { return __vector_apply(__builtin_acos, a); }
GLSL_PREFIX long double acos(long double a) noexcept { return __builtin_acosl(a); }
GLSL_PREFIX float [[spirv::GLSLstd450(18)]] atan(float a) noexcept { return __builtin_atanf( a); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(18)]] atan(vec2 a) noexcept { return __vector_apply(__builtin_atanf, a); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(18)]] atan(vec3 a) noexcept { return __vector_apply(__builtin_atanf, a); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(18)]] atan(vec4 a) noexcept { return __vector_apply(__builtin_atanf, a); }
extern "C" double [[spirv::GLSLstd450(18)]] atan(double ) noexcept;
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(18)]] atan(dvec2 a) noexcept { return __vector_apply(__builtin_atan, a); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(18)]] atan(dvec3 a) noexcept { return __vector_apply(__builtin_atan, a); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(18)]] atan(dvec4 a) noexcept { return __vector_apply(__builtin_atan, a); }
GLSL_PREFIX long double atan(long double a) noexcept { return __builtin_atanl(a); }
GLSL_PREFIX float [[spirv::GLSLstd450(25)]] atan2(float a, float b) noexcept { return __builtin_atan2f( a, b); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(25)]] atan2(vec2 a, vec2 b) noexcept { return __vector_apply(__builtin_atan2f, a, b); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(25)]] atan2(vec3 a, vec3 b) noexcept { return __vector_apply(__builtin_atan2f, a, b); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(25)]] atan2(vec4 a, vec4 b) noexcept { return __vector_apply(__builtin_atan2f, a, b); }
extern "C" double [[spirv::GLSLstd450(25)]] atan2(double , double ) noexcept;
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(25)]] atan2(dvec2 a, dvec2 b) noexcept { return __vector_apply(__builtin_atan2, a, b); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(25)]] atan2(dvec3 a, dvec3 b) noexcept { return __vector_apply(__builtin_atan2, a, b); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(25)]] atan2(dvec4 a, dvec4 b) noexcept { return __vector_apply(__builtin_atan2, a, b); }
GLSL_PREFIX long double atan2(long double a, long double b) noexcept { return __builtin_atan2l(a, b); }
GLSL_PREFIX float [[spirv::GLSLstd450(19)]] sinh(float a) noexcept { return __builtin_sinhf( a); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(19)]] sinh(vec2 a) noexcept { return __vector_apply(__builtin_sinhf, a); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(19)]] sinh(vec3 a) noexcept { return __vector_apply(__builtin_sinhf, a); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(19)]] sinh(vec4 a) noexcept { return __vector_apply(__builtin_sinhf, a); }
extern "C" double [[spirv::GLSLstd450(19)]] sinh(double ) noexcept;
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(19)]] sinh(dvec2 a) noexcept { return __vector_apply(__builtin_sinh, a); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(19)]] sinh(dvec3 a) noexcept { return __vector_apply(__builtin_sinh, a); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(19)]] sinh(dvec4 a) noexcept { return __vector_apply(__builtin_sinh, a); }
GLSL_PREFIX long double sinh(long double a) noexcept { return __builtin_sinhl(a); }
GLSL_PREFIX float [[spirv::GLSLstd450(20)]] cosh(float a) noexcept { return __builtin_coshf( a); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(20)]] cosh(vec2 a) noexcept { return __vector_apply(__builtin_coshf, a); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(20)]] cosh(vec3 a) noexcept { return __vector_apply(__builtin_coshf, a); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(20)]] cosh(vec4 a) noexcept { return __vector_apply(__builtin_coshf, a); }
extern "C" double [[spirv::GLSLstd450(20)]] cosh(double ) noexcept;
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(20)]] cosh(dvec2 a) noexcept { return __vector_apply(__builtin_cosh, a); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(20)]] cosh(dvec3 a) noexcept { return __vector_apply(__builtin_cosh, a); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(20)]] cosh(dvec4 a) noexcept { return __vector_apply(__builtin_cosh, a); }
GLSL_PREFIX long double cosh(long double a) noexcept { return __builtin_coshl(a); }
GLSL_PREFIX float [[spirv::GLSLstd450(21)]] tanh(float a) noexcept { return __builtin_tanhf( a); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(21)]] tanh(vec2 a) noexcept { return __vector_apply(__builtin_tanhf, a); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(21)]] tanh(vec3 a) noexcept { return __vector_apply(__builtin_tanhf, a); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(21)]] tanh(vec4 a) noexcept { return __vector_apply(__builtin_tanhf, a); }
extern "C" double [[spirv::GLSLstd450(21)]] tanh(double ) noexcept;
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(21)]] tanh(dvec2 a) noexcept { return __vector_apply(__builtin_tanh, a); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(21)]] tanh(dvec3 a) noexcept { return __vector_apply(__builtin_tanh, a); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(21)]] tanh(dvec4 a) noexcept { return __vector_apply(__builtin_tanh, a); }
GLSL_PREFIX long double tanh(long double a) noexcept { return __builtin_tanhl(a); }
GLSL_PREFIX float [[spirv::GLSLstd450(22)]] asinh(float a) noexcept { return __builtin_asinhf( a); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(22)]] asinh(vec2 a) noexcept { return __vector_apply(__builtin_asinhf, a); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(22)]] asinh(vec3 a) noexcept { return __vector_apply(__builtin_asinhf, a); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(22)]] asinh(vec4 a) noexcept { return __vector_apply(__builtin_asinhf, a); }
extern "C" double [[spirv::GLSLstd450(22)]] asinh(double ) noexcept;
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(22)]] asinh(dvec2 a) noexcept { return __vector_apply(__builtin_asinh, a); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(22)]] asinh(dvec3 a) noexcept { return __vector_apply(__builtin_asinh, a); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(22)]] asinh(dvec4 a) noexcept { return __vector_apply(__builtin_asinh, a); }
GLSL_PREFIX long double asinh(long double a) noexcept { return __builtin_asinhl(a); }
GLSL_PREFIX float [[spirv::GLSLstd450(23)]] acosh(float a) noexcept { return __builtin_acoshf( a); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(23)]] acosh(vec2 a) noexcept { return __vector_apply(__builtin_acoshf, a); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(23)]] acosh(vec3 a) noexcept { return __vector_apply(__builtin_acoshf, a); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(23)]] acosh(vec4 a) noexcept { return __vector_apply(__builtin_acoshf, a); }
extern "C" double [[spirv::GLSLstd450(23)]] acosh(double ) noexcept;
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(23)]] acosh(dvec2 a) noexcept { return __vector_apply(__builtin_acosh, a); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(23)]] acosh(dvec3 a) noexcept { return __vector_apply(__builtin_acosh, a); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(23)]] acosh(dvec4 a) noexcept { return __vector_apply(__builtin_acosh, a); }
GLSL_PREFIX long double acosh(long double a) noexcept { return __builtin_acoshl(a); }
GLSL_PREFIX float [[spirv::GLSLstd450(24)]] atanh(float a) noexcept { return __builtin_atanhf( a); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(24)]] atanh(vec2 a) noexcept { return __vector_apply(__builtin_atanhf, a); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(24)]] atanh(vec3 a) noexcept { return __vector_apply(__builtin_atanhf, a); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(24)]] atanh(vec4 a) noexcept { return __vector_apply(__builtin_atanhf, a); }
extern "C" double [[spirv::GLSLstd450(24)]] atanh(double ) noexcept;
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(24)]] atanh(dvec2 a) noexcept { return __vector_apply(__builtin_atanh, a); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(24)]] atanh(dvec3 a) noexcept { return __vector_apply(__builtin_atanh, a); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(24)]] atanh(dvec4 a) noexcept { return __vector_apply(__builtin_atanh, a); }
GLSL_PREFIX long double atanh(long double a) noexcept { return __builtin_atanhl(a); }
// https://www.khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.4.60.html#exponential-functions
GLSL_PREFIX float [[spirv::GLSLstd450(26)]] pow(float a, float b) noexcept { return __builtin_powf( a, b); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(26)]] pow(vec2 a, vec2 b) noexcept { return __vector_apply(__builtin_powf, a, b); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(26)]] pow(vec3 a, vec3 b) noexcept { return __vector_apply(__builtin_powf, a, b); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(26)]] pow(vec4 a, vec4 b) noexcept { return __vector_apply(__builtin_powf, a, b); }
extern "C" double [[spirv::GLSLstd450(26)]] pow(double , double ) noexcept;
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(26)]] pow(dvec2 a, dvec2 b) noexcept { return __vector_apply(__builtin_pow, a, b); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(26)]] pow(dvec3 a, dvec3 b) noexcept { return __vector_apply(__builtin_pow, a, b); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(26)]] pow(dvec4 a, dvec4 b) noexcept { return __vector_apply(__builtin_pow, a, b); }
GLSL_PREFIX long double pow(long double a, long double b) noexcept { return __builtin_powl(a, b); }
GLSL_PREFIX float [[spirv::GLSLstd450(27)]] exp(float a) noexcept { return __builtin_expf( a); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(27)]] exp(vec2 a) noexcept { return __vector_apply(__builtin_expf, a); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(27)]] exp(vec3 a) noexcept { return __vector_apply(__builtin_expf, a); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(27)]] exp(vec4 a) noexcept { return __vector_apply(__builtin_expf, a); }
extern "C" double [[spirv::GLSLstd450(27)]] exp(double ) noexcept;
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(27)]] exp(dvec2 a) noexcept { return __vector_apply(__builtin_exp, a); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(27)]] exp(dvec3 a) noexcept { return __vector_apply(__builtin_exp, a); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(27)]] exp(dvec4 a) noexcept { return __vector_apply(__builtin_exp, a); }
GLSL_PREFIX long double exp(long double a) noexcept { return __builtin_expl(a); }
GLSL_PREFIX float [[spirv::GLSLstd450(28)]] log(float a) noexcept { return __builtin_logf( a); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(28)]] log(vec2 a) noexcept { return __vector_apply(__builtin_logf, a); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(28)]] log(vec3 a) noexcept { return __vector_apply(__builtin_logf, a); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(28)]] log(vec4 a) noexcept { return __vector_apply(__builtin_logf, a); }
extern "C" double [[spirv::GLSLstd450(28)]] log(double ) noexcept;
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(28)]] log(dvec2 a) noexcept { return __vector_apply(__builtin_log, a); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(28)]] log(dvec3 a) noexcept { return __vector_apply(__builtin_log, a); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(28)]] log(dvec4 a) noexcept { return __vector_apply(__builtin_log, a); }
GLSL_PREFIX long double log(long double a) noexcept { return __builtin_logl(a); }
GLSL_PREFIX float [[spirv::GLSLstd450(29)]] exp2(float a) noexcept { return __builtin_exp2f( a); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(29)]] exp2(vec2 a) noexcept { return __vector_apply(__builtin_exp2f, a); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(29)]] exp2(vec3 a) noexcept { return __vector_apply(__builtin_exp2f, a); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(29)]] exp2(vec4 a) noexcept { return __vector_apply(__builtin_exp2f, a); }
extern "C" double [[spirv::GLSLstd450(29)]] exp2(double ) noexcept;
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(29)]] exp2(dvec2 a) noexcept { return __vector_apply(__builtin_exp2, a); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(29)]] exp2(dvec3 a) noexcept { return __vector_apply(__builtin_exp2, a); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(29)]] exp2(dvec4 a) noexcept { return __vector_apply(__builtin_exp2, a); }
GLSL_PREFIX long double exp2(long double a) noexcept { return __builtin_exp2l(a); }
GLSL_PREFIX float [[spirv::GLSLstd450(30)]] log2(float a) noexcept { return __builtin_log2f( a); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(30)]] log2(vec2 a) noexcept { return __vector_apply(__builtin_log2f, a); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(30)]] log2(vec3 a) noexcept { return __vector_apply(__builtin_log2f, a); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(30)]] log2(vec4 a) noexcept { return __vector_apply(__builtin_log2f, a); }
extern "C" double [[spirv::GLSLstd450(30)]] log2(double ) noexcept;
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(30)]] log2(dvec2 a) noexcept { return __vector_apply(__builtin_log2, a); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(30)]] log2(dvec3 a) noexcept { return __vector_apply(__builtin_log2, a); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(30)]] log2(dvec4 a) noexcept { return __vector_apply(__builtin_log2, a); }
GLSL_PREFIX long double log2(long double a) noexcept { return __builtin_log2l(a); }
GLSL_PREFIX float [[spirv::GLSLstd450(31)]] sqrt(float a) noexcept { return __builtin_sqrtf( a); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(31)]] sqrt(vec2 a) noexcept { return __vector_apply(__builtin_sqrtf, a); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(31)]] sqrt(vec3 a) noexcept { return __vector_apply(__builtin_sqrtf, a); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(31)]] sqrt(vec4 a) noexcept { return __vector_apply(__builtin_sqrtf, a); }
extern "C" double [[spirv::GLSLstd450(31)]] sqrt(double ) noexcept;
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(31)]] sqrt(dvec2 a) noexcept { return __vector_apply(__builtin_sqrt, a); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(31)]] sqrt(dvec3 a) noexcept { return __vector_apply(__builtin_sqrt, a); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(31)]] sqrt(dvec4 a) noexcept { return __vector_apply(__builtin_sqrt, a); }
GLSL_PREFIX long double sqrt(long double a) noexcept { return __builtin_sqrtl(a); }
GLSL_PREFIX float [[spirv::GLSLstd450(32)]] inversesqrt(float a) noexcept { return __builtin_rsqrtf( a); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(32)]] inversesqrt(vec2 a) noexcept { return __vector_apply(__builtin_rsqrtf, a); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(32)]] inversesqrt(vec3 a) noexcept { return __vector_apply(__builtin_rsqrtf, a); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(32)]] inversesqrt(vec4 a) noexcept { return __vector_apply(__builtin_rsqrtf, a); }
GLSL_PREFIX double [[spirv::GLSLstd450(32)]] inversesqrt(double a) noexcept { return __builtin_rsqrt ( a); }
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(32)]] inversesqrt(dvec2 a) noexcept { return __vector_apply(__builtin_rsqrt, a); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(32)]] inversesqrt(dvec3 a) noexcept { return __vector_apply(__builtin_rsqrt, a); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(32)]] inversesqrt(dvec4 a) noexcept { return __vector_apply(__builtin_rsqrt, a); }
// 8.3 Common Functions
GLSL_PREFIX float [[spirv::GLSLstd450(4)]] abs(float a) noexcept { return __builtin_fabsf( a); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(4)]] abs(vec2 a) noexcept { return __vector_apply(__builtin_fabsf, a); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(4)]] abs(vec3 a) noexcept { return __vector_apply(__builtin_fabsf, a); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(4)]] abs(vec4 a) noexcept { return __vector_apply(__builtin_fabsf, a); }
GLSL_PREFIX double [[spirv::GLSLstd450(4)]] abs(double a) noexcept { return __builtin_fabs( a); }
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(4)]] abs(dvec2 a) noexcept { return __vector_apply(__builtin_fabs, a); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(4)]] abs(dvec3 a) noexcept { return __vector_apply(__builtin_fabs, a); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(4)]] abs(dvec4 a) noexcept { return __vector_apply(__builtin_fabs, a); }
GLSL_PREFIX ivec2 [[spirv::GLSLstd450(5)]] abs(ivec2 a) noexcept { return __vector_apply(__builtin_abs, a); }
GLSL_PREFIX ivec3 [[spirv::GLSLstd450(5)]] abs(ivec3 a) noexcept { return __vector_apply(__builtin_abs, a); }
GLSL_PREFIX ivec4 [[spirv::GLSLstd450(5)]] abs(ivec4 a) noexcept { return __vector_apply(__builtin_abs, a); }
GLSL_PREFIX float [[spirv::GLSLstd450(6)]] sign(float a) noexcept { return a >= 0 ? 1.f : -1.f; }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(6)]] sign(vec2 a) noexcept { return a >= 0 ? 1.f : -1.f; }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(6)]] sign(vec3 a) noexcept { return a >= 0 ? 1.f : -1.f; }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(6)]] sign(vec4 a) noexcept { return a >= 0 ? 1.f : -1.f; }
GLSL_PREFIX double [[spirv::GLSLstd450(6)]] sign(double a) noexcept { return a >= 0 ? 1.0 : -1.0; }
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(6)]] sign(dvec2 a) noexcept { return a >= 0 ? 1.0 : -1.0; }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(6)]] sign(dvec3 a) noexcept { return a >= 0 ? 1.0 : -1.0; }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(6)]] sign(dvec4 a) noexcept { return a >= 0 ? 1.0 : -1.0; }
GLSL_PREFIX int [[spirv::GLSLstd450(7)]] sign(int a) noexcept { return a >= 0 ? 1 : -1; }
GLSL_PREFIX ivec2 [[spirv::GLSLstd450(7)]] sign(ivec2 a) noexcept { return a >= 0 ? 1 : -1; }
GLSL_PREFIX ivec3 [[spirv::GLSLstd450(7)]] sign(ivec3 a) noexcept { return a >= 0 ? 1 : -1; }
GLSL_PREFIX ivec4 [[spirv::GLSLstd450(7)]] sign(ivec4 a) noexcept { return a >= 0 ? 1 : -1; }
GLSL_PREFIX float [[spirv::GLSLstd450(8)]] floor(float a) noexcept { return __builtin_floorf( a); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(8)]] floor(vec2 a) noexcept { return __vector_apply(__builtin_floorf, a); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(8)]] floor(vec3 a) noexcept { return __vector_apply(__builtin_floorf, a); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(8)]] floor(vec4 a) noexcept { return __vector_apply(__builtin_floorf, a); }
extern "C" double [[spirv::GLSLstd450(8)]] floor(double ) noexcept;
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(8)]] floor(dvec2 a) noexcept { return __vector_apply(__builtin_floor, a); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(8)]] floor(dvec3 a) noexcept { return __vector_apply(__builtin_floor, a); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(8)]] floor(dvec4 a) noexcept { return __vector_apply(__builtin_floor, a); }
GLSL_PREFIX float [[spirv::GLSLstd450(3)]] trunc(float a) noexcept { return __builtin_truncf( a); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(3)]] trunc(vec2 a) noexcept { return __vector_apply(__builtin_truncf, a); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(3)]] trunc(vec3 a) noexcept { return __vector_apply(__builtin_truncf, a); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(3)]] trunc(vec4 a) noexcept { return __vector_apply(__builtin_truncf, a); }
extern "C" double [[spirv::GLSLstd450(3)]] trunc(double a) noexcept;
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(3)]] trunc(dvec2 a) noexcept { return __vector_apply(__builtin_trunc, a); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(3)]] trunc(dvec3 a) noexcept { return __vector_apply(__builtin_trunc, a); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(3)]] trunc(dvec4 a) noexcept { return __vector_apply(__builtin_trunc, a); }
GLSL_PREFIX float [[spirv::GLSLstd450(1)]] round(float a) noexcept { return __builtin_roundf( a); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(1)]] round(vec2 a) noexcept { return __vector_apply(__builtin_roundf, a); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(1)]] round(vec3 a) noexcept { return __vector_apply(__builtin_roundf, a); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(1)]] round(vec4 a) noexcept { return __vector_apply(__builtin_roundf, a); }
extern "C" double [[spirv::GLSLstd450(1)]] round(double ) noexcept;
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(1)]] round(dvec2 a) noexcept { return __vector_apply(__builtin_round, a); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(1)]] round(dvec3 a) noexcept { return __vector_apply(__builtin_round, a); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(1)]] round(dvec4 a) noexcept { return __vector_apply(__builtin_round, a); }
GLSL_PREFIX float [[spirv::opcode(141)]] mod(float x, float y) noexcept { return x - y * floor(x / y); }
GLSL_PREFIX vec2 [[spirv::opcode(141)]] mod(vec2 x, vec2 y) noexcept { return x - y * floor(x / y); }
GLSL_PREFIX vec3 [[spirv::opcode(141)]] mod(vec3 x, vec3 y) noexcept { return x - y * floor(x / y); }
GLSL_PREFIX vec4 [[spirv::opcode(141)]] mod(vec4 x, vec4 y) noexcept { return x - y * floor(x / y); }
GLSL_PREFIX double [[spirv::opcode(141)]] mod(double x, double y) noexcept { return x - y * floor(x / y); }
GLSL_PREFIX dvec2 [[spirv::opcode(141)]] mod(dvec2 x, dvec2 y) noexcept { return x - y * floor(x / y); }
GLSL_PREFIX dvec3 [[spirv::opcode(141)]] mod(dvec3 x, dvec3 y) noexcept { return x - y * floor(x / y); }
GLSL_PREFIX dvec4 [[spirv::opcode(141)]] mod(dvec4 x, dvec4 y) noexcept { return x - y * floor(x / y); }
GLSL_PREFIX float [[spirv::GLSLstd450(9)]] ceil(float a) noexcept { return __builtin_ceilf( a); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(9)]] ceil(vec2 a) noexcept { return __vector_apply(__builtin_ceilf, a); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(9)]] ceil(vec3 a) noexcept { return __vector_apply(__builtin_ceilf, a); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(9)]] ceil(vec4 a) noexcept { return __vector_apply(__builtin_ceilf, a); }
extern "C" double [[spirv::GLSLstd450(9)]] ceil(double ) noexcept;
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(9)]] ceil(dvec2 a) noexcept { return __vector_apply(__builtin_ceil, a); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(9)]] ceil(dvec3 a) noexcept { return __vector_apply(__builtin_ceil, a); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(9)]] ceil(dvec4 a) noexcept { return __vector_apply(__builtin_ceil, a); }
GLSL_PREFIX float [[spirv::GLSLstd450(10)]] fract(float a) noexcept { return a - floor(a); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(10)]] fract(vec2 a) noexcept { return a - floor(a); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(10)]] fract(vec3 a) noexcept { return a - floor(a); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(10)]] fract(vec4 a) noexcept { return a - floor(a); }
GLSL_PREFIX double [[spirv::GLSLstd450(10)]] fract(double a) noexcept { return a - floor(a); }
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(10)]] fract(dvec2 a) noexcept { return a - floor(a); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(10)]] fract(dvec3 a) noexcept { return a - floor(a); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(10)]] fract(dvec4 a) noexcept { return a - floor(a); }
GLSL_PREFIX float [[spirv::GLSLstd450(37)]] min(float a, float b) noexcept { return __builtin_fminf( a, b); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(37)]] min(vec2 a, vec2 b) noexcept { return __vector_apply(__builtin_fminf, a, b); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(37)]] min(vec3 a, vec3 b) noexcept { return __vector_apply(__builtin_fminf, a, b); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(37)]] min(vec4 a, vec4 b) noexcept { return __vector_apply(__builtin_fminf, a, b); }
GLSL_PREFIX double [[spirv::GLSLstd450(37)]] min(double a, double b) noexcept { return __builtin_fmin( a, b); }
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(37)]] min(dvec2 a, dvec2 b) noexcept { return __vector_apply(__builtin_fmin, a, b); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(37)]] min(dvec3 a, dvec3 b) noexcept { return __vector_apply(__builtin_fmin, a, b); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(37)]] min(dvec4 a, dvec4 b) noexcept { return __vector_apply(__builtin_fmin, a, b); }
GLSL_PREFIX int [[spirv::GLSLstd450(39)]] min(int a, int b) noexcept { return __builtin_min( a, b); }
GLSL_PREFIX ivec2 [[spirv::GLSLstd450(39)]] min(ivec2 a, ivec2 b) noexcept { return __vector_apply(__builtin_min, a, b); }
GLSL_PREFIX ivec3 [[spirv::GLSLstd450(39)]] min(ivec3 a, ivec3 b) noexcept { return __vector_apply(__builtin_min, a, b); }
GLSL_PREFIX ivec4 [[spirv::GLSLstd450(39)]] min(ivec4 a, ivec4 b) noexcept { return __vector_apply(__builtin_min, a, b); }
GLSL_PREFIX uint [[spirv::GLSLstd450(38)]] min(uint a, uint b) noexcept { return __builtin_umin( a, b); }
GLSL_PREFIX uvec2 [[spirv::GLSLstd450(38)]] min(uvec2 a, uvec2 b) noexcept { return __vector_apply(__builtin_umin, a, b); }
GLSL_PREFIX uvec3 [[spirv::GLSLstd450(38)]] min(uvec3 a, uvec3 b) noexcept { return __vector_apply(__builtin_umin, a, b); }
GLSL_PREFIX uvec4 [[spirv::GLSLstd450(38)]] min(uvec4 a, uvec4 b) noexcept { return __vector_apply(__builtin_umin, a, b); }
GLSL_PREFIX float [[spirv::GLSLstd450(40)]] max(float a, float b) noexcept { return __builtin_fmaxf( a, b); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(40)]] max(vec2 a, vec2 b) noexcept { return __vector_apply(__builtin_fmaxf, a, b); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(40)]] max(vec3 a, vec3 b) noexcept { return __vector_apply(__builtin_fmaxf, a, b); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(40)]] max(vec4 a, vec4 b) noexcept { return __vector_apply(__builtin_fmaxf, a, b); }
GLSL_PREFIX double [[spirv::GLSLstd450(40)]] max(double a, double b) noexcept { return __builtin_fmax( a, b); }
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(40)]] max(dvec2 a, dvec2 b) noexcept { return __vector_apply(__builtin_fmax, a, b); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(40)]] max(dvec3 a, dvec3 b) noexcept { return __vector_apply(__builtin_fmax, a, b); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(40)]] max(dvec4 a, dvec4 b) noexcept { return __vector_apply(__builtin_fmax, a, b); }
GLSL_PREFIX int [[spirv::GLSLstd450(42)]] max(int a, int b) noexcept { return __builtin_max( a, b); }
GLSL_PREFIX ivec2 [[spirv::GLSLstd450(42)]] max(ivec2 a, ivec2 b) noexcept { return __vector_apply(__builtin_max, a, b); }
GLSL_PREFIX ivec3 [[spirv::GLSLstd450(42)]] max(ivec3 a, ivec3 b) noexcept { return __vector_apply(__builtin_max, a, b); }
GLSL_PREFIX ivec4 [[spirv::GLSLstd450(42)]] max(ivec4 a, ivec4 b) noexcept { return __vector_apply(__builtin_max, a, b); }
GLSL_PREFIX uint [[spirv::GLSLstd450(41)]] max(uint a, uint b) noexcept { return __builtin_umax( a, b); }
GLSL_PREFIX uvec2 [[spirv::GLSLstd450(41)]] max(uvec2 a, uvec2 b) noexcept { return __vector_apply(__builtin_umax, a, b); }
GLSL_PREFIX uvec3 [[spirv::GLSLstd450(41)]] max(uvec3 a, uvec3 b) noexcept { return __vector_apply(__builtin_umax, a, b); }
GLSL_PREFIX uvec4 [[spirv::GLSLstd450(41)]] max(uvec4 a, uvec4 b) noexcept { return __vector_apply(__builtin_umax, a, b); }
GLSL_PREFIX float [[spirv::GLSLstd450(43)]] clamp(float x, float x0, float x1) noexcept { return min(max(x, x0), x1); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(43)]] clamp(vec2 x, vec2 x0, vec2 x1) noexcept { return min(max(x, x0), x1); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(43)]] clamp(vec3 x, vec3 x0, vec3 x1) noexcept { return min(max(x, x0), x1); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(43)]] clamp(vec4 x, vec4 x0, vec4 x1) noexcept { return min(max(x, x0), x1); }
GLSL_PREFIX double [[spirv::GLSLstd450(43)]] clamp(double x, double x0, double x1) noexcept { return min(max(x, x0), x1); }
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(43)]] clamp(dvec2 x, dvec2 x0, dvec2 x1) noexcept { return min(max(x, x0), x1); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(43)]] clamp(dvec3 x, dvec3 x0, dvec3 x1) noexcept { return min(max(x, x0), x1); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(43)]] clamp(dvec4 x, dvec4 x0, dvec4 x1) noexcept { return min(max(x, x0), x1); }
GLSL_PREFIX int [[spirv::GLSLstd450(45)]] clamp(int x, int x0, int x1) noexcept { return min(max(x, x0), x1); }
GLSL_PREFIX ivec2 [[spirv::GLSLstd450(45)]] clamp(ivec2 x, ivec2 x0, ivec2 x1) noexcept { return min(max(x, x0), x1); }
GLSL_PREFIX ivec3 [[spirv::GLSLstd450(45)]] clamp(ivec3 x, ivec3 x0, ivec3 x1) noexcept { return min(max(x, x0), x1); }
GLSL_PREFIX ivec4 [[spirv::GLSLstd450(45)]] clamp(ivec4 x, ivec4 x0, ivec4 x1) noexcept { return min(max(x, x0), x1); }
GLSL_PREFIX uint [[spirv::GLSLstd450(44)]] clamp(uint x, uint x0, uint x1) noexcept { return min(max(x, x0), x1); }
GLSL_PREFIX uvec2 [[spirv::GLSLstd450(44)]] clamp(uvec2 x, uvec2 x0, uvec2 x1) noexcept { return min(max(x, x0), x1); }
GLSL_PREFIX uvec3 [[spirv::GLSLstd450(44)]] clamp(uvec3 x, uvec3 x0, uvec3 x1) noexcept { return min(max(x, x0), x1); }
GLSL_PREFIX uvec4 [[spirv::GLSLstd450(44)]] clamp(uvec4 x, uvec4 x0, uvec4 x1) noexcept { return min(max(x, x0), x1); }
GLSL_PREFIX float saturate(float x) noexcept { return clamp(x, 0.f, 1.f); }
GLSL_PREFIX vec2 saturate(vec2 x) noexcept { return clamp(x, 0.f, 1.f); }
GLSL_PREFIX vec3 saturate(vec3 x) noexcept { return clamp(x, 0.f, 1.f); }
GLSL_PREFIX vec4 saturate(vec4 x) noexcept { return clamp(x, 0.f, 1.f); }
GLSL_PREFIX double saturate(double x) noexcept { return clamp(x, 0.0, 1.0); }
GLSL_PREFIX dvec2 saturate(dvec2 x) noexcept { return clamp(x, 0.0, 1.0); }
GLSL_PREFIX dvec3 saturate(dvec3 x) noexcept { return clamp(x, 0.0, 1.0); }
GLSL_PREFIX dvec4 saturate(dvec4 x) noexcept { return clamp(x, 0.0, 1.0); }
GLSL_PREFIX float [[spirv::GLSLstd450(46)]] mix(float x, float y, float a) noexcept { return x * (1 - a) + y * a; }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(46)]] mix(vec2 x, vec2 y, vec2 a) noexcept { return x * (1 - a) + y * a; }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(46)]] mix(vec3 x, vec3 y, vec3 a) noexcept { return x * (1 - a) + y * a; }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(46)]] mix(vec4 x, vec4 y, vec4 a) noexcept { return x * (1 - a) + y * a; }
GLSL_PREFIX double [[spirv::GLSLstd450(46)]] mix(double x, double y, double a) noexcept { return x * (1 - a) + y * a; }
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(46)]] mix(dvec2 x, dvec2 y, dvec2 a) noexcept { return x * (1 - a) + y * a; }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(46)]] mix(dvec3 x, dvec3 y, dvec3 a) noexcept { return x * (1 - a) + y * a; }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(46)]] mix(dvec4 x, dvec4 y, dvec4 a) noexcept { return x * (1 - a) + y * a; }
GLSL_PREFIX float [[spirv::GLSLstd450(48)]] step(float edge, float x) noexcept { return x >= edge ? 1.f : 0.f; }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(48)]] step(vec2 edge, vec2 x) noexcept { return x >= edge ? 1.f : 0.f; }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(48)]] step(vec3 edge, vec3 x) noexcept { return x >= edge ? 1.f : 0.f; }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(48)]] step(vec4 edge, vec4 x) noexcept { return x >= edge ? 1.f : 0.f; }
GLSL_PREFIX double [[spirv::GLSLstd450(48)]] step(double edge, double x) noexcept { return x >= edge ? 1.0 : 0.0; }
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(48)]] step(dvec2 edge, dvec2 x) noexcept { return x >= edge ? 1.0 : 0.0; }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(48)]] step(dvec3 edge, dvec3 x) noexcept { return x >= edge ? 1.0 : 0.0; }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(48)]] step(dvec4 edge, dvec4 x) noexcept { return x >= edge ? 1.0 : 0.0; }
GLSL_PREFIX float [[spirv::GLSLstd450(49)]] smoothstep(float edge0, float edge1, float x) noexcept { float t = saturate((x - edge0) / (edge1 - edge0)); return t * t * (3 - 2 * t); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(49)]] smoothstep(vec2 edge0, vec2 edge1, vec2 x) noexcept { vec2 t = saturate((x - edge0) / (edge1 - edge0)); return t * t * (3 - 2 * t); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(49)]] smoothstep(vec3 edge0, vec3 edge1, vec3 x) noexcept { vec3 t = saturate((x - edge0) / (edge1 - edge0)); return t * t * (3 - 2 * t); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(49)]] smoothstep(vec4 edge0, vec4 edge1, vec4 x) noexcept { vec4 t = saturate((x - edge0) / (edge1 - edge0)); return t * t * (3 - 2 * t); }
GLSL_PREFIX double [[spirv::GLSLstd450(49)]] smoothstep(double edge0, double edge1, double x) noexcept { double t = saturate((x - edge0) / (edge1 - edge0)); return t * t * (3 - 2 * t); }
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(49)]] smoothstep(dvec2 edge0, dvec2 edge1, dvec2 x) noexcept { dvec2 t = saturate((x - edge0) / (edge1 - edge0)); return t * t * (3 - 2 * t); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(49)]] smoothstep(dvec3 edge0, dvec3 edge1, dvec3 x) noexcept { dvec3 t = saturate((x - edge0) / (edge1 - edge0)); return t * t * (3 - 2 * t); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(49)]] smoothstep(dvec4 edge0, dvec4 edge1, dvec4 x) noexcept { dvec4 t = saturate((x - edge0) / (edge1 - edge0)); return t * t * (3 - 2 * t); }
GLSL_PREFIX bool [[spirv::opcode(156)]] isnan(float a) noexcept { return __builtin_isnanf( a); }
GLSL_PREFIX bvec2 [[spirv::opcode(156)]] isnan(vec2 a) noexcept { return __vector_apply(__builtin_isnanf, a); }
GLSL_PREFIX bvec3 [[spirv::opcode(156)]] isnan(vec3 a) noexcept { return __vector_apply(__builtin_isnanf, a); }
GLSL_PREFIX bvec4 [[spirv::opcode(156)]] isnan(vec4 a) noexcept { return __vector_apply(__builtin_isnanf, a); }
extern "C" bool [[spirv::opcode(156)]] isnan(double a) noexcept;
GLSL_PREFIX bvec2 [[spirv::opcode(156)]] isnan(dvec2 a) noexcept { return __vector_apply(__builtin_isnan, a); }
GLSL_PREFIX bvec3 [[spirv::opcode(156)]] isnan(dvec3 a) noexcept { return __vector_apply(__builtin_isnan, a); }
GLSL_PREFIX bvec4 [[spirv::opcode(156)]] isnan(dvec4 a) noexcept { return __vector_apply(__builtin_isnan, a); }
GLSL_PREFIX bool [[spirv::opcode(157)]] isinf(float a) noexcept { return __builtin_isinff( a); }
GLSL_PREFIX bvec2 [[spirv::opcode(157)]] isinf(vec2 a) noexcept { return __vector_apply(__builtin_isinff, a); }
GLSL_PREFIX bvec3 [[spirv::opcode(157)]] isinf(vec3 a) noexcept { return __vector_apply(__builtin_isinff, a); }
GLSL_PREFIX bvec4 [[spirv::opcode(157)]] isinf(vec4 a) noexcept { return __vector_apply(__builtin_isinff, a); }
extern "C" bool [[spirv::opcode(157)]] isinf(double a) noexcept;
GLSL_PREFIX bvec2 [[spirv::opcode(157)]] isinf(dvec2 a) noexcept { return __vector_apply(__builtin_isinf, a); }
GLSL_PREFIX bvec3 [[spirv::opcode(157)]] isinf(dvec3 a) noexcept { return __vector_apply(__builtin_isinf, a); }
GLSL_PREFIX bvec4 [[spirv::opcode(157)]] isinf(dvec4 a) noexcept { return __vector_apply(__builtin_isinf, a); }
// https://www.khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.4.60.html#floating-point-pack-and-unpack-functions
GLSL_PREFIX uint [[spirv::GLSLstd450(54)]] packSnorm4x8(vec4 v) noexcept;
GLSL_PREFIX uint [[spirv::GLSLstd450(55)]] packUnorm4x8(vec4 v) noexcept;
GLSL_PREFIX uint [[spirv::GLSLstd450(56)]] packSnorm2x16(vec2 v) noexcept;
GLSL_PREFIX uint [[spirv::GLSLstd450(57)]] packUnorm2x16(vec2 v) noexcept;
GLSL_PREFIX uint [[spirv::GLSLstd450(58)]] packHalf2x16(vec2 v) noexcept;
GLSL_PREFIX vec2 [[spirv::GLSLstd450(59)]] packDouble2x32(uvec2 v) noexcept;
GLSL_PREFIX vec2 [[spirv::GLSLstd450(60)]] unpackSnorm2x16(uint p) noexcept;
GLSL_PREFIX vec2 [[spirv::GLSLstd450(61)]] unpackUnorm2x16(uint p) noexcept;
GLSL_PREFIX vec2 [[spirv::GLSLstd450(62)]] unpackHalf2x16(uint p) noexcept;
GLSL_PREFIX vec4 [[spirv::GLSLstd450(63)]] unpackSnorm4x8(uint p) noexcept;
GLSL_PREFIX vec4 [[spirv::GLSLstd450(64)]] unpackUnorm4x8(uint p) noexcept;
GLSL_PREFIX uvec2 [[spirv::GLSLstd450(65)]] unpackDouble2x32(double v) noexcept;
// https://www.khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.4.60.html#geometric-functions
GLSL_PREFIX float [[spirv::GLSLstd450(66)]] length(vec2 a) noexcept { return sqrt(__vector_dot(a, a)); }
GLSL_PREFIX float [[spirv::GLSLstd450(66)]] length(vec3 a) noexcept { return sqrt(__vector_dot(a, a)); }
GLSL_PREFIX float [[spirv::GLSLstd450(66)]] length(vec4 a) noexcept { return sqrt(__vector_dot(a, a)); }
GLSL_PREFIX double [[spirv::GLSLstd450(66)]] length(dvec2 a) noexcept { return sqrt(__vector_dot(a, a)); }
GLSL_PREFIX double [[spirv::GLSLstd450(66)]] length(dvec3 a) noexcept { return sqrt(__vector_dot(a, a)); }
GLSL_PREFIX double [[spirv::GLSLstd450(66)]] length(dvec4 a) noexcept { return sqrt(__vector_dot(a, a)); }
GLSL_PREFIX float [[spirv::GLSLstd450(67)]] distance(vec2 a, vec2 b) noexcept { a -= b; return sqrt(__vector_dot(a, a)); }
GLSL_PREFIX float [[spirv::GLSLstd450(67)]] distance(vec3 a, vec3 b) noexcept { a -= b; return sqrt(__vector_dot(a, a)); }
GLSL_PREFIX float [[spirv::GLSLstd450(67)]] distance(vec4 a, vec4 b) noexcept { a -= b; return sqrt(__vector_dot(a, a)); }
GLSL_PREFIX double [[spirv::GLSLstd450(67)]] distance(dvec2 a, dvec2 b) noexcept { a -= b; return sqrt(__vector_dot(a, a)); }
GLSL_PREFIX double [[spirv::GLSLstd450(67)]] distance(dvec3 a, dvec3 b) noexcept { a -= b; return sqrt(__vector_dot(a, a)); }
GLSL_PREFIX double [[spirv::GLSLstd450(67)]] distance(dvec4 a, dvec4 b) noexcept { a -= b; return sqrt(__vector_dot(a, a)); }
GLSL_PREFIX float [[spirv::opcode(148)]] dot(vec2 a, vec2 b) noexcept { return __vector_dot(a, b); }
GLSL_PREFIX float [[spirv::opcode(148)]] dot(vec3 a, vec3 b) noexcept { return __vector_dot(a, b); }
GLSL_PREFIX float [[spirv::opcode(148)]] dot(vec4 a, vec4 b) noexcept { return __vector_dot(a, b); }
GLSL_PREFIX double [[spirv::opcode(148)]] dot(dvec2 a, dvec2 b) noexcept { return __vector_dot(a, b); }
GLSL_PREFIX double [[spirv::opcode(148)]] dot(dvec3 a, dvec3 b) noexcept { return __vector_dot(a, b); }
GLSL_PREFIX double [[spirv::opcode(148)]] dot(dvec4 a, dvec4 b) noexcept { return __vector_dot(a, b); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(68)]] cross(vec3 a, vec3 b) noexcept { return a.yzx * b.zxy - b.yzx * a.zxy; }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(68)]] cross(dvec3 a, dvec3 b) noexcept { return a.yzx * b.zxy - b.yzx * a.zxy; }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(69)]] normalize(vec2 a) noexcept { return inversesqrt(__vector_dot(a, a)) * a; }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(69)]] normalize(vec3 a) noexcept { return inversesqrt(__vector_dot(a, a)) * a; }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(69)]] normalize(vec4 a) noexcept { return inversesqrt(__vector_dot(a, a)) * a; }
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(69)]] normalize(dvec2 a) noexcept { return inversesqrt(__vector_dot(a, a)) * a; }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(69)]] normalize(dvec3 a) noexcept { return inversesqrt(__vector_dot(a, a)) * a; }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(69)]] normalize(dvec4 a) noexcept { return inversesqrt(__vector_dot(a, a)) * a; }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(70)]] faceforward(vec3 N, vec3 I, vec3 Nref) noexcept { return dot(Nref, I) < 0 ? N : -N; }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(70)]] faceforward(dvec3 N, dvec3 I, dvec3 Nref) noexcept { return dot(Nref, I) < 0 ? N : -N; }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(71)]] reflect(vec3 I, vec3 N) noexcept { return I - 2 * dot(N, I) * N; }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(71)]] reflect(dvec3 I, dvec3 N) noexcept { return I - 2 * dot(N, I) * N; }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(72)]] refract(vec3 I, vec3 N, float eta) noexcept {
float dotNI = dot(N, I);
float k = 1 - eta * eta * (1 - dotNI);
return k < 0 ? 0 : eta * I - (eta * dotNI + sqrt(k)) * N;
}
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(72)]] refract(dvec3 I, dvec3 N, double eta) noexcept {
double dotNI = dot(N, I);
double k = 1 - eta * eta * (1 - dotNI);
return k < 0 ? 0 : eta * I - (eta * dotNI + sqrt(k)) * N;
}
// https://www.khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.4.60.html#matrix-functions
GLSL_PREFIX mat2 [[spirv::opcode(84)]] transpose(mat2 m) noexcept { return __matrix_transpose(m); }
GLSL_PREFIX mat3 [[spirv::opcode(84)]] transpose(mat3 m) noexcept { return __matrix_transpose(m); }
GLSL_PREFIX mat4 [[spirv::opcode(84)]] transpose(mat4 m) noexcept { return __matrix_transpose(m); }
GLSL_PREFIX mat2x3 [[spirv::opcode(84)]] transpose(mat3x2 m) noexcept { return __matrix_transpose(m); }
GLSL_PREFIX mat3x2 [[spirv::opcode(84)]] transpose(mat2x3 m) noexcept { return __matrix_transpose(m); }
GLSL_PREFIX mat2x4 [[spirv::opcode(84)]] transpose(mat4x2 m) noexcept { return __matrix_transpose(m); }
GLSL_PREFIX mat4x2 [[spirv::opcode(84)]] transpose(mat2x4 m) noexcept { return __matrix_transpose(m); }
GLSL_PREFIX mat3x4 [[spirv::opcode(84)]] transpose(mat4x3 m) noexcept { return __matrix_transpose(m); }
GLSL_PREFIX mat4x3 [[spirv::opcode(84)]] transpose(mat3x4 m) noexcept { return __matrix_transpose(m); }
// For now these are only forward declarations. They'll compile for shaders,
// but fail to link for host code.
GLSL_PREFIX float [[spirv::GLSLstd450(33)]] determinant(mat2 m) noexcept;
GLSL_PREFIX float [[spirv::GLSLstd450(33)]] determinant(mat3 m) noexcept;
GLSL_PREFIX float [[spirv::GLSLstd450(33)]] determinant(mat4 m) noexcept;
GLSL_PREFIX double [[spirv::GLSLstd450(33)]] determinant(dmat2 m) noexcept;
GLSL_PREFIX double [[spirv::GLSLstd450(33)]] determinant(dmat3 m) noexcept;
GLSL_PREFIX double [[spirv::GLSLstd450(33)]] determinant(dmat4 m) noexcept;
GLSL_PREFIX mat2 [[spirv::GLSLstd450(34)]] inverse(mat2 m) noexcept;
GLSL_PREFIX mat3 [[spirv::GLSLstd450(34)]] inverse(mat3 m) noexcept;
GLSL_PREFIX mat4 [[spirv::GLSLstd450(34)]] inverse(mat4 m) noexcept;
GLSL_PREFIX dmat2 [[spirv::GLSLstd450(34)]] inverse(dmat2 m) noexcept;
GLSL_PREFIX dmat3 [[spirv::GLSLstd450(34)]] inverse(dmat3 m) noexcept;
GLSL_PREFIX dmat4 [[spirv::GLSLstd450(34)]] inverse(dmat4 m) noexcept;
GLSL_PREFIX bool [[spirv::opcode(154)]] any(bvec2 x) noexcept { return __vector_any(x); }
GLSL_PREFIX bool [[spirv::opcode(154)]] any(bvec3 x) noexcept { return __vector_any(x); }
GLSL_PREFIX bool [[spirv::opcode(154)]] any(bvec4 x) noexcept { return __vector_any(x); }
GLSL_PREFIX bool [[spirv::opcode(155)]] all(bvec2 x) noexcept { return __vector_all(x); }
GLSL_PREFIX bool [[spirv::opcode(155)]] all(bvec3 x) noexcept { return __vector_all(x); }
GLSL_PREFIX bool [[spirv::opcode(155)]] all(bvec4 x) noexcept { return __vector_all(x); }
// 8.8 Integer Functions
// TODO: Provide CPU implementation. Does this require a branch? shift left 32 is technically undefined.
GLSL_PREFIX int [[spirv::opcode(202)]] bitfieldExtract(int x, int offset, int bits) noexcept;
GLSL_PREFIX ivec2 [[spirv::opcode(202)]] bitfieldExtract(ivec2 x, int offset, int bits) noexcept { return __vector_apply(bitfieldExtract, x, offset, bits); }
GLSL_PREFIX ivec3 [[spirv::opcode(202)]] bitfieldExtract(ivec3 x, int offset, int bits) noexcept { return __vector_apply(bitfieldExtract, x, offset, bits); }
GLSL_PREFIX ivec4 [[spirv::opcode(202)]] bitfieldExtract(ivec4 x, int offset, int bits) noexcept { return __vector_apply(bitfieldExtract, x, offset, bits); }
GLSL_PREFIX uint [[spirv::opcode(203)]] bitfieldExtract(uint x, int offset, int bits) noexcept;
GLSL_PREFIX uvec2 [[spirv::opcode(203)]] bitfieldExtract(uvec2 x, int offset, int bits) noexcept { return __vector_apply(bitfieldExtract, x, offset, bits); }
GLSL_PREFIX uvec3 [[spirv::opcode(203)]] bitfieldExtract(uvec3 x, int offset, int bits) noexcept { return __vector_apply(bitfieldExtract, x, offset, bits); }
GLSL_PREFIX uvec4 [[spirv::opcode(203)]] bitfieldExtract(uvec4 x, int offset, int bits) noexcept { return __vector_apply(bitfieldExtract, x, offset, bits); }
// Workaround for https://developer.nvidia.com/nvidia_bug/3266093
GLSL_PREFIX int64_t bitfieldExtract(int64_t x, int offset, int bits) noexcept {
return ((1ll<< bits) - 1) & (x>> offset);
}
GLSL_PREFIX i64vec2 bitfieldExtract(i64vec2 x, int offset, int bits) noexcept { return __vector_apply(bitfieldExtract, x, offset, bits); }
GLSL_PREFIX i64vec3 bitfieldExtract(i64vec3 x, int offset, int bits) noexcept { return __vector_apply(bitfieldExtract, x, offset, bits); }
GLSL_PREFIX i64vec4 bitfieldExtract(i64vec4 x, int offset, int bits) noexcept { return __vector_apply(bitfieldExtract, x, offset, bits); }
GLSL_PREFIX uint64_t bitfieldExtract(uint64_t x, int offset, int bits) noexcept {
return ((1ull<< bits) - 1) & (x>> offset);
}
GLSL_PREFIX u64vec2 bitfieldExtract(u64vec2 x, int offset, int bits) noexcept { return __vector_apply(bitfieldExtract, x, offset, bits); }
GLSL_PREFIX u64vec3 bitfieldExtract(u64vec3 x, int offset, int bits) noexcept { return __vector_apply(bitfieldExtract, x, offset, bits); }
GLSL_PREFIX u64vec4 bitfieldExtract(u64vec4 x, int offset, int bits) noexcept { return __vector_apply(bitfieldExtract, x, offset, bits); }
GLSL_PREFIX int [[spirv::opcode(201)]] bitfieldInsert(int x, int y, int offset, int bits) noexcept;
GLSL_PREFIX ivec2 [[spirv::opcode(201)]] bitfieldInsert(ivec2 x, ivec2 y, int offset, int bits) noexcept { return __vector_apply(bitfieldInsert, x, y, offset, bits); }
GLSL_PREFIX ivec3 [[spirv::opcode(201)]] bitfieldInsert(ivec3 x, ivec3 y, int offset, int bits) noexcept { return __vector_apply(bitfieldInsert, x, y, offset, bits); }
GLSL_PREFIX ivec4 [[spirv::opcode(201)]] bitfieldInsert(ivec4 x, ivec4 y, int offset, int bits) noexcept { return __vector_apply(bitfieldInsert, x, y, offset, bits); }
GLSL_PREFIX uint [[spirv::opcode(201)]] bitfieldInsert(uint x, uint y, int offset, int bits) noexcept;
GLSL_PREFIX uvec2 [[spirv::opcode(201)]] bitfieldInsert(uvec2 x, uvec2 y, int offset, int bits) noexcept { return __vector_apply(bitfieldInsert, x, y, offset, bits); }
GLSL_PREFIX uvec3 [[spirv::opcode(201)]] bitfieldInsert(uvec3 x, uvec3 y, int offset, int bits) noexcept { return __vector_apply(bitfieldInsert, x, y, offset, bits); }
GLSL_PREFIX uvec4 [[spirv::opcode(201)]] bitfieldInsert(uvec4 x, uvec4 y, int offset, int bits) noexcept { return __vector_apply(bitfieldInsert, x, y, offset, bits); }
GLSL_PREFIX int [[spirv::opcode(204)]] bitfieldReverse(int x) noexcept;
GLSL_PREFIX ivec2 [[spirv::opcode(204)]] bitfieldReverse(ivec2 x) noexcept { return __vector_apply(bitfieldReverse, x); }
GLSL_PREFIX ivec3 [[spirv::opcode(204)]] bitfieldReverse(ivec3 x) noexcept { return __vector_apply(bitfieldReverse, x); }
GLSL_PREFIX ivec4 [[spirv::opcode(204)]] bitfieldReverse(ivec4 x) noexcept { return __vector_apply(bitfieldReverse, x); }
GLSL_PREFIX uint [[spirv::opcode(204)]] bitfieldReverse(uint x) noexcept;
GLSL_PREFIX uvec2 [[spirv::opcode(204)]] bitfieldReverse(uvec2 x) noexcept { return __vector_apply(bitfieldReverse, x); }
GLSL_PREFIX uvec3 [[spirv::opcode(204)]] bitfieldReverse(uvec3 x) noexcept { return __vector_apply(bitfieldReverse, x); }
GLSL_PREFIX uvec4 [[spirv::opcode(204)]] bitfieldReverse(uvec4 x) noexcept { return __vector_apply(bitfieldReverse, x); }
GLSL_PREFIX int [[spirv::opcode(205)]] bitCount(int x) noexcept { return __builtin_popcount( (uint) x); }
GLSL_PREFIX ivec2 [[spirv::opcode(205)]] bitCount(ivec2 x) noexcept { return __vector_apply(__builtin_popcount, (uvec2)x); }
GLSL_PREFIX ivec3 [[spirv::opcode(205)]] bitCount(ivec3 x) noexcept { return __vector_apply(__builtin_popcount, (uvec3)x); }
GLSL_PREFIX ivec4 [[spirv::opcode(205)]] bitCount(ivec4 x) noexcept { return __vector_apply(__builtin_popcount, (uvec4)x); }
GLSL_PREFIX int [[spirv::opcode(205)]] bitCount(uint x) noexcept { return __builtin_popcount( x); }
GLSL_PREFIX ivec2 [[spirv::opcode(205)]] bitCount(uvec2 x) noexcept { return __vector_apply(__builtin_popcount, x); }
GLSL_PREFIX ivec3 [[spirv::opcode(205)]] bitCount(uvec3 x) noexcept { return __vector_apply(__builtin_popcount, x); }
GLSL_PREFIX ivec4 [[spirv::opcode(205)]] bitCount(uvec4 x) noexcept { return __vector_apply(__builtin_popcount, x); }
// Results in the bit number of the least-significant 1-bit in the binary
// representation of Value. If Value is 0, the result is -1.
GLSL_PREFIX int [[spirv::GLSLstd450(73)]] findLSB(int x) noexcept { return x ? __builtin_ctz( (uint)x) : -1; }
GLSL_PREFIX ivec2 [[spirv::GLSLstd450(73)]] findLSB(ivec2 x) noexcept { return x ? __vector_apply(__builtin_ctz, (uvec2)x) : -1; }
GLSL_PREFIX ivec3 [[spirv::GLSLstd450(73)]] findLSB(ivec3 x) noexcept { return x ? __vector_apply(__builtin_ctz, (uvec3)x) : -1; }
GLSL_PREFIX ivec4 [[spirv::GLSLstd450(73)]] findLSB(ivec4 x) noexcept { return x ? __vector_apply(__builtin_ctz, (uvec4)x) : -1; }
GLSL_PREFIX int [[spirv::GLSLstd450(73)]] findLSB(uint x) noexcept { return x ? __builtin_ctz( x) : -1; }
GLSL_PREFIX ivec2 [[spirv::GLSLstd450(73)]] findLSB(uvec2 x) noexcept { return x ? __vector_apply(__builtin_ctz, x) : -1; }
GLSL_PREFIX ivec3 [[spirv::GLSLstd450(73)]] findLSB(uvec3 x) noexcept { return x ? __vector_apply(__builtin_ctz, x) : -1; }
GLSL_PREFIX ivec4 [[spirv::GLSLstd450(73)]] findLSB(uvec4 x) noexcept { return x ? __vector_apply(__builtin_ctz, x) : -1; }
// For positive numbers, the result will be the bit number of the most
// significant 1-bit. For negative numbers, the result will be the bit number
// of the most significant 0-bit. For a Value of 0 or -1, the result is -1.
GLSL_PREFIX int [[spirv::GLSLstd450(74)]] findMSB(int x) noexcept { x ^= x>> 31; return x ? __builtin_clz( (uint)x) : -1; }
GLSL_PREFIX ivec2 [[spirv::GLSLstd450(74)]] findMSB(ivec2 x) noexcept { x ^= x>> 31; return x ? __vector_apply(__builtin_clz, (uvec2)x) : -1; }
GLSL_PREFIX ivec3 [[spirv::GLSLstd450(74)]] findMSB(ivec3 x) noexcept { x ^= x>> 31; return x ? __vector_apply(__builtin_clz, (uvec3)x) : -1; }
GLSL_PREFIX ivec4 [[spirv::GLSLstd450(74)]] findMSB(ivec4 x) noexcept { x ^= x>> 31; return x ? __vector_apply(__builtin_clz, (uvec4)x) : -1; }
GLSL_PREFIX int [[spirv::GLSLstd450(75)]] findMSB(uint x) noexcept { return x ? __builtin_clz( x) : -1; }
GLSL_PREFIX ivec2 [[spirv::GLSLstd450(75)]] findMSB(uvec2 x) noexcept { return x ? __vector_apply(__builtin_clz, x) : -1; }
GLSL_PREFIX ivec3 [[spirv::GLSLstd450(75)]] findMSB(uvec3 x) noexcept { return x ? __vector_apply(__builtin_clz, x) : -1; }
GLSL_PREFIX ivec4 [[spirv::GLSLstd450(75)]] findMSB(uvec4 x) noexcept { return x ? __vector_apply(__builtin_clz, x) : -1; }
// reinterpret_cast bitcasts are coded into the CFG.
GLSL_PREFIX [[spirv::builtin]] int floatBitsToInt(float x) noexcept { return *reinterpret_cast<const int*>(&x); }
GLSL_PREFIX [[spirv::builtin]] ivec2 floatBitsToInt(vec2 x) noexcept { return __vector_apply(floatBitsToInt(0.f), x); }
GLSL_PREFIX [[spirv::builtin]] ivec3 floatBitsToInt(vec3 x) noexcept { return __vector_apply(floatBitsToInt(0.f), x); }
GLSL_PREFIX [[spirv::builtin]] ivec4 floatBitsToInt(vec4 x) noexcept { return __vector_apply(floatBitsToInt(0.f), x); }
GLSL_PREFIX [[spirv::builtin]] uint floatBitsToUint(float x) noexcept { return *reinterpret_cast<const uint*>(&x); }
GLSL_PREFIX [[spirv::builtin]] uvec2 floatBitsToUint(vec2 x) noexcept { return __vector_apply(floatBitsToUint(0.f), x); }
GLSL_PREFIX [[spirv::builtin]] uvec3 floatBitsToUint(vec3 x) noexcept { return __vector_apply(floatBitsToUint(0.f), x); }
GLSL_PREFIX [[spirv::builtin]] uvec4 floatBitsToUint(vec4 x) noexcept { return __vector_apply(floatBitsToUint(0.f), x); }
GLSL_PREFIX [[spirv::builtin]] float intBitsToFloat(int x) noexcept { return *reinterpret_cast<const float*>(&x); }
GLSL_PREFIX [[spirv::builtin]] vec2 intBitsToFloat(ivec2 x) noexcept { return __vector_apply(intBitsToFloat(0), x); }
GLSL_PREFIX [[spirv::builtin]] vec3 intBitsToFloat(ivec3 x) noexcept { return __vector_apply(intBitsToFloat(0), x); }
GLSL_PREFIX [[spirv::builtin]] vec4 intBitsToFloat(ivec4 x) noexcept { return __vector_apply(intBitsToFloat(0), x); }
GLSL_PREFIX [[spirv::builtin]] float uintBitsToFloat(uint x) noexcept { return *reinterpret_cast<const float*>(&x); }
GLSL_PREFIX [[spirv::builtin]] vec2 uintBitsToFloat(uvec2 x) noexcept { return __vector_apply(uintBitsToFloat(0u), x); }
GLSL_PREFIX [[spirv::builtin]] vec3 uintBitsToFloat(uvec3 x) noexcept { return __vector_apply(uintBitsToFloat(0u), x); }
GLSL_PREFIX [[spirv::builtin]] vec4 uintBitsToFloat(uvec4 x) noexcept { return __vector_apply(uintBitsToFloat(0u), x); }
GLSL_PREFIX float [[spirv::GLSLstd450(51)]] frexp(float x, int* y) noexcept { return __builtin_frexpf( x, y); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(51)]] frexp(vec2 x, ivec2* y) noexcept { return __vector_apply(__builtin_frexpf, x, y); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(51)]] frexp(vec3 x, ivec3* y) noexcept { return __vector_apply(__builtin_frexpf, x, y); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(51)]] frexp(vec4 x, ivec4* y) noexcept { return __vector_apply(__builtin_frexpf, x, y); }
extern "C" double [[spirv::GLSLstd450(51)]] frexp(double x, int* y) noexcept;
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(51)]] frexp(dvec2 x, ivec2* y) noexcept { return __vector_apply(__builtin_frexp, x, y); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(51)]] frexp(dvec3 x, ivec3* y) noexcept { return __vector_apply(__builtin_frexp, x, y); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(51)]] frexp(dvec4 x, ivec4* y) noexcept { return __vector_apply(__builtin_frexp, x, y); }
GLSL_PREFIX float [[spirv::GLSLstd450(53)]] ldexp(float x, int y) noexcept { return __builtin_ldexpf( x, y); }
GLSL_PREFIX vec2 [[spirv::GLSLstd450(53)]] ldexp(vec2 x, ivec2 y) noexcept { return __vector_apply(__builtin_ldexpf, x, y); }
GLSL_PREFIX vec3 [[spirv::GLSLstd450(53)]] ldexp(vec3 x, ivec3 y) noexcept { return __vector_apply(__builtin_ldexpf, x, y); }
GLSL_PREFIX vec4 [[spirv::GLSLstd450(53)]] ldexp(vec4 x, ivec4 y) noexcept { return __vector_apply(__builtin_ldexpf, x, y); }
extern "C" double [[spirv::GLSLstd450(53)]] ldexp(double x, int y) noexcept;
GLSL_PREFIX dvec2 [[spirv::GLSLstd450(53)]] ldexp(dvec2 x, ivec2 y) noexcept { return __vector_apply(__builtin_ldexp, x, y); }
GLSL_PREFIX dvec3 [[spirv::GLSLstd450(53)]] ldexp(dvec3 x, ivec3 y) noexcept { return __vector_apply(__builtin_ldexp, x, y); }
GLSL_PREFIX dvec4 [[spirv::GLSLstd450(53)]] ldexp(dvec4 x, ivec4 y) noexcept { return __vector_apply(__builtin_ldexp, x, y); }
////////////////////////////////////////////////////////////////////////////////
enum class gl_layout_t : unsigned {
std140,
std430,
scalar,
};
// https://www.khronos.org/registry/OpenGL/specs/gl/GLSLangSpec.4.60.html#built-in-variables
struct [[spirv::block]] gl_PerVertex {
[[spirv::builtin(0)]] vec4 Position;
[[spirv::builtin(1)]] float PointSize;
[[spirv::builtin(3)]] float ClipDistance[4];
[[spirv::builtin(4)]] float CullDistance[4];
};
// Vertex variables.
[[spirv::builtin(5) ]] int glvert_VertexID; // GL only
[[spirv::builtin(42) ]] int glvert_VertexIndex; // Vulkan only
[[spirv::builtin(6) ]] int glvert_InstanceID; // GL only
[[spirv::builtin(43) ]] int glvert_InstanceIndex; // Vulkan only
[[spirv::builtin(4426)]] int glvert_DrawID;
[[spirv::builtin(4424)]] int glvert_BaseVertex;
[[spirv::builtin(4425)]] int glvert_BaseInstance;
[[spirv::out]] gl_PerVertex glvert_Output;
// Tessellation control variables.
[[spirv::builtin(14)]] int gltesc_PatchVerticesIn;
[[spirv::builtin(7) ]] int gltesc_PrimitiveID;
[[spirv::builtin(8) ]] int gltesc_InvocationID;
[[spirv::builtin(11), spirv::out, spirv::patch]] float gltesc_LevelOuter[4]; // output
[[spirv::builtin(12), spirv::out, spirv::patch]] float gltesc_LevelInner[2]; // output
[[spirv::out]] gl_PerVertex gltesc_Output; // Implicitly gltech_Output[gltesc_InvocationID].
[[spirv::in ]] gl_PerVertex gltesc_Input[32];
// OpControlBarrier
[[spirv::builtin]] void gltesc_barrier();
// Tessellation evaluation variables.
[[spirv::in ]] gl_PerVertex gltese_Input[32];
[[spirv::builtin(14)]] int gltese_PatchVerticesIn;
[[spirv::builtin(7) ]] int gltese_PrimitiveID;
[[spirv::builtin(13)]] vec3 gltese_TessCoord;
[[spirv::builtin(11), spirv::patch]] float gltese_LevelOuter[4];
[[spirv::builtin(12), spirv::patch]] float gltese_LevelInner[2];
[[spirv::out]] gl_PerVertex gltese_Output; // output
enum class gltess_primitive_t : unsigned {
triangles,
quads,
isolines,
};
enum class gltess_output_t : unsigned {
points,
lines,
triangle_cw,
triangle_ccw,
};
enum class gltess_spacing_t : unsigned {
equal,
fractional_even,
fractional_odd,
};
// Geometry variables.
[[spirv::in]] gl_PerVertex glgeom_Input[6];
[[spirv::out]] gl_PerVertex glgeom_Output;
[[spirv::builtin(7) ]] int glgeom_PrimitiveIDIn;
[[spirv::builtin(8) ]] int glgeom_InvocationID;
[[spirv::builtin(7), spirv::out]] int glgeom_PrimitiveID; // output
[[spirv::builtin(9), spirv::out]] int glgeom_Layer; // output
[[spirv::builtin(10), spirv::out]] int glgeom_ViewportIndex; // output
[[spirv::builtin]] void glgeom_EmitVertex() noexcept;
[[spirv::builtin]] void glgeom_EndPrimitive() noexcept;
[[spirv::builtin]] void glgeom_EmitStreamVertex(int stream) noexcept;
[[spirv::builtin]] void glgeom_EndStreamPrimitive(int stream) noexcept;
enum class glgeom_input_t : unsigned {
points,
lines,
lines_adjacency,
triangles,
triangles_adjacency,
};
enum class glgeom_output_t : unsigned {
points,
line_strip,
triangle_strip,
};
// Fragment variables.
[[spirv::builtin(15)]] vec4 glfrag_FragCoord;
[[spirv::builtin(17)]] bool glfrag_FrontFacing;
[[spirv::builtin(3) ]] float glfrag_ClipDistance[4];
[[spirv::builtin(4) ]] float glfrag_CullDistance[4];
[[spirv::builtin(16)]] vec2 glfrag_PointCoord;
[[spirv::builtin(7) ]] int glfrag_PrimitiveID;
[[spirv::builtin(18)]] int glfrag_SampleID;
[[spirv::builtin(19)]] vec2 glfrag_SamplePosition;
[[spirv::builtin(20)]] int glfrag_SampleMaskIn[1];
[[spirv::builtin(9) ]] int glfrag_Layer;
[[spirv::builtin(10)]] int glfrag_ViewportIndex;
[[spirv::builtin(23)]] bool glfrag_HelperInvocation;
[[spirv::builtin(22), spirv::out]] float glfrag_FragDepth;
[[spirv::builtin(2), spirv::out]] int glfrag_SampleMask[1];
[[spirv::builtin]] void glfrag_discard() noexcept;
[[spirv::opcode(207)]] float glfrag_dFdx(float x) noexcept;
[[spirv::opcode(207)]] vec2 glfrag_dFdx(vec2 x) noexcept;
[[spirv::opcode(207)]] vec3 glfrag_dFdx(vec3 x) noexcept;
[[spirv::opcode(207)]] vec4 glfrag_dFdx(vec4 x) noexcept;
[[spirv::opcode(208)]] float glfrag_dFdy(float x) noexcept;
[[spirv::opcode(208)]] vec2 glfrag_dFdy(vec2 x) noexcept;
[[spirv::opcode(208)]] vec3 glfrag_dFdy(vec3 x) noexcept;
[[spirv::opcode(208)]] vec4 glfrag_dFdy(vec4 x) noexcept;
[[spirv::opcode(209)]] float glfrag_fwidth(float x) noexcept;
[[spirv::opcode(209)]] vec2 glfrag_fwidth(vec2 x) noexcept;
[[spirv::opcode(209)]] vec3 glfrag_fwidth(vec3 x) noexcept;
[[spirv::opcode(209)]] vec4 glfrag_fwidth(vec4 x) noexcept;
[[spirv::opcode(213)]] float glfrag_dFdxCoarse(float x) noexcept;
[[spirv::opcode(213)]] vec2 glfrag_dFdxCoarse(vec2 x) noexcept;
[[spirv::opcode(213)]] vec3 glfrag_dFdxCoarse(vec3 x) noexcept;
[[spirv::opcode(213)]] vec4 glfrag_dFdxCoarse(vec4 x) noexcept;
[[spirv::opcode(214)]] float glfrag_dFdyCoarse(float x) noexcept;
[[spirv::opcode(214)]] vec2 glfrag_dFdyCoarse(vec2 x) noexcept;
[[spirv::opcode(214)]] vec3 glfrag_dFdyCoarse(vec3 x) noexcept;
[[spirv::opcode(214)]] vec4 glfrag_dFdyCoarse(vec4 x) noexcept;
[[spirv::opcode(215)]] float glfrag_fwidthCoarse(float x) noexcept;
[[spirv::opcode(215)]] vec2 glfrag_fwidthCoarse(vec2 x) noexcept;
[[spirv::opcode(215)]] vec3 glfrag_fwidthCoarse(vec3 x) noexcept;
[[spirv::opcode(215)]] vec4 glfrag_fwidthCoarse(vec4 x) noexcept;
[[spirv::opcode(210)]] float glfrag_dFdxFine(float x) noexcept;
[[spirv::opcode(210)]] vec2 glfrag_dFdxFine(vec2 x) noexcept;
[[spirv::opcode(210)]] vec3 glfrag_dFdxFine(vec3 x) noexcept;
[[spirv::opcode(210)]] vec4 glfrag_dFdxFine(vec4 x) noexcept;
[[spirv::opcode(211)]] float glfrag_dFdyFine(float x) noexcept;
[[spirv::opcode(211)]] vec2 glfrag_dFdyFine(vec2 x) noexcept;
[[spirv::opcode(211)]] vec3 glfrag_dFdyFine(vec3 x) noexcept;
[[spirv::opcode(211)]] vec4 glfrag_dFdyFine(vec4 x) noexcept;
[[spirv::opcode(212)]] float glfrag_fwidthFine(float x) noexcept;
[[spirv::opcode(212)]] vec2 glfrag_fwidthFine(vec2 x) noexcept;
[[spirv::opcode(212)]] vec3 glfrag_fwidthFine(vec3 x) noexcept;
[[spirv::opcode(212)]] vec4 glfrag_fwidthFine(vec4 x) noexcept;
enum class glfrag_origin_t : unsigned {
lower_left, // OpenGL style
upper_left, // Vulkan style
};
// Compute shader variables.
[[spirv::builtin(24)]] uvec3 glcomp_NumWorkGroups;
[[spirv::builtin(25)]] uvec3 glcomp_WorkGroupSize;
[[spirv::builtin(26)]] uvec3 glcomp_WorkGroupID;
[[spirv::builtin(27)]] uvec3 glcomp_LocalInvocationID;
[[spirv::builtin(28)]] uvec3 glcomp_GlobalInvocationID;
[[spirv::builtin(29)]] unsigned glcomp_LocalInvocationIndex;
[[spirv::builtin(24)]] uvec3 gridDim; // glcomp_NumWorkGroups
[[spirv::builtin(25)]] uvec3 blockDim; // glcomp_WorkGroupSize
[[spirv::builtin(26)]] uvec3 blockIdx; // glcomp_WorkGroupID
[[spirv::builtin(27)]] uvec3 threadIdx; // glcomp_LocalInvocationID
#define __shared__ __attribute__((shared))
// NOTE: __synchreads is aliased to glcomp_barrier.
[[spirv::builtin]] void glcomp_barrier();
////////////////////////////////////////////////////////////////////////////////
// GLSL_NV_mesh_shader
[[spirv::out]]
gl_PerVertex glmesh_Output[126];
// Task shader variables.
[[spirv::builtin(5274), spirv::out]] uint glmesh_TaskCount;
// Mesh shader variables.
enum class glmesh_output_t : unsigned {
points,
lines,
triangles,
};
[[spirv::builtin(5280)]] uint glmesh_ViewCount;
[[spirv::builtin(5281)]] uint glmesh_ViewIndices[];
[[spirv::builtin(5275), spirv::out]] uint glmesh_PrimitiveCount;
[[spirv::builtin(5275), spirv::out]] uint glmesh_PrimitiveIndices[];
[[spirv::opcode(5299)]] uint glmesh_writePackedPrimitiveIndices4x8(
uint indexOffset, uint packedIndices);
// Floating-point opaque types.
enum class [[spirv::builtin]] sampler1D : long long;
enum class [[spirv::builtin]] sampler1DShadow : long long;
enum class [[spirv::builtin]] sampler1DArray : long long;
enum class [[spirv::builtin]] sampler1DArrayShadow : long long;
enum class [[spirv::builtin]] sampler2D : long long;
enum class [[spirv::builtin]] sampler2DShadow : long long;
enum class [[spirv::builtin]] sampler2DArray : long long;
enum class [[spirv::builtin]] sampler2DArrayShadow : long long;
enum class [[spirv::builtin]] sampler2DMS : long long;
enum class [[spirv::builtin]] sampler2DMSArray : long long;
enum class [[spirv::builtin]] sampler2DRect : long long;
enum class [[spirv::builtin]] sampler2DRectShadow : long long;
enum class [[spirv::builtin]] sampler3D : long long;
enum class [[spirv::builtin]] samplerCube : long long;
enum class [[spirv::builtin]] samplerCubeShadow : long long;
enum class [[spirv::builtin]] samplerCubeArray : long long;
enum class [[spirv::builtin]] samplerCubeArrayShadow : long long;
enum class [[spirv::builtin]] samplerBuffer : long long;
// Signed integer opaque types.
enum class [[spirv::builtin]] isampler1D : long long;
enum class [[spirv::builtin]] isampler1DArray : long long;
enum class [[spirv::builtin]] isampler2D : long long;
enum class [[spirv::builtin]] isampler2DArray : long long;
enum class [[spirv::builtin]] isampler2DMS : long long;
enum class [[spirv::builtin]] isampler2DMSArray : long long;
enum class [[spirv::builtin]] isampler2DRect : long long;
enum class [[spirv::builtin]] isampler3D : long long;
enum class [[spirv::builtin]] isamplerCube : long long;
enum class [[spirv::builtin]] isamplerCubeArray : long long;
enum class [[spirv::builtin]] isamplerBuffer : long long;
// Unsigned integer opaque types.
enum class [[spirv::builtin]] usampler1D : long long;
enum class [[spirv::builtin]] usampler1DArray : long long;
enum class [[spirv::builtin]] usampler2D : long long;
enum class [[spirv::builtin]] usampler2DArray : long long;
enum class [[spirv::builtin]] usampler2DMS : long long;
enum class [[spirv::builtin]] usampler2DMSArray : long long;
enum class [[spirv::builtin]] usampler2DRect : long long;
enum class [[spirv::builtin]] usampler3D : long long;
enum class [[spirv::builtin]] usamplerCube : long long;
enum class [[spirv::builtin]] usamplerCubeArray : long long;
enum class [[spirv::builtin]] usamplerBuffer : long long;
////////////////////////////////////////////////////////////////////////////////
enum class [[spirv::builtin]] sampler : long long;
enum class [[spirv::builtin]] samplerShadow : long long;
enum class [[spirv::builtin]] texture1D : long long;
enum class [[spirv::builtin]] texture1DArray : long long;
enum class [[spirv::builtin]] texture2D : long long;
enum class [[spirv::builtin]] texture2DArray : long long;
enum class [[spirv::builtin]] texture2DMS : long long;
enum class [[spirv::builtin]] texture2DMSArray : long long;
enum class [[spirv::builtin]] texture2DRect : long long;
enum class [[spirv::builtin]] texture3D : long long;
enum class [[spirv::builtin]] textureCube : long long;
enum class [[spirv::builtin]] textureCubeArray : long long;
enum class [[spirv::builtin]] textureBuffer : long long;
enum class [[spirv::builtin]] itexture1D : long long;
enum class [[spirv::builtin]] itexture1DArray : long long;
enum class [[spirv::builtin]] itexture2D : long long;
enum class [[spirv::builtin]] itexture2DArray : long long;
enum class [[spirv::builtin]] itexture2DMS : long long;
enum class [[spirv::builtin]] itexture2DMSArray : long long;
enum class [[spirv::builtin]] itexture2DRect : long long;
enum class [[spirv::builtin]] itexture3D : long long;
enum class [[spirv::builtin]] itextureCube : long long;
enum class [[spirv::builtin]] itextureCubeArray : long long;
enum class [[spirv::builtin]] itextureBuffer : long long;
enum class [[spirv::builtin]] utexture1D : long long;
enum class [[spirv::builtin]] utexture1DArray : long long;
enum class [[spirv::builtin]] utexture2D : long long;
enum class [[spirv::builtin]] utexture2DArray : long long;
enum class [[spirv::builtin]] utexture2DMS : long long;
enum class [[spirv::builtin]] utexture2DMSArray : long long;
enum class [[spirv::builtin]] utexture2DRect : long long;
enum class [[spirv::builtin]] utexture3D : long long;
enum class [[spirv::builtin]] utextureCube : long long;
enum class [[spirv::builtin]] utextureCubeArray : long long;
enum class [[spirv::builtin]] utextureBuffer : long long;
[[spirv::builtin]] sampler1D combine(texture1D, sampler);
[[spirv::builtin]] sampler1DArray combine(texture1DArray, sampler);
[[spirv::builtin]] sampler2D combine(texture2D, sampler);
[[spirv::builtin]] sampler2DArray combine(texture2DArray, sampler);
[[spirv::builtin]] sampler2DMS combine(texture2DMS, sampler);
[[spirv::builtin]] sampler2DMSArray combine(texture2DMSArray, sampler);
[[spirv::builtin]] sampler2DRect combine(texture2DRect, sampler);
[[spirv::builtin]] sampler3D combine(texture3D, sampler);
[[spirv::builtin]] samplerCube combine(textureCube, sampler);
[[spirv::builtin]] samplerCubeArray combine(textureCubeArray, sampler);
[[spirv::builtin]] samplerBuffer combine(textureBuffer, sampler);