1 /*
2     DSDL
3     Copyright (C) 2025 Inochi2D Project <luna@foxgirls.gay>
4 
5     This software is provided 'as-is', without any express or implied
6     warranty.  In no event will the authors be held liable for any damages
7     arising from the use of this software.
8 
9     Permission is granted to anyone to use this software for any purpose,
10     including commercial applications, and to alter it and redistribute it
11     freely, subject to the following restrictions:
12 
13     1. The origin of this software must not be misrepresented; you must not
14         claim that you wrote the original software. If you use this software
15         in a product, an acknowledgment in the product documentation would be
16         appreciated but is not required.
17     2. Altered source versions must be plainly marked as such, and must not be
18         misrepresented as being the original software.
19     3. This notice may not be removed or altered from any source distribution.
20 
21     ==========================================================================
22 
23     Simple DirectMedia Layer
24     Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
25 
26     This software is provided 'as-is', without any express or implied
27     warranty.  In no event will the authors be held liable for any damages
28     arising from the use of this software.
29 
30     Permission is granted to anyone to use this software for any purpose,
31     including commercial applications, and to alter it and redistribute it
32     freely, subject to the following restrictions:
33 
34     1. The origin of this software must not be misrepresented; you must not
35         claim that you wrote the original software. If you use this software
36         in a product, an acknowledgment in the product documentation would be
37         appreciated but is not required.
38     2. Altered source versions must be plainly marked as such, and must not be
39         misrepresented as being the original software.
40     3. This notice may not be removed or altered from any source distribution.
41 */
42 
43 /**
44     SDL GPU
45 
46     See_Also:
47         $(LINK2 https://wiki.libsdl.org/SDL3/CategoryAudio, SDL3 GPU Documentation)
48     
49     Copyright: © 2025 Inochi2D Project, © 1997-2025 Sam Lantinga
50     License: Subject to the terms of the Zlib License, as written in the LICENSE file.
51     Authors: 
52         Luna Nielsen
53 */
54 module sdl.gpu;
55 import sdl.stdc;
56 import sdl.properties;
57 import sdl.pixels;
58 import sdl.rect;
59 import sdl.video;
60 import sdl.surface;
61 
62 extern(C) nothrow @nogc:
63 
64 /**
65     An opaque handle representing the SDL_GPU context.
66 */
67 struct SDL_GPUDevice;
68 
69 /**
70     An opaque handle representing a buffer.
71 
72     Used for vertices, indices, indirect draw commands, and general compute
73     data.
74 
75     See_Also:
76         $(D SDL_CreateGPUBuffer)
77         $(D SDL_UploadToGPUBuffer)
78         $(D SDL_DownloadFromGPUBuffer)
79         $(D SDL_CopyGPUBufferToBuffer)
80         $(D SDL_BindGPUVertexBuffers)
81         $(D SDL_BindGPUIndexBuffer)
82         $(D SDL_BindGPUVertexStorageBuffers)
83         $(D SDL_BindGPUFragmentStorageBuffers)
84         $(D SDL_DrawGPUPrimitivesIndirect)
85         $(D SDL_DrawGPUIndexedPrimitivesIndirect)
86         $(D SDL_BindGPUComputeStorageBuffers)
87         $(D SDL_DispatchGPUComputeIndirect)
88         $(D SDL_ReleaseGPUBuffer)
89 */
90 struct SDL_GPUBuffer;
91 
92 /**
93     An opaque handle representing a transfer buffer.
94 
95     Used for transferring data to and from the device.
96 
97     See_Also:
98         $(D SDL_CreateGPUTransferBuffer)
99         $(D SDL_MapGPUTransferBuffer)
100         $(D SDL_UnmapGPUTransferBuffer)
101         $(D SDL_UploadToGPUBuffer)
102         $(D SDL_UploadToGPUTexture)
103         $(D SDL_DownloadFromGPUBuffer)
104         $(D SDL_DownloadFromGPUTexture)
105         $(D SDL_ReleaseGPUTransferBuffer)
106 */
107 struct SDL_GPUTransferBuffer;
108 
109 /**
110     An opaque handle representing a texture.
111 
112     See_Also:
113         $(D SDL_CreateGPUTexture)
114         $(D SDL_UploadToGPUTexture)
115         $(D SDL_DownloadFromGPUTexture)
116         $(D SDL_CopyGPUTextureToTexture)
117         $(D SDL_BindGPUVertexSamplers)
118         $(D SDL_BindGPUVertexStorageTextures)
119         $(D SDL_BindGPUFragmentSamplers)
120         $(D SDL_BindGPUFragmentStorageTextures)
121         $(D SDL_BindGPUComputeStorageTextures)
122         $(D SDL_GenerateMipmapsForGPUTexture)
123         $(D SDL_BlitGPUTexture)
124         $(D SDL_ReleaseGPUTexture)
125 */
126 struct SDL_GPUTexture;
127 
128 /**
129     An opaque handle representing a sampler.
130 
131     See_Also:
132         $(D SDL_CreateGPUSampler)
133         $(D SDL_BindGPUVertexSamplers)
134         $(D SDL_BindGPUFragmentSamplers)
135         $(D SDL_ReleaseGPUSampler)
136 */
137 struct SDL_GPUSampler;
138 
139 /**
140     An opaque handle representing a compiled shader object.
141 
142     See_Also:
143         $(D SDL_CreateGPUShader)
144         $(D SDL_CreateGPUGraphicsPipeline)
145         $(D SDL_ReleaseGPUShader)
146 */
147 struct SDL_GPUShader;
148 
149 /**
150     An opaque handle representing a compute pipeline.
151 
152     Used during compute passes.
153 
154     See_Also:
155         $(D SDL_CreateGPUComputePipeline)
156         $(D SDL_BindGPUComputePipeline)
157         $(D SDL_ReleaseGPUComputePipeline)
158 */
159 struct SDL_GPUComputePipeline;
160 
161 /**
162     An opaque handle representing a graphics pipeline.
163 
164     Used during render passes.
165 
166     See_Also:
167         $(D SDL_CreateGPUGraphicsPipeline)
168         $(D SDL_BindGPUGraphicsPipeline)
169         $(D SDL_ReleaseGPUGraphicsPipeline)
170 */
171 struct SDL_GPUGraphicsPipeline;
172 
173 /**
174     An opaque handle representing a command buffer.
175 
176     Most state is managed via command buffers. When setting state using a
177     command buffer, that state is local to the command buffer.
178 
179     Commands only begin execution on the GPU once SDL_SubmitGPUCommandBuffer is
180     called. Once the command buffer is submitted, it is no longer valid to use
181     it.
182 
183     Command buffers are executed in submission order. If you submit command
184     buffer A and then command buffer B all commands in A will begin executing
185     before any command in B begins executing.
186 
187     In multi-threading scenarios, you should only access a command buffer on
188     the thread you acquired it from.
189 
190     See_Also:
191         $(D SDL_AcquireGPUCommandBuffer)
192         $(D SDL_SubmitGPUCommandBuffer)
193         $(D SDL_SubmitGPUCommandBufferAndAcquireFence)
194 */
195 struct SDL_GPUCommandBuffer;
196 
197 /**
198     An opaque handle representing a render pass.
199 
200     This handle is transient and should not be held or referenced after
201     SDL_EndGPURenderPass is called.
202 
203     See_Also:
204         $(D SDL_BeginGPURenderPass)
205         $(D SDL_EndGPURenderPass)
206 */
207 struct SDL_GPURenderPass;
208 
209 /**
210     An opaque handle representing a compute pass.
211 
212     This handle is transient and should not be held or referenced after
213     SDL_EndGPUComputePass is called.
214 
215 
216     See_Also:
217         $(D SDL_BeginGPUComputePass)
218         $(D SDL_EndGPUComputePass)
219 */
220 struct SDL_GPUComputePass;
221 
222 /**
223     An opaque handle representing a copy pass.
224 
225     This handle is transient and should not be held or referenced after
226     SDL_EndGPUCopyPass is called.
227 
228 
229     See_Also:
230         $(D SDL_BeginGPUCopyPass)
231         $(D SDL_EndGPUCopyPass)
232 */
233 struct SDL_GPUCopyPass;
234 
235 /**
236     An opaque handle representing a fence.
237 
238 
239     See_Also:
240         $(D SDL_SubmitGPUCommandBufferAndAcquireFence)
241         $(D SDL_QueryGPUFence)
242         $(D SDL_WaitForGPUFences)
243         $(D SDL_ReleaseGPUFence)
244 */
245 struct SDL_GPUFence;
246 
247 /**
248     Specifies the primitive topology of a graphics pipeline.
249     
250     If you are using POINTLIST you must include a point size output in the
251     vertex shader.
252     
253     -   For HLSL compiling to SPIRV you must decorate a float output with
254         [[vk::builtin("PointSize")]].
255     -   For GLSL you must set the gl_PointSize builtin.
256     -   For MSL you must include a float output with the [[point_size]]
257         decorator.
258     
259     Note that sized point topology is totally unsupported on D3D12. Any size
260     other than 1 will be ignored. In general, you should avoid using point
261     topology for both compatibility and performance reasons. You WILL regret
262     using it.
263     
264     See_Also:
265         $(D SDL_CreateGPUGraphicsPipeline)
266 */
267 enum SDL_GPUPrimitiveType {
268         
269     /**
270         A series of separate triangles. 
271     */
272     SDL_GPU_PRIMITIVETYPE_TRIANGLELIST,
273         
274     /**
275         A series of connected triangles. 
276     */
277     SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP,
278         
279     /**
280         A series of separate lines. 
281     */
282     SDL_GPU_PRIMITIVETYPE_LINELIST,
283         
284     /**
285         A series of connected lines. 
286     */
287     SDL_GPU_PRIMITIVETYPE_LINESTRIP,
288         
289     /**
290         A series of separate points. 
291     */
292     SDL_GPU_PRIMITIVETYPE_POINTLIST,
293 }
294 
295 /**
296     Specifies how the contents of a texture attached to a render pass are
297     treated at the beginning of the render pass.
298 
299     See_Also:
300         $(D SDL_BeginGPURenderPass)
301 */
302 enum SDL_GPULoadOp {
303     
304     /**
305         The previous contents of the texture will be preserved. 
306     */
307     SDL_GPU_LOADOP_LOAD,
308         
309     /**
310         The contents of the texture will be cleared to a color. 
311     */
312     SDL_GPU_LOADOP_CLEAR,
313         
314     /**
315         The previous contents of the texture need not be preserved. The contents will be undefined. 
316     */
317     SDL_GPU_LOADOP_DONT_CARE,
318 }
319 
320 /**
321     Specifies how the contents of a texture attached to a render pass are
322     treated at the end of the render pass.
323 
324     See_Also:
325         $(D SDL_BeginGPURenderPass)
326 */
327 enum SDL_GPUStoreOp {
328     
329     /**
330         The contents generated during the render pass will be written to memory. 
331     */
332     SDL_GPU_STOREOP_STORE,
333         
334     /**
335         The contents generated during the render pass are not needed and may be discarded. The contents will be undefined. 
336     */
337     SDL_GPU_STOREOP_DONT_CARE,
338         
339     /**
340         The multisample contents generated during the render pass will be resolved to a non-multisample texture. The contents in the multisample texture may then be discarded and will be undefined. 
341     */
342     SDL_GPU_STOREOP_RESOLVE,
343         
344     /**
345         The multisample contents generated during the render pass will be resolved to a non-multisample texture. The contents in the multisample texture will be written to memory. 
346     */
347     SDL_GPU_STOREOP_RESOLVE_AND_STORE,
348 }
349 
350 /**
351     Specifies the size of elements in an index buffer.
352 
353 
354         $(D SDL_CreateGPUGraphicsPipeline)
355 */
356 enum SDL_GPUIndexElementSize {
357         
358     /**
359         The index elements are 16-bit. 
360     */
361     SDL_GPU_INDEXELEMENTSIZE_16BIT,
362         
363     /**
364         The index elements are 32-bit. 
365     */
366     SDL_GPU_INDEXELEMENTSIZE_32BIT,
367 }
368 
369 /**
370     Specifies the pixel format of a texture.
371 
372     Texture format support varies depending on driver, hardware, and usage
373     flags. In general, you should use SDL_GPUTextureSupportsFormat to query if
374     a format is supported before using it. However, there are a few guaranteed
375     formats.
376 
377     FIXME: Check universal support for 32-bit component formats FIXME: Check
378     universal support for SIMULTANEOUS_READ_WRITE
379 
380     For SAMPLER usage, the following formats are universally supported:
381 
382     - R8G8B8A8_UNORM
383     - B8G8R8A8_UNORM
384     - R8_UNORM
385     - R8_SNORM
386     - R8G8_UNORM
387     - R8G8_SNORM
388     - R8G8B8A8_SNORM
389     - R16_FLOAT
390     - R16G16_FLOAT
391     - R16G16B16A16_FLOAT
392     - R32_FLOAT
393     - R32G32_FLOAT
394     - R32G32B32A32_FLOAT
395     - R11G11B10_UFLOAT
396     - R8G8B8A8_UNORM_SRGB
397     - B8G8R8A8_UNORM_SRGB
398     - D16_UNORM
399 
400     For COLOR_TARGET usage, the following formats are universally supported:
401 
402     - R8G8B8A8_UNORM
403     - B8G8R8A8_UNORM
404     - R8_UNORM
405     - R16_FLOAT
406     - R16G16_FLOAT
407     - R16G16B16A16_FLOAT
408     - R32_FLOAT
409     - R32G32_FLOAT
410     - R32G32B32A32_FLOAT
411     - R8_UINT
412     - R8G8_UINT
413     - R8G8B8A8_UINT
414     - R16_UINT
415     - R16G16_UINT
416     - R16G16B16A16_UINT
417     - R8_INT
418     - R8G8_INT
419     - R8G8B8A8_INT
420     - R16_INT
421     - R16G16_INT
422     - R16G16B16A16_INT
423     - R8G8B8A8_UNORM_SRGB
424     - B8G8R8A8_UNORM_SRGB
425 
426     For STORAGE usages, the following formats are universally supported:
427 
428     - R8G8B8A8_UNORM
429     - R8G8B8A8_SNORM
430     - R16G16B16A16_FLOAT
431     - R32_FLOAT
432     - R32G32_FLOAT
433     - R32G32B32A32_FLOAT
434     - R8G8B8A8_UINT
435     - R16G16B16A16_UINT
436     - R8G8B8A8_INT
437     - R16G16B16A16_INT
438 
439     For DEPTH_STENCIL_TARGET usage, the following formats are universally
440     supported:
441 
442     - D16_UNORM
443     - Either (but not necessarily both!) D24_UNORM or D32_FLOAT
444     - Either (but not necessarily both!) D24_UNORM_S8_UINT or D32_FLOAT_S8_UINT
445 
446     Unless D16_UNORM is sufficient for your purposes, always check which of
447     D24/D32 is supported before creating a depth-stencil texture!
448 
449 
450         $(D SDL_CreateGPUTexture)
451         $(D SDL_GPUTextureSupportsFormat)
452 */
453 enum SDL_GPUTextureFormat {
454     SDL_GPU_TEXTUREFORMAT_INVALID,
455 
456     /* Unsigned Normalized Float Color Formats */
457     SDL_GPU_TEXTUREFORMAT_A8_UNORM,
458     SDL_GPU_TEXTUREFORMAT_R8_UNORM,
459     SDL_GPU_TEXTUREFORMAT_R8G8_UNORM,
460     SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM,
461     SDL_GPU_TEXTUREFORMAT_R16_UNORM,
462     SDL_GPU_TEXTUREFORMAT_R16G16_UNORM,
463     SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UNORM,
464     SDL_GPU_TEXTUREFORMAT_R10G10B10A2_UNORM,
465     SDL_GPU_TEXTUREFORMAT_B5G6R5_UNORM,
466     SDL_GPU_TEXTUREFORMAT_B5G5R5A1_UNORM,
467     SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM,
468     SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM,
469     /* Compressed Unsigned Normalized Float Color Formats */
470     SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM,
471     SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM,
472     SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM,
473     SDL_GPU_TEXTUREFORMAT_BC4_R_UNORM,
474     SDL_GPU_TEXTUREFORMAT_BC5_RG_UNORM,
475     SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM,
476     /* Compressed Signed Float Color Formats */
477     SDL_GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT,
478     /* Compressed Unsigned Float Color Formats */
479     SDL_GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT,
480     /* Signed Normalized Float Color Formats  */
481     SDL_GPU_TEXTUREFORMAT_R8_SNORM,
482     SDL_GPU_TEXTUREFORMAT_R8G8_SNORM,
483     SDL_GPU_TEXTUREFORMAT_R8G8B8A8_SNORM,
484     SDL_GPU_TEXTUREFORMAT_R16_SNORM,
485     SDL_GPU_TEXTUREFORMAT_R16G16_SNORM,
486     SDL_GPU_TEXTUREFORMAT_R16G16B16A16_SNORM,
487     /* Signed Float Color Formats */
488     SDL_GPU_TEXTUREFORMAT_R16_FLOAT,
489     SDL_GPU_TEXTUREFORMAT_R16G16_FLOAT,
490     SDL_GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT,
491     SDL_GPU_TEXTUREFORMAT_R32_FLOAT,
492     SDL_GPU_TEXTUREFORMAT_R32G32_FLOAT,
493     SDL_GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT,
494     /* Unsigned Float Color Formats */
495     SDL_GPU_TEXTUREFORMAT_R11G11B10_UFLOAT,
496     /* Unsigned Integer Color Formats */
497     SDL_GPU_TEXTUREFORMAT_R8_UINT,
498     SDL_GPU_TEXTUREFORMAT_R8G8_UINT,
499     SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UINT,
500     SDL_GPU_TEXTUREFORMAT_R16_UINT,
501     SDL_GPU_TEXTUREFORMAT_R16G16_UINT,
502     SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UINT,
503     SDL_GPU_TEXTUREFORMAT_R32_UINT,
504     SDL_GPU_TEXTUREFORMAT_R32G32_UINT,
505     SDL_GPU_TEXTUREFORMAT_R32G32B32A32_UINT,
506     /* Signed Integer Color Formats */
507     SDL_GPU_TEXTUREFORMAT_R8_INT,
508     SDL_GPU_TEXTUREFORMAT_R8G8_INT,
509     SDL_GPU_TEXTUREFORMAT_R8G8B8A8_INT,
510     SDL_GPU_TEXTUREFORMAT_R16_INT,
511     SDL_GPU_TEXTUREFORMAT_R16G16_INT,
512     SDL_GPU_TEXTUREFORMAT_R16G16B16A16_INT,
513     SDL_GPU_TEXTUREFORMAT_R32_INT,
514     SDL_GPU_TEXTUREFORMAT_R32G32_INT,
515     SDL_GPU_TEXTUREFORMAT_R32G32B32A32_INT,
516     /* SRGB Unsigned Normalized Color Formats */
517     SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB,
518     SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB,
519     /* Compressed SRGB Unsigned Normalized Color Formats */
520     SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB,
521     SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB,
522     SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB,
523     SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB,
524     /* Depth Formats */
525     SDL_GPU_TEXTUREFORMAT_D16_UNORM,
526     SDL_GPU_TEXTUREFORMAT_D24_UNORM,
527     SDL_GPU_TEXTUREFORMAT_D32_FLOAT,
528     SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT,
529     SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT,
530     /* Compressed ASTC Normalized Float Color Formats*/
531     SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM,
532     SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM,
533     SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM,
534     SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM,
535     SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM,
536     SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM,
537     SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM,
538     SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM,
539     SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM,
540     SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM,
541     SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM,
542     SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM,
543     SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM,
544     SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM,
545     /* Compressed SRGB ASTC Normalized Float Color Formats*/
546     SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM_SRGB,
547     SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM_SRGB,
548     SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM_SRGB,
549     SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM_SRGB,
550     SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM_SRGB,
551     SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM_SRGB,
552     SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM_SRGB,
553     SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM_SRGB,
554     SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM_SRGB,
555     SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM_SRGB,
556     SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM_SRGB,
557     SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM_SRGB,
558     SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM_SRGB,
559     SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM_SRGB,
560     /* Compressed ASTC Signed Float Color Formats*/
561     SDL_GPU_TEXTUREFORMAT_ASTC_4x4_FLOAT,
562     SDL_GPU_TEXTUREFORMAT_ASTC_5x4_FLOAT,
563     SDL_GPU_TEXTUREFORMAT_ASTC_5x5_FLOAT,
564     SDL_GPU_TEXTUREFORMAT_ASTC_6x5_FLOAT,
565     SDL_GPU_TEXTUREFORMAT_ASTC_6x6_FLOAT,
566     SDL_GPU_TEXTUREFORMAT_ASTC_8x5_FLOAT,
567     SDL_GPU_TEXTUREFORMAT_ASTC_8x6_FLOAT,
568     SDL_GPU_TEXTUREFORMAT_ASTC_8x8_FLOAT,
569     SDL_GPU_TEXTUREFORMAT_ASTC_10x5_FLOAT,
570     SDL_GPU_TEXTUREFORMAT_ASTC_10x6_FLOAT,
571     SDL_GPU_TEXTUREFORMAT_ASTC_10x8_FLOAT,
572     SDL_GPU_TEXTUREFORMAT_ASTC_10x10_FLOAT,
573     SDL_GPU_TEXTUREFORMAT_ASTC_12x10_FLOAT,
574     SDL_GPU_TEXTUREFORMAT_ASTC_12x12_FLOAT
575 }
576 
577 enum SDL_GPUTextureUsageFlags : Uint32 {
578     
579     /**
580         Texture supports sampling. 
581     */
582     SDL_GPU_TEXTUREUSAGE_SAMPLER = (1u << 0),
583         
584     /**
585         Texture is a color render target. 
586     */
587     SDL_GPU_TEXTUREUSAGE_COLOR_TARGET = (1u << 1),
588         
589     /**
590         Texture is a depth stencil target. 
591     */
592     SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET = (1u << 2),
593         
594     /**
595         Texture supports storage reads in graphics stages. 
596     */
597     SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ = (1u << 3),
598         
599     /**
600         Texture supports storage reads in the compute stage. 
601     */
602     SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ = (1u << 4),
603         
604     /**
605         Texture supports storage writes in the compute stage. 
606     */
607     SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE = (1u << 5),
608         
609     /**
610         Texture supports reads and writes in the same compute shader. This is NOT equivalent to READ | WRITE. 
611     */
612     SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE = (1u << 6),
613 }
614 
615 /**
616     Specifies the type of a texture.
617     
618 
619     See_Also:
620         $(D SDL_CreateGPUTexture)
621 */
622 enum SDL_GPUTextureType {
623     
624     /**
625         The texture is a 2-dimensional image. 
626     */
627     SDL_GPU_TEXTURETYPE_2D,
628         
629     /**
630         The texture is a 2-dimensional array image. 
631     */
632     SDL_GPU_TEXTURETYPE_2D_ARRAY,
633         
634     /**
635         The texture is a 3-dimensional image. 
636     */
637     SDL_GPU_TEXTURETYPE_3D,
638         
639     /**
640         The texture is a cube image. 
641     */
642     SDL_GPU_TEXTURETYPE_CUBE,
643         
644     /**
645         The texture is a cube array image. 
646     */
647     SDL_GPU_TEXTURETYPE_CUBE_ARRAY,
648 }
649 
650 /**
651     Specifies the sample count of a texture.
652     
653     Used in multisampling. Note that this value only applies when the texture
654     is used as a render target.
655     
656 
657     See_Also:
658         $(D SDL_CreateGPUTexture)
659         $(D SDL_GPUTextureSupportsSampleCount)
660 */
661 enum SDL_GPUSampleCount {
662         
663     /**
664         No multisampling. 
665     */
666     SDL_GPU_SAMPLECOUNT_1,
667         
668     /**
669         MSAA 2x 
670     */
671     SDL_GPU_SAMPLECOUNT_2,
672         
673     /**
674         MSAA 4x 
675     */
676     SDL_GPU_SAMPLECOUNT_4,
677         
678     /**
679         MSAA 8x 
680     */
681     SDL_GPU_SAMPLECOUNT_8,
682 }
683 
684 /**
685     Specifies the face of a cube map.
686 
687     Can be passed in as the layer field in texture-related structs.
688 
689 */
690 enum SDL_GPUCubeMapFace {
691     SDL_GPU_CUBEMAPFACE_POSITIVEX,
692     SDL_GPU_CUBEMAPFACE_NEGATIVEX,
693     SDL_GPU_CUBEMAPFACE_POSITIVEY,
694     SDL_GPU_CUBEMAPFACE_NEGATIVEY,
695     SDL_GPU_CUBEMAPFACE_POSITIVEZ,
696     SDL_GPU_CUBEMAPFACE_NEGATIVEZ
697 }
698 
699 /**
700     Specifies how a buffer is intended to be used by the client.
701 
702     A buffer must have at least one usage flag. Note that some usage flag
703     combinations are invalid.
704 
705     Unlike textures, READ | WRITE can be used for simultaneous read-write
706     usage. The same data synchronization concerns as textures apply.
707 
708     If you use a STORAGE flag, the data in the buffer must respect std140
709     layout conventions. In practical terms this means you must ensure that vec3
710     and vec4 fields are 16-byte aligned.
711 
712 
713         $(D SDL_CreateGPUBuffer)
714 */
715 enum SDL_GPUBufferUsageFlags : Uint32 {
716     
717     /**
718         Buffer is a vertex buffer. 
719     */
720     SDL_GPU_BUFFERUSAGE_VERTEX = (1u << 0),
721         
722     /**
723         Buffer is an index buffer. 
724     */
725     SDL_GPU_BUFFERUSAGE_INDEX = (1u << 1),
726         
727     /**
728         Buffer is an indirect buffer. 
729     */
730     SDL_GPU_BUFFERUSAGE_INDIRECT = (1u << 2),
731         
732     /**
733         Buffer supports storage reads in graphics stages. 
734     */
735     SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ = (1u << 3),
736         
737     /**
738         Buffer supports storage reads in the compute stage. 
739     */
740     SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ = (1u << 4),
741         
742     /**
743         Buffer supports storage writes in the compute stage. 
744     */
745     SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE = (1u << 5),
746 
747 }
748 
749 /**
750     Specifies how a transfer buffer is intended to be used by the client.
751 
752     Note that mapping and copying FROM an upload transfer buffer or TO a
753     download transfer buffer is undefined behavior.
754 
755 
756         $(D SDL_CreateGPUTransferBuffer)
757 */
758 enum SDL_GPUTransferBufferUsage {
759     SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD,
760     SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD
761 }
762 
763 /**
764     Specifies which stage a shader program corresponds to.
765 
766 
767         $(D SDL_CreateGPUShader)
768 */
769 enum SDL_GPUShaderStage {
770     SDL_GPU_SHADERSTAGE_VERTEX,
771     SDL_GPU_SHADERSTAGE_FRAGMENT
772 }
773 
774 /**
775     Specifies the format of shader code.
776     
777     Each format corresponds to a specific backend that accepts it.
778     
779 
780     See_Also:
781         $(D SDL_CreateGPUShader)
782 */
783 enum SDL_GPUShaderFormat : Uint32 {
784     SDL_GPU_SHADERFORMAT_INVALID = 0,
785     
786 /**
787     Shaders for NDA'd platforms. 
788 */
789 SDL_GPU_SHADERFORMAT_PRIVATE = (1u << 0),
790     
791 /**
792     SPIR-V shaders for Vulkan. 
793 */
794 SDL_GPU_SHADERFORMAT_SPIRV = (1u << 1),
795     
796 /**
797     DXBC SM5_1 shaders for D3D12. 
798 */
799 SDL_GPU_SHADERFORMAT_DXBC = (1u << 2),
800     
801 /**
802     DXIL SM6_0 shaders for D3D12. 
803 */
804 SDL_GPU_SHADERFORMAT_DXIL = (1u << 3),
805     
806 /**
807     MSL shaders for Metal. 
808 */
809 SDL_GPU_SHADERFORMAT_MSL = (1u << 4),
810     
811 /**
812     Precompiled metallib shaders for Metal. 
813 */
814 SDL_GPU_SHADERFORMAT_METALLIB = (1u << 5),
815 
816 }
817 
818 /**
819     Specifies the format of a vertex attribute.
820     
821 
822     See_Also:
823         $(D SDL_CreateGPUGraphicsPipeline)
824 */
825 enum SDL_GPUVertexElementFormat {
826     SDL_GPU_VERTEXELEMENTFORMAT_INVALID,
827 
828     /* 32-bit Signed Integers */
829     SDL_GPU_VERTEXELEMENTFORMAT_INT,
830     SDL_GPU_VERTEXELEMENTFORMAT_INT2,
831     SDL_GPU_VERTEXELEMENTFORMAT_INT3,
832     SDL_GPU_VERTEXELEMENTFORMAT_INT4,
833 
834     /* 32-bit Unsigned Integers */
835     SDL_GPU_VERTEXELEMENTFORMAT_UINT,
836     SDL_GPU_VERTEXELEMENTFORMAT_UINT2,
837     SDL_GPU_VERTEXELEMENTFORMAT_UINT3,
838     SDL_GPU_VERTEXELEMENTFORMAT_UINT4,
839 
840     /* 32-bit Floats */
841     SDL_GPU_VERTEXELEMENTFORMAT_FLOAT,
842     SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2,
843     SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3,
844     SDL_GPU_VERTEXELEMENTFORMAT_FLOAT4,
845 
846     /* 8-bit Signed Integers */
847     SDL_GPU_VERTEXELEMENTFORMAT_BYTE2,
848     SDL_GPU_VERTEXELEMENTFORMAT_BYTE4,
849 
850     /* 8-bit Unsigned Integers */
851     SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2,
852     SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4,
853 
854     /* 8-bit Signed Normalized */
855     SDL_GPU_VERTEXELEMENTFORMAT_BYTE2_NORM,
856     SDL_GPU_VERTEXELEMENTFORMAT_BYTE4_NORM,
857 
858     /* 8-bit Unsigned Normalized */
859     SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM,
860     SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM,
861 
862     /* 16-bit Signed Integers */
863     SDL_GPU_VERTEXELEMENTFORMAT_SHORT2,
864     SDL_GPU_VERTEXELEMENTFORMAT_SHORT4,
865 
866     /* 16-bit Unsigned Integers */
867     SDL_GPU_VERTEXELEMENTFORMAT_USHORT2,
868     SDL_GPU_VERTEXELEMENTFORMAT_USHORT4,
869 
870     /* 16-bit Signed Normalized */
871     SDL_GPU_VERTEXELEMENTFORMAT_SHORT2_NORM,
872     SDL_GPU_VERTEXELEMENTFORMAT_SHORT4_NORM,
873 
874     /* 16-bit Unsigned Normalized */
875     SDL_GPU_VERTEXELEMENTFORMAT_USHORT2_NORM,
876     SDL_GPU_VERTEXELEMENTFORMAT_USHORT4_NORM,
877 
878     /* 16-bit Floats */
879     SDL_GPU_VERTEXELEMENTFORMAT_HALF2,
880     SDL_GPU_VERTEXELEMENTFORMAT_HALF4
881 }
882 
883 /**
884     Specifies the rate at which vertex attributes are pulled from buffers.
885     
886 
887     See_Also:
888         $(D SDL_CreateGPUGraphicsPipeline)
889 */
890 enum SDL_GPUVertexInputRate {
891     
892 /**
893     Attribute addressing is a function of the vertex index. 
894 */
895 SDL_GPU_VERTEXINPUTRATE_VERTEX,
896     
897 /**
898     Attribute addressing is a function of the instance index. 
899 */
900 SDL_GPU_VERTEXINPUTRATE_INSTANCE,
901 }
902 
903 /**
904     Specifies the fill mode of the graphics pipeline.
905     
906 
907     See_Also:
908         $(D SDL_CreateGPUGraphicsPipeline)
909 */
910 enum SDL_GPUFillMode {
911     
912 /**
913     Polygons will be rendered via rasterization. 
914 */
915 SDL_GPU_FILLMODE_FILL,
916     
917 /**
918     Polygon edges will be drawn as line segments. 
919 */
920 SDL_GPU_FILLMODE_LINE,
921 }
922 
923 /**
924     Specifies the facing direction in which triangle faces will be culled.
925     
926 
927     See_Also:
928         $(D SDL_CreateGPUGraphicsPipeline)
929 */
930 enum SDL_GPUCullMode {
931     
932 /**
933     No triangles are culled. 
934 */
935 SDL_GPU_CULLMODE_NONE,
936     
937 /**
938     Front-facing triangles are culled. 
939 */
940 SDL_GPU_CULLMODE_FRONT,
941     
942 /**
943     Back-facing triangles are culled. 
944 */
945 SDL_GPU_CULLMODE_BACK,
946 }
947 
948 /**
949     Specifies the vertex winding that will cause a triangle to be determined to
950     be front-facing.
951     
952 
953     See_Also:
954         $(D SDL_CreateGPUGraphicsPipeline)
955 */
956 enum SDL_GPUFrontFace {
957     
958 /**
959     A triangle with counter-clockwise vertex winding will be considered front-facing. 
960 */
961 SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE,
962     
963 /**
964     A triangle with clockwise vertex winding will be considered front-facing. 
965 */
966 SDL_GPU_FRONTFACE_CLOCKWISE,
967 }
968 
969 /**
970     Specifies a comparison operator for depth, stencil and sampler operations.
971     
972 
973     See_Also:
974         $(D SDL_CreateGPUGraphicsPipeline)
975 */
976 enum SDL_GPUCompareOp {
977     SDL_GPU_COMPAREOP_INVALID,
978     
979 /**
980     The comparison always evaluates false. 
981 */
982 SDL_GPU_COMPAREOP_NEVER,
983     
984 /**
985     The comparison evaluates reference < test. 
986 */
987 SDL_GPU_COMPAREOP_LESS,
988     
989 /**
990     The comparison evaluates reference == test. 
991 */
992 SDL_GPU_COMPAREOP_EQUAL,
993     
994 /**
995     The comparison evaluates reference <= test. 
996 */
997 SDL_GPU_COMPAREOP_LESS_OR_EQUAL,
998     
999 /**
1000     The comparison evaluates reference > test. 
1001 */
1002 SDL_GPU_COMPAREOP_GREATER,
1003     
1004 /**
1005     The comparison evaluates reference != test. 
1006 */
1007 SDL_GPU_COMPAREOP_NOT_EQUAL,
1008     
1009 /**
1010     The comparison evalutes reference >= test. 
1011 */
1012 SDL_GPU_COMPAREOP_GREATER_OR_EQUAL,
1013     
1014 /**
1015     The comparison always evaluates true. 
1016 */
1017 SDL_GPU_COMPAREOP_ALWAYS,
1018 }
1019 
1020 /**
1021     Specifies what happens to a stored stencil value if stencil tests fail or
1022     pass.
1023     
1024 
1025     See_Also:
1026         $(D SDL_CreateGPUGraphicsPipeline)
1027 */
1028 enum SDL_GPUStencilOp {
1029     SDL_GPU_STENCILOP_INVALID,
1030         
1031     /**
1032         Keeps the current value. 
1033     */
1034     SDL_GPU_STENCILOP_KEEP,
1035         
1036     /**
1037         Sets the value to 0. 
1038     */
1039     SDL_GPU_STENCILOP_ZERO,
1040         
1041     /**
1042         Sets the value to reference. 
1043     */
1044     SDL_GPU_STENCILOP_REPLACE,
1045         
1046     /**
1047         Increments the current value and clamps to the maximum value. 
1048     */
1049     SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP,
1050         
1051     /**
1052         Decrements the current value and clamps to 0. 
1053     */
1054     SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP,
1055         
1056     /**
1057         Bitwise-inverts the current value. 
1058     */
1059     SDL_GPU_STENCILOP_INVERT,
1060         
1061     /**
1062         Increments the current value and wraps back to 0. 
1063     */
1064     SDL_GPU_STENCILOP_INCREMENT_AND_WRAP,
1065         
1066     /**
1067         Decrements the current value and wraps to the maximum value. 
1068     */
1069     SDL_GPU_STENCILOP_DECREMENT_AND_WRAP,
1070 }
1071 
1072 /**
1073     Specifies the operator to be used when pixels in a render target are
1074     blended with existing pixels in the texture.
1075     
1076     The source color is the value written by the fragment shader. The
1077     destination color is the value currently existing in the texture.
1078     
1079 
1080     See_Also:
1081         $(D SDL_CreateGPUGraphicsPipeline)
1082 */
1083 enum SDL_GPUBlendOp {
1084     SDL_GPU_BLENDOP_INVALID,
1085     
1086     /**
1087         (source * source_factor) + (destination * destination_factor) 
1088     */
1089     SDL_GPU_BLENDOP_ADD,
1090         
1091     /**
1092         (source * source_factor) - (destination * destination_factor) 
1093     */
1094     SDL_GPU_BLENDOP_SUBTRACT,
1095         
1096     /**
1097         (destination * destination_factor) - (source * source_factor) 
1098     */
1099     SDL_GPU_BLENDOP_REVERSE_SUBTRACT,
1100         
1101     /**
1102         min(source, destination) 
1103     */
1104     SDL_GPU_BLENDOP_MIN,
1105         
1106     /**
1107         max(source, destination) 
1108     */
1109     SDL_GPU_BLENDOP_MAX,
1110 }
1111 
1112 /**
1113     Specifies a blending factor to be used when pixels in a render target are
1114     blended with existing pixels in the texture.
1115     
1116     The source color is the value written by the fragment shader. The
1117     destination color is the value currently existing in the texture.
1118     
1119 
1120     See_Also:
1121         $(D SDL_CreateGPUGraphicsPipeline)
1122 */
1123 enum SDL_GPUBlendFactor {
1124     SDL_GPU_BLENDFACTOR_INVALID,
1125     
1126     /**
1127         0 
1128     */
1129     SDL_GPU_BLENDFACTOR_ZERO,
1130         
1131     /**
1132         1 
1133     */
1134     SDL_GPU_BLENDFACTOR_ONE,
1135         
1136     /**
1137         source color 
1138     */
1139     SDL_GPU_BLENDFACTOR_SRC_COLOR,
1140         
1141     /**
1142         1 - source color 
1143     */
1144     SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR,
1145         
1146     /**
1147         destination color 
1148     */
1149     SDL_GPU_BLENDFACTOR_DST_COLOR,
1150         
1151     /**
1152         1 - destination color 
1153     */
1154     SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR,
1155         
1156     /**
1157         source alpha 
1158     */
1159     SDL_GPU_BLENDFACTOR_SRC_ALPHA,
1160         
1161     /**
1162         1 - source alpha 
1163     */
1164     SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA,
1165         
1166     /**
1167         destination alpha 
1168     */
1169     SDL_GPU_BLENDFACTOR_DST_ALPHA,
1170         
1171     /**
1172         1 - destination alpha 
1173     */
1174     SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA,
1175         
1176     /**
1177         blend constant 
1178     */
1179     SDL_GPU_BLENDFACTOR_CONSTANT_COLOR,
1180         
1181     /**
1182         1 - blend constant 
1183     */
1184     SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR,
1185         
1186     /**
1187         min(source alpha, 1 - destination alpha) 
1188     */
1189     SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE,
1190 }
1191 
1192 /**
1193     Specifies which color components are written in a graphics pipeline.
1194     
1195 
1196     See_Also:
1197         $(D SDL_CreateGPUGraphicsPipeline)
1198 */
1199 enum SDL_GPUColorComponentFlags : Uint8 {
1200     
1201     /**
1202         the red component 
1203     */
1204     SDL_GPU_COLORCOMPONENT_R = (1u << 0),
1205         
1206     /**
1207         the green component 
1208     */
1209     SDL_GPU_COLORCOMPONENT_G = (1u << 1),
1210         
1211     /**
1212         the blue component 
1213     */
1214     SDL_GPU_COLORCOMPONENT_B = (1u << 2),
1215         
1216     /**
1217         the alpha component 
1218     */
1219     SDL_GPU_COLORCOMPONENT_A = (1u << 3),
1220 }
1221 
1222 /**
1223     Specifies a filter operation used by a sampler.
1224     
1225 
1226     See_Also:
1227         $(D SDL_CreateGPUSampler)
1228 */
1229 enum SDL_GPUFilter {
1230     
1231 /**
1232     Point filtering. 
1233 */
1234 SDL_GPU_FILTER_NEAREST,
1235     
1236 /**
1237     Linear filtering. 
1238 */
1239 SDL_GPU_FILTER_LINEAR,
1240 }
1241 
1242 /**
1243     Specifies a mipmap mode used by a sampler.
1244     
1245 
1246     See_Also:
1247         $(D SDL_CreateGPUSampler)
1248 */
1249 enum SDL_GPUSamplerMipmapMode {
1250         
1251     /**
1252         Point filtering. 
1253     */
1254     SDL_GPU_SAMPLERMIPMAPMODE_NEAREST,
1255         
1256     /**
1257         Linear filtering. 
1258     */
1259     SDL_GPU_SAMPLERMIPMAPMODE_LINEAR,
1260 }
1261 
1262 /**
1263     Specifies behavior of texture sampling when the coordinates exceed the 0-1
1264     range.
1265     
1266 
1267     See_Also:
1268         $(D SDL_CreateGPUSampler)
1269 */
1270 enum SDL_GPUSamplerAddressMode {
1271         
1272     /**
1273         Specifies that the coordinates will wrap around. 
1274     */
1275     SDL_GPU_SAMPLERADDRESSMODE_REPEAT,
1276         
1277     /**
1278         Specifies that the coordinates will wrap around mirrored. 
1279     */
1280     SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT,
1281         
1282     /**
1283         Specifies that the coordinates will clamp to the 0-1 range. 
1284     */
1285     SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE,
1286 }
1287 
1288 /**
1289     Specifies the timing that will be used to present swapchain textures to the
1290     OS.
1291     
1292     VSYNC mode will always be supported. IMMEDIATE and MAILBOX modes may not be
1293     supported on certain systems.
1294     
1295     It is recommended to query SDL_WindowSupportsGPUPresentMode after claiming
1296     the window if you wish to change the present mode to IMMEDIATE or MAILBOX.
1297     
1298     - VSYNC: Waits for vblank before presenting. No tearing is possible. If
1299     there is a pending image to present, the new image is enqueued for
1300     presentation. Disallows tearing at the cost of visual latency.
1301     - IMMEDIATE: Immediately presents. Lowest latency option, but tearing may
1302     occur.
1303     - MAILBOX: Waits for vblank before presenting. No tearing is possible. If
1304     there is a pending image to present, the pending image is replaced by the
1305     new image. Similar to VSYNC, but with reduced visual latency.
1306     
1307 
1308     See_Also:
1309         $(D SDL_SetGPUSwapchainParameters)
1310         $(D SDL_WindowSupportsGPUPresentMode)
1311         $(D SDL_WaitAndAcquireGPUSwapchainTexture)
1312 */
1313 enum SDL_GPUPresentMode {
1314     SDL_GPU_PRESENTMODE_VSYNC,
1315     SDL_GPU_PRESENTMODE_IMMEDIATE,
1316     SDL_GPU_PRESENTMODE_MAILBOX
1317 }
1318 
1319 /**
1320     Specifies the texture format and colorspace of the swapchain textures.
1321     
1322     SDR will always be supported. Other compositions may not be supported on
1323     certain systems.
1324     
1325     It is recommended to query SDL_WindowSupportsGPUSwapchainComposition after
1326     claiming the window if you wish to change the swapchain composition from
1327     SDR.
1328     
1329     - SDR: B8G8R8A8 or R8G8B8A8 swapchain. Pixel values are in sRGB encoding.
1330     - SDR_LINEAR: B8G8R8A8_SRGB or R8G8B8A8_SRGB swapchain. Pixel values are
1331     stored in memory in sRGB encoding but accessed in shaders in "linear
1332     sRGB" encoding which is sRGB but with a linear transfer function.
1333     - HDR_EXTENDED_LINEAR: R16G16B16A16_FLOAT swapchain. Pixel values are in
1334     extended linear sRGB encoding and permits values outside of the [0, 1]
1335     range.
1336     - HDR10_ST2084: A2R10G10B10 or A2B10G10R10 swapchain. Pixel values are in
1337     BT.2020 ST2084 (PQ) encoding.
1338     
1339 
1340     See_Also:
1341         $(D SDL_SetGPUSwapchainParameters)
1342         $(D SDL_WindowSupportsGPUSwapchainComposition)
1343         $(D SDL_WaitAndAcquireGPUSwapchainTexture)
1344 */
1345 enum SDL_GPUSwapchainComposition {
1346     SDL_GPU_SWAPCHAINCOMPOSITION_SDR,
1347     SDL_GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR,
1348     SDL_GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR,
1349     SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084
1350 }
1351 
1352 /**
1353     A structure specifying a viewport.
1354     
1355 
1356     See_Also:
1357         $(D SDL_SetGPUViewport)
1358 */
1359 struct SDL_GPUViewport {
1360 
1361     /**
1362         The left offset of the viewport.
1363     */
1364     float x;
1365 
1366     /**
1367         The top offset of the viewport.
1368     */
1369     float y;
1370 
1371     /**
1372         The width of the viewport.
1373     */
1374     float w;
1375 
1376     /**
1377         The height of the viewport.
1378     */
1379     float h;
1380 
1381     /**
1382         The minimum depth of the viewport.
1383     */
1384     float min_depth;
1385 
1386     /**
1387         The maximum depth of the viewport.
1388     */
1389     float max_depth;
1390 }
1391 
1392 /**
1393     A structure specifying parameters related to transferring data to or from a
1394     texture.
1395     
1396 
1397     See_Also:
1398         $(D SDL_UploadToGPUTexture)
1399         $(D SDL_DownloadFromGPUTexture)
1400 */
1401 struct SDL_GPUTextureTransferInfo {
1402 
1403     /**
1404         The transfer buffer used in the transfer operation.
1405     */
1406     SDL_GPUTransferBuffer* transfer_buffer;
1407 
1408     /**
1409         The starting byte of the image data in the transfer buffer.
1410     */
1411     Uint32 offset;
1412 
1413     /**
1414         The number of pixels from one row to the next.
1415     */
1416     Uint32 pixels_per_row;
1417 
1418     /**
1419         The number of rows from one layer/depth-slice to the next.
1420     */
1421     Uint32 rows_per_layer;
1422 }
1423 
1424 /**
1425     A structure specifying a location in a transfer buffer.
1426     
1427     Used when transferring buffer data to or from a transfer buffer.
1428     
1429 
1430     See_Also:
1431         $(D SDL_UploadToGPUBuffer)
1432         $(D SDL_DownloadFromGPUBuffer)
1433 */
1434 struct SDL_GPUTransferBufferLocation {
1435 
1436     /**
1437         The transfer buffer used in the transfer operation.
1438     */
1439     SDL_GPUTransferBuffer* transfer_buffer;
1440 
1441     /**
1442         The starting byte of the buffer data in the transfer buffer.
1443     */
1444     Uint32 offset;
1445 }
1446 
1447 /**
1448     A structure specifying a location in a texture.
1449     
1450     Used when copying data from one texture to another.
1451     
1452 
1453     See_Also:
1454         $(D SDL_CopyGPUTextureToTexture)
1455 */
1456 struct SDL_GPUTextureLocation {
1457 
1458     /**
1459         The texture used in the copy operation.
1460     */
1461     SDL_GPUTexture* texture;
1462 
1463     /**
1464         The mip level index of the location.
1465     */
1466     Uint32 mip_level;
1467 
1468     /**
1469         The layer index of the location.
1470     */
1471     Uint32 layer;
1472 
1473     /**
1474         The left offset of the location.
1475     */
1476     Uint32 x;
1477 
1478     /**
1479         The top offset of the location.
1480     */
1481     Uint32 y;
1482 
1483     /**
1484         The front offset of the location.
1485     */
1486     Uint32 z;
1487 }
1488 
1489 /**
1490     A structure specifying a region of a texture.
1491     
1492     Used when transferring data to or from a texture.
1493     
1494 
1495     See_Also:
1496         $(D SDL_UploadToGPUTexture)
1497         $(D SDL_DownloadFromGPUTexture)
1498 */
1499 struct SDL_GPUTextureRegion {
1500 
1501     /**
1502         The texture used in the copy operation.
1503     */
1504     SDL_GPUTexture* texture;
1505 
1506     /**
1507         The mip level index to transfer.
1508     */
1509     Uint32 mip_level;
1510 
1511     /**
1512         The layer index to transfer.
1513     */
1514     Uint32 layer;
1515 
1516     /**
1517         The left offset of the region.
1518     */
1519     Uint32 x;
1520 
1521     /**
1522         The top offset of the region.
1523     */
1524     Uint32 y;
1525 
1526     /**
1527         The front offset of the region.
1528     */
1529     Uint32 z;
1530 
1531     /**
1532         The width of the region.
1533     */
1534     Uint32 w;
1535 
1536     /**
1537         The height of the region.
1538     */
1539     Uint32 h;
1540 
1541     /**
1542         The depth of the region.
1543     */
1544     Uint32 d;
1545 }
1546 
1547 /**
1548     A structure specifying a region of a texture used in the blit operation.
1549     
1550 
1551     See_Also:
1552         $(D SDL_BlitGPUTexture)
1553 */
1554 struct SDL_GPUBlitRegion {
1555 
1556     /**
1557         The texture.
1558     */
1559     SDL_GPUTexture* texture;
1560 
1561     /**
1562         The mip level index of the region.
1563     */
1564     Uint32 mip_level;
1565 
1566     /**
1567         The layer index or depth plane of the region. This value is treated as a layer index on 2D array and cube textures, and as a depth plane on 3D textures.
1568     */
1569     Uint32 layer_or_depth_plane;
1570 
1571     /**
1572         The left offset of the region.
1573     */
1574     Uint32 x;
1575 
1576     /**
1577         The top offset of the region. 
1578     */
1579     Uint32 y;
1580 
1581     /**
1582         The width of the region.
1583     */
1584     Uint32 w;
1585 
1586     /**
1587         The height of the region.
1588     */
1589     Uint32 h;
1590 }
1591 
1592 /**
1593     A structure specifying a location in a buffer.
1594     
1595     Used when copying data between buffers.
1596     
1597 
1598     See_Also:
1599         $(D SDL_CopyGPUBufferToBuffer)
1600 */
1601 struct SDL_GPUBufferLocation {
1602 
1603     /**
1604         The buffer.
1605     */
1606     SDL_GPUBuffer* buffer;
1607 
1608     /**
1609         The starting byte within the buffer.
1610     */
1611     Uint32 offset;
1612 }
1613 
1614 /**
1615     A structure specifying a region of a buffer.
1616     
1617     Used when transferring data to or from buffers.
1618     
1619 
1620     See_Also:
1621         $(D SDL_UploadToGPUBuffer)
1622         $(D SDL_DownloadFromGPUBuffer)
1623 */
1624 struct SDL_GPUBufferRegion {
1625 
1626     /**
1627         The buffer.
1628     */
1629     SDL_GPUBuffer* buffer;
1630 
1631     /**
1632         The starting byte within the buffer.
1633     */
1634     Uint32 offset;
1635 
1636     /**
1637         The size in bytes of the region.
1638     */
1639     Uint32 size;
1640 }
1641 
1642 /**
1643     A structure specifying the parameters of an indirect draw command.
1644     
1645     Note that the `first_vertex` and `first_instance` parameters are NOT
1646     compatible with built-in vertex/instance ID variables in shaders (for
1647     example, SV_VertexID); GPU APIs and shader languages do not define these
1648     built-in variables consistently, so if your shader depends on them, the
1649     only way to keep behavior consistent and portable is to always pass 0 for
1650     the correlating parameter in the draw calls.
1651     
1652 
1653     See_Also:
1654         $(D SDL_DrawGPUPrimitivesIndirect)
1655 */
1656 struct SDL_GPUIndirectDrawCommand {
1657 
1658     /**
1659         The number of vertices to draw.
1660     */
1661     Uint32 num_vertices;
1662 
1663     /**
1664         The number of instances to draw.
1665     */
1666     Uint32 num_instances;
1667 
1668     /**
1669         The index of the first vertex to draw.
1670     */
1671     Uint32 first_vertex;
1672 
1673     /**
1674         The ID of the first instance to draw.
1675     */
1676     Uint32 first_instance;
1677 }
1678 
1679 /**
1680     A structure specifying the parameters of an indexed indirect draw command.
1681     
1682     Note that the `first_vertex` and `first_instance` parameters are NOT
1683     compatible with built-in vertex/instance ID variables in shaders (for
1684     example, SV_VertexID); GPU APIs and shader languages do not define these
1685     built-in variables consistently, so if your shader depends on them, the
1686     only way to keep behavior consistent and portable is to always pass 0 for
1687     the correlating parameter in the draw calls.
1688     
1689 
1690     See_Also:
1691         $(D SDL_DrawGPUIndexedPrimitivesIndirect)
1692 */
1693 struct SDL_GPUIndexedIndirectDrawCommand {
1694 
1695     /**
1696         The number of indices to draw per instance.
1697     */
1698     Uint32 num_indices;
1699 
1700     /**
1701         The number of instances to draw.
1702     */
1703     Uint32 num_instances;
1704 
1705     /**
1706         The base index within the index buffer.
1707     */
1708     Uint32 first_index;
1709 
1710     /**
1711         The value added to the vertex index before indexing into the vertex buffer.
1712     */
1713     Sint32 vertex_offset;
1714 
1715     /**
1716         The ID of the first instance to draw.
1717     */
1718     Uint32 first_instance;
1719 }
1720 
1721 /**
1722     A structure specifying the parameters of an indexed dispatch command.
1723     
1724 
1725     See_Also:
1726         $(D SDL_DispatchGPUComputeIndirect)
1727 */
1728 struct SDL_GPUIndirectDispatchCommand {
1729 
1730     /**
1731         The number of local workgroups to dispatch in the X dimension.
1732     */
1733     Uint32 groupcount_x;
1734 
1735     /**
1736         The number of local workgroups to dispatch in the Y dimension.
1737     */
1738     Uint32 groupcount_y;
1739 
1740     /**
1741         The number of local workgroups to dispatch in the Z dimension.
1742     */
1743     Uint32 groupcount_z;
1744 }
1745 
1746 /**
1747     A structure specifying the parameters of a sampler.
1748     See_Also:
1749         $(D SDL_CreateGPUSampler)
1750 */
1751 struct SDL_GPUSamplerCreateInfo {
1752 
1753     /**
1754         The minification filter to apply to lookups.
1755     */
1756     SDL_GPUFilter min_filter;
1757 
1758     /**
1759         The magnification filter to apply to lookups.
1760     */
1761     SDL_GPUFilter mag_filter;
1762 
1763     /**
1764         The mipmap filter to apply to lookups.
1765     */
1766     SDL_GPUSamplerMipmapMode mipmap_mode;
1767 
1768     /**
1769         The addressing mode for U coordinates outside [0, 1).
1770     */
1771     SDL_GPUSamplerAddressMode address_mode_u;
1772 
1773     /**
1774         The addressing mode for V coordinates outside [0, 1).
1775     */
1776     SDL_GPUSamplerAddressMode address_mode_v;
1777 
1778     /**
1779         The addressing mode for W coordinates outside [0, 1).
1780     */
1781     SDL_GPUSamplerAddressMode address_mode_w;
1782 
1783     /**
1784         The bias to be added to mipmap LOD calculation.
1785     */
1786     float mip_lod_bias;
1787 
1788     /**
1789         The anisotropy value clamp used by the sampler. If enable_anisotropy is false, this is ignored.
1790     */
1791     float max_anisotropy;
1792 
1793     /**
1794         The comparison operator to apply to fetched data before filtering.
1795     */
1796     SDL_GPUCompareOp compare_op;
1797 
1798     /**
1799         Clamps the minimum of the computed LOD value.
1800     */
1801     float min_lod;
1802 
1803     /**
1804         Clamps the maximum of the computed LOD value.
1805     */
1806     float max_lod;
1807 
1808     /**
1809         true to enable anisotropic filtering.
1810     */
1811     bool enable_anisotropy;
1812 
1813     /**
1814         true to enable comparison against a reference value during lookups.
1815     */
1816     bool enable_compare;
1817     Uint8 padding1;
1818     Uint8 padding2;
1819 
1820 
1821     /**
1822         A properties ID for extensions. Should be 0 if no extensions are needed.
1823     */
1824     SDL_PropertiesID props;
1825 }
1826 
1827 /**
1828     A structure specifying the parameters of vertex buffers used in a graphics
1829     pipeline.
1830     
1831     When you call SDL_BindGPUVertexBuffers, you specify the binding slots of
1832     the vertex buffers. For example if you called SDL_BindGPUVertexBuffers with
1833     a first_slot of 2 and num_bindings of 3, the binding slots 2, 3, 4 would be
1834     used by the vertex buffers you pass in.
1835     
1836     Vertex attributes are linked to buffers via the buffer_slot field of
1837     SDL_GPUVertexAttribute. For example, if an attribute has a buffer_slot of
1838     0, then that attribute belongs to the vertex buffer bound at slot 0.
1839     
1840 
1841     See_Also:
1842         $(D SDL_GPUVertexAttribute)
1843         $(D SDL_GPUVertexInputState)
1844 */
1845 struct SDL_GPUVertexBufferDescription {
1846 
1847     /**
1848         The binding slot of the vertex buffer.
1849     */
1850     Uint32 slot;
1851 
1852     /**
1853         The byte pitch between consecutive elements of the vertex buffer.
1854     */
1855     Uint32 pitch;
1856 
1857     /**
1858         Whether attribute addressing is a function of the vertex index or instance index.
1859     */
1860     SDL_GPUVertexInputRate input_rate;
1861 
1862     /**
1863         The number of instances to draw using the same per-instance data before advancing in the instance buffer by one element. Ignored unless input_rate is SDL_GPU_VERTEXINPUTRATE_INSTANCE
1864     */
1865     Uint32 instance_step_rate;
1866 }
1867 
1868 /**
1869     A structure specifying a vertex attribute.
1870     
1871     All vertex attribute locations provided to an SDL_GPUVertexInputState must
1872     be unique.
1873     
1874 
1875     See_Also:
1876         $(D SDL_GPUVertexBufferDescription)
1877         $(D SDL_GPUVertexInputState)
1878 */
1879 struct SDL_GPUVertexAttribute {
1880 
1881     /**
1882         The shader input location index.
1883     */
1884     Uint32 location;
1885 
1886     /**
1887         The binding slot of the associated vertex buffer.
1888     */
1889     Uint32 buffer_slot;
1890 
1891     /**
1892         The size and type of the attribute data.
1893     */
1894     SDL_GPUVertexElementFormat format;
1895 
1896     /**
1897         The byte offset of this attribute relative to the start of the vertex element.
1898     */
1899     Uint32 offset;
1900 }
1901 
1902 /**
1903     A structure specifying the parameters of a graphics pipeline vertex input
1904     state.
1905     
1906 
1907     See_Also:
1908         $(D SDL_GPUGraphicsPipelineCreateInfo)
1909         $(D SDL_GPUVertexBufferDescription)
1910         $(D SDL_GPUVertexAttribute)
1911 */
1912 struct SDL_GPUVertexInputState {
1913 
1914     /**
1915         A pointer to an array of vertex buffer descriptions.
1916     */
1917     const(SDL_GPUVertexBufferDescription)* vertex_buffer_descriptions;
1918 
1919     /**
1920         The number of vertex buffer descriptions in the above array.
1921     */
1922     Uint32 num_vertex_buffers;
1923 
1924     /**
1925         A pointer to an array of vertex attribute descriptions.
1926     */
1927     const(SDL_GPUVertexAttribute)* vertex_attributes;
1928 
1929     /**
1930         The number of vertex attribute descriptions in the above array.
1931     */
1932     Uint32 num_vertex_attributes;
1933 }
1934 
1935 /**
1936     A structure specifying the stencil operation state of a graphics pipeline.
1937     
1938 
1939     See_Also:
1940         $(D SDL_GPUDepthStencilState)
1941 */
1942 struct SDL_GPUStencilOpState {
1943 
1944     /**
1945         The action performed on samples that fail the stencil test.
1946     */
1947     SDL_GPUStencilOp fail_op;
1948 
1949     /**
1950         The action performed on samples that pass the depth and stencil tests.
1951     */
1952     SDL_GPUStencilOp pass_op;
1953 
1954     /**
1955         The action performed on samples that pass the stencil test and fail the depth test.
1956     */
1957     SDL_GPUStencilOp depth_fail_op;
1958 
1959     /**
1960         The comparison operator used in the stencil test.
1961     */
1962     SDL_GPUCompareOp compare_op;
1963 }
1964 
1965 /**
1966     A structure specifying the blend state of a color target.
1967     
1968 
1969     See_Also:
1970         $(D SDL_GPUColorTargetDescription)
1971 */
1972 struct SDL_GPUColorTargetBlendState {
1973 
1974     /**
1975         The value to be multiplied by the source RGB value.
1976     */
1977     SDL_GPUBlendFactor src_color_blendfactor;
1978 
1979     /**
1980         The value to be multiplied by the destination RGB value.
1981     */
1982     SDL_GPUBlendFactor dst_color_blendfactor;
1983 
1984     /**
1985         The blend operation for the RGB components.
1986     */
1987     SDL_GPUBlendOp color_blend_op;
1988 
1989     /**
1990         The value to be multiplied by the source alpha.
1991     */
1992     SDL_GPUBlendFactor src_alpha_blendfactor;
1993 
1994     /**
1995         The value to be multiplied by the destination alpha.
1996     */
1997     SDL_GPUBlendFactor dst_alpha_blendfactor;
1998 
1999     /**
2000         The blend operation for the alpha component.
2001     */
2002     SDL_GPUBlendOp alpha_blend_op;
2003 
2004     /**
2005         A bitmask specifying which of the RGBA components are enabled for writing. Writes to all channels if enable_color_write_mask is false.
2006     */
2007     SDL_GPUColorComponentFlags color_write_mask;
2008 
2009     /**
2010         Whether blending is enabled for the color target.
2011     */
2012     bool enable_blend;
2013 
2014     /**
2015         Whether the color write mask is enabled.
2016     */
2017     bool enable_color_write_mask;
2018     Uint8 padding1;
2019     Uint8 padding2;
2020 }
2021 
2022 /**
2023     A structure specifying code and metadata for creating a shader object.
2024     
2025 
2026     See_Also:
2027         $(D SDL_CreateGPUShader)
2028 */
2029 struct SDL_GPUShaderCreateInfo {
2030 
2031     /**
2032         The size in bytes of the code pointed to.
2033     */
2034     size_t code_size;
2035 
2036     /**
2037         A pointer to shader code.
2038     */
2039     const(Uint8)* code;
2040 
2041     /**
2042         A pointer to a null-terminated UTF-8 string specifying the entry point function name for the shader.
2043     */
2044     const(char)* entrypoint;
2045 
2046     /**
2047         The format of the shader code.
2048     */
2049     SDL_GPUShaderFormat format;
2050 
2051     /**
2052         The stage the shader program corresponds to.
2053     */
2054     SDL_GPUShaderStage stage;
2055 
2056     /**
2057         The number of samplers defined in the shader.
2058     */
2059     Uint32 num_samplers;
2060 
2061     /**
2062         The number of storage textures defined in the shader.
2063     */
2064     Uint32 num_storage_textures;
2065 
2066     /**
2067         The number of storage buffers defined in the shader.
2068     */
2069     Uint32 num_storage_buffers;
2070 
2071     /**
2072         The number of uniform buffers defined in the shader.
2073     */
2074     Uint32 num_uniform_buffers;
2075 
2076 
2077     /**
2078         A properties ID for extensions. Should be 0 if no extensions are needed.
2079     */
2080     SDL_PropertiesID props;
2081 }
2082 
2083 /**
2084     A structure specifying the parameters of a texture.
2085     
2086     Usage flags can be bitwise OR'd together for combinations of usages. Note
2087     that certain usage combinations are invalid, for example SAMPLER and
2088     GRAPHICS_STORAGE.
2089     
2090 
2091     See_Also:
2092         $(D SDL_CreateGPUTexture)
2093         $(D SDL_GPUTextureType)
2094         $(D SDL_GPUTextureFormat)
2095         $(D SDL_GPUTextureUsageFlags)
2096         $(D SDL_GPUSampleCount)
2097 */
2098 struct SDL_GPUTextureCreateInfo {
2099 
2100     /**
2101         The base dimensionality of the texture.
2102     */
2103     SDL_GPUTextureType type;
2104 
2105     /**
2106         The pixel format of the texture.
2107     */
2108     SDL_GPUTextureFormat format;
2109 
2110     /**
2111         How the texture is intended to be used by the client.
2112     */
2113     SDL_GPUTextureUsageFlags usage;
2114 
2115     /**
2116         The width of the texture.
2117     */
2118     Uint32 width;
2119 
2120     /**
2121         The height of the texture.
2122     */
2123     Uint32 height;
2124 
2125     /**
2126         The layer count or depth of the texture. This value is treated as a layer count on 2D array textures, and as a depth value on 3D textures.
2127     */
2128     Uint32 layer_count_or_depth;
2129 
2130     /**
2131         The number of mip levels in the texture.
2132     */
2133     Uint32 num_levels;
2134 
2135     /**
2136         The number of samples per texel. Only applies if the texture is used as a render target.
2137     */
2138     SDL_GPUSampleCount sample_count;
2139 
2140 
2141     /**
2142         A properties ID for extensions. Should be 0 if no extensions are needed.
2143     */
2144     SDL_PropertiesID props;
2145 }
2146 
2147 /**
2148     A structure specifying the parameters of a buffer.
2149     
2150     Usage flags can be bitwise OR'd together for combinations of usages. Note
2151     that certain combinations are invalid, for example VERTEX and INDEX.
2152     
2153 
2154     See_Also:
2155         $(D SDL_CreateGPUBuffer)
2156         $(D SDL_GPUBufferUsageFlags)
2157 */
2158 struct SDL_GPUBufferCreateInfo {
2159 
2160     /**
2161         How the buffer is intended to be used by the client.
2162     */
2163     SDL_GPUBufferUsageFlags usage;
2164 
2165     /**
2166         The size in bytes of the buffer.
2167     */
2168     Uint32 size;
2169 
2170 
2171     /**
2172         A properties ID for extensions. Should be 0 if no extensions are needed.
2173     */
2174     SDL_PropertiesID props;
2175 }
2176 
2177 /**
2178     A structure specifying the parameters of a transfer buffer.
2179     
2180 
2181     See_Also:
2182         $(D SDL_CreateGPUTransferBuffer)
2183 */
2184 struct SDL_GPUTransferBufferCreateInfo {
2185 
2186     /**
2187         How the transfer buffer is intended to be used by the client.
2188     */
2189     SDL_GPUTransferBufferUsage usage;
2190 
2191     /**
2192         The size in bytes of the transfer buffer.
2193     */
2194     Uint32 size;
2195 
2196 
2197     /**
2198         A properties ID for extensions. Should be 0 if no extensions are needed.
2199     */
2200     SDL_PropertiesID props;
2201 }
2202 
2203 /**
2204     A structure specifying the parameters of the graphics pipeline rasterizer
2205     state.
2206     
2207     NOTE: Some backend APIs (D3D11/12) will enable depth clamping even if
2208     enable_depth_clip is true. If you rely on this clamp+clip behavior,
2209     consider enabling depth clip and then manually clamping depth in your
2210     fragment shaders on Metal and Vulkan.
2211     
2212 
2213     See_Also:
2214         $(D SDL_GPUGraphicsPipelineCreateInfo)
2215 */
2216 struct SDL_GPURasterizerState {
2217 
2218     /**
2219         Whether polygons will be filled in or drawn as lines.
2220     */
2221     SDL_GPUFillMode fill_mode;
2222 
2223     /**
2224         The facing direction in which triangles will be culled.
2225     */
2226     SDL_GPUCullMode cull_mode;
2227 
2228     /**
2229         The vertex winding that will cause a triangle to be determined as front-facing.
2230     */
2231     SDL_GPUFrontFace front_face;
2232 
2233     /**
2234         A scalar factor controlling the depth value added to each fragment.
2235     */
2236     float depth_bias_constant_factor;
2237 
2238     /**
2239         The maximum depth bias of a fragment.
2240     */
2241     float depth_bias_clamp;
2242 
2243     /**
2244         A scalar factor applied to a fragment's slope in depth calculations.
2245     */
2246     float depth_bias_slope_factor;
2247 
2248     /**
2249         true to bias fragment depth values.
2250     */
2251     bool enable_depth_bias;
2252 
2253     /**
2254         true to enable depth clip, false to enable depth clamp.
2255     */
2256     bool enable_depth_clip;
2257     Uint8 padding1;
2258     Uint8 padding2;
2259 }
2260 
2261 /**
2262     A structure specifying the parameters of the graphics pipeline multisample
2263     state.
2264     
2265 
2266     See_Also:
2267         $(D SDL_GPUGraphicsPipelineCreateInfo)
2268 */
2269 struct SDL_GPUMultisampleState {
2270 
2271     /**
2272         The number of samples to be used in rasterization.
2273     */
2274     SDL_GPUSampleCount sample_count;
2275 
2276     /**
2277         Determines which samples get updated in the render targets. Treated as 0xFFFFFFFF if enable_mask is false.
2278     */
2279     Uint32 sample_mask;
2280 
2281     /**
2282         Enables sample masking.
2283     */
2284     bool enable_mask;
2285     Uint8 padding1;
2286     Uint8 padding2;
2287     Uint8 padding3;
2288 }
2289 
2290 /**
2291     A structure specifying the parameters of the graphics pipeline depth
2292     stencil state.
2293     
2294 
2295     See_Also:
2296         $(D SDL_GPUGraphicsPipelineCreateInfo)
2297 */
2298 struct SDL_GPUDepthStencilState {
2299 
2300     /**
2301         The comparison operator used for depth testing.
2302     */
2303     SDL_GPUCompareOp compare_op;
2304 
2305     /**
2306         The stencil op state for back-facing triangles.
2307     */
2308     SDL_GPUStencilOpState back_stencil_state;
2309 
2310     /**
2311         The stencil op state for front-facing triangles.
2312     */
2313     SDL_GPUStencilOpState front_stencil_state;
2314 
2315     /**
2316         Selects the bits of the stencil values participating in the stencil test.
2317     */
2318     Uint8 compare_mask;
2319 
2320     /**
2321         Selects the bits of the stencil values updated by the stencil test.
2322     */
2323     Uint8 write_mask;
2324 
2325     /**
2326         true enables the depth test.
2327     */
2328     bool enable_depth_test;
2329 
2330     /**
2331         true enables depth writes. Depth writes are always disabled when enable_depth_test is false.
2332     */
2333     bool enable_depth_write;
2334 
2335     /**
2336         true enables the stencil test.
2337     */
2338     bool enable_stencil_test;
2339     Uint8 padding1;
2340     Uint8 padding2;
2341     Uint8 padding3;
2342 }
2343 
2344 /**
2345     A structure specifying the parameters of color targets used in a graphics
2346     pipeline.
2347     
2348 
2349     See_Also:
2350         $(D SDL_GPUGraphicsPipelineTargetInfo)
2351 */
2352 struct SDL_GPUColorTargetDescription {
2353 
2354     /**
2355         The pixel format of the texture to be used as a color target.
2356     */
2357     SDL_GPUTextureFormat format;
2358 
2359     /**
2360         The blend state to be used for the color target.
2361     */
2362     SDL_GPUColorTargetBlendState blend_state;
2363 }
2364 
2365 /**
2366     A structure specifying the descriptions of render targets used in a
2367     graphics pipeline.
2368     
2369 
2370     See_Also:
2371         $(D SDL_GPUGraphicsPipelineCreateInfo)
2372 */
2373 struct SDL_GPUGraphicsPipelineTargetInfo {
2374 
2375     /**
2376         A pointer to an array of color target descriptions.
2377     */
2378     const(SDL_GPUColorTargetDescription)* color_target_descriptions;
2379 
2380     /**
2381         The number of color target descriptions in the above array.
2382     */
2383     Uint32 num_color_targets;
2384 
2385     /**
2386         The pixel format of the depth-stencil target. Ignored if has_depth_stencil_target is false.
2387     */
2388     SDL_GPUTextureFormat depth_stencil_format;
2389 
2390     /**
2391         true specifies that the pipeline uses a depth-stencil target.
2392     */
2393     bool has_depth_stencil_target;
2394     Uint8 padding1;
2395     Uint8 padding2;
2396     Uint8 padding3;
2397 }
2398 
2399 /**
2400     A structure specifying the parameters of a graphics pipeline state.
2401     
2402 
2403     See_Also:
2404         $(D SDL_CreateGPUGraphicsPipeline)
2405         $(D SDL_GPUShader)
2406         $(D SDL_GPUVertexInputState)
2407         $(D SDL_GPUPrimitiveType)
2408         $(D SDL_GPURasterizerState)
2409         $(D SDL_GPUMultisampleState)
2410         $(D SDL_GPUDepthStencilState)
2411         $(D SDL_GPUGraphicsPipelineTargetInfo)
2412 */
2413 struct SDL_GPUGraphicsPipelineCreateInfo {
2414 
2415     /**
2416         The vertex shader used by the graphics pipeline.
2417     */
2418     SDL_GPUShader* vertex_shader;
2419 
2420     /**
2421         The fragment shader used by the graphics pipeline.
2422     */
2423     SDL_GPUShader* fragment_shader;
2424 
2425     /**
2426         The vertex layout of the graphics pipeline.
2427     */
2428     SDL_GPUVertexInputState vertex_input_state;
2429 
2430     /**
2431         The primitive topology of the graphics pipeline.
2432     */
2433     SDL_GPUPrimitiveType primitive_type;
2434 
2435     /**
2436         The rasterizer state of the graphics pipeline.
2437     */
2438     SDL_GPURasterizerState rasterizer_state;
2439 
2440     /**
2441         The multisample state of the graphics pipeline.
2442     */
2443     SDL_GPUMultisampleState multisample_state;
2444 
2445     /**
2446         The depth-stencil state of the graphics pipeline.
2447     */
2448     SDL_GPUDepthStencilState depth_stencil_state;
2449 
2450     /**
2451         Formats and blend modes for the render targets of the graphics pipeline.
2452     */
2453     SDL_GPUGraphicsPipelineTargetInfo target_info;
2454 
2455 
2456     /**
2457         A properties ID for extensions. Should be 0 if no extensions are needed.
2458     */
2459     SDL_PropertiesID props;
2460 }
2461 
2462 /**
2463     A structure specifying the parameters of a compute pipeline state.
2464     
2465 
2466     See_Also:
2467         $(D SDL_CreateGPUComputePipeline)
2468         $(D SDL_GPUShaderFormat)
2469 */
2470 struct SDL_GPUComputePipelineCreateInfo {
2471 
2472     /**
2473         The size in bytes of the compute shader code pointed to.
2474     */
2475     size_t code_size;
2476 
2477     /**
2478         A pointer to compute shader code.
2479     */
2480     const(Uint8)* code;
2481 
2482     /**
2483         A pointer to a null-terminated UTF-8 string specifying the entry point function name for the shader.
2484     */
2485     const(char)* entrypoint;
2486 
2487     /**
2488         The format of the compute shader code.
2489     */
2490     SDL_GPUShaderFormat format;
2491 
2492     /**
2493         The number of samplers defined in the shader.
2494     */
2495     Uint32 num_samplers;
2496 
2497     /**
2498         The number of readonly storage textures defined in the shader.
2499     */
2500     Uint32 num_readonly_storage_textures;
2501 
2502     /**
2503         The number of readonly storage buffers defined in the shader.
2504     */
2505     Uint32 num_readonly_storage_buffers;
2506 
2507     /**
2508         The number of read-write storage textures defined in the shader.
2509     */
2510     Uint32 num_readwrite_storage_textures;
2511 
2512     /**
2513         The number of read-write storage buffers defined in the shader.
2514     */
2515     Uint32 num_readwrite_storage_buffers;
2516 
2517     /**
2518         The number of uniform buffers defined in the shader.
2519     */
2520     Uint32 num_uniform_buffers;
2521 
2522     /**
2523         The number of threads in the X dimension. This should match the value in the shader.
2524     */
2525     Uint32 threadcount_x;
2526 
2527     /**
2528         The number of threads in the Y dimension. This should match the value in the shader.
2529     */
2530     Uint32 threadcount_y;
2531 
2532     /**
2533         The number of threads in the Z dimension. This should match the value in the shader.
2534     */
2535     Uint32 threadcount_z;
2536 
2537 
2538     /**
2539         A properties ID for extensions. Should be 0 if no extensions are needed.
2540     */
2541     SDL_PropertiesID props;
2542 }
2543 
2544 /**
2545     A structure specifying the parameters of a color target used by a render
2546     pass.
2547     
2548     The load_op field determines what is done with the texture at the beginning
2549     of the render pass.
2550     
2551     - LOAD: Loads the data currently in the texture. Not recommended for
2552     multisample textures as it requires significant memory bandwidth.
2553     - CLEAR: Clears the texture to a single color.
2554     - DONT_CARE: The driver will do whatever it wants with the texture memory.
2555     This is a good option if you know that every single pixel will be touched
2556     in the render pass.
2557     
2558     The store_op field determines what is done with the color results of the
2559     render pass.
2560     
2561     - STORE: Stores the results of the render pass in the texture. Not
2562     recommended for multisample textures as it requires significant memory
2563     bandwidth.
2564     - DONT_CARE: The driver will do whatever it wants with the texture memory.
2565     This is often a good option for depth/stencil textures.
2566     - RESOLVE: Resolves a multisample texture into resolve_texture, which must
2567     have a sample count of 1. Then the driver may discard the multisample
2568     texture memory. This is the most performant method of resolving a
2569     multisample target.
2570     - RESOLVE_AND_STORE: Resolves a multisample texture into the
2571     resolve_texture, which must have a sample count of 1. Then the driver
2572     stores the multisample texture's contents. Not recommended as it requires
2573     significant memory bandwidth.
2574     
2575 
2576     See_Also:
2577         $(D SDL_BeginGPURenderPass)
2578 */
2579 struct SDL_GPUColorTargetInfo {
2580 
2581     /**
2582         The texture that will be used as a color target by a render pass.
2583     */
2584     SDL_GPUTexture* texture;
2585 
2586     /**
2587         The mip level to use as a color target.
2588     */
2589     Uint32 mip_level;
2590 
2591     /**
2592         The layer index or depth plane to use as a color target. This value is treated as a layer index on 2D array and cube textures, and as a depth plane on 3D textures.
2593     */
2594     Uint32 layer_or_depth_plane;
2595 
2596     /**
2597         The color to clear the color target to at the start of the render pass. Ignored if SDL_GPU_LOADOP_CLEAR is not used.
2598     */
2599     SDL_FColor clear_color;
2600 
2601     /**
2602         What is done with the contents of the color target at the beginning of the render pass.
2603     */
2604     SDL_GPULoadOp load_op;
2605 
2606     /**
2607         What is done with the results of the render pass.
2608     */
2609     SDL_GPUStoreOp store_op;
2610 
2611     /**
2612         The texture that will receive the results of a multisample resolve operation. Ignored if a RESOLVE* store_op is not used.
2613     */
2614     SDL_GPUTexture* resolve_texture;
2615 
2616     /**
2617         The mip level of the resolve texture to use for the resolve operation. Ignored if a RESOLVE* store_op is not used.
2618     */
2619     Uint32 resolve_mip_level;
2620 
2621     /**
2622         The layer index of the resolve texture to use for the resolve operation. Ignored if a RESOLVE* store_op is not used.
2623     */
2624     Uint32 resolve_layer;
2625 
2626     /**
2627         true cycles the texture if the texture is bound and load_op is not LOAD
2628     */
2629     bool cycle;
2630 
2631     /**
2632         true cycles the resolve texture if the resolve texture is bound. Ignored if a RESOLVE* store_op is not used.
2633     */
2634     bool cycle_resolve_texture;
2635     Uint8 padding1;
2636     Uint8 padding2;
2637 }
2638 
2639 /**
2640     A structure specifying the parameters of a depth-stencil target used by a
2641     render pass.
2642     
2643     The load_op field determines what is done with the depth contents of the
2644     texture at the beginning of the render pass.
2645     
2646     - LOAD: Loads the depth values currently in the texture.
2647     - CLEAR: Clears the texture to a single depth.
2648     - DONT_CARE: The driver will do whatever it wants with the memory. This is
2649     a good option if you know that every single pixel will be touched in the
2650     render pass.
2651     
2652     The store_op field determines what is done with the depth results of the
2653     render pass.
2654     
2655     - STORE: Stores the depth results in the texture.
2656     - DONT_CARE: The driver will do whatever it wants with the depth results.
2657     This is often a good option for depth/stencil textures that don't need to
2658     be reused again.
2659     
2660     The stencil_load_op field determines what is done with the stencil contents
2661     of the texture at the beginning of the render pass.
2662     
2663     - LOAD: Loads the stencil values currently in the texture.
2664     - CLEAR: Clears the stencil values to a single value.
2665     - DONT_CARE: The driver will do whatever it wants with the memory. This is
2666     a good option if you know that every single pixel will be touched in the
2667     render pass.
2668     
2669     The stencil_store_op field determines what is done with the stencil results
2670     of the render pass.
2671     
2672     - STORE: Stores the stencil results in the texture.
2673     - DONT_CARE: The driver will do whatever it wants with the stencil results.
2674     This is often a good option for depth/stencil textures that don't need to
2675     be reused again.
2676     
2677     Note that depth/stencil targets do not support multisample resolves.
2678     
2679 
2680     See_Also:
2681         $(D SDL_BeginGPURenderPass)
2682 */
2683 struct SDL_GPUDepthStencilTargetInfo {
2684 
2685     /**
2686         The texture that will be used as the depth stencil target by the render pass.
2687     */
2688     SDL_GPUTexture* texture;
2689 
2690     /**
2691         The value to clear the depth component to at the beginning of the render pass. Ignored if SDL_GPU_LOADOP_CLEAR is not used.
2692     */
2693     float clear_depth;
2694 
2695     /**
2696         What is done with the depth contents at the beginning of the render pass.
2697     */
2698     SDL_GPULoadOp load_op;
2699 
2700     /**
2701         What is done with the depth results of the render pass.
2702     */
2703     SDL_GPUStoreOp store_op;
2704 
2705     /**
2706         What is done with the stencil contents at the beginning of the render pass.
2707     */
2708     SDL_GPULoadOp stencil_load_op;
2709 
2710     /**
2711         What is done with the stencil results of the render pass.
2712     */
2713     SDL_GPUStoreOp stencil_store_op;
2714 
2715     /**
2716         true cycles the texture if the texture is bound and any load ops are not LOAD
2717     */
2718     bool cycle;
2719 
2720     /**
2721         The value to clear the stencil component to at the beginning of the render pass. Ignored if SDL_GPU_LOADOP_CLEAR is not used.
2722     */
2723     Uint8 clear_stencil;
2724     Uint8 padding1;
2725     Uint8 padding2;
2726 }
2727 
2728 /**
2729     A structure containing parameters for a blit command.
2730     
2731 
2732     See_Also:
2733         $(D SDL_BlitGPUTexture)
2734 */
2735 struct SDL_GPUBlitInfo {
2736 
2737     /**
2738         The source region for the blit.
2739     */
2740     SDL_GPUBlitRegion source;
2741 
2742     /**
2743         The destination region for the blit.
2744     */
2745     SDL_GPUBlitRegion destination;
2746 
2747     /**
2748         What is done with the contents of the destination before the blit.
2749     */
2750     SDL_GPULoadOp load_op;
2751 
2752     /**
2753         The color to clear the destination region to before the blit. Ignored if load_op is not SDL_GPU_LOADOP_CLEAR.
2754     */
2755     SDL_FColor clear_color;
2756 
2757     /**
2758         The flip mode for the source region.
2759     */
2760     SDL_FlipMode flip_mode;
2761 
2762     /**
2763         The filter mode used when blitting.
2764     */
2765     SDL_GPUFilter filter;
2766 
2767     /**
2768         true cycles the destination texture if it is already bound.
2769     */
2770     bool cycle;
2771     Uint8 padding1;
2772     Uint8 padding2;
2773     Uint8 padding3;
2774 }
2775 
2776 /**
2777     A structure specifying parameters in a buffer binding call.
2778     
2779 
2780     See_Also:
2781         $(D SDL_BindGPUVertexBuffers)
2782         $(D SDL_BindGPUIndexBuffer)
2783 */
2784 struct SDL_GPUBufferBinding {
2785 
2786     /**
2787         The buffer to bind. Must have been created with SDL_GPU_BUFFERUSAGE_VERTEX for SDL_BindGPUVertexBuffers, or SDL_GPU_BUFFERUSAGE_INDEX for SDL_BindGPUIndexBuffer.
2788     */
2789     SDL_GPUBuffer* buffer;
2790 
2791     /**
2792         The starting byte of the data to bind in the buffer.
2793     */
2794     Uint32 offset;
2795 }
2796 
2797 /**
2798     A structure specifying parameters in a sampler binding call.
2799     
2800 
2801     See_Also:
2802         $(D SDL_BindGPUVertexSamplers)
2803         $(D SDL_BindGPUFragmentSamplers)
2804 */
2805 struct SDL_GPUTextureSamplerBinding {
2806 
2807     /**
2808         The texture to bind. Must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER.
2809     */
2810     SDL_GPUTexture* texture;
2811 
2812     /**
2813         The sampler to bind.
2814     */
2815     SDL_GPUSampler* sampler;
2816 }
2817 
2818 /**
2819     A structure specifying parameters related to binding buffers in a compute
2820     pass.
2821     
2822 
2823     See_Also:
2824         $(D SDL_BeginGPUComputePass)
2825 */
2826 struct SDL_GPUStorageBufferReadWriteBinding {
2827 
2828     /**
2829         The buffer to bind. Must have been created with SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE.
2830     */
2831     SDL_GPUBuffer* buffer;
2832 
2833     /**
2834         true cycles the buffer if it is already bound.
2835     */
2836     bool cycle;
2837     Uint8 padding1;
2838     Uint8 padding2;
2839     Uint8 padding3;
2840 }
2841 
2842 /**
2843     A structure specifying parameters related to binding textures in a compute
2844     pass.
2845     
2846 
2847     See_Also:
2848         $(D SDL_BeginGPUComputePass)
2849 */
2850 struct SDL_GPUStorageTextureReadWriteBinding {
2851 
2852     /**
2853         The texture to bind. Must have been created with SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE or SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE.
2854     */
2855     SDL_GPUTexture* texture;
2856 
2857     /**
2858         The mip level index to bind.
2859     */
2860     Uint32 mip_level;
2861 
2862     /**
2863         The layer index to bind.
2864     */
2865     Uint32 layer;
2866 
2867     /**
2868         true cycles the texture if it is already bound.
2869     */
2870     bool cycle;
2871     Uint8 padding1;
2872     Uint8 padding2;
2873     Uint8 padding3;
2874 }
2875 
2876 /**
2877     Checks for GPU runtime support.
2878     
2879     Params:
2880         format_flags =  a bitflag indicating which shader formats the app is
2881                         able to provide.
2882         name =          the preferred GPU driver, or NULL to let SDL pick the optimal
2883                         driver.
2884     Returns:
2885         true if supported, false otherwise.
2886     
2887     See_Also:
2888         $(D SDL_CreateGPUDevice)
2889 */
2890 extern bool SDL_GPUSupportsShaderFormats(
2891     SDL_GPUShaderFormat format_flags,
2892     const(char)* name);
2893 
2894 /**
2895     Checks for GPU runtime support.
2896     
2897     Params:
2898         props = the properties to use.
2899 
2900     Returns:
2901         true if supported, false otherwise.
2902 
2903     See_Also:
2904         $(D SDL_CreateGPUDeviceWithProperties)
2905 */
2906 extern bool SDL_GPUSupportsProperties(
2907     SDL_PropertiesID props);
2908 
2909 /**
2910     Creates a GPU context.
2911     
2912     Params:
2913         format_flags =  a bitflag indicating which shader formats the app is
2914                         able to provide.
2915         debug_mode =    enable debug mode properties and validations.
2916         name =          the preferred GPU driver, or NULL to let SDL pick the optimal
2917                         driver.
2918 
2919     Returns:
2920         a GPU context on success or NULL on failure; call SDL_GetError()
2921         for more information.
2922 
2923     See_Also:
2924         $(D SDL_GetGPUShaderFormats)
2925         $(D SDL_GetGPUDeviceDriver)
2926         $(D SDL_DestroyGPUDevice)
2927         $(D SDL_GPUSupportsShaderFormats)
2928 */
2929 extern SDL_GPUDevice* SDL_CreateGPUDevice(
2930     SDL_GPUShaderFormat format_flags,
2931     bool debug_mode,
2932     const(char)* name);
2933 
2934 /**
2935     Creates a GPU context.
2936     
2937     These are the supported properties:
2938     
2939     - `SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN`: enable debug mode
2940     properties and validations, defaults to true.
2941     - `SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN`: enable to prefer
2942     energy efficiency over maximum GPU performance, defaults to false.
2943     - `SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING`: the name of the GPU driver to
2944     use, if a specific one is desired.
2945     
2946     These are the current shader format properties:
2947     
2948     - `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN`: The app is able to
2949     provide shaders for an NDA platform.
2950     - `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOLEAN`: The app is able to
2951     provide SPIR-V shaders if applicable.
2952     - `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN`: The app is able to
2953     provide DXBC shaders if applicable
2954     - `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN`: The app is able to
2955     provide DXIL shaders if applicable.
2956     - `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN`: The app is able to
2957     provide MSL shaders if applicable.
2958     - `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN`: The app is able to
2959     provide Metal shader libraries if applicable.
2960     
2961     With the D3D12 renderer:
2962     
2963     - `SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING`: the prefix to
2964     use for all vertex semantics, default is "TEXCOORD".
2965     
2966     Params:
2967         props = the properties to use.
2968 
2969     Returns:
2970         a GPU context on success or NULL on failure; call SDL_GetError()
2971         for more information.
2972     
2973     See_Also:
2974         $(D SDL_GetGPUShaderFormats)
2975         $(D SDL_GetGPUDeviceDriver)
2976         $(D SDL_DestroyGPUDevice)
2977         $(D SDL_GPUSupportsProperties)
2978 */
2979 extern SDL_GPUDevice* SDL_CreateGPUDeviceWithProperties(
2980     SDL_PropertiesID props);
2981 
2982 enum SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN = "SDL.gpu.device.create.debugmode";
2983 enum SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN = "SDL.gpu.device.create.preferlowpower";
2984 enum SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING = "SDL.gpu.device.create.name";
2985 enum SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN = "SDL.gpu.device.create.shaders.private";
2986 enum SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOLEAN = "SDL.gpu.device.create.shaders.spirv";
2987 enum SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN = "SDL.gpu.device.create.shaders.dxbc";
2988 enum SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN = "SDL.gpu.device.create.shaders.dxil";
2989 enum SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN = "SDL.gpu.device.create.shaders.msl";
2990 enum SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN = "SDL.gpu.device.create.shaders.metallib";
2991 enum SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING = "SDL.gpu.device.create.d3d12.semantic";
2992 
2993 /**
2994     Destroys a GPU context previously returned by SDL_CreateGPUDevice.
2995     
2996     Params:
2997         device = a GPU Context to destroy.
2998     
2999     See_Also:
3000         $(D SDL_CreateGPUDevice)
3001 */
3002 extern void SDL_DestroyGPUDevice(SDL_GPUDevice* device);
3003 
3004 /**
3005     Get the number of GPU drivers compiled into SDL.
3006     
3007     Returns:
3008         the number of built in GPU drivers.
3009     
3010     See_Also:
3011         $(D SDL_GetGPUDriver)
3012 */
3013 extern int SDL_GetNumGPUDrivers();
3014 
3015 /**
3016     Get the name of a built in GPU driver.
3017     
3018     The GPU drivers are presented in the order in which they are normally
3019     checked during initialization.
3020     
3021     The names of drivers are all simple, low-ASCII identifiers, like "vulkan",
3022     "metal" or "direct3d12". These never have Unicode characters, and are not
3023     meant to be proper names.
3024     
3025     Params:
3026         index = the index of a GPU driver.
3027     
3028     Returns:
3029         the name of the GPU driver with the given **index**.
3030     
3031     See_Also:
3032         $(D SDL_GetNumGPUDrivers)
3033 */
3034 extern const(char)* SDL_GetGPUDriver(int index);
3035 
3036 /**
3037     Returns the name of the backend used to create this GPU context.
3038     
3039     Params:
3040         device = a GPU context to query.
3041     
3042     Returns:
3043         the name of the device's driver, or NULL on error.
3044 */
3045 extern const(char)* SDL_GetGPUDeviceDriver(SDL_GPUDevice* device);
3046 
3047 /**
3048     Returns the supported shader formats for this GPU context.
3049     
3050     Params:
3051         device = a GPU context to query.
3052     
3053     Returns:
3054         a bitflag indicating which shader formats the driver is able to
3055         consume.
3056 */
3057 extern SDL_GPUShaderFormat SDL_GetGPUShaderFormats(SDL_GPUDevice* device);
3058 
3059 /* State Creation */
3060 
3061 /**
3062     Creates a pipeline object to be used in a compute workflow.
3063     
3064     Shader resource bindings must be authored to follow a particular order
3065     depending on the shader format.
3066     
3067     For SPIR-V shaders, use the following resource sets:
3068     
3069     - 0: Sampled textures, followed by read-only storage textures, followed by
3070     read-only storage buffers
3071     - 1: Read-write storage textures, followed by read-write storage buffers
3072     - 2: Uniform buffers
3073     
3074     For DXBC and DXIL shaders, use the following register order:
3075     
3076     - (t[n], space0): Sampled textures, followed by read-only storage textures,
3077     followed by read-only storage buffers
3078     - (u[n], space1): Read-write storage textures, followed by read-write
3079     storage buffers
3080     - (b[n], space2): Uniform buffers
3081     
3082     For MSL/metallib, use the following order:
3083     
3084     - [[buffer]]: Uniform buffers, followed by read-only storage buffers,
3085     followed by read-write storage buffers
3086     - [[texture]]: Sampled textures, followed by read-only storage textures,
3087     followed by read-write storage textures
3088     
3089     There are optional properties that can be provided through `props`. These
3090     are the supported properties:
3091     
3092     - `SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING`: a name that can be
3093     displayed in debugging tools.
3094     
3095     Params:
3096         device =        a GPU Context.
3097         createinfo =    a struct describing the state of the compute pipeline to
3098                         create.
3099 
3100     Returns:
3101         a compute pipeline object on success, or NULL on failure; call
3102         SDL_GetError() for more information.
3103     
3104     See_Also:
3105         $(D SDL_BindGPUComputePipeline)
3106         $(D SDL_ReleaseGPUComputePipeline)
3107 */
3108 extern SDL_GPUComputePipeline* SDL_CreateGPUComputePipeline(
3109     SDL_GPUDevice* device,
3110     const(SDL_GPUComputePipelineCreateInfo)* createinfo);
3111 
3112 enum SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING = "SDL.gpu.computepipeline.create.name";
3113 
3114 /**
3115     Creates a pipeline object to be used in a graphics workflow.
3116     
3117     There are optional properties that can be provided through `props`. These
3118     are the supported properties:
3119     
3120     - `SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING`: a name that can be
3121     displayed in debugging tools.
3122     
3123     Params:
3124         device =        a GPU Context.
3125         createinfo =    a struct describing the state of the graphics pipeline to
3126                         create.
3127     
3128     Returns:
3129         a graphics pipeline object on success, or NULL on failure; call
3130         SDL_GetError() for more information.
3131     
3132     See_Also:
3133         $(D SDL_CreateGPUShader)
3134         $(D SDL_BindGPUGraphicsPipeline)
3135         $(D SDL_ReleaseGPUGraphicsPipeline)
3136 */
3137 extern SDL_GPUGraphicsPipeline* SDL_CreateGPUGraphicsPipeline(
3138     SDL_GPUDevice* device,
3139     const(SDL_GPUGraphicsPipelineCreateInfo)* createinfo);
3140 
3141 enum SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING = "SDL.gpu.graphicspipeline.create.name";
3142 
3143 /**
3144     Creates a sampler object to be used when binding textures in a graphics
3145     workflow.
3146     
3147     There are optional properties that can be provided through `props`. These
3148     are the supported properties:
3149     
3150     - `SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING`: a name that can be displayed
3151     in debugging tools.
3152     
3153     Params:
3154         device =        a GPU Context.
3155         createinfo =    a struct describing the state of the sampler to create.
3156     
3157     Returns:
3158         a sampler object on success, or NULL on failure; call
3159         SDL_GetError() for more information.
3160     
3161     See_Also:
3162         $(D SDL_BindGPUVertexSamplers)
3163         $(D SDL_BindGPUFragmentSamplers)
3164         $(D SDL_ReleaseGPUSampler)
3165 */
3166 extern SDL_GPUSampler* SDL_CreateGPUSampler(
3167     SDL_GPUDevice* device,
3168     const(SDL_GPUSamplerCreateInfo)* createinfo);
3169 
3170 enum SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING = "SDL.gpu.sampler.create.name";
3171 
3172 /**
3173     Creates a shader to be used when creating a graphics pipeline.
3174     
3175     Shader resource bindings must be authored to follow a particular order
3176     depending on the shader format.
3177     
3178     For SPIR-V shaders, use the following resource sets:
3179     
3180     For vertex shaders:
3181     
3182     - 0: Sampled textures, followed by storage textures, followed by storage
3183     buffers
3184     - 1: Uniform buffers
3185     
3186     For fragment shaders:
3187     
3188     - 2: Sampled textures, followed by storage textures, followed by storage
3189     buffers
3190     - 3: Uniform buffers
3191     
3192     For DXBC and DXIL shaders, use the following register order:
3193     
3194     For vertex shaders:
3195     
3196     - (t[n], space0): Sampled textures, followed by storage textures, followed
3197     by storage buffers
3198     - (s[n], space0): Samplers with indices corresponding to the sampled
3199     textures
3200     - (b[n], space1): Uniform buffers
3201     
3202     For pixel shaders:
3203     
3204     - (t[n], space2): Sampled textures, followed by storage textures, followed
3205     by storage buffers
3206     - (s[n], space2): Samplers with indices corresponding to the sampled
3207     textures
3208     - (b[n], space3): Uniform buffers
3209     
3210     For MSL/metallib, use the following order:
3211     
3212     - [[texture]]: Sampled textures, followed by storage textures
3213     - [[sampler]]: Samplers with indices corresponding to the sampled textures
3214     - [[buffer]]: Uniform buffers, followed by storage buffers. Vertex buffer 0
3215     is bound at [[buffer(14)]], vertex buffer 1 at [[buffer(15)]], and so on.
3216     Rather than manually authoring vertex buffer indices, use the
3217     [[stage_in]] attribute which will automatically use the vertex input
3218     information from the SDL_GPUGraphicsPipeline.
3219     
3220     Shader semantics other than system-value semantics do not matter in D3D12
3221     and for ease of use the SDL implementation assumes that non system-value
3222     semantics will all be TEXCOORD. If you are using HLSL as the shader source
3223     language, your vertex semantics should start at TEXCOORD0 and increment
3224     like so: TEXCOORD1, TEXCOORD2, etc. If you wish to change the semantic
3225     prefix to something other than TEXCOORD you can use
3226     SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING with
3227     SDL_CreateGPUDeviceWithProperties().
3228     
3229     There are optional properties that can be provided through `props`. These
3230     are the supported properties:
3231     
3232     - `SDL_PROP_GPU_SHADER_CREATE_NAME_STRING`: a name that can be displayed in
3233     debugging tools.
3234     
3235     Params:
3236         device =        a GPU Context.
3237         createinfo =    a struct describing the state of the shader to create.
3238     
3239     Returns:
3240         a shader object on success, or NULL on failure; call
3241         SDL_GetError() for more information.
3242     
3243     See_Also:
3244         $(D SDL_CreateGPUGraphicsPipeline)
3245         $(D SDL_ReleaseGPUShader)
3246 */
3247 extern SDL_GPUShader* SDL_CreateGPUShader(
3248     SDL_GPUDevice* device,
3249     const(SDL_GPUShaderCreateInfo)* createinfo);
3250 
3251 enum SDL_PROP_GPU_SHADER_CREATE_NAME_STRING = "SDL.gpu.shader.create.name";
3252 
3253 /**
3254     Creates a texture object to be used in graphics or compute workflows.
3255     
3256     The contents of this texture are undefined until data is written to the
3257     texture.
3258     
3259     Note that certain combinations of usage flags are invalid. For example, a
3260     texture cannot have both the SAMPLER and GRAPHICS_STORAGE_READ flags.
3261     
3262     If you request a sample count higher than the hardware supports, the
3263     implementation will automatically fall back to the highest available sample
3264     count.
3265     
3266     There are optional properties that can be provided through
3267     SDL_GPUTextureCreateInfo's `props`. These are the supported properties:
3268     
3269     - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT`: (Direct3D 12 only) if
3270     the texture usage is SDL_GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture
3271     to a color with this red intensity. Defaults to zero.
3272     - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT`: (Direct3D 12 only) if
3273     the texture usage is SDL_GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture
3274     to a color with this green intensity. Defaults to zero.
3275     - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT`: (Direct3D 12 only) if
3276     the texture usage is SDL_GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture
3277     to a color with this blue intensity. Defaults to zero.
3278     - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT`: (Direct3D 12 only) if
3279     the texture usage is SDL_GPU_TEXTUREUSAGE_COLOR_TARGET, clear the texture
3280     to a color with this alpha intensity. Defaults to zero.
3281     - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT`: (Direct3D 12 only)
3282     if the texture usage is SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET, clear
3283     the texture to a depth of this value. Defaults to zero.
3284     - `SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_UINT8`: (Direct3D 12
3285     only) if the texture usage is SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET,
3286     clear the texture to a stencil of this value. Defaults to zero.
3287     - `SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING`: a name that can be displayed
3288     in debugging tools.
3289     
3290     Params:
3291         device =        a GPU Context.
3292         createinfo =    a struct describing the state of the texture to create.
3293     
3294     Returns:
3295         a texture object on success, or NULL on failure; call
3296         SDL_GetError() for more information.
3297     
3298     See_Also:
3299         $(D SDL_UploadToGPUTexture)
3300         $(D SDL_DownloadFromGPUTexture)
3301         $(D SDL_BindGPUVertexSamplers)
3302         $(D SDL_BindGPUVertexStorageTextures)
3303         $(D SDL_BindGPUFragmentSamplers)
3304         $(D SDL_BindGPUFragmentStorageTextures)
3305         $(D SDL_BindGPUComputeStorageTextures)
3306         $(D SDL_BlitGPUTexture)
3307         $(D SDL_ReleaseGPUTexture)
3308         $(D SDL_GPUTextureSupportsFormat)
3309 */
3310 extern SDL_GPUTexture* SDL_CreateGPUTexture(
3311     SDL_GPUDevice* device,
3312     const(SDL_GPUTextureCreateInfo)* createinfo);
3313 
3314 enum SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT = "SDL.gpu.texture.create.d3d12.clear.r";
3315 enum SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT = "SDL.gpu.texture.create.d3d12.clear.g";
3316 enum SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT = "SDL.gpu.texture.create.d3d12.clear.b";
3317 enum SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT = "SDL.gpu.texture.create.d3d12.clear.a";
3318 enum SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT = "SDL.gpu.texture.create.d3d12.clear.depth";
3319 enum SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_UINT8 = "SDL.gpu.texture.create.d3d12.clear.stencil";
3320 enum SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING = "SDL.gpu.texture.create.name";
3321 
3322 /**
3323     Creates a buffer object to be used in graphics or compute workflows.
3324     
3325     The contents of this buffer are undefined until data is written to the
3326     buffer.
3327     
3328     Note that certain combinations of usage flags are invalid. For example, a
3329     buffer cannot have both the VERTEX and INDEX flags.
3330     
3331     If you use a STORAGE flag, the data in the buffer must respect std140
3332     layout conventions. In practical terms this means you must ensure that vec3
3333     and vec4 fields are 16-byte aligned.
3334     
3335     For better understanding of underlying concepts and memory management with
3336     SDL GPU API, you may refer
3337     [this blog post](https://moonside.games/posts/sdl-gpu-concepts-cycling/)
3338     .
3339     
3340     There are optional properties that can be provided through `props`. These
3341     are the supported properties:
3342     
3343     - `SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING`: a name that can be displayed in
3344     debugging tools.
3345     
3346     Params:
3347         device =        a GPU Context.
3348         createinfo =    a struct describing the state of the buffer to create.
3349 
3350     Returns:
3351         a buffer object on success, or NULL on failure; call
3352         SDL_GetError() for more information.
3353     
3354     See_Also:
3355         $(D SDL_UploadToGPUBuffer)
3356         $(D SDL_DownloadFromGPUBuffer)
3357         $(D SDL_CopyGPUBufferToBuffer)
3358         $(D SDL_BindGPUVertexBuffers)
3359         $(D SDL_BindGPUIndexBuffer)
3360         $(D SDL_BindGPUVertexStorageBuffers)
3361         $(D SDL_BindGPUFragmentStorageBuffers)
3362         $(D SDL_DrawGPUPrimitivesIndirect)
3363         $(D SDL_DrawGPUIndexedPrimitivesIndirect)
3364         $(D SDL_BindGPUComputeStorageBuffers)
3365         $(D SDL_DispatchGPUComputeIndirect)
3366         $(D SDL_ReleaseGPUBuffer)
3367 */
3368 extern SDL_GPUBuffer* SDL_CreateGPUBuffer(
3369     SDL_GPUDevice* device,
3370     const(SDL_GPUBufferCreateInfo)* createinfo);
3371 
3372 enum SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING = "SDL.gpu.buffer.create.name";
3373 
3374 /**
3375     Creates a transfer buffer to be used when uploading to or downloading from
3376     graphics resources.
3377     
3378     Download buffers can be particularly expensive to create, so it is good
3379     practice to reuse them if data will be downloaded regularly.
3380     
3381     There are optional properties that can be provided through `props`. These
3382     are the supported properties:
3383     
3384     - `SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING`: a name that can be
3385     displayed in debugging tools.
3386     
3387     Params:
3388         device =        a GPU Context.
3389         createinfo =    a struct describing the state of the transfer buffer to
3390                         create.
3391     
3392     Returns:
3393         a transfer buffer on success, or NULL on failure; call
3394         SDL_GetError() for more information.
3395     
3396     See_Also:
3397         $(D SDL_UploadToGPUBuffer)
3398         $(D SDL_DownloadFromGPUBuffer)
3399         $(D SDL_UploadToGPUTexture)
3400         $(D SDL_DownloadFromGPUTexture)
3401         $(D SDL_ReleaseGPUTransferBuffer)
3402 */
3403 extern SDL_GPUTransferBuffer* SDL_CreateGPUTransferBuffer(
3404     SDL_GPUDevice* device,
3405     const(SDL_GPUTransferBufferCreateInfo)* createinfo);
3406 
3407 enum SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING = "SDL.gpu.transferbuffer.create.name";
3408 
3409 /**
3410     Sets an arbitrary string constant to label a buffer.
3411     
3412     You should use SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING with
3413     SDL_CreateGPUBuffer instead of this function to avoid thread safety issues.
3414     
3415     Params:
3416         device =    a GPU Context.
3417         buffer =    a buffer to attach the name to.
3418         text =      a UTF-8 string constant to mark as the name of the buffer.
3419     
3420     Threadsafety:
3421         This function is not thread safe, you must make sure the
3422         buffer is not simultaneously used by any other thread.
3423     
3424     See_Also:
3425         $(D SDL_CreateGPUBuffer)
3426 */
3427 extern void SDL_SetGPUBufferName(
3428     SDL_GPUDevice* device,
3429     SDL_GPUBuffer* buffer,
3430     const(char)* text);
3431 
3432 /**
3433     Sets an arbitrary string constant to label a texture.
3434     
3435     You should use SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING with
3436     SDL_CreateGPUTexture instead of this function to avoid thread safety
3437     issues.
3438     
3439     Params:
3440         device =    a GPU Context.
3441         texture =   a texture to attach the name to.
3442         text =      a UTF-8 string constant to mark as the name of the texture.
3443     
3444     Threadsafety:
3445         This function is not thread safe, you must make sure the
3446         texture is not simultaneously used by any other thread.
3447     
3448     See_Also:
3449         $(D SDL_CreateGPUTexture)
3450 */
3451 extern void SDL_SetGPUTextureName(
3452     SDL_GPUDevice* device,
3453     SDL_GPUTexture* texture,
3454     const(char)* text);
3455 
3456 /**
3457     Inserts an arbitrary string label into the command buffer callstream.
3458     
3459     Useful for debugging.
3460     
3461     Params:
3462         command_buffer =    a command buffer.
3463         text =              a UTF-8 string constant to insert as the label.
3464 */
3465 extern void SDL_InsertGPUDebugLabel(
3466     SDL_GPUCommandBuffer* command_buffer,
3467     const(char)* text);
3468 
3469 /**
3470     Begins a debug group with an arbitary name.
3471     
3472     Used for denoting groups of calls when viewing the command buffer
3473     callstream in a graphics debugging tool.
3474     
3475     Each call to SDL_PushGPUDebugGroup must have a corresponding call to
3476     SDL_PopGPUDebugGroup.
3477     
3478     On some backends (e.g. Metal), pushing a debug group during a
3479     render/blit/compute pass will create a group that is scoped to the native
3480     pass rather than the command buffer. For best results, if you push a debug
3481     group during a pass, always pop it in the same pass.
3482     
3483     Params:
3484         command_buffer =    a command buffer.
3485         name =              a UTF-8 string constant that names the group.
3486     
3487     See_Also:
3488         $(D SDL_PopGPUDebugGroup)
3489 */
3490 extern void SDL_PushGPUDebugGroup(
3491     SDL_GPUCommandBuffer* command_buffer,
3492     const(char)* name);
3493 
3494 /**
3495     Ends the most-recently pushed debug group.
3496     
3497     Params:
3498         command_buffer = a command buffer.
3499     
3500     See_Also:
3501         $(D SDL_PushGPUDebugGroup)
3502 */
3503 extern void SDL_PopGPUDebugGroup(
3504     SDL_GPUCommandBuffer* command_buffer);
3505 
3506 /**
3507     Frees the given texture as soon as it is safe to do so.
3508     
3509     You must not reference the texture after calling this function.
3510     
3511     Params:
3512         device =    a GPU context.
3513         texture =   a texture to be destroyed.
3514 */
3515 extern void SDL_ReleaseGPUTexture(
3516 SDL_GPUDevice* device,
3517 SDL_GPUTexture* texture);
3518 
3519 /**
3520     Frees the given sampler as soon as it is safe to do so.
3521     
3522     You must not reference the sampler after calling this function.
3523     
3524     Params:
3525         device =    a GPU context.
3526         sampler =   a sampler to be destroyed.
3527 */
3528 extern void SDL_ReleaseGPUSampler(
3529 SDL_GPUDevice* device,
3530 SDL_GPUSampler* sampler);
3531 
3532 /**
3533     Frees the given buffer as soon as it is safe to do so.
3534     
3535     You must not reference the buffer after calling this function.
3536     
3537     Params:
3538         device =    a GPU context.
3539         buffer =    a buffer to be destroyed.
3540 */
3541 extern void SDL_ReleaseGPUBuffer(
3542 SDL_GPUDevice* device,
3543 SDL_GPUBuffer* buffer);
3544 
3545 /**
3546     Frees the given transfer buffer as soon as it is safe to do so.
3547     
3548     You must not reference the transfer buffer after calling this function.
3549     
3550     Params:
3551         device =            a GPU context.
3552         transfer_buffer =   a transfer buffer to be destroyed.
3553 */
3554 extern void SDL_ReleaseGPUTransferBuffer(
3555 SDL_GPUDevice* device,
3556 SDL_GPUTransferBuffer* transfer_buffer);
3557 
3558 /**
3559     Frees the given compute pipeline as soon as it is safe to do so.
3560     
3561     You must not reference the compute pipeline after calling this function.
3562     
3563     Params:
3564         device =            a GPU context.
3565         compute_pipeline =  a compute pipeline to be destroyed.
3566 */
3567 extern void SDL_ReleaseGPUComputePipeline(
3568 SDL_GPUDevice* device,
3569 SDL_GPUComputePipeline* compute_pipeline);
3570 
3571 /**
3572     Frees the given shader as soon as it is safe to do so.
3573     
3574     You must not reference the shader after calling this function.
3575     
3576     Params:
3577         device =    a GPU context.
3578         shader =    a shader to be destroyed.
3579 */
3580 extern void SDL_ReleaseGPUShader(
3581 SDL_GPUDevice* device,
3582 SDL_GPUShader* shader);
3583 
3584 /**
3585     Frees the given graphics pipeline as soon as it is safe to do so.
3586     
3587     You must not reference the graphics pipeline after calling this function.
3588     
3589     Params:
3590         device =            a GPU context.
3591         graphics_pipeline = a graphics pipeline to be destroyed.
3592 */
3593 extern void SDL_ReleaseGPUGraphicsPipeline(
3594 SDL_GPUDevice* device,
3595 SDL_GPUGraphicsPipeline* graphics_pipeline);
3596 
3597 /**
3598     Acquire a command buffer.
3599     
3600     This command buffer is managed by the implementation and should not be
3601     freed by the user. The command buffer may only be used on the thread it was
3602     acquired on. The command buffer should be submitted on the thread it was
3603     acquired on.
3604     
3605     It is valid to acquire multiple command buffers on the same thread at once.
3606     In fact a common design pattern is to acquire two command buffers per frame
3607     where one is dedicated to render and compute passes and the other is
3608     dedicated to copy passes and other preparatory work such as generating
3609     mipmaps. Interleaving commands between the two command buffers reduces the
3610     total amount of passes overall which improves rendering performance.
3611     
3612     Params:
3613         device = a GPU context.
3614     
3615     Returns:
3616         a command buffer, or NULL on failure; call SDL_GetError() for more
3617         information.
3618     
3619     See_Also:
3620         $(D SDL_SubmitGPUCommandBuffer)
3621         $(D SDL_SubmitGPUCommandBufferAndAcquireFence)
3622 */
3623 extern SDL_GPUCommandBuffer* SDL_AcquireGPUCommandBuffer(
3624 SDL_GPUDevice* device);
3625 
3626 /* Uniform Data */
3627 
3628 /**
3629     Pushes data to a vertex uniform slot on the command buffer.
3630     
3631     Subsequent draw calls will use this uniform data.
3632     
3633     The data being pushed must respect std140 layout conventions. In practical
3634     terms this means you must ensure that vec3 and vec4 fields are 16-byte
3635     aligned.
3636     
3637     Params:
3638         command_buffer =    a command buffer.
3639         slot_index =        the vertex uniform slot to push data to.
3640         data =              client data to write.
3641         length =            the length of the data to write.
3642 */
3643 extern void SDL_PushGPUVertexUniformData(
3644 SDL_GPUCommandBuffer* command_buffer,
3645 Uint32 slot_index,
3646 const(void)* data,
3647 Uint32 length);
3648 
3649 /**
3650     Pushes data to a fragment uniform slot on the command buffer.
3651     
3652     Subsequent draw calls will use this uniform data.
3653     
3654     The data being pushed must respect std140 layout conventions. In practical
3655     terms this means you must ensure that vec3 and vec4 fields are 16-byte
3656     aligned.
3657     
3658     Params:
3659         command_buffer =    a command buffer.
3660         slot_index =        the fragment uniform slot to push data to.
3661         data =              client data to write.
3662         length =            the length of the data to write.
3663 */
3664 extern void SDL_PushGPUFragmentUniformData(
3665 SDL_GPUCommandBuffer* command_buffer,
3666 Uint32 slot_index,
3667 const(void)* data,
3668 Uint32 length);
3669 
3670 /**
3671     Pushes data to a uniform slot on the command buffer.
3672     
3673     Subsequent draw calls will use this uniform data.
3674     
3675     The data being pushed must respect std140 layout conventions. In practical
3676     terms this means you must ensure that vec3 and vec4 fields are 16-byte
3677     aligned.
3678     
3679     Params:
3680         command_buffer =    a command buffer.
3681         slot_index =        the uniform slot to push data to.
3682         data =              client data to write.
3683         length =            the length of the data to write.
3684 */
3685 extern void SDL_PushGPUComputeUniformData(
3686 SDL_GPUCommandBuffer* command_buffer,
3687 Uint32 slot_index,
3688 const(void)* data,
3689 Uint32 length);
3690 
3691 /* Graphics State */
3692 
3693 /**
3694     Begins a render pass on a command buffer.
3695     
3696     A render pass consists of a set of texture subresources (or depth slices in
3697     the 3D texture case) which will be rendered to during the render pass,
3698     along with corresponding clear values and load/store operations. All
3699     operations related to graphics pipelines must take place inside of a render
3700     pass. A default viewport and scissor state are automatically set when this
3701     is called. You cannot begin another render pass, or begin a compute pass or
3702     copy pass until you have ended the render pass.
3703     
3704     Params:
3705         command_buffer =            a command buffer.
3706         color_target_infos =        an array of texture subresources with
3707                                     corresponding clear values and load/store ops.
3708         num_color_targets =         the number of color targets in the
3709                                     color_target_infos array.
3710         depth_stencil_target_info = a texture subresource with corresponding
3711                                     clear value and load/store ops, may be
3712                                     NULL.
3713     
3714     Returns:
3715         A render pass handle.
3716     
3717     See_Also:
3718         $(D SDL_EndGPURenderPass)
3719 */
3720 extern SDL_GPURenderPass* SDL_BeginGPURenderPass(
3721 SDL_GPUCommandBuffer* command_buffer,
3722 const(SDL_GPUColorTargetInfo)* color_target_infos,
3723 Uint32 num_color_targets,
3724 const(SDL_GPUDepthStencilTargetInfo)* depth_stencil_target_info);
3725 
3726 /**
3727     Binds a graphics pipeline on a render pass to be used in rendering.
3728     
3729     A graphics pipeline must be bound before making any draw calls.
3730     
3731     Params:
3732         render_pass =       a render pass handle.
3733         graphics_pipeline = the graphics pipeline to bind.
3734 */
3735 extern void SDL_BindGPUGraphicsPipeline(
3736 SDL_GPURenderPass* render_pass,
3737 SDL_GPUGraphicsPipeline* graphics_pipeline);
3738 
3739 /**
3740     Sets the current viewport state on a command buffer.
3741     
3742     Params:
3743         render_pass =   a render pass handle.
3744         viewport =      the viewport to set.
3745 */
3746 extern void SDL_SetGPUViewport(
3747 SDL_GPURenderPass* render_pass,
3748 const(SDL_GPUViewport)* viewport);
3749 
3750 /**
3751     Sets the current scissor state on a command buffer.
3752     
3753     Params:
3754         render_pass =   a render pass handle.
3755         scissor =       the scissor area to set.
3756 */
3757 extern void SDL_SetGPUScissor(
3758 SDL_GPURenderPass* render_pass,
3759 const(SDL_Rect)* scissor);
3760 
3761 /**
3762     Sets the current blend constants on a command buffer.
3763     
3764     Params:
3765         render_pass =       a render pass handle.
3766         blend_constants =   the blend constant color.
3767     
3768     See_Also:
3769         $(D SDL_GPU_BLENDFACTOR_CONSTANT_COLOR)
3770         $(D SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR)
3771 */
3772 extern void SDL_SetGPUBlendConstants(
3773 SDL_GPURenderPass* render_pass,
3774 SDL_FColor blend_constants);
3775 
3776 /**
3777     Sets the current stencil reference value on a command buffer.
3778     
3779     Params:
3780         render_pass =   a render pass handle.
3781         reference =     the stencil reference value to set.
3782 */
3783 extern void SDL_SetGPUStencilReference(
3784 SDL_GPURenderPass* render_pass,
3785 Uint8 reference);
3786 
3787 /**
3788     Binds vertex buffers on a command buffer for use with subsequent draw
3789     calls.
3790     
3791     Params:
3792         render_pass =   a render pass handle.
3793         first_slot =    the vertex buffer slot to begin binding from.
3794         bindings =      an array of SDL_GPUBufferBinding structs containing vertex
3795                         buffers and offset values.
3796         num_bindings =  the number of bindings in the bindings array.
3797 */
3798 extern void SDL_BindGPUVertexBuffers(
3799 SDL_GPURenderPass* render_pass,
3800 Uint32 first_slot,
3801 const(SDL_GPUBufferBinding)* bindings,
3802 Uint32 num_bindings);
3803 
3804 /**
3805     Binds an index buffer on a command buffer for use with subsequent draw
3806     calls.
3807     
3808     Params:
3809         render_pass =           a render pass handle.
3810         binding =               a pointer to a struct containing an index buffer and offset.
3811         index_element_size =    whether the index values in the buffer are 16- or
3812                                 32-bit.
3813 */
3814 extern void SDL_BindGPUIndexBuffer(
3815 SDL_GPURenderPass* render_pass,
3816 const(SDL_GPUBufferBinding)* binding,
3817 SDL_GPUIndexElementSize index_element_size);
3818 
3819 /**
3820     Binds texture-sampler pairs for use on the vertex shader.
3821     
3822     The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER.
3823     
3824     Be sure your shader is set up according to the requirements documented in
3825     SDL_CreateGPUShader().
3826     
3827     Params:
3828         render_pass =               a render pass handle.
3829         first_slot =                the vertex sampler slot to begin binding from.
3830         texture_sampler_bindings =  an array of texture-sampler binding
3831                                     structs.
3832         num_bindings =              the number of texture-sampler pairs to bind from the
3833                                     array.
3834     
3835     See_Also:
3836         $(D SDL_CreateGPUShader)
3837 */
3838 extern void SDL_BindGPUVertexSamplers(
3839 SDL_GPURenderPass* render_pass,
3840 Uint32 first_slot,
3841 const(SDL_GPUTextureSamplerBinding)* texture_sampler_bindings,
3842 Uint32 num_bindings);
3843 
3844 /**
3845     Binds storage textures for use on the vertex shader.
3846     
3847     These textures must have been created with
3848     SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ.
3849     
3850     Be sure your shader is set up according to the requirements documented in
3851     SDL_CreateGPUShader().
3852     
3853     Params:
3854         render_pass =       a render pass handle.
3855         first_slot =        the vertex storage texture slot to begin binding from.
3856         storage_textures =  an array of storage textures.
3857         num_bindings =      the number of storage texture to bind from the array.
3858     
3859     See_Also:
3860         $(D SDL_CreateGPUShader)
3861 */
3862 extern void SDL_BindGPUVertexStorageTextures(
3863 SDL_GPURenderPass* render_pass,
3864 Uint32 first_slot,
3865 const(SDL_GPUTexture*)* storage_textures,
3866 Uint32 num_bindings);
3867 
3868 /**
3869     Binds storage buffers for use on the vertex shader.
3870     
3871     These buffers must have been created with
3872     SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ.
3873     
3874     Be sure your shader is set up according to the requirements documented in
3875     SDL_CreateGPUShader().
3876     
3877     Params:
3878         render_pass =       a render pass handle.
3879         first_slot =        the vertex storage buffer slot to begin binding from.
3880         storage_buffers =   an array of buffers.
3881         num_bindings =      the number of buffers to bind from the array.
3882     
3883     See_Also:
3884         $(D SDL_CreateGPUShader)
3885 */
3886 extern void SDL_BindGPUVertexStorageBuffers(
3887 SDL_GPURenderPass* render_pass,
3888 Uint32 first_slot,
3889 const(SDL_GPUBuffer*)* storage_buffers,
3890 Uint32 num_bindings);
3891 
3892 /**
3893     Binds texture-sampler pairs for use on the fragment shader.
3894     
3895     The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER.
3896     
3897     Be sure your shader is set up according to the requirements documented in
3898     SDL_CreateGPUShader().
3899     
3900     Params:
3901         render_pass =               a render pass handle.
3902         first_slot =                the fragment sampler slot to begin binding from.
3903         texture_sampler_bindings =  an array of texture-sampler binding
3904                                     structs.
3905         num_bindings =              the number of texture-sampler pairs to bind from the
3906                                     array.
3907 
3908     See_Also:
3909         $(D SDL_CreateGPUShader)
3910 */
3911 extern void SDL_BindGPUFragmentSamplers(
3912 SDL_GPURenderPass* render_pass,
3913 Uint32 first_slot,
3914 const(SDL_GPUTextureSamplerBinding)* texture_sampler_bindings,
3915 Uint32 num_bindings);
3916 
3917 /**
3918     Binds storage textures for use on the fragment shader.
3919     
3920     These textures must have been created with
3921     SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ.
3922     
3923     Be sure your shader is set up according to the requirements documented in
3924     SDL_CreateGPUShader().
3925     
3926     Params:
3927         render_pass =       a render pass handle.
3928         first_slot =        the fragment storage texture slot to begin binding from.
3929         storage_textures =  an array of storage textures.
3930         num_bindings =      the number of storage textures to bind from the array.
3931     
3932     See_Also:
3933         $(D SDL_CreateGPUShader)
3934 */
3935 extern void SDL_BindGPUFragmentStorageTextures(
3936 SDL_GPURenderPass* render_pass,
3937 Uint32 first_slot,
3938 const(SDL_GPUTexture*)* storage_textures,
3939 Uint32 num_bindings);
3940 
3941 /**
3942     Binds storage buffers for use on the fragment shader.
3943     
3944     These buffers must have been created with
3945     SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ.
3946     
3947     Be sure your shader is set up according to the requirements documented in
3948     SDL_CreateGPUShader().
3949     
3950     Params:
3951         render_pass =       a render pass handle.
3952         first_slot =        the fragment storage buffer slot to begin binding from.
3953         storage_buffers =   an array of storage buffers.
3954         num_bindings =      the number of storage buffers to bind from the array.
3955     
3956     See_Also:
3957         $(D SDL_CreateGPUShader)
3958 */
3959 extern void SDL_BindGPUFragmentStorageBuffers(
3960     SDL_GPURenderPass* render_pass,
3961     Uint32 first_slot,
3962     const(SDL_GPUBuffer*)* storage_buffers,
3963     Uint32 num_bindings);
3964 
3965 
3966 /**
3967     Draws data using bound graphics state with an index buffer and instancing
3968     enabled.
3969     
3970     You must not call this function before binding a graphics pipeline.
3971     
3972     Note that the `first_vertex` and `first_instance` parameters are NOT
3973     compatible with built-in vertex/instance ID variables in shaders (for
3974     example, SV_VertexID); GPU APIs and shader languages do not define these
3975     built-in variables consistently, so if your shader depends on them, the
3976     only way to keep behavior consistent and portable is to always pass 0 for
3977     the correlating parameter in the draw calls.
3978     
3979     Params:
3980         render_pass =       a render pass handle.
3981         num_indices =       the number of indices to draw per instance.
3982         num_instances =     the number of instances to draw.
3983         first_index =       the starting index within the index buffer.
3984         vertex_offset =     value added to vertex index before indexing into the
3985                             vertex buffer.
3986         first_instance =    the ID of the first instance to draw.
3987 */
3988 extern void SDL_DrawGPUIndexedPrimitives(
3989     SDL_GPURenderPass* render_pass,
3990     Uint32 num_indices,
3991     Uint32 num_instances,
3992     Uint32 first_index,
3993     Sint32 vertex_offset,
3994     Uint32 first_instance);
3995 
3996 /**
3997     Draws data using bound graphics state.
3998     
3999     You must not call this function before binding a graphics pipeline.
4000     
4001     Note that the `first_vertex` and `first_instance` parameters are NOT
4002     compatible with built-in vertex/instance ID variables in shaders (for
4003     example, SV_VertexID); GPU APIs and shader languages do not define these
4004     built-in variables consistently, so if your shader depends on them, the
4005     only way to keep behavior consistent and portable is to always pass 0 for
4006     the correlating parameter in the draw calls.
4007     
4008     Params:
4009         render_pass =       a render pass handle.
4010         num_vertices =      the number of vertices to draw.
4011         num_instances =     the number of instances that will be drawn.
4012         first_vertex =      the index of the first vertex to draw.
4013         first_instance =    the ID of the first instance to draw.
4014 */
4015 extern void SDL_DrawGPUPrimitives(
4016     SDL_GPURenderPass* render_pass,
4017     Uint32 num_vertices,
4018     Uint32 num_instances,
4019     Uint32 first_vertex,
4020     Uint32 first_instance);
4021 
4022 /**
4023     Draws data using bound graphics state and with draw parameters set from a
4024     buffer.
4025     
4026     The buffer must consist of tightly-packed draw parameter sets that each
4027     match the layout of SDL_GPUIndirectDrawCommand. You must not call this
4028     function before binding a graphics pipeline.
4029     
4030     Params:
4031         render_pass =   a render pass handle.
4032         buffer =        a buffer containing draw parameters.
4033         offset =        the offset to start reading from the draw buffer.
4034         draw_count =    the number of draw parameter sets that should be read
4035                         from the draw buffer.
4036 */
4037 extern void SDL_DrawGPUPrimitivesIndirect(
4038 SDL_GPURenderPass* render_pass,
4039 SDL_GPUBuffer* buffer,
4040 Uint32 offset,
4041 Uint32 draw_count);
4042 
4043 /**
4044     Draws data using bound graphics state with an index buffer enabled and with
4045     draw parameters set from a buffer.
4046     
4047     The buffer must consist of tightly-packed draw parameter sets that each
4048     match the layout of SDL_GPUIndexedIndirectDrawCommand. You must not call
4049     this function before binding a graphics pipeline.
4050     
4051     Params:
4052         render_pass =   a render pass handle.
4053         buffer =        a buffer containing draw parameters.
4054         offset =        the offset to start reading from the draw buffer.
4055         draw_count =    the number of draw parameter sets that should be read
4056                         from the draw buffer.
4057 */
4058 extern void SDL_DrawGPUIndexedPrimitivesIndirect(
4059     SDL_GPURenderPass* render_pass,
4060     SDL_GPUBuffer* buffer,
4061     Uint32 offset,
4062     Uint32 draw_count);
4063 
4064 /**
4065     Ends the given render pass.
4066     
4067     All bound graphics state on the render pass command buffer is unset. The
4068     render pass handle is now invalid.
4069     
4070     Params:
4071         render_pass = a render pass handle.
4072 */
4073 extern void SDL_EndGPURenderPass(
4074 SDL_GPURenderPass* render_pass);
4075 
4076 /* Compute Pass */
4077 
4078 /**
4079     Begins a compute pass on a command buffer.
4080     
4081     A compute pass is defined by a set of texture subresources and buffers that
4082     may be written to by compute pipelines. These textures and buffers must
4083     have been created with the COMPUTE_STORAGE_WRITE bit or the
4084     COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE bit. If you do not create a texture
4085     with COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE, you must not read from the
4086     texture in the compute pass. All operations related to compute pipelines
4087     must take place inside of a compute pass. You must not begin another
4088     compute pass, or a render pass or copy pass before ending the compute pass.
4089     
4090     A VERY IMPORTANT NOTE - Reads and writes in compute passes are NOT
4091     implicitly synchronized. This means you may cause data races by both
4092     reading and writing a resource region in a compute pass, or by writing
4093     multiple times to a resource region. If your compute work depends on
4094     reading the completed output from a previous dispatch, you MUST end the
4095     current compute pass and begin a new one before you can safely access the
4096     data. Otherwise you will receive unexpected results. Reading and writing a
4097     texture in the same compute pass is only supported by specific texture
4098     formats. Make sure you check the format support!
4099     
4100     Params:
4101         command_buffer =                a command buffer.
4102         storage_texture_bindings =      an array of writeable storage texture
4103                                         binding structs.
4104         num_storage_texture_bindings =  the number of storage textures to bind
4105                                         from the array.
4106         storage_buffer_bindings =       an array of writeable storage buffer binding
4107                                         structs.
4108         num_storage_buffer_bindings =   the number of storage buffers to bind
4109                                         from the array.
4110 
4111     Returns:
4112         A compute pass handle.
4113 
4114     See_Also:
4115         $(D SDL_EndGPUComputePass)
4116 */
4117 extern SDL_GPUComputePass* SDL_BeginGPUComputePass(
4118     SDL_GPUCommandBuffer* command_buffer,
4119     const(SDL_GPUStorageTextureReadWriteBinding)* storage_texture_bindings,
4120     Uint32 num_storage_texture_bindings,
4121     const(SDL_GPUStorageBufferReadWriteBinding)* storage_buffer_bindings,
4122     Uint32 num_storage_buffer_bindings);
4123 
4124 /**
4125     Binds a compute pipeline on a command buffer for use in compute dispatch.
4126     
4127     Params:
4128         compute_pass =      a compute pass handle.
4129         compute_pipeline =  a compute pipeline to bind.
4130 */
4131 extern void SDL_BindGPUComputePipeline(
4132     SDL_GPUComputePass* compute_pass,
4133     SDL_GPUComputePipeline* compute_pipeline);
4134 
4135 /**
4136     Binds texture-sampler pairs for use on the compute shader.
4137     
4138     The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER.
4139     
4140     Be sure your shader is set up according to the requirements documented in
4141     SDL_CreateGPUShader().
4142     
4143     Params:
4144         compute_pass =              a compute pass handle.
4145         first_slot =                the compute sampler slot to begin binding from.
4146         texture_sampler_bindings =  an array of texture-sampler binding
4147                                     structs.
4148         num_bindings =              the number of texture-sampler bindings to bind from the
4149                                     array.
4150 
4151     See_Also:
4152         $(D SDL_CreateGPUShader)
4153 */
4154 extern void SDL_BindGPUComputeSamplers(
4155 SDL_GPUComputePass* compute_pass,
4156 Uint32 first_slot,
4157 const(SDL_GPUTextureSamplerBinding)* texture_sampler_bindings,
4158 Uint32 num_bindings);
4159 
4160 /**
4161     Binds storage textures as readonly for use on the compute pipeline.
4162     
4163     These textures must have been created with
4164     SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ.
4165     
4166     Be sure your shader is set up according to the requirements documented in
4167     SDL_CreateGPUShader().
4168     
4169     Params:
4170         compute_pass =      a compute pass handle.
4171         first_slot =        the compute storage texture slot to begin binding from.
4172         storage_textures =  an array of storage textures.
4173         num_bindings =      the number of storage textures to bind from the array.
4174     
4175     See_Also:
4176         $(D SDL_CreateGPUShader)
4177 */
4178 extern void SDL_BindGPUComputeStorageTextures(
4179 SDL_GPUComputePass* compute_pass,
4180 Uint32 first_slot,
4181 const(SDL_GPUTexture*)* storage_textures,
4182 Uint32 num_bindings);
4183 
4184 /**
4185     Binds storage buffers as readonly for use on the compute pipeline.
4186     
4187     These buffers must have been created with
4188     SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ.
4189     
4190     Be sure your shader is set up according to the requirements documented in
4191     SDL_CreateGPUShader().
4192     
4193     Params:
4194         compute_pass =      a compute pass handle.
4195         first_slot =        the compute storage buffer slot to begin binding from.
4196         storage_buffers =   an array of storage buffer binding structs.
4197         num_bindings =      the number of storage buffers to bind from the array.
4198     
4199     See_Also:
4200         $(D SDL_CreateGPUShader)
4201 */
4202 extern void SDL_BindGPUComputeStorageBuffers(
4203 SDL_GPUComputePass* compute_pass,
4204 Uint32 first_slot,
4205 const(SDL_GPUBuffer*)* storage_buffers,
4206 Uint32 num_bindings);
4207 
4208 /**
4209     Dispatches compute work.
4210     
4211     You must not call this function before binding a compute pipeline.
4212     
4213     A VERY IMPORTANT NOTE If you dispatch multiple times in a compute pass, and
4214     the dispatches write to the same resource region as each other, there is no
4215     guarantee of which order the writes will occur. If the write order matters,
4216     you MUST end the compute pass and begin another one.
4217     
4218     Params:
4219         compute_pass =  a compute pass handle.
4220         groupcount_x =  number of local workgroups to dispatch in the X
4221                         dimension.
4222         groupcount_y =  number of local workgroups to dispatch in the Y
4223                         dimension.
4224         groupcount_z =  number of local workgroups to dispatch in the Z
4225                         dimension.
4226 */
4227 extern void SDL_DispatchGPUCompute(
4228 SDL_GPUComputePass* compute_pass,
4229 Uint32 groupcount_x,
4230 Uint32 groupcount_y,
4231 Uint32 groupcount_z);
4232 
4233 /**
4234     Dispatches compute work with parameters set from a buffer.
4235     
4236     The buffer layout should match the layout of
4237     SDL_GPUIndirectDispatchCommand. You must not call this function before
4238     binding a compute pipeline.
4239     
4240     A VERY IMPORTANT NOTE If you dispatch multiple times in a compute pass, and
4241     the dispatches write to the same resource region as each other, there is no
4242     guarantee of which order the writes will occur. If the write order matters,
4243     you MUST end the compute pass and begin another one.
4244     
4245     Params:
4246         compute_pass =  a compute pass handle.
4247         buffer =        a buffer containing dispatch parameters.
4248         offset =        the offset to start reading from the dispatch buffer.
4249 */
4250 extern void SDL_DispatchGPUComputeIndirect(
4251 SDL_GPUComputePass* compute_pass,
4252 SDL_GPUBuffer* buffer,
4253 Uint32 offset);
4254 
4255 /**
4256     Ends the current compute pass.
4257     
4258     All bound compute state on the command buffer is unset. The compute pass
4259     handle is now invalid.
4260     
4261     Params:
4262         compute_pass = a compute pass handle.
4263 */
4264 extern void SDL_EndGPUComputePass(
4265 SDL_GPUComputePass* compute_pass);
4266 
4267 /* TransferBuffer Data */
4268 
4269 /**
4270     Maps a transfer buffer into application address space.
4271     
4272     You must unmap the transfer buffer before encoding upload commands. The
4273     memory is owned by the graphics driver - do NOT call SDL_free() on the
4274     returned pointer.
4275     
4276     Params:
4277         device =            a GPU context.
4278         transfer_buffer =   a transfer buffer.
4279         cycle =             if true, cycles the transfer buffer if it is already bound.
4280     
4281     Returns:
4282         the address of the mapped transfer buffer memory, or NULL on
4283         failure; call SDL_GetError() for more information.
4284 */
4285 extern void* SDL_MapGPUTransferBuffer(
4286     SDL_GPUDevice* device,
4287     SDL_GPUTransferBuffer* transfer_buffer,
4288     bool cycle);
4289 
4290 /**
4291     Unmaps a previously mapped transfer buffer.
4292     
4293     Params:
4294         device =            a GPU context.
4295         transfer_buffer =   a previously mapped transfer buffer.
4296 */
4297 extern void SDL_UnmapGPUTransferBuffer(
4298     SDL_GPUDevice* device,
4299     SDL_GPUTransferBuffer* transfer_buffer);
4300 
4301 
4302 /**
4303     Begins a copy pass on a command buffer.
4304     
4305     All operations related to copying to or from buffers or textures take place
4306     inside a copy pass. You must not begin another copy pass, or a render pass
4307     or compute pass before ending the copy pass.
4308     
4309     Params:
4310         command_buffer = a command buffer.
4311     
4312     Returns:
4313         A copy pass handle.
4314 */
4315 extern SDL_GPUCopyPass* SDL_BeginGPUCopyPass(
4316     SDL_GPUCommandBuffer* command_buffer);
4317 
4318 /**
4319     Uploads data from a transfer buffer to a texture.
4320     
4321     The upload occurs on the GPU timeline. You may assume that the upload has
4322     finished in subsequent commands.
4323     
4324     You must align the data in the transfer buffer to a multiple of the texel
4325     size of the texture format.
4326     
4327     Params:
4328         copy_pass =     a copy pass handle.
4329         source =        the source transfer buffer with image layout information.
4330         destination =   the destination texture region.
4331         cycle =         if true, cycles the texture if the texture is bound, otherwise
4332                         overwrites the data.
4333 */
4334 extern void SDL_UploadToGPUTexture(
4335 SDL_GPUCopyPass* copy_pass,
4336 const(SDL_GPUTextureTransferInfo)* source,
4337 const(SDL_GPUTextureRegion)* destination,
4338 bool cycle);
4339 
4340 /**
4341     Uploads data from a transfer buffer to a buffer.
4342     
4343     The upload occurs on the GPU timeline. You may assume that the upload has
4344     finished in subsequent commands.
4345     
4346     Params:
4347         copy_pass =     a copy pass handle.
4348         source =        the source transfer buffer with offset.
4349         destination =   the destination buffer with offset and size.
4350         cycle =         if true, cycles the buffer if it is already bound, otherwise
4351                         overwrites the data.
4352 */
4353 extern void SDL_UploadToGPUBuffer(
4354     SDL_GPUCopyPass* copy_pass,
4355     const(SDL_GPUTransferBufferLocation)* source,
4356     const(SDL_GPUBufferRegion)* destination,
4357     bool cycle);
4358 
4359 /**
4360     Performs a texture-to-texture copy.
4361     
4362     This copy occurs on the GPU timeline. You may assume the copy has finished
4363     in subsequent commands.
4364     
4365     Params:
4366         copy_pass =     a copy pass handle.
4367         source =        a source texture region.
4368         destination =   a destination texture region.
4369         w =             the width of the region to copy.
4370         h =             the height of the region to copy.
4371         d =             the depth of the region to copy.
4372         cycle =         if true, cycles the destination texture if the destination
4373                         texture is bound, otherwise overwrites the data.
4374 */
4375 extern void SDL_CopyGPUTextureToTexture(
4376     SDL_GPUCopyPass* copy_pass,
4377     const(SDL_GPUTextureLocation)* source,
4378     const(SDL_GPUTextureLocation)* destination,
4379     Uint32 w,
4380     Uint32 h,
4381     Uint32 d,
4382     bool cycle);
4383 
4384 /**
4385     Performs a buffer-to-buffer copy.
4386     
4387     This copy occurs on the GPU timeline. You may assume the copy has finished
4388     in subsequent commands.
4389     
4390     Params:
4391         copy_pass =     a copy pass handle.
4392         source =        the buffer and offset to copy from.
4393         destination =   the buffer and offset to copy to.
4394         size =          the length of the buffer to copy.
4395         cycle =         if true, cycles the destination buffer if it is already bound,
4396                         otherwise overwrites the data.
4397 */
4398 extern void SDL_CopyGPUBufferToBuffer(
4399     SDL_GPUCopyPass* copy_pass,
4400     const(SDL_GPUBufferLocation)* source,
4401     const(SDL_GPUBufferLocation)* destination,
4402     Uint32 size,
4403     bool cycle);
4404 
4405 /**
4406     Copies data from a texture to a transfer buffer on the GPU timeline.
4407     
4408     This data is not guaranteed to be copied until the command buffer fence is
4409     signaled.
4410     
4411     Params:
4412         copy_pass =     a copy pass handle.
4413         source =        the source texture region.
4414         destination =   the destination transfer buffer with image layout
4415                         information.
4416 */
4417 extern void SDL_DownloadFromGPUTexture(
4418     SDL_GPUCopyPass* copy_pass,
4419     const(SDL_GPUTextureRegion)* source,
4420     const(SDL_GPUTextureTransferInfo)* destination);
4421 
4422 /**
4423     Copies data from a buffer to a transfer buffer on the GPU timeline.
4424     
4425     This data is not guaranteed to be copied until the command buffer fence is
4426     signaled.
4427     
4428     Params:
4429         copy_pass =     a copy pass handle.
4430         source =        the source buffer with offset and size.
4431         destination =   the destination transfer buffer with offset.
4432 */
4433 extern void SDL_DownloadFromGPUBuffer(
4434     SDL_GPUCopyPass* copy_pass,
4435     const(SDL_GPUBufferRegion)* source,
4436     const(SDL_GPUTransferBufferLocation)* destination);
4437 
4438 /**
4439     Ends the current copy pass.
4440     
4441     Params:
4442         copy_pass = a copy pass handle.
4443 */
4444 extern void SDL_EndGPUCopyPass(
4445 SDL_GPUCopyPass* copy_pass);
4446 
4447 /**
4448     Generates mipmaps for the given texture.
4449     
4450     This function must not be called inside of any pass.
4451     
4452     Params:
4453         command_buffer =    a command_buffer.
4454         texture =           a texture with more than 1 mip level.
4455 */
4456 extern void SDL_GenerateMipmapsForGPUTexture(
4457 SDL_GPUCommandBuffer* command_buffer,
4458 SDL_GPUTexture* texture);
4459 
4460 /**
4461     Blits from a source texture region to a destination texture region.
4462     
4463     This function must not be called inside of any pass.
4464     
4465     Params:
4466         command_buffer =    a command buffer.
4467         info =              the blit info struct containing the blit parameters.
4468 */
4469 extern void SDL_BlitGPUTexture(
4470 SDL_GPUCommandBuffer* command_buffer,
4471 const(SDL_GPUBlitInfo)* info);
4472 
4473 /* Submission/Presentation */
4474 
4475 /**
4476     Determines whether a swapchain composition is supported by the window.
4477     
4478     The window must be claimed before calling this function.
4479     
4480     Params:
4481         device =                a GPU context.
4482         window =                an SDL_Window.
4483         swapchain_composition = the swapchain composition to check.
4484     
4485     Returns:
4486         true if supported, false if unsupported.
4487     
4488     See_Also:
4489         $(D SDL_ClaimWindowForGPUDevice)
4490 */
4491 extern bool SDL_WindowSupportsGPUSwapchainComposition(
4492     SDL_GPUDevice* device,
4493     SDL_Window* window,
4494     SDL_GPUSwapchainComposition swapchain_composition);
4495 
4496 /**
4497     Determines whether a presentation mode is supported by the window.
4498     
4499     The window must be claimed before calling this function.
4500     
4501     Params:
4502         device =        a GPU context.
4503         window =        an SDL_Window.
4504         present_mode =  the presentation mode to check.
4505     
4506     Returns:
4507         true if supported, false if unsupported.
4508     
4509     See_Also:
4510         $(D SDL_ClaimWindowForGPUDevice)
4511 */
4512 extern bool SDL_WindowSupportsGPUPresentMode(
4513     SDL_GPUDevice* device,
4514     SDL_Window* window,
4515     SDL_GPUPresentMode present_mode);
4516 
4517 /**
4518     Claims a window, creating a swapchain structure for it.
4519     
4520     This must be called before SDL_AcquireGPUSwapchainTexture is called using
4521     the window. You should only call this function from the thread that created
4522     the window.
4523     
4524     The swapchain will be created with SDL_GPU_SWAPCHAINCOMPOSITION_SDR and
4525     SDL_GPU_PRESENTMODE_VSYNC. If you want to have different swapchain
4526     parameters, you must call SDL_SetGPUSwapchainParameters after claiming the
4527     window.
4528     
4529 
4530     Params:
4531         device =    a GPU context.
4532         window =    an SDL_Window.
4533     
4534     Returns:
4535         true on success, or false on failure; call SDL_GetError() for more
4536         information.
4537     
4538     Threadsafety:
4539         This function should only be called from the thread that
4540         created the window.
4541     
4542     See_Also:
4543         $(D SDL_WaitAndAcquireGPUSwapchainTexture)
4544         $(D SDL_ReleaseWindowFromGPUDevice)
4545         $(D SDL_WindowSupportsGPUPresentMode)
4546         $(D SDL_WindowSupportsGPUSwapchainComposition)
4547 */
4548 extern bool SDL_ClaimWindowForGPUDevice(
4549     SDL_GPUDevice* device,
4550     SDL_Window* window);
4551 
4552 /**
4553     Unclaims a window, destroying its swapchain structure.
4554     
4555     Params:
4556         device =    a GPU context.
4557         window =    an SDL_Window that has been claimed.
4558     
4559     See_Also:
4560         $(D SDL_ClaimWindowForGPUDevice)
4561 */
4562 extern void SDL_ReleaseWindowFromGPUDevice(
4563 SDL_GPUDevice* device,
4564 SDL_Window* window);
4565 
4566 /**
4567     Changes the swapchain parameters for the given claimed window.
4568     
4569     This function will fail if the requested present mode or swapchain
4570     composition are unsupported by the device. Check if the parameters are
4571     supported via SDL_WindowSupportsGPUPresentMode /
4572     SDL_WindowSupportsGPUSwapchainComposition prior to calling this function.
4573     
4574     SDL_GPU_PRESENTMODE_VSYNC and SDL_GPU_SWAPCHAINCOMPOSITION_SDR are always
4575     supported.
4576     
4577     Params:
4578         device =                a GPU context.
4579         window =                an SDL_Window that has been claimed.
4580         swapchain_composition = the desired composition of the swapchain.
4581         present_mode =          the desired present mode for the swapchain.
4582     
4583     Returns:
4584         true if successful, false on error; call SDL_GetError() for more
4585         information.
4586 
4587     See_Also:
4588         $(D SDL_WindowSupportsGPUPresentMode)
4589         $(D SDL_WindowSupportsGPUSwapchainComposition)
4590 */
4591 extern bool SDL_SetGPUSwapchainParameters(
4592 SDL_GPUDevice* device,
4593 SDL_Window* window,
4594 SDL_GPUSwapchainComposition swapchain_composition,
4595 SDL_GPUPresentMode present_mode);
4596 
4597 /**
4598     Configures the maximum allowed number of frames in flight.
4599     
4600     The default value when the device is created is 2. This means that after
4601     you have submitted 2 frames for presentation, if the GPU has not finished
4602     working on the first frame, SDL_AcquireGPUSwapchainTexture() will fill the
4603     swapchain texture pointer with NULL, and
4604     SDL_WaitAndAcquireGPUSwapchainTexture() will block.
4605     
4606     Higher values increase throughput at the expense of visual latency. Lower
4607     values decrease visual latency at the expense of throughput.
4608     
4609     Note that calling this function will stall and flush the command queue to
4610     prevent synchronization issues.
4611     
4612     The minimum value of allowed frames in flight is 1, and the maximum is 3.
4613     
4614     Params:
4615         device =                    a GPU context.
4616         allowed_frames_in_flight =  the maximum number of frames that can be
4617                                     pending on the GPU.
4618 
4619     Returns:
4620         true if successful, false on error; call SDL_GetError() for more
4621         information.
4622 */
4623 extern bool SDL_SetGPUAllowedFramesInFlight(
4624 SDL_GPUDevice* device,
4625 Uint32 allowed_frames_in_flight);
4626 
4627 /**
4628     Obtains the texture format of the swapchain for the given window.
4629     
4630     Note that this format can change if the swapchain parameters change.
4631     
4632     Params:
4633         device =    a GPU context.
4634         window =    an SDL_Window that has been claimed.
4635     
4636     Returns:
4637         the texture format of the swapchain.
4638 */
4639 extern SDL_GPUTextureFormat SDL_GetGPUSwapchainTextureFormat(
4640 SDL_GPUDevice* device,
4641 SDL_Window* window);
4642 
4643 /**
4644     Acquire a texture to use in presentation.
4645     
4646     When a swapchain texture is acquired on a command buffer, it will
4647     automatically be submitted for presentation when the command buffer is
4648     submitted. The swapchain texture should only be referenced by the command
4649     buffer used to acquire it.
4650     
4651     This function will fill the swapchain texture handle with NULL if too many
4652     frames are in flight. This is not an error.
4653     
4654     If you use this function, it is possible to create a situation where many
4655     command buffers are allocated while the rendering context waits for the GPU
4656     to catch up, which will cause memory usage to grow. You should use
4657     SDL_WaitAndAcquireGPUSwapchainTexture() unless you know what you are doing
4658     with timing.
4659     
4660     The swapchain texture is managed by the implementation and must not be
4661     freed by the user. You MUST NOT call this function from any thread other
4662     than the one that created the window.
4663     
4664     Params:
4665         command_buffer =            a command buffer.
4666         window =                    a window that has been claimed.
4667         swapchain_texture =         a pointer filled in with a swapchain texture
4668                                     handle.
4669         swapchain_texture_width =   a pointer filled in with the swapchain
4670                                     texture width, may be NULL.
4671         swapchain_texture_height =  a pointer filled in with the swapchain
4672                                     texture height, may be NULL.
4673     
4674     Returns:
4675         true on success, false on error; call SDL_GetError() for more
4676         information.
4677     
4678     Threadsafety:
4679         This function should only be called from the thread that
4680         created the window.
4681 
4682     See_Also:
4683         $(D SDL_ClaimWindowForGPUDevice)
4684         $(D SDL_SubmitGPUCommandBuffer)
4685         $(D SDL_SubmitGPUCommandBufferAndAcquireFence)
4686         $(D SDL_CancelGPUCommandBuffer)
4687         $(D SDL_GetWindowSizeInPixels)
4688         $(D SDL_WaitForGPUSwapchain)
4689         $(D SDL_WaitAndAcquireGPUSwapchainTexture)
4690         $(D SDL_SetGPUAllowedFramesInFlight)
4691 */
4692 extern bool SDL_AcquireGPUSwapchainTexture(
4693 SDL_GPUCommandBuffer* command_buffer,
4694 SDL_Window* window,
4695 SDL_GPUTexture** swapchain_texture,
4696 Uint32* swapchain_texture_width,
4697 Uint32* swapchain_texture_height);
4698 
4699 /**
4700     Blocks the thread until a swapchain texture is available to be acquired.
4701     
4702     Params:
4703         device =    a GPU context.
4704         window =    a window that has been claimed.
4705     
4706     Returns:
4707         true on success, false on failure; call SDL_GetError() for more
4708         information.
4709     
4710     Threadsafety:
4711         This function should only be called from the thread that
4712         created the window.
4713 
4714     See_Also:
4715         $(D SDL_AcquireGPUSwapchainTexture)
4716         $(D SDL_WaitAndAcquireGPUSwapchainTexture)
4717         $(D SDL_SetGPUAllowedFramesInFlight)
4718 */
4719 extern bool SDL_WaitForGPUSwapchain(
4720 SDL_GPUDevice* device,
4721 SDL_Window* window);
4722 
4723 /**
4724     Blocks the thread until a swapchain texture is available to be acquired,
4725     and then acquires it.
4726     
4727     When a swapchain texture is acquired on a command buffer, it will
4728     automatically be submitted for presentation when the command buffer is
4729     submitted. The swapchain texture should only be referenced by the command
4730     buffer used to acquire it. It is an error to call
4731     SDL_CancelGPUCommandBuffer() after a swapchain texture is acquired.
4732     
4733     This function can fill the swapchain texture handle with NULL in certain
4734     cases, for example if the window is minimized. This is not an error. You
4735     should always make sure to check whether the pointer is NULL before
4736     actually using it.
4737     
4738     The swapchain texture is managed by the implementation and must not be
4739     freed by the user. You MUST NOT call this function from any thread other
4740     than the one that created the window.
4741     
4742     Params:
4743         command_buffer =            a command buffer.
4744         window =                    a window that has been claimed.
4745         swapchain_texture =         a pointer filled in with a swapchain texture
4746                                     handle.
4747         swapchain_texture_width =   a pointer filled in with the swapchain
4748                                     texture width, may be NULL.
4749         swapchain_texture_height =  a pointer filled in with the swapchain
4750                                     texture height, may be NULL.
4751 
4752     Returns:
4753         true on success, false on error; call SDL_GetError() for more
4754         information.
4755     
4756     Threadsafety:
4757         This function should only be called from the thread that
4758         created the window.
4759 
4760     See_Also:
4761         $(D SDL_SubmitGPUCommandBuffer)
4762         $(D SDL_SubmitGPUCommandBufferAndAcquireFence)
4763 */
4764 extern bool SDL_WaitAndAcquireGPUSwapchainTexture(
4765 SDL_GPUCommandBuffer* command_buffer,
4766 SDL_Window* window,
4767 SDL_GPUTexture** swapchain_texture,
4768 Uint32* swapchain_texture_width,
4769 Uint32* swapchain_texture_height);
4770 
4771 /**
4772     Submits a command buffer so its commands can be processed on the GPU.
4773     
4774     It is invalid to use the command buffer after this is called.
4775     
4776     This must be called from the thread the command buffer was acquired on.
4777     
4778     All commands in the submission are guaranteed to begin executing before any
4779     command in a subsequent submission begins executing.
4780     
4781     Params:
4782         command_buffer = a command buffer.
4783     
4784     Returns:
4785         true on success, false on failure; call SDL_GetError() for more
4786         information.
4787 
4788     See_Also:
4789         $(D SDL_AcquireGPUCommandBuffer)
4790         $(D SDL_WaitAndAcquireGPUSwapchainTexture)
4791         $(D SDL_AcquireGPUSwapchainTexture)
4792         $(D SDL_SubmitGPUCommandBufferAndAcquireFence)
4793 */
4794 extern bool SDL_SubmitGPUCommandBuffer(
4795 SDL_GPUCommandBuffer* command_buffer);
4796 
4797 /**
4798     Submits a command buffer so its commands can be processed on the GPU, and
4799     acquires a fence associated with the command buffer.
4800     
4801     You must release this fence when it is no longer needed or it will cause a
4802     leak. It is invalid to use the command buffer after this is called.
4803     
4804     This must be called from the thread the command buffer was acquired on.
4805     
4806     All commands in the submission are guaranteed to begin executing before any
4807     command in a subsequent submission begins executing.
4808     
4809     Params:
4810         command_buffer = a command buffer.
4811 
4812     Returns:
4813         a fence associated with the command buffer, or NULL on failure;
4814         call SDL_GetError() for more information.
4815 
4816     See_Also:
4817         $(D SDL_AcquireGPUCommandBuffer)
4818         $(D SDL_WaitAndAcquireGPUSwapchainTexture)
4819         $(D SDL_AcquireGPUSwapchainTexture)
4820         $(D SDL_SubmitGPUCommandBuffer)
4821         $(D SDL_ReleaseGPUFence)
4822 */
4823 extern SDL_GPUFence* SDL_SubmitGPUCommandBufferAndAcquireFence(
4824 SDL_GPUCommandBuffer* command_buffer);
4825 
4826 /**
4827     Cancels a command buffer.
4828     
4829     None of the enqueued commands are executed.
4830     
4831     It is an error to call this function after a swapchain texture has been
4832     acquired.
4833     
4834     This must be called from the thread the command buffer was acquired on.
4835     
4836     You must not reference the command buffer after calling this function.
4837     
4838     Params:
4839         command_buffer = a command buffer.
4840         
4841     Returns:
4842         true on success, false on error; call SDL_GetError() for more
4843         information.
4844 
4845     See_Also:
4846         $(D SDL_WaitAndAcquireGPUSwapchainTexture)
4847         $(D SDL_AcquireGPUCommandBuffer)
4848         $(D SDL_AcquireGPUSwapchainTexture)
4849 */
4850 extern bool SDL_CancelGPUCommandBuffer(
4851 SDL_GPUCommandBuffer* command_buffer);
4852 
4853 /**
4854     Blocks the thread until the GPU is completely idle.
4855     
4856     Params:
4857         device = a GPU context.
4858 
4859     Returns:
4860         true on success, false on failure; call SDL_GetError() for more
4861         information.
4862 
4863     See_Also:
4864         $(D SDL_WaitForGPUFences)
4865 */
4866 extern bool SDL_WaitForGPUIdle(
4867 SDL_GPUDevice* device);
4868 
4869 /**
4870     Blocks the thread until the given fences are signaled.
4871     
4872     Params:
4873         device =        a GPU context.
4874         wait_all =      if 0, wait for any fence to be signaled, if 1, wait for all
4875                         fences to be signaled.
4876         fences =        an array of fences to wait on.
4877         num_fences =    the number of fences in the fences array.
4878 
4879     Returns:
4880         true on success, false on failure; call SDL_GetError() for more
4881         information.
4882 
4883     See_Also:
4884         $(D SDL_SubmitGPUCommandBufferAndAcquireFence)
4885         $(D SDL_WaitForGPUIdle)
4886 */
4887 extern bool SDL_WaitForGPUFences(
4888 SDL_GPUDevice* device,
4889 bool wait_all,
4890 const(SDL_GPUFence*)* fences,
4891 Uint32 num_fences);
4892 
4893 /**
4894     Checks the status of a fence.
4895     
4896     Params:
4897         device =    a GPU context.
4898         fence =     a fence.
4899     
4900     Returns:
4901         true if the fence is signaled, false if it is not.
4902 
4903     See_Also:
4904         $(D SDL_SubmitGPUCommandBufferAndAcquireFence)
4905 */
4906 extern bool SDL_QueryGPUFence(
4907 SDL_GPUDevice* device,
4908 SDL_GPUFence* fence);
4909 
4910 /**
4911     Releases a fence obtained from SDL_SubmitGPUCommandBufferAndAcquireFence.
4912     
4913     Params:
4914         device =    a GPU context.
4915         fence =     a fence.
4916 
4917     See_Also:
4918         $(D SDL_SubmitGPUCommandBufferAndAcquireFence)
4919 */
4920 extern void SDL_ReleaseGPUFence(
4921 SDL_GPUDevice* device,
4922 SDL_GPUFence* fence);
4923 
4924 /* Format Info */
4925 
4926 /**
4927     Obtains the texel block size for a texture format.
4928     
4929     Params:
4930         format = the texture format you want to know the texel size of.
4931 
4932     Returns:
4933         the texel block size of the texture format.
4934 
4935     See_Also:
4936         $(D SDL_UploadToGPUTexture)
4937 */
4938 extern Uint32 SDL_GPUTextureFormatTexelBlockSize(
4939 SDL_GPUTextureFormat format);
4940 
4941 /**
4942     Determines whether a texture format is supported for a given type and
4943     usage.
4944     
4945     Params:
4946         device =    a GPU context.
4947         format =    the texture format to check.
4948         type =      the type of texture (2D, 3D, Cube).
4949         usage =     a bitmask of all usage scenarios to check.
4950         
4951     Returns:
4952         whether the texture format is supported for this type and usage.
4953 */
4954 extern bool SDL_GPUTextureSupportsFormat(
4955 SDL_GPUDevice* device,
4956 SDL_GPUTextureFormat format,
4957 SDL_GPUTextureType type,
4958 SDL_GPUTextureUsageFlags usage);
4959 
4960 /**
4961     Determines if a sample count for a texture format is supported.
4962     
4963     Params:
4964         device =        a GPU context.
4965         format =        the texture format to check.
4966         sample_count =  the sample count to check.
4967 
4968     Returns:
4969         a hardware-specific version of min(preferred, possible).
4970 */
4971 extern bool SDL_GPUTextureSupportsSampleCount(
4972 SDL_GPUDevice* device,
4973 SDL_GPUTextureFormat format,
4974 SDL_GPUSampleCount sample_count);
4975 
4976 /**
4977     Calculate the size in bytes of a texture format with dimensions.
4978     
4979     Params:
4980         format =                a texture format.
4981         width =                 width in pixels.
4982         height =                height in pixels.
4983         depth_or_layer_count =  depth for 3D textures or layer count otherwise.
4984 
4985     Returns:
4986         the size of a texture with this format and dimensions.
4987 */
4988 extern Uint32 SDL_CalculateGPUTextureFormatSize(
4989 SDL_GPUTextureFormat format,
4990 Uint32 width,
4991 Uint32 height,
4992 Uint32 depth_or_layer_count);
4993 
4994 version (SDL_PLATFORM_GDK) {
4995 
4996     /**
4997         Call this to suspend GPU operation on Xbox when you receive the
4998         SDL_EVENT_DID_ENTER_BACKGROUND event.
4999 
5000         Do NOT call any SDL_GPU functions after calling this function! This must
5001         also be called before calling SDL_GDKSuspendComplete.
5002 
5003         Params:
5004             device = a GPU context.
5005         
5006         See_Also:
5007             $(D SDL_AddEventWatch)
5008     */
5009     extern void SDL_GDKSuspendGPU(SDL_GPUDevice* device);
5010 
5011     /**
5012         Call this to resume GPU operation on Xbox when you receive the
5013         SDL_EVENT_WILL_ENTER_FOREGROUND event.
5014 
5015         When resuming, this function MUST be called before calling any other
5016         SDL_GPU functions.
5017 
5018         Params:
5019             device = a GPU context.
5020         
5021         See_Also
5022             $(D SDL_AddEventWatch)
5023     */
5024     extern void SDL_GDKResumeGPU(SDL_GPUDevice* device);
5025 }