forked from bullno1/cosmo-sokol
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsokol_cosmo.c
2258 lines (2064 loc) · 64 KB
/
sokol_cosmo.c
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
#include <sokol_app.h>
#include <sokol_gfx.h>
#include <cosmo.h>
#pragma GCC diagnostic ignored "-Wreturn-type"
extern bool linux_sapp_isvalid(void);
extern bool windows_sapp_isvalid(void);
bool sapp_isvalid(void) {
if (IsLinux()) {
return linux_sapp_isvalid();
}
if (IsWindows()) {
return windows_sapp_isvalid();
}
}
extern int linux_sapp_width(void);
extern int windows_sapp_width(void);
int sapp_width(void) {
if (IsLinux()) {
return linux_sapp_width();
}
if (IsWindows()) {
return windows_sapp_width();
}
}
extern float linux_sapp_widthf(void);
extern float windows_sapp_widthf(void);
float sapp_widthf(void) {
if (IsLinux()) {
return linux_sapp_widthf();
}
if (IsWindows()) {
return windows_sapp_widthf();
}
}
extern int linux_sapp_height(void);
extern int windows_sapp_height(void);
int sapp_height(void) {
if (IsLinux()) {
return linux_sapp_height();
}
if (IsWindows()) {
return windows_sapp_height();
}
}
extern float linux_sapp_heightf(void);
extern float windows_sapp_heightf(void);
float sapp_heightf(void) {
if (IsLinux()) {
return linux_sapp_heightf();
}
if (IsWindows()) {
return windows_sapp_heightf();
}
}
extern int linux_sapp_color_format(void);
extern int windows_sapp_color_format(void);
int sapp_color_format(void) {
if (IsLinux()) {
return linux_sapp_color_format();
}
if (IsWindows()) {
return windows_sapp_color_format();
}
}
extern int linux_sapp_depth_format(void);
extern int windows_sapp_depth_format(void);
int sapp_depth_format(void) {
if (IsLinux()) {
return linux_sapp_depth_format();
}
if (IsWindows()) {
return windows_sapp_depth_format();
}
}
extern int linux_sapp_sample_count(void);
extern int windows_sapp_sample_count(void);
int sapp_sample_count(void) {
if (IsLinux()) {
return linux_sapp_sample_count();
}
if (IsWindows()) {
return windows_sapp_sample_count();
}
}
extern bool linux_sapp_high_dpi(void);
extern bool windows_sapp_high_dpi(void);
bool sapp_high_dpi(void) {
if (IsLinux()) {
return linux_sapp_high_dpi();
}
if (IsWindows()) {
return windows_sapp_high_dpi();
}
}
extern float linux_sapp_dpi_scale(void);
extern float windows_sapp_dpi_scale(void);
float sapp_dpi_scale(void) {
if (IsLinux()) {
return linux_sapp_dpi_scale();
}
if (IsWindows()) {
return windows_sapp_dpi_scale();
}
}
extern void linux_sapp_show_keyboard(bool show);
extern void windows_sapp_show_keyboard(bool show);
void sapp_show_keyboard(bool show) {
if (IsLinux()) {
linux_sapp_show_keyboard(show);
return;
}
if (IsWindows()) {
windows_sapp_show_keyboard(show);
return;
}
}
extern bool linux_sapp_keyboard_shown(void);
extern bool windows_sapp_keyboard_shown(void);
bool sapp_keyboard_shown(void) {
if (IsLinux()) {
return linux_sapp_keyboard_shown();
}
if (IsWindows()) {
return windows_sapp_keyboard_shown();
}
}
extern bool linux_sapp_is_fullscreen(void);
extern bool windows_sapp_is_fullscreen(void);
bool sapp_is_fullscreen(void) {
if (IsLinux()) {
return linux_sapp_is_fullscreen();
}
if (IsWindows()) {
return windows_sapp_is_fullscreen();
}
}
extern void linux_sapp_toggle_fullscreen(void);
extern void windows_sapp_toggle_fullscreen(void);
void sapp_toggle_fullscreen(void) {
if (IsLinux()) {
linux_sapp_toggle_fullscreen();
return;
}
if (IsWindows()) {
windows_sapp_toggle_fullscreen();
return;
}
}
extern void linux_sapp_show_mouse(bool show);
extern void windows_sapp_show_mouse(bool show);
void sapp_show_mouse(bool show) {
if (IsLinux()) {
linux_sapp_show_mouse(show);
return;
}
if (IsWindows()) {
windows_sapp_show_mouse(show);
return;
}
}
extern bool linux_sapp_mouse_shown(void);
extern bool windows_sapp_mouse_shown(void);
bool sapp_mouse_shown(void) {
if (IsLinux()) {
return linux_sapp_mouse_shown();
}
if (IsWindows()) {
return windows_sapp_mouse_shown();
}
}
extern void linux_sapp_lock_mouse(bool lock);
extern void windows_sapp_lock_mouse(bool lock);
void sapp_lock_mouse(bool lock) {
if (IsLinux()) {
linux_sapp_lock_mouse(lock);
return;
}
if (IsWindows()) {
windows_sapp_lock_mouse(lock);
return;
}
}
extern bool linux_sapp_mouse_locked(void);
extern bool windows_sapp_mouse_locked(void);
bool sapp_mouse_locked(void) {
if (IsLinux()) {
return linux_sapp_mouse_locked();
}
if (IsWindows()) {
return windows_sapp_mouse_locked();
}
}
extern void linux_sapp_set_mouse_cursor(sapp_mouse_cursor cursor);
extern void windows_sapp_set_mouse_cursor(sapp_mouse_cursor cursor);
void sapp_set_mouse_cursor(sapp_mouse_cursor cursor) {
if (IsLinux()) {
linux_sapp_set_mouse_cursor(cursor);
return;
}
if (IsWindows()) {
windows_sapp_set_mouse_cursor(cursor);
return;
}
}
extern sapp_mouse_cursor linux_sapp_get_mouse_cursor(void);
extern sapp_mouse_cursor windows_sapp_get_mouse_cursor(void);
sapp_mouse_cursor sapp_get_mouse_cursor(void) {
if (IsLinux()) {
return linux_sapp_get_mouse_cursor();
}
if (IsWindows()) {
return windows_sapp_get_mouse_cursor();
}
}
extern void* linux_sapp_userdata(void);
extern void* windows_sapp_userdata(void);
void* sapp_userdata(void) {
if (IsLinux()) {
return linux_sapp_userdata();
}
if (IsWindows()) {
return windows_sapp_userdata();
}
}
extern sapp_desc linux_sapp_query_desc(void);
extern sapp_desc windows_sapp_query_desc(void);
sapp_desc sapp_query_desc(void) {
if (IsLinux()) {
return linux_sapp_query_desc();
}
if (IsWindows()) {
return windows_sapp_query_desc();
}
}
extern void linux_sapp_request_quit(void);
extern void windows_sapp_request_quit(void);
void sapp_request_quit(void) {
if (IsLinux()) {
linux_sapp_request_quit();
return;
}
if (IsWindows()) {
windows_sapp_request_quit();
return;
}
}
extern void linux_sapp_cancel_quit(void);
extern void windows_sapp_cancel_quit(void);
void sapp_cancel_quit(void) {
if (IsLinux()) {
linux_sapp_cancel_quit();
return;
}
if (IsWindows()) {
windows_sapp_cancel_quit();
return;
}
}
extern void linux_sapp_quit(void);
extern void windows_sapp_quit(void);
void sapp_quit(void) {
if (IsLinux()) {
linux_sapp_quit();
return;
}
if (IsWindows()) {
windows_sapp_quit();
return;
}
}
extern void linux_sapp_consume_event(void);
extern void windows_sapp_consume_event(void);
void sapp_consume_event(void) {
if (IsLinux()) {
linux_sapp_consume_event();
return;
}
if (IsWindows()) {
windows_sapp_consume_event();
return;
}
}
extern uint64_t linux_sapp_frame_count(void);
extern uint64_t windows_sapp_frame_count(void);
uint64_t sapp_frame_count(void) {
if (IsLinux()) {
return linux_sapp_frame_count();
}
if (IsWindows()) {
return windows_sapp_frame_count();
}
}
extern double linux_sapp_frame_duration(void);
extern double windows_sapp_frame_duration(void);
double sapp_frame_duration(void) {
if (IsLinux()) {
return linux_sapp_frame_duration();
}
if (IsWindows()) {
return windows_sapp_frame_duration();
}
}
extern void linux_sapp_set_clipboard_string(const char* str);
extern void windows_sapp_set_clipboard_string(const char* str);
void sapp_set_clipboard_string(const char* str) {
if (IsLinux()) {
linux_sapp_set_clipboard_string(str);
return;
}
if (IsWindows()) {
windows_sapp_set_clipboard_string(str);
return;
}
}
extern const char* linux_sapp_get_clipboard_string(void);
extern const char* windows_sapp_get_clipboard_string(void);
const char* sapp_get_clipboard_string(void) {
if (IsLinux()) {
return linux_sapp_get_clipboard_string();
}
if (IsWindows()) {
return windows_sapp_get_clipboard_string();
}
}
extern void linux_sapp_set_window_title(const char* str);
extern void windows_sapp_set_window_title(const char* str);
void sapp_set_window_title(const char* str) {
if (IsLinux()) {
linux_sapp_set_window_title(str);
return;
}
if (IsWindows()) {
windows_sapp_set_window_title(str);
return;
}
}
extern void linux_sapp_set_icon(const sapp_icon_desc* icon_desc);
extern void windows_sapp_set_icon(const sapp_icon_desc* icon_desc);
void sapp_set_icon(const sapp_icon_desc* icon_desc) {
if (IsLinux()) {
linux_sapp_set_icon(icon_desc);
return;
}
if (IsWindows()) {
windows_sapp_set_icon(icon_desc);
return;
}
}
extern int linux_sapp_get_num_dropped_files(void);
extern int windows_sapp_get_num_dropped_files(void);
int sapp_get_num_dropped_files(void) {
if (IsLinux()) {
return linux_sapp_get_num_dropped_files();
}
if (IsWindows()) {
return windows_sapp_get_num_dropped_files();
}
}
extern const char* linux_sapp_get_dropped_file_path(int index);
extern const char* windows_sapp_get_dropped_file_path(int index);
const char* sapp_get_dropped_file_path(int index) {
if (IsLinux()) {
return linux_sapp_get_dropped_file_path(index);
}
if (IsWindows()) {
return windows_sapp_get_dropped_file_path(index);
}
}
extern void linux_sapp_run(const sapp_desc* desc);
extern void windows_sapp_run(const sapp_desc* desc);
void sapp_run(const sapp_desc* desc) {
if (IsLinux()) {
linux_sapp_run(desc);
return;
}
if (IsWindows()) {
windows_sapp_run(desc);
return;
}
}
extern const void* linux_sapp_egl_get_display(void);
extern const void* windows_sapp_egl_get_display(void);
const void* sapp_egl_get_display(void) {
if (IsLinux()) {
return linux_sapp_egl_get_display();
}
if (IsWindows()) {
return windows_sapp_egl_get_display();
}
}
extern const void* linux_sapp_egl_get_context(void);
extern const void* windows_sapp_egl_get_context(void);
const void* sapp_egl_get_context(void) {
if (IsLinux()) {
return linux_sapp_egl_get_context();
}
if (IsWindows()) {
return windows_sapp_egl_get_context();
}
}
extern void linux_sapp_html5_ask_leave_site(bool ask);
extern void windows_sapp_html5_ask_leave_site(bool ask);
void sapp_html5_ask_leave_site(bool ask) {
if (IsLinux()) {
linux_sapp_html5_ask_leave_site(ask);
return;
}
if (IsWindows()) {
windows_sapp_html5_ask_leave_site(ask);
return;
}
}
extern uint32_t linux_sapp_html5_get_dropped_file_size(int index);
extern uint32_t windows_sapp_html5_get_dropped_file_size(int index);
uint32_t sapp_html5_get_dropped_file_size(int index) {
if (IsLinux()) {
return linux_sapp_html5_get_dropped_file_size(index);
}
if (IsWindows()) {
return windows_sapp_html5_get_dropped_file_size(index);
}
}
extern void linux_sapp_html5_fetch_dropped_file(const sapp_html5_fetch_request* request);
extern void windows_sapp_html5_fetch_dropped_file(const sapp_html5_fetch_request* request);
void sapp_html5_fetch_dropped_file(const sapp_html5_fetch_request* request) {
if (IsLinux()) {
linux_sapp_html5_fetch_dropped_file(request);
return;
}
if (IsWindows()) {
windows_sapp_html5_fetch_dropped_file(request);
return;
}
}
extern const void* linux_sapp_metal_get_device(void);
extern const void* windows_sapp_metal_get_device(void);
const void* sapp_metal_get_device(void) {
if (IsLinux()) {
return linux_sapp_metal_get_device();
}
if (IsWindows()) {
return windows_sapp_metal_get_device();
}
}
extern const void* linux_sapp_metal_get_current_drawable(void);
extern const void* windows_sapp_metal_get_current_drawable(void);
const void* sapp_metal_get_current_drawable(void) {
if (IsLinux()) {
return linux_sapp_metal_get_current_drawable();
}
if (IsWindows()) {
return windows_sapp_metal_get_current_drawable();
}
}
extern const void* linux_sapp_metal_get_depth_stencil_texture(void);
extern const void* windows_sapp_metal_get_depth_stencil_texture(void);
const void* sapp_metal_get_depth_stencil_texture(void) {
if (IsLinux()) {
return linux_sapp_metal_get_depth_stencil_texture();
}
if (IsWindows()) {
return windows_sapp_metal_get_depth_stencil_texture();
}
}
extern const void* linux_sapp_metal_get_msaa_color_texture(void);
extern const void* windows_sapp_metal_get_msaa_color_texture(void);
const void* sapp_metal_get_msaa_color_texture(void) {
if (IsLinux()) {
return linux_sapp_metal_get_msaa_color_texture();
}
if (IsWindows()) {
return windows_sapp_metal_get_msaa_color_texture();
}
}
extern const void* linux_sapp_macos_get_window(void);
extern const void* windows_sapp_macos_get_window(void);
const void* sapp_macos_get_window(void) {
if (IsLinux()) {
return linux_sapp_macos_get_window();
}
if (IsWindows()) {
return windows_sapp_macos_get_window();
}
}
extern const void* linux_sapp_ios_get_window(void);
extern const void* windows_sapp_ios_get_window(void);
const void* sapp_ios_get_window(void) {
if (IsLinux()) {
return linux_sapp_ios_get_window();
}
if (IsWindows()) {
return windows_sapp_ios_get_window();
}
}
extern const void* linux_sapp_d3d11_get_device(void);
extern const void* windows_sapp_d3d11_get_device(void);
const void* sapp_d3d11_get_device(void) {
if (IsLinux()) {
return linux_sapp_d3d11_get_device();
}
if (IsWindows()) {
return windows_sapp_d3d11_get_device();
}
}
extern const void* linux_sapp_d3d11_get_device_context(void);
extern const void* windows_sapp_d3d11_get_device_context(void);
const void* sapp_d3d11_get_device_context(void) {
if (IsLinux()) {
return linux_sapp_d3d11_get_device_context();
}
if (IsWindows()) {
return windows_sapp_d3d11_get_device_context();
}
}
extern const void* linux_sapp_d3d11_get_swap_chain(void);
extern const void* windows_sapp_d3d11_get_swap_chain(void);
const void* sapp_d3d11_get_swap_chain(void) {
if (IsLinux()) {
return linux_sapp_d3d11_get_swap_chain();
}
if (IsWindows()) {
return windows_sapp_d3d11_get_swap_chain();
}
}
extern const void* linux_sapp_d3d11_get_render_view(void);
extern const void* windows_sapp_d3d11_get_render_view(void);
const void* sapp_d3d11_get_render_view(void) {
if (IsLinux()) {
return linux_sapp_d3d11_get_render_view();
}
if (IsWindows()) {
return windows_sapp_d3d11_get_render_view();
}
}
extern const void* linux_sapp_d3d11_get_resolve_view(void);
extern const void* windows_sapp_d3d11_get_resolve_view(void);
const void* sapp_d3d11_get_resolve_view(void) {
if (IsLinux()) {
return linux_sapp_d3d11_get_resolve_view();
}
if (IsWindows()) {
return windows_sapp_d3d11_get_resolve_view();
}
}
extern const void* linux_sapp_d3d11_get_depth_stencil_view(void);
extern const void* windows_sapp_d3d11_get_depth_stencil_view(void);
const void* sapp_d3d11_get_depth_stencil_view(void) {
if (IsLinux()) {
return linux_sapp_d3d11_get_depth_stencil_view();
}
if (IsWindows()) {
return windows_sapp_d3d11_get_depth_stencil_view();
}
}
extern const void* linux_sapp_win32_get_hwnd(void);
extern const void* windows_sapp_win32_get_hwnd(void);
const void* sapp_win32_get_hwnd(void) {
if (IsLinux()) {
return linux_sapp_win32_get_hwnd();
}
if (IsWindows()) {
return windows_sapp_win32_get_hwnd();
}
}
extern const void* linux_sapp_wgpu_get_device(void);
extern const void* windows_sapp_wgpu_get_device(void);
const void* sapp_wgpu_get_device(void) {
if (IsLinux()) {
return linux_sapp_wgpu_get_device();
}
if (IsWindows()) {
return windows_sapp_wgpu_get_device();
}
}
extern const void* linux_sapp_wgpu_get_render_view(void);
extern const void* windows_sapp_wgpu_get_render_view(void);
const void* sapp_wgpu_get_render_view(void) {
if (IsLinux()) {
return linux_sapp_wgpu_get_render_view();
}
if (IsWindows()) {
return windows_sapp_wgpu_get_render_view();
}
}
extern const void* linux_sapp_wgpu_get_resolve_view(void);
extern const void* windows_sapp_wgpu_get_resolve_view(void);
const void* sapp_wgpu_get_resolve_view(void) {
if (IsLinux()) {
return linux_sapp_wgpu_get_resolve_view();
}
if (IsWindows()) {
return windows_sapp_wgpu_get_resolve_view();
}
}
extern const void* linux_sapp_wgpu_get_depth_stencil_view(void);
extern const void* windows_sapp_wgpu_get_depth_stencil_view(void);
const void* sapp_wgpu_get_depth_stencil_view(void) {
if (IsLinux()) {
return linux_sapp_wgpu_get_depth_stencil_view();
}
if (IsWindows()) {
return windows_sapp_wgpu_get_depth_stencil_view();
}
}
extern uint32_t linux_sapp_gl_get_framebuffer(void);
extern uint32_t windows_sapp_gl_get_framebuffer(void);
uint32_t sapp_gl_get_framebuffer(void) {
if (IsLinux()) {
return linux_sapp_gl_get_framebuffer();
}
if (IsWindows()) {
return windows_sapp_gl_get_framebuffer();
}
}
extern int linux_sapp_gl_get_major_version(void);
extern int windows_sapp_gl_get_major_version(void);
int sapp_gl_get_major_version(void) {
if (IsLinux()) {
return linux_sapp_gl_get_major_version();
}
if (IsWindows()) {
return windows_sapp_gl_get_major_version();
}
}
extern int linux_sapp_gl_get_minor_version(void);
extern int windows_sapp_gl_get_minor_version(void);
int sapp_gl_get_minor_version(void) {
if (IsLinux()) {
return linux_sapp_gl_get_minor_version();
}
if (IsWindows()) {
return windows_sapp_gl_get_minor_version();
}
}
extern const void* linux_sapp_android_get_native_activity(void);
extern const void* windows_sapp_android_get_native_activity(void);
const void* sapp_android_get_native_activity(void) {
if (IsLinux()) {
return linux_sapp_android_get_native_activity();
}
if (IsWindows()) {
return windows_sapp_android_get_native_activity();
}
}
extern void linux_sg_setup(const sg_desc* desc);
extern void windows_sg_setup(const sg_desc* desc);
void sg_setup(const sg_desc* desc) {
if (IsLinux()) {
linux_sg_setup(desc);
return;
}
if (IsWindows()) {
windows_sg_setup(desc);
return;
}
}
extern void linux_sg_shutdown(void);
extern void windows_sg_shutdown(void);
void sg_shutdown(void) {
if (IsLinux()) {
linux_sg_shutdown();
return;
}
if (IsWindows()) {
windows_sg_shutdown();
return;
}
}
extern bool linux_sg_isvalid(void);
extern bool windows_sg_isvalid(void);
bool sg_isvalid(void) {
if (IsLinux()) {
return linux_sg_isvalid();
}
if (IsWindows()) {
return windows_sg_isvalid();
}
}
extern void linux_sg_reset_state_cache(void);
extern void windows_sg_reset_state_cache(void);
void sg_reset_state_cache(void) {
if (IsLinux()) {
linux_sg_reset_state_cache();
return;
}
if (IsWindows()) {
windows_sg_reset_state_cache();
return;
}
}
extern sg_trace_hooks linux_sg_install_trace_hooks(const sg_trace_hooks* trace_hooks);
extern sg_trace_hooks windows_sg_install_trace_hooks(const sg_trace_hooks* trace_hooks);
sg_trace_hooks sg_install_trace_hooks(const sg_trace_hooks* trace_hooks) {
if (IsLinux()) {
return linux_sg_install_trace_hooks(trace_hooks);
}
if (IsWindows()) {
return windows_sg_install_trace_hooks(trace_hooks);
}
}
extern void linux_sg_push_debug_group(const char* name);
extern void windows_sg_push_debug_group(const char* name);
void sg_push_debug_group(const char* name) {
if (IsLinux()) {
linux_sg_push_debug_group(name);
return;
}
if (IsWindows()) {
windows_sg_push_debug_group(name);
return;
}
}
extern void linux_sg_pop_debug_group(void);
extern void windows_sg_pop_debug_group(void);
void sg_pop_debug_group(void) {
if (IsLinux()) {
linux_sg_pop_debug_group();
return;
}
if (IsWindows()) {
windows_sg_pop_debug_group();
return;
}
}
extern bool linux_sg_add_commit_listener(sg_commit_listener listener);
extern bool windows_sg_add_commit_listener(sg_commit_listener listener);
bool sg_add_commit_listener(sg_commit_listener listener) {
if (IsLinux()) {
return linux_sg_add_commit_listener(listener);
}
if (IsWindows()) {
return windows_sg_add_commit_listener(listener);
}
}
extern bool linux_sg_remove_commit_listener(sg_commit_listener listener);
extern bool windows_sg_remove_commit_listener(sg_commit_listener listener);
bool sg_remove_commit_listener(sg_commit_listener listener) {
if (IsLinux()) {
return linux_sg_remove_commit_listener(listener);
}
if (IsWindows()) {
return windows_sg_remove_commit_listener(listener);
}
}
extern sg_buffer linux_sg_make_buffer(const sg_buffer_desc* desc);
extern sg_buffer windows_sg_make_buffer(const sg_buffer_desc* desc);
sg_buffer sg_make_buffer(const sg_buffer_desc* desc) {
if (IsLinux()) {
return linux_sg_make_buffer(desc);
}
if (IsWindows()) {
return windows_sg_make_buffer(desc);
}
}
extern sg_image linux_sg_make_image(const sg_image_desc* desc);
extern sg_image windows_sg_make_image(const sg_image_desc* desc);
sg_image sg_make_image(const sg_image_desc* desc) {
if (IsLinux()) {
return linux_sg_make_image(desc);
}
if (IsWindows()) {
return windows_sg_make_image(desc);
}
}
extern sg_sampler linux_sg_make_sampler(const sg_sampler_desc* desc);
extern sg_sampler windows_sg_make_sampler(const sg_sampler_desc* desc);
sg_sampler sg_make_sampler(const sg_sampler_desc* desc) {
if (IsLinux()) {
return linux_sg_make_sampler(desc);
}
if (IsWindows()) {
return windows_sg_make_sampler(desc);
}
}
extern sg_shader linux_sg_make_shader(const sg_shader_desc* desc);
extern sg_shader windows_sg_make_shader(const sg_shader_desc* desc);
sg_shader sg_make_shader(const sg_shader_desc* desc) {
if (IsLinux()) {
return linux_sg_make_shader(desc);
}
if (IsWindows()) {
return windows_sg_make_shader(desc);
}
}
extern sg_pipeline linux_sg_make_pipeline(const sg_pipeline_desc* desc);
extern sg_pipeline windows_sg_make_pipeline(const sg_pipeline_desc* desc);
sg_pipeline sg_make_pipeline(const sg_pipeline_desc* desc) {
if (IsLinux()) {
return linux_sg_make_pipeline(desc);
}
if (IsWindows()) {
return windows_sg_make_pipeline(desc);
}
}
extern sg_attachments linux_sg_make_attachments(const sg_attachments_desc* desc);
extern sg_attachments windows_sg_make_attachments(const sg_attachments_desc* desc);
sg_attachments sg_make_attachments(const sg_attachments_desc* desc) {
if (IsLinux()) {
return linux_sg_make_attachments(desc);
}
if (IsWindows()) {
return windows_sg_make_attachments(desc);
}
}
extern void linux_sg_destroy_buffer(sg_buffer buf);
extern void windows_sg_destroy_buffer(sg_buffer buf);
void sg_destroy_buffer(sg_buffer buf) {
if (IsLinux()) {
linux_sg_destroy_buffer(buf);
return;
}
if (IsWindows()) {
windows_sg_destroy_buffer(buf);
return;
}
}
extern void linux_sg_destroy_image(sg_image img);
extern void windows_sg_destroy_image(sg_image img);
void sg_destroy_image(sg_image img) {
if (IsLinux()) {
linux_sg_destroy_image(img);
return;
}
if (IsWindows()) {
windows_sg_destroy_image(img);
return;
}
}
extern void linux_sg_destroy_sampler(sg_sampler smp);
extern void windows_sg_destroy_sampler(sg_sampler smp);
void sg_destroy_sampler(sg_sampler smp) {
if (IsLinux()) {
linux_sg_destroy_sampler(smp);
return;
}
if (IsWindows()) {
windows_sg_destroy_sampler(smp);
return;
}
}
extern void linux_sg_destroy_shader(sg_shader shd);
extern void windows_sg_destroy_shader(sg_shader shd);
void sg_destroy_shader(sg_shader shd) {
if (IsLinux()) {
linux_sg_destroy_shader(shd);
return;
}
if (IsWindows()) {
windows_sg_destroy_shader(shd);
return;
}
}
extern void linux_sg_destroy_pipeline(sg_pipeline pip);
extern void windows_sg_destroy_pipeline(sg_pipeline pip);
void sg_destroy_pipeline(sg_pipeline pip) {
if (IsLinux()) {
linux_sg_destroy_pipeline(pip);
return;
}
if (IsWindows()) {
windows_sg_destroy_pipeline(pip);
return;
}
}
extern void linux_sg_destroy_attachments(sg_attachments atts);
extern void windows_sg_destroy_attachments(sg_attachments atts);
void sg_destroy_attachments(sg_attachments atts) {
if (IsLinux()) {
linux_sg_destroy_attachments(atts);
return;
}
if (IsWindows()) {
windows_sg_destroy_attachments(atts);
return;
}
}
extern void linux_sg_update_buffer(sg_buffer buf, const sg_range* data);
extern void windows_sg_update_buffer(sg_buffer buf, const sg_range* data);
void sg_update_buffer(sg_buffer buf, const sg_range* data) {
if (IsLinux()) {
linux_sg_update_buffer(buf, data);
return;
}
if (IsWindows()) {
windows_sg_update_buffer(buf, data);
return;
}
}
extern void linux_sg_update_image(sg_image img, const sg_image_data* data);
extern void windows_sg_update_image(sg_image img, const sg_image_data* data);
void sg_update_image(sg_image img, const sg_image_data* data) {
if (IsLinux()) {
linux_sg_update_image(img, data);
return;
}
if (IsWindows()) {
windows_sg_update_image(img, data);
return;
}
}
extern int linux_sg_append_buffer(sg_buffer buf, const sg_range* data);
extern int windows_sg_append_buffer(sg_buffer buf, const sg_range* data);
int sg_append_buffer(sg_buffer buf, const sg_range* data) {
if (IsLinux()) {
return linux_sg_append_buffer(buf, data);
}
if (IsWindows()) {
return windows_sg_append_buffer(buf, data);
}
}
extern bool linux_sg_query_buffer_overflow(sg_buffer buf);
extern bool windows_sg_query_buffer_overflow(sg_buffer buf);
bool sg_query_buffer_overflow(sg_buffer buf) {
if (IsLinux()) {