1 /++
2 + Machine generated D bindings for Sokol library.
3 + 
4 +     Source header: sokol_gfx.h
5 +     Module: sokol.gfx
6 + 
7 +     Do not edit manually; regenerate using gen_d.py.
8 +/
9 module sokol.gfx;
10 
11 /++
12 + Resource id typedefs:
13 + 
14 +     sg_buffer:      vertex- and index-buffers
15 +     sg_image:       images used as textures and render-pass attachments
16 +     sg_sampler      sampler objects describing how a texture is sampled in a shader
17 +     sg_shader:      vertex- and fragment-shaders and shader interface information
18 +     sg_pipeline:    associated shader and vertex-layouts, and render states
19 +     sg_view:        a resource view object used for bindings and render-pass attachments
20 + 
21 +     Instead of pointers, resource creation functions return a 32-bit
22 +     handle which uniquely identifies the resource object.
23 + 
24 +     The 32-bit resource id is split into a 16-bit pool index in the lower bits,
25 +     and a 16-bit 'generation counter' in the upper bits. The index allows fast
26 +     pool lookups, and combined with the generation-counter it allows to detect
27 +     'dangling accesses' (trying to use an object which no longer exists, and
28 +     its pool slot has been reused for a new object)
29 + 
30 +     The resource ids are wrapped into a strongly-typed struct so that
31 +     trying to pass an incompatible resource id is a compile error.
32 +/
33 extern(C) struct Buffer {
34     uint id = 0;
35 }
36 extern(C) struct Image {
37     uint id = 0;
38 }
39 extern(C) struct Sampler {
40     uint id = 0;
41 }
42 extern(C) struct Shader {
43     uint id = 0;
44 }
45 extern(C) struct Pipeline {
46     uint id = 0;
47 }
48 extern(C) struct View {
49     uint id = 0;
50 }
51 /++
52 + sg_range is a pointer-size-pair struct used to pass memory blobs into
53 +     sokol-gfx. When initialized from a value type (array or struct), you can
54 +     use the SG_RANGE() macro to build an sg_range struct. For functions which
55 +     take either a sg_range pointer, or a (C++) sg_range reference, use the
56 +     SG_RANGE_REF macro as a solution which compiles both in C and C++.
57 +/
58 extern(C) struct Range {
59     const(void)* ptr = null;
60     size_t size = 0;
61 }
62 /++
63 + various compile-time constants in the public API
64 +/
65 enum invalid_id = 0;
66 enum num_inflight_frames = 2;
67 enum max_color_attachments = 8;
68 enum max_uniformblock_members = 16;
69 enum max_vertex_attributes = 16;
70 enum max_mipmaps = 16;
71 enum max_vertexbuffer_bindslots = 8;
72 enum max_uniformblock_bindslots = 8;
73 enum max_view_bindslots = 32;
74 enum max_sampler_bindslots = 12;
75 enum max_texture_sampler_pairs = 32;
76 enum max_portable_color_attachments = 4;
77 enum max_portable_texture_bindings_per_stage = 16;
78 enum max_portable_storagebuffer_bindings_per_stage = 8;
79 enum max_portable_storageimage_bindings_per_stage = 4;
80 /++
81 + sg_color
82 + 
83 +     An RGBA color value.
84 +/
85 extern(C) struct Color {
86     float r = 0.0f;
87     float g = 0.0f;
88     float b = 0.0f;
89     float a = 0.0f;
90 }
91 /++
92 + sg_backend
93 + 
94 +     The active 3D-API backend, use the function sg_query_backend()
95 +     to get the currently active backend.
96 +/
97 enum Backend {
98     Glcore,
99     Gles3,
100     D3d11,
101     Metal_ios,
102     Metal_macos,
103     Metal_simulator,
104     Wgpu,
105     Vulkan,
106     Dummy,
107 }
108 /++
109 + sg_pixel_format
110 + 
111 +     sokol_gfx.h basically uses the same pixel formats as WebGPU, since these
112 +     are supported on most newer GPUs.
113 + 
114 +     A pixelformat name consist of three parts:
115 + 
116 +         - components (R, RG, RGB or RGBA)
117 +         - bit width per component (8, 16 or 32)
118 +         - component data type:
119 +             - unsigned normalized (no postfix)
120 +             - signed normalized (SN postfix)
121 +             - unsigned integer (UI postfix)
122 +             - signed integer (SI postfix)
123 +             - float (F postfix)
124 + 
125 +     Not all pixel formats can be used for everything, call sg_query_pixelformat()
126 +     to inspect the capabilities of a given pixelformat. The function returns
127 +     an sg_pixelformat_info struct with the following members:
128 + 
129 +         - sample: the pixelformat can be sampled as texture at least with
130 +                   nearest filtering
131 +         - filter: the pixelformat can be sampled as texture with linear
132 +                   filtering
133 +         - render: the pixelformat can be used as render-pass attachment
134 +         - blend:  blending is supported when used as render-pass attachment
135 +         - msaa:   multisample-antialiasing is supported when used
136 +                   as render-pass attachment
137 +         - depth:  the pixelformat can be used for depth-stencil attachments
138 +         - compressed: this is a block-compressed format
139 +         - bytes_per_pixel: the numbers of bytes in a pixel (0 for compressed formats)
140 + 
141 +     The default pixel format for texture images is SG_PIXELFORMAT_RGBA8.
142 + 
143 +     The default pixel format for render target images is platform-dependent
144 +     and taken from the sg_environment struct passed into sg_setup(). Typically
145 +     the default formats are:
146 + 
147 +         - for the Metal, D3D11 and WebGPU backends: SG_PIXELFORMAT_BGRA8
148 +         - for GL backends: SG_PIXELFORMAT_RGBA8
149 +/
150 enum PixelFormat {
151     Default,
152     None,
153     R8,
154     R8sn,
155     R8ui,
156     R8si,
157     R16,
158     R16sn,
159     R16ui,
160     R16si,
161     R16f,
162     Rg8,
163     Rg8sn,
164     Rg8ui,
165     Rg8si,
166     R32ui,
167     R32si,
168     R32f,
169     Rg16,
170     Rg16sn,
171     Rg16ui,
172     Rg16si,
173     Rg16f,
174     Rgba8,
175     Srgb8a8,
176     Rgba8sn,
177     Rgba8ui,
178     Rgba8si,
179     Bgra8,
180     Rgb10a2,
181     Rg11b10f,
182     Rgb9e5,
183     Rg32ui,
184     Rg32si,
185     Rg32f,
186     Rgba16,
187     Rgba16sn,
188     Rgba16ui,
189     Rgba16si,
190     Rgba16f,
191     Rgba32ui,
192     Rgba32si,
193     Rgba32f,
194     Depth,
195     Depth_stencil,
196     Bc1_rgba,
197     Bc2_rgba,
198     Bc3_rgba,
199     Bc3_srgba,
200     Bc4_r,
201     Bc4_rsn,
202     Bc5_rg,
203     Bc5_rgsn,
204     Bc6h_rgbf,
205     Bc6h_rgbuf,
206     Bc7_rgba,
207     Bc7_srgba,
208     Etc2_rgb8,
209     Etc2_srgb8,
210     Etc2_rgb8a1,
211     Etc2_rgba8,
212     Etc2_srgb8a8,
213     Eac_r11,
214     Eac_r11sn,
215     Eac_rg11,
216     Eac_rg11sn,
217     Astc_4x4_rgba,
218     Astc_4x4_srgba,
219     Num,
220 }
221 /++
222 + Runtime information about a pixel format, returned by sg_query_pixelformat().
223 +/
224 extern(C) struct PixelformatInfo {
225     bool sample = false;
226     bool filter = false;
227     bool render = false;
228     bool blend = false;
229     bool msaa = false;
230     bool depth = false;
231     bool compressed = false;
232     bool read = false;
233     bool write = false;
234     int bytes_per_pixel = 0;
235 }
236 /++
237 + Runtime information about available optional features, returned by sg_query_features()
238 +/
239 extern(C) struct Features {
240     bool origin_top_left = false;
241     bool image_clamp_to_border = false;
242     bool mrt_independent_blend_state = false;
243     bool mrt_independent_write_mask = false;
244     bool compute = false;
245     bool msaa_texture_bindings = false;
246     bool separate_buffer_types = false;
247     bool draw_base_vertex = false;
248     bool draw_base_instance = false;
249     bool dual_source_blending = false;
250     bool vertexformat_int10_n2 = false;
251     bool gl_texture_views = false;
252 }
253 /++
254 + Runtime information about resource limits, returned by sg_query_limit()
255 +/
256 extern(C) struct Limits {
257     int max_image_size_2d = 0;
258     int max_image_size_cube = 0;
259     int max_image_size_3d = 0;
260     int max_image_size_array = 0;
261     int max_image_array_layers = 0;
262     int max_vertex_attrs = 0;
263     int max_color_attachments = 0;
264     int max_texture_bindings_per_stage = 0;
265     int max_storage_buffer_bindings_per_stage = 0;
266     int max_storage_image_bindings_per_stage = 0;
267     int gl_max_vertex_uniform_components = 0;
268     int gl_max_combined_texture_image_units = 0;
269     int d3d11_max_unordered_access_views = 0;
270     int vk_min_uniform_buffer_offset_alignment = 0;
271 }
272 /++
273 + sg_resource_state
274 + 
275 +     The current state of a resource in its resource pool.
276 +     Resources start in the INITIAL state, which means the
277 +     pool slot is unoccupied and can be allocated. When a resource is
278 +     created, first an id is allocated, and the resource pool slot
279 +     is set to state ALLOC. After allocation, the resource is
280 +     initialized, which may result in the VALID or FAILED state. The
281 +     reason why allocation and initialization are separate is because
282 +     some resource types (e.g. buffers and images) might be asynchronously
283 +     initialized by the user application. If a resource which is not
284 +     in the VALID state is attempted to be used for rendering, rendering
285 +     operations will silently be dropped.
286 + 
287 +     The special INVALID state is returned in sg_query_xxx_state() if no
288 +     resource object exists for the provided resource id.
289 +/
290 enum ResourceState {
291     Initial,
292     Alloc,
293     Valid,
294     Failed,
295     Invalid,
296 }
297 /++
298 + sg_index_type
299 + 
300 +     Indicates whether indexed rendering (fetching vertex-indices from an
301 +     index buffer) is used, and if yes, the index data type (16- or 32-bits).
302 + 
303 +     This is used in the sg_pipeline_desc.index_type member when creating a
304 +     pipeline object.
305 + 
306 +     The default index type is SG_INDEXTYPE_NONE.
307 +/
308 enum IndexType {
309     Default,
310     None,
311     Uint16,
312     Uint32,
313     Num,
314 }
315 /++
316 + sg_image_type
317 + 
318 +     Indicates the basic type of an image object (2D-texture, cubemap,
319 +     3D-texture or 2D-array-texture). Used in the sg_image_desc.type member when
320 +     creating an image, and in sg_shader_image_desc to describe a sampled texture
321 +     in the shader (both must match and will be checked in the validation layer
322 +     when calling sg_apply_bindings).
323 + 
324 +     The default image type when creating an image is SG_IMAGETYPE_2D.
325 +/
326 enum ImageType {
327     Default,
328     _2d,
329     Cube,
330     _3d,
331     Array,
332     Num,
333 }
334 /++
335 + sg_image_sample_type
336 + 
337 +     The basic data type of a texture sample as expected by a shader.
338 +     Must be provided in sg_shader_image and used by the validation
339 +     layer in sg_apply_bindings() to check if the provided image object
340 +     is compatible with what the shader expects. Apart from the sokol-gfx
341 +     validation layer, WebGPU is the only backend API which actually requires
342 +     matching texture and sampler type to be provided upfront for validation
343 +     (other 3D APIs treat texture/sampler type mismatches as undefined behaviour).
344 + 
345 +     NOTE that the following texture pixel formats require the use
346 +     of SG_IMAGESAMPLETYPE_UNFILTERABLE_FLOAT, combined with a sampler
347 +     of type SG_SAMPLERTYPE_NONFILTERING:
348 + 
349 +     - SG_PIXELFORMAT_R32F
350 +     - SG_PIXELFORMAT_RG32F
351 +     - SG_PIXELFORMAT_RGBA32F
352 + 
353 +     (when using sokol-shdc, also check out the meta tags `@image_sample_type`
354 +     and `@sampler_type`)
355 +/
356 enum ImageSampleType {
357     Default,
358     Float,
359     Depth,
360     Sint,
361     Uint,
362     Unfilterable_float,
363     Num,
364 }
365 /++
366 + sg_sampler_type
367 + 
368 +     The basic type of a texture sampler (sampling vs comparison) as
369 +     defined in a shader. Must be provided in sg_shader_sampler_desc.
370 + 
371 +     sg_image_sample_type and sg_sampler_type for a texture/sampler
372 +     pair must be compatible with each other, specifically only
373 +     the following pairs are allowed:
374 + 
375 +     - SG_IMAGESAMPLETYPE_FLOAT => (SG_SAMPLERTYPE_FILTERING or SG_SAMPLERTYPE_NONFILTERING)
376 +     - SG_IMAGESAMPLETYPE_UNFILTERABLE_FLOAT => SG_SAMPLERTYPE_NONFILTERING
377 +     - SG_IMAGESAMPLETYPE_SINT => SG_SAMPLERTYPE_NONFILTERING
378 +     - SG_IMAGESAMPLETYPE_UINT => SG_SAMPLERTYPE_NONFILTERING
379 +     - SG_IMAGESAMPLETYPE_DEPTH => SG_SAMPLERTYPE_COMPARISON
380 +/
381 enum SamplerType {
382     Default,
383     Filtering,
384     Nonfiltering,
385     Comparison,
386     Num,
387 }
388 /++
389 + sg_primitive_type
390 + 
391 +     This is the common subset of 3D primitive types supported across all 3D
392 +     APIs. This is used in the sg_pipeline_desc.primitive_type member when
393 +     creating a pipeline object.
394 + 
395 +     The default primitive type is SG_PRIMITIVETYPE_TRIANGLES.
396 +/
397 enum PrimitiveType {
398     Default,
399     Points,
400     Lines,
401     Line_strip,
402     Triangles,
403     Triangle_strip,
404     Num,
405 }
406 /++
407 + sg_filter
408 + 
409 +     The filtering mode when sampling a texture image. This is
410 +     used in the sg_sampler_desc.min_filter, sg_sampler_desc.mag_filter
411 +     and sg_sampler_desc.mipmap_filter members when creating a sampler object.
412 + 
413 +     For the default is SG_FILTER_NEAREST.
414 +/
415 enum Filter {
416     Default,
417     Nearest,
418     Linear,
419     Num,
420 }
421 /++
422 + sg_wrap
423 + 
424 +     The texture coordinates wrapping mode when sampling a texture
425 +     image. This is used in the sg_image_desc.wrap_u, .wrap_v
426 +     and .wrap_w members when creating an image.
427 + 
428 +     The default wrap mode is SG_WRAP_REPEAT.
429 + 
430 +     NOTE: SG_WRAP_CLAMP_TO_BORDER is not supported on all backends
431 +     and platforms. To check for support, call sg_query_features()
432 +     and check the "clamp_to_border" boolean in the returned
433 +     sg_features struct.
434 + 
435 +     Platforms which don't support SG_WRAP_CLAMP_TO_BORDER will silently fall back
436 +     to SG_WRAP_CLAMP_TO_EDGE without a validation error.
437 +/
438 enum Wrap {
439     Default,
440     Repeat,
441     Clamp_to_edge,
442     Clamp_to_border,
443     Mirrored_repeat,
444     Num,
445 }
446 /++
447 + sg_border_color
448 + 
449 +     The border color to use when sampling a texture, and the UV wrap
450 +     mode is SG_WRAP_CLAMP_TO_BORDER.
451 + 
452 +     The default border color is SG_BORDERCOLOR_OPAQUE_BLACK
453 +/
454 enum BorderColor {
455     Default,
456     Transparent_black,
457     Opaque_black,
458     Opaque_white,
459     Num,
460 }
461 /++
462 + sg_vertex_format
463 + 
464 +     The data type of a vertex component. This is used to describe
465 +     the layout of input vertex data when creating a pipeline object.
466 + 
467 +     NOTE that specific mapping rules exist from the CPU-side vertex
468 +     formats to the vertex attribute base type in the vertex shader code
469 +     (see doc header section 'ON VERTEX FORMATS').
470 +/
471 enum VertexFormat {
472     Invalid,
473     Float,
474     Float2,
475     Float3,
476     Float4,
477     Int,
478     Int2,
479     Int3,
480     Int4,
481     Uint,
482     Uint2,
483     Uint3,
484     Uint4,
485     Byte4,
486     Byte4n,
487     Ubyte4,
488     Ubyte4n,
489     Short2,
490     Short2n,
491     Ushort2,
492     Ushort2n,
493     Short4,
494     Short4n,
495     Ushort4,
496     Ushort4n,
497     Int10_n2,
498     Uint10_n2,
499     Half2,
500     Half4,
501     Num,
502 }
503 /++
504 + sg_vertex_step
505 + 
506 +     Defines whether the input pointer of a vertex input stream is advanced
507 +     'per vertex' or 'per instance'. The default step-func is
508 +     SG_VERTEXSTEP_PER_VERTEX. SG_VERTEXSTEP_PER_INSTANCE is used with
509 +     instanced-rendering.
510 + 
511 +     The vertex-step is part of the vertex-layout definition
512 +     when creating pipeline objects.
513 +/
514 enum VertexStep {
515     Default,
516     Per_vertex,
517     Per_instance,
518     Num,
519 }
520 /++
521 + sg_uniform_type
522 + 
523 +     The data type of a uniform block member. This is used to
524 +     describe the internal layout of uniform blocks when creating
525 +     a shader object. This is only required for the GL backend, all
526 +     other backends will ignore the interior layout of uniform blocks.
527 +/
528 enum UniformType {
529     Invalid,
530     Float,
531     Float2,
532     Float3,
533     Float4,
534     Int,
535     Int2,
536     Int3,
537     Int4,
538     Mat4,
539     Num,
540 }
541 /++
542 + sg_uniform_layout
543 + 
544 +     A hint for the interior memory layout of uniform blocks. This is
545 +     only relevant for the GL backend where the internal layout
546 +     of uniform blocks must be known to sokol-gfx. For all other backends the
547 +     internal memory layout of uniform blocks doesn't matter, sokol-gfx
548 +     will just pass uniform data as an opaque memory blob to the
549 +     3D backend.
550 + 
551 +     SG_UNIFORMLAYOUT_NATIVE (default)
552 +         Native layout means that a 'backend-native' memory layout
553 +         is used. For the GL backend this means that uniforms
554 +         are packed tightly in memory (e.g. there are no padding
555 +         bytes).
556 + 
557 +     SG_UNIFORMLAYOUT_STD140
558 +         The memory layout is a subset of std140. Arrays are only
559 +         allowed for the FLOAT4, INT4 and MAT4. Alignment is as
560 +         is as follows:
561 + 
562 +             FLOAT, INT:         4 byte alignment
563 +             FLOAT2, INT2:       8 byte alignment
564 +             FLOAT3, INT3:       16 byte alignment(!)
565 +             FLOAT4, INT4:       16 byte alignment
566 +             MAT4:               16 byte alignment
567 +             FLOAT4[], INT4[]:   16 byte alignment
568 + 
569 +         The overall size of the uniform block must be a multiple
570 +         of 16.
571 + 
572 +     For more information search for 'UNIFORM DATA LAYOUT' in the documentation block
573 +     at the start of the header.
574 +/
575 enum UniformLayout {
576     Default,
577     Native,
578     Std140,
579     Num,
580 }
581 /++
582 + sg_cull_mode
583 + 
584 +     The face-culling mode, this is used in the
585 +     sg_pipeline_desc.cull_mode member when creating a
586 +     pipeline object.
587 + 
588 +     The default cull mode is SG_CULLMODE_NONE
589 +/
590 enum CullMode {
591     Default,
592     None,
593     Front,
594     Back,
595     Num,
596 }
597 /++
598 + sg_face_winding
599 + 
600 +     The vertex-winding rule that determines a front-facing primitive. This
601 +     is used in the member sg_pipeline_desc.face_winding
602 +     when creating a pipeline object.
603 + 
604 +     The default winding is SG_FACEWINDING_CW (clockwise)
605 +/
606 enum FaceWinding {
607     Default,
608     Ccw,
609     Cw,
610     Num,
611 }
612 /++
613 + sg_compare_func
614 + 
615 +     The compare-function for configuring depth- and stencil-ref tests
616 +     in pipeline objects, and for texture samplers which perform a comparison
617 +     instead of regular sampling operation.
618 + 
619 +     Used in the following structs:
620 + 
621 +     sg_pipeline_desc
622 +         .depth
623 +             .compare
624 +         .stencil
625 +             .front.compare
626 +             .back.compare
627 + 
628 +     sg_sampler_desc
629 +         .compare
630 + 
631 +     The default compare func for depth- and stencil-tests is
632 +     SG_COMPAREFUNC_ALWAYS.
633 + 
634 +     The default compare func for samplers is SG_COMPAREFUNC_NEVER.
635 +/
636 enum CompareFunc {
637     Default,
638     Never,
639     Less,
640     Equal,
641     Less_equal,
642     Greater,
643     Not_equal,
644     Greater_equal,
645     Always,
646     Num,
647 }
648 /++
649 + sg_stencil_op
650 + 
651 +     The operation performed on a currently stored stencil-value when a
652 +     comparison test passes or fails. This is used when creating a pipeline
653 +     object in the following sg_pipeline_desc struct items:
654 + 
655 +     sg_pipeline_desc
656 +         .stencil
657 +             .front
658 +                 .fail_op
659 +                 .depth_fail_op
660 +                 .pass_op
661 +             .back
662 +                 .fail_op
663 +                 .depth_fail_op
664 +                 .pass_op
665 + 
666 +     The default value is SG_STENCILOP_KEEP.
667 +/
668 enum StencilOp {
669     Default,
670     Keep,
671     Zero,
672     Replace,
673     Incr_clamp,
674     Decr_clamp,
675     Invert,
676     Incr_wrap,
677     Decr_wrap,
678     Num,
679 }
680 /++
681 + sg_blend_factor
682 + 
683 +     The source and destination factors in blending operations.
684 +     This is used in the following members when creating a pipeline object:
685 + 
686 +     sg_pipeline_desc
687 +         .colors[i]
688 +             .blend
689 +                 .src_factor_rgb
690 +                 .dst_factor_rgb
691 +                 .src_factor_alpha
692 +                 .dst_factor_alpha
693 + 
694 +     The default value is SG_BLENDFACTOR_ONE for source
695 +     factors, and for the destination SG_BLENDFACTOR_ZERO if the associated
696 +     blend-op is ADD, SUBTRACT or REVERSE_SUBTRACT or SG_BLENDFACTOR_ONE
697 +     if the associated blend-op is MIN or MAX.
698 +/
699 enum BlendFactor {
700     Default,
701     Zero,
702     One,
703     Src_color,
704     One_minus_src_color,
705     Src_alpha,
706     One_minus_src_alpha,
707     Dst_color,
708     One_minus_dst_color,
709     Dst_alpha,
710     One_minus_dst_alpha,
711     Src_alpha_saturated,
712     Blend_color,
713     One_minus_blend_color,
714     Blend_alpha,
715     One_minus_blend_alpha,
716     Src1_color,
717     One_minus_src1_color,
718     Src1_alpha,
719     One_minus_src1_alpha,
720     Num,
721 }
722 /++
723 + sg_blend_op
724 + 
725 +     Describes how the source and destination values are combined in the
726 +     fragment blending operation. It is used in the following struct items
727 +     when creating a pipeline object:
728 + 
729 +     sg_pipeline_desc
730 +         .colors[i]
731 +             .blend
732 +                 .op_rgb
733 +                 .op_alpha
734 + 
735 +     The default value is SG_BLENDOP_ADD.
736 +/
737 enum BlendOp {
738     Default,
739     Add,
740     Subtract,
741     Reverse_subtract,
742     Min,
743     Max,
744     Num,
745 }
746 /++
747 + sg_color_mask
748 + 
749 +     Selects the active color channels when writing a fragment color to the
750 +     framebuffer. This is used in the members
751 +     sg_pipeline_desc.colors[i].write_mask when creating a pipeline object.
752 + 
753 +     The default colormask is SG_COLORMASK_RGBA (write all colors channels)
754 + 
755 +     NOTE: since the color mask value 0 is reserved for the default value
756 +     (SG_COLORMASK_RGBA), use SG_COLORMASK_NONE if all color channels
757 +     should be disabled.
758 +/
759 enum ColorMask {
760     Default = 0,
761     None = 16,
762     R = 1,
763     G = 2,
764     Rg = 3,
765     B = 4,
766     Rb = 5,
767     Gb = 6,
768     Rgb = 7,
769     A = 8,
770     Ra = 9,
771     Ga = 10,
772     Rga = 11,
773     Ba = 12,
774     Rba = 13,
775     Gba = 14,
776     Rgba = 15,
777 }
778 /++
779 + sg_load_action
780 + 
781 +     Defines the load action that should be performed at the start of a render pass:
782 + 
783 +     SG_LOADACTION_CLEAR:        clear the render target
784 +     SG_LOADACTION_LOAD:         load the previous content of the render target
785 +     SG_LOADACTION_DONTCARE:     leave the render target in an undefined state
786 + 
787 +     This is used in the sg_pass_action structure.
788 + 
789 +     The default load action for all pass attachments is SG_LOADACTION_CLEAR,
790 +     with the values rgba = { 0.5f, 0.5f, 0.5f, 1.0f }, depth=1.0f and stencil=0.
791 + 
792 +     If you want to override the default behaviour, it is important to not
793 +     only set the clear color, but the 'action' field as well (as long as this
794 +     is _SG_LOADACTION_DEFAULT, the value fields will be ignored).
795 +/
796 enum LoadAction {
797     Default,
798     Clear,
799     Load,
800     Dontcare,
801 }
802 /++
803 + sg_store_action
804 + 
805 +     Defines the store action that should be performed at the end of a render pass:
806 + 
807 +     SG_STOREACTION_STORE:       store the rendered content to the color attachment image
808 +     SG_STOREACTION_DONTCARE:    allows the GPU to discard the rendered content
809 +/
810 enum StoreAction {
811     Default,
812     Store,
813     Dontcare,
814 }
815 /++
816 + sg_pass_action
817 + 
818 +     The sg_pass_action struct defines the actions to be performed
819 +     at the start and end of a render pass.
820 + 
821 +     - at the start of the pass: whether the render attachments should be cleared,
822 +       loaded with their previous content, or start in an undefined state
823 +     - for clear operations: the clear value (color, depth, or stencil values)
824 +     - at the end of the pass: whether the rendering result should be
825 +       stored back into the render attachment or discarded
826 +/
827 extern(C) struct ColorAttachmentAction {
828     LoadAction load_action = LoadAction.Default;
829     StoreAction store_action = StoreAction.Default;
830     Color clear_value = {};
831 }
832 extern(C) struct DepthAttachmentAction {
833     LoadAction load_action = LoadAction.Default;
834     StoreAction store_action = StoreAction.Default;
835     float clear_value = 0.0f;
836 }
837 extern(C) struct StencilAttachmentAction {
838     LoadAction load_action = LoadAction.Default;
839     StoreAction store_action = StoreAction.Default;
840     ubyte clear_value = 0;
841 }
842 extern(C) struct PassAction {
843     ColorAttachmentAction[8] colors = [];
844     DepthAttachmentAction depth = {};
845     StencilAttachmentAction stencil = {};
846 }
847 /++
848 + sg_swapchain
849 + 
850 +     Used in sg_begin_pass() to provide details about an external swapchain
851 +     (pixel formats, sample count and backend-API specific render surface objects).
852 + 
853 +     The following information must be provided:
854 + 
855 +     - the width and height of the swapchain surfaces in number of pixels,
856 +     - the pixel format of the render- and optional msaa-resolve-surface
857 +     - the pixel format of the optional depth- or depth-stencil-surface
858 +     - the MSAA sample count for the render and depth-stencil surface
859 + 
860 +     If the pixel formats and MSAA sample counts are left zero-initialized,
861 +     their defaults are taken from the sg_environment struct provided in the
862 +     sg_setup() call.
863 + 
864 +     The width and height *must* be > 0.
865 + 
866 +     The boolean `sg_swapchain.invalid` is used to communicate an invalid
867 +     swapchain state to sokol-gfx (for instance the swapchain code outside of
868 +     sokol-gfx not being able to create swapchain surfaces). When the .invalid
869 +     boolean is set to true, all other sg_swapchain struct items must be zeroed
870 +     (checked in the validation layer), and all rendering in this swapchain-pass
871 +     will be silently skipped.
872 + 
873 +     For valid swapchains, the following backend API specific objects must be passed in
874 +     as 'type erased' void pointers:
875 + 
876 +     GL:
877 +         - on all GL backends, a GL framebuffer object must be provided. This
878 +           can be zero for the default framebuffer.
879 + 
880 +     D3D11:
881 +         - an ID3D11RenderTargetView for the rendering surface, without
882 +           MSAA rendering this surface will also be displayed
883 +         - an optional ID3D11DepthStencilView for the depth- or depth/stencil
884 +           buffer surface
885 +         - when MSAA rendering is used, another ID3D11RenderTargetView
886 +           which serves as MSAA resolve target and will be displayed
887 + 
888 +     WebGPU (same as D3D11, except different types)
889 +         - a WGPUTextureView for the rendering surface, without
890 +           MSAA rendering this surface will also be displayed
891 +         - an optional WGPUTextureView for the depth- or depth/stencil
892 +           buffer surface
893 +         - when MSAA rendering is used, another WGPUTextureView
894 +           which serves as MSAA resolve target and will be displayed
895 + 
896 +     Metal (NOTE that the roles of provided surfaces is slightly different
897 +     than on D3D11 or WebGPU in case of MSAA vs non-MSAA rendering):
898 + 
899 +         - A current CAMetalDrawable (NOT an MTLDrawable!) which will be presented.
900 +           This will either be rendered to directly (if no MSAA is used), or serve
901 +           as MSAA-resolve target.
902 +         - an optional MTLTexture for the depth- or depth-stencil buffer
903 +         - an optional multisampled MTLTexture which serves as intermediate
904 +           rendering surface which will then be resolved into the
905 +           CAMetalDrawable.
906 + 
907 +     NOTE that for Metal you must use an ObjC __bridge cast to
908 +     properly tunnel the ObjC object id through a C void*, e.g.:
909 + 
910 +         swapchain.metal.current_drawable = (__bridge const void*) [mtkView currentDrawable];
911 + 
912 +     On all other backends you shouldn't need to mess with the reference count.
913 + 
914 +     It's a good practice to write a helper function which returns an initialized
915 +     sg_swapchain struct, which can then be plugged directly into
916 +     sg_pass.swapchain. Look at the function sglue_swapchain() in the sokol_glue.h
917 +     as an example.
918 +/
919 extern(C) struct MetalSwapchain {
920     const(void)* current_drawable = null;
921     const(void)* depth_stencil_texture = null;
922     const(void)* msaa_color_texture = null;
923 }
924 extern(C) struct D3d11Swapchain {
925     const(void)* render_view = null;
926     const(void)* resolve_view = null;
927     const(void)* depth_stencil_view = null;
928 }
929 extern(C) struct WgpuSwapchain {
930     const(void)* render_view = null;
931     const(void)* resolve_view = null;
932     const(void)* depth_stencil_view = null;
933 }
934 extern(C) struct VulkanSwapchain {
935     const(void)* render_image = null;
936     const(void)* render_view = null;
937     const(void)* resolve_image = null;
938     const(void)* resolve_view = null;
939     const(void)* depth_stencil_image = null;
940     const(void)* depth_stencil_view = null;
941     const(void)* render_finished_semaphore = null;
942     const(void)* present_complete_semaphore = null;
943 }
944 extern(C) struct GlSwapchain {
945     uint framebuffer = 0;
946 }
947 extern(C) struct Swapchain {
948     bool invalid = false;
949     int width = 0;
950     int height = 0;
951     int sample_count = 0;
952     PixelFormat color_format = PixelFormat.Default;
953     PixelFormat depth_format = PixelFormat.Default;
954     MetalSwapchain metal = {};
955     D3d11Swapchain d3d11 = {};
956     WgpuSwapchain wgpu = {};
957     VulkanSwapchain vulkan = {};
958     GlSwapchain gl = {};
959 }
960 /++
961 + sg_attachments
962 + 
963 +     Used in sg_pass to provide render pass attachment views. Each
964 +     type of pass attachment has it corresponding view type:
965 + 
966 +     sg_attachments.colors[]:
967 +         populate with color-attachment views, e.g.:
968 + 
969 +         sg_make_view(&(sg_view_desc){
970 +             .color_attachment = { ... },
971 +         });
972 + 
973 +     sg_attachments.resolves[]:
974 +         populate with resolve-attachment views, e.g.:
975 + 
976 +         sg_make_view(&(sg_view_desc){
977 +             .resolve_attachment = { ... },
978 +         });
979 + 
980 +     sg_attachments.depth_stencil:
981 +         populate with depth-stencil-attachment views, e.g.:
982 + 
983 +         sg_make_view(&(sg_view_desc){
984 +             .depth_stencil_attachment = { ... },
985 +         });
986 +/
987 extern(C) struct Attachments {
988     View[8] colors = [];
989     View[8] resolves = [];
990     View depth_stencil = {};
991 }
992 /++
993 + sg_pass
994 + 
995 +     The sg_pass structure is passed as argument into the sg_begin_pass()
996 +     function.
997 + 
998 +     For a swapchain render pass, provide an sg_pass_action and sg_swapchain
999 +     struct (for instance via the sglue_swapchain() helper function from
1000 +     sokol_glue.h):
1001 + 
1002 +         sg_begin_pass(&(sg_pass){
1003 +             .action = { ... },
1004 +             .swapchain = sglue_swapchain(),
1005 +         });
1006 + 
1007 +     For an offscreen render pass, provide an sg_pass_action struct with
1008 +     attachment view objects:
1009 + 
1010 +         sg_begin_pass(&(sg_pass){
1011 +             .action = { ... },
1012 +             .attachments = {
1013 +                 .colors = { ... },
1014 +                 .resolves = { ... },
1015 +                 .depth_stencil = ...,
1016 +             },
1017 +         });
1018 + 
1019 +     You can also omit the .action object to get default pass action behaviour
1020 +     (clear to color=grey, depth=1 and stencil=0).
1021 + 
1022 +     For a compute pass, just set the sg_pass.compute boolean to true:
1023 + 
1024 +         sg_begin_pass(&(sg_pass){ .compute = true });
1025 +/
1026 extern(C) struct Pass {
1027     uint _start_canary = 0;
1028     bool compute = false;
1029     PassAction action = {};
1030     Attachments attachments = {};
1031     Swapchain swapchain = {};
1032     const(char)* label = null;
1033     uint _end_canary = 0;
1034 }
1035 /++
1036 + sg_bindings
1037 + 
1038 +     The sg_bindings structure defines the resource bindings for
1039 +     the next draw call.
1040 + 
1041 +     To update the resource bindings, call sg_apply_bindings() with
1042 +     a pointer to a populated sg_bindings struct. Note that
1043 +     sg_apply_bindings() must be called after sg_apply_pipeline()
1044 +     and that bindings are not preserved across sg_apply_pipeline()
1045 +     calls, even when the new pipeline uses the same 'bindings layout'.
1046 + 
1047 +     A resource binding struct contains:
1048 + 
1049 +     - 1..N vertex buffers
1050 +     - 1..N vertex buffer offsets
1051 +     - 0..1 index buffer
1052 +     - 0..1 index buffer offset
1053 +     - 0..N resource views (texture-, storage-image, storage-buffer-views)
1054 +     - 0..N samplers
1055 + 
1056 +     Where 'N' is defined in the following constants:
1057 + 
1058 +     - SG_MAX_VERTEXBUFFER_BINDSLOTS
1059 +     - SG_MAX_VIEW_BINDSLOTS
1060 +     - SG_MAX_SAMPLER_BINDSLOTS
1061 + 
1062 +     Note that inside compute passes vertex- and index-buffer-bindings are
1063 +     disallowed.
1064 + 
1065 +     When using sokol-shdc for shader authoring, the `layout(binding=N)`
1066 +     for texture-, storage-image- and storage-buffer-bindings directly
1067 +     maps to the views-array index, for instance the following vertex-
1068 +     and fragment-shader interface for sokol-shdc:
1069 + 
1070 +         @vs vs
1071 +         layout(binding=0) uniform vs_params { ... };
1072 +         layout(binding=0) readonly buffer ssbo { ... };
1073 +         layout(binding=1) uniform texture2D vs_tex;
1074 +         layout(binding=0) uniform sampler vs_smp;
1075 +         ...
1076 +         @end
1077 + 
1078 +         @fs fs
1079 +         layout(binding=1) uniform fs_params { ... };
1080 +         layout(binding=2) uniform texture2D fs_tex;
1081 +         layout(binding=1) uniform sampler fs_smp;
1082 +         ...
1083 +         @end
1084 + 
1085 +     ...would map to the following sg_bindings struct:
1086 + 
1087 +         const sg_bindings bnd = {
1088 +             .vertex_buffers[0] = ...,
1089 +             .views[0] = ssbo_view,
1090 +             .views[1] = vs_tex_view,
1091 +             .views[2] = fs_tex_view,
1092 +             .samplers[0] = vs_smp,
1093 +             .samplers[1] = fs_smp,
1094 +         };
1095 + 
1096 +     ...alternatively you can use code-generated slot indices:
1097 + 
1098 +         const sg_bindings bnd = {
1099 +             .vertex_buffers[0] = ...,
1100 +             .views[VIEW_ssbo] = ssbo_view,
1101 +             .views[VIEW_vs_tex] = vs_tex_view,
1102 +             .views[VIEW_fs_tex] = fs_tex_view,
1103 +             .samplers[SMP_vs_smp] = vs_smp,
1104 +             .samplers[SMP_fs_smp] = fs_smp,
1105 +         };
1106 + 
1107 +     Resource bindslots for a specific shader/pipeline may have gaps, and an
1108 +     sg_bindings struct may have populated bind slots which are not used by a
1109 +     specific shader. This allows to use the same sg_bindings struct across
1110 +     different shader variants.
1111 + 
1112 +     When not using sokol-shdc, the bindslot indices in the sg_bindings
1113 +     struct need to match the per-binding reflection info slot indices
1114 +     in the sg_shader_desc struct (for details about that see the
1115 +     sg_shader_desc struct documentation).
1116 + 
1117 +     The optional buffer offsets can be used to put different unrelated
1118 +     chunks of vertex- and/or index-data into the same buffer objects.
1119 +/
1120 extern(C) struct Bindings {
1121     uint _start_canary = 0;
1122     Buffer[8] vertex_buffers = [];
1123     int[8] vertex_buffer_offsets = [0, 0, 0, 0, 0, 0, 0, 0];
1124     Buffer index_buffer = {};
1125     int index_buffer_offset = 0;
1126     View[32] views = [];
1127     Sampler[12] samplers = [];
1128     uint _end_canary = 0;
1129 }
1130 /++
1131 + sg_buffer_usage
1132 + 
1133 +     Describes how a buffer object is going to be used:
1134 + 
1135 +     .vertex_buffer (default: true)
1136 +         the buffer will be bound as vertex buffer via sg_bindings.vertex_buffers[]
1137 +     .index_buffer (default: false)
1138 +         the buffer will be bound as index buffer via sg_bindings.index_buffer
1139 +     .storage_buffer (default: false)
1140 +         the buffer will be bound as storage buffer via storage-buffer-view
1141 +         in sg_bindings.views[]
1142 +     .immutable (default: true)
1143 +         the buffer content will never be updated from the CPU side (but
1144 +         may be written to by a compute shader)
1145 +     .dynamic_update (default: false)
1146 +         the buffer content will be infrequently updated from the CPU side
1147 +     .stream_upate (default: false)
1148 +         the buffer content will be updated each frame from the CPU side
1149 +/
1150 extern(C) struct BufferUsage {
1151     bool vertex_buffer = false;
1152     bool index_buffer = false;
1153     bool storage_buffer = false;
1154     bool _immutable = false;
1155     bool dynamic_update = false;
1156     bool stream_update = false;
1157 }
1158 /++
1159 + sg_buffer_desc
1160 + 
1161 +     Creation parameters for sg_buffer objects, used in the sg_make_buffer() call.
1162 + 
1163 +     The default configuration is:
1164 + 
1165 +     .size:      0       (*must* be >0 for buffers without data)
1166 +     .usage      { .vertex_buffer = true, .immutable = true }
1167 +     .data.ptr   0       (*must* be valid for immutable buffers without storage buffer usage)
1168 +     .data.size  0       (*must* be > 0 for immutable buffers without storage buffer usage)
1169 +     .label      0       (optional string label)
1170 + 
1171 +     For immutable buffers which are initialized with initial data,
1172 +     keep the .size item zero-initialized, and set the size together with the
1173 +     pointer to the initial data in the .data item.
1174 + 
1175 +     For immutable or mutable buffers without initial data, keep the .data item
1176 +     zero-initialized, and set the buffer size in the .size item instead.
1177 + 
1178 +     You can also set both size values, but currently both size values must
1179 +     be identical (this may change in the future when the dynamic resource
1180 +     management may become more flexible).
1181 + 
1182 +     NOTE: Immutable buffers without storage-buffer-usage *must* be created
1183 +     with initial content, this restriction doesn't apply to storage buffer usage,
1184 +     because storage buffers may also get their initial content by running
1185 +     a compute shader on them.
1186 + 
1187 +     NOTE: Buffers without initial data will have undefined content, e.g.
1188 +     do *not* expect the buffer to be zero-initialized!
1189 + 
1190 +     ADVANCED TOPIC: Injecting native 3D-API buffers:
1191 + 
1192 +     The following struct members allow to inject your own GL, Metal
1193 +     or D3D11 buffers into sokol_gfx:
1194 + 
1195 +     .gl_buffers[SG_NUM_INFLIGHT_FRAMES]
1196 +     .mtl_buffers[SG_NUM_INFLIGHT_FRAMES]
1197 +     .d3d11_buffer
1198 + 
1199 +     You must still provide all other struct items except the .data item, and
1200 +     these must match the creation parameters of the native buffers you provide.
1201 +     For sg_buffer_desc.usage.immutable buffers, only provide a single native
1202 +     3D-API buffer, otherwise you need to provide SG_NUM_INFLIGHT_FRAMES buffers
1203 +     (only for GL and Metal, not D3D11). Providing multiple buffers for GL and
1204 +     Metal is necessary because sokol_gfx will rotate through them when calling
1205 +     sg_update_buffer() to prevent lock-stalls.
1206 + 
1207 +     Note that it is expected that immutable injected buffer have already been
1208 +     initialized with content, and the .content member must be 0!
1209 + 
1210 +     Also you need to call sg_reset_state_cache() after calling native 3D-API
1211 +     functions, and before calling any sokol_gfx function.
1212 +/
1213 extern(C) struct BufferDesc {
1214     uint _start_canary = 0;
1215     size_t size = 0;
1216     BufferUsage usage = {};
1217     Range data = {};
1218     const(char)* label = null;
1219     uint[2] gl_buffers = [0, 0];
1220     const(void)*[2] mtl_buffers = null;
1221     const(void)* d3d11_buffer = null;
1222     const(void)* wgpu_buffer = null;
1223     uint _end_canary = 0;
1224 }
1225 /++
1226 + sg_image_usage
1227 + 
1228 +     Describes the intended usage of an image object:
1229 + 
1230 +     .storage_image (default: false)
1231 +         the image can be used as parent resource of a storage-image-view,
1232 +         which allows compute shaders to write to the image in a compute
1233 +         pass (for read-only access in compute shaders bind the image
1234 +         via a texture view instead
1235 +     .color_attachment (default: false)
1236 +         the image can be used as parent resource of a color-attachment-view,
1237 +         which is then passed into sg_begin_pass via sg_pass.attachments.colors[]
1238 +         so that fragment shaders can render into the image
1239 +     .resolve_attachment (default: false)
1240 +         the image can be used as parent resource of a resolve-attachment-view,
1241 +         which is then passed into sg_begin_pass via sg_pass.attachments.resolves[]
1242 +         as target for an MSAA-resolve operation in sg_end_pass()
1243 +     .depth_stencil_attachment (default: false)
1244 +         the image can be used as parent resource of a depth-stencil-attachmnet-view
1245 +         which is then passes into sg_begin_pass via sg_pass.attachments.depth_stencil
1246 +         as depth-stencil-buffer
1247 +     .immutable (default: true)
1248 +         the image content cannot be updated from the CPU side
1249 +         (but may be updated by the GPU in a render- or compute-pass)
1250 +     .dynamic_update (default: false)
1251 +         the image content is updated infrequently by the CPU
1252 +     .stream_update (default: false)
1253 +         the image content is updated each frame by the CPU via
1254 + 
1255 +     Note that creating a texture view from the image to be used for
1256 +     texture-sampling in vertex-, fragment- or compute-shaders
1257 +     is always implicitly allowed.
1258 +/
1259 extern(C) struct ImageUsage {
1260     bool storage_image = false;
1261     bool color_attachment = false;
1262     bool resolve_attachment = false;
1263     bool depth_stencil_attachment = false;
1264     bool _immutable = false;
1265     bool dynamic_update = false;
1266     bool stream_update = false;
1267 }
1268 /++
1269 + sg_view_type
1270 + 
1271 +     Allows to query the type of a view object via the function sg_query_view_type()
1272 +/
1273 enum ViewType {
1274     Invalid,
1275     Storagebuffer,
1276     Storageimage,
1277     Texture,
1278     Colorattachment,
1279     Resolveattachment,
1280     Depthstencilattachment,
1281 }
1282 /++
1283 + sg_image_data
1284 + 
1285 +     Defines the content of an image through an array of sg_range structs, each
1286 +     range pointing to the pixel data for one mip-level. For array-, cubemap- and
1287 +     3D-images each mip-level contains all slice-surfaces for that mip-level in a
1288 +     single tightly packed memory block.
1289 + 
1290 +     The size of a single surface in a mip-level for a regular 2D texture
1291 +     can be computed via:
1292 + 
1293 +         sg_query_surface_pitch(pixel_format, mip_width, mip_height, 1);
1294 + 
1295 +     For array- and 3d-images the size of a single miplevel is:
1296 + 
1297 +         num_slices * sg_query_surface_pitch(pixel_format, mip_width, mip_height, 1);
1298 + 
1299 +     For cubemap-images the size of a single mip-level is:
1300 + 
1301 +         6 * sg_query_surface_pitch(pixel_format, mip_width, mip_height, 1);
1302 + 
1303 +     The order of cubemap-faces is in a mip-level data chunk is:
1304 + 
1305 +         [0] => +X
1306 +         [1] => -X
1307 +         [2] => +Y
1308 +         [3] => -Y
1309 +         [4] => +Z
1310 +         [5] => -Z
1311 +/
1312 extern(C) struct ImageData {
1313     Range[16] mip_levels = [];
1314 }
1315 /++
1316 + sg_image_desc
1317 + 
1318 +     Creation parameters for sg_image objects, used in the sg_make_image() call.
1319 + 
1320 +     The default configuration is:
1321 + 
1322 +     .type               SG_IMAGETYPE_2D
1323 +     .usage              .immutable = true
1324 +     .width              0 (must be set to >0)
1325 +     .height             0 (must be set to >0)
1326 +     .num_slices         1 (3D textures: depth; array textures: number of layers)
1327 +     .num_mipmaps        1
1328 +     .pixel_format       SG_PIXELFORMAT_RGBA8 for textures, or sg_desc.environment.defaults.color_format for render targets
1329 +     .sample_count       1 for textures, or sg_desc.environment.defaults.sample_count for render targets
1330 +     .data               an sg_image_data struct to define the initial content
1331 +     .label              0 (optional string label for trace hooks)
1332 + 
1333 +     Q: Why is the default sample_count for render targets identical with the
1334 +     "default sample count" from sg_desc.environment.defaults.sample_count?
1335 + 
1336 +     A: So that it matches the default sample count in pipeline objects. Even
1337 +     though it is a bit strange/confusing that offscreen render targets by default
1338 +     get the same sample count as 'default swapchains', but it's better that
1339 +     an offscreen render target created with default parameters matches
1340 +     a pipeline object created with default parameters.
1341 + 
1342 +     NOTE:
1343 + 
1344 +     Regular images used as texture binding with usage.immutable must be fully
1345 +     initialized by providing a valid .data member which points to initialization
1346 +     data.
1347 + 
1348 +     Images with usage.*_attachment or usage.storage_image must
1349 +     *not* be created with initial content. Be aware that the initial
1350 +     content of pass attachment and storage images is undefined
1351 +     (not guaranteed to be zeroed).
1352 + 
1353 +     ADVANCED TOPIC: Injecting native 3D-API textures:
1354 + 
1355 +     The following struct members allow to inject your own GL, Metal or D3D11
1356 +     textures into sokol_gfx:
1357 + 
1358 +     .gl_textures[SG_NUM_INFLIGHT_FRAMES]
1359 +     .mtl_textures[SG_NUM_INFLIGHT_FRAMES]
1360 +     .d3d11_texture
1361 +     .wgpu_texture
1362 + 
1363 +     For GL, you can also specify the texture target or leave it empty to use
1364 +     the default texture target for the image type (GL_TEXTURE_2D for
1365 +     SG_IMAGETYPE_2D etc)
1366 + 
1367 +     The same rules apply as for injecting native buffers (see sg_buffer_desc
1368 +     documentation for more details).
1369 +/
1370 extern(C) struct ImageDesc {
1371     uint _start_canary = 0;
1372     ImageType type = ImageType.Default;
1373     ImageUsage usage = {};
1374     int width = 0;
1375     int height = 0;
1376     int num_slices = 0;
1377     int num_mipmaps = 0;
1378     PixelFormat pixel_format = PixelFormat.Default;
1379     int sample_count = 0;
1380     ImageData data = {};
1381     const(char)* label = null;
1382     uint[2] gl_textures = [0, 0];
1383     uint gl_texture_target = 0;
1384     const(void)*[2] mtl_textures = null;
1385     const(void)* d3d11_texture = null;
1386     const(void)* wgpu_texture = null;
1387     uint _end_canary = 0;
1388 }
1389 /++
1390 + sg_sampler_desc
1391 + 
1392 +     Creation parameters for sg_sampler objects, used in the sg_make_sampler() call
1393 + 
1394 +     .min_filter:        SG_FILTER_NEAREST
1395 +     .mag_filter:        SG_FILTER_NEAREST
1396 +     .mipmap_filter      SG_FILTER_NEAREST
1397 +     .wrap_u:            SG_WRAP_REPEAT
1398 +     .wrap_v:            SG_WRAP_REPEAT
1399 +     .wrap_w:            SG_WRAP_REPEAT (only SG_IMAGETYPE_3D)
1400 +     .min_lod            0.0f
1401 +     .max_lod            FLT_MAX
1402 +     .border_color       SG_BORDERCOLOR_OPAQUE_BLACK
1403 +     .compare            SG_COMPAREFUNC_NEVER
1404 +     .max_anisotropy     1 (must be 1..16)
1405 +/
1406 extern(C) struct SamplerDesc {
1407     uint _start_canary = 0;
1408     Filter min_filter = Filter.Default;
1409     Filter mag_filter = Filter.Default;
1410     Filter mipmap_filter = Filter.Default;
1411     Wrap wrap_u = Wrap.Default;
1412     Wrap wrap_v = Wrap.Default;
1413     Wrap wrap_w = Wrap.Default;
1414     float min_lod = 0.0f;
1415     float max_lod = 0.0f;
1416     BorderColor border_color = BorderColor.Default;
1417     CompareFunc compare = CompareFunc.Default;
1418     uint max_anisotropy = 0;
1419     const(char)* label = null;
1420     uint gl_sampler = 0;
1421     const(void)* mtl_sampler = null;
1422     const(void)* d3d11_sampler = null;
1423     const(void)* wgpu_sampler = null;
1424     uint _end_canary = 0;
1425 }
1426 /++
1427 + sg_shader_desc
1428 + 
1429 +     Used as parameter of sg_make_shader() to create a shader object which
1430 +     communicates shader source or bytecode and shader interface
1431 +     reflection information to sokol-gfx.
1432 + 
1433 +     If you use sokol-shdc you can ignore the following information since
1434 +     the sg_shader_desc struct will be code-generated.
1435 + 
1436 +     Otherwise you need to provide the following information to the
1437 +     sg_make_shader() call:
1438 + 
1439 +     - a vertex- and fragment-shader function:
1440 +         - the shader source or bytecode
1441 +         - an optional entry point name
1442 +         - for D3D11: an optional compile target when source code is provided
1443 +           (the defaults are "vs_4_0" and "ps_4_0")
1444 + 
1445 +     - ...or alternatively, a compute function:
1446 +         - the shader source or bytecode
1447 +         - an optional entry point name
1448 +         - for D3D11: an optional compile target when source code is provided
1449 +           (the default is "cs_5_0")
1450 + 
1451 +     - vertex attributes required by some backends (not for compute shaders):
1452 +         - the vertex attribute base type (undefined, float, signed int, unsigned int),
1453 +           this information is only used in the validation layer to check that the
1454 +           pipeline object vertex formats are compatible with the input vertex attribute
1455 +           type used in the vertex shader. NOTE that the default base type
1456 +           'undefined' skips the validation layer check.
1457 +         - for the GL backend: optional vertex attribute names used for name lookup
1458 +         - for the D3D11 backend: semantic names and indices
1459 + 
1460 +     - only for compute shaders on the Metal backend:
1461 +         - the workgroup size aka 'threads per thread-group'
1462 + 
1463 +           In other 3D APIs this is declared in the shader code:
1464 +             - GLSL: `layout(local_size_x=x, local_size_y=y, local_size_y=z) in;`
1465 +             - HLSL: `[numthreads(x, y, z)]`
1466 +             - WGSL: `@workgroup_size(x, y, z)`
1467 +           ...but in Metal the workgroup size is declared on the CPU side
1468 + 
1469 +     - reflection information for each uniform block binding used by the shader:
1470 +         - the shader stage the uniform block appears in (SG_SHADERSTAGE_*)
1471 +         - the size in bytes of the uniform block
1472 +         - backend-specific bindslots:
1473 +             - HLSL: the constant buffer register `register(b0..7)`
1474 +             - MSL: the buffer attribute `[[buffer(0..7)]]`
1475 +             - WGSL: the binding in `@group(0) @binding(0..15)`
1476 +         - GLSL only: a description of the uniform block interior
1477 +             - the memory layout standard (SG_UNIFORMLAYOUT_*)
1478 +             - for each member in the uniform block:
1479 +                 - the member type (SG_UNIFORM_*)
1480 +                 - if the member is an array, the array count
1481 +                 - the member name
1482 + 
1483 +     - reflection information for each texture-, storage-buffer and
1484 +       storage-image bindings by the shader, each with an associated
1485 +       view type:
1486 +         - texture bindings => texture views
1487 +         - storage-buffer bindings => storage-buffer views
1488 +         - storage-image bindings => storage-image views
1489 + 
1490 +     - texture bindings must provide the following information:
1491 +         - the shader stage the texture binding appears in (SG_SHADERSTAGE_*)
1492 +         - the image type (SG_IMAGETYPE_*)
1493 +         - the image-sample type (SG_IMAGESAMPLETYPE_*)
1494 +         - whether the texture is multisampled
1495 +         - backend specific bindslots:
1496 +             - HLSL: the texture register `register(t0..31)`
1497 +             - MSL: the texture attribute `[[texture(0..31)]]`
1498 +             - WGSL: the binding in `@group(1) @binding(0..127)`
1499 + 
1500 +     - storage-buffer bindings must provide the following information:
1501 +         - the shader stage the storage buffer appears in (SG_SHADERSTAGE_*)
1502 +         - whether the storage buffer is readonly
1503 +         - backend specific bindslots:
1504 +             - HLSL:
1505 +                 - for storage buffer bindings: `register(t0..31)`
1506 +                 - for read/write storage buffer bindings: `register(u0..31)`
1507 +             - MSL: the buffer attribute `[[buffer(8..23)]]`
1508 +             - WGSL: the binding in `@group(1) @binding(0..127)`
1509 +             - GL: the binding in `layout(binding=0..sg_limits.max_storage_buffer_bindings_per_stage)`
1510 + 
1511 +     - storage-image bindings must provide the following information:
1512 +         - the shader stage (*must* be SG_SHADERSTAGE_COMPUTE)
1513 +         - whether the storage image is writeonly or readwrite (for readonly
1514 +           access use a regular texture binding instead)
1515 +         - the image type expected by the shader (SG_IMAGETYPE_*)
1516 +         - the access pixel format expected by the shader (SG_PIXELFORMAT_*),
1517 +           note that only a subset of pixel formats is allowed for storage image
1518 +           bindings
1519 +         - backend specific bindslots:
1520 +             - HLSL: the UAV register `register(u0..31)`
1521 +             - MSL: the texture attribute `[[texture(0..31)]]`
1522 +             - WGSL: the binding in `@group(1) @binding(0..127)`
1523 +             - GLSL: the binding in `layout(binding=0..sg_imits.max_storage_buffer_bindings_per_stage, [access_format])`
1524 + 
1525 +     - reflection information for each sampler used by the shader:
1526 +         - the shader stage the sampler appears in (SG_SHADERSTAGE_*)
1527 +         - the sampler type (SG_SAMPLERTYPE_*)
1528 +         - backend specific bindslots:
1529 +             - HLSL: the sampler register `register(s0..11)`
1530 +             - MSL: the sampler attribute `[[sampler(0..11)]]`
1531 +             - WGSL: the binding in `@group(0) @binding(0..127)`
1532 + 
1533 +     - reflection information for each texture-sampler pair used by
1534 +       the shader:
1535 +         - the shader stage (SG_SHADERSTAGE_*)
1536 +         - the texture's array index in the sg_shader_desc.views[] array
1537 +         - the sampler's array index in the sg_shader_desc.samplers[] array
1538 +         - GLSL only: the name of the combined image-sampler object
1539 + 
1540 +     The number and order of items in the sg_shader_desc.attrs[]
1541 +     array corresponds to the items in sg_pipeline_desc.layout.attrs.
1542 + 
1543 +         - sg_shader_desc.attrs[N] => sg_pipeline_desc.layout.attrs[N]
1544 + 
1545 +     NOTE that vertex attribute indices currently cannot have gaps.
1546 + 
1547 +     The items index in the sg_shader_desc.uniform_blocks[] array corresponds
1548 +     to the ub_slot arg in sg_apply_uniforms():
1549 + 
1550 +         - sg_shader_desc.uniform_blocks[N] => sg_apply_uniforms(N, ...)
1551 + 
1552 +     The items in the sg_shader_desc.views[] array directly map to
1553 +     the views in the sg_bindings.views[] array!
1554 + 
1555 +     For all GL backends, shader source-code must be provided. For D3D11 and Metal,
1556 +     either shader source-code or byte-code can be provided.
1557 + 
1558 +     NOTE that the uniform-block, view and sampler arrays may have gaps. This
1559 +     allows to use the same sg_bindings struct for different but related
1560 +     shader variations.
1561 + 
1562 +     For D3D11, if source code is provided, the d3dcompiler_47.dll will be loaded
1563 +     on demand. If this fails, shader creation will fail. When compiling HLSL
1564 +     source code, you can provide an optional target string via
1565 +     sg_shader_stage_desc.d3d11_target, the default target is "vs_4_0" for the
1566 +     vertex shader stage and "ps_4_0" for the pixel shader stage.
1567 +     You may optionally provide the file path to enable the default #include handler
1568 +     behavior when compiling source code.
1569 +/
1570 enum ShaderStage {
1571     None,
1572     Vertex,
1573     Fragment,
1574     Compute,
1575 }
1576 extern(C) struct ShaderFunction {
1577     const(char)* source = null;
1578     Range bytecode = {};
1579     const(char)* entry = null;
1580     const(char)* d3d11_target = null;
1581     const(char)* d3d11_filepath = null;
1582 }
1583 enum ShaderAttrBaseType {
1584     Undefined,
1585     Float,
1586     Sint,
1587     Uint,
1588 }
1589 extern(C) struct ShaderVertexAttr {
1590     ShaderAttrBaseType base_type = ShaderAttrBaseType.Undefined;
1591     const(char)* glsl_name = null;
1592     const(char)* hlsl_sem_name = null;
1593     ubyte hlsl_sem_index = 0;
1594 }
1595 extern(C) struct GlslShaderUniform {
1596     UniformType type = UniformType.Invalid;
1597     ushort array_count = 0;
1598     const(char)* glsl_name = null;
1599 }
1600 extern(C) struct ShaderUniformBlock {
1601     ShaderStage stage = ShaderStage.None;
1602     uint size = 0;
1603     ubyte hlsl_register_b_n = 0;
1604     ubyte msl_buffer_n = 0;
1605     ubyte wgsl_group0_binding_n = 0;
1606     ubyte spirv_set0_binding_n = 0;
1607     UniformLayout layout = UniformLayout.Default;
1608     GlslShaderUniform[16] glsl_uniforms = [];
1609 }
1610 extern(C) struct ShaderTextureView {
1611     ShaderStage stage = ShaderStage.None;
1612     ImageType image_type = ImageType.Default;
1613     ImageSampleType sample_type = ImageSampleType.Default;
1614     bool multisampled = false;
1615     ubyte hlsl_register_t_n = 0;
1616     ubyte msl_texture_n = 0;
1617     ubyte wgsl_group1_binding_n = 0;
1618     ubyte spirv_set1_binding_n = 0;
1619 }
1620 extern(C) struct ShaderStorageBufferView {
1621     ShaderStage stage = ShaderStage.None;
1622     bool readonly = false;
1623     ubyte hlsl_register_t_n = 0;
1624     ubyte hlsl_register_u_n = 0;
1625     ubyte msl_buffer_n = 0;
1626     ubyte wgsl_group1_binding_n = 0;
1627     ubyte spirv_set1_binding_n = 0;
1628     ubyte glsl_binding_n = 0;
1629 }
1630 extern(C) struct ShaderStorageImageView {
1631     ShaderStage stage = ShaderStage.None;
1632     ImageType image_type = ImageType.Default;
1633     PixelFormat access_format = PixelFormat.Default;
1634     bool writeonly = false;
1635     ubyte hlsl_register_u_n = 0;
1636     ubyte msl_texture_n = 0;
1637     ubyte wgsl_group1_binding_n = 0;
1638     ubyte spirv_set1_binding_n = 0;
1639     ubyte glsl_binding_n = 0;
1640 }
1641 extern(C) struct ShaderView {
1642     ShaderTextureView texture = {};
1643     ShaderStorageBufferView storage_buffer = {};
1644     ShaderStorageImageView storage_image = {};
1645 }
1646 extern(C) struct ShaderSampler {
1647     ShaderStage stage = ShaderStage.None;
1648     SamplerType sampler_type = SamplerType.Default;
1649     ubyte hlsl_register_s_n = 0;
1650     ubyte msl_sampler_n = 0;
1651     ubyte wgsl_group1_binding_n = 0;
1652     ubyte spirv_set1_binding_n = 0;
1653 }
1654 extern(C) struct ShaderTextureSamplerPair {
1655     ShaderStage stage = ShaderStage.None;
1656     ubyte view_slot = 0;
1657     ubyte sampler_slot = 0;
1658     const(char)* glsl_name = null;
1659 }
1660 extern(C) struct MtlShaderThreadsPerThreadgroup {
1661     int x = 0;
1662     int y = 0;
1663     int z = 0;
1664 }
1665 extern(C) struct ShaderDesc {
1666     uint _start_canary = 0;
1667     ShaderFunction vertex_func = {};
1668     ShaderFunction fragment_func = {};
1669     ShaderFunction compute_func = {};
1670     ShaderVertexAttr[16] attrs = [];
1671     ShaderUniformBlock[8] uniform_blocks = [];
1672     ShaderView[32] views = [];
1673     ShaderSampler[12] samplers = [];
1674     ShaderTextureSamplerPair[32] texture_sampler_pairs = [];
1675     MtlShaderThreadsPerThreadgroup mtl_threads_per_threadgroup = {};
1676     const(char)* label = null;
1677     uint _end_canary = 0;
1678 }
1679 /++
1680 + sg_pipeline_desc
1681 + 
1682 +     The sg_pipeline_desc struct defines all creation parameters for an
1683 +     sg_pipeline object, used as argument to the sg_make_pipeline() function:
1684 + 
1685 +     Pipeline objects come in two flavours:
1686 + 
1687 +     - render pipelines for use in render passes
1688 +     - compute pipelines for use in compute passes
1689 + 
1690 +     A compute pipeline only requires a compute shader object but no
1691 +     'render state', while a render pipeline requires a vertex/fragment shader
1692 +     object and additional render state declarations:
1693 + 
1694 +     - the vertex layout for all input vertex buffers
1695 +     - a shader object
1696 +     - the 3D primitive type (points, lines, triangles, ...)
1697 +     - the index type (none, 16- or 32-bit)
1698 +     - all the fixed-function-pipeline state (depth-, stencil-, blend-state, etc...)
1699 + 
1700 +     If the vertex data has no gaps between vertex components, you can omit
1701 +     the .layout.buffers[].stride and layout.attrs[].offset items (leave them
1702 +     default-initialized to 0), sokol-gfx will then compute the offsets and
1703 +     strides from the vertex component formats (.layout.attrs[].format).
1704 +     Please note that ALL vertex attribute offsets must be 0 in order for the
1705 +     automatic offset computation to kick in.
1706 + 
1707 +     Note that if you use vertex-pulling from storage buffers instead of
1708 +     fixed-function vertex input you can simply omit the entire nested .layout
1709 +     struct.
1710 + 
1711 +     The default configuration is as follows:
1712 + 
1713 +     .compute:               false (must be set to true for a compute pipeline)
1714 +     .shader:                0 (must be initialized with a valid sg_shader id!)
1715 +     .layout:
1716 +         .buffers[]:         vertex buffer layouts
1717 +             .stride:        0 (if no stride is given it will be computed)
1718 +             .step_func      SG_VERTEXSTEP_PER_VERTEX
1719 +             .step_rate      1
1720 +         .attrs[]:           vertex attribute declarations
1721 +             .buffer_index   0 the vertex buffer bind slot
1722 +             .offset         0 (offsets can be omitted if the vertex layout has no gaps)
1723 +             .format         SG_VERTEXFORMAT_INVALID (must be initialized!)
1724 +     .depth:
1725 +         .pixel_format:      sg_desc.context.depth_format
1726 +         .compare:           SG_COMPAREFUNC_ALWAYS
1727 +         .write_enabled:     false
1728 +         .bias:              0.0f
1729 +         .bias_slope_scale:  0.0f
1730 +         .bias_clamp:        0.0f
1731 +     .stencil:
1732 +         .enabled:           false
1733 +         .front/back:
1734 +             .compare:       SG_COMPAREFUNC_ALWAYS
1735 +             .fail_op:       SG_STENCILOP_KEEP
1736 +             .depth_fail_op: SG_STENCILOP_KEEP
1737 +             .pass_op:       SG_STENCILOP_KEEP
1738 +         .read_mask:         0
1739 +         .write_mask:        0
1740 +         .ref:               0
1741 +     .color_count            1
1742 +     .colors[0..color_count]
1743 +         .pixel_format       sg_desc.context.color_format
1744 +         .write_mask:        SG_COLORMASK_RGBA
1745 +         .blend:
1746 +             .enabled:           false
1747 +             .src_factor_rgb:    SG_BLENDFACTOR_ONE
1748 +             .dst_factor_rgb:    SG_BLENDFACTOR_ZERO
1749 +             .op_rgb:            SG_BLENDOP_ADD
1750 +             .src_factor_alpha:  SG_BLENDFACTOR_ONE
1751 +             .dst_factor_alpha:  SG_BLENDFACTOR_ZERO
1752 +             .op_alpha:          SG_BLENDOP_ADD
1753 +     .primitive_type:            SG_PRIMITIVETYPE_TRIANGLES
1754 +     .index_type:                SG_INDEXTYPE_NONE
1755 +     .cull_mode:                 SG_CULLMODE_NONE
1756 +     .face_winding:              SG_FACEWINDING_CW
1757 +     .sample_count:              sg_desc.context.sample_count
1758 +     .blend_color:               (sg_color) { 0.0f, 0.0f, 0.0f, 0.0f }
1759 +     .alpha_to_coverage_enabled: false
1760 +     .label  0       (optional string label for trace hooks)
1761 +/
1762 extern(C) struct VertexBufferLayoutState {
1763     int stride = 0;
1764     VertexStep step_func = VertexStep.Default;
1765     int step_rate = 0;
1766 }
1767 extern(C) struct VertexAttrState {
1768     int buffer_index = 0;
1769     int offset = 0;
1770     VertexFormat format = VertexFormat.Invalid;
1771 }
1772 extern(C) struct VertexLayoutState {
1773     VertexBufferLayoutState[8] buffers = [];
1774     VertexAttrState[16] attrs = [];
1775 }
1776 extern(C) struct StencilFaceState {
1777     CompareFunc compare = CompareFunc.Default;
1778     StencilOp fail_op = StencilOp.Default;
1779     StencilOp depth_fail_op = StencilOp.Default;
1780     StencilOp pass_op = StencilOp.Default;
1781 }
1782 extern(C) struct StencilState {
1783     bool enabled = false;
1784     StencilFaceState front = {};
1785     StencilFaceState back = {};
1786     ubyte read_mask = 0;
1787     ubyte write_mask = 0;
1788     ubyte _ref = 0;
1789 }
1790 extern(C) struct DepthState {
1791     PixelFormat pixel_format = PixelFormat.Default;
1792     CompareFunc compare = CompareFunc.Default;
1793     bool write_enabled = false;
1794     float bias = 0.0f;
1795     float bias_slope_scale = 0.0f;
1796     float bias_clamp = 0.0f;
1797 }
1798 extern(C) struct BlendState {
1799     bool enabled = false;
1800     BlendFactor src_factor_rgb = BlendFactor.Default;
1801     BlendFactor dst_factor_rgb = BlendFactor.Default;
1802     BlendOp op_rgb = BlendOp.Default;
1803     BlendFactor src_factor_alpha = BlendFactor.Default;
1804     BlendFactor dst_factor_alpha = BlendFactor.Default;
1805     BlendOp op_alpha = BlendOp.Default;
1806 }
1807 extern(C) struct ColorTargetState {
1808     PixelFormat pixel_format = PixelFormat.Default;
1809     ColorMask write_mask = ColorMask.Default;
1810     BlendState blend = {};
1811 }
1812 extern(C) struct PipelineDesc {
1813     uint _start_canary = 0;
1814     bool compute = false;
1815     Shader shader = {};
1816     VertexLayoutState layout = {};
1817     DepthState depth = {};
1818     StencilState stencil = {};
1819     int color_count = 0;
1820     ColorTargetState[8] colors = [];
1821     PrimitiveType primitive_type = PrimitiveType.Default;
1822     IndexType index_type = IndexType.Default;
1823     CullMode cull_mode = CullMode.Default;
1824     FaceWinding face_winding = FaceWinding.Default;
1825     int sample_count = 0;
1826     Color blend_color = {};
1827     bool alpha_to_coverage_enabled = false;
1828     const(char)* label = null;
1829     uint _end_canary = 0;
1830 }
1831 /++
1832 + sg_view_desc
1833 + 
1834 +     Creation params for sg_view objects, passed into sg_make_view() calls.
1835 + 
1836 +     View objects are passed into sg_apply_bindings() (for texture-, storage-buffer-
1837 +     and storage-image views), and sg_begin_pass() (for color-, resolve-
1838 +     and depth-stencil-attachment views).
1839 + 
1840 +     The view type is determined by initializing one of the sub-structs of
1841 +     sg_view_desc:
1842 + 
1843 +     .texture            a texture-view object will be created
1844 +         .image          the sg_image parent resource
1845 +         .mip_levels     optional mip-level range, keep zero-initialized for the
1846 +                         entire mipmap chain
1847 +             .base       the first mip level
1848 +             .count      number of mip levels, keeping this zero-initialized means
1849 +                         'all remaining mip levels'
1850 +         .slices         optional slice range, keep zero-initialized to include
1851 +                         all slices
1852 +             .base       the first slice
1853 +             .count      number of slices, keeping this zero-initializied means 'all remaining slices'
1854 + 
1855 +     .storage_buffer     a storage-buffer-view object will be created
1856 +         .buffer         the sg_buffer parent resource, must have been created
1857 +                         with `sg_buffer_desc.usage.storage_buffer = true`
1858 +         .offset         optional 256-byte aligned byte-offset into the buffer
1859 + 
1860 +     .storage_image      a storage-image-view object will be created
1861 +         .image          the sg_image parent resource, must have been created
1862 +                         with `sg_image_desc.usage.storage_image = true`
1863 +         .mip_level      selects the mip-level for the compute shader to write
1864 +         .slice          selects the slice for the compute shader to write
1865 + 
1866 +     .color_attachment   a color-attachment-view object will be created
1867 +         .image          the sg_image parent resource, must have been created
1868 +                         with `sg_image_desc.usage.color_attachment = true`
1869 +         .mip_level      selects the mip-level to render into
1870 +         .slice          selects the slice to render into
1871 + 
1872 +     .resolve_attachment a resolve-attachment-view object will be created
1873 +         .image          the sg_image parent resource, must have been created
1874 +                         with `sg_image_desc.usage.resolve_attachment = true`
1875 +         .mip_level      selects the mip-level to msaa-resolve into
1876 +         .slice          selects the slice to msaa-resolve into
1877 + 
1878 +     .depth_stencil_attachment   a depth-stencil-attachment-view object will be created
1879 +         .image          the sg_image parent resource, must have been created
1880 +                         with `sg_image_desc.usage.depth_stencil_attachment = true`
1881 +         .mip_level      selects the mip-level to render into
1882 +         .slice          selects the slice to render into
1883 +/
1884 extern(C) struct BufferViewDesc {
1885     Buffer buffer = {};
1886     int offset = 0;
1887 }
1888 extern(C) struct ImageViewDesc {
1889     Image image = {};
1890     int mip_level = 0;
1891     int slice = 0;
1892 }
1893 extern(C) struct TextureViewRange {
1894     int base = 0;
1895     int count = 0;
1896 }
1897 extern(C) struct TextureViewDesc {
1898     Image image = {};
1899     TextureViewRange mip_levels = {};
1900     TextureViewRange slices = {};
1901 }
1902 extern(C) struct ViewDesc {
1903     uint _start_canary = 0;
1904     TextureViewDesc texture = {};
1905     BufferViewDesc storage_buffer = {};
1906     ImageViewDesc storage_image = {};
1907     ImageViewDesc color_attachment = {};
1908     ImageViewDesc resolve_attachment = {};
1909     ImageViewDesc depth_stencil_attachment = {};
1910     const(char)* label = null;
1911     uint _end_canary = 0;
1912 }
1913 /++
1914 + sg_trace_hooks
1915 + 
1916 +     Installable callback functions to keep track of the sokol-gfx calls,
1917 +     this is useful for debugging, or keeping track of resource creation
1918 +     and destruction.
1919 + 
1920 +     Trace hooks are installed with sg_install_trace_hooks(), this returns
1921 +     another sg_trace_hooks struct with the previous set of
1922 +     trace hook function pointers. These should be invoked by the
1923 +     new trace hooks to form a proper call chain.
1924 +/
1925 extern(C) struct TraceHooks {
1926     void* user_data = null;
1927     extern(C) void function(void*) reset_state_cache = null;
1928     extern(C) void function(const BufferDesc*, Buffer, void*) make_buffer = null;
1929     extern(C) void function(const ImageDesc*, Image, void*) make_image = null;
1930     extern(C) void function(const SamplerDesc*, Sampler, void*) make_sampler = null;
1931     extern(C) void function(const ShaderDesc*, Shader, void*) make_shader = null;
1932     extern(C) void function(const PipelineDesc*, Pipeline, void*) make_pipeline = null;
1933     extern(C) void function(const ViewDesc*, View, void*) make_view = null;
1934     extern(C) void function(Buffer, void*) destroy_buffer = null;
1935     extern(C) void function(Image, void*) destroy_image = null;
1936     extern(C) void function(Sampler, void*) destroy_sampler = null;
1937     extern(C) void function(Shader, void*) destroy_shader = null;
1938     extern(C) void function(Pipeline, void*) destroy_pipeline = null;
1939     extern(C) void function(View, void*) destroy_view = null;
1940     extern(C) void function(Buffer, const Range*, void*) update_buffer = null;
1941     extern(C) void function(Image, const ImageData*, void*) update_image = null;
1942     extern(C) void function(Buffer, const Range*, int, void*) append_buffer = null;
1943     extern(C) void function(const Pass*, void*) begin_pass = null;
1944     extern(C) void function(int, int, int, int, bool, void*) apply_viewport = null;
1945     extern(C) void function(int, int, int, int, bool, void*) apply_scissor_rect = null;
1946     extern(C) void function(Pipeline, void*) apply_pipeline = null;
1947     extern(C) void function(const Bindings*, void*) apply_bindings = null;
1948     extern(C) void function(int, const Range*, void*) apply_uniforms = null;
1949     extern(C) void function(int, int, int, void*) draw = null;
1950     extern(C) void function(int, int, int, int, int, void*) draw_ex = null;
1951     extern(C) void function(int, int, int, void*) dispatch = null;
1952     extern(C) void function(void*) end_pass = null;
1953     extern(C) void function(void*) commit = null;
1954     extern(C) void function(Buffer, void*) alloc_buffer = null;
1955     extern(C) void function(Image, void*) alloc_image = null;
1956     extern(C) void function(Sampler, void*) alloc_sampler = null;
1957     extern(C) void function(Shader, void*) alloc_shader = null;
1958     extern(C) void function(Pipeline, void*) alloc_pipeline = null;
1959     extern(C) void function(View, void*) alloc_view = null;
1960     extern(C) void function(Buffer, void*) dealloc_buffer = null;
1961     extern(C) void function(Image, void*) dealloc_image = null;
1962     extern(C) void function(Sampler, void*) dealloc_sampler = null;
1963     extern(C) void function(Shader, void*) dealloc_shader = null;
1964     extern(C) void function(Pipeline, void*) dealloc_pipeline = null;
1965     extern(C) void function(View, void*) dealloc_view = null;
1966     extern(C) void function(Buffer, const BufferDesc*, void*) init_buffer = null;
1967     extern(C) void function(Image, const ImageDesc*, void*) init_image = null;
1968     extern(C) void function(Sampler, const SamplerDesc*, void*) init_sampler = null;
1969     extern(C) void function(Shader, const ShaderDesc*, void*) init_shader = null;
1970     extern(C) void function(Pipeline, const PipelineDesc*, void*) init_pipeline = null;
1971     extern(C) void function(View, const ViewDesc*, void*) init_view = null;
1972     extern(C) void function(Buffer, void*) uninit_buffer = null;
1973     extern(C) void function(Image, void*) uninit_image = null;
1974     extern(C) void function(Sampler, void*) uninit_sampler = null;
1975     extern(C) void function(Shader, void*) uninit_shader = null;
1976     extern(C) void function(Pipeline, void*) uninit_pipeline = null;
1977     extern(C) void function(View, void*) uninit_view = null;
1978     extern(C) void function(Buffer, void*) fail_buffer = null;
1979     extern(C) void function(Image, void*) fail_image = null;
1980     extern(C) void function(Sampler, void*) fail_sampler = null;
1981     extern(C) void function(Shader, void*) fail_shader = null;
1982     extern(C) void function(Pipeline, void*) fail_pipeline = null;
1983     extern(C) void function(View, void*) fail_view = null;
1984     extern(C) void function(const(char)*, void*) push_debug_group = null;
1985     extern(C) void function(void*) pop_debug_group = null;
1986 }
1987 /++
1988 + sg_buffer_info
1989 +     sg_image_info
1990 +     sg_sampler_info
1991 +     sg_shader_info
1992 +     sg_pipeline_info
1993 +     sg_view_info
1994 + 
1995 +     These structs contain various internal resource attributes which
1996 +     might be useful for debug-inspection. Please don't rely on the
1997 +     actual content of those structs too much, as they are quite closely
1998 +     tied to sokol_gfx.h internals and may change more frequently than
1999 +     the other public API elements.
2000 + 
2001 +     The *_info structs are used as the return values of the following functions:
2002 + 
2003 +     sg_query_buffer_info()
2004 +     sg_query_image_info()
2005 +     sg_query_sampler_info()
2006 +     sg_query_shader_info()
2007 +     sg_query_pipeline_info()
2008 +     sg_query_view_info()
2009 +/
2010 extern(C) struct SlotInfo {
2011     ResourceState state = ResourceState.Initial;
2012     uint res_id = 0;
2013     uint uninit_count = 0;
2014 }
2015 extern(C) struct BufferInfo {
2016     SlotInfo slot = {};
2017     uint update_frame_index = 0;
2018     uint append_frame_index = 0;
2019     int append_pos = 0;
2020     bool append_overflow = false;
2021     int num_slots = 0;
2022     int active_slot = 0;
2023 }
2024 extern(C) struct ImageInfo {
2025     SlotInfo slot = {};
2026     uint upd_frame_index = 0;
2027     int num_slots = 0;
2028     int active_slot = 0;
2029 }
2030 extern(C) struct SamplerInfo {
2031     SlotInfo slot = {};
2032 }
2033 extern(C) struct ShaderInfo {
2034     SlotInfo slot = {};
2035 }
2036 extern(C) struct PipelineInfo {
2037     SlotInfo slot = {};
2038 }
2039 extern(C) struct ViewInfo {
2040     SlotInfo slot = {};
2041 }
2042 /++
2043 + sg_stats
2044 + 
2045 +     Allows to track generic and backend-specific rendering stats,
2046 +     obtained via sg_query_stats().
2047 +/
2048 extern(C) struct FrameStatsGl {
2049     uint num_bind_buffer = 0;
2050     uint num_active_texture = 0;
2051     uint num_bind_texture = 0;
2052     uint num_bind_sampler = 0;
2053     uint num_bind_image_texture = 0;
2054     uint num_use_program = 0;
2055     uint num_render_state = 0;
2056     uint num_vertex_attrib_pointer = 0;
2057     uint num_vertex_attrib_divisor = 0;
2058     uint num_enable_vertex_attrib_array = 0;
2059     uint num_disable_vertex_attrib_array = 0;
2060     uint num_uniform = 0;
2061     uint num_memory_barriers = 0;
2062 }
2063 extern(C) struct FrameStatsD3d11Pass {
2064     uint num_om_set_render_targets = 0;
2065     uint num_clear_render_target_view = 0;
2066     uint num_clear_depth_stencil_view = 0;
2067     uint num_resolve_subresource = 0;
2068 }
2069 extern(C) struct FrameStatsD3d11Pipeline {
2070     uint num_rs_set_state = 0;
2071     uint num_om_set_depth_stencil_state = 0;
2072     uint num_om_set_blend_state = 0;
2073     uint num_ia_set_primitive_topology = 0;
2074     uint num_ia_set_input_layout = 0;
2075     uint num_vs_set_shader = 0;
2076     uint num_vs_set_constant_buffers = 0;
2077     uint num_ps_set_shader = 0;
2078     uint num_ps_set_constant_buffers = 0;
2079     uint num_cs_set_shader = 0;
2080     uint num_cs_set_constant_buffers = 0;
2081 }
2082 extern(C) struct FrameStatsD3d11Bindings {
2083     uint num_ia_set_vertex_buffers = 0;
2084     uint num_ia_set_index_buffer = 0;
2085     uint num_vs_set_shader_resources = 0;
2086     uint num_vs_set_samplers = 0;
2087     uint num_ps_set_shader_resources = 0;
2088     uint num_ps_set_samplers = 0;
2089     uint num_cs_set_shader_resources = 0;
2090     uint num_cs_set_samplers = 0;
2091     uint num_cs_set_unordered_access_views = 0;
2092 }
2093 extern(C) struct FrameStatsD3d11Uniforms {
2094     uint num_update_subresource = 0;
2095 }
2096 extern(C) struct FrameStatsD3d11Draw {
2097     uint num_draw_indexed_instanced = 0;
2098     uint num_draw_indexed = 0;
2099     uint num_draw_instanced = 0;
2100     uint num_draw = 0;
2101 }
2102 extern(C) struct FrameStatsD3d11 {
2103     FrameStatsD3d11Pass pass = {};
2104     FrameStatsD3d11Pipeline pipeline = {};
2105     FrameStatsD3d11Bindings bindings = {};
2106     FrameStatsD3d11Uniforms uniforms = {};
2107     FrameStatsD3d11Draw draw = {};
2108     uint num_map = 0;
2109     uint num_unmap = 0;
2110 }
2111 extern(C) struct FrameStatsMetalIdpool {
2112     uint num_added = 0;
2113     uint num_released = 0;
2114     uint num_garbage_collected = 0;
2115 }
2116 extern(C) struct FrameStatsMetalPipeline {
2117     uint num_set_blend_color = 0;
2118     uint num_set_cull_mode = 0;
2119     uint num_set_front_facing_winding = 0;
2120     uint num_set_stencil_reference_value = 0;
2121     uint num_set_depth_bias = 0;
2122     uint num_set_render_pipeline_state = 0;
2123     uint num_set_depth_stencil_state = 0;
2124 }
2125 extern(C) struct FrameStatsMetalBindings {
2126     uint num_set_vertex_buffer = 0;
2127     uint num_set_vertex_buffer_offset = 0;
2128     uint num_skip_redundant_vertex_buffer = 0;
2129     uint num_set_vertex_texture = 0;
2130     uint num_skip_redundant_vertex_texture = 0;
2131     uint num_set_vertex_sampler_state = 0;
2132     uint num_skip_redundant_vertex_sampler_state = 0;
2133     uint num_set_fragment_buffer = 0;
2134     uint num_set_fragment_buffer_offset = 0;
2135     uint num_skip_redundant_fragment_buffer = 0;
2136     uint num_set_fragment_texture = 0;
2137     uint num_skip_redundant_fragment_texture = 0;
2138     uint num_set_fragment_sampler_state = 0;
2139     uint num_skip_redundant_fragment_sampler_state = 0;
2140     uint num_set_compute_buffer = 0;
2141     uint num_set_compute_buffer_offset = 0;
2142     uint num_skip_redundant_compute_buffer = 0;
2143     uint num_set_compute_texture = 0;
2144     uint num_skip_redundant_compute_texture = 0;
2145     uint num_set_compute_sampler_state = 0;
2146     uint num_skip_redundant_compute_sampler_state = 0;
2147 }
2148 extern(C) struct FrameStatsMetalUniforms {
2149     uint num_set_vertex_buffer_offset = 0;
2150     uint num_set_fragment_buffer_offset = 0;
2151     uint num_set_compute_buffer_offset = 0;
2152 }
2153 extern(C) struct FrameStatsMetal {
2154     FrameStatsMetalIdpool idpool = {};
2155     FrameStatsMetalPipeline pipeline = {};
2156     FrameStatsMetalBindings bindings = {};
2157     FrameStatsMetalUniforms uniforms = {};
2158 }
2159 extern(C) struct FrameStatsWgpuUniforms {
2160     uint num_set_bindgroup = 0;
2161     uint size_write_buffer = 0;
2162 }
2163 extern(C) struct FrameStatsWgpuBindings {
2164     uint num_set_vertex_buffer = 0;
2165     uint num_skip_redundant_vertex_buffer = 0;
2166     uint num_set_index_buffer = 0;
2167     uint num_skip_redundant_index_buffer = 0;
2168     uint num_create_bindgroup = 0;
2169     uint num_discard_bindgroup = 0;
2170     uint num_set_bindgroup = 0;
2171     uint num_skip_redundant_bindgroup = 0;
2172     uint num_bindgroup_cache_hits = 0;
2173     uint num_bindgroup_cache_misses = 0;
2174     uint num_bindgroup_cache_collisions = 0;
2175     uint num_bindgroup_cache_invalidates = 0;
2176     uint num_bindgroup_cache_hash_vs_key_mismatch = 0;
2177 }
2178 extern(C) struct FrameStatsWgpu {
2179     FrameStatsWgpuUniforms uniforms = {};
2180     FrameStatsWgpuBindings bindings = {};
2181 }
2182 extern(C) struct FrameStatsVk {
2183     uint num_cmd_pipeline_barrier = 0;
2184     uint num_allocate_memory = 0;
2185     uint num_free_memory = 0;
2186     uint size_allocate_memory = 0;
2187     uint num_delete_queue_added = 0;
2188     uint num_delete_queue_collected = 0;
2189     uint num_cmd_copy_buffer = 0;
2190     uint num_cmd_copy_buffer_to_image = 0;
2191     uint num_cmd_set_descriptor_buffer_offsets = 0;
2192     uint size_descriptor_buffer_writes = 0;
2193 }
2194 extern(C) struct FrameResourceStats {
2195     uint allocated = 0;
2196     uint deallocated = 0;
2197     uint inited = 0;
2198     uint uninited = 0;
2199 }
2200 extern(C) struct TotalResourceStats {
2201     uint alive = 0;
2202     uint free = 0;
2203     uint allocated = 0;
2204     uint deallocated = 0;
2205     uint inited = 0;
2206     uint uninited = 0;
2207 }
2208 extern(C) struct TotalStats {
2209     TotalResourceStats buffers = {};
2210     TotalResourceStats images = {};
2211     TotalResourceStats samplers = {};
2212     TotalResourceStats views = {};
2213     TotalResourceStats shaders = {};
2214     TotalResourceStats pipelines = {};
2215 }
2216 extern(C) struct FrameStats {
2217     uint frame_index = 0;
2218     uint num_passes = 0;
2219     uint num_apply_viewport = 0;
2220     uint num_apply_scissor_rect = 0;
2221     uint num_apply_pipeline = 0;
2222     uint num_apply_bindings = 0;
2223     uint num_apply_uniforms = 0;
2224     uint num_draw = 0;
2225     uint num_draw_ex = 0;
2226     uint num_dispatch = 0;
2227     uint num_update_buffer = 0;
2228     uint num_append_buffer = 0;
2229     uint num_update_image = 0;
2230     uint size_apply_uniforms = 0;
2231     uint size_update_buffer = 0;
2232     uint size_append_buffer = 0;
2233     uint size_update_image = 0;
2234     FrameResourceStats buffers = {};
2235     FrameResourceStats images = {};
2236     FrameResourceStats samplers = {};
2237     FrameResourceStats views = {};
2238     FrameResourceStats shaders = {};
2239     FrameResourceStats pipelines = {};
2240     FrameStatsGl gl = {};
2241     FrameStatsD3d11 d3d11 = {};
2242     FrameStatsMetal metal = {};
2243     FrameStatsWgpu wgpu = {};
2244     FrameStatsVk vk = {};
2245 }
2246 extern(C) struct Stats {
2247     FrameStats prev_frame = {};
2248     FrameStats cur_frame = {};
2249     TotalStats total = {};
2250 }
2251 enum LogItem {
2252     Ok,
2253     Malloc_failed,
2254     Gl_texture_format_not_supported,
2255     Gl_3d_textures_not_supported,
2256     Gl_array_textures_not_supported,
2257     Gl_storagebuffer_glsl_binding_out_of_range,
2258     Gl_storageimage_glsl_binding_out_of_range,
2259     Gl_shader_compilation_failed,
2260     Gl_shader_linking_failed,
2261     Gl_vertex_attribute_not_found_in_shader,
2262     Gl_uniformblock_name_not_found_in_shader,
2263     Gl_image_sampler_name_not_found_in_shader,
2264     Gl_framebuffer_status_undefined,
2265     Gl_framebuffer_status_incomplete_attachment,
2266     Gl_framebuffer_status_incomplete_missing_attachment,
2267     Gl_framebuffer_status_unsupported,
2268     Gl_framebuffer_status_incomplete_multisample,
2269     Gl_framebuffer_status_unknown,
2270     D3d11_feature_level_0_detected,
2271     D3d11_create_buffer_failed,
2272     D3d11_create_buffer_srv_failed,
2273     D3d11_create_buffer_uav_failed,
2274     D3d11_create_depth_texture_unsupported_pixel_format,
2275     D3d11_create_depth_texture_failed,
2276     D3d11_create_2d_texture_unsupported_pixel_format,
2277     D3d11_create_2d_texture_failed,
2278     D3d11_create_2d_srv_failed,
2279     D3d11_create_3d_texture_unsupported_pixel_format,
2280     D3d11_create_3d_texture_failed,
2281     D3d11_create_3d_srv_failed,
2282     D3d11_create_msaa_texture_failed,
2283     D3d11_create_sampler_state_failed,
2284     D3d11_uniformblock_hlsl_register_b_out_of_range,
2285     D3d11_storagebuffer_hlsl_register_t_out_of_range,
2286     D3d11_storagebuffer_hlsl_register_u_out_of_range,
2287     D3d11_image_hlsl_register_t_out_of_range,
2288     D3d11_storageimage_hlsl_register_u_out_of_range,
2289     D3d11_sampler_hlsl_register_s_out_of_range,
2290     D3d11_load_d3dcompiler_47_dll_failed,
2291     D3d11_shader_compilation_failed,
2292     D3d11_shader_compilation_output,
2293     D3d11_create_constant_buffer_failed,
2294     D3d11_create_input_layout_failed,
2295     D3d11_create_rasterizer_state_failed,
2296     D3d11_create_depth_stencil_state_failed,
2297     D3d11_create_blend_state_failed,
2298     D3d11_create_rtv_failed,
2299     D3d11_create_dsv_failed,
2300     D3d11_create_uav_failed,
2301     D3d11_map_for_update_buffer_failed,
2302     D3d11_map_for_append_buffer_failed,
2303     D3d11_map_for_update_image_failed,
2304     Metal_create_buffer_failed,
2305     Metal_texture_format_not_supported,
2306     Metal_create_texture_failed,
2307     Metal_create_sampler_failed,
2308     Metal_shader_compilation_failed,
2309     Metal_shader_creation_failed,
2310     Metal_shader_compilation_output,
2311     Metal_shader_entry_not_found,
2312     Metal_uniformblock_msl_buffer_slot_out_of_range,
2313     Metal_storagebuffer_msl_buffer_slot_out_of_range,
2314     Metal_storageimage_msl_texture_slot_out_of_range,
2315     Metal_image_msl_texture_slot_out_of_range,
2316     Metal_sampler_msl_sampler_slot_out_of_range,
2317     Metal_create_cps_failed,
2318     Metal_create_cps_output,
2319     Metal_create_rps_failed,
2320     Metal_create_rps_output,
2321     Metal_create_dss_failed,
2322     Wgpu_bindgroups_pool_exhausted,
2323     Wgpu_bindgroupscache_size_greater_one,
2324     Wgpu_bindgroupscache_size_pow2,
2325     Wgpu_createbindgroup_failed,
2326     Wgpu_create_buffer_failed,
2327     Wgpu_create_texture_failed,
2328     Wgpu_create_texture_view_failed,
2329     Wgpu_create_sampler_failed,
2330     Wgpu_create_shader_module_failed,
2331     Wgpu_shader_create_bindgroup_layout_failed,
2332     Wgpu_uniformblock_wgsl_group0_binding_out_of_range,
2333     Wgpu_texture_wgsl_group1_binding_out_of_range,
2334     Wgpu_storagebuffer_wgsl_group1_binding_out_of_range,
2335     Wgpu_storageimage_wgsl_group1_binding_out_of_range,
2336     Wgpu_sampler_wgsl_group1_binding_out_of_range,
2337     Wgpu_create_pipeline_layout_failed,
2338     Wgpu_create_render_pipeline_failed,
2339     Wgpu_create_compute_pipeline_failed,
2340     Vulkan_required_extension_function_missing,
2341     Vulkan_alloc_device_memory_no_suitable_memory_type,
2342     Vulkan_allocate_memory_failed,
2343     Vulkan_alloc_buffer_device_memory_failed,
2344     Vulkan_alloc_image_device_memory_failed,
2345     Vulkan_delete_queue_exhausted,
2346     Vulkan_staging_create_buffer_failed,
2347     Vulkan_staging_allocate_memory_failed,
2348     Vulkan_staging_bind_buffer_memory_failed,
2349     Vulkan_staging_stream_buffer_overflow,
2350     Vulkan_create_shared_buffer_failed,
2351     Vulkan_allocate_shared_buffer_memory_failed,
2352     Vulkan_bind_shared_buffer_memory_failed,
2353     Vulkan_map_shared_buffer_memory_failed,
2354     Vulkan_create_buffer_failed,
2355     Vulkan_bind_buffer_memory_failed,
2356     Vulkan_create_image_failed,
2357     Vulkan_bind_image_memory_failed,
2358     Vulkan_create_shader_module_failed,
2359     Vulkan_uniformblock_spirv_set0_binding_out_of_range,
2360     Vulkan_texture_spirv_set1_binding_out_of_range,
2361     Vulkan_storagebuffer_spirv_set1_binding_out_of_range,
2362     Vulkan_storageimage_spirv_set1_binding_out_of_range,
2363     Vulkan_sampler_spirv_set1_binding_out_of_range,
2364     Vulkan_create_descriptor_set_layout_failed,
2365     Vulkan_shader_uniform_descriptor_set_size_vs_cache_size,
2366     Vulkan_create_pipeline_layout_failed,
2367     Vulkan_create_graphics_pipeline_failed,
2368     Vulkan_create_compute_pipeline_failed,
2369     Vulkan_create_image_view_failed,
2370     Vulkan_view_max_descriptor_size,
2371     Vulkan_create_sampler_failed,
2372     Vulkan_sampler_max_descriptor_size,
2373     Vulkan_wait_for_fence_failed,
2374     Vulkan_uniform_buffer_overflow,
2375     Vulkan_descriptor_buffer_overflow,
2376     Identical_commit_listener,
2377     Commit_listener_array_full,
2378     Trace_hooks_not_enabled,
2379     Dealloc_buffer_invalid_state,
2380     Dealloc_image_invalid_state,
2381     Dealloc_sampler_invalid_state,
2382     Dealloc_shader_invalid_state,
2383     Dealloc_pipeline_invalid_state,
2384     Dealloc_view_invalid_state,
2385     Init_buffer_invalid_state,
2386     Init_image_invalid_state,
2387     Init_sampler_invalid_state,
2388     Init_shader_invalid_state,
2389     Init_pipeline_invalid_state,
2390     Init_view_invalid_state,
2391     Uninit_buffer_invalid_state,
2392     Uninit_image_invalid_state,
2393     Uninit_sampler_invalid_state,
2394     Uninit_shader_invalid_state,
2395     Uninit_pipeline_invalid_state,
2396     Uninit_view_invalid_state,
2397     Fail_buffer_invalid_state,
2398     Fail_image_invalid_state,
2399     Fail_sampler_invalid_state,
2400     Fail_shader_invalid_state,
2401     Fail_pipeline_invalid_state,
2402     Fail_view_invalid_state,
2403     Buffer_pool_exhausted,
2404     Image_pool_exhausted,
2405     Sampler_pool_exhausted,
2406     Shader_pool_exhausted,
2407     Pipeline_pool_exhausted,
2408     View_pool_exhausted,
2409     Beginpass_too_many_color_attachments,
2410     Beginpass_too_many_resolve_attachments,
2411     Beginpass_attachments_alive,
2412     Draw_without_bindings,
2413     Shaderdesc_too_many_vertexstage_textures,
2414     Shaderdesc_too_many_fragmentstage_textures,
2415     Shaderdesc_too_many_computestage_textures,
2416     Shaderdesc_too_many_vertexstage_storagebuffers,
2417     Shaderdesc_too_many_fragmentstage_storagebuffers,
2418     Shaderdesc_too_many_computestage_storagebuffers,
2419     Shaderdesc_too_many_vertexstage_storageimages,
2420     Shaderdesc_too_many_fragmentstage_storageimages,
2421     Shaderdesc_too_many_computestage_storageimages,
2422     Shaderdesc_too_many_vertexstage_texturesamplerpairs,
2423     Shaderdesc_too_many_fragmentstage_texturesamplerpairs,
2424     Shaderdesc_too_many_computestage_texturesamplerpairs,
2425     Validate_bufferdesc_canary,
2426     Validate_bufferdesc_immutable_dynamic_stream,
2427     Validate_bufferdesc_separate_buffer_types,
2428     Validate_bufferdesc_expect_nonzero_size,
2429     Validate_bufferdesc_expect_matching_data_size,
2430     Validate_bufferdesc_expect_zero_data_size,
2431     Validate_bufferdesc_expect_no_data,
2432     Validate_bufferdesc_expect_data,
2433     Validate_bufferdesc_storagebuffer_supported,
2434     Validate_bufferdesc_storagebuffer_size_multiple_4,
2435     Validate_imagedata_nodata,
2436     Validate_imagedata_data_size,
2437     Validate_imagedesc_canary,
2438     Validate_imagedesc_immutable_dynamic_stream,
2439     Validate_imagedesc_attachment_color_depth_stencil,
2440     Validate_imagedesc_imagetype_2d_numslices,
2441     Validate_imagedesc_imagetype_cube_numslices,
2442     Validate_imagedesc_imagetype_array_numslices,
2443     Validate_imagedesc_imagetype_3d_numslices,
2444     Validate_imagedesc_numslices,
2445     Validate_imagedesc_width,
2446     Validate_imagedesc_height,
2447     Validate_imagedesc_nonrt_pixelformat,
2448     Validate_imagedesc_msaa_but_no_attachment,
2449     Validate_imagedesc_depth_3d_image,
2450     Validate_imagedesc_attachment_expect_immutable,
2451     Validate_imagedesc_attachment_expect_no_data,
2452     Validate_imagedesc_attachment_pixelformat,
2453     Validate_imagedesc_attachment_resolve_expect_no_msaa,
2454     Validate_imagedesc_attachment_no_msaa_support,
2455     Validate_imagedesc_attachment_msaa_num_mipmaps,
2456     Validate_imagedesc_attachment_msaa_3d_image,
2457     Validate_imagedesc_attachment_msaa_cube_image,
2458     Validate_imagedesc_attachment_msaa_array_image,
2459     Validate_imagedesc_storageimage_pixelformat,
2460     Validate_imagedesc_storageimage_expect_no_msaa,
2461     Validate_imagedesc_injected_no_data,
2462     Validate_imagedesc_dynamic_no_data,
2463     Validate_imagedesc_compressed_immutable,
2464     Validate_samplerdesc_canary,
2465     Validate_samplerdesc_anistropic_requires_linear_filtering,
2466     Validate_shaderdesc_canary,
2467     Validate_shaderdesc_vertex_source,
2468     Validate_shaderdesc_fragment_source,
2469     Validate_shaderdesc_compute_source,
2470     Validate_shaderdesc_vertex_source_or_bytecode,
2471     Validate_shaderdesc_fragment_source_or_bytecode,
2472     Validate_shaderdesc_compute_source_or_bytecode,
2473     Validate_shaderdesc_invalid_shader_combo,
2474     Validate_shaderdesc_no_bytecode_size,
2475     Validate_shaderdesc_metal_threads_per_threadgroup_initialized,
2476     Validate_shaderdesc_metal_threads_per_threadgroup_multiple_32,
2477     Validate_shaderdesc_uniformblock_no_cont_members,
2478     Validate_shaderdesc_uniformblock_size_is_zero,
2479     Validate_shaderdesc_uniformblock_metal_buffer_slot_collision,
2480     Validate_shaderdesc_uniformblock_hlsl_register_b_collision,
2481     Validate_shaderdesc_uniformblock_wgsl_group0_binding_collision,
2482     Validate_shaderdesc_uniformblock_spirv_set0_binding_collision,
2483     Validate_shaderdesc_uniformblock_no_members,
2484     Validate_shaderdesc_uniformblock_uniform_glsl_name,
2485     Validate_shaderdesc_uniformblock_size_mismatch,
2486     Validate_shaderdesc_uniformblock_array_count,
2487     Validate_shaderdesc_uniformblock_std140_array_type,
2488     Validate_shaderdesc_view_storagebuffer_metal_buffer_slot_collision,
2489     Validate_shaderdesc_view_storagebuffer_hlsl_register_t_collision,
2490     Validate_shaderdesc_view_storagebuffer_hlsl_register_u_collision,
2491     Validate_shaderdesc_view_storagebuffer_glsl_binding_collision,
2492     Validate_shaderdesc_view_storagebuffer_wgsl_group1_binding_collision,
2493     Validate_shaderdesc_view_storagebuffer_spirv_set1_binding_collision,
2494     Validate_shaderdesc_view_storageimage_expect_compute_stage,
2495     Validate_shaderdesc_view_storageimage_metal_texture_slot_collision,
2496     Validate_shaderdesc_view_storageimage_hlsl_register_u_collision,
2497     Validate_shaderdesc_view_storageimage_glsl_binding_collision,
2498     Validate_shaderdesc_view_storageimage_wgsl_group1_binding_collision,
2499     Validate_shaderdesc_view_storageimage_spirv_set1_binding_collision,
2500     Validate_shaderdesc_view_texture_metal_texture_slot_collision,
2501     Validate_shaderdesc_view_texture_hlsl_register_t_collision,
2502     Validate_shaderdesc_view_texture_wgsl_group1_binding_collision,
2503     Validate_shaderdesc_view_texture_spirv_set1_binding_collision,
2504     Validate_shaderdesc_sampler_metal_sampler_slot_collision,
2505     Validate_shaderdesc_sampler_hlsl_register_s_collision,
2506     Validate_shaderdesc_sampler_wgsl_group1_binding_collision,
2507     Validate_shaderdesc_sampler_spirv_set1_binding_collision,
2508     Validate_shaderdesc_texture_sampler_pair_view_slot_out_of_range,
2509     Validate_shaderdesc_texture_sampler_pair_sampler_slot_out_of_range,
2510     Validate_shaderdesc_texture_sampler_pair_texture_stage_mismatch,
2511     Validate_shaderdesc_texture_sampler_pair_expect_texture_view,
2512     Validate_shaderdesc_texture_sampler_pair_sampler_stage_mismatch,
2513     Validate_shaderdesc_texture_sampler_pair_glsl_name,
2514     Validate_shaderdesc_nonfiltering_sampler_required,
2515     Validate_shaderdesc_comparison_sampler_required,
2516     Validate_shaderdesc_texview_not_referenced_by_texture_sampler_pairs,
2517     Validate_shaderdesc_sampler_not_referenced_by_texture_sampler_pairs,
2518     Validate_shaderdesc_attr_string_too_long,
2519     Validate_pipelinedesc_canary,
2520     Validate_pipelinedesc_shader,
2521     Validate_pipelinedesc_compute_shader_expected,
2522     Validate_pipelinedesc_no_compute_shader_expected,
2523     Validate_pipelinedesc_no_cont_attrs,
2524     Validate_pipelinedesc_attr_basetype_mismatch,
2525     Validate_pipelinedesc_attr_vertexformat_int10_n2_not_supported,
2526     Validate_pipelinedesc_layout_stride4,
2527     Validate_pipelinedesc_attr_semantics,
2528     Validate_pipelinedesc_shader_readonly_storagebuffers,
2529     Validate_pipelinedesc_blendop_minmax_requires_blendfactor_one,
2530     Validate_pipelinedesc_dual_source_blending_not_supported,
2531     Validate_viewdesc_canary,
2532     Validate_viewdesc_unique_viewtype,
2533     Validate_viewdesc_any_viewtype,
2534     Validate_viewdesc_resource_alive,
2535     Validate_viewdesc_resource_failed,
2536     Validate_viewdesc_storagebuffer_offset_vs_buffer_size,
2537     Validate_viewdesc_storagebuffer_offset_multiple_256,
2538     Validate_viewdesc_storagebuffer_usage,
2539     Validate_viewdesc_storageimage_usage,
2540     Validate_viewdesc_colorattachment_usage,
2541     Validate_viewdesc_resolveattachment_usage,
2542     Validate_viewdesc_depthstencilattachment_usage,
2543     Validate_viewdesc_image_miplevel,
2544     Validate_viewdesc_image_2d_slice,
2545     Validate_viewdesc_image_cubemap_slice,
2546     Validate_viewdesc_image_array_slice,
2547     Validate_viewdesc_image_3d_slice,
2548     Validate_viewdesc_texture_expect_no_msaa,
2549     Validate_viewdesc_texture_miplevels,
2550     Validate_viewdesc_texture_2d_slices,
2551     Validate_viewdesc_texture_cubemap_slices,
2552     Validate_viewdesc_texture_array_slices,
2553     Validate_viewdesc_texture_3d_slices,
2554     Validate_viewdesc_storageimage_pixelformat,
2555     Validate_viewdesc_colorattachment_pixelformat,
2556     Validate_viewdesc_depthstencilattachment_pixelformat,
2557     Validate_viewdesc_resolveattachment_samplecount,
2558     Validate_beginpass_canary,
2559     Validate_beginpass_computepass_expect_no_attachments,
2560     Validate_beginpass_swapchain_expect_width,
2561     Validate_beginpass_swapchain_expect_width_notset,
2562     Validate_beginpass_swapchain_expect_height,
2563     Validate_beginpass_swapchain_expect_height_notset,
2564     Validate_beginpass_swapchain_expect_samplecount,
2565     Validate_beginpass_swapchain_expect_samplecount_notset,
2566     Validate_beginpass_swapchain_expect_colorformat,
2567     Validate_beginpass_swapchain_expect_colorformat_notset,
2568     Validate_beginpass_swapchain_expect_depthformat_notset,
2569     Validate_beginpass_swapchain_metal_expect_currentdrawable,
2570     Validate_beginpass_swapchain_metal_expect_currentdrawable_notset,
2571     Validate_beginpass_swapchain_metal_expect_depthstenciltexture,
2572     Validate_beginpass_swapchain_metal_expect_depthstenciltexture_notset,
2573     Validate_beginpass_swapchain_metal_expect_msaacolortexture,
2574     Validate_beginpass_swapchain_metal_expect_msaacolortexture_notset,
2575     Validate_beginpass_swapchain_d3d11_expect_renderview,
2576     Validate_beginpass_swapchain_d3d11_expect_renderview_notset,
2577     Validate_beginpass_swapchain_d3d11_expect_resolveview,
2578     Validate_beginpass_swapchain_d3d11_expect_resolveview_notset,
2579     Validate_beginpass_swapchain_d3d11_expect_depthstencilview,
2580     Validate_beginpass_swapchain_d3d11_expect_depthstencilview_notset,
2581     Validate_beginpass_swapchain_wgpu_expect_renderview,
2582     Validate_beginpass_swapchain_wgpu_expect_renderview_notset,
2583     Validate_beginpass_swapchain_wgpu_expect_resolveview,
2584     Validate_beginpass_swapchain_wgpu_expect_resolveview_notset,
2585     Validate_beginpass_swapchain_wgpu_expect_depthstencilview,
2586     Validate_beginpass_swapchain_wgpu_expect_depthstencilview_notset,
2587     Validate_beginpass_swapchain_gl_expect_framebuffer_notset,
2588     Validate_beginpass_swapchain_vulkan_expect_renderimage,
2589     Validate_beginpass_swapchain_vulkan_expect_renderimage_notset,
2590     Validate_beginpass_swapchain_vulkan_expect_renderview,
2591     Validate_beginpass_swapchain_vulkan_expect_renderview_notset,
2592     Validate_beginpass_swapchain_vulkan_expect_depthstencilimage,
2593     Validate_beginpass_swapchain_vulkan_expect_depthstencilimage_notset,
2594     Validate_beginpass_swapchain_vulkan_expect_depthstencilview,
2595     Validate_beginpass_swapchain_vulkan_expect_depthstencilview_notset,
2596     Validate_beginpass_swapchain_vulkan_expect_resolveimage,
2597     Validate_beginpass_swapchain_vulkan_expect_resolveimage_notset,
2598     Validate_beginpass_swapchain_vulkan_expect_resolveview,
2599     Validate_beginpass_swapchain_vulkan_expect_resolveview_notset,
2600     Validate_beginpass_swapchain_vulkan_expect_renderfinishedsemaphore,
2601     Validate_beginpass_swapchain_vulkan_expect_renderfinishedsemaphore_notset,
2602     Validate_beginpass_swapchain_vulkan_expect_presentcompletesemaphore,
2603     Validate_beginpass_swapchain_vulkan_expect_presentcompletesemaphore_notset,
2604     Validate_beginpass_colorattachmentviews_continuous,
2605     Validate_beginpass_colorattachmentview_alive,
2606     Validate_beginpass_colorattachmentview_valid,
2607     Validate_beginpass_colorattachmentview_type,
2608     Validate_beginpass_colorattachmentview_image_alive,
2609     Validate_beginpass_colorattachmentview_image_valid,
2610     Validate_beginpass_colorattachmentview_sizes,
2611     Validate_beginpass_colorattachmentview_samplecount,
2612     Validate_beginpass_colorattachmentview_samplecounts_equal,
2613     Validate_beginpass_resolveattachmentview_no_colorattachmentview,
2614     Validate_beginpass_resolveattachmentview_alive,
2615     Validate_beginpass_resolveattachmentview_valid,
2616     Validate_beginpass_resolveattachmentview_type,
2617     Validate_beginpass_resolveattachmentview_image_alive,
2618     Validate_beginpass_resolveattachmentview_image_valid,
2619     Validate_beginpass_resolveattachmentview_sizes,
2620     Validate_beginpass_depthstencilattachmentviews_continuous,
2621     Validate_beginpass_depthstencilattachmentview_alive,
2622     Validate_beginpass_depthstencilattachmentview_valid,
2623     Validate_beginpass_depthstencilattachmentview_type,
2624     Validate_beginpass_depthstencilattachmentview_image_alive,
2625     Validate_beginpass_depthstencilattachmentview_image_valid,
2626     Validate_beginpass_depthstencilattachmentview_sizes,
2627     Validate_beginpass_depthstencilattachmentview_samplecount,
2628     Validate_beginpass_attachments_expected,
2629     Validate_avp_renderpass_expected,
2630     Validate_asr_renderpass_expected,
2631     Validate_apip_pipeline_valid_id,
2632     Validate_apip_pipeline_exists,
2633     Validate_apip_pipeline_valid,
2634     Validate_apip_pass_expected,
2635     Validate_apip_pipeline_shader_alive,
2636     Validate_apip_pipeline_shader_valid,
2637     Validate_apip_computepass_expected,
2638     Validate_apip_renderpass_expected,
2639     Validate_apip_swapchain_color_count,
2640     Validate_apip_swapchain_color_format,
2641     Validate_apip_swapchain_depth_format,
2642     Validate_apip_swapchain_sample_count,
2643     Validate_apip_attachments_alive,
2644     Validate_apip_colorattachments_count,
2645     Validate_apip_colorattachments_view_valid,
2646     Validate_apip_colorattachments_image_valid,
2647     Validate_apip_colorattachments_format,
2648     Validate_apip_depthstencilattachment_view_valid,
2649     Validate_apip_depthstencilattachment_image_valid,
2650     Validate_apip_depthstencilattachment_format,
2651     Validate_apip_attachment_sample_count,
2652     Validate_abnd_pass_expected,
2653     Validate_abnd_empty_bindings,
2654     Validate_abnd_no_pipeline,
2655     Validate_abnd_pipeline_alive,
2656     Validate_abnd_pipeline_valid,
2657     Validate_abnd_pipeline_shader_alive,
2658     Validate_abnd_pipeline_shader_valid,
2659     Validate_abnd_compute_expected_no_vbufs,
2660     Validate_abnd_compute_expected_no_ibuf,
2661     Validate_abnd_expected_vbuf,
2662     Validate_abnd_vbuf_alive,
2663     Validate_abnd_vbuf_usage,
2664     Validate_abnd_vbuf_overflow,
2665     Validate_abnd_expected_no_ibuf,
2666     Validate_abnd_expected_ibuf,
2667     Validate_abnd_ibuf_alive,
2668     Validate_abnd_ibuf_usage,
2669     Validate_abnd_ibuf_overflow,
2670     Validate_abnd_expected_view_binding,
2671     Validate_abnd_view_alive,
2672     Validate_abnd_expect_texview,
2673     Validate_abnd_expect_sbview,
2674     Validate_abnd_expect_simgview,
2675     Validate_abnd_texview_imagetype_mismatch,
2676     Validate_abnd_texview_expected_multisampled_image,
2677     Validate_abnd_texview_expected_non_multisampled_image,
2678     Validate_abnd_texview_expected_filterable_image,
2679     Validate_abnd_texview_expected_depth_image,
2680     Validate_abnd_sbview_readwrite_immutable,
2681     Validate_abnd_simgview_compute_pass_expected,
2682     Validate_abnd_simgview_imagetype_mismatch,
2683     Validate_abnd_simgview_accessformat,
2684     Validate_abnd_expected_sampler_binding,
2685     Validate_abnd_unexpected_sampler_compare_never,
2686     Validate_abnd_expected_sampler_compare_never,
2687     Validate_abnd_expected_nonfiltering_sampler,
2688     Validate_abnd_sampler_alive,
2689     Validate_abnd_sampler_valid,
2690     Validate_abnd_texture_binding_vs_depthstencil_attachment,
2691     Validate_abnd_texture_binding_vs_color_attachment,
2692     Validate_abnd_texture_binding_vs_resolve_attachment,
2693     Validate_abnd_texture_vs_storageimage_binding,
2694     Validate_au_pass_expected,
2695     Validate_au_no_pipeline,
2696     Validate_au_pipeline_alive,
2697     Validate_au_pipeline_valid,
2698     Validate_au_pipeline_shader_alive,
2699     Validate_au_pipeline_shader_valid,
2700     Validate_au_no_uniformblock_at_slot,
2701     Validate_au_size,
2702     Validate_draw_renderpass_expected,
2703     Validate_draw_baseelement_ge_zero,
2704     Validate_draw_numelements_ge_zero,
2705     Validate_draw_numinstances_ge_zero,
2706     Validate_draw_ex_renderpass_expected,
2707     Validate_draw_ex_baseelement_ge_zero,
2708     Validate_draw_ex_numelements_ge_zero,
2709     Validate_draw_ex_numinstances_ge_zero,
2710     Validate_draw_ex_baseinstance_ge_zero,
2711     Validate_draw_ex_basevertex_vs_indexed,
2712     Validate_draw_ex_baseinstance_vs_instanced,
2713     Validate_draw_ex_basevertex_not_supported,
2714     Validate_draw_ex_baseinstance_not_supported,
2715     Validate_draw_required_bindings_or_uniforms_missing,
2716     Validate_dispatch_computepass_expected,
2717     Validate_dispatch_numgroupsx,
2718     Validate_dispatch_numgroupsy,
2719     Validate_dispatch_numgroupsz,
2720     Validate_dispatch_required_bindings_or_uniforms_missing,
2721     Validate_updatebuf_usage,
2722     Validate_updatebuf_size,
2723     Validate_updatebuf_once,
2724     Validate_updatebuf_append,
2725     Validate_appendbuf_usage,
2726     Validate_appendbuf_size,
2727     Validate_appendbuf_update,
2728     Validate_updimg_usage,
2729     Validate_updimg_once,
2730     Validation_failed,
2731 }
2732 /++
2733 + sg_desc
2734 + 
2735 +     The sg_desc struct contains configuration values for sokol_gfx,
2736 +     it is used as parameter to the sg_setup() call.
2737 + 
2738 +     The default configuration is:
2739 + 
2740 +     .buffer_pool_size                   128
2741 +     .image_pool_size                    128
2742 +     .sampler_pool_size                  64
2743 +     .shader_pool_size                   32
2744 +     .pipeline_pool_size                 64
2745 +     .view_pool_size                     256
2746 +     .uniform_buffer_size                4 MB (4*1024*1024)
2747 +     .max_commit_listeners               1024
2748 +     .disable_validation                 false
2749 +     .metal.force_managed_storage_mode   false
2750 +     .metal.use_command_buffer_with_retained_references  false
2751 +     .wgpu.disable_bindgroups_cache      false
2752 +     .wgpu.bindgroups_cache_size         1024
2753 +     .vulkan.copy_staging_buffer_size    4 MB
2754 +     .vulkan.stream_staging_buffer_size  16 MB
2755 +     .vulkan.descriptor_buffer_size      16 MB
2756 + 
2757 +     .allocator.alloc_fn     0 (in this case, malloc() will be called)
2758 +     .allocator.free_fn      0 (in this case, free() will be called)
2759 +     .allocator.user_data    0
2760 + 
2761 +     .environment.defaults.color_format: default value depends on selected backend:
2762 +         all GL backends:    SG_PIXELFORMAT_RGBA8
2763 +         Metal and D3D11:    SG_PIXELFORMAT_BGRA8
2764 +         WebGPU:             *no default* (must be queried from WebGPU swapchain object)
2765 +     .environment.defaults.depth_format: SG_PIXELFORMAT_DEPTH_STENCIL
2766 +     .environment.defaults.sample_count: 1
2767 + 
2768 +     Metal specific:
2769 +         (NOTE: All Objective-C object references are transferred through
2770 +         a bridged cast (__bridge const void*) to sokol_gfx, which will use an
2771 +         unretained bridged cast (__bridge id<xxx>) to retrieve the Objective-C
2772 +         references back. Since the bridge cast is unretained, the caller
2773 +         must hold a strong reference to the Objective-C object until sg_setup()
2774 +         returns.
2775 + 
2776 +         .metal.force_managed_storage_mode
2777 +             when enabled, Metal buffers and texture resources are created in managed storage
2778 +             mode, otherwise sokol-gfx will decide whether to create buffers and
2779 +             textures in managed or shared storage mode (this is mainly a debugging option)
2780 +         .metal.use_command_buffer_with_retained_references
2781 +             when true, the sokol-gfx Metal backend will use Metal command buffers which
2782 +             bump the reference count of resource objects as long as they are inflight,
2783 +             this is slower than the default command-buffer-with-unretained-references
2784 +             method, this may be a workaround when confronted with lifetime validation
2785 +             errors from the Metal validation layer until a proper fix has been implemented
2786 +         .environment.metal.device
2787 +             a pointer to the MTLDevice object
2788 + 
2789 +     D3D11 specific:
2790 +         .environment.d3d11.device
2791 +             a pointer to the ID3D11Device object, this must have been created
2792 +             before sg_setup() is called
2793 +         .environment.d3d11.device_context
2794 +             a pointer to the ID3D11DeviceContext object
2795 +         .d3d11.shader_debugging
2796 +             set this to true to compile shaders which are provided as HLSL source
2797 +             code with debug information and without optimization, this allows
2798 +             shader debugging in tools like RenderDoc, to output source code
2799 +             instead of byte code from sokol-shdc, omit the `--binary` cmdline
2800 +             option
2801 + 
2802 +     WebGPU specific:
2803 +         .wgpu.disable_bindgroups_cache
2804 +             When this is true, the WebGPU backend will create and immediately
2805 +             release a BindGroup object in the sg_apply_bindings() call, only
2806 +             use this for debugging purposes.
2807 +         .wgpu.bindgroups_cache_size
2808 +             The size of the bindgroups cache for re-using BindGroup objects
2809 +             between sg_apply_bindings() calls. The smaller the cache size,
2810 +             the more likely are cache slot collisions which will cause
2811 +             a BindGroups object to be destroyed and a new one created.
2812 +             Use the information returned by sg_query_stats() to check
2813 +             if this is a frequent occurrence, and increase the cache size as
2814 +             needed (the default is 1024).
2815 +             NOTE: wgpu_bindgroups_cache_size must be a power-of-2 number!
2816 +         .environment.wgpu.device
2817 +             a WGPUDevice handle
2818 + 
2819 +     Vulkan specific:
2820 +         .vulkan.copy_staging_buffer_size
2821 +             Size of the staging buffer in bytes for uploading the initial
2822 +             content of buffers and images, and for updating
2823 +             .usage.dynamic_update resources. The default is 4 MB,
2824 +             bigger resource updates are split into multiple chunks
2825 +             of the staging buffer size
2826 +         .vulkan.stream_staging_buffer_size
2827 +             Size of the staging buffer in bytes for updating .usage.stream_update
2828 +             resources. The default is 16 MB. The size must be big enough
2829 +             to accomodate all update into .usage.stream_update resources.
2830 +             Any additional data will cause an error log message and
2831 +             incomplete rendering. Note that the actually allocated size
2832 +             will be twice as much because the stream-staging-buffer is
2833 +             double-buffered.
2834 +         .vulkan.descriptor_buffer_size
2835 +             Size of the descriptor-upload buffer in bytes. The default
2836 +             size is 16 bytes. The size must be big enough to accomodate
2837 +             all unifrom-block, view- and sampler-bindings in a single
2838 +             frame (assume a worst-case of 256 bytes per binding). Note
2839 +             that the actually allocated size will be twice as much
2840 +             because the descriptor-buffer is double-buffered.
2841 + 
2842 +     When using sokol_gfx.h and sokol_app.h together, consider using the
2843 +     helper function sglue_environment() in the sokol_glue.h header to
2844 +     initialize the sg_desc.environment nested struct. sglue_environment() returns
2845 +     a completely initialized sg_environment struct with information
2846 +     provided by sokol_app.h.
2847 +/
2848 extern(C) struct EnvironmentDefaults {
2849     PixelFormat color_format = PixelFormat.Default;
2850     PixelFormat depth_format = PixelFormat.Default;
2851     int sample_count = 0;
2852 }
2853 extern(C) struct MetalEnvironment {
2854     const(void)* device = null;
2855 }
2856 extern(C) struct D3d11Environment {
2857     const(void)* device = null;
2858     const(void)* device_context = null;
2859 }
2860 extern(C) struct WgpuEnvironment {
2861     const(void)* device = null;
2862 }
2863 extern(C) struct VulkanEnvironment {
2864     const(void)* instance = null;
2865     const(void)* physical_device = null;
2866     const(void)* device = null;
2867     const(void)* queue = null;
2868     uint queue_family_index = 0;
2869 }
2870 extern(C) struct Environment {
2871     EnvironmentDefaults defaults = {};
2872     MetalEnvironment metal = {};
2873     D3d11Environment d3d11 = {};
2874     WgpuEnvironment wgpu = {};
2875     VulkanEnvironment vulkan = {};
2876 }
2877 /++
2878 + sg_commit_listener
2879 + 
2880 +     Used with function sg_add_commit_listener() to add a callback
2881 +     which will be called in sg_commit(). This is useful for libraries
2882 +     building on top of sokol-gfx to be notified about when a frame
2883 +     ends (instead of having to guess, or add a manual 'new-frame'
2884 +     function.
2885 +/
2886 extern(C) struct CommitListener {
2887     extern(C) void function(void*) func = null;
2888     void* user_data = null;
2889 }
2890 /++
2891 + sg_allocator
2892 + 
2893 +     Used in sg_desc to provide custom memory-alloc and -free functions
2894 +     to sokol_gfx.h. If memory management should be overridden, both the
2895 +     alloc_fn and free_fn function must be provided (e.g. it's not valid to
2896 +     override one function but not the other).
2897 +/
2898 extern(C) struct Allocator {
2899     extern(C) void* function(size_t, void*) alloc_fn = null;
2900     extern(C) void function(void*, void*) free_fn = null;
2901     void* user_data = null;
2902 }
2903 /++
2904 + sg_logger
2905 + 
2906 +     Used in sg_desc to provide a logging function. Please be aware
2907 +     that without logging function, sokol-gfx will be completely
2908 +     silent, e.g. it will not report errors, warnings and
2909 +     validation layer messages. For maximum error verbosity,
2910 +     compile in debug mode (e.g. NDEBUG *not* defined) and provide a
2911 +     compatible logger function in the sg_setup() call
2912 +     (for instance the standard logging function from sokol_log.h).
2913 +/
2914 extern(C) struct Logger {
2915     extern(C) void function(const(char)*, uint, uint, const(char)*, uint, const(char)*, void*) func = null;
2916     void* user_data = null;
2917 }
2918 extern(C) struct D3d11Desc {
2919     bool shader_debugging = false;
2920 }
2921 extern(C) struct MetalDesc {
2922     bool force_managed_storage_mode = false;
2923     bool use_command_buffer_with_retained_references = false;
2924 }
2925 extern(C) struct WgpuDesc {
2926     bool disable_bindgroups_cache = false;
2927     int bindgroups_cache_size = 0;
2928 }
2929 extern(C) struct VulkanDesc {
2930     int copy_staging_buffer_size = 0;
2931     int stream_staging_buffer_size = 0;
2932     int descriptor_buffer_size = 0;
2933 }
2934 extern(C) struct Desc {
2935     uint _start_canary = 0;
2936     int buffer_pool_size = 0;
2937     int image_pool_size = 0;
2938     int sampler_pool_size = 0;
2939     int shader_pool_size = 0;
2940     int pipeline_pool_size = 0;
2941     int view_pool_size = 0;
2942     int uniform_buffer_size = 0;
2943     int max_commit_listeners = 0;
2944     bool disable_validation = false;
2945     bool enforce_portable_limits = false;
2946     D3d11Desc d3d11 = {};
2947     MetalDesc metal = {};
2948     WgpuDesc wgpu = {};
2949     VulkanDesc vulkan = {};
2950     Allocator allocator = {};
2951     Logger logger = {};
2952     Environment environment = {};
2953     uint _end_canary = 0;
2954 }
2955 /++
2956 + setup and misc functions
2957 +/
2958 extern(C) void sg_setup(const Desc* desc) @system @nogc nothrow pure;
2959 void setup(scope ref Desc desc) @trusted @nogc nothrow pure {
2960     sg_setup(&desc);
2961 }
2962 extern(C) void sg_shutdown() @system @nogc nothrow pure;
2963 void shutdown() @trusted @nogc nothrow pure {
2964     sg_shutdown();
2965 }
2966 extern(C) bool sg_isvalid() @system @nogc nothrow pure;
2967 bool isvalid() @trusted @nogc nothrow pure {
2968     return sg_isvalid();
2969 }
2970 extern(C) void sg_reset_state_cache() @system @nogc nothrow pure;
2971 void resetStateCache() @trusted @nogc nothrow pure {
2972     sg_reset_state_cache();
2973 }
2974 extern(C) TraceHooks sg_install_trace_hooks(const TraceHooks* trace_hooks) @system @nogc nothrow pure;
2975 TraceHooks installTraceHooks(scope ref TraceHooks trace_hooks) @trusted @nogc nothrow pure {
2976     return sg_install_trace_hooks(&trace_hooks);
2977 }
2978 extern(C) void sg_push_debug_group(const(char)* name) @system @nogc nothrow pure;
2979 void pushDebugGroup(const(char)* name) @trusted @nogc nothrow pure {
2980     sg_push_debug_group(name);
2981 }
2982 extern(C) void sg_pop_debug_group() @system @nogc nothrow pure;
2983 void popDebugGroup() @trusted @nogc nothrow pure {
2984     sg_pop_debug_group();
2985 }
2986 extern(C) bool sg_add_commit_listener(CommitListener listener) @system @nogc nothrow pure;
2987 bool addCommitListener(CommitListener listener) @trusted @nogc nothrow pure {
2988     return sg_add_commit_listener(listener);
2989 }
2990 extern(C) bool sg_remove_commit_listener(CommitListener listener) @system @nogc nothrow pure;
2991 bool removeCommitListener(CommitListener listener) @trusted @nogc nothrow pure {
2992     return sg_remove_commit_listener(listener);
2993 }
2994 /++
2995 + resource creation, destruction and updating
2996 +/
2997 extern(C) Buffer sg_make_buffer(const BufferDesc* desc) @system @nogc nothrow pure;
2998 Buffer makeBuffer(scope ref BufferDesc desc) @trusted @nogc nothrow pure {
2999     return sg_make_buffer(&desc);
3000 }
3001 extern(C) Image sg_make_image(const ImageDesc* desc) @system @nogc nothrow pure;
3002 Image makeImage(scope ref ImageDesc desc) @trusted @nogc nothrow pure {
3003     return sg_make_image(&desc);
3004 }
3005 extern(C) Sampler sg_make_sampler(const SamplerDesc* desc) @system @nogc nothrow pure;
3006 Sampler makeSampler(scope ref SamplerDesc desc) @trusted @nogc nothrow pure {
3007     return sg_make_sampler(&desc);
3008 }
3009 extern(C) Shader sg_make_shader(const ShaderDesc* desc) @system @nogc nothrow pure;
3010 Shader makeShader(scope ref ShaderDesc desc) @trusted @nogc nothrow pure {
3011     return sg_make_shader(&desc);
3012 }
3013 extern(C) Pipeline sg_make_pipeline(const PipelineDesc* desc) @system @nogc nothrow pure;
3014 Pipeline makePipeline(scope ref PipelineDesc desc) @trusted @nogc nothrow pure {
3015     return sg_make_pipeline(&desc);
3016 }
3017 extern(C) View sg_make_view(const ViewDesc* desc) @system @nogc nothrow pure;
3018 View makeView(scope ref ViewDesc desc) @trusted @nogc nothrow pure {
3019     return sg_make_view(&desc);
3020 }
3021 extern(C) void sg_destroy_buffer(Buffer buf) @system @nogc nothrow pure;
3022 void destroyBuffer(Buffer buf) @trusted @nogc nothrow pure {
3023     sg_destroy_buffer(buf);
3024 }
3025 extern(C) void sg_destroy_image(Image img) @system @nogc nothrow pure;
3026 void destroyImage(Image img) @trusted @nogc nothrow pure {
3027     sg_destroy_image(img);
3028 }
3029 extern(C) void sg_destroy_sampler(Sampler smp) @system @nogc nothrow pure;
3030 void destroySampler(Sampler smp) @trusted @nogc nothrow pure {
3031     sg_destroy_sampler(smp);
3032 }
3033 extern(C) void sg_destroy_shader(Shader shd) @system @nogc nothrow pure;
3034 void destroyShader(Shader shd) @trusted @nogc nothrow pure {
3035     sg_destroy_shader(shd);
3036 }
3037 extern(C) void sg_destroy_pipeline(Pipeline pip) @system @nogc nothrow pure;
3038 void destroyPipeline(Pipeline pip) @trusted @nogc nothrow pure {
3039     sg_destroy_pipeline(pip);
3040 }
3041 extern(C) void sg_destroy_view(View view) @system @nogc nothrow pure;
3042 void destroyView(View view) @trusted @nogc nothrow pure {
3043     sg_destroy_view(view);
3044 }
3045 extern(C) void sg_update_buffer(Buffer buf, const Range* data) @system @nogc nothrow pure;
3046 void updateBuffer(Buffer buf, scope ref Range data) @trusted @nogc nothrow pure {
3047     sg_update_buffer(buf, &data);
3048 }
3049 extern(C) void sg_update_image(Image img, const ImageData* data) @system @nogc nothrow pure;
3050 void updateImage(Image img, scope ref ImageData data) @trusted @nogc nothrow pure {
3051     sg_update_image(img, &data);
3052 }
3053 extern(C) int sg_append_buffer(Buffer buf, const Range* data) @system @nogc nothrow pure;
3054 int appendBuffer(Buffer buf, scope ref Range data) @trusted @nogc nothrow pure {
3055     return sg_append_buffer(buf, &data);
3056 }
3057 extern(C) bool sg_query_buffer_overflow(Buffer buf) @system @nogc nothrow pure;
3058 bool queryBufferOverflow(Buffer buf) @trusted @nogc nothrow pure {
3059     return sg_query_buffer_overflow(buf);
3060 }
3061 extern(C) bool sg_query_buffer_will_overflow(Buffer buf, size_t size) @system @nogc nothrow pure;
3062 bool queryBufferWillOverflow(Buffer buf, size_t size) @trusted @nogc nothrow pure {
3063     return sg_query_buffer_will_overflow(buf, size);
3064 }
3065 /++
3066 + render and compute functions
3067 +/
3068 extern(C) void sg_begin_pass(const Pass* pass) @system @nogc nothrow pure;
3069 void beginPass(scope ref Pass pass) @trusted @nogc nothrow pure {
3070     sg_begin_pass(&pass);
3071 }
3072 extern(C) void sg_apply_viewport(int x, int y, int width, int height, bool origin_top_left) @system @nogc nothrow pure;
3073 void applyViewport(int x, int y, int width, int height, bool origin_top_left) @trusted @nogc nothrow pure {
3074     sg_apply_viewport(x, y, width, height, origin_top_left);
3075 }
3076 extern(C) void sg_apply_viewportf(float x, float y, float width, float height, bool origin_top_left) @system @nogc nothrow pure;
3077 void applyViewportf(float x, float y, float width, float height, bool origin_top_left) @trusted @nogc nothrow pure {
3078     sg_apply_viewportf(x, y, width, height, origin_top_left);
3079 }
3080 extern(C) void sg_apply_scissor_rect(int x, int y, int width, int height, bool origin_top_left) @system @nogc nothrow pure;
3081 void applyScissorRect(int x, int y, int width, int height, bool origin_top_left) @trusted @nogc nothrow pure {
3082     sg_apply_scissor_rect(x, y, width, height, origin_top_left);
3083 }
3084 extern(C) void sg_apply_scissor_rectf(float x, float y, float width, float height, bool origin_top_left) @system @nogc nothrow pure;
3085 void applyScissorRectf(float x, float y, float width, float height, bool origin_top_left) @trusted @nogc nothrow pure {
3086     sg_apply_scissor_rectf(x, y, width, height, origin_top_left);
3087 }
3088 extern(C) void sg_apply_pipeline(Pipeline pip) @system @nogc nothrow pure;
3089 void applyPipeline(Pipeline pip) @trusted @nogc nothrow pure {
3090     sg_apply_pipeline(pip);
3091 }
3092 extern(C) void sg_apply_bindings(const Bindings* bindings) @system @nogc nothrow pure;
3093 void applyBindings(scope ref Bindings bindings) @trusted @nogc nothrow pure {
3094     sg_apply_bindings(&bindings);
3095 }
3096 extern(C) void sg_apply_uniforms(uint ub_slot, const Range* data) @system @nogc nothrow pure;
3097 void applyUniforms(uint ub_slot, scope ref Range data) @trusted @nogc nothrow pure {
3098     sg_apply_uniforms(ub_slot, &data);
3099 }
3100 extern(C) void sg_draw(uint base_element, uint num_elements, uint num_instances) @system @nogc nothrow pure;
3101 void draw(uint base_element, uint num_elements, uint num_instances) @trusted @nogc nothrow pure {
3102     sg_draw(base_element, num_elements, num_instances);
3103 }
3104 extern(C) void sg_draw_ex(int base_element, int num_elements, int num_instances, int base_vertex, int base_instance) @system @nogc nothrow pure;
3105 void drawEx(int base_element, int num_elements, int num_instances, int base_vertex, int base_instance) @trusted @nogc nothrow pure {
3106     sg_draw_ex(base_element, num_elements, num_instances, base_vertex, base_instance);
3107 }
3108 extern(C) void sg_dispatch(uint num_groups_x, uint num_groups_y, uint num_groups_z) @system @nogc nothrow pure;
3109 void dispatch(uint num_groups_x, uint num_groups_y, uint num_groups_z) @trusted @nogc nothrow pure {
3110     sg_dispatch(num_groups_x, num_groups_y, num_groups_z);
3111 }
3112 extern(C) void sg_end_pass() @system @nogc nothrow pure;
3113 void endPass() @trusted @nogc nothrow pure {
3114     sg_end_pass();
3115 }
3116 extern(C) void sg_commit() @system @nogc nothrow pure;
3117 void commit() @trusted @nogc nothrow pure {
3118     sg_commit();
3119 }
3120 /++
3121 + getting information
3122 +/
3123 extern(C) Desc sg_query_desc() @system @nogc nothrow pure;
3124 Desc queryDesc() @trusted @nogc nothrow pure {
3125     return sg_query_desc();
3126 }
3127 extern(C) Backend sg_query_backend() @system @nogc nothrow pure;
3128 Backend queryBackend() @trusted @nogc nothrow pure {
3129     return sg_query_backend();
3130 }
3131 extern(C) Features sg_query_features() @system @nogc nothrow pure;
3132 Features queryFeatures() @trusted @nogc nothrow pure {
3133     return sg_query_features();
3134 }
3135 extern(C) Limits sg_query_limits() @system @nogc nothrow pure;
3136 Limits queryLimits() @trusted @nogc nothrow pure {
3137     return sg_query_limits();
3138 }
3139 extern(C) PixelformatInfo sg_query_pixelformat(PixelFormat fmt) @system @nogc nothrow pure;
3140 PixelformatInfo queryPixelformat(PixelFormat fmt) @trusted @nogc nothrow pure {
3141     return sg_query_pixelformat(fmt);
3142 }
3143 extern(C) int sg_query_row_pitch(PixelFormat fmt, int width, int row_align_bytes) @system @nogc nothrow pure;
3144 int queryRowPitch(PixelFormat fmt, int width, int row_align_bytes) @trusted @nogc nothrow pure {
3145     return sg_query_row_pitch(fmt, width, row_align_bytes);
3146 }
3147 extern(C) int sg_query_surface_pitch(PixelFormat fmt, int width, int height, int row_align_bytes) @system @nogc nothrow pure;
3148 int querySurfacePitch(PixelFormat fmt, int width, int height, int row_align_bytes) @trusted @nogc nothrow pure {
3149     return sg_query_surface_pitch(fmt, width, height, row_align_bytes);
3150 }
3151 /++
3152 + get current state of a resource (INITIAL, ALLOC, VALID, FAILED, INVALID)
3153 +/
3154 extern(C) ResourceState sg_query_buffer_state(Buffer buf) @system @nogc nothrow pure;
3155 ResourceState queryBufferState(Buffer buf) @trusted @nogc nothrow pure {
3156     return sg_query_buffer_state(buf);
3157 }
3158 extern(C) ResourceState sg_query_image_state(Image img) @system @nogc nothrow pure;
3159 ResourceState queryImageState(Image img) @trusted @nogc nothrow pure {
3160     return sg_query_image_state(img);
3161 }
3162 extern(C) ResourceState sg_query_sampler_state(Sampler smp) @system @nogc nothrow pure;
3163 ResourceState querySamplerState(Sampler smp) @trusted @nogc nothrow pure {
3164     return sg_query_sampler_state(smp);
3165 }
3166 extern(C) ResourceState sg_query_shader_state(Shader shd) @system @nogc nothrow pure;
3167 ResourceState queryShaderState(Shader shd) @trusted @nogc nothrow pure {
3168     return sg_query_shader_state(shd);
3169 }
3170 extern(C) ResourceState sg_query_pipeline_state(Pipeline pip) @system @nogc nothrow pure;
3171 ResourceState queryPipelineState(Pipeline pip) @trusted @nogc nothrow pure {
3172     return sg_query_pipeline_state(pip);
3173 }
3174 extern(C) ResourceState sg_query_view_state(View view) @system @nogc nothrow pure;
3175 ResourceState queryViewState(View view) @trusted @nogc nothrow pure {
3176     return sg_query_view_state(view);
3177 }
3178 /++
3179 + get runtime information about a resource
3180 +/
3181 extern(C) BufferInfo sg_query_buffer_info(Buffer buf) @system @nogc nothrow pure;
3182 BufferInfo queryBufferInfo(Buffer buf) @trusted @nogc nothrow pure {
3183     return sg_query_buffer_info(buf);
3184 }
3185 extern(C) ImageInfo sg_query_image_info(Image img) @system @nogc nothrow pure;
3186 ImageInfo queryImageInfo(Image img) @trusted @nogc nothrow pure {
3187     return sg_query_image_info(img);
3188 }
3189 extern(C) SamplerInfo sg_query_sampler_info(Sampler smp) @system @nogc nothrow pure;
3190 SamplerInfo querySamplerInfo(Sampler smp) @trusted @nogc nothrow pure {
3191     return sg_query_sampler_info(smp);
3192 }
3193 extern(C) ShaderInfo sg_query_shader_info(Shader shd) @system @nogc nothrow pure;
3194 ShaderInfo queryShaderInfo(Shader shd) @trusted @nogc nothrow pure {
3195     return sg_query_shader_info(shd);
3196 }
3197 extern(C) PipelineInfo sg_query_pipeline_info(Pipeline pip) @system @nogc nothrow pure;
3198 PipelineInfo queryPipelineInfo(Pipeline pip) @trusted @nogc nothrow pure {
3199     return sg_query_pipeline_info(pip);
3200 }
3201 extern(C) ViewInfo sg_query_view_info(View view) @system @nogc nothrow pure;
3202 ViewInfo queryViewInfo(View view) @trusted @nogc nothrow pure {
3203     return sg_query_view_info(view);
3204 }
3205 /++
3206 + get desc structs matching a specific resource (NOTE that not all creation attributes may be provided)
3207 +/
3208 extern(C) BufferDesc sg_query_buffer_desc(Buffer buf) @system @nogc nothrow pure;
3209 BufferDesc queryBufferDesc(Buffer buf) @trusted @nogc nothrow pure {
3210     return sg_query_buffer_desc(buf);
3211 }
3212 extern(C) ImageDesc sg_query_image_desc(Image img) @system @nogc nothrow pure;
3213 ImageDesc queryImageDesc(Image img) @trusted @nogc nothrow pure {
3214     return sg_query_image_desc(img);
3215 }
3216 extern(C) SamplerDesc sg_query_sampler_desc(Sampler smp) @system @nogc nothrow pure;
3217 SamplerDesc querySamplerDesc(Sampler smp) @trusted @nogc nothrow pure {
3218     return sg_query_sampler_desc(smp);
3219 }
3220 extern(C) ShaderDesc sg_query_shader_desc(Shader shd) @system @nogc nothrow pure;
3221 ShaderDesc queryShaderDesc(Shader shd) @trusted @nogc nothrow pure {
3222     return sg_query_shader_desc(shd);
3223 }
3224 extern(C) PipelineDesc sg_query_pipeline_desc(Pipeline pip) @system @nogc nothrow pure;
3225 PipelineDesc queryPipelineDesc(Pipeline pip) @trusted @nogc nothrow pure {
3226     return sg_query_pipeline_desc(pip);
3227 }
3228 extern(C) ViewDesc sg_query_view_desc(View view) @system @nogc nothrow pure;
3229 ViewDesc queryViewDesc(View view) @trusted @nogc nothrow pure {
3230     return sg_query_view_desc(view);
3231 }
3232 /++
3233 + get resource creation desc struct with their default values replaced
3234 +/
3235 extern(C) BufferDesc sg_query_buffer_defaults(const BufferDesc* desc) @system @nogc nothrow pure;
3236 BufferDesc queryBufferDefaults(scope ref BufferDesc desc) @trusted @nogc nothrow pure {
3237     return sg_query_buffer_defaults(&desc);
3238 }
3239 extern(C) ImageDesc sg_query_image_defaults(const ImageDesc* desc) @system @nogc nothrow pure;
3240 ImageDesc queryImageDefaults(scope ref ImageDesc desc) @trusted @nogc nothrow pure {
3241     return sg_query_image_defaults(&desc);
3242 }
3243 extern(C) SamplerDesc sg_query_sampler_defaults(const SamplerDesc* desc) @system @nogc nothrow pure;
3244 SamplerDesc querySamplerDefaults(scope ref SamplerDesc desc) @trusted @nogc nothrow pure {
3245     return sg_query_sampler_defaults(&desc);
3246 }
3247 extern(C) ShaderDesc sg_query_shader_defaults(const ShaderDesc* desc) @system @nogc nothrow pure;
3248 ShaderDesc queryShaderDefaults(scope ref ShaderDesc desc) @trusted @nogc nothrow pure {
3249     return sg_query_shader_defaults(&desc);
3250 }
3251 extern(C) PipelineDesc sg_query_pipeline_defaults(const PipelineDesc* desc) @system @nogc nothrow pure;
3252 PipelineDesc queryPipelineDefaults(scope ref PipelineDesc desc) @trusted @nogc nothrow pure {
3253     return sg_query_pipeline_defaults(&desc);
3254 }
3255 extern(C) ViewDesc sg_query_view_defaults(const ViewDesc* desc) @system @nogc nothrow pure;
3256 ViewDesc queryViewDefaults(scope ref ViewDesc desc) @trusted @nogc nothrow pure {
3257     return sg_query_view_defaults(&desc);
3258 }
3259 /++
3260 + assorted query functions
3261 +/
3262 extern(C) size_t sg_query_buffer_size(Buffer buf) @system @nogc nothrow pure;
3263 size_t queryBufferSize(Buffer buf) @trusted @nogc nothrow pure {
3264     return sg_query_buffer_size(buf);
3265 }
3266 extern(C) BufferUsage sg_query_buffer_usage(Buffer buf) @system @nogc nothrow pure;
3267 BufferUsage queryBufferUsage(Buffer buf) @trusted @nogc nothrow pure {
3268     return sg_query_buffer_usage(buf);
3269 }
3270 extern(C) ImageType sg_query_image_type(Image img) @system @nogc nothrow pure;
3271 ImageType queryImageType(Image img) @trusted @nogc nothrow pure {
3272     return sg_query_image_type(img);
3273 }
3274 extern(C) int sg_query_image_width(Image img) @system @nogc nothrow pure;
3275 int queryImageWidth(Image img) @trusted @nogc nothrow pure {
3276     return sg_query_image_width(img);
3277 }
3278 extern(C) int sg_query_image_height(Image img) @system @nogc nothrow pure;
3279 int queryImageHeight(Image img) @trusted @nogc nothrow pure {
3280     return sg_query_image_height(img);
3281 }
3282 extern(C) int sg_query_image_num_slices(Image img) @system @nogc nothrow pure;
3283 int queryImageNumSlices(Image img) @trusted @nogc nothrow pure {
3284     return sg_query_image_num_slices(img);
3285 }
3286 extern(C) int sg_query_image_num_mipmaps(Image img) @system @nogc nothrow pure;
3287 int queryImageNumMipmaps(Image img) @trusted @nogc nothrow pure {
3288     return sg_query_image_num_mipmaps(img);
3289 }
3290 extern(C) PixelFormat sg_query_image_pixelformat(Image img) @system @nogc nothrow pure;
3291 PixelFormat queryImagePixelformat(Image img) @trusted @nogc nothrow pure {
3292     return sg_query_image_pixelformat(img);
3293 }
3294 extern(C) ImageUsage sg_query_image_usage(Image img) @system @nogc nothrow pure;
3295 ImageUsage queryImageUsage(Image img) @trusted @nogc nothrow pure {
3296     return sg_query_image_usage(img);
3297 }
3298 extern(C) int sg_query_image_sample_count(Image img) @system @nogc nothrow pure;
3299 int queryImageSampleCount(Image img) @trusted @nogc nothrow pure {
3300     return sg_query_image_sample_count(img);
3301 }
3302 extern(C) ViewType sg_query_view_type(View view) @system @nogc nothrow pure;
3303 ViewType queryViewType(View view) @trusted @nogc nothrow pure {
3304     return sg_query_view_type(view);
3305 }
3306 extern(C) Image sg_query_view_image(View view) @system @nogc nothrow pure;
3307 Image queryViewImage(View view) @trusted @nogc nothrow pure {
3308     return sg_query_view_image(view);
3309 }
3310 extern(C) Buffer sg_query_view_buffer(View view) @system @nogc nothrow pure;
3311 Buffer queryViewBuffer(View view) @trusted @nogc nothrow pure {
3312     return sg_query_view_buffer(view);
3313 }
3314 /++
3315 + separate resource allocation and initialization (for async setup)
3316 +/
3317 extern(C) Buffer sg_alloc_buffer() @system @nogc nothrow pure;
3318 Buffer allocBuffer() @trusted @nogc nothrow pure {
3319     return sg_alloc_buffer();
3320 }
3321 extern(C) Image sg_alloc_image() @system @nogc nothrow pure;
3322 Image allocImage() @trusted @nogc nothrow pure {
3323     return sg_alloc_image();
3324 }
3325 extern(C) Sampler sg_alloc_sampler() @system @nogc nothrow pure;
3326 Sampler allocSampler() @trusted @nogc nothrow pure {
3327     return sg_alloc_sampler();
3328 }
3329 extern(C) Shader sg_alloc_shader() @system @nogc nothrow pure;
3330 Shader allocShader() @trusted @nogc nothrow pure {
3331     return sg_alloc_shader();
3332 }
3333 extern(C) Pipeline sg_alloc_pipeline() @system @nogc nothrow pure;
3334 Pipeline allocPipeline() @trusted @nogc nothrow pure {
3335     return sg_alloc_pipeline();
3336 }
3337 extern(C) View sg_alloc_view() @system @nogc nothrow pure;
3338 View allocView() @trusted @nogc nothrow pure {
3339     return sg_alloc_view();
3340 }
3341 extern(C) void sg_dealloc_buffer(Buffer buf) @system @nogc nothrow pure;
3342 void deallocBuffer(Buffer buf) @trusted @nogc nothrow pure {
3343     sg_dealloc_buffer(buf);
3344 }
3345 extern(C) void sg_dealloc_image(Image img) @system @nogc nothrow pure;
3346 void deallocImage(Image img) @trusted @nogc nothrow pure {
3347     sg_dealloc_image(img);
3348 }
3349 extern(C) void sg_dealloc_sampler(Sampler smp) @system @nogc nothrow pure;
3350 void deallocSampler(Sampler smp) @trusted @nogc nothrow pure {
3351     sg_dealloc_sampler(smp);
3352 }
3353 extern(C) void sg_dealloc_shader(Shader shd) @system @nogc nothrow pure;
3354 void deallocShader(Shader shd) @trusted @nogc nothrow pure {
3355     sg_dealloc_shader(shd);
3356 }
3357 extern(C) void sg_dealloc_pipeline(Pipeline pip) @system @nogc nothrow pure;
3358 void deallocPipeline(Pipeline pip) @trusted @nogc nothrow pure {
3359     sg_dealloc_pipeline(pip);
3360 }
3361 extern(C) void sg_dealloc_view(View view) @system @nogc nothrow pure;
3362 void deallocView(View view) @trusted @nogc nothrow pure {
3363     sg_dealloc_view(view);
3364 }
3365 extern(C) void sg_init_buffer(Buffer buf, const BufferDesc* desc) @system @nogc nothrow pure;
3366 void initBuffer(Buffer buf, scope ref BufferDesc desc) @trusted @nogc nothrow pure {
3367     sg_init_buffer(buf, &desc);
3368 }
3369 extern(C) void sg_init_image(Image img, const ImageDesc* desc) @system @nogc nothrow pure;
3370 void initImage(Image img, scope ref ImageDesc desc) @trusted @nogc nothrow pure {
3371     sg_init_image(img, &desc);
3372 }
3373 extern(C) void sg_init_sampler(Sampler smg, const SamplerDesc* desc) @system @nogc nothrow pure;
3374 void initSampler(Sampler smg, scope ref SamplerDesc desc) @trusted @nogc nothrow pure {
3375     sg_init_sampler(smg, &desc);
3376 }
3377 extern(C) void sg_init_shader(Shader shd, const ShaderDesc* desc) @system @nogc nothrow pure;
3378 void initShader(Shader shd, scope ref ShaderDesc desc) @trusted @nogc nothrow pure {
3379     sg_init_shader(shd, &desc);
3380 }
3381 extern(C) void sg_init_pipeline(Pipeline pip, const PipelineDesc* desc) @system @nogc nothrow pure;
3382 void initPipeline(Pipeline pip, scope ref PipelineDesc desc) @trusted @nogc nothrow pure {
3383     sg_init_pipeline(pip, &desc);
3384 }
3385 extern(C) void sg_init_view(View view, const ViewDesc* desc) @system @nogc nothrow pure;
3386 void initView(View view, scope ref ViewDesc desc) @trusted @nogc nothrow pure {
3387     sg_init_view(view, &desc);
3388 }
3389 extern(C) void sg_uninit_buffer(Buffer buf) @system @nogc nothrow pure;
3390 void uninitBuffer(Buffer buf) @trusted @nogc nothrow pure {
3391     sg_uninit_buffer(buf);
3392 }
3393 extern(C) void sg_uninit_image(Image img) @system @nogc nothrow pure;
3394 void uninitImage(Image img) @trusted @nogc nothrow pure {
3395     sg_uninit_image(img);
3396 }
3397 extern(C) void sg_uninit_sampler(Sampler smp) @system @nogc nothrow pure;
3398 void uninitSampler(Sampler smp) @trusted @nogc nothrow pure {
3399     sg_uninit_sampler(smp);
3400 }
3401 extern(C) void sg_uninit_shader(Shader shd) @system @nogc nothrow pure;
3402 void uninitShader(Shader shd) @trusted @nogc nothrow pure {
3403     sg_uninit_shader(shd);
3404 }
3405 extern(C) void sg_uninit_pipeline(Pipeline pip) @system @nogc nothrow pure;
3406 void uninitPipeline(Pipeline pip) @trusted @nogc nothrow pure {
3407     sg_uninit_pipeline(pip);
3408 }
3409 extern(C) void sg_uninit_view(View view) @system @nogc nothrow pure;
3410 void uninitView(View view) @trusted @nogc nothrow pure {
3411     sg_uninit_view(view);
3412 }
3413 extern(C) void sg_fail_buffer(Buffer buf) @system @nogc nothrow pure;
3414 void failBuffer(Buffer buf) @trusted @nogc nothrow pure {
3415     sg_fail_buffer(buf);
3416 }
3417 extern(C) void sg_fail_image(Image img) @system @nogc nothrow pure;
3418 void failImage(Image img) @trusted @nogc nothrow pure {
3419     sg_fail_image(img);
3420 }
3421 extern(C) void sg_fail_sampler(Sampler smp) @system @nogc nothrow pure;
3422 void failSampler(Sampler smp) @trusted @nogc nothrow pure {
3423     sg_fail_sampler(smp);
3424 }
3425 extern(C) void sg_fail_shader(Shader shd) @system @nogc nothrow pure;
3426 void failShader(Shader shd) @trusted @nogc nothrow pure {
3427     sg_fail_shader(shd);
3428 }
3429 extern(C) void sg_fail_pipeline(Pipeline pip) @system @nogc nothrow pure;
3430 void failPipeline(Pipeline pip) @trusted @nogc nothrow pure {
3431     sg_fail_pipeline(pip);
3432 }
3433 extern(C) void sg_fail_view(View view) @system @nogc nothrow pure;
3434 void failView(View view) @trusted @nogc nothrow pure {
3435     sg_fail_view(view);
3436 }
3437 /++
3438 + frame and total stats
3439 +/
3440 extern(C) void sg_enable_stats() @system @nogc nothrow pure;
3441 void enableStats() @trusted @nogc nothrow pure {
3442     sg_enable_stats();
3443 }
3444 extern(C) void sg_disable_stats() @system @nogc nothrow pure;
3445 void disableStats() @trusted @nogc nothrow pure {
3446     sg_disable_stats();
3447 }
3448 extern(C) bool sg_stats_enabled() @system @nogc nothrow pure;
3449 bool statsEnabled() @trusted @nogc nothrow pure {
3450     return sg_stats_enabled();
3451 }
3452 extern(C) Stats sg_query_stats() @system @nogc nothrow pure;
3453 Stats queryStats() @trusted @nogc nothrow pure {
3454     return sg_query_stats();
3455 }
3456 /++
3457 + Backend-specific structs and functions, these may come in handy for mixing
3458 +    sokol-gfx rendering with 'native backend' rendering functions.
3459 + 
3460 +    This group of functions will be expanded as needed.
3461 +/
3462 extern(C) struct D3d11BufferInfo {
3463     const(void)* buf = null;
3464 }
3465 extern(C) struct D3d11ImageInfo {
3466     const(void)* tex2d = null;
3467     const(void)* tex3d = null;
3468     const(void)* res = null;
3469 }
3470 extern(C) struct D3d11SamplerInfo {
3471     const(void)* smp = null;
3472 }
3473 extern(C) struct D3d11ShaderInfo {
3474     const(void)*[8] cbufs = null;
3475     const(void)* vs = null;
3476     const(void)* fs = null;
3477 }
3478 extern(C) struct D3d11PipelineInfo {
3479     const(void)* il = null;
3480     const(void)* rs = null;
3481     const(void)* dss = null;
3482     const(void)* bs = null;
3483 }
3484 extern(C) struct D3d11ViewInfo {
3485     const(void)* srv = null;
3486     const(void)* uav = null;
3487     const(void)* rtv = null;
3488     const(void)* dsv = null;
3489 }
3490 extern(C) struct MtlBufferInfo {
3491     const(void)*[2] buf = null;
3492     int active_slot = 0;
3493 }
3494 extern(C) struct MtlImageInfo {
3495     const(void)*[2] tex = null;
3496     int active_slot = 0;
3497 }
3498 extern(C) struct MtlSamplerInfo {
3499     const(void)* smp = null;
3500 }
3501 extern(C) struct MtlShaderInfo {
3502     const(void)* vertex_lib = null;
3503     const(void)* fragment_lib = null;
3504     const(void)* vertex_func = null;
3505     const(void)* fragment_func = null;
3506 }
3507 extern(C) struct MtlPipelineInfo {
3508     const(void)* rps = null;
3509     const(void)* dss = null;
3510 }
3511 extern(C) struct WgpuBufferInfo {
3512     const(void)* buf = null;
3513 }
3514 extern(C) struct WgpuImageInfo {
3515     const(void)* tex = null;
3516 }
3517 extern(C) struct WgpuSamplerInfo {
3518     const(void)* smp = null;
3519 }
3520 extern(C) struct WgpuShaderInfo {
3521     const(void)* vs_mod = null;
3522     const(void)* fs_mod = null;
3523     const(void)* bgl = null;
3524 }
3525 extern(C) struct WgpuPipelineInfo {
3526     const(void)* render_pipeline = null;
3527     const(void)* compute_pipeline = null;
3528 }
3529 extern(C) struct WgpuViewInfo {
3530     const(void)* view = null;
3531 }
3532 extern(C) struct GlBufferInfo {
3533     uint[2] buf = [0, 0];
3534     int active_slot = 0;
3535 }
3536 extern(C) struct GlImageInfo {
3537     uint[2] tex = [0, 0];
3538     uint tex_target = 0;
3539     int active_slot = 0;
3540 }
3541 extern(C) struct GlSamplerInfo {
3542     uint smp = 0;
3543 }
3544 extern(C) struct GlShaderInfo {
3545     uint prog = 0;
3546 }
3547 extern(C) struct GlViewInfo {
3548     uint[2] tex_view = [0, 0];
3549     uint msaa_render_buffer = 0;
3550     uint msaa_resolve_frame_buffer = 0;
3551 }
3552 /++
3553 + D3D11: return ID3D11Device
3554 +/
3555 extern(C) const(void)* sg_d3d11_device() @system @nogc nothrow pure;
3556 const(void)* d3d11Device() @trusted @nogc nothrow pure {
3557     return sg_d3d11_device();
3558 }
3559 /++
3560 + D3D11: return ID3D11DeviceContext
3561 +/
3562 extern(C) const(void)* sg_d3d11_device_context() @system @nogc nothrow pure;
3563 const(void)* d3d11DeviceContext() @trusted @nogc nothrow pure {
3564     return sg_d3d11_device_context();
3565 }
3566 /++
3567 + D3D11: get internal buffer resource objects
3568 +/
3569 extern(C) D3d11BufferInfo sg_d3d11_query_buffer_info(Buffer buf) @system @nogc nothrow pure;
3570 D3d11BufferInfo d3d11QueryBufferInfo(Buffer buf) @trusted @nogc nothrow pure {
3571     return sg_d3d11_query_buffer_info(buf);
3572 }
3573 /++
3574 + D3D11: get internal image resource objects
3575 +/
3576 extern(C) D3d11ImageInfo sg_d3d11_query_image_info(Image img) @system @nogc nothrow pure;
3577 D3d11ImageInfo d3d11QueryImageInfo(Image img) @trusted @nogc nothrow pure {
3578     return sg_d3d11_query_image_info(img);
3579 }
3580 /++
3581 + D3D11: get internal sampler resource objects
3582 +/
3583 extern(C) D3d11SamplerInfo sg_d3d11_query_sampler_info(Sampler smp) @system @nogc nothrow pure;
3584 D3d11SamplerInfo d3d11QuerySamplerInfo(Sampler smp) @trusted @nogc nothrow pure {
3585     return sg_d3d11_query_sampler_info(smp);
3586 }
3587 /++
3588 + D3D11: get internal shader resource objects
3589 +/
3590 extern(C) D3d11ShaderInfo sg_d3d11_query_shader_info(Shader shd) @system @nogc nothrow pure;
3591 D3d11ShaderInfo d3d11QueryShaderInfo(Shader shd) @trusted @nogc nothrow pure {
3592     return sg_d3d11_query_shader_info(shd);
3593 }
3594 /++
3595 + D3D11: get internal pipeline resource objects
3596 +/
3597 extern(C) D3d11PipelineInfo sg_d3d11_query_pipeline_info(Pipeline pip) @system @nogc nothrow pure;
3598 D3d11PipelineInfo d3d11QueryPipelineInfo(Pipeline pip) @trusted @nogc nothrow pure {
3599     return sg_d3d11_query_pipeline_info(pip);
3600 }
3601 /++
3602 + D3D11: get internal view resource objects
3603 +/
3604 extern(C) D3d11ViewInfo sg_d3d11_query_view_info(View view) @system @nogc nothrow pure;
3605 D3d11ViewInfo d3d11QueryViewInfo(View view) @trusted @nogc nothrow pure {
3606     return sg_d3d11_query_view_info(view);
3607 }
3608 /++
3609 + Metal: return __bridge-casted MTLDevice
3610 +/
3611 extern(C) const(void)* sg_mtl_device() @system @nogc nothrow pure;
3612 const(void)* mtlDevice() @trusted @nogc nothrow pure {
3613     return sg_mtl_device();
3614 }
3615 /++
3616 + Metal: return __bridge-casted MTLRenderCommandEncoder when inside render pass (otherwise zero)
3617 +/
3618 extern(C) const(void)* sg_mtl_render_command_encoder() @system @nogc nothrow pure;
3619 const(void)* mtlRenderCommandEncoder() @trusted @nogc nothrow pure {
3620     return sg_mtl_render_command_encoder();
3621 }
3622 /++
3623 + Metal: return __bridge-casted MTLComputeCommandEncoder when inside compute pass (otherwise zero)
3624 +/
3625 extern(C) const(void)* sg_mtl_compute_command_encoder() @system @nogc nothrow pure;
3626 const(void)* mtlComputeCommandEncoder() @trusted @nogc nothrow pure {
3627     return sg_mtl_compute_command_encoder();
3628 }
3629 /++
3630 + Metal: return __bridge-casted MTLCommandQueue
3631 +/
3632 extern(C) const(void)* sg_mtl_command_queue() @system @nogc nothrow pure;
3633 const(void)* mtlCommandQueue() @trusted @nogc nothrow pure {
3634     return sg_mtl_command_queue();
3635 }
3636 /++
3637 + Metal: get internal __bridge-casted buffer resource objects
3638 +/
3639 extern(C) MtlBufferInfo sg_mtl_query_buffer_info(Buffer buf) @system @nogc nothrow pure;
3640 MtlBufferInfo mtlQueryBufferInfo(Buffer buf) @trusted @nogc nothrow pure {
3641     return sg_mtl_query_buffer_info(buf);
3642 }
3643 /++
3644 + Metal: get internal __bridge-casted image resource objects
3645 +/
3646 extern(C) MtlImageInfo sg_mtl_query_image_info(Image img) @system @nogc nothrow pure;
3647 MtlImageInfo mtlQueryImageInfo(Image img) @trusted @nogc nothrow pure {
3648     return sg_mtl_query_image_info(img);
3649 }
3650 /++
3651 + Metal: get internal __bridge-casted sampler resource objects
3652 +/
3653 extern(C) MtlSamplerInfo sg_mtl_query_sampler_info(Sampler smp) @system @nogc nothrow pure;
3654 MtlSamplerInfo mtlQuerySamplerInfo(Sampler smp) @trusted @nogc nothrow pure {
3655     return sg_mtl_query_sampler_info(smp);
3656 }
3657 /++
3658 + Metal: get internal __bridge-casted shader resource objects
3659 +/
3660 extern(C) MtlShaderInfo sg_mtl_query_shader_info(Shader shd) @system @nogc nothrow pure;
3661 MtlShaderInfo mtlQueryShaderInfo(Shader shd) @trusted @nogc nothrow pure {
3662     return sg_mtl_query_shader_info(shd);
3663 }
3664 /++
3665 + Metal: get internal __bridge-casted pipeline resource objects
3666 +/
3667 extern(C) MtlPipelineInfo sg_mtl_query_pipeline_info(Pipeline pip) @system @nogc nothrow pure;
3668 MtlPipelineInfo mtlQueryPipelineInfo(Pipeline pip) @trusted @nogc nothrow pure {
3669     return sg_mtl_query_pipeline_info(pip);
3670 }
3671 /++
3672 + WebGPU: return WGPUDevice object
3673 +/
3674 extern(C) const(void)* sg_wgpu_device() @system @nogc nothrow pure;
3675 const(void)* wgpuDevice() @trusted @nogc nothrow pure {
3676     return sg_wgpu_device();
3677 }
3678 /++
3679 + WebGPU: return WGPUQueue object
3680 +/
3681 extern(C) const(void)* sg_wgpu_queue() @system @nogc nothrow pure;
3682 const(void)* wgpuQueue() @trusted @nogc nothrow pure {
3683     return sg_wgpu_queue();
3684 }
3685 /++
3686 + WebGPU: return this frame's WGPUCommandEncoder
3687 +/
3688 extern(C) const(void)* sg_wgpu_command_encoder() @system @nogc nothrow pure;
3689 const(void)* wgpuCommandEncoder() @trusted @nogc nothrow pure {
3690     return sg_wgpu_command_encoder();
3691 }
3692 /++
3693 + WebGPU: return WGPURenderPassEncoder of current pass (returns 0 when outside pass or in a compute pass)
3694 +/
3695 extern(C) const(void)* sg_wgpu_render_pass_encoder() @system @nogc nothrow pure;
3696 const(void)* wgpuRenderPassEncoder() @trusted @nogc nothrow pure {
3697     return sg_wgpu_render_pass_encoder();
3698 }
3699 /++
3700 + WebGPU: return WGPUComputePassEncoder of current pass (returns 0 when outside pass or in a render pass)
3701 +/
3702 extern(C) const(void)* sg_wgpu_compute_pass_encoder() @system @nogc nothrow pure;
3703 const(void)* wgpuComputePassEncoder() @trusted @nogc nothrow pure {
3704     return sg_wgpu_compute_pass_encoder();
3705 }
3706 /++
3707 + WebGPU: get internal buffer resource objects
3708 +/
3709 extern(C) WgpuBufferInfo sg_wgpu_query_buffer_info(Buffer buf) @system @nogc nothrow pure;
3710 WgpuBufferInfo wgpuQueryBufferInfo(Buffer buf) @trusted @nogc nothrow pure {
3711     return sg_wgpu_query_buffer_info(buf);
3712 }
3713 /++
3714 + WebGPU: get internal image resource objects
3715 +/
3716 extern(C) WgpuImageInfo sg_wgpu_query_image_info(Image img) @system @nogc nothrow pure;
3717 WgpuImageInfo wgpuQueryImageInfo(Image img) @trusted @nogc nothrow pure {
3718     return sg_wgpu_query_image_info(img);
3719 }
3720 /++
3721 + WebGPU: get internal sampler resource objects
3722 +/
3723 extern(C) WgpuSamplerInfo sg_wgpu_query_sampler_info(Sampler smp) @system @nogc nothrow pure;
3724 WgpuSamplerInfo wgpuQuerySamplerInfo(Sampler smp) @trusted @nogc nothrow pure {
3725     return sg_wgpu_query_sampler_info(smp);
3726 }
3727 /++
3728 + WebGPU: get internal shader resource objects
3729 +/
3730 extern(C) WgpuShaderInfo sg_wgpu_query_shader_info(Shader shd) @system @nogc nothrow pure;
3731 WgpuShaderInfo wgpuQueryShaderInfo(Shader shd) @trusted @nogc nothrow pure {
3732     return sg_wgpu_query_shader_info(shd);
3733 }
3734 /++
3735 + WebGPU: get internal pipeline resource objects
3736 +/
3737 extern(C) WgpuPipelineInfo sg_wgpu_query_pipeline_info(Pipeline pip) @system @nogc nothrow pure;
3738 WgpuPipelineInfo wgpuQueryPipelineInfo(Pipeline pip) @trusted @nogc nothrow pure {
3739     return sg_wgpu_query_pipeline_info(pip);
3740 }
3741 /++
3742 + WebGPU: get internal view resource objects
3743 +/
3744 extern(C) WgpuViewInfo sg_wgpu_query_view_info(View view) @system @nogc nothrow pure;
3745 WgpuViewInfo wgpuQueryViewInfo(View view) @trusted @nogc nothrow pure {
3746     return sg_wgpu_query_view_info(view);
3747 }
3748 /++
3749 + GL: get internal buffer resource objects
3750 +/
3751 extern(C) GlBufferInfo sg_gl_query_buffer_info(Buffer buf) @system @nogc nothrow pure;
3752 GlBufferInfo glQueryBufferInfo(Buffer buf) @trusted @nogc nothrow pure {
3753     return sg_gl_query_buffer_info(buf);
3754 }
3755 /++
3756 + GL: get internal image resource objects
3757 +/
3758 extern(C) GlImageInfo sg_gl_query_image_info(Image img) @system @nogc nothrow pure;
3759 GlImageInfo glQueryImageInfo(Image img) @trusted @nogc nothrow pure {
3760     return sg_gl_query_image_info(img);
3761 }
3762 /++
3763 + GL: get internal sampler resource objects
3764 +/
3765 extern(C) GlSamplerInfo sg_gl_query_sampler_info(Sampler smp) @system @nogc nothrow pure;
3766 GlSamplerInfo glQuerySamplerInfo(Sampler smp) @trusted @nogc nothrow pure {
3767     return sg_gl_query_sampler_info(smp);
3768 }
3769 /++
3770 + GL: get internal shader resource objects
3771 +/
3772 extern(C) GlShaderInfo sg_gl_query_shader_info(Shader shd) @system @nogc nothrow pure;
3773 GlShaderInfo glQueryShaderInfo(Shader shd) @trusted @nogc nothrow pure {
3774     return sg_gl_query_shader_info(shd);
3775 }
3776 /++
3777 + GL: get internal view resource objects
3778 +/
3779 extern(C) GlViewInfo sg_gl_query_view_info(View view) @system @nogc nothrow pure;
3780 GlViewInfo glQueryViewInfo(View view) @trusted @nogc nothrow pure {
3781     return sg_gl_query_view_info(view);
3782 }