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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
|
/*
* Copyright 2011-2022 Branimir Karadzic. All rights reserved.
* License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
*/
/*
*
* AUTO GENERATED FROM IDL! DO NOT EDIT! (source : temp.bgfx.idl.inl)
*
* More info about IDL:
* https://gist.github.com/bkaradzic/05a1c86a6dd57bf86e2d828878e88dc2#bgfx-is-switching-to-idl-to-generate-api
*
*/
#define BGFX_C99_ENUM_CHECK(_enum, _c99enumcount) \
BX_STATIC_ASSERT(_enum::Count == _enum::Enum(_c99enumcount) )
BGFX_C99_ENUM_CHECK(bgfx::Fatal, BGFX_FATAL_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::RendererType, BGFX_RENDERER_TYPE_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::Attrib, BGFX_ATTRIB_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::AttribType, BGFX_ATTRIB_TYPE_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::TextureFormat, BGFX_TEXTURE_FORMAT_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::UniformType, BGFX_UNIFORM_TYPE_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::BackbufferRatio, BGFX_BACKBUFFER_RATIO_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::OcclusionQueryResult, BGFX_OCCLUSION_QUERY_RESULT_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::Topology, BGFX_TOPOLOGY_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::TopologyConvert, BGFX_TOPOLOGY_CONVERT_COUNT);
BGFX_C99_ENUM_CHECK(bgfx::RenderFrame, BGFX_RENDER_FRAME_COUNT);
#undef BGFX_C99_ENUM_CHECK
#define BGFX_C99_STRUCT_SIZE_CHECK(_cppstruct, _c99struct) \
BX_STATIC_ASSERT(sizeof(_cppstruct) == sizeof(_c99struct) )
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Memory, bgfx_memory_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Transform, bgfx_transform_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Stats, bgfx_stats_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::VertexLayout, bgfx_vertex_layout_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::TransientIndexBuffer, bgfx_transient_index_buffer_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::TransientVertexBuffer, bgfx_transient_vertex_buffer_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::InstanceDataBuffer, bgfx_instance_data_buffer_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::TextureInfo, bgfx_texture_info_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::UniformInfo, bgfx_uniform_info_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Attachment, bgfx_attachment_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Caps::GPU, bgfx_caps_gpu_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Caps::Limits, bgfx_caps_limits_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::Caps, bgfx_caps_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::PlatformData, bgfx_platform_data_t);
BGFX_C99_STRUCT_SIZE_CHECK(bgfx::InternalData, bgfx_internal_data_t);
#undef BGFX_C99_STRUCT_SIZE_CHECK
BGFX_C_API void bgfx_attachment_init(bgfx_attachment_t* _this, bgfx_texture_handle_t _handle, bgfx_access_t _access, uint16_t _layer, uint16_t _numLayers, uint16_t _mip, uint8_t _resolve)
{
bgfx::Attachment* This = (bgfx::Attachment*)_this;
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
This->init(handle.cpp, (bgfx::Access::Enum)_access, _layer, _numLayers, _mip, _resolve);
}
BGFX_C_API bgfx_vertex_layout_t* bgfx_vertex_layout_begin(bgfx_vertex_layout_t* _this, bgfx_renderer_type_t _rendererType)
{
bgfx::VertexLayout* This = (bgfx::VertexLayout*)_this;
return (bgfx_vertex_layout_t*)&This->begin((bgfx::RendererType::Enum)_rendererType);
}
BGFX_C_API bgfx_vertex_layout_t* bgfx_vertex_layout_add(bgfx_vertex_layout_t* _this, bgfx_attrib_t _attrib, uint8_t _num, bgfx_attrib_type_t _type, bool _normalized, bool _asInt)
{
bgfx::VertexLayout* This = (bgfx::VertexLayout*)_this;
return (bgfx_vertex_layout_t*)&This->add((bgfx::Attrib::Enum)_attrib, _num, (bgfx::AttribType::Enum)_type, _normalized, _asInt);
}
BGFX_C_API void bgfx_vertex_layout_decode(const bgfx_vertex_layout_t* _this, bgfx_attrib_t _attrib, uint8_t * _num, bgfx_attrib_type_t * _type, bool * _normalized, bool * _asInt)
{
const bgfx::VertexLayout* This = (const bgfx::VertexLayout*)_this;
bgfx::AttribType::Enum type;
This->decode((bgfx::Attrib::Enum)_attrib, *_num, type, *_normalized, *_asInt);
*_type = (bgfx_attrib_type_t)type;
}
BGFX_C_API bool bgfx_vertex_layout_has(const bgfx_vertex_layout_t* _this, bgfx_attrib_t _attrib)
{
const bgfx::VertexLayout* This = (const bgfx::VertexLayout*)_this;
return This->has((bgfx::Attrib::Enum)_attrib);
}
BGFX_C_API bgfx_vertex_layout_t* bgfx_vertex_layout_skip(bgfx_vertex_layout_t* _this, uint8_t _num)
{
bgfx::VertexLayout* This = (bgfx::VertexLayout*)_this;
return (bgfx_vertex_layout_t*)&This->skip(_num);
}
BGFX_C_API void bgfx_vertex_layout_end(bgfx_vertex_layout_t* _this)
{
bgfx::VertexLayout* This = (bgfx::VertexLayout*)_this;
This->end();
}
BGFX_C_API void bgfx_vertex_pack(const float _input[4], bool _inputNormalized, bgfx_attrib_t _attr, const bgfx_vertex_layout_t * _layout, void* _data, uint32_t _index)
{
const bgfx::VertexLayout & layout = *(const bgfx::VertexLayout *)_layout;
bgfx::vertexPack(_input, _inputNormalized, (bgfx::Attrib::Enum)_attr, layout, _data, _index);
}
BGFX_C_API void bgfx_vertex_unpack(float _output[4], bgfx_attrib_t _attr, const bgfx_vertex_layout_t * _layout, const void* _data, uint32_t _index)
{
const bgfx::VertexLayout & layout = *(const bgfx::VertexLayout *)_layout;
bgfx::vertexUnpack(_output, (bgfx::Attrib::Enum)_attr, layout, _data, _index);
}
BGFX_C_API void bgfx_vertex_convert(const bgfx_vertex_layout_t * _dstLayout, void* _dstData, const bgfx_vertex_layout_t * _srcLayout, const void* _srcData, uint32_t _num)
{
const bgfx::VertexLayout & dstLayout = *(const bgfx::VertexLayout *)_dstLayout;
const bgfx::VertexLayout & srcLayout = *(const bgfx::VertexLayout *)_srcLayout;
bgfx::vertexConvert(dstLayout, _dstData, srcLayout, _srcData, _num);
}
BGFX_C_API uint32_t bgfx_weld_vertices(void* _output, const bgfx_vertex_layout_t * _layout, const void* _data, uint32_t _num, bool _index32, float _epsilon)
{
const bgfx::VertexLayout & layout = *(const bgfx::VertexLayout *)_layout;
return bgfx::weldVertices(_output, layout, _data, _num, _index32, _epsilon);
}
BGFX_C_API uint32_t bgfx_topology_convert(bgfx_topology_convert_t _conversion, void* _dst, uint32_t _dstSize, const void* _indices, uint32_t _numIndices, bool _index32)
{
return bgfx::topologyConvert((bgfx::TopologyConvert::Enum)_conversion, _dst, _dstSize, _indices, _numIndices, _index32);
}
BGFX_C_API void bgfx_topology_sort_tri_list(bgfx_topology_sort_t _sort, void* _dst, uint32_t _dstSize, const float _dir[3], const float _pos[3], const void* _vertices, uint32_t _stride, const void* _indices, uint32_t _numIndices, bool _index32)
{
bgfx::topologySortTriList((bgfx::TopologySort::Enum)_sort, _dst, _dstSize, _dir, _pos, _vertices, _stride, _indices, _numIndices, _index32);
}
BGFX_C_API uint8_t bgfx_get_supported_renderers(uint8_t _max, bgfx_renderer_type_t* _enum)
{
return bgfx::getSupportedRenderers(_max, (bgfx::RendererType::Enum*)_enum);
}
BGFX_C_API const char* bgfx_get_renderer_name(bgfx_renderer_type_t _type)
{
return bgfx::getRendererName((bgfx::RendererType::Enum)_type);
}
/* BGFX_C_API void bgfx_init_ctor(bgfx_init_t* _init) */
/* BGFX_C_API bool bgfx_init(const bgfx_init_t * _init) */
BGFX_C_API void bgfx_shutdown(void)
{
bgfx::shutdown();
}
BGFX_C_API void bgfx_reset(uint32_t _width, uint32_t _height, uint32_t _flags, bgfx_texture_format_t _format)
{
bgfx::reset(_width, _height, _flags, (bgfx::TextureFormat::Enum)_format);
}
BGFX_C_API uint32_t bgfx_frame(bool _capture)
{
return bgfx::frame(_capture);
}
BGFX_C_API bgfx_renderer_type_t bgfx_get_renderer_type(void)
{
return (bgfx_renderer_type_t)bgfx::getRendererType();
}
BGFX_C_API const bgfx_caps_t* bgfx_get_caps(void)
{
return (const bgfx_caps_t*)bgfx::getCaps();
}
BGFX_C_API const bgfx_stats_t* bgfx_get_stats(void)
{
return (const bgfx_stats_t*)bgfx::getStats();
}
BGFX_C_API const bgfx_memory_t* bgfx_alloc(uint32_t _size)
{
return (const bgfx_memory_t*)bgfx::alloc(_size);
}
BGFX_C_API const bgfx_memory_t* bgfx_copy(const void* _data, uint32_t _size)
{
return (const bgfx_memory_t*)bgfx::copy(_data, _size);
}
BGFX_C_API const bgfx_memory_t* bgfx_make_ref(const void* _data, uint32_t _size)
{
return (const bgfx_memory_t*)bgfx::makeRef(_data, _size);
}
BGFX_C_API const bgfx_memory_t* bgfx_make_ref_release(const void* _data, uint32_t _size, bgfx_release_fn_t _releaseFn, void* _userData)
{
return (const bgfx_memory_t*)bgfx::makeRef(_data, _size, (bgfx::ReleaseFn)_releaseFn, _userData);
}
BGFX_C_API void bgfx_set_debug(uint32_t _debug)
{
bgfx::setDebug(_debug);
}
BGFX_C_API void bgfx_dbg_text_clear(uint8_t _attr, bool _small)
{
bgfx::dbgTextClear(_attr, _small);
}
BGFX_C_API void bgfx_dbg_text_printf(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, ... )
{
va_list argList;
va_start(argList, _format);
bgfx::dbgTextPrintfVargs(_x, _y, _attr, _format, argList);
va_end(argList);
}
BGFX_C_API void bgfx_dbg_text_vprintf(uint16_t _x, uint16_t _y, uint8_t _attr, const char* _format, va_list _argList)
{
bgfx::dbgTextPrintfVargs(_x, _y, _attr, _format, _argList);
}
BGFX_C_API void bgfx_dbg_text_image(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const void* _data, uint16_t _pitch)
{
bgfx::dbgTextImage(_x, _y, _width, _height, _data, _pitch);
}
BGFX_C_API bgfx_index_buffer_handle_t bgfx_create_index_buffer(const bgfx_memory_t* _mem, uint16_t _flags)
{
union { bgfx_index_buffer_handle_t c; bgfx::IndexBufferHandle cpp; } handle_ret;
handle_ret.cpp = bgfx::createIndexBuffer((const bgfx::Memory*)_mem, _flags);
return handle_ret.c;
}
BGFX_C_API void bgfx_set_index_buffer_name(bgfx_index_buffer_handle_t _handle, const char* _name, int32_t _len)
{
union { bgfx_index_buffer_handle_t c; bgfx::IndexBufferHandle cpp; } handle = { _handle };
bgfx::setName(handle.cpp, _name, _len);
}
BGFX_C_API void bgfx_destroy_index_buffer(bgfx_index_buffer_handle_t _handle)
{
union { bgfx_index_buffer_handle_t c; bgfx::IndexBufferHandle cpp; } handle = { _handle };
bgfx::destroy(handle.cpp);
}
BGFX_C_API bgfx_vertex_layout_handle_t bgfx_create_vertex_layout(const bgfx_vertex_layout_t * _layout)
{
const bgfx::VertexLayout & layout = *(const bgfx::VertexLayout *)_layout;
union { bgfx_vertex_layout_handle_t c; bgfx::VertexLayoutHandle cpp; } handle_ret;
handle_ret.cpp = bgfx::createVertexLayout(layout);
return handle_ret.c;
}
BGFX_C_API void bgfx_destroy_vertex_layout(bgfx_vertex_layout_handle_t _layoutHandle)
{
union { bgfx_vertex_layout_handle_t c; bgfx::VertexLayoutHandle cpp; } layoutHandle = { _layoutHandle };
bgfx::destroy(layoutHandle.cpp);
}
BGFX_C_API bgfx_vertex_buffer_handle_t bgfx_create_vertex_buffer(const bgfx_memory_t* _mem, const bgfx_vertex_layout_t * _layout, uint16_t _flags)
{
const bgfx::VertexLayout & layout = *(const bgfx::VertexLayout *)_layout;
union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle_ret;
handle_ret.cpp = bgfx::createVertexBuffer((const bgfx::Memory*)_mem, layout, _flags);
return handle_ret.c;
}
BGFX_C_API void bgfx_set_vertex_buffer_name(bgfx_vertex_buffer_handle_t _handle, const char* _name, int32_t _len)
{
union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle };
bgfx::setName(handle.cpp, _name, _len);
}
BGFX_C_API void bgfx_destroy_vertex_buffer(bgfx_vertex_buffer_handle_t _handle)
{
union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle };
bgfx::destroy(handle.cpp);
}
BGFX_C_API bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer(uint32_t _num, uint16_t _flags)
{
union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle_ret;
handle_ret.cpp = bgfx::createDynamicIndexBuffer(_num, _flags);
return handle_ret.c;
}
BGFX_C_API bgfx_dynamic_index_buffer_handle_t bgfx_create_dynamic_index_buffer_mem(const bgfx_memory_t* _mem, uint16_t _flags)
{
union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle_ret;
handle_ret.cpp = bgfx::createDynamicIndexBuffer((const bgfx::Memory*)_mem, _flags);
return handle_ret.c;
}
BGFX_C_API void bgfx_update_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _startIndex, const bgfx_memory_t* _mem)
{
union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle = { _handle };
bgfx::update(handle.cpp, _startIndex, (const bgfx::Memory*)_mem);
}
BGFX_C_API void bgfx_destroy_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle)
{
union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle = { _handle };
bgfx::destroy(handle.cpp);
}
BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer(uint32_t _num, const bgfx_vertex_layout_t* _layout, uint16_t _flags)
{
const bgfx::VertexLayout& layout = *(const bgfx::VertexLayout*)_layout;
union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle_ret;
handle_ret.cpp = bgfx::createDynamicVertexBuffer(_num, layout, _flags);
return handle_ret.c;
}
BGFX_C_API bgfx_dynamic_vertex_buffer_handle_t bgfx_create_dynamic_vertex_buffer_mem(const bgfx_memory_t* _mem, const bgfx_vertex_layout_t* _layout, uint16_t _flags)
{
const bgfx::VertexLayout& layout = *(const bgfx::VertexLayout*)_layout;
union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle_ret;
handle_ret.cpp = bgfx::createDynamicVertexBuffer((const bgfx::Memory*)_mem, layout, _flags);
return handle_ret.c;
}
BGFX_C_API void bgfx_update_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, const bgfx_memory_t* _mem)
{
union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle };
bgfx::update(handle.cpp, _startVertex, (const bgfx::Memory*)_mem);
}
BGFX_C_API void bgfx_destroy_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle)
{
union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle };
bgfx::destroy(handle.cpp);
}
BGFX_C_API uint32_t bgfx_get_avail_transient_index_buffer(uint32_t _num, bool _index32)
{
return bgfx::getAvailTransientIndexBuffer(_num, _index32);
}
BGFX_C_API uint32_t bgfx_get_avail_transient_vertex_buffer(uint32_t _num, const bgfx_vertex_layout_t * _layout)
{
const bgfx::VertexLayout & layout = *(const bgfx::VertexLayout *)_layout;
return bgfx::getAvailTransientVertexBuffer(_num, layout);
}
BGFX_C_API uint32_t bgfx_get_avail_instance_data_buffer(uint32_t _num, uint16_t _stride)
{
return bgfx::getAvailInstanceDataBuffer(_num, _stride);
}
BGFX_C_API void bgfx_alloc_transient_index_buffer(bgfx_transient_index_buffer_t* _tib, uint32_t _num, bool _index32)
{
bgfx::allocTransientIndexBuffer((bgfx::TransientIndexBuffer*)_tib, _num, _index32);
}
BGFX_C_API void bgfx_alloc_transient_vertex_buffer(bgfx_transient_vertex_buffer_t* _tvb, uint32_t _num, const bgfx_vertex_layout_t * _layout)
{
const bgfx::VertexLayout & layout = *(const bgfx::VertexLayout *)_layout;
bgfx::allocTransientVertexBuffer((bgfx::TransientVertexBuffer*)_tvb, _num, layout);
}
BGFX_C_API bool bgfx_alloc_transient_buffers(bgfx_transient_vertex_buffer_t* _tvb, const bgfx_vertex_layout_t * _layout, uint32_t _numVertices, bgfx_transient_index_buffer_t* _tib, uint32_t _numIndices, bool _index32)
{
const bgfx::VertexLayout & layout = *(const bgfx::VertexLayout *)_layout;
return bgfx::allocTransientBuffers((bgfx::TransientVertexBuffer*)_tvb, layout, _numVertices, (bgfx::TransientIndexBuffer*)_tib, _numIndices, _index32);
}
BGFX_C_API void bgfx_alloc_instance_data_buffer(bgfx_instance_data_buffer_t* _idb, uint32_t _num, uint16_t _stride)
{
bgfx::allocInstanceDataBuffer((bgfx::InstanceDataBuffer*)_idb, _num, _stride);
}
BGFX_C_API bgfx_indirect_buffer_handle_t bgfx_create_indirect_buffer(uint32_t _num)
{
union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } handle_ret;
handle_ret.cpp = bgfx::createIndirectBuffer(_num);
return handle_ret.c;
}
BGFX_C_API void bgfx_destroy_indirect_buffer(bgfx_indirect_buffer_handle_t _handle)
{
union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } handle = { _handle };
bgfx::destroy(handle.cpp);
}
BGFX_C_API bgfx_shader_handle_t bgfx_create_shader(const bgfx_memory_t* _mem)
{
union { bgfx_shader_handle_t c; bgfx::ShaderHandle cpp; } handle_ret;
handle_ret.cpp = bgfx::createShader((const bgfx::Memory*)_mem);
return handle_ret.c;
}
BGFX_C_API uint16_t bgfx_get_shader_uniforms(bgfx_shader_handle_t _handle, bgfx_uniform_handle_t* _uniforms, uint16_t _max)
{
union { bgfx_shader_handle_t c; bgfx::ShaderHandle cpp; } handle = { _handle };
return bgfx::getShaderUniforms(handle.cpp, (bgfx::UniformHandle*)_uniforms, _max);
}
BGFX_C_API void bgfx_set_shader_name(bgfx_shader_handle_t _handle, const char* _name, int32_t _len)
{
union { bgfx_shader_handle_t c; bgfx::ShaderHandle cpp; } handle = { _handle };
bgfx::setName(handle.cpp, _name, _len);
}
BGFX_C_API void bgfx_destroy_shader(bgfx_shader_handle_t _handle)
{
union { bgfx_shader_handle_t c; bgfx::ShaderHandle cpp; } handle = { _handle };
bgfx::destroy(handle.cpp);
}
BGFX_C_API bgfx_program_handle_t bgfx_create_program(bgfx_shader_handle_t _vsh, bgfx_shader_handle_t _fsh, bool _destroyShaders)
{
union { bgfx_shader_handle_t c; bgfx::ShaderHandle cpp; } vsh = { _vsh };
union { bgfx_shader_handle_t c; bgfx::ShaderHandle cpp; } fsh = { _fsh };
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle_ret;
handle_ret.cpp = bgfx::createProgram(vsh.cpp, fsh.cpp, _destroyShaders);
return handle_ret.c;
}
BGFX_C_API bgfx_program_handle_t bgfx_create_compute_program(bgfx_shader_handle_t _csh, bool _destroyShaders)
{
union { bgfx_shader_handle_t c; bgfx::ShaderHandle cpp; } csh = { _csh };
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle_ret;
handle_ret.cpp = bgfx::createProgram(csh.cpp, _destroyShaders);
return handle_ret.c;
}
BGFX_C_API void bgfx_destroy_program(bgfx_program_handle_t _handle)
{
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } handle = { _handle };
bgfx::destroy(handle.cpp);
}
BGFX_C_API bool bgfx_is_texture_valid(uint16_t _depth, bool _cubeMap, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags)
{
return bgfx::isTextureValid(_depth, _cubeMap, _numLayers, (bgfx::TextureFormat::Enum)_format, _flags);
}
BGFX_C_API bool bgfx_is_frame_buffer_valid(uint8_t _num, const bgfx_attachment_t* _attachment)
{
return bgfx::isFrameBufferValid(_num, (const bgfx::Attachment*)_attachment);
}
BGFX_C_API void bgfx_calc_texture_size(bgfx_texture_info_t * _info, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format)
{
bgfx::TextureInfo & info = *(bgfx::TextureInfo *)_info;
bgfx::calcTextureSize(info, _width, _height, _depth, _cubeMap, _hasMips, _numLayers, (bgfx::TextureFormat::Enum)_format);
}
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture(const bgfx_memory_t* _mem, uint64_t _flags, uint8_t _skip, bgfx_texture_info_t* _info)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle_ret;
handle_ret.cpp = bgfx::createTexture((const bgfx::Memory*)_mem, _flags, _skip, (bgfx::TextureInfo*)_info);
return handle_ret.c;
}
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d(uint16_t _width, uint16_t _height, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t* _mem)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle_ret;
handle_ret.cpp = bgfx::createTexture2D(_width, _height, _hasMips, _numLayers, (bgfx::TextureFormat::Enum)_format, _flags, (const bgfx::Memory*)_mem);
return handle_ret.c;
}
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_2d_scaled(bgfx_backbuffer_ratio_t _ratio, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle_ret;
handle_ret.cpp = bgfx::createTexture2D((bgfx::BackbufferRatio::Enum)_ratio, _hasMips, _numLayers, (bgfx::TextureFormat::Enum)_format, _flags);
return handle_ret.c;
}
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_3d(uint16_t _width, uint16_t _height, uint16_t _depth, bool _hasMips, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t* _mem)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle_ret;
handle_ret.cpp = bgfx::createTexture3D(_width, _height, _depth, _hasMips, (bgfx::TextureFormat::Enum)_format, _flags, (const bgfx::Memory*)_mem);
return handle_ret.c;
}
BGFX_C_API bgfx_texture_handle_t bgfx_create_texture_cube(uint16_t _size, bool _hasMips, uint16_t _numLayers, bgfx_texture_format_t _format, uint64_t _flags, const bgfx_memory_t* _mem)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle_ret;
handle_ret.cpp = bgfx::createTextureCube(_size, _hasMips, _numLayers, (bgfx::TextureFormat::Enum)_format, _flags, (const bgfx::Memory*)_mem);
return handle_ret.c;
}
BGFX_C_API void bgfx_update_texture_2d(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
bgfx::updateTexture2D(handle.cpp, _layer, _mip, _x, _y, _width, _height, (const bgfx::Memory*)_mem, _pitch);
}
BGFX_C_API void bgfx_update_texture_3d(bgfx_texture_handle_t _handle, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _z, uint16_t _width, uint16_t _height, uint16_t _depth, const bgfx_memory_t* _mem)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
bgfx::updateTexture3D(handle.cpp, _mip, _x, _y, _z, _width, _height, _depth, (const bgfx::Memory*)_mem);
}
BGFX_C_API void bgfx_update_texture_cube(bgfx_texture_handle_t _handle, uint16_t _layer, uint8_t _side, uint8_t _mip, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height, const bgfx_memory_t* _mem, uint16_t _pitch)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
bgfx::updateTextureCube(handle.cpp, _layer, _side, _mip, _x, _y, _width, _height, (const bgfx::Memory*)_mem, _pitch);
}
BGFX_C_API uint32_t bgfx_read_texture(bgfx_texture_handle_t _handle, void* _data, uint8_t _mip)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
return bgfx::readTexture(handle.cpp, _data, _mip);
}
BGFX_C_API void bgfx_set_texture_name(bgfx_texture_handle_t _handle, const char* _name, int32_t _len)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
bgfx::setName(handle.cpp, _name, _len);
}
BGFX_C_API void* bgfx_get_direct_access_ptr(bgfx_texture_handle_t _handle)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
return bgfx::getDirectAccessPtr(handle.cpp);
}
BGFX_C_API void bgfx_destroy_texture(bgfx_texture_handle_t _handle)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
bgfx::destroy(handle.cpp);
}
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer(uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, uint64_t _textureFlags)
{
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle_ret;
handle_ret.cpp = bgfx::createFrameBuffer(_width, _height, (bgfx::TextureFormat::Enum)_format, _textureFlags);
return handle_ret.c;
}
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_scaled(bgfx_backbuffer_ratio_t _ratio, bgfx_texture_format_t _format, uint64_t _textureFlags)
{
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle_ret;
handle_ret.cpp = bgfx::createFrameBuffer((bgfx::BackbufferRatio::Enum)_ratio, (bgfx::TextureFormat::Enum)_format, _textureFlags);
return handle_ret.c;
}
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_handles(uint8_t _num, const bgfx_texture_handle_t* _handles, bool _destroyTexture)
{
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle_ret;
handle_ret.cpp = bgfx::createFrameBuffer(_num, (const bgfx::TextureHandle*)_handles, _destroyTexture);
return handle_ret.c;
}
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_attachment(uint8_t _num, const bgfx_attachment_t* _attachment, bool _destroyTexture)
{
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle_ret;
handle_ret.cpp = bgfx::createFrameBuffer(_num, (const bgfx::Attachment*)_attachment, _destroyTexture);
return handle_ret.c;
}
BGFX_C_API bgfx_frame_buffer_handle_t bgfx_create_frame_buffer_from_nwh(void* _nwh, uint16_t _width, uint16_t _height, bgfx_texture_format_t _format, bgfx_texture_format_t _depthFormat)
{
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle_ret;
handle_ret.cpp = bgfx::createFrameBuffer(_nwh, _width, _height, (bgfx::TextureFormat::Enum)_format, (bgfx::TextureFormat::Enum)_depthFormat);
return handle_ret.c;
}
BGFX_C_API void bgfx_set_frame_buffer_name(bgfx_frame_buffer_handle_t _handle, const char* _name, int32_t _len)
{
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle = { _handle };
bgfx::setName(handle.cpp, _name, _len);
}
BGFX_C_API bgfx_texture_handle_t bgfx_get_texture(bgfx_frame_buffer_handle_t _handle, uint8_t _attachment)
{
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle = { _handle };
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle_ret;
handle_ret.cpp = bgfx::getTexture(handle.cpp, _attachment);
return handle_ret.c;
}
BGFX_C_API void bgfx_destroy_frame_buffer(bgfx_frame_buffer_handle_t _handle)
{
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle = { _handle };
bgfx::destroy(handle.cpp);
}
BGFX_C_API bgfx_uniform_handle_t bgfx_create_uniform(const char* _name, bgfx_uniform_type_t _type, uint16_t _num)
{
union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } handle_ret;
handle_ret.cpp = bgfx::createUniform(_name, (bgfx::UniformType::Enum)_type, _num);
return handle_ret.c;
}
BGFX_C_API void bgfx_get_uniform_info(bgfx_uniform_handle_t _handle, bgfx_uniform_info_t * _info)
{
union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } handle = { _handle };
bgfx::UniformInfo & info = *(bgfx::UniformInfo *)_info;
bgfx::getUniformInfo(handle.cpp, info);
}
BGFX_C_API void bgfx_destroy_uniform(bgfx_uniform_handle_t _handle)
{
union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } handle = { _handle };
bgfx::destroy(handle.cpp);
}
BGFX_C_API bgfx_occlusion_query_handle_t bgfx_create_occlusion_query(void)
{
union { bgfx_occlusion_query_handle_t c; bgfx::OcclusionQueryHandle cpp; } handle_ret;
handle_ret.cpp = bgfx::createOcclusionQuery();
return handle_ret.c;
}
BGFX_C_API bgfx_occlusion_query_result_t bgfx_get_result(bgfx_occlusion_query_handle_t _handle, int32_t* _result)
{
union { bgfx_occlusion_query_handle_t c; bgfx::OcclusionQueryHandle cpp; } handle = { _handle };
return (bgfx_occlusion_query_result_t)bgfx::getResult(handle.cpp, _result);
}
BGFX_C_API void bgfx_destroy_occlusion_query(bgfx_occlusion_query_handle_t _handle)
{
union { bgfx_occlusion_query_handle_t c; bgfx::OcclusionQueryHandle cpp; } handle = { _handle };
bgfx::destroy(handle.cpp);
}
BGFX_C_API void bgfx_set_palette_color(uint8_t _index, const float _rgba[4])
{
bgfx::setPaletteColor(_index, _rgba);
}
BGFX_C_API void bgfx_set_palette_color_rgba8(uint8_t _index, uint32_t _rgba)
{
bgfx::setPaletteColor(_index, _rgba);
}
BGFX_C_API void bgfx_set_view_name(bgfx_view_id_t _id, const char* _name)
{
bgfx::setViewName((bgfx::ViewId)_id, _name);
}
BGFX_C_API void bgfx_set_view_rect(bgfx_view_id_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
{
bgfx::setViewRect((bgfx::ViewId)_id, _x, _y, _width, _height);
}
BGFX_C_API void bgfx_set_view_rect_ratio(bgfx_view_id_t _id, uint16_t _x, uint16_t _y, bgfx_backbuffer_ratio_t _ratio)
{
bgfx::setViewRect((bgfx::ViewId)_id, _x, _y, (bgfx::BackbufferRatio::Enum)_ratio);
}
BGFX_C_API void bgfx_set_view_scissor(bgfx_view_id_t _id, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
{
bgfx::setViewScissor((bgfx::ViewId)_id, _x, _y, _width, _height);
}
BGFX_C_API void bgfx_set_view_clear(bgfx_view_id_t _id, uint16_t _flags, uint32_t _rgba, float _depth, uint8_t _stencil)
{
bgfx::setViewClear((bgfx::ViewId)_id, _flags, _rgba, _depth, _stencil);
}
BGFX_C_API void bgfx_set_view_clear_mrt(bgfx_view_id_t _id, uint16_t _flags, float _depth, uint8_t _stencil, uint8_t _c0, uint8_t _c1, uint8_t _c2, uint8_t _c3, uint8_t _c4, uint8_t _c5, uint8_t _c6, uint8_t _c7)
{
bgfx::setViewClear((bgfx::ViewId)_id, _flags, _depth, _stencil, _c0, _c1, _c2, _c3, _c4, _c5, _c6, _c7);
}
BGFX_C_API void bgfx_set_view_mode(bgfx_view_id_t _id, bgfx_view_mode_t _mode)
{
bgfx::setViewMode((bgfx::ViewId)_id, (bgfx::ViewMode::Enum)_mode);
}
BGFX_C_API void bgfx_set_view_frame_buffer(bgfx_view_id_t _id, bgfx_frame_buffer_handle_t _handle)
{
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle = { _handle };
bgfx::setViewFrameBuffer((bgfx::ViewId)_id, handle.cpp);
}
BGFX_C_API void bgfx_set_view_transform(bgfx_view_id_t _id, const void* _view, const void* _proj)
{
bgfx::setViewTransform((bgfx::ViewId)_id, _view, _proj);
}
BGFX_C_API void bgfx_set_view_order(bgfx_view_id_t _id, uint16_t _num, const bgfx_view_id_t* _order)
{
bgfx::setViewOrder((bgfx::ViewId)_id, _num, (const bgfx::ViewId*)_order);
}
BGFX_C_API void bgfx_reset_view(bgfx_view_id_t _id)
{
bgfx::resetView((bgfx::ViewId)_id);
}
BGFX_C_API bgfx_encoder_t* bgfx_encoder_begin(bool _forThread)
{
return (bgfx_encoder_t*)bgfx::begin(_forThread);
}
BGFX_C_API void bgfx_encoder_end(bgfx_encoder_t* _encoder)
{
bgfx::end((bgfx::Encoder*)_encoder);
}
BGFX_C_API void bgfx_encoder_set_marker(bgfx_encoder_t* _this, const char* _marker)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
This->setMarker(_marker);
}
BGFX_C_API void bgfx_encoder_set_state(bgfx_encoder_t* _this, uint64_t _state, uint32_t _rgba)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
This->setState(_state, _rgba);
}
BGFX_C_API void bgfx_encoder_set_condition(bgfx_encoder_t* _this, bgfx_occlusion_query_handle_t _handle, bool _visible)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_occlusion_query_handle_t c; bgfx::OcclusionQueryHandle cpp; } handle = { _handle };
This->setCondition(handle.cpp, _visible);
}
BGFX_C_API void bgfx_encoder_set_stencil(bgfx_encoder_t* _this, uint32_t _fstencil, uint32_t _bstencil)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
This->setStencil(_fstencil, _bstencil);
}
BGFX_C_API uint16_t bgfx_encoder_set_scissor(bgfx_encoder_t* _this, uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
return This->setScissor(_x, _y, _width, _height);
}
BGFX_C_API void bgfx_encoder_set_scissor_cached(bgfx_encoder_t* _this, uint16_t _cache)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
This->setScissor(_cache);
}
BGFX_C_API uint32_t bgfx_encoder_set_transform(bgfx_encoder_t* _this, const void* _mtx, uint16_t _num)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
return This->setTransform(_mtx, _num);
}
BGFX_C_API void bgfx_encoder_set_transform_cached(bgfx_encoder_t* _this, uint32_t _cache, uint16_t _num)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
This->setTransform(_cache, _num);
}
BGFX_C_API uint32_t bgfx_encoder_alloc_transform(bgfx_encoder_t* _this, bgfx_transform_t* _transform, uint16_t _num)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
return This->allocTransform((bgfx::Transform*)_transform, _num);
}
BGFX_C_API void bgfx_encoder_set_uniform(bgfx_encoder_t* _this, bgfx_uniform_handle_t _handle, const void* _value, uint16_t _num)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } handle = { _handle };
This->setUniform(handle.cpp, _value, _num);
}
BGFX_C_API void bgfx_encoder_set_index_buffer(bgfx_encoder_t* _this, bgfx_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_index_buffer_handle_t c; bgfx::IndexBufferHandle cpp; } handle = { _handle };
This->setIndexBuffer(handle.cpp, _firstIndex, _numIndices);
}
BGFX_C_API void bgfx_encoder_set_dynamic_index_buffer(bgfx_encoder_t* _this, bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle = { _handle };
This->setIndexBuffer(handle.cpp, _firstIndex, _numIndices);
}
BGFX_C_API void bgfx_encoder_set_transient_index_buffer(bgfx_encoder_t* _this, const bgfx_transient_index_buffer_t* _tib, uint32_t _firstIndex, uint32_t _numIndices)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
This->setIndexBuffer((const bgfx::TransientIndexBuffer*)_tib, _firstIndex, _numIndices);
}
BGFX_C_API void bgfx_encoder_set_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle };
This->setVertexBuffer(_stream, handle.cpp, _startVertex, _numVertices);
}
BGFX_C_API void bgfx_encoder_set_vertex_buffer_with_layout(bgfx_encoder_t* _this, uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices, bgfx_vertex_layout_handle_t _layoutHandle)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle };
union { bgfx_vertex_layout_handle_t c; bgfx::VertexLayoutHandle cpp; } layoutHandle = { _layoutHandle };
This->setVertexBuffer(_stream, handle.cpp, _startVertex, _numVertices, layoutHandle.cpp);
}
BGFX_C_API void bgfx_encoder_set_dynamic_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle };
This->setVertexBuffer(_stream, handle.cpp, _startVertex, _numVertices);
}
BGFX_C_API void bgfx_encoder_set_dynamic_vertex_buffer_with_layout(bgfx_encoder_t* _this, uint8_t _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices, bgfx_vertex_layout_handle_t _layoutHandle)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle };
union { bgfx_vertex_layout_handle_t c; bgfx::VertexLayoutHandle cpp; } layoutHandle = { _layoutHandle };
This->setVertexBuffer(_stream, handle.cpp, _startVertex, _numVertices, layoutHandle.cpp);
}
BGFX_C_API void bgfx_encoder_set_transient_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stream, const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
This->setVertexBuffer(_stream, (const bgfx::TransientVertexBuffer*)_tvb, _startVertex, _numVertices);
}
BGFX_C_API void bgfx_encoder_set_transient_vertex_buffer_with_layout(bgfx_encoder_t* _this, uint8_t _stream, const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices, bgfx_vertex_layout_handle_t _layoutHandle)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_vertex_layout_handle_t c; bgfx::VertexLayoutHandle cpp; } layoutHandle = { _layoutHandle };
This->setVertexBuffer(_stream, (const bgfx::TransientVertexBuffer*)_tvb, _startVertex, _numVertices, layoutHandle.cpp);
}
BGFX_C_API void bgfx_encoder_set_vertex_count(bgfx_encoder_t* _this, uint32_t _numVertices)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
This->setVertexCount(_numVertices);
}
BGFX_C_API void bgfx_encoder_set_instance_data_buffer(bgfx_encoder_t* _this, const bgfx_instance_data_buffer_t* _idb, uint32_t _start, uint32_t _num)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
This->setInstanceDataBuffer((const bgfx::InstanceDataBuffer*)_idb, _start, _num);
}
BGFX_C_API void bgfx_encoder_set_instance_data_from_vertex_buffer(bgfx_encoder_t* _this, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle };
This->setInstanceDataBuffer(handle.cpp, _startVertex, _num);
}
BGFX_C_API void bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer(bgfx_encoder_t* _this, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle };
This->setInstanceDataBuffer(handle.cpp, _startVertex, _num);
}
BGFX_C_API void bgfx_encoder_set_instance_count(bgfx_encoder_t* _this, uint32_t _numInstances)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
This->setInstanceCount(_numInstances);
}
BGFX_C_API void bgfx_encoder_set_texture(bgfx_encoder_t* _this, uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } sampler = { _sampler };
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
This->setTexture(_stage, sampler.cpp, handle.cpp, _flags);
}
BGFX_C_API void bgfx_encoder_touch(bgfx_encoder_t* _this, bgfx_view_id_t _id)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
This->touch((bgfx::ViewId)_id);
}
BGFX_C_API void bgfx_encoder_submit(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _depth, uint8_t _flags)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program };
This->submit((bgfx::ViewId)_id, program.cpp, _depth, _flags);
}
BGFX_C_API void bgfx_encoder_submit_occlusion_query(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint32_t _depth, uint8_t _flags)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program };
union { bgfx_occlusion_query_handle_t c; bgfx::OcclusionQueryHandle cpp; } occlusionQuery = { _occlusionQuery };
This->submit((bgfx::ViewId)_id, program.cpp, occlusionQuery.cpp, _depth, _flags);
}
BGFX_C_API void bgfx_encoder_submit_indirect(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint32_t _depth, uint8_t _flags)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program };
union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } indirectHandle = { _indirectHandle };
This->submit((bgfx::ViewId)_id, program.cpp, indirectHandle.cpp, _start, _num, _depth, _flags);
}
BGFX_C_API void bgfx_encoder_submit_indirect_count(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, bgfx_index_buffer_handle_t _numHandle, uint32_t _numIndex, uint16_t _numMax, uint32_t _depth, uint8_t _flags)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program };
union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } indirectHandle = { _indirectHandle };
union { bgfx_index_buffer_handle_t c; bgfx::IndexBufferHandle cpp; } numHandle = { _numHandle };
This->submit((bgfx::ViewId)_id, program.cpp, indirectHandle.cpp, _start, numHandle.cpp, _numIndex, _numMax, _depth, _flags);
}
BGFX_C_API void bgfx_encoder_set_compute_index_buffer(bgfx_encoder_t* _this, uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_index_buffer_handle_t c; bgfx::IndexBufferHandle cpp; } handle = { _handle };
This->setBuffer(_stage, handle.cpp, (bgfx::Access::Enum)_access);
}
BGFX_C_API void bgfx_encoder_set_compute_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle };
This->setBuffer(_stage, handle.cpp, (bgfx::Access::Enum)_access);
}
BGFX_C_API void bgfx_encoder_set_compute_dynamic_index_buffer(bgfx_encoder_t* _this, uint8_t _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle = { _handle };
This->setBuffer(_stage, handle.cpp, (bgfx::Access::Enum)_access);
}
BGFX_C_API void bgfx_encoder_set_compute_dynamic_vertex_buffer(bgfx_encoder_t* _this, uint8_t _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle };
This->setBuffer(_stage, handle.cpp, (bgfx::Access::Enum)_access);
}
BGFX_C_API void bgfx_encoder_set_compute_indirect_buffer(bgfx_encoder_t* _this, uint8_t _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } handle = { _handle };
This->setBuffer(_stage, handle.cpp, (bgfx::Access::Enum)_access);
}
BGFX_C_API void bgfx_encoder_set_image(bgfx_encoder_t* _this, uint8_t _stage, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
This->setImage(_stage, handle.cpp, _mip, (bgfx::Access::Enum)_access, (bgfx::TextureFormat::Enum)_format);
}
BGFX_C_API void bgfx_encoder_dispatch(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program };
This->dispatch((bgfx::ViewId)_id, program.cpp, _numX, _numY, _numZ, _flags);
}
BGFX_C_API void bgfx_encoder_dispatch_indirect(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program };
union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } indirectHandle = { _indirectHandle };
This->dispatch((bgfx::ViewId)_id, program.cpp, indirectHandle.cpp, _start, _num, _flags);
}
BGFX_C_API void bgfx_encoder_discard(bgfx_encoder_t* _this, uint8_t _flags)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
This->discard(_flags);
}
BGFX_C_API void bgfx_encoder_blit(bgfx_encoder_t* _this, bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth)
{
bgfx::Encoder* This = (bgfx::Encoder*)_this;
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } dst = { _dst };
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } src = { _src };
This->blit((bgfx::ViewId)_id, dst.cpp, _dstMip, _dstX, _dstY, _dstZ, src.cpp, _srcMip, _srcX, _srcY, _srcZ, _width, _height, _depth);
}
BGFX_C_API void bgfx_request_screen_shot(bgfx_frame_buffer_handle_t _handle, const char* _filePath)
{
union { bgfx_frame_buffer_handle_t c; bgfx::FrameBufferHandle cpp; } handle = { _handle };
bgfx::requestScreenShot(handle.cpp, _filePath);
}
BGFX_C_API bgfx_render_frame_t bgfx_render_frame(int32_t _msecs)
{
return (bgfx_render_frame_t)bgfx::renderFrame(_msecs);
}
BGFX_C_API void bgfx_set_platform_data(const bgfx_platform_data_t * _data)
{
const bgfx::PlatformData & data = *(const bgfx::PlatformData *)_data;
bgfx::setPlatformData(data);
}
BGFX_C_API const bgfx_internal_data_t* bgfx_get_internal_data(void)
{
return (const bgfx_internal_data_t*)bgfx::getInternalData();
}
BGFX_C_API uintptr_t bgfx_override_internal_texture_ptr(bgfx_texture_handle_t _handle, uintptr_t _ptr)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
return bgfx::overrideInternal(handle.cpp, _ptr);
}
BGFX_C_API uintptr_t bgfx_override_internal_texture(bgfx_texture_handle_t _handle, uint16_t _width, uint16_t _height, uint8_t _numMips, bgfx_texture_format_t _format, uint64_t _flags)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
return bgfx::overrideInternal(handle.cpp, _width, _height, _numMips, (bgfx::TextureFormat::Enum)_format, _flags);
}
BGFX_C_API void bgfx_set_marker(const char* _marker)
{
bgfx::setMarker(_marker);
}
BGFX_C_API void bgfx_set_state(uint64_t _state, uint32_t _rgba)
{
bgfx::setState(_state, _rgba);
}
BGFX_C_API void bgfx_set_condition(bgfx_occlusion_query_handle_t _handle, bool _visible)
{
union { bgfx_occlusion_query_handle_t c; bgfx::OcclusionQueryHandle cpp; } handle = { _handle };
bgfx::setCondition(handle.cpp, _visible);
}
BGFX_C_API void bgfx_set_stencil(uint32_t _fstencil, uint32_t _bstencil)
{
bgfx::setStencil(_fstencil, _bstencil);
}
BGFX_C_API uint16_t bgfx_set_scissor(uint16_t _x, uint16_t _y, uint16_t _width, uint16_t _height)
{
return bgfx::setScissor(_x, _y, _width, _height);
}
BGFX_C_API void bgfx_set_scissor_cached(uint16_t _cache)
{
bgfx::setScissor(_cache);
}
BGFX_C_API uint32_t bgfx_set_transform(const void* _mtx, uint16_t _num)
{
return bgfx::setTransform(_mtx, _num);
}
BGFX_C_API void bgfx_set_transform_cached(uint32_t _cache, uint16_t _num)
{
bgfx::setTransform(_cache, _num);
}
BGFX_C_API uint32_t bgfx_alloc_transform(bgfx_transform_t* _transform, uint16_t _num)
{
return bgfx::allocTransform((bgfx::Transform*)_transform, _num);
}
BGFX_C_API void bgfx_set_uniform(bgfx_uniform_handle_t _handle, const void* _value, uint16_t _num)
{
union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } handle = { _handle };
bgfx::setUniform(handle.cpp, _value, _num);
}
BGFX_C_API void bgfx_set_index_buffer(bgfx_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices)
{
union { bgfx_index_buffer_handle_t c; bgfx::IndexBufferHandle cpp; } handle = { _handle };
bgfx::setIndexBuffer(handle.cpp, _firstIndex, _numIndices);
}
BGFX_C_API void bgfx_set_dynamic_index_buffer(bgfx_dynamic_index_buffer_handle_t _handle, uint32_t _firstIndex, uint32_t _numIndices)
{
union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle = { _handle };
bgfx::setIndexBuffer(handle.cpp, _firstIndex, _numIndices);
}
BGFX_C_API void bgfx_set_transient_index_buffer(const bgfx_transient_index_buffer_t* _tib, uint32_t _firstIndex, uint32_t _numIndices)
{
bgfx::setIndexBuffer((const bgfx::TransientIndexBuffer*)_tib, _firstIndex, _numIndices);
}
BGFX_C_API void bgfx_set_vertex_buffer(uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices)
{
union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle };
bgfx::setVertexBuffer(_stream, handle.cpp, _startVertex, _numVertices);
}
BGFX_C_API void bgfx_set_vertex_buffer_with_layout(uint8_t _stream, bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices, bgfx_vertex_layout_handle_t _layoutHandle)
{
union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle };
union { bgfx_vertex_layout_handle_t c; bgfx::VertexLayoutHandle cpp; } layoutHandle = { _layoutHandle };
bgfx::setVertexBuffer(_stream, handle.cpp, _startVertex, _numVertices, layoutHandle.cpp);
}
BGFX_C_API void bgfx_set_dynamic_vertex_buffer(uint8_t _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices)
{
union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle };
bgfx::setVertexBuffer(_stream, handle.cpp, _startVertex, _numVertices);
}
BGFX_C_API void bgfx_set_dynamic_vertex_buffer_with_layout(uint8_t _stream, bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _numVertices, bgfx_vertex_layout_handle_t _layoutHandle)
{
union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle };
union { bgfx_vertex_layout_handle_t c; bgfx::VertexLayoutHandle cpp; } layoutHandle = { _layoutHandle };
bgfx::setVertexBuffer(_stream, handle.cpp, _startVertex, _numVertices, layoutHandle.cpp);
}
BGFX_C_API void bgfx_set_transient_vertex_buffer(uint8_t _stream, const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices)
{
bgfx::setVertexBuffer(_stream, (const bgfx::TransientVertexBuffer*)_tvb, _startVertex, _numVertices);
}
BGFX_C_API void bgfx_set_transient_vertex_buffer_with_layout(uint8_t _stream, const bgfx_transient_vertex_buffer_t* _tvb, uint32_t _startVertex, uint32_t _numVertices, bgfx_vertex_layout_handle_t _layoutHandle)
{
union { bgfx_vertex_layout_handle_t c; bgfx::VertexLayoutHandle cpp; } layoutHandle = { _layoutHandle };
bgfx::setVertexBuffer(_stream, (const bgfx::TransientVertexBuffer*)_tvb, _startVertex, _numVertices, layoutHandle.cpp);
}
BGFX_C_API void bgfx_set_vertex_count(uint32_t _numVertices)
{
bgfx::setVertexCount(_numVertices);
}
BGFX_C_API void bgfx_set_instance_data_buffer(const bgfx_instance_data_buffer_t* _idb, uint32_t _start, uint32_t _num)
{
bgfx::setInstanceDataBuffer((const bgfx::InstanceDataBuffer*)_idb, _start, _num);
}
BGFX_C_API void bgfx_set_instance_data_from_vertex_buffer(bgfx_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num)
{
union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle };
bgfx::setInstanceDataBuffer(handle.cpp, _startVertex, _num);
}
BGFX_C_API void bgfx_set_instance_data_from_dynamic_vertex_buffer(bgfx_dynamic_vertex_buffer_handle_t _handle, uint32_t _startVertex, uint32_t _num)
{
union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle };
bgfx::setInstanceDataBuffer(handle.cpp, _startVertex, _num);
}
BGFX_C_API void bgfx_set_instance_count(uint32_t _numInstances)
{
bgfx::setInstanceCount(_numInstances);
}
BGFX_C_API void bgfx_set_texture(uint8_t _stage, bgfx_uniform_handle_t _sampler, bgfx_texture_handle_t _handle, uint32_t _flags)
{
union { bgfx_uniform_handle_t c; bgfx::UniformHandle cpp; } sampler = { _sampler };
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
bgfx::setTexture(_stage, sampler.cpp, handle.cpp, _flags);
}
BGFX_C_API void bgfx_touch(bgfx_view_id_t _id)
{
bgfx::touch((bgfx::ViewId)_id);
}
BGFX_C_API void bgfx_submit(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _depth, uint8_t _flags)
{
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program };
bgfx::submit((bgfx::ViewId)_id, program.cpp, _depth, _flags);
}
BGFX_C_API void bgfx_submit_occlusion_query(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_occlusion_query_handle_t _occlusionQuery, uint32_t _depth, uint8_t _flags)
{
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program };
union { bgfx_occlusion_query_handle_t c; bgfx::OcclusionQueryHandle cpp; } occlusionQuery = { _occlusionQuery };
bgfx::submit((bgfx::ViewId)_id, program.cpp, occlusionQuery.cpp, _depth, _flags);
}
BGFX_C_API void bgfx_submit_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint32_t _depth, uint8_t _flags)
{
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program };
union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } indirectHandle = { _indirectHandle };
bgfx::submit((bgfx::ViewId)_id, program.cpp, indirectHandle.cpp, _start, _num, _depth, _flags);
}
BGFX_C_API void bgfx_submit_indirect_count(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, bgfx_index_buffer_handle_t _numHandle, uint32_t _numIndex, uint16_t _numMax, uint32_t _depth, uint8_t _flags)
{
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program };
union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } indirectHandle = { _indirectHandle };
union { bgfx_index_buffer_handle_t c; bgfx::IndexBufferHandle cpp; } numHandle = { _numHandle };
bgfx::submit((bgfx::ViewId)_id, program.cpp, indirectHandle.cpp, _start, numHandle.cpp, _numIndex, _numMax, _depth, _flags);
}
BGFX_C_API void bgfx_set_compute_index_buffer(uint8_t _stage, bgfx_index_buffer_handle_t _handle, bgfx_access_t _access)
{
union { bgfx_index_buffer_handle_t c; bgfx::IndexBufferHandle cpp; } handle = { _handle };
bgfx::setBuffer(_stage, handle.cpp, (bgfx::Access::Enum)_access);
}
BGFX_C_API void bgfx_set_compute_vertex_buffer(uint8_t _stage, bgfx_vertex_buffer_handle_t _handle, bgfx_access_t _access)
{
union { bgfx_vertex_buffer_handle_t c; bgfx::VertexBufferHandle cpp; } handle = { _handle };
bgfx::setBuffer(_stage, handle.cpp, (bgfx::Access::Enum)_access);
}
BGFX_C_API void bgfx_set_compute_dynamic_index_buffer(uint8_t _stage, bgfx_dynamic_index_buffer_handle_t _handle, bgfx_access_t _access)
{
union { bgfx_dynamic_index_buffer_handle_t c; bgfx::DynamicIndexBufferHandle cpp; } handle = { _handle };
bgfx::setBuffer(_stage, handle.cpp, (bgfx::Access::Enum)_access);
}
BGFX_C_API void bgfx_set_compute_dynamic_vertex_buffer(uint8_t _stage, bgfx_dynamic_vertex_buffer_handle_t _handle, bgfx_access_t _access)
{
union { bgfx_dynamic_vertex_buffer_handle_t c; bgfx::DynamicVertexBufferHandle cpp; } handle = { _handle };
bgfx::setBuffer(_stage, handle.cpp, (bgfx::Access::Enum)_access);
}
BGFX_C_API void bgfx_set_compute_indirect_buffer(uint8_t _stage, bgfx_indirect_buffer_handle_t _handle, bgfx_access_t _access)
{
union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } handle = { _handle };
bgfx::setBuffer(_stage, handle.cpp, (bgfx::Access::Enum)_access);
}
BGFX_C_API void bgfx_set_image(uint8_t _stage, bgfx_texture_handle_t _handle, uint8_t _mip, bgfx_access_t _access, bgfx_texture_format_t _format)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } handle = { _handle };
bgfx::setImage(_stage, handle.cpp, _mip, (bgfx::Access::Enum)_access, (bgfx::TextureFormat::Enum)_format);
}
BGFX_C_API void bgfx_dispatch(bgfx_view_id_t _id, bgfx_program_handle_t _program, uint32_t _numX, uint32_t _numY, uint32_t _numZ, uint8_t _flags)
{
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program };
bgfx::dispatch((bgfx::ViewId)_id, program.cpp, _numX, _numY, _numZ, _flags);
}
BGFX_C_API void bgfx_dispatch_indirect(bgfx_view_id_t _id, bgfx_program_handle_t _program, bgfx_indirect_buffer_handle_t _indirectHandle, uint16_t _start, uint16_t _num, uint8_t _flags)
{
union { bgfx_program_handle_t c; bgfx::ProgramHandle cpp; } program = { _program };
union { bgfx_indirect_buffer_handle_t c; bgfx::IndirectBufferHandle cpp; } indirectHandle = { _indirectHandle };
bgfx::dispatch((bgfx::ViewId)_id, program.cpp, indirectHandle.cpp, _start, _num, _flags);
}
BGFX_C_API void bgfx_discard(uint8_t _flags)
{
bgfx::discard(_flags);
}
BGFX_C_API void bgfx_blit(bgfx_view_id_t _id, bgfx_texture_handle_t _dst, uint8_t _dstMip, uint16_t _dstX, uint16_t _dstY, uint16_t _dstZ, bgfx_texture_handle_t _src, uint8_t _srcMip, uint16_t _srcX, uint16_t _srcY, uint16_t _srcZ, uint16_t _width, uint16_t _height, uint16_t _depth)
{
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } dst = { _dst };
union { bgfx_texture_handle_t c; bgfx::TextureHandle cpp; } src = { _src };
bgfx::blit((bgfx::ViewId)_id, dst.cpp, _dstMip, _dstX, _dstY, _dstZ, src.cpp, _srcMip, _srcX, _srcY, _srcZ, _width, _height, _depth);
}
/* user define functions */
BGFX_C_API void bgfx_init_ctor(bgfx_init_t* _init)
{
BX_PLACEMENT_NEW(_init, bgfx::Init);
}
BGFX_C_API bool bgfx_init(const bgfx_init_t * _init)
{
bgfx_init_t init =*_init;
if (init.callback != NULL)
{
static bgfx::CallbackC99 s_callback;
s_callback.m_interface = init.callback;
init.callback = reinterpret_cast<bgfx_callback_interface_t*>(&s_callback);
}
if (init.allocator != NULL)
{
static bgfx::AllocatorC99 s_allocator;
s_allocator.m_interface = init.allocator;
init.allocator = reinterpret_cast<bgfx_allocator_interface_t*>(&s_allocator);
}
union { const bgfx_init_t* c; const bgfx::Init* cpp; } in;
in.c = &init;
return bgfx::init(*in.cpp);
}
/**/
BGFX_C_API bgfx_interface_vtbl_t* bgfx_get_interface(uint32_t _version)
{
if (_version == BGFX_API_VERSION)
{
static bgfx_interface_vtbl_t s_bgfx_interface =
{
bgfx_attachment_init,
bgfx_vertex_layout_begin,
bgfx_vertex_layout_add,
bgfx_vertex_layout_decode,
bgfx_vertex_layout_has,
bgfx_vertex_layout_skip,
bgfx_vertex_layout_end,
bgfx_vertex_pack,
bgfx_vertex_unpack,
bgfx_vertex_convert,
bgfx_weld_vertices,
bgfx_topology_convert,
bgfx_topology_sort_tri_list,
bgfx_get_supported_renderers,
bgfx_get_renderer_name,
bgfx_init_ctor,
bgfx_init,
bgfx_shutdown,
bgfx_reset,
bgfx_frame,
bgfx_get_renderer_type,
bgfx_get_caps,
bgfx_get_stats,
bgfx_alloc,
bgfx_copy,
bgfx_make_ref,
bgfx_make_ref_release,
bgfx_set_debug,
bgfx_dbg_text_clear,
bgfx_dbg_text_printf,
bgfx_dbg_text_vprintf,
bgfx_dbg_text_image,
bgfx_create_index_buffer,
bgfx_set_index_buffer_name,
bgfx_destroy_index_buffer,
bgfx_create_vertex_layout,
bgfx_destroy_vertex_layout,
bgfx_create_vertex_buffer,
bgfx_set_vertex_buffer_name,
bgfx_destroy_vertex_buffer,
bgfx_create_dynamic_index_buffer,
bgfx_create_dynamic_index_buffer_mem,
bgfx_update_dynamic_index_buffer,
bgfx_destroy_dynamic_index_buffer,
bgfx_create_dynamic_vertex_buffer,
bgfx_create_dynamic_vertex_buffer_mem,
bgfx_update_dynamic_vertex_buffer,
bgfx_destroy_dynamic_vertex_buffer,
bgfx_get_avail_transient_index_buffer,
bgfx_get_avail_transient_vertex_buffer,
bgfx_get_avail_instance_data_buffer,
bgfx_alloc_transient_index_buffer,
bgfx_alloc_transient_vertex_buffer,
bgfx_alloc_transient_buffers,
bgfx_alloc_instance_data_buffer,
bgfx_create_indirect_buffer,
bgfx_destroy_indirect_buffer,
bgfx_create_shader,
bgfx_get_shader_uniforms,
bgfx_set_shader_name,
bgfx_destroy_shader,
bgfx_create_program,
bgfx_create_compute_program,
bgfx_destroy_program,
bgfx_is_texture_valid,
bgfx_is_frame_buffer_valid,
bgfx_calc_texture_size,
bgfx_create_texture,
bgfx_create_texture_2d,
bgfx_create_texture_2d_scaled,
bgfx_create_texture_3d,
bgfx_create_texture_cube,
bgfx_update_texture_2d,
bgfx_update_texture_3d,
bgfx_update_texture_cube,
bgfx_read_texture,
bgfx_set_texture_name,
bgfx_get_direct_access_ptr,
bgfx_destroy_texture,
bgfx_create_frame_buffer,
bgfx_create_frame_buffer_scaled,
bgfx_create_frame_buffer_from_handles,
bgfx_create_frame_buffer_from_attachment,
bgfx_create_frame_buffer_from_nwh,
bgfx_set_frame_buffer_name,
bgfx_get_texture,
bgfx_destroy_frame_buffer,
bgfx_create_uniform,
bgfx_get_uniform_info,
bgfx_destroy_uniform,
bgfx_create_occlusion_query,
bgfx_get_result,
bgfx_destroy_occlusion_query,
bgfx_set_palette_color,
bgfx_set_palette_color_rgba8,
bgfx_set_view_name,
bgfx_set_view_rect,
bgfx_set_view_rect_ratio,
bgfx_set_view_scissor,
bgfx_set_view_clear,
bgfx_set_view_clear_mrt,
bgfx_set_view_mode,
bgfx_set_view_frame_buffer,
bgfx_set_view_transform,
bgfx_set_view_order,
bgfx_reset_view,
bgfx_encoder_begin,
bgfx_encoder_end,
bgfx_encoder_set_marker,
bgfx_encoder_set_state,
bgfx_encoder_set_condition,
bgfx_encoder_set_stencil,
bgfx_encoder_set_scissor,
bgfx_encoder_set_scissor_cached,
bgfx_encoder_set_transform,
bgfx_encoder_set_transform_cached,
bgfx_encoder_alloc_transform,
bgfx_encoder_set_uniform,
bgfx_encoder_set_index_buffer,
bgfx_encoder_set_dynamic_index_buffer,
bgfx_encoder_set_transient_index_buffer,
bgfx_encoder_set_vertex_buffer,
bgfx_encoder_set_vertex_buffer_with_layout,
bgfx_encoder_set_dynamic_vertex_buffer,
bgfx_encoder_set_dynamic_vertex_buffer_with_layout,
bgfx_encoder_set_transient_vertex_buffer,
bgfx_encoder_set_transient_vertex_buffer_with_layout,
bgfx_encoder_set_vertex_count,
bgfx_encoder_set_instance_data_buffer,
bgfx_encoder_set_instance_data_from_vertex_buffer,
bgfx_encoder_set_instance_data_from_dynamic_vertex_buffer,
bgfx_encoder_set_instance_count,
bgfx_encoder_set_texture,
bgfx_encoder_touch,
bgfx_encoder_submit,
bgfx_encoder_submit_occlusion_query,
bgfx_encoder_submit_indirect,
bgfx_encoder_submit_indirect_count,
bgfx_encoder_set_compute_index_buffer,
bgfx_encoder_set_compute_vertex_buffer,
bgfx_encoder_set_compute_dynamic_index_buffer,
bgfx_encoder_set_compute_dynamic_vertex_buffer,
bgfx_encoder_set_compute_indirect_buffer,
bgfx_encoder_set_image,
bgfx_encoder_dispatch,
bgfx_encoder_dispatch_indirect,
bgfx_encoder_discard,
bgfx_encoder_blit,
bgfx_request_screen_shot,
bgfx_render_frame,
bgfx_set_platform_data,
bgfx_get_internal_data,
bgfx_override_internal_texture_ptr,
bgfx_override_internal_texture,
bgfx_set_marker,
bgfx_set_state,
bgfx_set_condition,
bgfx_set_stencil,
bgfx_set_scissor,
bgfx_set_scissor_cached,
bgfx_set_transform,
bgfx_set_transform_cached,
bgfx_alloc_transform,
bgfx_set_uniform,
bgfx_set_index_buffer,
bgfx_set_dynamic_index_buffer,
bgfx_set_transient_index_buffer,
bgfx_set_vertex_buffer,
bgfx_set_vertex_buffer_with_layout,
bgfx_set_dynamic_vertex_buffer,
bgfx_set_dynamic_vertex_buffer_with_layout,
bgfx_set_transient_vertex_buffer,
bgfx_set_transient_vertex_buffer_with_layout,
bgfx_set_vertex_count,
bgfx_set_instance_data_buffer,
bgfx_set_instance_data_from_vertex_buffer,
bgfx_set_instance_data_from_dynamic_vertex_buffer,
bgfx_set_instance_count,
bgfx_set_texture,
bgfx_touch,
bgfx_submit,
bgfx_submit_occlusion_query,
bgfx_submit_indirect,
bgfx_submit_indirect_count,
bgfx_set_compute_index_buffer,
bgfx_set_compute_vertex_buffer,
bgfx_set_compute_dynamic_index_buffer,
bgfx_set_compute_dynamic_vertex_buffer,
bgfx_set_compute_indirect_buffer,
bgfx_set_image,
bgfx_dispatch,
bgfx_dispatch_indirect,
bgfx_discard,
bgfx_blit
};
return &s_bgfx_interface;
}
return NULL;
}
|