-
-
Notifications
You must be signed in to change notification settings - Fork 2
/
EuSDLGPU.ew
2578 lines (1425 loc) · 72 KB
/
EuSDLGPU.ew
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
--------------------------------------
--EuSDL GPU --
--Written By Andy P. (Icy Viking) --
--Written in Euphoria 4.1.0 Beta 2 --
--Wrapper for SDL GPU 2 --
--Icy Viking Games --
--Date: 4-14-20 --
--------------------------------------
without warning
include std/machine.e
include std/math.e
include std/dll.e
include std/os.e
--load the DLL/Library file
atom gpu
--load correct file for platform being developed on
ifdef WIN32 then
gpu = open_dll("SDL2_gpu.dll")
elsifdef LINUX or FREEBSD then
gpu = open_dll("SDL2_gpu.so")
end ifdef
if gpu < 1 then
puts(1,"Failed to load SDL2_gpu library!\n")
abort(0)
end if
include EuSDL2.ew
--Flags/Globals
public constant SDL_GPU_VERSION_MAJOR = 0,
SDL_GPU_VERSION_MINOR = 11,
SDL_GPU_VERSION_PATCH = 0
public constant GPU_FLASE = 0,
GPU_TRUE = 1
-----------------
--GPU Rect --
--X,Y (float) --
--W,H (float) --
-----------------
--^^ GPU Rect will be modified to be more Euphoria friendly
--The struct will be four separate float vars
public constant GPU_RENDERER_UNKNOWN = 0,
GPU_RENDERER_OPENGL_1_BASE = 1,
GPU_RENDERER_OPENGL_1 = 2,
GPU_RENDERER_OPENGL_2 = 3,
GPU_RENDERER_OPENGL_3 = 4,
GPU_RENDERER_OPENGL_4 = 5,
GPU_RENDERER_GLES_1 = 11,
GPU_RENDERER_GLES_2 = 12,
GPU_RENDERER_GLES_3 = 13,
GPU_RENDERER_D3D9 = 21,
GPU_RENDERER_D3D10 = 22,
GPU_RENDERER_D3D11 = 23
public enum type GPU_ComparisonEnum
GPU_NEVER = 512,
GPU_LESS = 513,
GPU_EQUAL = 514,
GPU_LEQUAL = 515,
GPU_GREATER = 516,
GPU_NOTEQUAL = 517,
GPU_GEQUAL = 518,
GPU_ALWAYS = 519
end type
GPU_ComparisonEnum GPUEnum --used for the enum type (GPUEnum)
public enum type GPU_BlendFuncEnum
GPU_FUNC_ZERO = 0,
GPU_FUNC_ONE = 1,
GPU_FUNC_SRC_COLOR = 768,
GPU_FUNC_DST_COLOR = 774,
GPU_FUNC_ONE_MINUS_SRC = 769,
GPU_FUNC_ONE_MINUS_DST = 775,
GPU_FUNC_SRC_ALPHA = 770,
GPU_FUNC_DST_ALPHA = 772,
GPU_FUNC_ONE_MINUS_SRC_ALPHA = 771,
GPU_FUNC_ONE_MINUS_DST_ALPHA = 773
end type
GPU_BlendFuncEnum GPU_BlendFunc
public enum type GPU_BlendEqEnum
GPU_EQ_ADD = 32774,
GPU_EQ_SUBTRACT = 32778,
GPU_EQ_REVERSE_SUBTRACT = 32779
end type
GPU_BlendEqEnum GPU_BlendEq
public enum type GPU_BlendPresetEnum
GPU_BLEND_NORMAL = 0,
GPU_BLEND_PREMULTIPLIED_ALPHA = 1,
GPU_BLEND_MULTIPLY = 2,
GPU_BLEND_ADD = 3,
GPU_BLEND_SUBTRACT = 4,
GPU_BLEND_MOD_ALPHA = 5,
GPU_BLEND_SET_ALPHA = 6,
GPU_BLEND_SET = 7,
GPU_BLEND_NORMAL_KEEP_ALPHA = 8,
GPU_BLEND_NORMAL_ADD_ALPHA = 9,
GPU_BLEND_NORMAL_FACTOR_ALPHA = 10
end type
GPU_BlendPresetEnum GPU_BlendPreset
public enum type GPU_FilterEnum
GPU_FILTER_NEAREST = 0,
GPU_FILTER_LINEAR = 1,
GPU_FILTER_LINEAR_MIPMAP = 2
end type
GPU_FilterEnum GPUFilter
public enum type GPU_SnapEnum
GPU_SNAP_NONE = 0,
GPU_SNAP_POSITION = 1,
GPU_SNAP_DIMENSIONS = 2,
GPU_SNAP_POSITION_AND_DIMENSIONS = 3
end type
GPU_SnapEnum GPU_Snap
public enum type GPU_WrapEnum
GPU_WRAP_NONE = 0,
GPU_WRAP_REPEAT = 1,
GPU_WRAP_MIRRORED = 2
end type
GPU_WrapEnum GPU_Wrap
public enum type GPU_FormatEnum
GPU_FORMAT_LUMINANCE = 1,
GPU_FORMAT_LUMINANCE_ALPHA = 2,
GPU_FORMAT_RGB = 3,
GPU_FORMAT_RGBA = 4,
GPU_FORMAT_ALPHA = 5,
GPU_FORMAT_RG = 6,
GPU_FORMAT_YCBCR422 = 7,
GPU_FORMAT_YCBCR420P = 8,
GPU_FORMAT_BGR = 9,
GPU_FORMAT_BGRA = 10,
GPU_FORMAT_ABGR = 11
end type
GPU_FormatEnum GPU_Format
public enum type GPU_FileFormatEnum
GPU_FILE_AUTO = 0,
GPU_FILE_PNG,
GPU_FILE_BMP,
GPU_FILE_TGA
end type
GPU_FileFormatEnum GPUFileFormat
-------------------------------
--GPU Camera Rect(Struct) --
--X,Y,Z (float) --
--angle (float) --
--zoom_x,zoom_y (float) --
--z_near,z_far (float) --
--use_centered_origin (bool) --
-------------------------------
--^^ This will be converted to be more Euphoria friendly
----------------------------------
--GPU ShaderBlock Struct --
--position_loc (int) --
--texcoord_loc (int) --
--color_loc (int) --
--modelViewProjection_loc (int) --
----------------------------------
--^^ This will be converted to be more Euphoria friendly
----------------------------------
--GPU_MatrixStack Struct --
--storage_size (uint) --
--size (uint) --
--matrix (float ptr) --
----------------------------------
--^^ This will be converted to be more Euphoria friendly
--------------------------------------------------------
--GPU_Context Struct
--context void ptr
--failed GPU_Bool
--windowID uint32
--window_w int
--window_h int
--drawable_w int
--drawable_h int
--stored_window_w int
--stored_window_h int
--actie_target ptr
--current_shader_program uint32
--default_textured_shader_program uint32
--default_untextured_shader_program uint32
--current_shader_block uint
--default_textured_shader_block uint
--default_untextured_shader_block uint
--shapes_use_blending bool
--shapes_blend_mode blendmode enum
--line_thickness float
--use_texturing bool
--refcount int
--data ptr (void)
----------------------------------------------------------
----------------------------------------------------------
--GPU Target Struct
--renderer struct
--context_target ptr
--image ptr
--data void ptr
--w,h uint
--using_virtual_res - bool
--base_w,base_h uint
--use_clip_rect bool
--clip_rect rect
--use_color bool
--color SDL_Color
--viewport rect
--matrix_mode int
--projection_matrix uint
--view_matrix - uint
--model_matrix - uint
--camera uint
--use_camera bool
--use_depth_test bool
--use_depth_write bool
--depth_function --comparison enum
--context ptr
--refcount int
--is_alias bool
------------------------------------------------------
public constant GPU_FEATURE_NON_POWER_OF_TWO = 1,
GPU_FEATURE_RENDER_TARGETS = 2,
GPU_FEATURE_BLEND_EQUATIONS = 4,
GPU_FEATURE_BLEND_FUNC_SEPARATE = 8,
GPU_FEATURE_BLEND_EQUATIONS_SEPARATE = 16,
GPU_FEATURE_GL_BGR = 32,
GPU_FEATURE_GL_BGRA = 64,
GPU_FEATURE_GL_ABGR = 128,
GPU_FEATURE_VERTEX_SHADER = 256,
GPU_FEATURE_FRAGMENT_SHADER = 512,
GPU_FEATURE_PIXEL_SHADER = 512,
GPU_FEATURE_GEOMETRY_SHADER = 1024,
GPU_FEATURE_WRAP_REPEAT_MIRRORED = 2048,
GPU_FEATURE_CORE_FRAMEBUFFER_OBJECTS = 4096
public constant GPU_INIT_ENABLE_VSYNC = 1,
GPU_INIT_DISABLE_VSYNC = 2,
GPU_INIT_DISABLE_DOUBLE_BUFFER = 4,
GPU_INIT_DISABLE_AUTO_VIRTUAL_RESOLUTION = 8,
GPU_INIT_REQUEST_COMPATBILITY_PROFILE = 16,
GPU_INIT_USE_ROW_BY_ROW_TEXTURE_UPLOAD_FALLBACK = 32,
GPU_INIT_USE_COPY_TEXTURE_UPLOAD_FALLBACK = 64
public constant GPU_NONE = 0
public constant GPU_POINTS = 0,
GPU_LINES = 1,
GPU_LINE_LOOP = 2,
GPU_LINE_STRIP = 3,
GPU_TRIANGLES = 4,
GPU_TRIANGLE_STRIP = 5,
GPU_TRIANGLE_FAN = 6
public constant GPU_BATCH_XY = 1,
GPU_BATCH_XYZ = 2,
GPU_BATCH_ST = 4,
GPU_BATCH_RGB = 8,
GPU_BATCH_RGBA = 16,
GPU_BATCH_RGB8 = 32,
GPU_BATCH_RGBA8 = 64
public constant GPU_BATCH_XY_ST = or_all({GPU_BATCH_XY,GPU_BATCH_ST})
public constant GPU_BATCH_XYZ_ST = or_all({GPU_BATCH_XYZ,GPU_BATCH_ST})
public constant GPU_BATCH_XY_RGB = or_all({GPU_BATCH_XY,GPU_BATCH_RGB})
public constant GPU_BATCH_XYZ_RGB = or_all({GPU_BATCH_XYZ,GPU_BATCH_RGB})
public constant GPU_BATCH_XY_RGBA = or_all({GPU_BATCH_XY,GPU_BATCH_RGBA})
public constant GPU_BATCH_XYZ_RGBA = or_all({GPU_BATCH_XYZ,GPU_BATCH_RGBA})
public constant GPU_BATCH_XY_ST_RGBA = or_all({GPU_BATCH_XY,GPU_BATCH_ST,GPU_BATCH_RGBA})
public constant GPU_BATCH_XYZ_ST_RGBA = or_all({GPU_BATCH_XYZ,GPU_BATCH_ST,GPU_BATCH_RGBA})
public constant GPU_BATCH_XY_RGB8 = or_all({GPU_BATCH_XY,GPU_BATCH_RGB8})
public constant GPU_BATCH_XYZ_RGB8 = or_all({GPU_BATCH_XYZ,GPU_BATCH_RGB8})
public constant GPU_BATCH_XY_RGBA8 = or_all({GPU_BATCH_XY,GPU_BATCH_RGBA8})
public constant GPU_BATCH_XYZ_RGBA8 = or_all({GPU_BATCH_XYZ,GPU_BATCH_RGBA8})
public constant GPU_BATCH_XY_ST_RGBA8 = or_all({GPU_BATCH_XY,GPU_BATCH_ST,GPU_BATCH_RGBA8})
public constant GPU_BATCH_XYZ_ST_RGBA8 = or_all({GPU_BATCH_XYZ,GPU_BATCH_ST,GPU_BATCH_RGBA8})
public constant GPU_FLIP_NONE = 0,
GPU_FLIP_HORIZONTAL = 1,
GPU_FLIP_VERTICAL = 2
public constant GPU_TYPE_BYTE = 5120,
GPU_TYPE_UNSIGNED_BYTE = 5121,
GPU_TYPE_SHORT = 5122,
GPU_TYPE_UNSIGNED_SHORT = 5123,
GPU_TYPE_INT = 5124,
GPU_TYPE_UNSIGNED_INT = 5125,
GPU_TYPE_TYPE_FLOAT = 5126,
GPU_TYPE_DOUBLE = 5130
public constant GPU_DEFAULT_INIT_FLAGS = 0
public enum type GPU_ShaderEnum
GPU_VERTEX_SHADER = 0,
GPU_FRAGMENT_SHADER = 1,
GPU_PIXEL_SHADER = 1,
GPU_GEOMATRY_SHADER = 2
end type
GPU_ShaderEnum GPU_Shader
public enum type GPU_ShaderLanguageEnum
GPU_LANGUAGE_NONE = 0,
GPU_LANGUAGE_ARB_ASSEMBLY = 1,
GPU_LANGUAGE_GLSL = 2,
GPU_LANGUAGE_GLSLES = 3,
GPU_LANGUAGE_HLSL = 4,
GPU_LANGUAGE_CG = 5
end type
GPU_ShaderLanguageEnum GPU_ShaderLanguage
------------------------------------
--GPU AttributeFormat Struct
--is_per_sprite bool
--num_elems_per_value int
--type enum
--normalize bool
--stride_bytes int
--offset_bytes int
-----------------------------------
-----------------------------------
--GPU Attributes Struct
--location int
--values void ptr
--format gpu_attributeformat
-----------------------------------
----------------------------------
--GPU AttributeSource Struct
--enabled bool
--num_values int
--next_value potr void
--per_vertex_storage_stride_bytes int
--per_vertex_storage_offset_bytes int
--per_vertex_storage_size int
--per_vertex_storage void ptr
--attribute gpu_attribute
---------------------------------
public enum type GPU_ErrorEnum
GPU_ERROR_NONE = 0,
GPU_ERROR_BACKEND_ERROR = 1,
GPU_ERROR_DATA_ERROR = 2,
GPU_ERROR_USER_ERROR = 3,
GPU_ERROR_UNSUPPORTED_FUNCTION = 4,
GPU_ERROR_NULL_ARGUMENT = 5,
GPU_ERROR_FILE_NOT_FOUND = 6
end type
------------------------
--GPU ErrorObject
--function char ptr
--error gpu_errorenum
--details char ptr
------------------------
public enum type GPU_DebugLevelEnum
GPU_DEBUG_LEVEL_0 = 0,
GPU_DEBUG_LEVEL_1 = 1,
GPU_DEBUG_LEVEL_2 = 2,
GPU_DEBUG_LEVEL_3 = 3,
GPU_DEBUG_LEVEL_MAX = 3
end type
GPU_DebugLevelEnum GPU_DebugLevel
public enum type GPU_LogLevelEnum
GPU_LOG_INFO = 0,
GPU_LOG_WARNING,
GPU_LOG_ERROR
end type
GPU_LogLevelEnum GPU_LogLevel
------------------------------
--GPU Renderer Struct
--GPU_RendererID id
-- GPU_RendererID requested_id
-- GPU_WindowFlagEnum SDL_init_flags
-- GPU_InitFlagEnum GPU_init_flags
-- GPU_ShaderLanguageEnum shader_language
-- int min_shader_version
-- int max_shader_version
-- GPU_FeatureEnum enabled_features
--
-- GPU_Target* current_context_target
--
-- GPU_bool coordinate_mode
--
-- float default_image_anchor_x
-- float default_image_anchor_y
-- struct GPU_RendererImpl* impl
---------------------------------------------
--Functions
public constant xGPU_GetLinkedVersion = define_c_func(gpu,"+GPU_GetLinkedVersion",{},C_UINT)
public function GPU_GetLinkedVersion()
return c_func(xGPU_GetLinkedVersion,{})
end function
public constant xGPU_SetInitWindow = define_c_proc(gpu,"+GPU_SetInitWindow",{C_UINT})
public procedure GPU_SetInitWindow(atom win)
c_proc(xGPU_SetInitWindow,{win})
end procedure
public constant xGPU_GetInitWindow = define_c_func(gpu,"+GPU_GetInitWindow",{},C_UINT)
public function GPU_GetInitWindow()
return c_func(xGPU_GetInitWindow,{})
end function
public constant xGPU_SetPreInitFlags = define_c_proc(gpu,"+GPU_SetPreInitFlags",{C_UINT})
public procedure GPU_SetPreInitFlags(atom flag)
c_proc(xGPU_SetPreInitFlags,{flag})
end procedure
public constant xGPU_GetPreInitFlags = define_c_func(gpu,"+GPU_GetPreInitFlags",{},C_UINT)
public function GPU_GetPreInitFlags()
return c_func(xGPU_GetPreInitFlags,{})
end function
public constant xGPU_SetRequiredFeatures = define_c_proc(gpu,"+GPU_SetRequiredFeatures",{C_UINT})
public procedure GPU_SetRequiredFeatures(atom feature)
c_proc(xGPU_SetRequiredFeatures,{feature})
end procedure
public constant xGPU_GetRequiredFeatures = define_c_func(gpu,"+GPU_GetRequiredFeatures",{},C_UINT)
public function GPU_GetRequiredFeatures()
return c_func(xGPU_GetRequiredFeatures,{})
end function
public constant xGPU_GetDefaultRendererOrder = define_c_proc(gpu,"+GPU_GetDefaultRendererOrder",{C_POINTER,C_POINTER})
public procedure GPU_GetDefaultRendererOrder(atom size,atom order)
c_proc(xGPU_GetDefaultRendererOrder,{size,order})
end procedure
public constant xGPU_GetRendererOrder = define_c_proc(gpu,"+GPU_GetRendererOrder",{C_POINTER,C_POINTER})
public procedure GPU_GetRendererOrder(atom size,atom order)
c_proc(xGPU_GetRendererOrder,{size,order})
end procedure
public constant xGPU_SetRendererOrder = define_c_proc(gpu,"+GPU_SetRendererOrder",{C_INT,C_POINTER})
public procedure GPU_SetRendererOrder(atom size,atom order)
c_proc(xGPU_SetRendererOrder,{size,order})
end procedure
public constant xGPU_Init = define_c_func(gpu,"+GPU_Init",{C_UINT,C_UINT,C_UINT},C_UINT)
public function GPU_Init(atom w,atom h,atom flag)
return c_func(xGPU_Init,{w,h,flag})
end function
public constant xGPU_InitRenderer = define_c_func(gpu,"+GPU_InitRenderer",{C_UINT,C_UINT,C_UINT,C_UINT},C_UINT)
public function GPU_InitRenderer(atom render,atom w,atom h,atom flag)
return c_func(xGPU_InitRenderer,{render,w,h,flag})
end function
public constant xGPU_InitRendererByID = define_c_func(gpu,"+GPU_InitRendererByID",{C_UINT,C_UINT,C_UINT,C_UINT},C_UINT)
public function GPU_InitRendererByID(atom render,atom w,atom h,atom flag)
return c_func(xGPU_InitRendererByID,{render,w,h,flag})
end function
public constant xGPU_IsFeatureEnabled = define_c_func(gpu,"+GPU_IsFeatureEnabled",{C_UINT},C_BOOL)
public function GPU_IsFeatureEnabled(atom feature)
return c_func(xGPU_IsFeatureEnabled,{feature})
end function
public constant xGPU_CloseCurrentRenderer = define_c_proc(gpu,"+GPU_CloseCurrentRenderer",{})
public procedure GPU_CloseCurrentRenderer()
c_proc(xGPU_CloseCurrentRenderer,{})
end procedure
public constant xGPU_Quit = define_c_proc(gpu,"+GPU_Quit",{})
public procedure GPU_Quit()
c_proc(xGPU_Quit,{})
end procedure
public constant xGPU_SetDebugLevel = define_c_proc(gpu,"+GPU_SetDebugLevel",{C_UINT})
public procedure GPU_SetDebugLevel(atom x)
c_proc(xGPU_SetDebugLevel,{x})
end procedure
public constant xGPU_GetDebugLevel = define_c_func(gpu,"+GPU_GetDebugLevel",{},C_UINT)
public function GPU_GetDebugLevel()
return c_func(xGPU_GetDebugLevel,{})
end function
public constant xGPU_LogInfo = define_c_proc(gpu,"+GPU_LogInfo",{C_POINTER})
public procedure GPU_LogInfo(sequence format)
atom str = allocate_string(format,1)
c_proc(xGPU_LogInfo,{str})
end procedure
public constant xGPU_LogWarning = define_c_proc(gpu,"+GPU_LogWarning",{C_POINTER})
public procedure GPU_LogWarning(sequence format)
atom str = allocate_string(format,1)
c_proc(xGPU_LogWarning,{str})
end procedure
public constant xGPU_LogError = define_c_proc(gpu,"+GPU_LogError",{C_POINTER})
public procedure GPU_LogError(sequence format)
atom str = allocate_string(format,1)
c_proc(xGPU_LogError,{str})
end procedure
public constant xGPU_SetLogCallback = define_c_proc(gpu,"+GPU_SetLogCallback",{C_UINT,C_POINTER,C_UINT})
public procedure GPU_SetLogCallback(atom xlog,sequence format,atom args)
atom str = allocate_string(format,1)
c_proc(xGPU_SetLogCallback,{xlog,str,args})
end procedure
public constant xGPU_PushErrorCode = define_c_proc(gpu,"+GPU_PushErrorCode",{C_POINTER,C_UINT,C_POINTER})
public procedure GPU_PushErrorCode(sequence func,atom e,sequence details)
atom str = allocate_string(func,1)
atom str2 = allocate_string(details,1)
c_proc(xGPU_PushErrorCode,{str,e,str2})
end procedure
public constant xGPU_PopErrorCode = define_c_func(gpu,"+GPU_PopErrorCode",{},C_UINT)
public function GPU_PopErrorCode()
return c_func(xGPU_PopErrorCode,{})
end function
public constant xGPU_GetErrorString = define_c_func(gpu,"+GPU_GetErrorString",{C_UINT},C_POINTER)
public function GPU_GetErrorString(atom e)
return c_func(xGPU_GetErrorString,{e})
end function
public constant xGPU_SetErrorQueueMax = define_c_proc(gpu,"+GPU_SetErrorQueueMax",{C_UINT})
public procedure GPU_SetErrorQueueMax(atom max)
c_proc(xGPU_SetErrorQueueMax,{max})
end procedure
public constant xGPU_MakeRendererID = define_c_func(gpu,"+GPU_MakeRendererID",{C_POINTER,C_UINT,C_INT,C_INT},C_UINT)
public function GPU_MakeRendererID(sequence name,atom ren,atom major,atom minor)
atom str = allocate_string(name,1)
return c_func(xGPU_MakeRendererID,{str,ren,major,minor})
end function
public constant xGPU_GetRendererID = define_c_func(gpu,"+GPU_GetRendererID",{C_UINT},C_UINT)
public function GPU_GetRendererID(atom ren)
return c_func(xGPU_GetRendererID,{ren})
end function
public constant xGPU_GetNumRegisteredRenderers = define_c_func(gpu,"+GPU_GetNumRegisteredRenderers",{},C_INT)
public function GPU_GetNumRegisteredRenderers()
return c_func(xGPU_GetNumRegisteredRenderers,{})
end function
public constant xGPU_GetRegisteredRendererList = define_c_proc(gpu,"+GPU_GetRegisteredRendererList",{C_POINTER})
public procedure GPU_GetRegisteredRendererList(atom ren)
c_proc(xGPU_GetRegisteredRendererList,{ren})
end procedure
public constant xGPU_RegisterRenderer = define_c_proc(gpu,"+GPU_RegisterRenderer",{C_UINT,C_POINTER,C_POINTER})
public procedure GPU_RegisterRenderer(atom id,atom ren,atom x)
c_proc(xGPU_RegisterRenderer,{id,ren,x})
end procedure
public constant xGPU_ReserveNextRendererEnum = define_c_func(gpu,"+GPU_ReserverNextRendererEnum",{},C_UINT)
public function GPU_ReserveNextRendererEnum()
return c_func(xGPU_ReserveNextRendererEnum,{})
end function
public constant xGPU_GetNumActiveRenderers = define_c_func(gpu,"+GPU_GetNumActiveRenderers",{},C_INT)
public function GPU_GetNumActiveRenderers()
return c_func(xGPU_GetNumActiveRenderers,{})
end function
public constant xGPU_GetActiveRendererList = define_c_proc(gpu,"+GPU_GetActiveRendererList",{C_POINTER})
public procedure GPU_GetActiveRendererList(atom ren)
c_proc(xGPU_GetActiveRendererList,{ren})
end procedure
public constant xGPU_GetCurrentRenderer = define_c_func(gpu,"+GPU_GetCurrentRenderer",{},C_POINTER)
public function GPU_GetCurrentRenderer()
return c_func(xGPU_GetCurrentRenderer,{})
end function
public constant xGPU_SetCurrentRenderer = define_c_proc(gpu,"+GPU_SetCurrentRenderer",{C_UINT})
public procedure GPU_SetCurrentRenderer(atom id)
c_proc(xGPU_SetCurrentRenderer,{id})
end procedure
public constant xGPU_GetRenderer = define_c_func(gpu,"+GPU_GetRenderer",{C_UINT},C_POINTER)
public function GPU_GetRenderer(atom id)
return c_func(xGPU_GetRenderer,{id})
end function
public constant xGPU_FreeRenderer = define_c_proc(gpu,"+GPU_FreeRenderer",{C_POINTER})
public procedure GPU_FreeRenderer(atom ren)
c_proc(xGPU_FreeRenderer,{ren})
end procedure
public constant xGPU_ResetRendererState = define_c_proc(gpu,"+GPU_ResetRendererState",{})
public procedure GPU_ResetRendererState()
c_proc(xGPU_ResetRendererState,{})
end procedure
public constant xGPU_SetCoordinateMode = define_c_proc(gpu,"+GPU_SetCoordinateMode",{C_BOOL})
public procedure GPU_SetCoordinateMode(atom coord)
c_proc(xGPU_SetCoordinateMode,{coord})
end procedure
public constant xGPU_GetCoordinateMode = define_c_func(gpu,"+GPU_GetCoordinateMode",{},C_BOOL)
public function GPU_GetCoordinateMode()
return c_func(xGPU_GetCoordinateMode,{})
end function
public constant xGPU_SetDefaultAnchor = define_c_proc(gpu,"+GPU_SetDefaultAnchor",{C_FLOAT,C_FLOAT})
public procedure GPU_SetDefaultAnchor(atom x,atom y)
c_proc(xGPU_SetDefaultAnchor,{x,y})
end procedure
public constant xGPU_GetDefaultAnchor = define_c_proc(gpu,"+GPU_GetDefaultAnchor",{C_POINTER,C_POINTER})
public procedure GPU_GetDefaultAnchor(atom x,atom y)
c_proc(xGPU_GetDefaultAnchor,{x,y})
end procedure
public constant xGPU_GetContextTarget = define_c_func(gpu,"+GPU_GetContextTarget",{},C_POINTER)
public function GPU_GetContextTarget()
return c_func(xGPU_GetContextTarget,{})
end function
public constant xGPU_GetWindowTarget = define_c_func(gpu,"+GPU_GetWindowTarget",{C_UINT},C_POINTER)
public function GPU_GetWindowTarget(atom id)
return c_func(xGPU_GetWindowTarget,{id})
end function
public constant xGPU_CreateTargetFromWindow = define_c_func(gpu,"+GPU_CreateTargetFromWindow",{C_UINT},C_POINTER)
public function GPU_CreateTargetFromWindow(atom id)
return c_func(xGPU_CreateTargetFromWindow,{id})
end function
public constant xGPU_MakeCurrent = define_c_proc(gpu,"+GPU_MakeCurrent",{C_POINTER,C_UINT})
public procedure GPU_MakeCurrent(atom tar,atom id)
c_proc(xGPU_MakeCurrent,{tar,id})
end procedure
public constant xGPU_SetWindowResolution = define_c_func(gpu,"+GPU_SetWindowResolution",{C_UINT,C_UINT},C_BOOL)
public function GPU_SetWindowResolution(atom w,atom h)
return c_func(xGPU_SetWindowResolution,{w,h})
end function
public constant xGPU_SetFullscreen = define_c_func(gpu,"+GPU_SetFullscreen",{C_BOOL,C_BOOL},C_BOOL)
public function GPU_SetFullscreen(atom enable,atom desktop)
return c_func(xGPU_SetFullscreen,{enable,desktop})
end function
public constant xGPU_GetFullscreen = define_c_func(gpu,"+GPU_GetFullscreen",{},C_BOOL)
public function GPU_GetFulscreen()
return c_func(xGPU_GetFullscreen,{})
end function
public constant xGPU_GetActiveTarget = define_c_func(gpu,"+GPU_GetActiveTarget",{},C_POINTER)
public function GPU_GetActiveTarget()
return c_func(xGPU_GetActiveTarget,{})
end function
public constant xGPU_SetActiveTarget = define_c_func(gpu,"+GPU_SetActiveTarget",{C_POINTER},C_BOOL)
public function GPU_SetActiveTarget(atom tar)
return c_func(xGPU_SetActiveTarget,{tar})
end function
public constant xGPU_SetShapeBlending = define_c_proc(gpu,"+GPU_SetShapeBlending",{C_BOOL})
public procedure GPU_SetShapeBlending(atom en)
c_proc(xGPU_SetShapeBlending,{en})
end procedure
public constant xGPU_GetBlendModeFromPreset = define_c_func(gpu,"+GPU_GetBlendModeFromPreset",{C_UINT},C_UINT)
public function GPU_GetBlendModeFromPreset(atom pre)
return c_func(xGPU_GetBlendModeFromPreset,{pre})
end function
public constant xGPU_SetShapeBlendFunction = define_c_proc(gpu,"+GPU_SetShapeBlendFunction",{C_UINT,C_UINT,C_UINT,C_UINT})
public procedure GPU_SetShapeBlendFunction(atom src,atom dst,atom src2,atom dst2)
c_proc(xGPU_SetShapeBlendFunction,{src,dst,src2,dst2})
end procedure
public constant xGPU_SetShapeBlendEquation = define_c_proc(gpu,"+GPU_SetShapeBlendEquation",{C_UINT,C_UINT})
public procedure GPU_SetShapeBlendEquation(atom col,atom al)
c_proc(xGPU_SetShapeBlendEquation,{col,al})
end procedure
public constant xGPU_SetShapeBlendMode = define_c_proc(gpu,"+GPU_SetShapeBlendMode",{C_UINT})
public procedure GPU_SetShapeBlendMode(atom mode)
c_proc(xGPU_SetShapeBlendMode,{mode})
end procedure
public constant xGPU_SetLineThickness = define_c_func(gpu,"+GPU_SetLineThickness",{C_FLOAT},C_FLOAT)
public function GPU_SetLineThickness(atom thick)
return c_func(xGPU_SetLineThickness,{thick})
end function
public constant xGPU_GetLineThickness = define_c_func(gpu,"+GPU_GetLineThickness",{},C_FLOAT)
public function GPU_GetLineThickness()
return c_func(xGPU_GetLineThickness,{})
end function
public constant xGPU_CreateAliasTarget = define_c_func(gpu,"+GPU_CreateAliasTarget",{C_POINTER},C_POINTER)
public function GPU_CreateAliasTarget(atom tar)
return c_func(xGPU_CreateAliasTarget,{tar})
end function
public constant xGPU_LoadTarget = define_c_func(gpu,"+GPU_LoadTarget",{C_POINTER},C_POINTER)
public function GPU_LoadTarget(atom tar)
return c_func(xGPU_LoadTarget,{tar})
end function
public constant xGPU_GetTarget = define_c_func(gpu,"+GPU_GetTarget",{C_POINTER},C_POINTER)
public function GPU_GetTarget(atom tar)
return c_func(xGPU_GetTarget,{tar})
end function
public constant xGPU_FreeTarget = define_c_proc(gpu,"+GPU_FreeTarget",{C_POINTER})
public procedure GPU_FreeTarget(atom tar)
c_proc(xGPU_FreeTarget,{tar})
end procedure
public constant xGPU_SetVirtualResolution = define_c_proc(gpu,"+GPU_SetVirtualResolution",{C_POINTER,C_UINT,C_UINT})
public procedure GPU_SetVirtualResolution(atom tar,atom w,atom h)
c_proc(xGPU_SetVirtualResolution,{tar,w,h})
end procedure
public constant xGPU_GetVirtualResolution = define_c_proc(gpu,"+GPU_GetVirtualResolution",{C_POINTER,C_POINTER,C_POINTER})
public procedure GPU_GetVirtualResolution(atom tar,atom w,atom h)
c_proc(xGPU_GetVirtualResolution,{tar,w,h})
end procedure
public constant xGPU_GetVirtualCoords = define_c_proc(gpu,"+GPU_GetVirtualCoords",{C_POINTER,C_POINTER,C_POINTER,C_POINTER})
public procedure GPU_GetVirtualCoords(atom tar,atom x,atom y,atom dx,atom dy)
c_proc(xGPU_GetVirtualCoords,{tar,x,y,dx,dy})