-
Notifications
You must be signed in to change notification settings - Fork 5
/
gfx.d
1916 lines (1912 loc) · 55.4 KB
/
gfx.d
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
// machine generated, do not edit
module sokol.gfx;
// helper function to convert a C string to a D string
string cStrTod(T)(scope T c_str) nothrow {
import std.conv: to;
return c_str.to!string;
}
// WIP: helper function to convert "anything" to a Range struct
Range asRange(T)(T val) @trusted {
import std.traits;
static if (isPointer!T) {
return Range(val, T.sizeof);
} else static if (is(T == float[]) || is(T == double[])) {
auto arr = val.dup;
return Range(&arr[0], arr.length * arr[0].sizeof);
} else static if (is(T == struct)) {
Range r = {ptr: cast(const(void)*)&val, size: T.sizeof};
return r;
} else {
static assert(0, "Cannot convert to range");
}
}
extern(C)
struct Buffer {
uint id;
}
extern(C)
struct Image {
uint id;
}
extern(C)
struct Sampler {
uint id;
}
extern(C)
struct Shader {
uint id;
}
extern(C)
struct Pipeline {
uint id;
}
extern(C)
struct Pass {
uint id;
}
extern(C)
struct Context {
uint id;
}
extern(C)
struct Range {
const(void)* ptr;
size_t size;
}
enum invalid_id = 0;
enum num_shader_stages = 2;
enum num_inflight_frames = 2;
enum max_color_attachments = 4;
enum max_vertex_buffers = 8;
enum max_shaderstage_images = 12;
enum max_shaderstage_samplers = 8;
enum max_shaderstage_imagesamplerpairs = 12;
enum max_shaderstage_ubs = 4;
enum max_ub_members = 16;
enum max_vertex_attributes = 16;
enum max_mipmaps = 16;
enum max_texturearray_layers = 128;
extern(C)
struct Color {
float r;
float g;
float b;
float a;
}
enum Backend {
Glcore33,
Gles3,
D3d11,
Metal_ios,
Metal_macos,
Metal_simulator,
Wgpu,
Dummy,
}
enum PixelFormat {
Default,
None,
R8,
R8sn,
R8ui,
R8si,
R16,
R16sn,
R16ui,
R16si,
R16f,
Rg8,
Rg8sn,
Rg8ui,
Rg8si,
R32ui,
R32si,
R32f,
Rg16,
Rg16sn,
Rg16ui,
Rg16si,
Rg16f,
Rgba8,
Srgb8a8,
Rgba8sn,
Rgba8ui,
Rgba8si,
Bgra8,
Rgb10a2,
Rg11b10f,
Rg32ui,
Rg32si,
Rg32f,
Rgba16,
Rgba16sn,
Rgba16ui,
Rgba16si,
Rgba16f,
Rgba32ui,
Rgba32si,
Rgba32f,
Depth,
Depth_stencil,
Bc1_rgba,
Bc2_rgba,
Bc3_rgba,
Bc4_r,
Bc4_rsn,
Bc5_rg,
Bc5_rgsn,
Bc6h_rgbf,
Bc6h_rgbuf,
Bc7_rgba,
Pvrtc_rgb_2bpp,
Pvrtc_rgb_4bpp,
Pvrtc_rgba_2bpp,
Pvrtc_rgba_4bpp,
Etc2_rgb8,
Etc2_rgb8a1,
Etc2_rgba8,
Etc2_rg11,
Etc2_rg11sn,
Rgb9e5,
Num,
}
extern(C)
struct PixelformatInfo {
bool sample;
bool filter;
bool render;
bool blend;
bool msaa;
bool depth;
}
extern(C)
struct Features {
bool origin_top_left;
bool image_clamp_to_border;
bool mrt_independent_blend_state;
bool mrt_independent_write_mask;
}
extern(C)
struct Limits {
int max_image_size_2d;
int max_image_size_cube;
int max_image_size_3d;
int max_image_size_array;
int max_image_array_layers;
int max_vertex_attrs;
int gl_max_vertex_uniform_vectors;
int gl_max_combined_texture_image_units;
}
enum ResourceState {
Initial,
Alloc,
Valid,
Failed,
Invalid,
}
enum Usage {
Default,
Immutable,
Dynamic,
Stream,
Num,
}
enum BufferType {
Default,
Vertexbuffer,
Indexbuffer,
Num,
}
enum IndexType {
Default,
None,
Uint16,
Uint32,
Num,
}
enum ImageType {
Default,
_2d,
Cube,
_3d,
Array,
Num,
}
enum ImageSampleType {
Default,
Float,
Depth,
Sint,
Uint,
Unfilterable_float,
Num,
}
enum SamplerType {
Default,
Filtering,
Nonfiltering,
Comparison,
Num,
}
enum CubeFace {
Pos_x,
Neg_x,
Pos_y,
Neg_y,
Pos_z,
Neg_z,
Num,
}
enum ShaderStage {
Vs,
Fs,
}
enum PrimitiveType {
Default,
Points,
Lines,
Line_strip,
Triangles,
Triangle_strip,
Num,
}
enum Filter {
Default,
None,
Nearest,
Linear,
Num,
}
enum Wrap {
Default,
Repeat,
Clamp_to_edge,
Clamp_to_border,
Mirrored_repeat,
Num,
}
enum BorderColor {
Default,
Transparent_black,
Opaque_black,
Opaque_white,
Num,
}
enum VertexFormat {
Invalid,
Float,
Float2,
Float3,
Float4,
Byte4,
Byte4n,
Ubyte4,
Ubyte4n,
Short2,
Short2n,
Ushort2n,
Short4,
Short4n,
Ushort4n,
Uint10_n2,
Half2,
Half4,
Num,
}
enum VertexStep {
Default,
Per_vertex,
Per_instance,
Num,
}
enum UniformType {
Invalid,
Float,
Float2,
Float3,
Float4,
Int,
Int2,
Int3,
Int4,
Mat4,
Num,
}
enum UniformLayout {
Default,
Native,
Std140,
Num,
}
enum CullMode {
Default,
None,
Front,
Back,
Num,
}
enum FaceWinding {
Default,
Ccw,
Cw,
Num,
}
enum CompareFunc {
Default,
Never,
Less,
Equal,
Less_equal,
Greater,
Not_equal,
Greater_equal,
Always,
Num,
}
enum StencilOp {
Default,
Keep,
Zero,
Replace,
Incr_clamp,
Decr_clamp,
Invert,
Incr_wrap,
Decr_wrap,
Num,
}
enum BlendFactor {
Default,
Zero,
One,
Src_color,
One_minus_src_color,
Src_alpha,
One_minus_src_alpha,
Dst_color,
One_minus_dst_color,
Dst_alpha,
One_minus_dst_alpha,
Src_alpha_saturated,
Blend_color,
One_minus_blend_color,
Blend_alpha,
One_minus_blend_alpha,
Num,
}
enum BlendOp {
Default,
Add,
Subtract,
Reverse_subtract,
Num,
}
enum ColorMask {
Default = 0,
None = 16,
R = 1,
G = 2,
Rg = 3,
B = 4,
Rb = 5,
Gb = 6,
Rgb = 7,
A = 8,
Ra = 9,
Ga = 10,
Rga = 11,
Ba = 12,
Rba = 13,
Gba = 14,
Rgba = 15,
}
enum LoadAction {
Default,
Clear,
Load,
Dontcare,
}
enum StoreAction {
Default,
Store,
Dontcare,
}
extern(C)
struct ColorAttachmentAction {
LoadAction load_action;
StoreAction store_action;
Color clear_value;
}
extern(C)
struct DepthAttachmentAction {
LoadAction load_action;
StoreAction store_action;
float clear_value;
}
extern(C)
struct StencilAttachmentAction {
LoadAction load_action;
StoreAction store_action;
ubyte clear_value;
}
extern(C)
struct PassAction {
uint _start_canary;
ColorAttachmentAction[4] colors;
DepthAttachmentAction depth;
StencilAttachmentAction stencil;
uint _end_canary;
}
extern(C)
struct StageBindings {
Image[12] images;
Sampler[8] samplers;
}
extern(C)
struct Bindings {
uint _start_canary;
Buffer[8] vertex_buffers;
int[8] vertex_buffer_offsets;
Buffer index_buffer;
int index_buffer_offset;
StageBindings vs;
StageBindings fs;
uint _end_canary;
}
extern(C)
struct BufferDesc {
uint _start_canary;
size_t size;
BufferType type;
Usage usage;
Range data;
const(char)* label;
uint[2] gl_buffers;
const(void)*[2] mtl_buffers;
const(void)* d3d11_buffer;
const(void)* wgpu_buffer;
uint _end_canary;
}
extern(C)
struct ImageData {
Range[6][16] subimage;
}
extern(C)
struct ImageDesc {
uint _start_canary;
ImageType type;
bool render_target;
int width;
int height;
int num_slices;
int num_mipmaps;
Usage usage;
PixelFormat pixel_format;
int sample_count;
ImageData data;
const(char)* label;
uint[2] gl_textures;
uint gl_texture_target;
const(void)*[2] mtl_textures;
const(void)* d3d11_texture;
const(void)* d3d11_shader_resource_view;
const(void)* wgpu_texture;
const(void)* wgpu_texture_view;
uint _end_canary;
}
extern(C)
struct SamplerDesc {
uint _start_canary;
Filter min_filter;
Filter mag_filter;
Filter mipmap_filter;
Wrap wrap_u;
Wrap wrap_v;
Wrap wrap_w;
float min_lod;
float max_lod;
BorderColor border_color;
CompareFunc compare;
uint max_anisotropy;
const(char)* label;
uint gl_sampler;
const(void)* mtl_sampler;
const(void)* d3d11_sampler;
const(void)* wgpu_sampler;
uint _end_canary;
}
extern(C)
struct ShaderAttrDesc {
const(char)* name;
const(char)* sem_name;
int sem_index;
}
extern(C)
struct ShaderUniformDesc {
const(char)* name;
UniformType type;
int array_count;
}
extern(C)
struct ShaderUniformBlockDesc {
size_t size;
UniformLayout layout;
ShaderUniformDesc[16] uniforms;
}
extern(C)
struct ShaderImageDesc {
bool used;
bool multisampled;
ImageType image_type;
ImageSampleType sample_type;
}
extern(C)
struct ShaderSamplerDesc {
bool used;
SamplerType sampler_type;
}
extern(C)
struct ShaderImageSamplerPairDesc {
bool used;
int image_slot;
int sampler_slot;
const(char)* glsl_name;
}
extern(C)
struct ShaderStageDesc {
const(char)* source;
Range bytecode;
const(char)* entry;
const(char)* d3d11_target;
ShaderUniformBlockDesc[4] uniform_blocks;
ShaderImageDesc[12] images;
ShaderSamplerDesc[8] samplers;
ShaderImageSamplerPairDesc[12] image_sampler_pairs;
}
extern(C)
struct ShaderDesc {
uint _start_canary;
ShaderAttrDesc[16] attrs;
ShaderStageDesc vs;
ShaderStageDesc fs;
const(char)* label;
uint _end_canary;
}
extern(C)
struct VertexBufferLayoutState {
int stride;
VertexStep step_func;
int step_rate;
}
extern(C)
struct VertexAttrState {
int buffer_index;
int offset;
VertexFormat format;
}
extern(C)
struct VertexLayoutState {
VertexBufferLayoutState[8] buffers;
VertexAttrState[16] attrs;
}
extern(C)
struct StencilFaceState {
CompareFunc compare;
StencilOp fail_op;
StencilOp depth_fail_op;
StencilOp pass_op;
}
extern(C)
struct StencilState {
bool enabled;
StencilFaceState front;
StencilFaceState back;
ubyte read_mask;
ubyte write_mask;
ubyte _ref;
}
extern(C)
struct DepthState {
PixelFormat pixel_format;
CompareFunc compare;
bool write_enabled;
float bias;
float bias_slope_scale;
float bias_clamp;
}
extern(C)
struct BlendState {
bool enabled;
BlendFactor src_factor_rgb;
BlendFactor dst_factor_rgb;
BlendOp op_rgb;
BlendFactor src_factor_alpha;
BlendFactor dst_factor_alpha;
BlendOp op_alpha;
}
extern(C)
struct ColorTargetState {
PixelFormat pixel_format;
ColorMask write_mask;
BlendState blend;
}
extern(C)
struct PipelineDesc {
uint _start_canary;
Shader shader;
VertexLayoutState layout;
DepthState depth;
StencilState stencil;
int color_count;
ColorTargetState[4] colors;
PrimitiveType primitive_type;
IndexType index_type;
CullMode cull_mode;
FaceWinding face_winding;
int sample_count;
Color blend_color;
bool alpha_to_coverage_enabled;
const(char)* label;
uint _end_canary;
}
extern(C)
struct PassAttachmentDesc {
Image image;
int mip_level;
int slice;
}
extern(C)
struct PassDesc {
uint _start_canary;
PassAttachmentDesc[4] color_attachments;
PassAttachmentDesc[4] resolve_attachments;
PassAttachmentDesc depth_stencil_attachment;
const(char)* label;
uint _end_canary;
}
extern(C)
struct TraceHooks {
void* user_data;
extern(C) void function(void*) reset_state_cache;
extern(C) void function(const BufferDesc *, Buffer, void*) make_buffer;
extern(C) void function(const ImageDesc *, Image, void*) make_image;
extern(C) void function(const SamplerDesc *, Sampler, void*) make_sampler;
extern(C) void function(const ShaderDesc *, Shader, void*) make_shader;
extern(C) void function(const PipelineDesc *, Pipeline, void*) make_pipeline;
extern(C) void function(const PassDesc *, Pass, void*) make_pass;
extern(C) void function(Buffer, void*) destroy_buffer;
extern(C) void function(Image, void*) destroy_image;
extern(C) void function(Sampler, void*) destroy_sampler;
extern(C) void function(Shader, void*) destroy_shader;
extern(C) void function(Pipeline, void*) destroy_pipeline;
extern(C) void function(Pass, void*) destroy_pass;
extern(C) void function(Buffer, const Range *, void*) update_buffer;
extern(C) void function(Image, const ImageData *, void*) update_image;
extern(C) void function(Buffer, const Range *, int, void*) append_buffer;
extern(C) void function(const PassAction *, int, int, void*) begin_default_pass;
extern(C) void function(Pass, const PassAction *, void*) begin_pass;
extern(C) void function(int, int, int, int, bool, void*) apply_viewport;
extern(C) void function(int, int, int, int, bool, void*) apply_scissor_rect;
extern(C) void function(Pipeline, void*) apply_pipeline;
extern(C) void function(const Bindings *, void*) apply_bindings;
extern(C) void function(ShaderStage, int, const Range *, void*) apply_uniforms;
extern(C) void function(int, int, int, void*) draw;
extern(C) void function(void*) end_pass;
extern(C) void function(void*) commit;
extern(C) void function(Buffer, void*) alloc_buffer;
extern(C) void function(Image, void*) alloc_image;
extern(C) void function(Sampler, void*) alloc_sampler;
extern(C) void function(Shader, void*) alloc_shader;
extern(C) void function(Pipeline, void*) alloc_pipeline;
extern(C) void function(Pass, void*) alloc_pass;
extern(C) void function(Buffer, void*) dealloc_buffer;
extern(C) void function(Image, void*) dealloc_image;
extern(C) void function(Sampler, void*) dealloc_sampler;
extern(C) void function(Shader, void*) dealloc_shader;
extern(C) void function(Pipeline, void*) dealloc_pipeline;
extern(C) void function(Pass, void*) dealloc_pass;
extern(C) void function(Buffer, const BufferDesc *, void*) init_buffer;
extern(C) void function(Image, const ImageDesc *, void*) init_image;
extern(C) void function(Sampler, const SamplerDesc *, void*) init_sampler;
extern(C) void function(Shader, const ShaderDesc *, void*) init_shader;
extern(C) void function(Pipeline, const PipelineDesc *, void*) init_pipeline;
extern(C) void function(Pass, const PassDesc *, void*) init_pass;
extern(C) void function(Buffer, void*) uninit_buffer;
extern(C) void function(Image, void*) uninit_image;
extern(C) void function(Sampler, void*) uninit_sampler;
extern(C) void function(Shader, void*) uninit_shader;
extern(C) void function(Pipeline, void*) uninit_pipeline;
extern(C) void function(Pass, void*) uninit_pass;
extern(C) void function(Buffer, void*) fail_buffer;
extern(C) void function(Image, void*) fail_image;
extern(C) void function(Sampler, void*) fail_sampler;
extern(C) void function(Shader, void*) fail_shader;
extern(C) void function(Pipeline, void*) fail_pipeline;
extern(C) void function(Pass, void*) fail_pass;
extern(C) void function(scope const(char)*, void*) push_debug_group;
extern(C) void function(void*) pop_debug_group;
}
extern(C)
struct SlotInfo {
ResourceState state;
uint res_id;
uint ctx_id;
}
extern(C)
struct BufferInfo {
SlotInfo slot;
uint update_frame_index;
uint append_frame_index;
int append_pos;
bool append_overflow;
int num_slots;
int active_slot;
}
extern(C)
struct ImageInfo {
SlotInfo slot;
uint upd_frame_index;
int num_slots;
int active_slot;
}
extern(C)
struct SamplerInfo {
SlotInfo slot;
}
extern(C)
struct ShaderInfo {
SlotInfo slot;
}
extern(C)
struct PipelineInfo {
SlotInfo slot;
}
extern(C)
struct PassInfo {
SlotInfo slot;
}
extern(C)
struct FrameStatsGl {
uint num_bind_buffer;
uint num_active_texture;
uint num_bind_texture;
uint num_bind_sampler;
uint num_use_program;
uint num_render_state;
uint num_vertex_attrib_pointer;
uint num_vertex_attrib_divisor;
uint num_enable_vertex_attrib_array;
uint num_disable_vertex_attrib_array;
uint num_uniform;
}
extern(C)
struct FrameStatsD3d11Pass {
uint num_om_set_render_targets;
uint num_clear_render_target_view;
uint num_clear_depth_stencil_view;
uint num_resolve_subresource;
}
extern(C)
struct FrameStatsD3d11Pipeline {
uint num_rs_set_state;
uint num_om_set_depth_stencil_state;
uint num_om_set_blend_state;
uint num_ia_set_primitive_topology;
uint num_ia_set_input_layout;
uint num_vs_set_shader;
uint num_vs_set_constant_buffers;
uint num_ps_set_shader;
uint num_ps_set_constant_buffers;
}
extern(C)
struct FrameStatsD3d11Bindings {
uint num_ia_set_vertex_buffers;
uint num_ia_set_index_buffer;
uint num_vs_set_shader_resources;
uint num_ps_set_shader_resources;
uint num_vs_set_samplers;
uint num_ps_set_samplers;
}
extern(C)
struct FrameStatsD3d11Uniforms {
uint num_update_subresource;
}
extern(C)
struct FrameStatsD3d11Draw {
uint num_draw_indexed_instanced;
uint num_draw_indexed;
uint num_draw_instanced;
uint num_draw;
}
extern(C)
struct FrameStatsD3d11 {
FrameStatsD3d11Pass pass;
FrameStatsD3d11Pipeline pipeline;
FrameStatsD3d11Bindings bindings;
FrameStatsD3d11Uniforms uniforms;
FrameStatsD3d11Draw draw;
uint num_map;
uint num_unmap;
}
extern(C)
struct FrameStatsMetalIdpool {
uint num_added;
uint num_released;
uint num_garbage_collected;
}
extern(C)
struct FrameStatsMetalPipeline {
uint num_set_blend_color;
uint num_set_cull_mode;
uint num_set_front_facing_winding;
uint num_set_stencil_reference_value;
uint num_set_depth_bias;
uint num_set_render_pipeline_state;
uint num_set_depth_stencil_state;
}
extern(C)
struct FrameStatsMetalBindings {
uint num_set_vertex_buffer;
uint num_set_vertex_texture;
uint num_set_vertex_sampler_state;
uint num_set_fragment_texture;
uint num_set_fragment_sampler_state;
}
extern(C)
struct FrameStatsMetalUniforms {
uint num_set_vertex_buffer_offset;
uint num_set_fragment_buffer_offset;
}
extern(C)
struct FrameStatsMetal {
FrameStatsMetalIdpool idpool;
FrameStatsMetalPipeline pipeline;
FrameStatsMetalBindings bindings;
FrameStatsMetalUniforms uniforms;
}
extern(C)
struct FrameStatsWgpuUniforms {
uint num_set_bindgroup;
uint size_write_buffer;
}
extern(C)
struct FrameStatsWgpuBindings {
uint num_set_vertex_buffer;
uint num_skip_redundant_vertex_buffer;
uint num_set_index_buffer;
uint num_skip_redundant_index_buffer;
uint num_create_bindgroup;
uint num_discard_bindgroup;
uint num_set_bindgroup;
uint num_skip_redundant_bindgroup;
uint num_bindgroup_cache_hits;
uint num_bindgroup_cache_misses;
uint num_bindgroup_cache_collisions;
uint num_bindgroup_cache_hash_vs_key_mismatch;
}
extern(C)
struct FrameStatsWgpu {
FrameStatsWgpuUniforms uniforms;
FrameStatsWgpuBindings bindings;
}
extern(C)
struct FrameStats {
uint frame_index;
uint num_passes;
uint num_apply_viewport;
uint num_apply_scissor_rect;
uint num_apply_pipeline;
uint num_apply_bindings;
uint num_apply_uniforms;
uint num_draw;
uint num_update_buffer;
uint num_append_buffer;
uint num_update_image;
uint size_apply_uniforms;
uint size_update_buffer;
uint size_append_buffer;
uint size_update_image;
FrameStatsGl gl;
FrameStatsD3d11 d3d11;
FrameStatsMetal metal;
FrameStatsWgpu wgpu;
}
enum LogItem {
Ok,
Malloc_failed,
Gl_texture_format_not_supported,
Gl_3d_textures_not_supported,
Gl_array_textures_not_supported,
Gl_shader_compilation_failed,
Gl_shader_linking_failed,
Gl_vertex_attribute_not_found_in_shader,
Gl_texture_name_not_found_in_shader,
Gl_framebuffer_status_undefined,
Gl_framebuffer_status_incomplete_attachment,
Gl_framebuffer_status_incomplete_missing_attachment,
Gl_framebuffer_status_unsupported,
Gl_framebuffer_status_incomplete_multisample,
Gl_framebuffer_status_unknown,
D3d11_create_buffer_failed,
D3d11_create_depth_texture_unsupported_pixel_format,
D3d11_create_depth_texture_failed,
D3d11_create_2d_texture_unsupported_pixel_format,
D3d11_create_2d_texture_failed,
D3d11_create_2d_srv_failed,
D3d11_create_3d_texture_unsupported_pixel_format,
D3d11_create_3d_texture_failed,
D3d11_create_3d_srv_failed,
D3d11_create_msaa_texture_failed,
D3d11_create_sampler_state_failed,
D3d11_load_d3dcompiler_47_dll_failed,
D3d11_shader_compilation_failed,
D3d11_shader_compilation_output,
D3d11_create_constant_buffer_failed,
D3d11_create_input_layout_failed,
D3d11_create_rasterizer_state_failed,
D3d11_create_depth_stencil_state_failed,
D3d11_create_blend_state_failed,
D3d11_create_rtv_failed,
D3d11_create_dsv_failed,
D3d11_map_for_update_buffer_failed,
D3d11_map_for_append_buffer_failed,
D3d11_map_for_update_image_failed,
Metal_create_buffer_failed,
Metal_texture_format_not_supported,
Metal_create_texture_failed,
Metal_create_sampler_failed,
Metal_shader_compilation_failed,
Metal_shader_creation_failed,
Metal_shader_compilation_output,
Metal_vertex_shader_entry_not_found,
Metal_fragment_shader_entry_not_found,
Metal_create_rps_failed,
Metal_create_rps_output,
Metal_create_dss_failed,
Wgpu_bindgroups_pool_exhausted,
Wgpu_bindgroupscache_size_greater_one,
Wgpu_bindgroupscache_size_pow2,
Wgpu_createbindgroup_failed,
Wgpu_create_buffer_failed,
Wgpu_create_texture_failed,
Wgpu_create_texture_view_failed,
Wgpu_create_sampler_failed,
Wgpu_create_shader_module_failed,
Wgpu_shader_too_many_images,
Wgpu_shader_too_many_samplers,
Wgpu_shader_create_bindgroup_layout_failed,
Wgpu_create_pipeline_layout_failed,
Wgpu_create_render_pipeline_failed,
Wgpu_pass_create_texture_view_failed,
Uninit_buffer_active_context_mismatch,
Uninit_image_active_context_mismatch,
Uninit_sampler_active_context_mismatch,
Uninit_shader_active_context_mismatch,
Uninit_pipeline_active_context_mismatch,
Uninit_pass_active_context_mismatch,
Identical_commit_listener,
Commit_listener_array_full,
Trace_hooks_not_enabled,
Dealloc_buffer_invalid_state,
Dealloc_image_invalid_state,
Dealloc_sampler_invalid_state,
Dealloc_shader_invalid_state,
Dealloc_pipeline_invalid_state,
Dealloc_pass_invalid_state,
Init_buffer_invalid_state,