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