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