-
Notifications
You must be signed in to change notification settings - Fork 2k
/
Copy pathbgfx.idl
3218 lines (2903 loc) · 142 KB
/
bgfx.idl
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
-- vim: syntax=lua
-- bgfx interface
version(129)
typedef "bool"
typedef "char"
typedef "float"
typedef "int8_t"
typedef "int32_t"
typedef "int64_t"
typedef "uint8_t"
typedef "uint16_t"
typedef "uint32_t"
typedef "uint64_t"
typedef "uintptr_t"
typedef "va_list"
typedef "void"
typedef "ViewId"
typedef "CallbackI" { cname = "callback_interface" }
typedef "bx::AllocatorI" { cname = "allocator_interface" }
--- Memory release callback.
funcptr.ReleaseFn
"void"
.ptr "void*" --- Pointer to allocated data.
.userData "void*" --- User defined data if needed.
--- Color RGB/alpha/depth write. When it's not specified write will be disabled.
flag.StateWrite { bits = 64 , base = 1 }
.R --- Enable R write.
.G --- Enable G write.
.B --- Enable B write.
.A --- Enable alpha write.
.Z (39) --- Enable depth write.
.Rgb { "R", "G", "B" } --- Enable RGB write.
.Mask { "Rgb", "A", "Z" } --- Write all channels mask.
--- Depth test state. When `BGFX_STATE_DEPTH_` is not specified depth test will be disabled.
flag.StateDepthTest { bits = 64, shift = 4, range = 4, base = 1 , desc = "Depth test state" }
.Less --- Enable depth test, less.
.Lequal --- Enable depth test, less or equal.
.Equal --- Enable depth test, equal.
.Gequal --- Enable depth test, greater or equal.
.Greater --- Enable depth test, greater.
.Notequal --- Enable depth test, not equal.
.Never --- Enable depth test, never.
.Always --- Enable depth test, always.
()
--- Use BGFX_STATE_BLEND_FUNC(_src, _dst) or BGFX_STATE_BLEND_FUNC_SEPARATE(_srcRGB, _dstRGB, _srcA, _dstA)
--- helper macros.
flag.StateBlend { bits = 64, shift = 12, range = 16, base = 1, desc = "Blend state" }
.Zero --- 0, 0, 0, 0
.One --- 1, 1, 1, 1
.SrcColor --- Rs, Gs, Bs, As
.InvSrcColor --- 1-Rs, 1-Gs, 1-Bs, 1-As
.SrcAlpha --- As, As, As, As
.InvSrcAlpha --- 1-As, 1-As, 1-As, 1-As
.DstAlpha --- Ad, Ad, Ad, Ad
.InvDstAlpha --- 1-Ad, 1-Ad, 1-Ad ,1-Ad
.DstColor --- Rd, Gd, Bd, Ad
.InvDstColor --- 1-Rd, 1-Gd, 1-Bd, 1-Ad
.SrcAlphaSat --- f, f, f, 1; f = min(As, 1-Ad)
.Factor --- Blend factor
.InvFactor --- 1-Blend factor
()
--- Use BGFX_STATE_BLEND_EQUATION(_equation) or BGFX_STATE_BLEND_EQUATION_SEPARATE(_equationRGB, _equationA)
--- helper macros.
flag.StateBlendEquation { bits = 64, shift = 28, range = 6, base = 0, desc = "Blend equation" }
.Add --- Blend add: src + dst.
.Sub --- Blend subtract: src - dst.
.Revsub --- Blend reverse subtract: dst - src.
.Min --- Blend min: min(src, dst).
.Max --- Blend max: max(src, dst).
()
--- Cull state. When `BGFX_STATE_CULL_*` is not specified culling will be disabled.
flag.StateCull { bits = 64, shift = 36, range = 2, base = 1, desc = "Culling mode" }
.Cw --- Cull clockwise triangles.
.Ccw --- Cull counter-clockwise triangles.
()
--- Alpha reference value.
flag.StateAlphaRef { bits = 64, shift = 40, range = 8, desc = "Alpha reference", "helper" }
flag.StatePt { bits = 64, shift = 48, range = 3, base = 1, desc = "Primitive type" }
.Tristrip --- Tristrip.
.Lines --- Lines.
.Linestrip --- Line strip.
.Points --- Points.
()
--- Point size value.
flag.StatePointSize { bits = 64, shift = 52, range = 4, desc = "Point size", "helper" }
--- Enable MSAA write when writing into MSAA frame buffer.
--- This flag is ignored when not writing into MSAA frame buffer.
flag.State { bits = 64 , range = 64 , desc = "State" }
.Msaa (57) --- Enable MSAA rasterization.
.Lineaa (58) --- Enable line AA rasterization.
.ConservativeRaster (59) --- Enable conservative rasterization.
.None (0) --- No state.
.FrontCcw(40) --- Front counter-clockwise (default is clockwise).
.BlendIndependent(35) --- Enable blend independent.
.BlendAlphaToCoverage (36) --- Enable alpha to coverage.
.Default { "WriteRgb", "WriteA", "WriteZ", "DepthTestLess", "CullCw", "Msaa" }
--- Default state is write to RGB, alpha, and depth with depth test less enabled, with clockwise
--- culling and MSAA (when writing into MSAA frame buffer, otherwise this flag is ignored).
--- Do not use!
flag.StateReserved { bits = 64, shift = 61, range = 3 }
--- Set stencil ref value.
flag.StencilFuncRef { bits = 32, shift = 0, range = 8, "helper" }
--- Set stencil rmask value.
flag.StencilFuncRmask { bits = 32, shift = 8, range = 8, "helper" }
flag.Stencil { bits = 32, const }
.None (0x00000000)
.Mask (0xffffffff)
.Default (0x00000000)
flag.StencilTest { bits = 32, shift = 16, range = 4 , base = 1, desc = "Stencil test" }
.Less --- Enable stencil test, less.
.Lequal --- Enable stencil test, less or equal.
.Equal --- Enable stencil test, equal.
.Gequal --- Enable stencil test, greater or equal.
.Greater --- Enable stencil test, greater.
.Notequal --- Enable stencil test, not equal.
.Never --- Enable stencil test, never.
.Always --- Enable stencil test, always.
()
flag.StencilOpFailS { bits = 32, shift = 20, range = 4, base = 0, desc = "Stencil operation fail" }
.Zero --- Zero.
.Keep --- Keep.
.Replace --- Replace.
.Incr --- Increment and wrap.
.Incrsat --- Increment and clamp.
.Decr --- Decrement and wrap.
.Decrsat --- Decrement and clamp.
.Invert --- Invert.
()
flag.StencilOpFailZ { bits = 32, shift = 24, range = 4, base = 0, desc = "Stencil operation depth fail" }
.Zero --- Zero.
.Keep --- Keep.
.Replace --- Replace.
.Incr --- Increment and wrap.
.Incrsat --- Increment and clamp.
.Decr --- Decrement and wrap.
.Decrsat --- Decrement and clamp.
.Invert --- Invert.
()
flag.StencilOpPassZ { bits = 32, shift = 28, range = 4 , base = 0, desc = "Stencil operation depth pass" }
.Zero --- Zero.
.Keep --- Keep.
.Replace --- Replace.
.Incr --- Increment and wrap.
.Incrsat --- Increment and clamp.
.Decr --- Decrement and wrap.
.Decrsat --- Decrement and clamp.
.Invert --- Invert.
()
flag.Clear { bits = 16 }
.None --- No clear flags.
.Color --- Clear color.
.Depth --- Clear depth.
.Stencil --- Clear stencil.
.DiscardColor_0 --- Discard frame buffer attachment 0.
.DiscardColor_1 --- Discard frame buffer attachment 1.
.DiscardColor_2 --- Discard frame buffer attachment 2.
.DiscardColor_3 --- Discard frame buffer attachment 3.
.DiscardColor_4 --- Discard frame buffer attachment 4.
.DiscardColor_5 --- Discard frame buffer attachment 5.
.DiscardColor_6 --- Discard frame buffer attachment 6.
.DiscardColor_7 --- Discard frame buffer attachment 7.
.DiscardDepth --- Discard frame buffer depth attachment.
.DiscardStencil --- Discard frame buffer stencil attachment.
.DiscardColorMask {
"DiscardColor_0",
"DiscardColor_1",
"DiscardColor_2",
"DiscardColor_3",
"DiscardColor_4",
"DiscardColor_5",
"DiscardColor_6",
"DiscardColor_7"
}
.DiscardMask {
"DiscardColorMask",
"DiscardDepth",
"DiscardStencil"
}
--- Rendering state discard. When state is preserved in submit, rendering states can be discarded
--- on a finer grain.
flag.Discard { bits = 8, const, desc = "Discard flags" }
.None (0x00) --- Preserve everything.
.Bindings (0x01) --- Discard texture sampler and buffer bindings.
.IndexBuffer (0x02) --- Discard index buffer.
.InstanceData (0x04) --- Discard instance data.
.State (0x08) --- Discard state and uniform bindings.
.Transform (0x10) --- Discard transform.
.VertexStreams (0x20) --- Discard vertex streams.
.All (0xff) --- Discard all states.
()
flag.Debug { bits = 32 }
.None --- No debug.
.Wireframe --- Enable wireframe for all primitives.
.Ifh --- Enable infinitely fast hardware test. No draw calls will be submitted to driver.
--- It's useful when profiling to quickly assess bottleneck between CPU and GPU.
.Stats --- Enable statistics display.
.Text --- Enable debug text display.
.Profiler --- Enable profiler. This causes per-view statistics to be collected, available through `bgfx::Stats::ViewStats`. This is unrelated to the profiler functions in `bgfx::CallbackI`.
()
flag.BufferComputeFormat { bits = 16, shift = 0, range = 4, base = 1 }
._8x1 --- 1 8-bit value
._8x2 --- 2 8-bit values
._8x4 --- 4 8-bit values
._16x1 --- 1 16-bit value
._16x2 --- 2 16-bit values
._16x4 --- 4 16-bit values
._32x1 --- 1 32-bit value
._32x2 --- 2 32-bit values
._32x4 --- 4 32-bit values
()
flag.BufferComputeType { bits = 16, shift = 4, range = 2, base = 1 }
.Int --- Type `int`.
.Uint --- Type `uint`.
.Float --- Type `float`.
()
flag.Buffer { bits = 16, base = 8 }
.None(0)
.ComputeRead --- Buffer will be read by shader.
.ComputeWrite --- Buffer will be used for writing.
.DrawIndirect --- Buffer will be used for storing draw indirect commands.
.AllowResize --- Allow dynamic index/vertex buffer resize during update.
.Index32 --- Index buffer contains 32-bit indices.
.ComputeReadWrite { "ComputeRead" , "ComputeWrite" }
()
flag.Texture { bits = 64 }
.None (0)
.MsaaSample (36) --- Texture will be used for MSAA sampling.
.Rt (37) --- Render target no MSAA.
.ComputeWrite (45) --- Texture will be used for compute write.
.Srgb (46) --- Sample texture as sRGB.
.BlitDst (47) --- Texture will be used as blit destination.
.ReadBack (48) --- Texture will be used for read back from GPU.
()
flag.TextureRtMsaa { bits = 64, shift = 36, range = 3 , base = 2 }
.X2 --- Render target MSAAx2 mode.
.X4 --- Render target MSAAx4 mode.
.X8 --- Render target MSAAx8 mode.
.X16 --- Render target MSAAx16 mode.
()
flag.TextureRt { bits = 64, shift = 36, range = 4 }
.WriteOnly (9) --- Render target will be used for writing
--- Sampler flags.
flag.SamplerU { bits = 32, shift = 0, range = 2, base = 1 }
.Mirror --- Wrap U mode: Mirror
.Clamp --- Wrap U mode: Clamp
.Border --- Wrap U mode: Border
()
flag.SamplerV { bits = 32, shift = 2, range = 2, base = 1 }
.Mirror --- Wrap V mode: Mirror
.Clamp --- Wrap V mode: Clamp
.Border --- Wrap V mode: Border
()
flag.SamplerW { bits = 32, shift = 4, range = 2, base = 1 }
.Mirror --- Wrap W mode: Mirror
.Clamp --- Wrap W mode: Clamp
.Border --- Wrap W mode: Border
()
flag.SamplerMin { bits = 32, shift = 6, range = 2, base = 1 }
.Point --- Min sampling mode: Point
.Anisotropic --- Min sampling mode: Anisotropic
()
flag.SamplerMag { bits = 32, shift = 8, range = 2, base = 1 }
.Point --- Mag sampling mode: Point
.Anisotropic --- Mag sampling mode: Anisotropic
()
flag.SamplerMip { bits = 32, shift = 10, range = 1, base = 1 }
.Point --- Mip sampling mode: Point
()
flag.SamplerCompare { bits = 32 , shift = 16, range = 4, base = 1 }
.Less --- Compare when sampling depth texture: less.
.Lequal --- Compare when sampling depth texture: less or equal.
.Equal --- Compare when sampling depth texture: equal.
.Gequal --- Compare when sampling depth texture: greater or equal.
.Greater --- Compare when sampling depth texture: greater.
.Notequal --- Compare when sampling depth texture: not equal.
.Never --- Compare when sampling depth texture: never.
.Always --- Compare when sampling depth texture: always.
()
flag.SamplerBorderColor { bits = 32, shift = 24, range = 4, "helper" }
flag.SamplerReserved { bits = 32, shift = 28, range = 4 }
flag.Sampler { bits = 32 }
.None
.SampleStencil (21) --- Sample stencil instead of depth.
.Point { "MinPoint", "MagPoint", "MipPoint" }
.UvwMirror { "UMirror", "VMirror", "WMirror" }
.UvwClamp { "UClamp", "VClamp", "WClamp" }
.UvwBorder { "UBorder", "VBorder", "WBorder" }
.BitsMask {
"UMask",
"VMask",
"WMask",
"MinMask",
"MagMask",
"MipMask",
"CompareMask"
}
()
flag.ResetMsaa { bits = 32, shift = 4, range = 3, base = 1 }
.X2 --- Enable 2x MSAA.
.X4 --- Enable 4x MSAA.
.X8 --- Enable 8x MSAA.
.X16 --- Enable 16x MSAA.
()
flag.Reset { bits = 32 }
.None ( 0) --- No reset flags.
.Fullscreen ( 1) --- Not supported yet.
.Vsync ( 8) --- Enable V-Sync.
.Maxanisotropy ( 9) --- Turn on/off max anisotropy.
.Capture (10) --- Begin screen capture.
.FlushAfterRender (14) --- Flush rendering after submitting to GPU.
.FlipAfterRender (15) --- This flag specifies where flip occurs. Default behaviour is that flip occurs
--- before rendering new frame. This flag only has effect when `BGFX_CONFIG_MULTITHREADED=0`.
.SrgbBackbuffer (16) --- Enable sRGB backbuffer.
.Hdr10 (17) --- Enable HDR10 rendering.
.Hidpi (18) --- Enable HiDPI rendering.
.DepthClamp (19) --- Enable depth clamp.
.Suspend (20) --- Suspend rendering.
.TransparentBackbuffer (21) --- Transparent backbuffer. Availability depends on: `BGFX_CAPS_TRANSPARENT_BACKBUFFER`.
()
flag.ResetFullscreen { bits = 32, shift = 0, range = 1, base = 1 }
()
flag.ResetReserved { bits = 32, shift = 31, range = 1 , desc = "Internal" }
flag.Caps { bits = 64, base = 1, name = "Caps" }
.AlphaToCoverage --- Alpha to coverage is supported.
.BlendIndependent --- Blend independent is supported.
.Compute --- Compute shaders are supported.
.ConservativeRaster --- Conservative rasterization is supported.
.DrawIndirect --- Draw indirect is supported.
.DrawIndirectCount --- Draw indirect with indirect count is supported.
.FragmentDepth --- Fragment depth is available in fragment shader.
.FragmentOrdering --- Fragment ordering is available in fragment shader.
.GraphicsDebugger --- Graphics debugger is present.
.Hdr10 --- HDR10 rendering is supported.
.Hidpi --- HiDPI rendering is supported.
.ImageRw --- Image Read/Write is supported.
.Index32 --- 32-bit indices are supported.
.Instancing --- Instancing is supported.
.OcclusionQuery --- Occlusion query is supported.
.PrimitiveId --- PrimitiveID is available in fragment shader.
.RendererMultithreaded --- Renderer is on separate thread.
.SwapChain --- Multiple windows are supported.
.TextureBlit --- Texture blit is supported.
.TextureCompareLequal --- Texture compare less equal mode is supported.
.TextureCompareReserved
.TextureCubeArray --- Cubemap texture array is supported.
.TextureDirectAccess --- CPU direct access to GPU texture memory.
.TextureReadBack --- Read-back texture is supported.
.Texture_2dArray --- 2D texture array is supported.
.Texture_3d --- 3D textures are supported.
.TransparentBackbuffer --- Transparent back buffer supported.
.VertexAttribHalf --- Vertex attribute half-float is supported.
.VertexAttribUint10 --- Vertex attribute 10_10_10_2 is supported.
.VertexId --- Rendering with VertexID only is supported.
.ViewportLayerArray --- Viewport layer is available in vertex shader.
.TextureCompareAll --- All texture compare modes are supported.
{ "TextureCompareReserved", "TextureCompareLequal" }
()
flag.CapsFormat { bits = 32 }
.TextureNone --- Texture format is not supported.
.Texture_2d --- Texture format is supported.
.Texture_2dSrgb --- Texture as sRGB format is supported.
.Texture_2dEmulated --- Texture format is emulated.
.Texture_3d --- Texture format is supported.
.Texture_3dSrgb --- Texture as sRGB format is supported.
.Texture_3dEmulated --- Texture format is emulated.
.TextureCube --- Texture format is supported.
.TextureCubeSrgb --- Texture as sRGB format is supported.
.TextureCubeEmulated --- Texture format is emulated.
.TextureVertex --- Texture format can be used from vertex shader.
.TextureImageRead --- Texture format can be used as image and read from.
.TextureImageWrite --- Texture format can be used as image and written to.
.TextureFramebuffer --- Texture format can be used as frame buffer.
.TextureFramebufferMsaa --- Texture format can be used as MSAA frame buffer.
.TextureMsaa --- Texture can be sampled as MSAA.
.TextureMipAutogen --- Texture format supports auto-generated mips.
()
flag.Resolve { bits = 8 }
.None --- No resolve flags.
.AutoGenMips --- Auto-generate mip maps on resolve.
()
flag.PciId { bits = 16 , const }
.None (0x0000) --- Autoselect adapter.
.SoftwareRasterizer (0x0001) --- Software rasterizer.
.Amd (0x1002) --- AMD adapter.
.Apple (0x106b) --- Apple adapter.
.Intel (0x8086) --- Intel adapter.
.Nvidia (0x10de) --- nVidia adapter.
.Microsoft (0x1414) --- Microsoft adapter.
.Arm (0x13b5) --- ARM adapter.
()
flag.CubeMap { bits = 8, const }
.PositiveX (0x00) --- Cubemap +x.
.NegativeX (0x01) --- Cubemap -x.
.PositiveY (0x02) --- Cubemap +y.
.NegativeY (0x03) --- Cubemap -y.
.PositiveZ (0x04) --- Cubemap +z.
.NegativeZ (0x05) --- Cubemap -z.
()
--- Fatal error enum.
enum.Fatal { underscore, comment = "" }
.DebugCheck
.InvalidShader
.UnableToInitialize
.UnableToCreateTexture
.DeviceLost
()
--- Renderer backend type enum.
enum.RendererType { comment = "Renderer types:" }
.Noop --- No rendering.
.Agc --- AGC
.Direct3D11 --- Direct3D 11.0
.Direct3D12 --- Direct3D 12.0
.Gnm --- GNM
.Metal --- Metal
.Nvn --- NVN
.OpenGLES --- OpenGL ES 2.0+
.OpenGL --- OpenGL 2.1+
.Vulkan --- Vulkan
()
--- Access mode enum.
enum.Access { comment = "Access:" }
.Read --- Read.
.Write --- Write.
.ReadWrite --- Read and write.
()
--- Vertex attribute enum.
enum.Attrib { comment = "Corresponds to vertex shader attribute." }
.Position --- a_position
.Normal --- a_normal
.Tangent --- a_tangent
.Bitangent --- a_bitangent
.Color0 --- a_color0
.Color1 --- a_color1
.Color2 --- a_color2
.Color3 --- a_color3
.Indices --- a_indices
.Weight --- a_weight
.TexCoord0 --- a_texcoord0
.TexCoord1 --- a_texcoord1
.TexCoord2 --- a_texcoord2
.TexCoord3 --- a_texcoord3
.TexCoord4 --- a_texcoord4
.TexCoord5 --- a_texcoord5
.TexCoord6 --- a_texcoord6
.TexCoord7 --- a_texcoord7
()
--- Vertex attribute type enum.
enum.AttribType { comment = "Attribute types:" }
.Uint8 --- Uint8
.Uint10 --- Uint10, availability depends on: `BGFX_CAPS_VERTEX_ATTRIB_UINT10`.
.Int16 --- Int16
.Half --- Half, availability depends on: `BGFX_CAPS_VERTEX_ATTRIB_HALF`.
.Float --- Float
()
--- Texture format enum.
---
--- Notation:
---
--- RGBA16S
--- ^ ^ ^
--- | | +-- [ ]Unorm
--- | | [F]loat
--- | | [S]norm
--- | | [I]nt
--- | | [U]int
--- | +---- Number of bits per component
--- +-------- Components
---
--- @attention Availability depends on Caps (see: formats).
enum.TextureFormat { comment = "Texture formats:" }
.BC1 --- DXT1 R5G6B5A1
.BC2 --- DXT3 R5G6B5A4
.BC3 --- DXT5 R5G6B5A8
.BC4 --- LATC1/ATI1 R8
.BC5 --- LATC2/ATI2 RG8
.BC6H --- BC6H RGB16F
.BC7 --- BC7 RGB 4-7 bits per color channel, 0-8 bits alpha
.ETC1 --- ETC1 RGB8
.ETC2 --- ETC2 RGB8
.ETC2A --- ETC2 RGBA8
.ETC2A1 --- ETC2 RGB8A1
.PTC12 --- PVRTC1 RGB 2BPP
.PTC14 --- PVRTC1 RGB 4BPP
.PTC12A --- PVRTC1 RGBA 2BPP
.PTC14A --- PVRTC1 RGBA 4BPP
.PTC22 --- PVRTC2 RGBA 2BPP
.PTC24 --- PVRTC2 RGBA 4BPP
.ATC --- ATC RGB 4BPP
.ATCE --- ATCE RGBA 8 BPP explicit alpha
.ATCI --- ATCI RGBA 8 BPP interpolated alpha
.ASTC4x4 --- ASTC 4x4 8.0 BPP
.ASTC5x4 --- ASTC 5x4 6.40 BPP
.ASTC5x5 --- ASTC 5x5 5.12 BPP
.ASTC6x5 --- ASTC 6x5 4.27 BPP
.ASTC6x6 --- ASTC 6x6 3.56 BPP
.ASTC8x5 --- ASTC 8x5 3.20 BPP
.ASTC8x6 --- ASTC 8x6 2.67 BPP
.ASTC8x8 --- ASTC 8x8 2.00 BPP
.ASTC10x5 --- ASTC 10x5 2.56 BPP
.ASTC10x6 --- ASTC 10x6 2.13 BPP
.ASTC10x8 --- ASTC 10x8 1.60 BPP
.ASTC10x10 --- ASTC 10x10 1.28 BPP
.ASTC12x10 --- ASTC 12x10 1.07 BPP
.ASTC12x12 --- ASTC 12x12 0.89 BPP
.Unknown --- Compressed formats above.
.R1
.A8
.R8
.R8I
.R8U
.R8S
.R16
.R16I
.R16U
.R16F
.R16S
.R32I
.R32U
.R32F
.RG8
.RG8I
.RG8U
.RG8S
.RG16
.RG16I
.RG16U
.RG16F
.RG16S
.RG32I
.RG32U
.RG32F
.RGB8
.RGB8I
.RGB8U
.RGB8S
.RGB9E5F
.BGRA8
.RGBA8
.RGBA8I
.RGBA8U
.RGBA8S
.RGBA16
.RGBA16I
.RGBA16U
.RGBA16F
.RGBA16S
.RGBA32I
.RGBA32U
.RGBA32F
.B5G6R5
.R5G6B5
.BGRA4
.RGBA4
.BGR5A1
.RGB5A1
.RGB10A2
.RG11B10F
.UnknownDepth --- Depth formats below.
.D16
.D24
.D24S8
.D32
.D16F
.D24F
.D32F
.D0S8
()
--- Uniform type enum.
enum.UniformType { comment = "Uniform types:" }
.Sampler --- Sampler.
.End --- Reserved, do not use.
.Vec4 --- 4 floats vector.
.Mat3 --- 3x3 matrix.
.Mat4 --- 4x4 matrix.
()
--- Backbuffer ratio enum.
enum.BackbufferRatio { comment = "Backbuffer ratios:" }
.Equal --- Equal to backbuffer.
.Half --- One half size of backbuffer.
.Quarter --- One quarter size of backbuffer.
.Eighth --- One eighth size of backbuffer.
.Sixteenth --- One sixteenth size of backbuffer.
.Double --- Double size of backbuffer.
()
--- Occlusion query result.
enum.OcclusionQueryResult { comment = "Occlusion query results:" }
.Invisible --- Query failed test.
.Visible --- Query passed test.
.NoResult --- Query result is not available yet.
()
--- Primitive topology.
enum.Topology { underscore, comment = "Primitive topology:" }
.TriList --- Triangle list.
.TriStrip --- Triangle strip.
.LineList --- Line list.
.LineStrip --- Line strip.
.PointList --- Point list.
()
--- Topology conversion function.
enum.TopologyConvert { underscore , comment = "Topology conversion functions:" }
.TriListFlipWinding --- Flip winding order of triangle list.
.TriStripFlipWinding --- Flip winding order of triangle strip.
.TriListToLineList --- Convert triangle list to line list.
.TriStripToTriList --- Convert triangle strip to triangle list.
.LineStripToLineList --- Convert line strip to line list.
()
--- Topology sort order.
enum.TopologySort { underscore, comment = "Topology sort order:" , }
.DirectionFrontToBackMin
.DirectionFrontToBackAvg
.DirectionFrontToBackMax
.DirectionBackToFrontMin
.DirectionBackToFrontAvg
.DirectionBackToFrontMax
.DistanceFrontToBackMin
.DistanceFrontToBackAvg
.DistanceFrontToBackMax
.DistanceBackToFrontMin
.DistanceBackToFrontAvg
.DistanceBackToFrontMax
()
--- View mode sets draw call sort order.
enum.ViewMode { underscore, comment = "View modes:" }
.Default --- Default sort order.
.Sequential --- Sort in the same order in which submit calls were called.
.DepthAscending --- Sort draw call depth in ascending order.
.DepthDescending --- Sort draw call depth in descending order.
()
--- Native window handle type.
enum.NativeWindowHandleType { underscore, comment = "Native Window handle type:" }
.Default --- Platform default handle type (X11 on Linux).
.Wayland --- Wayland.
()
--- Render frame enum.
enum.RenderFrame { underscore, comment = "" }
.NoContext --- Renderer context is not created yet.
.Render --- Renderer context is created and rendering.
.Timeout --- Renderer context wait for main thread signal timed out without rendering.
.Exiting --- Renderer context is getting destroyed.
()
--- GPU info.
struct.GPU { namespace = "Caps" }
.vendorId "uint16_t" --- Vendor PCI id. See `BGFX_PCI_ID_*`.
.deviceId "uint16_t" --- Device id.
--- Renderer runtime limits.
struct.Limits { namespace = "Caps" }
.maxDrawCalls "uint32_t" --- Maximum number of draw calls.
.maxBlits "uint32_t" --- Maximum number of blit calls.
.maxTextureSize "uint32_t" --- Maximum texture size.
.maxTextureLayers "uint32_t" --- Maximum texture layers.
.maxViews "uint32_t" --- Maximum number of views.
.maxFrameBuffers "uint32_t" --- Maximum number of frame buffer handles.
.maxFBAttachments "uint32_t" --- Maximum number of frame buffer attachments.
.maxPrograms "uint32_t" --- Maximum number of program handles.
.maxShaders "uint32_t" --- Maximum number of shader handles.
.maxTextures "uint32_t" --- Maximum number of texture handles.
.maxTextureSamplers "uint32_t" --- Maximum number of texture samplers.
.maxComputeBindings "uint32_t" --- Maximum number of compute bindings.
.maxVertexLayouts "uint32_t" --- Maximum number of vertex format layouts.
.maxVertexStreams "uint32_t" --- Maximum number of vertex streams.
.maxIndexBuffers "uint32_t" --- Maximum number of index buffer handles.
.maxVertexBuffers "uint32_t" --- Maximum number of vertex buffer handles.
.maxDynamicIndexBuffers "uint32_t" --- Maximum number of dynamic index buffer handles.
.maxDynamicVertexBuffers "uint32_t" --- Maximum number of dynamic vertex buffer handles.
.maxUniforms "uint32_t" --- Maximum number of uniform handles.
.maxOcclusionQueries "uint32_t" --- Maximum number of occlusion query handles.
.maxEncoders "uint32_t" --- Maximum number of encoder threads.
.minResourceCbSize "uint32_t" --- Minimum resource command buffer size.
.transientVbSize "uint32_t" --- Maximum transient vertex buffer size.
.transientIbSize "uint32_t" --- Maximum transient index buffer size.
--- Renderer capabilities.
struct.Caps
.rendererType "RendererType::Enum" --- Renderer backend type. See: `bgfx::RendererType`
.supported "uint64_t" --- Supported functionality.
--- @attention See `BGFX_CAPS_*` flags at https://bkaradzic.github.io/bgfx/bgfx.html#available-caps
.vendorId "uint16_t" --- Selected GPU vendor PCI id.
.deviceId "uint16_t" --- Selected GPU device id.
.homogeneousDepth "bool" --- True when NDC depth is in [-1, 1] range, otherwise its [0, 1].
.originBottomLeft "bool" --- True when NDC origin is at bottom left.
.numGPUs "uint8_t" --- Number of enumerated GPUs.
.gpu "GPU[4]" --- Enumerated GPUs.
.limits "Limits" --- Renderer runtime limits.
.formats "uint16_t[TextureFormat::Count]"
--- Supported texture format capabilities flags:
--- - `BGFX_CAPS_FORMAT_TEXTURE_NONE` - Texture format is not supported.
--- - `BGFX_CAPS_FORMAT_TEXTURE_2D` - Texture format is supported.
--- - `BGFX_CAPS_FORMAT_TEXTURE_2D_SRGB` - Texture as sRGB format is supported.
--- - `BGFX_CAPS_FORMAT_TEXTURE_2D_EMULATED` - Texture format is emulated.
--- - `BGFX_CAPS_FORMAT_TEXTURE_3D` - Texture format is supported.
--- - `BGFX_CAPS_FORMAT_TEXTURE_3D_SRGB` - Texture as sRGB format is supported.
--- - `BGFX_CAPS_FORMAT_TEXTURE_3D_EMULATED` - Texture format is emulated.
--- - `BGFX_CAPS_FORMAT_TEXTURE_CUBE` - Texture format is supported.
--- - `BGFX_CAPS_FORMAT_TEXTURE_CUBE_SRGB` - Texture as sRGB format is supported.
--- - `BGFX_CAPS_FORMAT_TEXTURE_CUBE_EMULATED` - Texture format is emulated.
--- - `BGFX_CAPS_FORMAT_TEXTURE_VERTEX` - Texture format can be used from vertex shader.
--- - `BGFX_CAPS_FORMAT_TEXTURE_IMAGE_READ` - Texture format can be used as image
--- and read from.
--- - `BGFX_CAPS_FORMAT_TEXTURE_IMAGE_WRITE` - Texture format can be used as image
--- and written to.
--- - `BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER` - Texture format can be used as frame
--- buffer.
--- - `BGFX_CAPS_FORMAT_TEXTURE_FRAMEBUFFER_MSAA` - Texture format can be used as MSAA
--- frame buffer.
--- - `BGFX_CAPS_FORMAT_TEXTURE_MSAA` - Texture can be sampled as MSAA.
--- - `BGFX_CAPS_FORMAT_TEXTURE_MIP_AUTOGEN` - Texture format supports auto-generated
--- mips.
--- Internal data.
struct.InternalData
.caps "const Caps*" --- Renderer capabilities.
.context "void*" --- GL context, or D3D device.
--- Platform data.
struct.PlatformData { ctor }
.ndt "void*" --- Native display type (*nix specific).
.nwh "void*" --- Native window handle. If `NULL`, bgfx will create a headless
--- context/device, provided the rendering API supports it.
.context "void*" --- GL context, D3D device, or Vulkan device. If `NULL`, bgfx
--- will create context/device.
.backBuffer "void*" --- GL back-buffer, or D3D render target view. If `NULL` bgfx will
--- create back-buffer color surface.
.backBufferDS "void*" --- Backbuffer depth/stencil. If `NULL`, bgfx will create a back-buffer
--- depth/stencil surface.
.type "NativeWindowHandleType::Enum" --- Handle type. Needed for platforms having more than one option.
--- Backbuffer resolution and reset parameters.
struct.Resolution { ctor }
.format "TextureFormat::Enum" --- Backbuffer format.
.width "uint32_t" --- Backbuffer width.
.height "uint32_t" --- Backbuffer height.
.reset "uint32_t" --- Reset parameters.
.numBackBuffers "uint8_t" --- Number of back buffers.
.maxFrameLatency "uint8_t" --- Maximum frame latency.
.debugTextScale "uint8_t" --- Scale factor for debug text.
--- Configurable runtime limits parameters.
struct.Limits { ctor, namespace = "Init" }
.maxEncoders "uint16_t" --- Maximum number of encoder threads.
.minResourceCbSize "uint32_t" --- Minimum resource command buffer size.
.transientVbSize "uint32_t" --- Maximum transient vertex buffer size.
.transientIbSize "uint32_t" --- Maximum transient index buffer size.
--- Initialization parameters used by `bgfx::init`.
struct.Init { ctor }
.type "RendererType::Enum" --- Select rendering backend. When set to RendererType::Count
--- a default rendering backend will be selected appropriate to the platform.
--- See: `bgfx::RendererType`
.vendorId "uint16_t" --- Vendor PCI ID. If set to `BGFX_PCI_ID_NONE`, discrete and integrated
--- GPUs will be prioritised.
--- - `BGFX_PCI_ID_NONE` - Autoselect adapter.
--- - `BGFX_PCI_ID_SOFTWARE_RASTERIZER` - Software rasterizer.
--- - `BGFX_PCI_ID_AMD` - AMD adapter.
--- - `BGFX_PCI_ID_APPLE` - Apple adapter.
--- - `BGFX_PCI_ID_INTEL` - Intel adapter.
--- - `BGFX_PCI_ID_NVIDIA` - NVIDIA adapter.
--- - `BGFX_PCI_ID_MICROSOFT` - Microsoft adapter.
.deviceId "uint16_t" --- Device ID. If set to 0 it will select first device, or device with
--- matching ID.
.capabilities "uint64_t" --- Capabilities initialization mask (default: UINT64_MAX).
.debug "bool" --- Enable device for debugging.
.profile "bool" --- Enable device for profiling.
.platformData "PlatformData" --- Platform data.
.resolution "Resolution" --- Backbuffer resolution and reset parameters. See: `bgfx::Resolution`.
.limits "Limits" --- Configurable runtime limits parameters.
.callback "CallbackI*" --- Provide application specific callback interface.
--- See: `bgfx::CallbackI`
.allocator "bx::AllocatorI*" --- Custom allocator. When a custom allocator is not
--- specified, bgfx uses the CRT allocator. Bgfx assumes
--- custom allocator is thread safe.
--- Memory must be obtained by calling `bgfx::alloc`, `bgfx::copy`, or `bgfx::makeRef`.
---
--- @attention It is illegal to create this structure on stack and pass it to any bgfx API.
struct.Memory
.data "uint8_t*" --- Pointer to data.
.size "uint32_t" --- Data size.
--- Transient index buffer.
struct.TransientIndexBuffer
.data "uint8_t*" --- Pointer to data.
.size "uint32_t" --- Data size.
.startIndex "uint32_t" --- First index.
.handle "IndexBufferHandle" --- Index buffer handle.
.isIndex16 "bool" --- Index buffer format is 16-bits if true, otherwise it is 32-bit.
--- Transient vertex buffer.
struct.TransientVertexBuffer
.data "uint8_t*" --- Pointer to data.
.size "uint32_t" --- Data size.
.startVertex "uint32_t" --- First vertex.
.stride "uint16_t" --- Vertex stride.
.handle "VertexBufferHandle" --- Vertex buffer handle.
.layoutHandle "VertexLayoutHandle" --- Vertex layout handle.
--- Instance data buffer info.
struct.InstanceDataBuffer
.data "uint8_t*" --- Pointer to data.
.size "uint32_t" --- Data size.
.offset "uint32_t" --- Offset in vertex buffer.
.num "uint32_t" --- Number of instances.
.stride "uint16_t" --- Vertex buffer stride.
.handle "VertexBufferHandle" --- Vertex buffer object handle.
--- Texture info.
struct.TextureInfo
.format "TextureFormat::Enum" --- Texture format.
.storageSize "uint32_t" --- Total amount of bytes required to store texture.
.width "uint16_t" --- Texture width.
.height "uint16_t" --- Texture height.
.depth "uint16_t" --- Texture depth.
.numLayers "uint16_t" --- Number of layers in texture array.
.numMips "uint8_t" --- Number of MIP maps.
.bitsPerPixel "uint8_t" --- Format bits per pixel.
.cubeMap "bool" --- Texture is cubemap.
--- Uniform info.
struct.UniformInfo
.name "char[256]" --- Uniform name.
.type "UniformType::Enum" --- Uniform type.
.num "uint16_t" --- Number of elements in array.
--- Frame buffer texture attachment info.
struct.Attachment { shortname }
.access "Access::Enum" --- Attachment access. See `Access::Enum`.
.handle "TextureHandle" --- Render target texture handle.
.mip "uint16_t" --- Mip level.
.layer "uint16_t" --- Cubemap side or depth layer/slice to use.
.numLayers "uint16_t" --- Number of texture layer/slice(s) in array to use.
.resolve "uint8_t" --- Resolve flags. See: `BGFX_RESOLVE_*`
--- Init attachment.
func.Attachment.init
"void"
.handle "TextureHandle" --- Render target texture handle.
.access "Access::Enum" --- Access. See `Access::Enum`.
{ default = "Access::Write" }
.layer "uint16_t" --- Cubemap side or depth layer/slice to use.
{ default = 0 }
.numLayers "uint16_t" --- Number of texture layer/slice(s) in array to use.
{ default = 1 }
.mip "uint16_t" --- Mip level.
{ default = 0 }
.resolve "uint8_t" --- Resolve flags. See: `BGFX_RESOLVE_*`
{ default = "BGFX_RESOLVE_AUTO_GEN_MIPS" }
--- Transform data.
struct.Transform
.data "float*" --- Pointer to first 4x4 matrix.
.num "uint16_t" --- Number of matrices.
--- View stats.
struct.ViewStats
.name "char[256]" --- View name.
.view "ViewId" --- View id.
.cpuTimeBegin "int64_t" --- CPU (submit) begin time.
.cpuTimeEnd "int64_t" --- CPU (submit) end time.
.gpuTimeBegin "int64_t" --- GPU begin time.
.gpuTimeEnd "int64_t" --- GPU end time.
.gpuFrameNum "uint32_t" --- Frame which generated gpuTimeBegin, gpuTimeEnd.
--- Encoder stats.
struct.EncoderStats
.cpuTimeBegin "int64_t" --- Encoder thread CPU submit begin time.
.cpuTimeEnd "int64_t" --- Encoder thread CPU submit end time.
--- Renderer statistics data.
---
--- @remarks All time values are high-resolution timestamps, while
--- time frequencies define timestamps-per-second for that hardware.
struct.Stats
.cpuTimeFrame "int64_t" --- CPU time between two `bgfx::frame` calls.
.cpuTimeBegin "int64_t" --- Render thread CPU submit begin time.
.cpuTimeEnd "int64_t" --- Render thread CPU submit end time.
.cpuTimerFreq "int64_t" --- CPU timer frequency. Timestamps-per-second
.gpuTimeBegin "int64_t" --- GPU frame begin time.
.gpuTimeEnd "int64_t" --- GPU frame end time.
.gpuTimerFreq "int64_t" --- GPU timer frequency.
.waitRender "int64_t" --- Time spent waiting for render backend thread to finish issuing draw commands to underlying graphics API.
.waitSubmit "int64_t" --- Time spent waiting for submit thread to advance to next frame.
.numDraw "uint32_t" --- Number of draw calls submitted.
.numCompute "uint32_t" --- Number of compute calls submitted.
.numBlit "uint32_t" --- Number of blit calls submitted.
.maxGpuLatency "uint32_t" --- GPU driver latency.
.gpuFrameNum "uint32_t" --- Frame which generated gpuTimeBegin, gpuTimeEnd.
.numDynamicIndexBuffers "uint16_t" --- Number of used dynamic index buffers.
.numDynamicVertexBuffers "uint16_t" --- Number of used dynamic vertex buffers.
.numFrameBuffers "uint16_t" --- Number of used frame buffers.
.numIndexBuffers "uint16_t" --- Number of used index buffers.
.numOcclusionQueries "uint16_t" --- Number of used occlusion queries.
.numPrograms "uint16_t" --- Number of used programs.
.numShaders "uint16_t" --- Number of used shaders.
.numTextures "uint16_t" --- Number of used textures.
.numUniforms "uint16_t" --- Number of used uniforms.
.numVertexBuffers "uint16_t" --- Number of used vertex buffers.
.numVertexLayouts "uint16_t" --- Number of used vertex layouts.
.textureMemoryUsed "int64_t" --- Estimate of texture memory used.
.rtMemoryUsed "int64_t" --- Estimate of render target memory used.
.transientVbUsed "int32_t" --- Amount of transient vertex buffer used.
.transientIbUsed "int32_t" --- Amount of transient index buffer used.
.numPrims "uint32_t[Topology::Count]" --- Number of primitives rendered.
.gpuMemoryMax "int64_t" --- Maximum available GPU memory for application.
.gpuMemoryUsed "int64_t" --- Amount of GPU memory used by the application.
.width "uint16_t" --- Backbuffer width in pixels.
.height "uint16_t" --- Backbuffer height in pixels.
.textWidth "uint16_t" --- Debug text width in characters.
.textHeight "uint16_t" --- Debug text height in characters.
.numViews "uint16_t" --- Number of view stats.
.viewStats "ViewStats*" --- Array of View stats.
.numEncoders "uint8_t" --- Number of encoders used during frame.
.encoderStats "EncoderStats*" --- Array of encoder stats.
--- Vertex layout.
struct.VertexLayout { ctor }
.hash "uint32_t" --- Hash.
.stride "uint16_t" --- Stride.
.offset "uint16_t[Attrib::Count]" --- Attribute offsets.
.attributes "uint16_t[Attrib::Count]" --- Used attributes.
--- Encoders are used for submitting draw calls from multiple threads. Only one encoder
--- per thread should be used. Use `bgfx::begin()` to obtain an encoder for a thread.