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