SDL 3.0
SDL_gpu.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2024 Sam Lantinga <slouken@libsdl.org>
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/* WIKI CATEGORY: GPU */
23
24/**
25 * # CategoryGPU
26 *
27 * Include file for SDL GPU API functions
28 */
29
30#ifndef SDL_gpu_h_
31#define SDL_gpu_h_
32
33#include <SDL3/SDL_stdinc.h>
34#include <SDL3/SDL_pixels.h>
35#include <SDL3/SDL_properties.h>
36#include <SDL3/SDL_rect.h>
37#include <SDL3/SDL_surface.h>
38#include <SDL3/SDL_video.h>
39
40#include <SDL3/SDL_begin_code.h>
41#ifdef __cplusplus
42extern "C" {
43#endif /* __cplusplus */
44
45/* Type Declarations */
46
47/**
48 * An opaque handle representing the SDL_GPU context.
49 *
50 * \since This struct is available since SDL 3.0.0
51 */
53
54/**
55 * An opaque handle representing a buffer.
56 *
57 * Used for vertices, indices, indirect draw commands, and general compute
58 * data.
59 *
60 * \since This struct is available since SDL 3.0.0
61 *
62 * \sa SDL_CreateGPUBuffer
63 * \sa SDL_SetGPUBufferName
64 * \sa SDL_UploadToGPUBuffer
65 * \sa SDL_DownloadFromGPUBuffer
66 * \sa SDL_CopyGPUBufferToBuffer
67 * \sa SDL_BindGPUVertexBuffers
68 * \sa SDL_BindGPUIndexBuffer
69 * \sa SDL_BindGPUVertexStorageBuffers
70 * \sa SDL_BindGPUFragmentStorageBuffers
71 * \sa SDL_DrawGPUPrimitivesIndirect
72 * \sa SDL_DrawGPUIndexedPrimitivesIndirect
73 * \sa SDL_BindGPUComputeStorageBuffers
74 * \sa SDL_DispatchGPUComputeIndirect
75 * \sa SDL_ReleaseGPUBuffer
76 */
78
79/**
80 * An opaque handle representing a transfer buffer.
81 *
82 * Used for transferring data to and from the device.
83 *
84 * \since This struct is available since SDL 3.0.0
85 *
86 * \sa SDL_CreateGPUTransferBuffer
87 * \sa SDL_MapGPUTransferBuffer
88 * \sa SDL_UnmapGPUTransferBuffer
89 * \sa SDL_UploadToGPUBuffer
90 * \sa SDL_UploadToGPUTexture
91 * \sa SDL_DownloadFromGPUBuffer
92 * \sa SDL_DownloadFromGPUTexture
93 * \sa SDL_ReleaseGPUTransferBuffer
94 */
96
97/**
98 * An opaque handle representing a texture.
99 *
100 * \since This struct is available since SDL 3.0.0
101 *
102 * \sa SDL_CreateGPUTexture
103 * \sa SDL_SetGPUTextureName
104 * \sa SDL_UploadToGPUTexture
105 * \sa SDL_DownloadFromGPUTexture
106 * \sa SDL_CopyGPUTextureToTexture
107 * \sa SDL_BindGPUVertexSamplers
108 * \sa SDL_BindGPUVertexStorageTextures
109 * \sa SDL_BindGPUFragmentSamplers
110 * \sa SDL_BindGPUFragmentStorageTextures
111 * \sa SDL_BindGPUComputeStorageTextures
112 * \sa SDL_GenerateMipmapsForGPUTexture
113 * \sa SDL_BlitGPUTexture
114 * \sa SDL_ReleaseGPUTexture
115 */
117
118/**
119 * An opaque handle representing a sampler.
120 *
121 * \since This struct is available since SDL 3.0.0
122 *
123 * \sa SDL_CreateGPUSampler
124 * \sa SDL_BindGPUVertexSamplers
125 * \sa SDL_BindGPUFragmentSamplers
126 * \sa SDL_ReleaseGPUSampler
127 */
129
130/**
131 * An opaque handle representing a compiled shader object.
132 *
133 * \since This struct is available since SDL 3.0.0
134 *
135 * \sa SDL_CreateGPUShader
136 * \sa SDL_CreateGPUGraphicsPipeline
137 * \sa SDL_ReleaseGPUShader
138 */
140
141/**
142 * An opaque handle representing a compute pipeline.
143 *
144 * Used during compute passes.
145 *
146 * \since This struct is available since SDL 3.0.0
147 *
148 * \sa SDL_CreateGPUComputePipeline
149 * \sa SDL_BindGPUComputePipeline
150 * \sa SDL_ReleaseGPUComputePipeline
151 */
153
154/**
155 * An opaque handle representing a graphics pipeline.
156 *
157 * Used during render passes.
158 *
159 * \since This struct is available since SDL 3.0.0
160 *
161 * \sa SDL_CreateGPUGraphicsPipeline
162 * \sa SDL_BindGPUGraphicsPipeline
163 * \sa SDL_ReleaseGPUGraphicsPipeline
164 */
166
167/**
168 * An opaque handle representing a command buffer.
169 *
170 * Most state is managed via command buffers. When setting state using a
171 * command buffer, that state is local to the command buffer.
172 *
173 * Commands only begin execution on the GPU once SDL_SubmitGPUCommandBuffer is
174 * called. Once the command buffer is submitted, it is no longer valid to use
175 * it.
176 *
177 * Command buffers are executed in submission order. If you submit command
178 * buffer A and then command buffer B all commands in A will begin executing
179 * before any command in B begins executing.
180 *
181 * In multi-threading scenarios, you should acquire and submit a command
182 * buffer on the same thread. As long as you satisfy this requirement, all
183 * functionality related to command buffers is thread-safe.
184 *
185 * \since This struct is available since SDL 3.0.0
186 *
187 * \sa SDL_AcquireGPUCommandBuffer
188 * \sa SDL_SubmitGPUCommandBuffer
189 * \sa SDL_SubmitGPUCommandBufferAndAcquireFence
190 */
192
193/**
194 * An opaque handle representing a render pass.
195 *
196 * This handle is transient and should not be held or referenced after
197 * SDL_EndGPURenderPass is called.
198 *
199 * \since This struct is available since SDL 3.0.0
200 *
201 * \sa SDL_BeginGPURenderPass
202 * \sa SDL_EndGPURenderPass
203 */
205
206/**
207 * An opaque handle representing a compute pass.
208 *
209 * This handle is transient and should not be held or referenced after
210 * SDL_EndGPUComputePass is called.
211 *
212 * \since This struct is available since SDL 3.0.0
213 *
214 * \sa SDL_BeginGPUComputePass
215 * \sa SDL_EndGPUComputePass
216 */
218
219/**
220 * An opaque handle representing a copy pass.
221 *
222 * This handle is transient and should not be held or referenced after
223 * SDL_EndGPUCopyPass is called.
224 *
225 * \since This struct is available since SDL 3.0.0
226 *
227 * \sa SDL_BeginGPUCopyPass
228 * \sa SDL_EndGPUCopyPass
229 */
231
232/**
233 * An opaque handle representing a fence.
234 *
235 * \since This struct is available since SDL 3.0.0
236 *
237 * \sa SDL_SubmitGPUCommandBufferAndAcquireFence
238 * \sa SDL_QueryGPUFence
239 * \sa SDL_WaitForGPUFences
240 * \sa SDL_ReleaseGPUFence
241 */
243
244/**
245 * Specifies the primitive topology of a graphics pipeline.
246 *
247 * \since This enum is available since SDL 3.0.0
248 *
249 * \sa SDL_CreateGPUGraphicsPipeline
250 */
252{
253 SDL_GPU_PRIMITIVETYPE_TRIANGLELIST, /**< A series of separate triangles. */
254 SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP, /**< A series of connected triangles. */
255 SDL_GPU_PRIMITIVETYPE_LINELIST, /**< A series of separate lines. */
256 SDL_GPU_PRIMITIVETYPE_LINESTRIP, /**< A series of connected lines. */
257 SDL_GPU_PRIMITIVETYPE_POINTLIST /**< A series of separate points. */
259
260/**
261 * Specifies how the contents of a texture attached to a render pass are
262 * treated at the beginning of the render pass.
263 *
264 * \since This enum is available since SDL 3.0.0
265 *
266 * \sa SDL_BeginGPURenderPass
267 */
268typedef enum SDL_GPULoadOp
269{
270 SDL_GPU_LOADOP_LOAD, /**< The previous contents of the texture will be preserved. */
271 SDL_GPU_LOADOP_CLEAR, /**< The contents of the texture will be cleared to a color. */
272 SDL_GPU_LOADOP_DONT_CARE /**< The previous contents of the texture need not be preserved. The contents will be undefined. */
274
275/**
276 * Specifies how the contents of a texture attached to a render pass are
277 * treated at the end of the render pass.
278 *
279 * \since This enum is available since SDL 3.0.0
280 *
281 * \sa SDL_BeginGPURenderPass
282 */
283typedef enum SDL_GPUStoreOp
284{
285 SDL_GPU_STOREOP_STORE, /**< The contents generated during the render pass will be written to memory. */
286 SDL_GPU_STOREOP_DONT_CARE, /**< The contents generated during the render pass are not needed and may be discarded. The contents will be undefined. */
287 SDL_GPU_STOREOP_RESOLVE, /**< 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. */
288 SDL_GPU_STOREOP_RESOLVE_AND_STORE /**< 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. */
290
291/**
292 * Specifies the size of elements in an index buffer.
293 *
294 * \since This enum is available since SDL 3.0.0
295 *
296 * \sa SDL_CreateGPUGraphicsPipeline
297 */
299{
300 SDL_GPU_INDEXELEMENTSIZE_16BIT, /**< The index elements are 16-bit. */
301 SDL_GPU_INDEXELEMENTSIZE_32BIT /**< The index elements are 32-bit. */
303
304/**
305 * Specifies the pixel format of a texture.
306 *
307 * Texture format support varies depending on driver, hardware, and usage
308 * flags. In general, you should use SDL_GPUTextureSupportsFormat to query if
309 * a format is supported before using it. However, there are a few guaranteed
310 * formats.
311 *
312 * For SAMPLER usage, the following formats are universally supported:
313 *
314 * - R8G8B8A8_UNORM
315 * - B8G8R8A8_UNORM
316 * - R8_UNORM
317 * - R8_SNORM
318 * - R8G8_UNORM
319 * - R8G8_SNORM
320 * - R8G8B8A8_SNORM
321 * - R16_FLOAT
322 * - R16G16_FLOAT
323 * - R16G16B16A16_FLOAT
324 * - R32_FLOAT
325 * - R32G32_FLOAT
326 * - R32G32B32A32_FLOAT
327 * - R11G11B10_UFLOAT
328 * - R8G8B8A8_UNORM_SRGB
329 * - B8G8R8A8_UNORM_SRGB
330 * - D16_UNORM
331 *
332 * For COLOR_TARGET usage, the following formats are universally supported:
333 *
334 * - R8G8B8A8_UNORM
335 * - B8G8R8A8_UNORM
336 * - R8_UNORM
337 * - R16_FLOAT
338 * - R16G16_FLOAT
339 * - R16G16B16A16_FLOAT
340 * - R32_FLOAT
341 * - R32G32_FLOAT
342 * - R32G32B32A32_FLOAT
343 * - R8_UINT
344 * - R8G8_UINT
345 * - R8G8B8A8_UINT
346 * - R16_UINT
347 * - R16G16_UINT
348 * - R16G16B16A16_UINT
349 * - R8_INT
350 * - R8G8_INT
351 * - R8G8B8A8_INT
352 * - R16_INT
353 * - R16G16_INT
354 * - R16G16B16A16_INT
355 * - R8G8B8A8_UNORM_SRGB
356 * - B8G8R8A8_UNORM_SRGB
357 *
358 * For STORAGE usages, the following formats are universally supported:
359 *
360 * - R8G8B8A8_UNORM
361 * - R8G8B8A8_SNORM
362 * - R16G16B16A16_FLOAT
363 * - R32_FLOAT
364 * - R32G32_FLOAT
365 * - R32G32B32A32_FLOAT
366 * - R8G8B8A8_UINT
367 * - R16G16B16A16_UINT
368 * - R8G8B8A8_INT
369 * - R16G16B16A16_INT
370 *
371 * For DEPTH_STENCIL_TARGET usage, the following formats are universally
372 * supported:
373 *
374 * - D16_UNORM
375 * - Either (but not necessarily both!) D24_UNORM or D32_SFLOAT
376 * - Either (but not necessarily both!) D24_UNORM_S8_UINT or
377 * D32_SFLOAT_S8_UINT
378 *
379 * Unless D16_UNORM is sufficient for your purposes, always check which of
380 * D24/D32 is supported before creating a depth-stencil texture!
381 *
382 * \since This enum is available since SDL 3.0.0
383 *
384 * \sa SDL_CreateGPUTexture
385 * \sa SDL_GPUTextureSupportsFormat
386 */
388{
390
391 /* Unsigned Normalized Float Color Formats */
404 /* Compressed Unsigned Normalized Float Color Formats */
411 /* Compressed Signed Float Color Formats */
413 /* Compressed Unsigned Float Color Formats */
415 /* Signed Normalized Float Color Formats */
422 /* Signed Float Color Formats */
429 /* Unsigned Float Color Formats */
431 /* Unsigned Integer Color Formats */
438 /* Signed Integer Color Formats */
445 /* SRGB Unsigned Normalized Color Formats */
448 /* Compressed SRGB Unsigned Normalized Color Formats */
453 /* Depth Formats */
460
461/**
462 * Specifies how a texture is intended to be used by the client.
463 *
464 * A texture must have at least one usage flag. Note that some usage flag
465 * combinations are invalid.
466 *
467 * \since This enum is available since SDL 3.0.0
468 *
469 * \sa SDL_CreateGPUTexture
470 */
472
473#define SDL_GPU_TEXTUREUSAGE_SAMPLER (1u << 0) /**< Texture supports sampling. */
474#define SDL_GPU_TEXTUREUSAGE_COLOR_TARGET (1u << 1) /**< Texture is a color render target. */
475#define SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET (1u << 2) /**< Texture is a depth stencil target. */
476#define SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ (1u << 3) /**< Texture supports storage reads in graphics stages. */
477#define SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ (1u << 4) /**< Texture supports storage reads in the compute stage. */
478#define SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE (1u << 5) /**< Texture supports storage writes in the compute stage. */
479
480/**
481 * Specifies the type of a texture.
482 *
483 * \since This enum is available since SDL 3.0.0
484 *
485 * \sa SDL_CreateGPUTexture
486 */
488{
489 SDL_GPU_TEXTURETYPE_2D, /**< The texture is a 2-dimensional image. */
490 SDL_GPU_TEXTURETYPE_2D_ARRAY, /**< The texture is a 2-dimensional array image. */
491 SDL_GPU_TEXTURETYPE_3D, /**< The texture is a 3-dimensional image. */
492 SDL_GPU_TEXTURETYPE_CUBE, /**< The texture is a cube image. */
493 SDL_GPU_TEXTURETYPE_CUBE_ARRAY /**< The texture is a cube array image. */
495
496/**
497 * Specifies the sample count of a texture.
498 *
499 * Used in multisampling. Note that this value only applies when the texture
500 * is used as a render target.
501 *
502 * \since This enum is available since SDL 3.0.0
503 *
504 * \sa SDL_CreateGPUTexture
505 * \sa SDL_GPUTextureSupportsSampleCount
506 */
508{
509 SDL_GPU_SAMPLECOUNT_1, /**< No multisampling. */
510 SDL_GPU_SAMPLECOUNT_2, /**< MSAA 2x */
511 SDL_GPU_SAMPLECOUNT_4, /**< MSAA 4x */
512 SDL_GPU_SAMPLECOUNT_8 /**< MSAA 8x */
514
515
516/**
517 * Specifies the face of a cube map.
518 *
519 * Can be passed in as the layer field in texture-related structs.
520 *
521 * \since This enum is available since SDL 3.0.0
522 */
532
533/**
534 * Specifies how a buffer is intended to be used by the client.
535 *
536 * A buffer must have at least one usage flag. Note that some usage flag
537 * combinations are invalid.
538 *
539 * \since This enum is available since SDL 3.0.0
540 *
541 * \sa SDL_CreateGPUBuffer
542 */
544
545#define SDL_GPU_BUFFERUSAGE_VERTEX (1u << 0) /**< Buffer is a vertex buffer. */
546#define SDL_GPU_BUFFERUSAGE_INDEX (1u << 1) /**< Buffer is an index buffer. */
547#define SDL_GPU_BUFFERUSAGE_INDIRECT (1u << 2) /**< Buffer is an indirect buffer. */
548#define SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ (1u << 3) /**< Buffer supports storage reads in graphics stages. */
549#define SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ (1u << 4) /**< Buffer supports storage reads in the compute stage. */
550#define SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE (1u << 5) /**< Buffer supports storage writes in the compute stage. */
551
552/**
553 * Specifies how a transfer buffer is intended to be used by the client.
554 *
555 * Note that mapping and copying FROM an upload transfer buffer or TO a
556 * download transfer buffer is undefined behavior.
557 *
558 * \since This enum is available since SDL 3.0.0
559 *
560 * \sa SDL_CreateGPUTransferBuffer
561 */
567
568/**
569 * Specifies which stage a shader program corresponds to.
570 *
571 * \since This enum is available since SDL 3.0.0
572 *
573 * \sa SDL_CreateGPUShader
574 */
580
581/**
582 * Specifies the format of shader code.
583 *
584 * Each format corresponds to a specific backend that accepts it.
585 *
586 * \since This datatype is available since SDL 3.0.0
587 *
588 * \sa SDL_CreateGPUShader
589 */
591
592#define SDL_GPU_SHADERFORMAT_INVALID 0
593#define SDL_GPU_SHADERFORMAT_PRIVATE (1u << 0) /**< Shaders for NDA'd platforms. */
594#define SDL_GPU_SHADERFORMAT_SPIRV (1u << 1) /**< SPIR-V shaders for Vulkan. */
595#define SDL_GPU_SHADERFORMAT_DXBC (1u << 2) /**< DXBC SM5_0 shaders for D3D11. */
596#define SDL_GPU_SHADERFORMAT_DXIL (1u << 3) /**< DXIL shaders for D3D12. */
597#define SDL_GPU_SHADERFORMAT_MSL (1u << 4) /**< MSL shaders for Metal. */
598#define SDL_GPU_SHADERFORMAT_METALLIB (1u << 5) /**< Precompiled metallib shaders for Metal. */
599
600/**
601 * Specifies the format of a vertex attribute.
602 *
603 * \since This enum is available since SDL 3.0.0
604 *
605 * \sa SDL_CreateGPUGraphicsPipeline
606 */
608{
610
611 /* 32-bit Signed Integers */
616
617 /* 32-bit Unsigned Integers */
622
623 /* 32-bit Floats */
628
629 /* 8-bit Signed Integers */
632
633 /* 8-bit Unsigned Integers */
636
637 /* 8-bit Signed Normalized */
640
641 /* 8-bit Unsigned Normalized */
644
645 /* 16-bit Signed Integers */
648
649 /* 16-bit Unsigned Integers */
652
653 /* 16-bit Signed Normalized */
656
657 /* 16-bit Unsigned Normalized */
660
661 /* 16-bit Floats */
665
666/**
667 * Specifies the rate at which vertex attributes are pulled from buffers.
668 *
669 * \since This enum is available since SDL 3.0.0
670 *
671 * \sa SDL_CreateGPUGraphicsPipeline
672 */
674{
675 SDL_GPU_VERTEXINPUTRATE_VERTEX, /**< Attribute addressing is a function of the vertex index. */
676 SDL_GPU_VERTEXINPUTRATE_INSTANCE /**< Attribute addressing is a function of the instance index. */
678
679/**
680 * Specifies the fill mode of the graphics pipeline.
681 *
682 * \since This enum is available since SDL 3.0.0
683 *
684 * \sa SDL_CreateGPUGraphicsPipeline
685 */
686typedef enum SDL_GPUFillMode
687{
688 SDL_GPU_FILLMODE_FILL, /**< Polygons will be rendered via rasterization. */
689 SDL_GPU_FILLMODE_LINE /**< Polygon edges will be drawn as line segments. */
691
692/**
693 * Specifies the facing direction in which triangle faces will be culled.
694 *
695 * \since This enum is available since SDL 3.0.0
696 *
697 * \sa SDL_CreateGPUGraphicsPipeline
698 */
699typedef enum SDL_GPUCullMode
700{
701 SDL_GPU_CULLMODE_NONE, /**< No triangles are culled. */
702 SDL_GPU_CULLMODE_FRONT, /**< Front-facing triangles are culled. */
703 SDL_GPU_CULLMODE_BACK /**< Back-facing triangles are culled. */
705
706/**
707 * Specifies the vertex winding that will cause a triangle to be determined to
708 * be front-facing.
709 *
710 * \since This enum is available since SDL 3.0.0
711 *
712 * \sa SDL_CreateGPUGraphicsPipeline
713 */
715{
716 SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE, /**< A triangle with counter-clockwise vertex winding will be considered front-facing. */
717 SDL_GPU_FRONTFACE_CLOCKWISE /**< A triangle with clockwise vertex winding will be considered front-facing. */
719
720/**
721 * Specifies a comparison operator for depth, stencil and sampler operations.
722 *
723 * \since This enum is available since SDL 3.0.0
724 *
725 * \sa SDL_CreateGPUGraphicsPipeline
726 */
728{
730 SDL_GPU_COMPAREOP_NEVER, /**< The comparison always evaluates false. */
731 SDL_GPU_COMPAREOP_LESS, /**< The comparison evaluates reference < test. */
732 SDL_GPU_COMPAREOP_EQUAL, /**< The comparison evaluates reference == test. */
733 SDL_GPU_COMPAREOP_LESS_OR_EQUAL, /**< The comparison evaluates reference <= test. */
734 SDL_GPU_COMPAREOP_GREATER, /**< The comparison evaluates reference > test. */
735 SDL_GPU_COMPAREOP_NOT_EQUAL, /**< The comparison evaluates reference != test. */
736 SDL_GPU_COMPAREOP_GREATER_OR_EQUAL, /**< The comparison evalutes reference >= test. */
737 SDL_GPU_COMPAREOP_ALWAYS /**< The comparison always evaluates true. */
739
740/**
741 * Specifies what happens to a stored stencil value if stencil tests fail or
742 * pass.
743 *
744 * \since This enum is available since SDL 3.0.0
745 *
746 * \sa SDL_CreateGPUGraphicsPipeline
747 */
749{
751 SDL_GPU_STENCILOP_KEEP, /**< Keeps the current value. */
752 SDL_GPU_STENCILOP_ZERO, /**< Sets the value to 0. */
753 SDL_GPU_STENCILOP_REPLACE, /**< Sets the value to reference. */
754 SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP, /**< Increments the current value and clamps to the maximum value. */
755 SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP, /**< Decrements the current value and clamps to 0. */
756 SDL_GPU_STENCILOP_INVERT, /**< Bitwise-inverts the current value. */
757 SDL_GPU_STENCILOP_INCREMENT_AND_WRAP, /**< Increments the current value and wraps back to 0. */
758 SDL_GPU_STENCILOP_DECREMENT_AND_WRAP /**< Decrements the current value and wraps to the maximum value. */
760
761/**
762 * Specifies the operator to be used when pixels in a render target are
763 * blended with existing pixels in the texture.
764 *
765 * The source color is the value written by the fragment shader. The
766 * destination color is the value currently existing in the texture.
767 *
768 * \since This enum is available since SDL 3.0.0
769 *
770 * \sa SDL_CreateGPUGraphicsPipeline
771 */
772typedef enum SDL_GPUBlendOp
773{
775 SDL_GPU_BLENDOP_ADD, /**< (source * source_factor) + (destination * destination_factor) */
776 SDL_GPU_BLENDOP_SUBTRACT, /**< (source * source_factor) - (destination * destination_factor) */
777 SDL_GPU_BLENDOP_REVERSE_SUBTRACT, /**< (destination * destination_factor) - (source * source_factor) */
778 SDL_GPU_BLENDOP_MIN, /**< min(source, destination) */
779 SDL_GPU_BLENDOP_MAX /**< max(source, destination) */
781
782/**
783 * Specifies a blending factor to be used when pixels in a render target are
784 * blended with existing pixels in the texture.
785 *
786 * The source color is the value written by the fragment shader. The
787 * destination color is the value currently existing in the texture.
788 *
789 * \since This enum is available since SDL 3.0.0
790 *
791 * \sa SDL_CreateGPUGraphicsPipeline
792 */
794{
798 SDL_GPU_BLENDFACTOR_SRC_COLOR, /**< source color */
800 SDL_GPU_BLENDFACTOR_DST_COLOR, /**< destination color */
801 SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR, /**< 1 - destination color */
802 SDL_GPU_BLENDFACTOR_SRC_ALPHA, /**< source alpha */
804 SDL_GPU_BLENDFACTOR_DST_ALPHA, /**< destination alpha */
805 SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA, /**< 1 - destination alpha */
808 SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE /**< min(source alpha, 1 - destination alpha) */
810
811/**
812 * Specifies which color components are written in a graphics pipeline.
813 *
814 * \since This enum is available since SDL 3.0.0
815 *
816 * \sa SDL_CreateGPUGraphicsPipeline
817 */
819
820#define SDL_GPU_COLORCOMPONENT_R (1u << 0) /**< the red component */
821#define SDL_GPU_COLORCOMPONENT_G (1u << 1) /**< the green component */
822#define SDL_GPU_COLORCOMPONENT_B (1u << 2) /**< the blue component */
823#define SDL_GPU_COLORCOMPONENT_A (1u << 3) /**< the alpha component */
824
825/**
826 * Specifies a filter operation used by a sampler.
827 *
828 * \since This enum is available since SDL 3.0.0
829 *
830 * \sa SDL_CreateGPUSampler
831 */
832typedef enum SDL_GPUFilter
833{
834 SDL_GPU_FILTER_NEAREST, /**< Point filtering. */
835 SDL_GPU_FILTER_LINEAR /**< Linear filtering. */
837
838/**
839 * Specifies a mipmap mode used by a sampler.
840 *
841 * \since This enum is available since SDL 3.0.0
842 *
843 * \sa SDL_CreateGPUSampler
844 */
850
851/**
852 * Specifies behavior of texture sampling when the coordinates exceed the 0-1
853 * range.
854 *
855 * \since This enum is available since SDL 3.0.0
856 *
857 * \sa SDL_CreateGPUSampler
858 */
860{
861 SDL_GPU_SAMPLERADDRESSMODE_REPEAT, /**< Specifies that the coordinates will wrap around. */
862 SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT, /**< Specifies that the coordinates will wrap around mirrored. */
863 SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE /**< Specifies that the coordinates will clamp to the 0-1 range. */
865
866/**
867 * Specifies the timing that will be used to present swapchain textures to the
868 * OS.
869 *
870 * Note that this value affects the behavior of
871 * SDL_AcquireGPUSwapchainTexture. VSYNC mode will always be supported.
872 * IMMEDIATE and MAILBOX modes may not be supported on certain systems.
873 *
874 * It is recommended to query SDL_WindowSupportsGPUPresentMode after claiming
875 * the window if you wish to change the present mode to IMMEDIATE or MAILBOX.
876 *
877 * - VSYNC: Waits for vblank before presenting. No tearing is possible. If
878 * there is a pending image to present, the new image is enqueued for
879 * presentation. Disallows tearing at the cost of visual latency. When using
880 * this present mode, AcquireSwapchainTexture will block if too many frames
881 * are in flight.
882 * - IMMEDIATE: Immediately presents. Lowest latency option, but tearing may
883 * occur. When using this mode, AcquireSwapchainTexture will return NULL if
884 * too many frames are in flight.
885 * - MAILBOX: Waits for vblank before presenting. No tearing is possible. If
886 * there is a pending image to present, the pending image is replaced by the
887 * new image. Similar to VSYNC, but with reduced visual latency. When using
888 * this mode, AcquireSwapchainTexture will return NULL if too many frames
889 * are in flight.
890 *
891 * \since This enum is available since SDL 3.0.0
892 *
893 * \sa SDL_SetGPUSwapchainParameters
894 * \sa SDL_WindowSupportsGPUPresentMode
895 * \sa SDL_AcquireGPUSwapchainTexture
896 */
903
904/**
905 * Specifies the texture format and colorspace of the swapchain textures.
906 *
907 * SDR will always be supported. Other compositions may not be supported on
908 * certain systems.
909 *
910 * It is recommended to query SDL_WindowSupportsGPUSwapchainComposition after
911 * claiming the window if you wish to change the swapchain composition from
912 * SDR.
913 *
914 * - SDR: B8G8R8A8 or R8G8B8A8 swapchain. Pixel values are in nonlinear sRGB
915 * encoding.
916 * - SDR_LINEAR: B8G8R8A8_SRGB or R8G8B8A8_SRGB swapchain. Pixel values are in
917 * nonlinear sRGB encoding.
918 * - HDR_EXTENDED_LINEAR: R16G16B16A16_SFLOAT swapchain. Pixel values are in
919 * extended linear encoding.
920 * - HDR10_ST2048: A2R10G10B10 or A2B10G10R10 swapchain. Pixel values are in
921 * PQ ST2048 encoding.
922 *
923 * \since This enum is available since SDL 3.0.0
924 *
925 * \sa SDL_SetGPUSwapchainParameters
926 * \sa SDL_WindowSupportsGPUSwapchainComposition
927 * \sa SDL_AcquireGPUSwapchainTexture
928 */
936
937/* Structures */
938
939/**
940 * A structure specifying a viewport.
941 *
942 * \since This struct is available since SDL 3.0.0
943 *
944 * \sa SDL_SetGPUViewport
945 */
946typedef struct SDL_GPUViewport
947{
948 float x; /**< The left offset of the viewport. */
949 float y; /**< The top offset of the viewport. */
950 float w; /**< The width of the viewport. */
951 float h; /**< The height of the viewport. */
952 float min_depth; /**< The minimum depth of the viewport. */
953 float max_depth; /**< The maximum depth of the viewport. */
955
956/**
957 * A structure specifying parameters related to transferring data to or from a
958 * texture.
959 *
960 * \since This struct is available since SDL 3.0.0
961 *
962 * \sa SDL_UploadToGPUTexture
963 * \sa SDL_DownloadFromGPUTexture
964 */
966{
967 SDL_GPUTransferBuffer *transfer_buffer; /**< The transfer buffer used in the transfer operation. */
968 Uint32 offset; /**< The starting byte of the image data in the transfer buffer. */
969 Uint32 pixels_per_row; /**< The number of pixels from one row to the next. */
970 Uint32 rows_per_layer; /**< The number of rows from one layer/depth-slice to the next. */
972
973/**
974 * A structure specifying a location in a transfer buffer.
975 *
976 * Used when transferring buffer data to or from a transfer buffer.
977 *
978 * \since This struct is available since SDL 3.0.0
979 *
980 * \sa SDL_UploadToGPUBuffer
981 * \sa SDL_DownloadFromGPUBuffer
982 */
984{
985 SDL_GPUTransferBuffer *transfer_buffer; /**< The transfer buffer used in the transfer operation. */
986 Uint32 offset; /**< The starting byte of the buffer data in the transfer buffer. */
988
989/**
990 * A structure specifying a location in a texture.
991 *
992 * Used when copying data from one texture to another.
993 *
994 * \since This struct is available since SDL 3.0.0
995 *
996 * \sa SDL_CopyGPUTextureToTexture
997 */
999{
1000 SDL_GPUTexture *texture; /**< The texture used in the copy operation. */
1001 Uint32 mip_level; /**< The mip level index of the location. */
1002 Uint32 layer; /**< The layer index of the location. */
1003 Uint32 x; /**< The left offset of the location. */
1004 Uint32 y; /**< The top offset of the location. */
1005 Uint32 z; /**< The front offset of the location. */
1007
1008/**
1009 * A structure specifying a region of a texture.
1010 *
1011 * Used when transferring data to or from a texture.
1012 *
1013 * \since This struct is available since SDL 3.0.0
1014 *
1015 * \sa SDL_UploadToGPUTexture
1016 * \sa SDL_DownloadFromGPUTexture
1017 */
1019{
1020 SDL_GPUTexture *texture; /**< The texture used in the copy operation. */
1021 Uint32 mip_level; /**< The mip level index to transfer. */
1022 Uint32 layer; /**< The layer index to transfer. */
1023 Uint32 x; /**< The left offset of the region. */
1024 Uint32 y; /**< The top offset of the region. */
1025 Uint32 z; /**< The front offset of the region. */
1026 Uint32 w; /**< The width of the region. */
1027 Uint32 h; /**< The height of the region. */
1028 Uint32 d; /**< The depth of the region. */
1030
1031/**
1032 * A structure specifying a region of a texture used in the blit operation.
1033 *
1034 * \since This struct is available since SDL 3.0.0
1035 *
1036 * \sa SDL_BlitGPUTexture
1037 */
1038typedef struct SDL_GPUBlitRegion
1039{
1040 SDL_GPUTexture *texture; /**< The texture. */
1041 Uint32 mip_level; /**< The mip level index of the region. */
1042 Uint32 layer_or_depth_plane; /**< 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. */
1043 Uint32 x; /**< The left offset of the region. */
1044 Uint32 y; /**< The top offset of the region. */
1045 Uint32 w; /**< The width of the region. */
1046 Uint32 h; /**< The height of the region. */
1048
1049/**
1050 * A structure specifying a location in a buffer.
1051 *
1052 * Used when copying data between buffers.
1053 *
1054 * \since This struct is available since SDL 3.0.0
1055 *
1056 * \sa SDL_CopyGPUBufferToBuffer
1057 */
1059{
1060 SDL_GPUBuffer *buffer; /**< The buffer. */
1061 Uint32 offset; /**< The starting byte within the buffer. */
1063
1064/**
1065 * A structure specifying a region of a buffer.
1066 *
1067 * Used when transferring data to or from buffers.
1068 *
1069 * \since This struct is available since SDL 3.0.0
1070 *
1071 * \sa SDL_UploadToGPUBuffer
1072 * \sa SDL_DownloadFromGPUBuffer
1073 */
1075{
1076 SDL_GPUBuffer *buffer; /**< The buffer. */
1077 Uint32 offset; /**< The starting byte within the buffer. */
1078 Uint32 size; /**< The size in bytes of the region. */
1080
1081/**
1082 * A structure specifying the parameters of an indirect draw command.
1083 *
1084 * Note that the `first_vertex` and `first_instance` parameters are NOT
1085 * compatible with built-in vertex/instance ID variables in shaders (for
1086 * example, SV_VertexID). If your shader depends on these variables, the
1087 * correlating draw call parameter MUST be 0.
1088 *
1089 * \since This struct is available since SDL 3.0.0
1090 *
1091 * \sa SDL_DrawGPUPrimitivesIndirect
1092 */
1094{
1095 Uint32 num_vertices; /**< The number of vertices to draw. */
1096 Uint32 num_instances; /**< The number of instances to draw. */
1097 Uint32 first_vertex; /**< The index of the first vertex to draw. */
1098 Uint32 first_instance; /**< The ID of the first instance to draw. */
1100
1101/**
1102 * A structure specifying the parameters of an indexed indirect draw command.
1103 *
1104 * Note that the `first_vertex` and `first_instance` parameters are NOT
1105 * compatible with built-in vertex/instance ID variables in shaders (for
1106 * example, SV_VertexID). If your shader depends on these variables, the
1107 * correlating draw call parameter MUST be 0.
1108 *
1109 * \since This struct is available since SDL 3.0.0
1110 *
1111 * \sa SDL_DrawGPUIndexedPrimitivesIndirect
1112 */
1114{
1115 Uint32 num_indices; /**< The number of indices to draw per instance. */
1116 Uint32 num_instances; /**< The number of instances to draw. */
1117 Uint32 first_index; /**< The base index within the index buffer. */
1118 Sint32 vertex_offset; /**< The value added to the vertex index before indexing into the vertex buffer. */
1119 Uint32 first_instance; /**< The ID of the first instance to draw. */
1121
1122/**
1123 * A structure specifying the parameters of an indexed dispatch command.
1124 *
1125 * \since This struct is available since SDL 3.0.0
1126 *
1127 * \sa SDL_DispatchGPUComputeIndirect
1128 */
1130{
1131 Uint32 groupcount_x; /**< The number of local workgroups to dispatch in the X dimension. */
1132 Uint32 groupcount_y; /**< The number of local workgroups to dispatch in the Y dimension. */
1133 Uint32 groupcount_z; /**< The number of local workgroups to dispatch in the Z dimension. */
1135
1136/* State structures */
1137
1138/**
1139 * A structure specifying the parameters of a sampler.
1140 *
1141 * \since This function is available since SDL 3.0.0
1142 *
1143 * \sa SDL_CreateGPUSampler
1144 */
1146{
1147 SDL_GPUFilter min_filter; /**< The minification filter to apply to lookups. */
1148 SDL_GPUFilter mag_filter; /**< The magnification filter to apply to lookups. */
1149 SDL_GPUSamplerMipmapMode mipmap_mode; /**< The mipmap filter to apply to lookups. */
1150 SDL_GPUSamplerAddressMode address_mode_u; /**< The addressing mode for U coordinates outside [0, 1). */
1151 SDL_GPUSamplerAddressMode address_mode_v; /**< The addressing mode for V coordinates outside [0, 1). */
1152 SDL_GPUSamplerAddressMode address_mode_w; /**< The addressing mode for W coordinates outside [0, 1). */
1153 float mip_lod_bias; /**< The bias to be added to mipmap LOD calculation. */
1154 float max_anisotropy; /**< The anisotropy value clamp used by the sampler. If enable_anisotropy is SDL_FALSE, this is ignored. */
1155 SDL_GPUCompareOp compare_op; /**< The comparison operator to apply to fetched data before filtering. */
1156 float min_lod; /**< Clamps the minimum of the computed LOD value. */
1157 float max_lod; /**< Clamps the maximum of the computed LOD value. */
1158 SDL_bool enable_anisotropy; /**< SDL_TRUE to enable anisotropic filtering. */
1159 SDL_bool enable_compare; /**< SDL_TRUE to enable comparison against a reference value during lookups. */
1162
1163 SDL_PropertiesID props; /**< A properties ID for extensions. Should be 0 if no extensions are needed. */
1165
1166/**
1167 * A structure specifying the parameters of vertex buffers used in a graphics
1168 * pipeline.
1169 *
1170 * When you call SDL_BindGPUVertexBuffers, you specify the binding slots of
1171 * the vertex buffers. For example if you called SDL_BindGPUVertexBuffers with
1172 * a first_slot of 2 and num_bindings of 3, the binding slots 2, 3, 4 would be
1173 * used by the vertex buffers you pass in.
1174 *
1175 * Vertex attributes are linked to buffers via the buffer_slot field of
1176 * SDL_GPUVertexAttribute. For example, if an attribute has a buffer_slot of
1177 * 0, then that attribute belongs to the vertex buffer bound at slot 0.
1178 *
1179 * \since This struct is available since SDL 3.0.0
1180 *
1181 * \sa SDL_GPUVertexAttribute
1182 * \sa SDL_GPUVertexInputState
1183 */
1185{
1186 Uint32 slot; /**< The binding slot of the vertex buffer. */
1187 Uint32 pitch; /**< The byte pitch between consecutive elements of the vertex buffer. */
1188 SDL_GPUVertexInputRate input_rate; /**< Whether attribute addressing is a function of the vertex index or instance index. */
1189 Uint32 instance_step_rate; /**< 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 */
1191
1192/**
1193 * A structure specifying a vertex attribute.
1194 *
1195 * All vertex attribute locations provided to an SDL_GPUVertexInputState must
1196 * be unique.
1197 *
1198 * \since This struct is available since SDL 3.0.0
1199 *
1200 * \sa SDL_GPUVertexBufferDescription
1201 * \sa SDL_GPUVertexInputState
1202 */
1204{
1205 Uint32 location; /**< The shader input location index. */
1206 Uint32 buffer_slot; /**< The binding slot of the associated vertex buffer. */
1207 SDL_GPUVertexElementFormat format; /**< The size and type of the attribute data. */
1208 Uint32 offset; /**< The byte offset of this attribute relative to the start of the vertex element. */
1210
1211/**
1212 * A structure specifying the parameters of a graphics pipeline vertex input
1213 * state.
1214 *
1215 * \since This struct is available since SDL 3.0.0
1216 *
1217 * \sa SDL_GPUGraphicsPipelineCreateInfo
1218 */
1220{
1221 const SDL_GPUVertexBufferDescription *vertex_buffer_descriptions; /**< A pointer to an array of vertex buffer descriptions. */
1222 Uint32 num_vertex_buffers; /**< The number of vertex buffer descriptions in the above array. */
1223 const SDL_GPUVertexAttribute *vertex_attributes; /**< A pointer to an array of vertex attribute descriptions. */
1224 Uint32 num_vertex_attributes; /**< The number of vertex attribute descriptions in the above array. */
1226
1227/**
1228 * A structure specifying the stencil operation state of a graphics pipeline.
1229 *
1230 * \since This struct is available since SDL 3.0.0
1231 *
1232 * \sa SDL_GPUDepthStencilState
1233 */
1235{
1236 SDL_GPUStencilOp fail_op; /**< The action performed on samples that fail the stencil test. */
1237 SDL_GPUStencilOp pass_op; /**< The action performed on samples that pass the depth and stencil tests. */
1238 SDL_GPUStencilOp depth_fail_op; /**< The action performed on samples that pass the stencil test and fail the depth test. */
1239 SDL_GPUCompareOp compare_op; /**< The comparison operator used in the stencil test. */
1241
1242/**
1243 * A structure specifying the blend state of a color target.
1244 *
1245 * \since This struct is available since SDL 3.0.0
1246 *
1247 * \sa SDL_GPUColorTargetDescription
1248 */
1250{
1251 SDL_GPUBlendFactor src_color_blendfactor; /**< The value to be multiplied by the source RGB value. */
1252 SDL_GPUBlendFactor dst_color_blendfactor; /**< The value to be multiplied by the destination RGB value. */
1253 SDL_GPUBlendOp color_blend_op; /**< The blend operation for the RGB components. */
1254 SDL_GPUBlendFactor src_alpha_blendfactor; /**< The value to be multiplied by the source alpha. */
1255 SDL_GPUBlendFactor dst_alpha_blendfactor; /**< The value to be multiplied by the destination alpha. */
1256 SDL_GPUBlendOp alpha_blend_op; /**< The blend operation for the alpha component. */
1257 SDL_GPUColorComponentFlags color_write_mask; /**< A bitmask specifying which of the RGBA components are enabled for writing. Writes to all channels if enable_color_write_mask is SDL_FALSE. */
1258 SDL_bool enable_blend; /**< Whether blending is enabled for the color target. */
1259 SDL_bool enable_color_write_mask; /**< Whether the color write mask is enabled. */
1263
1264
1265/**
1266 * A structure specifying code and metadata for creating a shader object.
1267 *
1268 * \since This struct is available since SDL 3.0.0
1269 *
1270 * \sa SDL_CreateGPUShader
1271 */
1273{
1274 size_t code_size; /**< The size in bytes of the code pointed to. */
1275 const Uint8 *code; /**< A pointer to shader code. */
1276 const char *entrypoint; /**< A pointer to a null-terminated UTF-8 string specifying the entry point function name for the shader. */
1277 SDL_GPUShaderFormat format; /**< The format of the shader code. */
1278 SDL_GPUShaderStage stage; /**< The stage the shader program corresponds to. */
1279 Uint32 num_samplers; /**< The number of samplers defined in the shader. */
1280 Uint32 num_storage_textures; /**< The number of storage textures defined in the shader. */
1281 Uint32 num_storage_buffers; /**< The number of storage buffers defined in the shader. */
1282 Uint32 num_uniform_buffers; /**< The number of uniform buffers defined in the shader. */
1283
1284 SDL_PropertiesID props; /**< A properties ID for extensions. Should be 0 if no extensions are needed. */
1286
1287/**
1288 * A structure specifying the parameters of a texture.
1289 *
1290 * Usage flags can be bitwise OR'd together for combinations of usages. Note
1291 * that certain usage combinations are invalid, for example SAMPLER and
1292 * GRAPHICS_STORAGE.
1293 *
1294 * \since This struct is available since SDL 3.0.0
1295 *
1296 * \sa SDL_CreateGPUTexture
1297 */
1299{
1300 SDL_GPUTextureType type; /**< The base dimensionality of the texture. */
1301 SDL_GPUTextureFormat format; /**< The pixel format of the texture. */
1302 SDL_GPUTextureUsageFlags usage; /**< How the texture is intended to be used by the client. */
1303 Uint32 width; /**< The width of the texture. */
1304 Uint32 height; /**< The height of the texture. */
1305 Uint32 layer_count_or_depth; /**< 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. */
1306 Uint32 num_levels; /**< The number of mip levels in the texture. */
1307 SDL_GPUSampleCount sample_count; /**< The number of samples per texel. Only applies if the texture is used as a render target. */
1308
1309 SDL_PropertiesID props; /**< A properties ID for extensions. Should be 0 if no extensions are needed. */
1311
1312#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_R_FLOAT "SDL.gpu.createtexture.d3d12.clear.r"
1313#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_G_FLOAT "SDL.gpu.createtexture.d3d12.clear.g"
1314#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_B_FLOAT "SDL.gpu.createtexture.d3d12.clear.b"
1315#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_A_FLOAT "SDL.gpu.createtexture.d3d12.clear.a"
1316#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_DEPTH_FLOAT "SDL.gpu.createtexture.d3d12.clear.depth"
1317#define SDL_PROP_GPU_CREATETEXTURE_D3D12_CLEAR_STENCIL_UINT8 "SDL.gpu.createtexture.d3d12.clear.stencil"
1318
1319/**
1320 * A structure specifying the parameters of a buffer.
1321 *
1322 * Usage flags can be bitwise OR'd together for combinations of usages. Note
1323 * that certain combinations are invalid, for example VERTEX and INDEX.
1324 *
1325 * \since This struct is available since SDL 3.0.0
1326 *
1327 * \sa SDL_CreateGPUBuffer
1328 */
1330{
1331 SDL_GPUBufferUsageFlags usage; /**< How the buffer is intended to be used by the client. */
1332 Uint32 size; /**< The size in bytes of the buffer. */
1333
1334 SDL_PropertiesID props; /**< A properties ID for extensions. Should be 0 if no extensions are needed. */
1336
1337/**
1338 * A structure specifying the parameters of a transfer buffer.
1339 *
1340 * \since This struct is available since SDL 3.0.0
1341 *
1342 * \sa SDL_CreateGPUTransferBuffer
1343 */
1345{
1346 SDL_GPUTransferBufferUsage usage; /**< How the transfer buffer is intended to be used by the client. */
1347 Uint32 size; /**< The size in bytes of the transfer buffer. */
1348
1349 SDL_PropertiesID props; /**< A properties ID for extensions. Should be 0 if no extensions are needed. */
1351
1352/* Pipeline state structures */
1353
1354/**
1355 * A structure specifying the parameters of the graphics pipeline rasterizer
1356 * state.
1357 *
1358 * \since This struct is available since SDL 3.0.0
1359 *
1360 * \sa SDL_GPUGraphicsPipelineCreateInfo
1361 */
1363{
1364 SDL_GPUFillMode fill_mode; /**< Whether polygons will be filled in or drawn as lines. */
1365 SDL_GPUCullMode cull_mode; /**< The facing direction in which triangles will be culled. */
1366 SDL_GPUFrontFace front_face; /**< The vertex winding that will cause a triangle to be determined as front-facing. */
1367 float depth_bias_constant_factor; /**< A scalar factor controlling the depth value added to each fragment. */
1368 float depth_bias_clamp; /**< The maximum depth bias of a fragment. */
1369 float depth_bias_slope_factor; /**< A scalar factor applied to a fragment's slope in depth calculations. */
1370 SDL_bool enable_depth_bias; /**< SDL_TRUE to bias fragment depth values. */
1375
1376/**
1377 * A structure specifying the parameters of the graphics pipeline multisample
1378 * state.
1379 *
1380 * \since This struct is available since SDL 3.0.0
1381 *
1382 * \sa SDL_GPUGraphicsPipelineCreateInfo
1383 */
1385{
1386 SDL_GPUSampleCount sample_count; /**< The number of samples to be used in rasterization. */
1387 Uint32 sample_mask; /**< Determines which samples get updated in the render targets. Treated as 0xFFFFFFFF if enable_mask is SDL_FALSE. */
1388 SDL_bool enable_mask; /**< Enables sample masking. */
1393
1394/**
1395 * A structure specifying the parameters of the graphics pipeline depth
1396 * stencil state.
1397 *
1398 * \since This struct is available since SDL 3.0.0
1399 *
1400 * \sa SDL_GPUGraphicsPipelineCreateInfo
1401 */
1403{
1404 SDL_GPUCompareOp compare_op; /**< The comparison operator used for depth testing. */
1405 SDL_GPUStencilOpState back_stencil_state; /**< The stencil op state for back-facing triangles. */
1406 SDL_GPUStencilOpState front_stencil_state; /**< The stencil op state for front-facing triangles. */
1407 Uint8 compare_mask; /**< Selects the bits of the stencil values participating in the stencil test. */
1408 Uint8 write_mask; /**< Selects the bits of the stencil values updated by the stencil test. */
1409 SDL_bool enable_depth_test; /**< SDL_TRUE enables the depth test. */
1410 SDL_bool enable_depth_write; /**< SDL_TRUE enables depth writes. Depth writes are always disabled when enable_depth_test is SDL_FALSE. */
1411 SDL_bool enable_stencil_test; /**< SDL_TRUE enables the stencil test. */
1416
1417/**
1418 * A structure specifying the parameters of color targets used in a graphics
1419 * pipeline.
1420 *
1421 * \since This struct is available since SDL 3.0.0
1422 *
1423 * \sa SDL_GPUGraphicsPipelineTargetInfo
1424 */
1426{
1427 SDL_GPUTextureFormat format; /**< The pixel format of the texture to be used as a color target. */
1428 SDL_GPUColorTargetBlendState blend_state; /**< The blend state to be used for the color target. */
1430
1431/**
1432 * A structure specifying the descriptions of render targets used in a
1433 * graphics pipeline.
1434 *
1435 * \since This struct is available since SDL 3.0.0
1436 *
1437 * \sa SDL_GPUGraphicsPipelineCreateInfo
1438 */
1440{
1441 const SDL_GPUColorTargetDescription *color_target_descriptions; /**< A pointer to an array of color target descriptions. */
1442 Uint32 num_color_targets; /**< The number of color target descriptions in the above array. */
1443 SDL_GPUTextureFormat depth_stencil_format; /**< The pixel format of the depth-stencil target. Ignored if has_depth_stencil_target is SDL_FALSE. */
1444 SDL_bool has_depth_stencil_target; /**< SDL_TRUE specifies that the pipeline uses a depth-stencil target. */
1449
1450/**
1451 * A structure specifying the parameters of a graphics pipeline state.
1452 *
1453 * \since This struct is available since SDL 3.0.0
1454 *
1455 * \sa SDL_CreateGPUGraphicsPipeline
1456 */
1458{
1459 SDL_GPUShader *vertex_shader; /**< The vertex shader used by the graphics pipeline. */
1460 SDL_GPUShader *fragment_shader; /**< The fragment shader used by the graphics pipeline. */
1461 SDL_GPUVertexInputState vertex_input_state; /**< The vertex layout of the graphics pipeline. */
1462 SDL_GPUPrimitiveType primitive_type; /**< The primitive topology of the graphics pipeline. */
1463 SDL_GPURasterizerState rasterizer_state; /**< The rasterizer state of the graphics pipeline. */
1464 SDL_GPUMultisampleState multisample_state; /**< The multisample state of the graphics pipeline. */
1465 SDL_GPUDepthStencilState depth_stencil_state; /**< The depth-stencil state of the graphics pipeline. */
1466 SDL_GPUGraphicsPipelineTargetInfo target_info; /**< Formats and blend modes for the render targets of the graphics pipeline. */
1467
1468 SDL_PropertiesID props; /**< A properties ID for extensions. Should be 0 if no extensions are needed. */
1470
1471/**
1472 * A structure specifying the parameters of a compute pipeline state.
1473 *
1474 * \since This struct is available since SDL 3.0.0
1475 *
1476 * \sa SDL_CreateGPUComputePipeline
1477 */
1479{
1480 size_t code_size; /**< The size in bytes of the compute shader code pointed to. */
1481 const Uint8 *code; /**< A pointer to compute shader code. */
1482 const char *entrypoint; /**< A pointer to a null-terminated UTF-8 string specifying the entry point function name for the shader. */
1483 SDL_GPUShaderFormat format; /**< The format of the compute shader code. */
1484 Uint32 num_samplers; /**< The number of samplers defined in the shader. */
1485 Uint32 num_readonly_storage_textures; /**< The number of readonly storage textures defined in the shader. */
1486 Uint32 num_readonly_storage_buffers; /**< The number of readonly storage buffers defined in the shader. */
1487 Uint32 num_writeonly_storage_textures; /**< The number of writeonly storage textures defined in the shader. */
1488 Uint32 num_writeonly_storage_buffers; /**< The number of writeonly storage buffers defined in the shader. */
1489 Uint32 num_uniform_buffers; /**< The number of uniform buffers defined in the shader. */
1490 Uint32 threadcount_x; /**< The number of threads in the X dimension. This should match the value in the shader. */
1491 Uint32 threadcount_y; /**< The number of threads in the Y dimension. This should match the value in the shader. */
1492 Uint32 threadcount_z; /**< The number of threads in the Z dimension. This should match the value in the shader. */
1493
1494 SDL_PropertiesID props; /**< A properties ID for extensions. Should be 0 if no extensions are needed. */
1496
1497/**
1498 * A structure specifying the parameters of a color target used by a render
1499 * pass.
1500 *
1501 * The load_op field determines what is done with the texture at the beginning
1502 * of the render pass.
1503 *
1504 * - LOAD: Loads the data currently in the texture. Not recommended for
1505 * multisample textures as it requires significant memory bandwidth.
1506 * - CLEAR: Clears the texture to a single color.
1507 * - DONT_CARE: The driver will do whatever it wants with the texture memory.
1508 * This is a good option if you know that every single pixel will be touched
1509 * in the render pass.
1510 *
1511 * The store_op field determines what is done with the color results of the
1512 * render pass.
1513 *
1514 * - STORE: Stores the results of the render pass in the texture. Not
1515 * recommended for multisample textures as it requires significant memory
1516 * bandwidth.
1517 * - DONT_CARE: The driver will do whatever it wants with the texture memory.
1518 * This is often a good option for depth/stencil textures.
1519 * - RESOLVE: Resolves a multisample texture into resolve_texture, which must
1520 * have a sample count of 1. Then the driver may discard the multisample
1521 * texture memory. This is the most performant method of resolving a
1522 * multisample target.
1523 * - RESOLVE_AND_STORE: Resolves a multisample texture into the
1524 * resolve_texture, which must have a sample count of 1. Then the driver
1525 * stores the multisample texture's contents. Not recommended as it requires
1526 * significant memory bandwidth.
1527 *
1528 * \since This struct is available since SDL 3.0.0
1529 *
1530 * \sa SDL_BeginGPURenderPass
1531 */
1533{
1534 SDL_GPUTexture *texture; /**< The texture that will be used as a color target by a render pass. */
1535 Uint32 mip_level; /**< The mip level to use as a color target. */
1536 Uint32 layer_or_depth_plane; /**< 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. */
1537 SDL_FColor clear_color; /**< The color to clear the color target to at the start of the render pass. Ignored if SDL_GPU_LOADOP_CLEAR is not used. */
1538 SDL_GPULoadOp load_op; /**< What is done with the contents of the color target at the beginning of the render pass. */
1539 SDL_GPUStoreOp store_op; /**< What is done with the results of the render pass. */
1540 SDL_GPUTexture *resolve_texture; /**< The texture that will receive the results of a multisample resolve operation. Ignored if a RESOLVE* store_op is not used. */
1541 Uint32 resolve_mip_level; /**< The mip level of the resolve texture to use for the resolve operation. Ignored if a RESOLVE* store_op is not used. */
1542 Uint32 resolve_layer; /**< The layer index of the resolve texture to use for the resolve operation. Ignored if a RESOLVE* store_op is not used. */
1543 SDL_bool cycle; /**< SDL_TRUE cycles the texture if the texture is bound and load_op is not LOAD */
1544 SDL_bool cycle_resolve_texture; /**< SDL_TRUE cycles the resolve texture if the resolve texture is bound. Ignored if a RESOLVE* store_op is not used. */
1548
1549/**
1550 * A structure specifying the parameters of a depth-stencil target used by a
1551 * render pass.
1552 *
1553 * The load_op field determines what is done with the depth contents of the
1554 * texture at the beginning of the render pass.
1555 *
1556 * - LOAD: Loads the depth values currently in the texture.
1557 * - CLEAR: Clears the texture to a single depth.
1558 * - DONT_CARE: The driver will do whatever it wants with the memory. This is
1559 * a good option if you know that every single pixel will be touched in the
1560 * render pass.
1561 *
1562 * The store_op field determines what is done with the depth results of the
1563 * render pass.
1564 *
1565 * - STORE: Stores the depth results in the texture.
1566 * - DONT_CARE: The driver will do whatever it wants with the depth results.
1567 * This is often a good option for depth/stencil textures that don't need to
1568 * be reused again.
1569 *
1570 * The stencil_load_op field determines what is done with the stencil contents
1571 * of the texture at the beginning of the render pass.
1572 *
1573 * - LOAD: Loads the stencil values currently in the texture.
1574 * - CLEAR: Clears the stencil values to a single value.
1575 * - DONT_CARE: The driver will do whatever it wants with the memory. This is
1576 * a good option if you know that every single pixel will be touched in the
1577 * render pass.
1578 *
1579 * The stencil_store_op field determines what is done with the stencil results
1580 * of the render pass.
1581 *
1582 * - STORE: Stores the stencil results in the texture.
1583 * - DONT_CARE: The driver will do whatever it wants with the stencil results.
1584 * This is often a good option for depth/stencil textures that don't need to
1585 * be reused again.
1586 *
1587 * Note that depth/stencil targets do not support multisample resolves.
1588 *
1589 * \since This struct is available since SDL 3.0.0
1590 *
1591 * \sa SDL_BeginGPURenderPass
1592 */
1594{
1595 SDL_GPUTexture *texture; /**< The texture that will be used as the depth stencil target by the render pass. */
1596 float clear_depth; /**< The value to clear the depth component to at the beginning of the render pass. Ignored if SDL_GPU_LOADOP_CLEAR is not used. */
1597 SDL_GPULoadOp load_op; /**< What is done with the depth contents at the beginning of the render pass. */
1598 SDL_GPUStoreOp store_op; /**< What is done with the depth results of the render pass. */
1599 SDL_GPULoadOp stencil_load_op; /**< What is done with the stencil contents at the beginning of the render pass. */
1600 SDL_GPUStoreOp stencil_store_op; /**< What is done with the stencil results of the render pass. */
1601 SDL_bool cycle; /**< SDL_TRUE cycles the texture if the texture is bound and any load ops are not LOAD */
1602 Uint8 clear_stencil; /**< The value to clear the stencil component to at the beginning of the render pass. Ignored if SDL_GPU_LOADOP_CLEAR is not used. */
1606
1607/**
1608 * A structure containing parameters for a blit command.
1609 *
1610 * \since This struct is available since SDL 3.0.0
1611 *
1612 * \sa SDL_BlitGPUTexture
1613 */
1614typedef struct SDL_GPUBlitInfo {
1615 SDL_GPUBlitRegion source; /**< The source region for the blit. */
1616 SDL_GPUBlitRegion destination; /**< The destination region for the blit. */
1617 SDL_GPULoadOp load_op; /**< What is done with the contents of the destination before the blit. */
1618 SDL_FColor clear_color; /**< The color to clear the destination region to before the blit. Ignored if load_op is not SDL_GPU_LOADOP_CLEAR. */
1619 SDL_FlipMode flip_mode; /**< The flip mode for the source region. */
1620 SDL_GPUFilter filter; /**< The filter mode used when blitting. */
1621 SDL_bool cycle; /**< SDL_TRUE cycles the destination texture if it is already bound. */
1626/* Binding structs */
1627
1628/**
1629 * A structure specifying parameters in a buffer binding call.
1630 *
1631 * \since This struct is available since SDL 3.0.0
1632 *
1633 * \sa SDL_BindGPUVertexBuffers
1634 * \sa SDL_BindGPUIndexBuffers
1635 */
1637{
1638 SDL_GPUBuffer *buffer; /**< The buffer to bind. Must have been created with SDL_GPU_BUFFERUSAGE_VERTEX for SDL_BindGPUVertexBuffers, or SDL_GPU_BUFFERUSAGE_INDEX for SDL_BindGPUIndexBuffers. */
1639 Uint32 offset; /**< The starting byte of the data to bind in the buffer. */
1641
1642/**
1643 * A structure specifying parameters in a sampler binding call.
1644 *
1645 * \since This struct is available since SDL 3.0.0
1646 *
1647 * \sa SDL_BindGPUVertexSamplers
1648 * \sa SDL_BindGPUFragmentSamplers
1649 */
1651{
1652 SDL_GPUTexture *texture; /**< The texture to bind. Must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER. */
1653 SDL_GPUSampler *sampler; /**< The sampler to bind. */
1655
1656/**
1657 * A structure specifying parameters related to binding buffers in a compute
1658 * pass.
1659 *
1660 * \since This struct is available since SDL 3.0.0
1661 *
1662 * \sa SDL_BeginGPUComputePass
1663 */
1665{
1666 SDL_GPUBuffer *buffer; /**< The buffer to bind. Must have been created with SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE. */
1667 SDL_bool cycle; /**< SDL_TRUE cycles the buffer if it is already bound. */
1672
1673/**
1674 * A structure specifying parameters related to binding textures in a compute
1675 * pass.
1676 *
1677 * \since This struct is available since SDL 3.0.0
1678 *
1679 * \sa SDL_BeginGPUComputePass
1680 */
1682{
1683 SDL_GPUTexture *texture; /**< The texture to bind. Must have been created with SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE. */
1684 Uint32 mip_level; /**< The mip level index to bind. */
1685 Uint32 layer; /**< The layer index to bind. */
1686 SDL_bool cycle; /**< SDL_TRUE cycles the texture if it is already bound. */
1691
1692/* Functions */
1693
1694/* Device */
1695
1696/**
1697 * Checks for GPU runtime support.
1698 *
1699 * \param format_flags a bitflag indicating which shader formats the app is
1700 * able to provide.
1701 * \param name the preferred GPU driver, or NULL to let SDL pick the optimal
1702 * driver.
1703 * \returns SDL_TRUE if supported, SDL_FALSE otherwise.
1704 *
1705 * \since This function is available since SDL 3.0.0.
1706 *
1707 * \sa SDL_CreateGPUDevice
1708 */
1709extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GPUSupportsShaderFormats(
1710 SDL_GPUShaderFormat format_flags,
1711 const char *name);
1712
1713/**
1714 * Checks for GPU runtime support.
1715 *
1716 * \param props the properties to use.
1717 * \returns SDL_TRUE if supported, SDL_FALSE otherwise.
1718 *
1719 * \since This function is available since SDL 3.0.0.
1720 *
1721 * \sa SDL_CreateGPUDeviceWithProperties
1722 */
1723extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GPUSupportsProperties(
1724 SDL_PropertiesID props);
1725
1726/**
1727 * Creates a GPU context.
1728 *
1729 * \param format_flags a bitflag indicating which shader formats the app is
1730 * able to provide.
1731 * \param debug_mode enable debug mode properties and validations.
1732 * \param name the preferred GPU driver, or NULL to let SDL pick the optimal
1733 * driver.
1734 * \returns a GPU context on success or NULL on failure.
1735 *
1736 * \since This function is available since SDL 3.0.0.
1737 *
1738 * \sa SDL_GetGPUShaderFormats
1739 * \sa SDL_GetGPUDeviceDriver
1740 * \sa SDL_DestroyGPUDevice
1741 * \sa SDL_GPUSupportsShaderFormats
1742 */
1743extern SDL_DECLSPEC SDL_GPUDevice *SDLCALL SDL_CreateGPUDevice(
1744 SDL_GPUShaderFormat format_flags,
1745 SDL_bool debug_mode,
1746 const char *name);
1747
1748/**
1749 * Creates a GPU context.
1750 *
1751 * These are the supported properties:
1752 *
1753 * - `SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOL`: enable debug mode properties
1754 * and validations, defaults to SDL_TRUE.
1755 * - `SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOL`: enable to prefer energy
1756 * efficiency over maximum GPU performance, defaults to SDL_FALSE.
1757 * - `SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING`: the name of the GPU driver to
1758 * use, if a specific one is desired.
1759 *
1760 * These are the current shader format properties:
1761 *
1762 * - `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOL`: The app is able to
1763 * provide shaders for an NDA platform.
1764 * - `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOL`: The app is able to
1765 * provide SPIR-V shaders if applicable.
1766 * - SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOL`: The app is able to provide
1767 * DXBC shaders if applicable
1768 * `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOL`: The app is able to
1769 * provide DXIL shaders if applicable.
1770 * - `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOL`: The app is able to provide
1771 * MSL shaders if applicable.
1772 * - `SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOL`: The app is able to
1773 * provide Metal shader libraries if applicable.
1774 *
1775 * With the D3D12 renderer:
1776 *
1777 * - `SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING`: the prefix to
1778 * use for all vertex semantics, default is "TEXCOORD".
1779 *
1780 * \param props the properties to use.
1781 * \returns a GPU context on success or NULL on failure.
1782 *
1783 * \since This function is available since SDL 3.0.0.
1784 *
1785 * \sa SDL_GetGPUShaderFormats
1786 * \sa SDL_GetGPUDeviceDriver
1787 * \sa SDL_DestroyGPUDevice
1788 * \sa SDL_GPUSupportsProperties
1789 */
1791 SDL_PropertiesID props);
1792
1793#define SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOL "SDL.gpu.device.create.debugmode"
1794#define SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOL "SDL.gpu.device.create.preferlowpower"
1795#define SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING "SDL.gpu.device.create.name"
1796#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOL "SDL.gpu.device.create.shaders.private"
1797#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOL "SDL.gpu.device.create.shaders.spirv"
1798#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOL "SDL.gpu.device.create.shaders.dxbc"
1799#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOL "SDL.gpu.device.create.shaders.dxil"
1800#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOL "SDL.gpu.device.create.shaders.msl"
1801#define SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOL "SDL.gpu.device.create.shaders.metallib"
1802#define SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING "SDL.gpu.device.create.d3d12.semantic"
1803
1804/**
1805 * Destroys a GPU context previously returned by SDL_CreateGPUDevice.
1806 *
1807 * \param device a GPU Context to destroy.
1808 *
1809 * \since This function is available since SDL 3.0.0.
1810 *
1811 * \sa SDL_CreateGPUDevice
1812 */
1813extern SDL_DECLSPEC void SDLCALL SDL_DestroyGPUDevice(SDL_GPUDevice *device);
1814
1815/**
1816 * Get the number of GPU drivers compiled into SDL.
1817 *
1818 * \returns the number of built in GPU drivers.
1819 *
1820 * \since This function is available since SDL 3.0.0.
1821 *
1822 * \sa SDL_GetGPUDriver
1823 */
1824extern SDL_DECLSPEC int SDLCALL SDL_GetNumGPUDrivers(void);
1825
1826/**
1827 * Get the name of a built in GPU driver.
1828 *
1829 * The GPU drivers are presented in the order in which they are normally
1830 * checked during initialization.
1831 *
1832 * The names of drivers are all simple, low-ASCII identifiers, like "vulkan",
1833 * "metal" or "direct3d12". These never have Unicode characters, and are not
1834 * meant to be proper names.
1835 *
1836 * \param index the index of a GPU driver.
1837 * \returns the name of the GPU driver with the given **index**.
1838 *
1839 * \since This function is available since SDL 3.0.0.
1840 *
1841 * \sa SDL_GetNumGPUDrivers
1842 */
1843extern SDL_DECLSPEC const char * SDLCALL SDL_GetGPUDriver(int index);
1844
1845/**
1846 * Returns the name of the backend used to create this GPU context.
1847 *
1848 * \param device a GPU context to query.
1849 * \returns the name of the device's driver, or NULL on error.
1850 *
1851 * \since This function is available since SDL 3.0.0.
1852 */
1853extern SDL_DECLSPEC const char * SDLCALL SDL_GetGPUDeviceDriver(SDL_GPUDevice *device);
1854
1855/**
1856 * Returns the supported shader formats for this GPU context.
1857 *
1858 * \param device a GPU context to query.
1859 * \returns a bitflag indicating which shader formats the driver is able to
1860 * consume.
1861 *
1862 * \since This function is available since SDL 3.0.0.
1863 */
1864extern SDL_DECLSPEC SDL_GPUShaderFormat SDLCALL SDL_GetGPUShaderFormats(SDL_GPUDevice *device);
1865
1866/* State Creation */
1867
1868/**
1869 * Creates a pipeline object to be used in a compute workflow.
1870 *
1871 * Shader resource bindings must be authored to follow a particular order
1872 * depending on the shader format.
1873 *
1874 * For SPIR-V shaders, use the following resource sets:
1875 *
1876 * - 0: Sampled textures, followed by read-only storage textures, followed by
1877 * read-only storage buffers
1878 * - 1: Write-only storage textures, followed by write-only storage buffers
1879 * - 2: Uniform buffers
1880 *
1881 * For DXBC Shader Model 5_0 shaders, use the following register order:
1882 *
1883 * - t registers: Sampled textures, followed by read-only storage textures,
1884 * followed by read-only storage buffers
1885 * - u registers: Write-only storage textures, followed by write-only storage
1886 * buffers
1887 * - b registers: Uniform buffers
1888 *
1889 * For DXIL shaders, use the following register order:
1890 *
1891 * - (t[n], space0): Sampled textures, followed by read-only storage textures,
1892 * followed by read-only storage buffers
1893 * - (u[n], space1): Write-only storage textures, followed by write-only
1894 * storage buffers
1895 * - (b[n], space2): Uniform buffers
1896 *
1897 * For MSL/metallib, use the following order:
1898 *
1899 * - [[buffer]]: Uniform buffers, followed by write-only storage buffers,
1900 * followed by write-only storage buffers
1901 * - [[texture]]: Sampled textures, followed by read-only storage textures,
1902 * followed by write-only storage textures
1903 *
1904 * \param device a GPU Context.
1905 * \param createinfo a struct describing the state of the compute pipeline to
1906 * create.
1907 * \returns a compute pipeline object on success, or NULL on failure.
1908 *
1909 * \since This function is available since SDL 3.0.0.
1910 *
1911 * \sa SDL_BindGPUComputePipeline
1912 * \sa SDL_ReleaseGPUComputePipeline
1913 */
1915 SDL_GPUDevice *device,
1916 const SDL_GPUComputePipelineCreateInfo *createinfo);
1917
1918/**
1919 * Creates a pipeline object to be used in a graphics workflow.
1920 *
1921 * \param device a GPU Context.
1922 * \param createinfo a struct describing the state of the graphics pipeline to
1923 * create.
1924 * \returns a graphics pipeline object on success, or NULL on failure.
1925 *
1926 * \since This function is available since SDL 3.0.0.
1927 *
1928 * \sa SDL_CreateGPUShader
1929 * \sa SDL_BindGPUGraphicsPipeline
1930 * \sa SDL_ReleaseGPUGraphicsPipeline
1931 */
1933 SDL_GPUDevice *device,
1934 const SDL_GPUGraphicsPipelineCreateInfo *createinfo);
1935
1936/**
1937 * Creates a sampler object to be used when binding textures in a graphics
1938 * workflow.
1939 *
1940 * \param device a GPU Context.
1941 * \param createinfo a struct describing the state of the sampler to create.
1942 * \returns a sampler object on success, or NULL on failure.
1943 *
1944 * \since This function is available since SDL 3.0.0.
1945 *
1946 * \sa SDL_BindGPUVertexSamplers
1947 * \sa SDL_BindGPUFragmentSamplers
1948 * \sa SDL_ReleaseSampler
1949 */
1950extern SDL_DECLSPEC SDL_GPUSampler *SDLCALL SDL_CreateGPUSampler(
1951 SDL_GPUDevice *device,
1952 const SDL_GPUSamplerCreateInfo *createinfo);
1953
1954/**
1955 * Creates a shader to be used when creating a graphics pipeline.
1956 *
1957 * Shader resource bindings must be authored to follow a particular order
1958 * depending on the shader format.
1959 *
1960 * For SPIR-V shaders, use the following resource sets:
1961 *
1962 * For vertex shaders:
1963 *
1964 * - 0: Sampled textures, followed by storage textures, followed by storage
1965 * buffers
1966 * - 1: Uniform buffers
1967 *
1968 * For fragment shaders:
1969 *
1970 * - 2: Sampled textures, followed by storage textures, followed by storage
1971 * buffers
1972 * - 3: Uniform buffers
1973 *
1974 * For DXBC Shader Model 5_0 shaders, use the following register order:
1975 *
1976 * - t registers: Sampled textures, followed by storage textures, followed by
1977 * storage buffers
1978 * - s registers: Samplers with indices corresponding to the sampled textures
1979 * - b registers: Uniform buffers
1980 *
1981 * For DXIL shaders, use the following register order:
1982 *
1983 * For vertex shaders:
1984 *
1985 * - (t[n], space0): Sampled textures, followed by storage textures, followed
1986 * by storage buffers
1987 * - (s[n], space0): Samplers with indices corresponding to the sampled
1988 * textures
1989 * - (b[n], space1): Uniform buffers
1990 *
1991 * For pixel shaders:
1992 *
1993 * - (t[n], space2): Sampled textures, followed by storage textures, followed
1994 * by storage buffers
1995 * - (s[n], space2): Samplers with indices corresponding to the sampled
1996 * textures
1997 * - (b[n], space3): Uniform buffers
1998 *
1999 * For MSL/metallib, use the following order:
2000 *
2001 * - [[texture]]: Sampled textures, followed by storage textures
2002 * - [[sampler]]: Samplers with indices corresponding to the sampled textures
2003 * - [[buffer]]: Uniform buffers, followed by storage buffers. Vertex buffer 0
2004 * is bound at [[buffer(14)]], vertex buffer 1 at [[buffer(15)]], and so on.
2005 * Rather than manually authoring vertex buffer indices, use the
2006 * [[stage_in]] attribute which will automatically use the vertex input
2007 * information from the SDL_GPUPipeline.
2008 *
2009 * \param device a GPU Context.
2010 * \param createinfo a struct describing the state of the shader to create.
2011 * \returns a shader object on success, or NULL on failure.
2012 *
2013 * \since This function is available since SDL 3.0.0.
2014 *
2015 * \sa SDL_CreateGPUGraphicsPipeline
2016 * \sa SDL_ReleaseGPUShader
2017 */
2018extern SDL_DECLSPEC SDL_GPUShader *SDLCALL SDL_CreateGPUShader(
2019 SDL_GPUDevice *device,
2020 const SDL_GPUShaderCreateInfo *createinfo);
2021
2022/**
2023 * Creates a texture object to be used in graphics or compute workflows.
2024 *
2025 * The contents of this texture are undefined until data is written to the
2026 * texture.
2027 *
2028 * Note that certain combinations of usage flags are invalid. For example, a
2029 * texture cannot have both the SAMPLER and GRAPHICS_STORAGE_READ flags.
2030 *
2031 * If you request a sample count higher than the hardware supports, the
2032 * implementation will automatically fall back to the highest available sample
2033 * count.
2034 *
2035 * \param device a GPU Context.
2036 * \param createinfo a struct describing the state of the texture to create.
2037 * \returns a texture object on success, or NULL on failure.
2038 *
2039 * \since This function is available since SDL 3.0.0.
2040 *
2041 * \sa SDL_UploadToGPUTexture
2042 * \sa SDL_DownloadFromGPUTexture
2043 * \sa SDL_BindGPUVertexSamplers
2044 * \sa SDL_BindGPUVertexStorageTextures
2045 * \sa SDL_BindGPUFragmentSamplers
2046 * \sa SDL_BindGPUFragmentStorageTextures
2047 * \sa SDL_BindGPUComputeStorageTextures
2048 * \sa SDL_BlitGPUTexture
2049 * \sa SDL_ReleaseGPUTexture
2050 * \sa SDL_GPUTextureSupportsFormat
2051 */
2052extern SDL_DECLSPEC SDL_GPUTexture *SDLCALL SDL_CreateGPUTexture(
2053 SDL_GPUDevice *device,
2054 const SDL_GPUTextureCreateInfo *createinfo);
2055
2056/**
2057 * Creates a buffer object to be used in graphics or compute workflows.
2058 *
2059 * The contents of this buffer are undefined until data is written to the
2060 * buffer.
2061 *
2062 * Note that certain combinations of usage flags are invalid. For example, a
2063 * buffer cannot have both the VERTEX and INDEX flags.
2064 *
2065 * \param device a GPU Context.
2066 * \param createinfo a struct describing the state of the buffer to create.
2067 * \returns a buffer object on success, or NULL on failure.
2068 *
2069 * \since This function is available since SDL 3.0.0.
2070 *
2071 * \sa SDL_SetGPUBufferName
2072 * \sa SDL_UploadToGPUBuffer
2073 * \sa SDL_DownloadFromGPUBuffer
2074 * \sa SDL_CopyGPUBufferToBuffer
2075 * \sa SDL_BindGPUVertexBuffers
2076 * \sa SDL_BindGPUIndexBuffer
2077 * \sa SDL_BindGPUVertexStorageBuffers
2078 * \sa SDL_BindGPUFragmentStorageBuffers
2079 * \sa SDL_DrawGPUPrimitivesIndirect
2080 * \sa SDL_DrawGPUIndexedPrimitivesIndirect
2081 * \sa SDL_BindGPUComputeStorageBuffers
2082 * \sa SDL_DispatchGPUComputeIndirect
2083 * \sa SDL_ReleaseGPUBuffer
2084 */
2085extern SDL_DECLSPEC SDL_GPUBuffer *SDLCALL SDL_CreateGPUBuffer(
2086 SDL_GPUDevice *device,
2087 const SDL_GPUBufferCreateInfo *createinfo);
2088
2089/**
2090 * Creates a transfer buffer to be used when uploading to or downloading from
2091 * graphics resources.
2092 *
2093 * \param device a GPU Context.
2094 * \param createinfo a struct describing the state of the transfer buffer to
2095 * create.
2096 * \returns a transfer buffer on success, or NULL on failure.
2097 *
2098 * \since This function is available since SDL 3.0.0.
2099 *
2100 * \sa SDL_UploadToGPUBuffer
2101 * \sa SDL_DownloadFromGPUBuffer
2102 * \sa SDL_UploadToGPUTexture
2103 * \sa SDL_DownloadFromGPUTexture
2104 * \sa SDL_ReleaseGPUTransferBuffer
2105 */
2107 SDL_GPUDevice *device,
2108 const SDL_GPUTransferBufferCreateInfo *createinfo);
2109
2110/* Debug Naming */
2111
2112/**
2113 * Sets an arbitrary string constant to label a buffer.
2114 *
2115 * Useful for debugging.
2116 *
2117 * \param device a GPU Context.
2118 * \param buffer a buffer to attach the name to.
2119 * \param text a UTF-8 string constant to mark as the name of the buffer.
2120 *
2121 * \since This function is available since SDL 3.0.0.
2122 */
2123extern SDL_DECLSPEC void SDLCALL SDL_SetGPUBufferName(
2124 SDL_GPUDevice *device,
2125 SDL_GPUBuffer *buffer,
2126 const char *text);
2127
2128/**
2129 * Sets an arbitrary string constant to label a texture.
2130 *
2131 * Useful for debugging.
2132 *
2133 * \param device a GPU Context.
2134 * \param texture a texture to attach the name to.
2135 * \param text a UTF-8 string constant to mark as the name of the texture.
2136 *
2137 * \since This function is available since SDL 3.0.0.
2138 */
2139extern SDL_DECLSPEC void SDLCALL SDL_SetGPUTextureName(
2140 SDL_GPUDevice *device,
2141 SDL_GPUTexture *texture,
2142 const char *text);
2143
2144/**
2145 * Inserts an arbitrary string label into the command buffer callstream.
2146 *
2147 * Useful for debugging.
2148 *
2149 * \param command_buffer a command buffer.
2150 * \param text a UTF-8 string constant to insert as the label.
2151 *
2152 * \since This function is available since SDL 3.0.0.
2153 */
2154extern SDL_DECLSPEC void SDLCALL SDL_InsertGPUDebugLabel(
2155 SDL_GPUCommandBuffer *command_buffer,
2156 const char *text);
2157
2158/**
2159 * Begins a debug group with an arbitary name.
2160 *
2161 * Used for denoting groups of calls when viewing the command buffer
2162 * callstream in a graphics debugging tool.
2163 *
2164 * Each call to SDL_PushGPUDebugGroup must have a corresponding call to
2165 * SDL_PopGPUDebugGroup.
2166 *
2167 * On some backends (e.g. Metal), pushing a debug group during a
2168 * render/blit/compute pass will create a group that is scoped to the native
2169 * pass rather than the command buffer. For best results, if you push a debug
2170 * group during a pass, always pop it in the same pass.
2171 *
2172 * \param command_buffer a command buffer.
2173 * \param name a UTF-8 string constant that names the group.
2174 *
2175 * \since This function is available since SDL 3.0.0.
2176 *
2177 * \sa SDL_PopGPUDebugGroup
2178 */
2179extern SDL_DECLSPEC void SDLCALL SDL_PushGPUDebugGroup(
2180 SDL_GPUCommandBuffer *command_buffer,
2181 const char *name);
2182
2183/**
2184 * Ends the most-recently pushed debug group.
2185 *
2186 * \param command_buffer a command buffer.
2187 *
2188 * \since This function is available since SDL 3.0.0.
2189 *
2190 * \sa SDL_PushGPUDebugGroup
2191 */
2192extern SDL_DECLSPEC void SDLCALL SDL_PopGPUDebugGroup(
2193 SDL_GPUCommandBuffer *command_buffer);
2194
2195/* Disposal */
2196
2197/**
2198 * Frees the given texture as soon as it is safe to do so.
2199 *
2200 * You must not reference the texture after calling this function.
2201 *
2202 * \param device a GPU context.
2203 * \param texture a texture to be destroyed.
2204 *
2205 * \since This function is available since SDL 3.0.0.
2206 */
2207extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUTexture(
2208 SDL_GPUDevice *device,
2209 SDL_GPUTexture *texture);
2210
2211/**
2212 * Frees the given sampler as soon as it is safe to do so.
2213 *
2214 * You must not reference the sampler after calling this function.
2215 *
2216 * \param device a GPU context.
2217 * \param sampler a sampler to be destroyed.
2218 *
2219 * \since This function is available since SDL 3.0.0.
2220 */
2221extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUSampler(
2222 SDL_GPUDevice *device,
2223 SDL_GPUSampler *sampler);
2224
2225/**
2226 * Frees the given buffer as soon as it is safe to do so.
2227 *
2228 * You must not reference the buffer after calling this function.
2229 *
2230 * \param device a GPU context.
2231 * \param buffer a buffer to be destroyed.
2232 *
2233 * \since This function is available since SDL 3.0.0.
2234 */
2235extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUBuffer(
2236 SDL_GPUDevice *device,
2237 SDL_GPUBuffer *buffer);
2238
2239/**
2240 * Frees the given transfer buffer as soon as it is safe to do so.
2241 *
2242 * You must not reference the transfer buffer after calling this function.
2243 *
2244 * \param device a GPU context.
2245 * \param transfer_buffer a transfer buffer to be destroyed.
2246 *
2247 * \since This function is available since SDL 3.0.0.
2248 */
2249extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUTransferBuffer(
2250 SDL_GPUDevice *device,
2251 SDL_GPUTransferBuffer *transfer_buffer);
2252
2253/**
2254 * Frees the given compute pipeline as soon as it is safe to do so.
2255 *
2256 * You must not reference the compute pipeline after calling this function.
2257 *
2258 * \param device a GPU context.
2259 * \param compute_pipeline a compute pipeline to be destroyed.
2260 *
2261 * \since This function is available since SDL 3.0.0.
2262 */
2263extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUComputePipeline(
2264 SDL_GPUDevice *device,
2265 SDL_GPUComputePipeline *compute_pipeline);
2266
2267/**
2268 * Frees the given shader as soon as it is safe to do so.
2269 *
2270 * You must not reference the shader after calling this function.
2271 *
2272 * \param device a GPU context.
2273 * \param shader a shader to be destroyed.
2274 *
2275 * \since This function is available since SDL 3.0.0.
2276 */
2277extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUShader(
2278 SDL_GPUDevice *device,
2279 SDL_GPUShader *shader);
2280
2281/**
2282 * Frees the given graphics pipeline as soon as it is safe to do so.
2283 *
2284 * You must not reference the graphics pipeline after calling this function.
2285 *
2286 * \param device a GPU context.
2287 * \param graphics_pipeline a graphics pipeline to be destroyed.
2288 *
2289 * \since This function is available since SDL 3.0.0.
2290 */
2291extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUGraphicsPipeline(
2292 SDL_GPUDevice *device,
2293 SDL_GPUGraphicsPipeline *graphics_pipeline);
2294
2295/**
2296 * Acquire a command buffer.
2297 *
2298 * This command buffer is managed by the implementation and should not be
2299 * freed by the user. The command buffer may only be used on the thread it was
2300 * acquired on. The command buffer should be submitted on the thread it was
2301 * acquired on.
2302 *
2303 * \param device a GPU context.
2304 * \returns a command buffer.
2305 *
2306 * \since This function is available since SDL 3.0.0.
2307 *
2308 * \sa SDL_SubmitGPUCommandBuffer
2309 * \sa SDL_SubmitGPUCommandBufferAndAcquireFence
2310 */
2312 SDL_GPUDevice *device);
2313
2314/*
2315 * UNIFORM DATA
2316 *
2317 * Uniforms are for passing data to shaders.
2318 * The uniform data will be constant across all executions of the shader.
2319 *
2320 * There are 4 available uniform slots per shader stage (vertex, fragment, compute).
2321 * Uniform data pushed to a slot on a stage keeps its value throughout the command buffer
2322 * until you call the relevant Push function on that slot again.
2323 *
2324 * For example, you could write your vertex shaders to read a camera matrix from uniform binding slot 0,
2325 * push the camera matrix at the start of the command buffer, and that data will be used for every
2326 * subsequent draw call.
2327 *
2328 * It is valid to push uniform data during a render or compute pass.
2329 *
2330 * Uniforms are best for pushing small amounts of data.
2331 * If you are pushing more than a matrix or two per call you should consider using a storage buffer instead.
2332 */
2333
2334/**
2335 * Pushes data to a vertex uniform slot on the command buffer.
2336 *
2337 * Subsequent draw calls will use this uniform data.
2338 *
2339 * \param command_buffer a command buffer.
2340 * \param slot_index the vertex uniform slot to push data to.
2341 * \param data client data to write.
2342 * \param length the length of the data to write.
2343 *
2344 * \since This function is available since SDL 3.0.0.
2345 */
2346extern SDL_DECLSPEC void SDLCALL SDL_PushGPUVertexUniformData(
2347 SDL_GPUCommandBuffer *command_buffer,
2348 Uint32 slot_index,
2349 const void *data,
2350 Uint32 length);
2351
2352/**
2353 * Pushes data to a fragment uniform slot on the command buffer.
2354 *
2355 * Subsequent draw calls will use this uniform data.
2356 *
2357 * \param command_buffer a command buffer.
2358 * \param slot_index the fragment uniform slot to push data to.
2359 * \param data client data to write.
2360 * \param length the length of the data to write.
2361 *
2362 * \since This function is available since SDL 3.0.0.
2363 */
2364extern SDL_DECLSPEC void SDLCALL SDL_PushGPUFragmentUniformData(
2365 SDL_GPUCommandBuffer *command_buffer,
2366 Uint32 slot_index,
2367 const void *data,
2368 Uint32 length);
2369
2370/**
2371 * Pushes data to a uniform slot on the command buffer.
2372 *
2373 * Subsequent draw calls will use this uniform data.
2374 *
2375 * \param command_buffer a command buffer.
2376 * \param slot_index the uniform slot to push data to.
2377 * \param data client data to write.
2378 * \param length the length of the data to write.
2379 *
2380 * \since This function is available since SDL 3.0.0.
2381 */
2382extern SDL_DECLSPEC void SDLCALL SDL_PushGPUComputeUniformData(
2383 SDL_GPUCommandBuffer *command_buffer,
2384 Uint32 slot_index,
2385 const void *data,
2386 Uint32 length);
2387
2388/*
2389 * A NOTE ON CYCLING
2390 *
2391 * When using a command buffer, operations do not occur immediately -
2392 * they occur some time after the command buffer is submitted.
2393 *
2394 * When a resource is used in a pending or active command buffer, it is considered to be "bound".
2395 * When a resource is no longer used in any pending or active command buffers, it is considered to be "unbound".
2396 *
2397 * If data resources are bound, it is unspecified when that data will be unbound
2398 * unless you acquire a fence when submitting the command buffer and wait on it.
2399 * However, this doesn't mean you need to track resource usage manually.
2400 *
2401 * All of the functions and structs that involve writing to a resource have a "cycle" bool.
2402 * GPUTransferBuffer, GPUBuffer, and GPUTexture all effectively function as ring buffers on internal resources.
2403 * When cycle is SDL_TRUE, if the resource is bound, the cycle rotates to the next unbound internal resource,
2404 * or if none are available, a new one is created.
2405 * This means you don't have to worry about complex state tracking and synchronization as long as cycling is correctly employed.
2406 *
2407 * For example: you can call MapTransferBuffer, write texture data, UnmapTransferBuffer, and then UploadToTexture.
2408 * The next time you write texture data to the transfer buffer, if you set the cycle param to SDL_TRUE, you don't have
2409 * to worry about overwriting any data that is not yet uploaded.
2410 *
2411 * Another example: If you are using a texture in a render pass every frame, this can cause a data dependency between frames.
2412 * If you set cycle to SDL_TRUE in the SDL_GPUColorTargetInfo struct, you can prevent this data dependency.
2413 *
2414 * Cycling will never undefine already bound data.
2415 * When cycling, all data in the resource is considered to be undefined for subsequent commands until that data is written again.
2416 * You must take care not to read undefined data.
2417 *
2418 * Note that when cycling a texture, the entire texture will be cycled,
2419 * even if only part of the texture is used in the call,
2420 * so you must consider the entire texture to contain undefined data after cycling.
2421 *
2422 * You must also take care not to overwrite a section of data that has been referenced in a command without cycling first.
2423 * It is OK to overwrite unreferenced data in a bound resource without cycling,
2424 * but overwriting a section of data that has already been referenced will produce unexpected results.
2425 */
2426
2427/* Graphics State */
2428
2429/**
2430 * Begins a render pass on a command buffer.
2431 *
2432 * A render pass consists of a set of texture subresources (or depth slices in
2433 * the 3D texture case) which will be rendered to during the render pass,
2434 * along with corresponding clear values and load/store operations. All
2435 * operations related to graphics pipelines must take place inside of a render
2436 * pass. A default viewport and scissor state are automatically set when this
2437 * is called. You cannot begin another render pass, or begin a compute pass or
2438 * copy pass until you have ended the render pass.
2439 *
2440 * \param command_buffer a command buffer.
2441 * \param color_target_infos an array of texture subresources with
2442 * corresponding clear values and load/store ops.
2443 * \param num_color_targets the number of color targets in the
2444 * color_target_infos array.
2445 * \param depth_stencil_target_info a texture subresource with corresponding
2446 * clear value and load/store ops, may be
2447 * NULL.
2448 * \returns a render pass handle.
2449 *
2450 * \since This function is available since SDL 3.0.0.
2451 *
2452 * \sa SDL_EndGPURenderPass
2453 */
2454extern SDL_DECLSPEC SDL_GPURenderPass *SDLCALL SDL_BeginGPURenderPass(
2455 SDL_GPUCommandBuffer *command_buffer,
2456 const SDL_GPUColorTargetInfo *color_target_infos,
2457 Uint32 num_color_targets,
2458 const SDL_GPUDepthStencilTargetInfo *depth_stencil_target_info);
2459
2460/**
2461 * Binds a graphics pipeline on a render pass to be used in rendering.
2462 *
2463 * A graphics pipeline must be bound before making any draw calls.
2464 *
2465 * \param render_pass a render pass handle.
2466 * \param graphics_pipeline the graphics pipeline to bind.
2467 *
2468 * \since This function is available since SDL 3.0.0.
2469 */
2470extern SDL_DECLSPEC void SDLCALL SDL_BindGPUGraphicsPipeline(
2471 SDL_GPURenderPass *render_pass,
2472 SDL_GPUGraphicsPipeline *graphics_pipeline);
2473
2474/**
2475 * Sets the current viewport state on a command buffer.
2476 *
2477 * \param render_pass a render pass handle.
2478 * \param viewport the viewport to set.
2479 *
2480 * \since This function is available since SDL 3.0.0.
2481 */
2482extern SDL_DECLSPEC void SDLCALL SDL_SetGPUViewport(
2483 SDL_GPURenderPass *render_pass,
2484 const SDL_GPUViewport *viewport);
2485
2486/**
2487 * Sets the current scissor state on a command buffer.
2488 *
2489 * \param render_pass a render pass handle.
2490 * \param scissor the scissor area to set.
2491 *
2492 * \since This function is available since SDL 3.0.0.
2493 */
2494extern SDL_DECLSPEC void SDLCALL SDL_SetGPUScissor(
2495 SDL_GPURenderPass *render_pass,
2496 const SDL_Rect *scissor);
2497
2498/**
2499 * Sets the current blend constants on a command buffer.
2500 *
2501 * \param render_pass a render pass handle.
2502 * \param blend_constants the blend constant color.
2503 *
2504 * \since This function is available since SDL 3.0.0.
2505 *
2506 * \sa SDL_GPU_BLENDFACTOR_CONSTANT_COLOR
2507 * \sa SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR
2508 */
2509extern SDL_DECLSPEC void SDLCALL SDL_SetGPUBlendConstants(
2510 SDL_GPURenderPass *render_pass,
2511 SDL_FColor blend_constants);
2512
2513/**
2514 * Sets the current stencil reference value on a command buffer.
2515 *
2516 * \param render_pass a render pass handle.
2517 * \param reference the stencil reference value to set.
2518 *
2519 * \since This function is available since SDL 3.0.0.
2520 */
2521extern SDL_DECLSPEC void SDLCALL SDL_SetGPUStencilReference(
2522 SDL_GPURenderPass *render_pass,
2523 Uint8 reference);
2524
2525/**
2526 * Binds vertex buffers on a command buffer for use with subsequent draw
2527 * calls.
2528 *
2529 * \param render_pass a render pass handle.
2530 * \param first_slot the vertex buffer slot to begin binding from.
2531 * \param bindings an array of SDL_GPUBufferBinding structs containing vertex
2532 * buffers and offset values.
2533 * \param num_bindings the number of bindings in the bindings array.
2534 *
2535 * \since This function is available since SDL 3.0.0.
2536 */
2537extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexBuffers(
2538 SDL_GPURenderPass *render_pass,
2539 Uint32 first_slot,
2540 const SDL_GPUBufferBinding *bindings,
2541 Uint32 num_bindings);
2542
2543/**
2544 * Binds an index buffer on a command buffer for use with subsequent draw
2545 * calls.
2546 *
2547 * \param render_pass a render pass handle.
2548 * \param binding a pointer to a struct containing an index buffer and offset.
2549 * \param index_element_size whether the index values in the buffer are 16- or
2550 * 32-bit.
2551 *
2552 * \since This function is available since SDL 3.0.0.
2553 */
2554extern SDL_DECLSPEC void SDLCALL SDL_BindGPUIndexBuffer(
2555 SDL_GPURenderPass *render_pass,
2556 const SDL_GPUBufferBinding *binding,
2557 SDL_GPUIndexElementSize index_element_size);
2558
2559/**
2560 * Binds texture-sampler pairs for use on the vertex shader.
2561 *
2562 * The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER.
2563 *
2564 * \param render_pass a render pass handle.
2565 * \param first_slot the vertex sampler slot to begin binding from.
2566 * \param texture_sampler_bindings an array of texture-sampler binding
2567 * structs.
2568 * \param num_bindings the number of texture-sampler pairs to bind from the
2569 * array.
2570 *
2571 * \since This function is available since SDL 3.0.0.
2572 */
2573extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexSamplers(
2574 SDL_GPURenderPass *render_pass,
2575 Uint32 first_slot,
2576 const SDL_GPUTextureSamplerBinding *texture_sampler_bindings,
2577 Uint32 num_bindings);
2578
2579/**
2580 * Binds storage textures for use on the vertex shader.
2581 *
2582 * These textures must have been created with
2583 * SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ.
2584 *
2585 * \param render_pass a render pass handle.
2586 * \param first_slot the vertex storage texture slot to begin binding from.
2587 * \param storage_textures an array of storage textures.
2588 * \param num_bindings the number of storage texture to bind from the array.
2589 *
2590 * \since This function is available since SDL 3.0.0.
2591 */
2592extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexStorageTextures(
2593 SDL_GPURenderPass *render_pass,
2594 Uint32 first_slot,
2595 SDL_GPUTexture *const *storage_textures,
2596 Uint32 num_bindings);
2597
2598/**
2599 * Binds storage buffers for use on the vertex shader.
2600 *
2601 * These buffers must have been created with
2602 * SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ.
2603 *
2604 * \param render_pass a render pass handle.
2605 * \param first_slot the vertex storage buffer slot to begin binding from.
2606 * \param storage_buffers an array of buffers.
2607 * \param num_bindings the number of buffers to bind from the array.
2608 *
2609 * \since This function is available since SDL 3.0.0.
2610 */
2611extern SDL_DECLSPEC void SDLCALL SDL_BindGPUVertexStorageBuffers(
2612 SDL_GPURenderPass *render_pass,
2613 Uint32 first_slot,
2614 SDL_GPUBuffer *const *storage_buffers,
2615 Uint32 num_bindings);
2616
2617/**
2618 * Binds texture-sampler pairs for use on the fragment shader.
2619 *
2620 * The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER.
2621 *
2622 * \param render_pass a render pass handle.
2623 * \param first_slot the fragment sampler slot to begin binding from.
2624 * \param texture_sampler_bindings an array of texture-sampler binding
2625 * structs.
2626 * \param num_bindings the number of texture-sampler pairs to bind from the
2627 * array.
2628 *
2629 * \since This function is available since SDL 3.0.0.
2630 */
2631extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentSamplers(
2632 SDL_GPURenderPass *render_pass,
2633 Uint32 first_slot,
2634 const SDL_GPUTextureSamplerBinding *texture_sampler_bindings,
2635 Uint32 num_bindings);
2636
2637/**
2638 * Binds storage textures for use on the fragment shader.
2639 *
2640 * These textures must have been created with
2641 * SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ.
2642 *
2643 * \param render_pass a render pass handle.
2644 * \param first_slot the fragment storage texture slot to begin binding from.
2645 * \param storage_textures an array of storage textures.
2646 * \param num_bindings the number of storage textures to bind from the array.
2647 *
2648 * \since This function is available since SDL 3.0.0.
2649 */
2650extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentStorageTextures(
2651 SDL_GPURenderPass *render_pass,
2652 Uint32 first_slot,
2653 SDL_GPUTexture *const *storage_textures,
2654 Uint32 num_bindings);
2655
2656/**
2657 * Binds storage buffers for use on the fragment shader.
2658 *
2659 * These buffers must have been created with
2660 * SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ.
2661 *
2662 * \param render_pass a render pass handle.
2663 * \param first_slot the fragment storage buffer slot to begin binding from.
2664 * \param storage_buffers an array of storage buffers.
2665 * \param num_bindings the number of storage buffers to bind from the array.
2666 *
2667 * \since This function is available since SDL 3.0.0.
2668 */
2669extern SDL_DECLSPEC void SDLCALL SDL_BindGPUFragmentStorageBuffers(
2670 SDL_GPURenderPass *render_pass,
2671 Uint32 first_slot,
2672 SDL_GPUBuffer *const *storage_buffers,
2673 Uint32 num_bindings);
2674
2675/* Drawing */
2676
2677/**
2678 * Draws data using bound graphics state with an index buffer and instancing
2679 * enabled.
2680 *
2681 * You must not call this function before binding a graphics pipeline.
2682 *
2683 * Note that the `first_vertex` and `first_instance` parameters are NOT
2684 * compatible with built-in vertex/instance ID variables in shaders (for
2685 * example, SV_VertexID). If your shader depends on these variables, the
2686 * correlating draw call parameter MUST be 0.
2687 *
2688 * \param render_pass a render pass handle.
2689 * \param num_indices the number of indices to draw per instance.
2690 * \param num_instances the number of instances to draw.
2691 * \param first_index the starting index within the index buffer.
2692 * \param vertex_offset value added to vertex index before indexing into the
2693 * vertex buffer.
2694 * \param first_instance the ID of the first instance to draw.
2695 *
2696 * \since This function is available since SDL 3.0.0.
2697 */
2698extern SDL_DECLSPEC void SDLCALL SDL_DrawGPUIndexedPrimitives(
2699 SDL_GPURenderPass *render_pass,
2700 Uint32 num_indices,
2701 Uint32 num_instances,
2702 Uint32 first_index,
2703 Sint32 vertex_offset,
2704 Uint32 first_instance);
2705
2706/**
2707 * Draws data using bound graphics state.
2708 *
2709 * You must not call this function before binding a graphics pipeline.
2710 *
2711 * Note that the `first_vertex` and `first_instance` parameters are NOT
2712 * compatible with built-in vertex/instance ID variables in shaders (for
2713 * example, SV_VertexID). If your shader depends on these variables, the
2714 * correlating draw call parameter MUST be 0.
2715 *
2716 * \param render_pass a render pass handle.
2717 * \param num_vertices the number of vertices to draw.
2718 * \param num_instances the number of instances that will be drawn.
2719 * \param first_vertex the index of the first vertex to draw.
2720 * \param first_instance the ID of the first instance to draw.
2721 *
2722 * \since This function is available since SDL 3.0.0.
2723 */
2724extern SDL_DECLSPEC void SDLCALL SDL_DrawGPUPrimitives(
2725 SDL_GPURenderPass *render_pass,
2726 Uint32 num_vertices,
2727 Uint32 num_instances,
2728 Uint32 first_vertex,
2729 Uint32 first_instance);
2730
2731/**
2732 * Draws data using bound graphics state and with draw parameters set from a
2733 * buffer.
2734 *
2735 * The buffer must consist of tightly-packed draw parameter sets that each
2736 * match the layout of SDL_GPUIndirectDrawCommand. You must not call this
2737 * function before binding a graphics pipeline.
2738 *
2739 * \param render_pass a render pass handle.
2740 * \param buffer a buffer containing draw parameters.
2741 * \param offset the offset to start reading from the draw buffer.
2742 * \param draw_count the number of draw parameter sets that should be read
2743 * from the draw buffer.
2744 *
2745 * \since This function is available since SDL 3.0.0.
2746 */
2747extern SDL_DECLSPEC void SDLCALL SDL_DrawGPUPrimitivesIndirect(
2748 SDL_GPURenderPass *render_pass,
2749 SDL_GPUBuffer *buffer,
2750 Uint32 offset,
2751 Uint32 draw_count);
2752
2753/**
2754 * Draws data using bound graphics state with an index buffer enabled and with
2755 * draw parameters set from a buffer.
2756 *
2757 * The buffer must consist of tightly-packed draw parameter sets that each
2758 * match the layout of SDL_GPUIndexedIndirectDrawCommand. You must not call
2759 * this function before binding a graphics pipeline.
2760 *
2761 * \param render_pass a render pass handle.
2762 * \param buffer a buffer containing draw parameters.
2763 * \param offset the offset to start reading from the draw buffer.
2764 * \param draw_count the number of draw parameter sets that should be read
2765 * from the draw buffer.
2766 *
2767 * \since This function is available since SDL 3.0.0.
2768 */
2769extern SDL_DECLSPEC void SDLCALL SDL_DrawGPUIndexedPrimitivesIndirect(
2770 SDL_GPURenderPass *render_pass,
2771 SDL_GPUBuffer *buffer,
2772 Uint32 offset,
2773 Uint32 draw_count);
2774
2775/**
2776 * Ends the given render pass.
2777 *
2778 * All bound graphics state on the render pass command buffer is unset. The
2779 * render pass handle is now invalid.
2780 *
2781 * \param render_pass a render pass handle.
2782 *
2783 * \since This function is available since SDL 3.0.0.
2784 */
2785extern SDL_DECLSPEC void SDLCALL SDL_EndGPURenderPass(
2786 SDL_GPURenderPass *render_pass);
2787
2788/* Compute Pass */
2789
2790/**
2791 * Begins a compute pass on a command buffer.
2792 *
2793 * A compute pass is defined by a set of texture subresources and buffers that
2794 * will be written to by compute pipelines. These textures and buffers must
2795 * have been created with the COMPUTE_STORAGE_WRITE bit. All operations
2796 * related to compute pipelines must take place inside of a compute pass. You
2797 * must not begin another compute pass, or a render pass or copy pass before
2798 * ending the compute pass.
2799 *
2800 * A VERY IMPORTANT NOTE Textures and buffers bound as write-only MUST NOT be
2801 * read from during the compute pass. Doing so will result in undefined
2802 * behavior. If your compute work requires reading the output from a previous
2803 * dispatch, you MUST end the current compute pass and begin a new one before
2804 * you can safely access the data.
2805 *
2806 * \param command_buffer a command buffer.
2807 * \param storage_texture_bindings an array of writeable storage texture
2808 * binding structs.
2809 * \param num_storage_texture_bindings the number of storage textures to bind
2810 * from the array.
2811 * \param storage_buffer_bindings an array of writeable storage buffer binding
2812 * structs.
2813 * \param num_storage_buffer_bindings the number of storage buffers to bind
2814 * from the array.
2815 * \returns a compute pass handle.
2816 *
2817 * \since This function is available since SDL 3.0.0.
2818 *
2819 * \sa SDL_EndGPUComputePass
2820 */
2821extern SDL_DECLSPEC SDL_GPUComputePass *SDLCALL SDL_BeginGPUComputePass(
2822 SDL_GPUCommandBuffer *command_buffer,
2823 const SDL_GPUStorageTextureWriteOnlyBinding *storage_texture_bindings,
2824 Uint32 num_storage_texture_bindings,
2825 const SDL_GPUStorageBufferWriteOnlyBinding *storage_buffer_bindings,
2826 Uint32 num_storage_buffer_bindings);
2827
2828/**
2829 * Binds a compute pipeline on a command buffer for use in compute dispatch.
2830 *
2831 * \param compute_pass a compute pass handle.
2832 * \param compute_pipeline a compute pipeline to bind.
2833 *
2834 * \since This function is available since SDL 3.0.0.
2835 */
2836extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputePipeline(
2837 SDL_GPUComputePass *compute_pass,
2838 SDL_GPUComputePipeline *compute_pipeline);
2839
2840/**
2841 * Binds texture-sampler pairs for use on the compute shader.
2842 *
2843 * The textures must have been created with SDL_GPU_TEXTUREUSAGE_SAMPLER.
2844 *
2845 * \param compute_pass a compute pass handle.
2846 * \param first_slot the compute sampler slot to begin binding from.
2847 * \param texture_sampler_bindings an array of texture-sampler binding
2848 * structs.
2849 * \param num_bindings the number of texture-sampler bindings to bind from the
2850 * array.
2851 *
2852 * \since This function is available since SDL 3.0.0.
2853 */
2854extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeSamplers(
2855 SDL_GPUComputePass *compute_pass,
2856 Uint32 first_slot,
2857 const SDL_GPUTextureSamplerBinding *texture_sampler_bindings,
2858 Uint32 num_bindings);
2859
2860/**
2861 * Binds storage textures as readonly for use on the compute pipeline.
2862 *
2863 * These textures must have been created with
2864 * SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ.
2865 *
2866 * \param compute_pass a compute pass handle.
2867 * \param first_slot the compute storage texture slot to begin binding from.
2868 * \param storage_textures an array of storage textures.
2869 * \param num_bindings the number of storage textures to bind from the array.
2870 *
2871 * \since This function is available since SDL 3.0.0.
2872 */
2873extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeStorageTextures(
2874 SDL_GPUComputePass *compute_pass,
2875 Uint32 first_slot,
2876 SDL_GPUTexture *const *storage_textures,
2877 Uint32 num_bindings);
2878
2879/**
2880 * Binds storage buffers as readonly for use on the compute pipeline.
2881 *
2882 * These buffers must have been created with
2883 * SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ.
2884 *
2885 * \param compute_pass a compute pass handle.
2886 * \param first_slot the compute storage buffer slot to begin binding from.
2887 * \param storage_buffers an array of storage buffer binding structs.
2888 * \param num_bindings the number of storage buffers to bind from the array.
2889 *
2890 * \since This function is available since SDL 3.0.0.
2891 */
2892extern SDL_DECLSPEC void SDLCALL SDL_BindGPUComputeStorageBuffers(
2893 SDL_GPUComputePass *compute_pass,
2894 Uint32 first_slot,
2895 SDL_GPUBuffer *const *storage_buffers,
2896 Uint32 num_bindings);
2897
2898/**
2899 * Dispatches compute work.
2900 *
2901 * You must not call this function before binding a compute pipeline.
2902 *
2903 * A VERY IMPORTANT NOTE If you dispatch multiple times in a compute pass, and
2904 * the dispatches write to the same resource region as each other, there is no
2905 * guarantee of which order the writes will occur. If the write order matters,
2906 * you MUST end the compute pass and begin another one.
2907 *
2908 * \param compute_pass a compute pass handle.
2909 * \param groupcount_x number of local workgroups to dispatch in the X
2910 * dimension.
2911 * \param groupcount_y number of local workgroups to dispatch in the Y
2912 * dimension.
2913 * \param groupcount_z number of local workgroups to dispatch in the Z
2914 * dimension.
2915 *
2916 * \since This function is available since SDL 3.0.0.
2917 */
2918extern SDL_DECLSPEC void SDLCALL SDL_DispatchGPUCompute(
2919 SDL_GPUComputePass *compute_pass,
2920 Uint32 groupcount_x,
2921 Uint32 groupcount_y,
2922 Uint32 groupcount_z);
2923
2924/**
2925 * Dispatches compute work with parameters set from a buffer.
2926 *
2927 * The buffer layout should match the layout of
2928 * SDL_GPUIndirectDispatchCommand. You must not call this function before
2929 * binding a compute pipeline.
2930 *
2931 * A VERY IMPORTANT NOTE If you dispatch multiple times in a compute pass, and
2932 * the dispatches write to the same resource region as each other, there is no
2933 * guarantee of which order the writes will occur. If the write order matters,
2934 * you MUST end the compute pass and begin another one.
2935 *
2936 * \param compute_pass a compute pass handle.
2937 * \param buffer a buffer containing dispatch parameters.
2938 * \param offset the offset to start reading from the dispatch buffer.
2939 *
2940 * \since This function is available since SDL 3.0.0.
2941 */
2942extern SDL_DECLSPEC void SDLCALL SDL_DispatchGPUComputeIndirect(
2943 SDL_GPUComputePass *compute_pass,
2944 SDL_GPUBuffer *buffer,
2945 Uint32 offset);
2946
2947/**
2948 * Ends the current compute pass.
2949 *
2950 * All bound compute state on the command buffer is unset. The compute pass
2951 * handle is now invalid.
2952 *
2953 * \param compute_pass a compute pass handle.
2954 *
2955 * \since This function is available since SDL 3.0.0.
2956 */
2957extern SDL_DECLSPEC void SDLCALL SDL_EndGPUComputePass(
2958 SDL_GPUComputePass *compute_pass);
2959
2960/* TransferBuffer Data */
2961
2962/**
2963 * Maps a transfer buffer into application address space.
2964 *
2965 * You must unmap the transfer buffer before encoding upload commands.
2966 *
2967 * \param device a GPU context.
2968 * \param transfer_buffer a transfer buffer.
2969 * \param cycle if SDL_TRUE, cycles the transfer buffer if it is already
2970 * bound.
2971 * \returns the address of the mapped transfer buffer memory.
2972 *
2973 * \since This function is available since SDL 3.0.0.
2974 */
2975extern SDL_DECLSPEC void *SDLCALL SDL_MapGPUTransferBuffer(
2976 SDL_GPUDevice *device,
2977 SDL_GPUTransferBuffer *transfer_buffer,
2978 SDL_bool cycle);
2979
2980/**
2981 * Unmaps a previously mapped transfer buffer.
2982 *
2983 * \param device a GPU context.
2984 * \param transfer_buffer a previously mapped transfer buffer.
2985 *
2986 * \since This function is available since SDL 3.0.0.
2987 */
2988extern SDL_DECLSPEC void SDLCALL SDL_UnmapGPUTransferBuffer(
2989 SDL_GPUDevice *device,
2990 SDL_GPUTransferBuffer *transfer_buffer);
2991
2992/* Copy Pass */
2993
2994/**
2995 * Begins a copy pass on a command buffer.
2996 *
2997 * All operations related to copying to or from buffers or textures take place
2998 * inside a copy pass. You must not begin another copy pass, or a render pass
2999 * or compute pass before ending the copy pass.
3000 *
3001 * \param command_buffer a command buffer.
3002 * \returns a copy pass handle.
3003 *
3004 * \since This function is available since SDL 3.0.0.
3005 */
3006extern SDL_DECLSPEC SDL_GPUCopyPass *SDLCALL SDL_BeginGPUCopyPass(
3007 SDL_GPUCommandBuffer *command_buffer);
3008
3009/**
3010 * Uploads data from a transfer buffer to a texture.
3011 *
3012 * The upload occurs on the GPU timeline. You may assume that the upload has
3013 * finished in subsequent commands.
3014 *
3015 * You must align the data in the transfer buffer to a multiple of the texel
3016 * size of the texture format.
3017 *
3018 * \param copy_pass a copy pass handle.
3019 * \param source the source transfer buffer with image layout information.
3020 * \param destination the destination texture region.
3021 * \param cycle if SDL_TRUE, cycles the texture if the texture is bound,
3022 * otherwise overwrites the data.
3023 *
3024 * \since This function is available since SDL 3.0.0.
3025 */
3026extern SDL_DECLSPEC void SDLCALL SDL_UploadToGPUTexture(
3027 SDL_GPUCopyPass *copy_pass,
3028 const SDL_GPUTextureTransferInfo *source,
3029 const SDL_GPUTextureRegion *destination,
3030 SDL_bool cycle);
3031
3032/* Uploads data from a TransferBuffer to a Buffer. */
3033
3034/**
3035 * Uploads data from a transfer buffer to a buffer.
3036 *
3037 * The upload occurs on the GPU timeline. You may assume that the upload has
3038 * finished in subsequent commands.
3039 *
3040 * \param copy_pass a copy pass handle.
3041 * \param source the source transfer buffer with offset.
3042 * \param destination the destination buffer with offset and size.
3043 * \param cycle if SDL_TRUE, cycles the buffer if it is already bound,
3044 * otherwise overwrites the data.
3045 *
3046 * \since This function is available since SDL 3.0.0.
3047 */
3048extern SDL_DECLSPEC void SDLCALL SDL_UploadToGPUBuffer(
3049 SDL_GPUCopyPass *copy_pass,
3050 const SDL_GPUTransferBufferLocation *source,
3051 const SDL_GPUBufferRegion *destination,
3052 SDL_bool cycle);
3053
3054/**
3055 * Performs a texture-to-texture copy.
3056 *
3057 * This copy occurs on the GPU timeline. You may assume the copy has finished
3058 * in subsequent commands.
3059 *
3060 * \param copy_pass a copy pass handle.
3061 * \param source a source texture region.
3062 * \param destination a destination texture region.
3063 * \param w the width of the region to copy.
3064 * \param h the height of the region to copy.
3065 * \param d the depth of the region to copy.
3066 * \param cycle if SDL_TRUE, cycles the destination texture if the destination
3067 * texture is bound, otherwise overwrites the data.
3068 *
3069 * \since This function is available since SDL 3.0.0.
3070 */
3071extern SDL_DECLSPEC void SDLCALL SDL_CopyGPUTextureToTexture(
3072 SDL_GPUCopyPass *copy_pass,
3073 const SDL_GPUTextureLocation *source,
3074 const SDL_GPUTextureLocation *destination,
3075 Uint32 w,
3076 Uint32 h,
3077 Uint32 d,
3078 SDL_bool cycle);
3079
3080/* Copies data from a buffer to a buffer. */
3081
3082/**
3083 * Performs a buffer-to-buffer copy.
3084 *
3085 * This copy occurs on the GPU timeline. You may assume the copy has finished
3086 * in subsequent commands.
3087 *
3088 * \param copy_pass a copy pass handle.
3089 * \param source the buffer and offset to copy from.
3090 * \param destination the buffer and offset to copy to.
3091 * \param size the length of the buffer to copy.
3092 * \param cycle if SDL_TRUE, cycles the destination buffer if it is already
3093 * bound, otherwise overwrites the data.
3094 *
3095 * \since This function is available since SDL 3.0.0.
3096 */
3097extern SDL_DECLSPEC void SDLCALL SDL_CopyGPUBufferToBuffer(
3098 SDL_GPUCopyPass *copy_pass,
3099 const SDL_GPUBufferLocation *source,
3100 const SDL_GPUBufferLocation *destination,
3101 Uint32 size,
3102 SDL_bool cycle);
3103
3104/**
3105 * Copies data from a texture to a transfer buffer on the GPU timeline.
3106 *
3107 * This data is not guaranteed to be copied until the command buffer fence is
3108 * signaled.
3109 *
3110 * \param copy_pass a copy pass handle.
3111 * \param source the source texture region.
3112 * \param destination the destination transfer buffer with image layout
3113 * information.
3114 *
3115 * \since This function is available since SDL 3.0.0.
3116 */
3117extern SDL_DECLSPEC void SDLCALL SDL_DownloadFromGPUTexture(
3118 SDL_GPUCopyPass *copy_pass,
3119 const SDL_GPUTextureRegion *source,
3120 const SDL_GPUTextureTransferInfo *destination);
3121
3122/**
3123 * Copies data from a buffer to a transfer buffer on the GPU timeline.
3124 *
3125 * This data is not guaranteed to be copied until the command buffer fence is
3126 * signaled.
3127 *
3128 * \param copy_pass a copy pass handle.
3129 * \param source the source buffer with offset and size.
3130 * \param destination the destination transfer buffer with offset.
3131 *
3132 * \since This function is available since SDL 3.0.0.
3133 */
3134extern SDL_DECLSPEC void SDLCALL SDL_DownloadFromGPUBuffer(
3135 SDL_GPUCopyPass *copy_pass,
3136 const SDL_GPUBufferRegion *source,
3137 const SDL_GPUTransferBufferLocation *destination);
3138
3139/**
3140 * Ends the current copy pass.
3141 *
3142 * \param copy_pass a copy pass handle.
3143 *
3144 * \since This function is available since SDL 3.0.0.
3145 */
3146extern SDL_DECLSPEC void SDLCALL SDL_EndGPUCopyPass(
3147 SDL_GPUCopyPass *copy_pass);
3148
3149/**
3150 * Generates mipmaps for the given texture.
3151 *
3152 * This function must not be called inside of any pass.
3153 *
3154 * \param command_buffer a command_buffer.
3155 * \param texture a texture with more than 1 mip level.
3156 *
3157 * \since This function is available since SDL 3.0.0.
3158 */
3159extern SDL_DECLSPEC void SDLCALL SDL_GenerateMipmapsForGPUTexture(
3160 SDL_GPUCommandBuffer *command_buffer,
3161 SDL_GPUTexture *texture);
3162
3163/**
3164 * Blits from a source texture region to a destination texture region.
3165 *
3166 * This function must not be called inside of any pass.
3167 *
3168 * \param command_buffer a command buffer.
3169 * \param info the blit info struct containing the blit parameters.
3170 *
3171 * \since This function is available since SDL 3.0.0.
3172 */
3173extern SDL_DECLSPEC void SDLCALL SDL_BlitGPUTexture(
3174 SDL_GPUCommandBuffer *command_buffer,
3175 const SDL_GPUBlitInfo *info);
3176
3177/* Submission/Presentation */
3178
3179/**
3180 * Determines whether a swapchain composition is supported by the window.
3181 *
3182 * The window must be claimed before calling this function.
3183 *
3184 * \param device a GPU context.
3185 * \param window an SDL_Window.
3186 * \param swapchain_composition the swapchain composition to check.
3187 * \returns SDL_TRUE if supported, SDL_FALSE if unsupported (or on error).
3188 *
3189 * \since This function is available since SDL 3.0.0.
3190 *
3191 * \sa SDL_ClaimWindowForGPUDevice
3192 */
3194 SDL_GPUDevice *device,
3195 SDL_Window *window,
3196 SDL_GPUSwapchainComposition swapchain_composition);
3197
3198/**
3199 * Determines whether a presentation mode is supported by the window.
3200 *
3201 * The window must be claimed before calling this function.
3202 *
3203 * \param device a GPU context.
3204 * \param window an SDL_Window.
3205 * \param present_mode the presentation mode to check.
3206 * \returns SDL_TRUE if supported, SDL_FALSE if unsupported (or on error).
3207 *
3208 * \since This function is available since SDL 3.0.0.
3209 *
3210 * \sa SDL_ClaimWindowForGPUDevice
3211 */
3212extern SDL_DECLSPEC SDL_bool SDLCALL SDL_WindowSupportsGPUPresentMode(
3213 SDL_GPUDevice *device,
3214 SDL_Window *window,
3215 SDL_GPUPresentMode present_mode);
3216
3217/**
3218 * Claims a window, creating a swapchain structure for it.
3219 *
3220 * This must be called before SDL_AcquireGPUSwapchainTexture is called using
3221 * the window.
3222 *
3223 * The swapchain will be created with SDL_GPU_SWAPCHAINCOMPOSITION_SDR and
3224 * SDL_GPU_PRESENTMODE_VSYNC. If you want to have different swapchain
3225 * parameters, you must call SDL_SetGPUSwapchainParameters after claiming the
3226 * window.
3227 *
3228 * \param device a GPU context.
3229 * \param window an SDL_Window.
3230 * \returns SDL_TRUE on success, otherwise SDL_FALSE.
3231 *
3232 * \since This function is available since SDL 3.0.0.
3233 *
3234 * \sa SDL_AcquireGPUSwapchainTexture
3235 * \sa SDL_ReleaseWindowFromGPUDevice
3236 * \sa SDL_WindowSupportsGPUPresentMode
3237 * \sa SDL_WindowSupportsGPUSwapchainComposition
3238 */
3239extern SDL_DECLSPEC SDL_bool SDLCALL SDL_ClaimWindowForGPUDevice(
3240 SDL_GPUDevice *device,
3241 SDL_Window *window);
3242
3243/**
3244 * Unclaims a window, destroying its swapchain structure.
3245 *
3246 * \param device a GPU context.
3247 * \param window an SDL_Window that has been claimed.
3248 *
3249 * \since This function is available since SDL 3.0.0.
3250 *
3251 * \sa SDL_ClaimWindowForGPUDevice
3252 */
3253extern SDL_DECLSPEC void SDLCALL SDL_ReleaseWindowFromGPUDevice(
3254 SDL_GPUDevice *device,
3255 SDL_Window *window);
3256
3257/**
3258 * Changes the swapchain parameters for the given claimed window.
3259 *
3260 * This function will fail if the requested present mode or swapchain
3261 * composition are unsupported by the device. Check if the parameters are
3262 * supported via SDL_WindowSupportsGPUPresentMode /
3263 * SDL_WindowSupportsGPUSwapchainComposition prior to calling this function.
3264 *
3265 * SDL_GPU_PRESENTMODE_VSYNC and SDL_GPU_SWAPCHAINCOMPOSITION_SDR are always
3266 * supported.
3267 *
3268 * \param device a GPU context.
3269 * \param window an SDL_Window that has been claimed.
3270 * \param swapchain_composition the desired composition of the swapchain.
3271 * \param present_mode the desired present mode for the swapchain.
3272 * \returns SDL_TRUE if successful, SDL_FALSE on error.
3273 *
3274 * \since This function is available since SDL 3.0.0.
3275 *
3276 * \sa SDL_WindowSupportsGPUPresentMode
3277 * \sa SDL_WindowSupportsGPUSwapchainComposition
3278 */
3279extern SDL_DECLSPEC SDL_bool SDLCALL SDL_SetGPUSwapchainParameters(
3280 SDL_GPUDevice *device,
3281 SDL_Window *window,
3282 SDL_GPUSwapchainComposition swapchain_composition,
3283 SDL_GPUPresentMode present_mode);
3284
3285/**
3286 * Obtains the texture format of the swapchain for the given window.
3287 *
3288 * \param device a GPU context.
3289 * \param window an SDL_Window that has been claimed.
3290 * \returns the texture format of the swapchain.
3291 *
3292 * \since This function is available since SDL 3.0.0.
3293 */
3295 SDL_GPUDevice *device,
3296 SDL_Window *window);
3297
3298/**
3299 * Acquire a texture to use in presentation.
3300 *
3301 * When a swapchain texture is acquired on a command buffer, it will
3302 * automatically be submitted for presentation when the command buffer is
3303 * submitted. The swapchain texture should only be referenced by the command
3304 * buffer used to acquire it. May return NULL under certain conditions. This
3305 * is not necessarily an error. This texture is managed by the implementation
3306 * and must not be freed by the user. You MUST NOT call this function from any
3307 * thread other than the one that created the window.
3308 *
3309 * \param command_buffer a command buffer.
3310 * \param window a window that has been claimed.
3311 * \param w a pointer filled in with the swapchain width.
3312 * \param h a pointer filled in with the swapchain height.
3313 * \returns a swapchain texture.
3314 *
3315 * \since This function is available since SDL 3.0.0.
3316 *
3317 * \sa SDL_ClaimWindowForGPUDevice
3318 * \sa SDL_SubmitGPUCommandBuffer
3319 * \sa SDL_SubmitGPUCommandBufferAndAcquireFence
3320 */
3322 SDL_GPUCommandBuffer *command_buffer,
3323 SDL_Window *window,
3324 Uint32 *w,
3325 Uint32 *h);
3326
3327/**
3328 * Submits a command buffer so its commands can be processed on the GPU.
3329 *
3330 * It is invalid to use the command buffer after this is called.
3331 *
3332 * This must be called from the thread the command buffer was acquired on.
3333 *
3334 * All commands in the submission are guaranteed to begin executing before any
3335 * command in a subsequent submission begins executing.
3336 *
3337 * \param command_buffer a command buffer.
3338 *
3339 * \since This function is available since SDL 3.0.0.
3340 *
3341 * \sa SDL_AcquireGPUCommandBuffer
3342 * \sa SDL_AcquireGPUSwapchainTexture
3343 * \sa SDL_SubmitGPUCommandBufferAndAcquireFence
3344 */
3345extern SDL_DECLSPEC void SDLCALL SDL_SubmitGPUCommandBuffer(
3346 SDL_GPUCommandBuffer *command_buffer);
3347
3348/**
3349 * Submits a command buffer so its commands can be processed on the GPU, and
3350 * acquires a fence associated with the command buffer.
3351 *
3352 * You must release this fence when it is no longer needed or it will cause a
3353 * leak. It is invalid to use the command buffer after this is called.
3354 *
3355 * This must be called from the thread the command buffer was acquired on.
3356 *
3357 * All commands in the submission are guaranteed to begin executing before any
3358 * command in a subsequent submission begins executing.
3359 *
3360 * \param command_buffer a command buffer.
3361 * \returns a fence associated with the command buffer.
3362 *
3363 * \since This function is available since SDL 3.0.0.
3364 *
3365 * \sa SDL_AcquireGPUCommandBuffer
3366 * \sa SDL_AcquireGPUSwapchainTexture
3367 * \sa SDL_SubmitGPUCommandBuffer
3368 * \sa SDL_ReleaseGPUFence
3369 */
3371 SDL_GPUCommandBuffer *command_buffer);
3372
3373/**
3374 * Blocks the thread until the GPU is completely idle.
3375 *
3376 * \param device a GPU context.
3377 *
3378 * \since This function is available since SDL 3.0.0.
3379 *
3380 * \sa SDL_WaitForGPUFences
3381 */
3382extern SDL_DECLSPEC void SDLCALL SDL_WaitForGPUIdle(
3383 SDL_GPUDevice *device);
3384
3385/**
3386 * Blocks the thread until the given fences are signaled.
3387 *
3388 * \param device a GPU context.
3389 * \param wait_all if 0, wait for any fence to be signaled, if 1, wait for all
3390 * fences to be signaled.
3391 * \param fences an array of fences to wait on.
3392 * \param num_fences the number of fences in the fences array.
3393 *
3394 * \since This function is available since SDL 3.0.0.
3395 *
3396 * \sa SDL_SubmitGPUCommandBufferAndAcquireFence
3397 * \sa SDL_WaitForGPUIdle
3398 */
3399extern SDL_DECLSPEC void SDLCALL SDL_WaitForGPUFences(
3400 SDL_GPUDevice *device,
3401 SDL_bool wait_all,
3402 SDL_GPUFence *const *fences,
3403 Uint32 num_fences);
3404
3405/**
3406 * Checks the status of a fence.
3407 *
3408 * \param device a GPU context.
3409 * \param fence a fence.
3410 * \returns SDL_TRUE if the fence is signaled, SDL_FALSE if it is not.
3411 *
3412 * \since This function is available since SDL 3.0.0.
3413 *
3414 * \sa SDL_SubmitGPUCommandBufferAndAcquireFence
3415 */
3416extern SDL_DECLSPEC SDL_bool SDLCALL SDL_QueryGPUFence(
3417 SDL_GPUDevice *device,
3418 SDL_GPUFence *fence);
3419
3420/**
3421 * Releases a fence obtained from SDL_SubmitGPUCommandBufferAndAcquireFence.
3422 *
3423 * \param device a GPU context.
3424 * \param fence a fence.
3425 *
3426 * \since This function is available since SDL 3.0.0.
3427 *
3428 * \sa SDL_SubmitGPUCommandBufferAndAcquireFence
3429 */
3430extern SDL_DECLSPEC void SDLCALL SDL_ReleaseGPUFence(
3431 SDL_GPUDevice *device,
3432 SDL_GPUFence *fence);
3433
3434/* Format Info */
3435
3436/**
3437 * Obtains the texel block size for a texture format.
3438 *
3439 * \param format the texture format you want to know the texel size of.
3440 * \returns the texel block size of the texture format.
3441 *
3442 * \since This function is available since SDL 3.0.0.
3443 *
3444 * \sa SDL_UploadToGPUTexture
3445 */
3446extern SDL_DECLSPEC Uint32 SDLCALL SDL_GPUTextureFormatTexelBlockSize(
3447 SDL_GPUTextureFormat format);
3448
3449/**
3450 * Determines whether a texture format is supported for a given type and
3451 * usage.
3452 *
3453 * \param device a GPU context.
3454 * \param format the texture format to check.
3455 * \param type the type of texture (2D, 3D, Cube).
3456 * \param usage a bitmask of all usage scenarios to check.
3457 * \returns whether the texture format is supported for this type and usage.
3458 *
3459 * \since This function is available since SDL 3.0.0.
3460 */
3461extern SDL_DECLSPEC SDL_bool SDLCALL SDL_GPUTextureSupportsFormat(
3462 SDL_GPUDevice *device,
3463 SDL_GPUTextureFormat format,
3464 SDL_GPUTextureType type,
3466
3467/**
3468 * Determines if a sample count for a texture format is supported.
3469 *
3470 * \param device a GPU context.
3471 * \param format the texture format to check.
3472 * \param sample_count the sample count to check.
3473 * \returns a hardware-specific version of min(preferred, possible).
3474 *
3475 * \since This function is available since SDL 3.0.0.
3476 */
3478 SDL_GPUDevice *device,
3479 SDL_GPUTextureFormat format,
3480 SDL_GPUSampleCount sample_count);
3481
3482#ifdef SDL_PLATFORM_GDK
3483
3484/**
3485 * Call this to suspend GPU operation on Xbox when you receive the
3486 * SDL_EVENT_DID_ENTER_BACKGROUND event.
3487 *
3488 * Do NOT call any SDL_GPU functions after calling this function! This must
3489 * also be called before calling SDL_GDKSuspendComplete.
3490 *
3491 * \param device a GPU context.
3492 *
3493 * \since This function is available since SDL 3.0.0.
3494 *
3495 * \sa SDL_AddEventWatch
3496 */
3497extern SDL_DECLSPEC void SDLCALL SDL_GDKSuspendGPU(SDL_GPUDevice *device);
3498
3499/**
3500 * Call this to resume GPU operation on Xbox when you receive the
3501 * SDL_EVENT_WILL_ENTER_FOREGROUND event.
3502 *
3503 * When resuming, this function MUST be called before calling any other
3504 * SDL_GPU functions.
3505 *
3506 * \param device a GPU context.
3507 *
3508 * \since This function is available since SDL 3.0.0.
3509 *
3510 * \sa SDL_AddEventWatch
3511 */
3512extern SDL_DECLSPEC void SDLCALL SDL_GDKResumeGPU(SDL_GPUDevice *device);
3513
3514#endif /* SDL_PLATFORM_GDK */
3515
3516#ifdef __cplusplus
3517}
3518#endif /* __cplusplus */
3519#include <SDL3/SDL_close_code.h>
3520
3521#endif /* SDL_gpu_h_ */
void SDL_BindGPUComputeStorageTextures(SDL_GPUComputePass *compute_pass, Uint32 first_slot, SDL_GPUTexture *const *storage_textures, Uint32 num_bindings)
void SDL_EndGPUComputePass(SDL_GPUComputePass *compute_pass)
void SDL_WaitForGPUFences(SDL_GPUDevice *device, SDL_bool wait_all, SDL_GPUFence *const *fences, Uint32 num_fences)
void SDL_DestroyGPUDevice(SDL_GPUDevice *device)
void SDL_CopyGPUBufferToBuffer(SDL_GPUCopyPass *copy_pass, const SDL_GPUBufferLocation *source, const SDL_GPUBufferLocation *destination, Uint32 size, SDL_bool cycle)
SDL_GPUSampleCount
Definition SDL_gpu.h:508
@ SDL_GPU_SAMPLECOUNT_2
Definition SDL_gpu.h:510
@ SDL_GPU_SAMPLECOUNT_8
Definition SDL_gpu.h:512
@ SDL_GPU_SAMPLECOUNT_1
Definition SDL_gpu.h:509
@ SDL_GPU_SAMPLECOUNT_4
Definition SDL_gpu.h:511
SDL_GPUTransferBuffer * SDL_CreateGPUTransferBuffer(SDL_GPUDevice *device, const SDL_GPUTransferBufferCreateInfo *createinfo)
SDL_GPUCubeMapFace
Definition SDL_gpu.h:524
@ SDL_GPU_CUBEMAPFACE_NEGATIVEY
Definition SDL_gpu.h:528
@ SDL_GPU_CUBEMAPFACE_POSITIVEY
Definition SDL_gpu.h:527
@ SDL_GPU_CUBEMAPFACE_NEGATIVEX
Definition SDL_gpu.h:526
@ SDL_GPU_CUBEMAPFACE_NEGATIVEZ
Definition SDL_gpu.h:530
@ SDL_GPU_CUBEMAPFACE_POSITIVEX
Definition SDL_gpu.h:525
@ SDL_GPU_CUBEMAPFACE_POSITIVEZ
Definition SDL_gpu.h:529
SDL_bool SDL_GPUSupportsShaderFormats(SDL_GPUShaderFormat format_flags, const char *name)
SDL_bool SDL_WindowSupportsGPUSwapchainComposition(SDL_GPUDevice *device, SDL_Window *window, SDL_GPUSwapchainComposition swapchain_composition)
void SDL_EndGPURenderPass(SDL_GPURenderPass *render_pass)
void SDL_ReleaseGPUComputePipeline(SDL_GPUDevice *device, SDL_GPUComputePipeline *compute_pipeline)
struct SDL_GPUTransferBuffer SDL_GPUTransferBuffer
Definition SDL_gpu.h:95
void * SDL_MapGPUTransferBuffer(SDL_GPUDevice *device, SDL_GPUTransferBuffer *transfer_buffer, SDL_bool cycle)
void SDL_PushGPUDebugGroup(SDL_GPUCommandBuffer *command_buffer, const char *name)
SDL_GPUFrontFace
Definition SDL_gpu.h:715
@ SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE
Definition SDL_gpu.h:716
@ SDL_GPU_FRONTFACE_CLOCKWISE
Definition SDL_gpu.h:717
SDL_GPUDevice * SDL_CreateGPUDeviceWithProperties(SDL_PropertiesID props)
SDL_GPUVertexInputRate
Definition SDL_gpu.h:674
@ SDL_GPU_VERTEXINPUTRATE_INSTANCE
Definition SDL_gpu.h:676
@ SDL_GPU_VERTEXINPUTRATE_VERTEX
Definition SDL_gpu.h:675
SDL_GPUTexture * SDL_CreateGPUTexture(SDL_GPUDevice *device, const SDL_GPUTextureCreateInfo *createinfo)
SDL_GPUPrimitiveType
Definition SDL_gpu.h:252
@ SDL_GPU_PRIMITIVETYPE_TRIANGLELIST
Definition SDL_gpu.h:253
@ SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP
Definition SDL_gpu.h:254
@ SDL_GPU_PRIMITIVETYPE_POINTLIST
Definition SDL_gpu.h:257
@ SDL_GPU_PRIMITIVETYPE_LINESTRIP
Definition SDL_gpu.h:256
@ SDL_GPU_PRIMITIVETYPE_LINELIST
Definition SDL_gpu.h:255
void SDL_DownloadFromGPUBuffer(SDL_GPUCopyPass *copy_pass, const SDL_GPUBufferRegion *source, const SDL_GPUTransferBufferLocation *destination)
SDL_GPUTexture * SDL_AcquireGPUSwapchainTexture(SDL_GPUCommandBuffer *command_buffer, SDL_Window *window, Uint32 *w, Uint32 *h)
SDL_GPUShader * SDL_CreateGPUShader(SDL_GPUDevice *device, const SDL_GPUShaderCreateInfo *createinfo)
void SDL_PushGPUFragmentUniformData(SDL_GPUCommandBuffer *command_buffer, Uint32 slot_index, const void *data, Uint32 length)
SDL_GPUCommandBuffer * SDL_AcquireGPUCommandBuffer(SDL_GPUDevice *device)
void SDL_EndGPUCopyPass(SDL_GPUCopyPass *copy_pass)
SDL_bool SDL_ClaimWindowForGPUDevice(SDL_GPUDevice *device, SDL_Window *window)
Uint32 SDL_GPUShaderFormat
Definition SDL_gpu.h:590
void SDL_UploadToGPUTexture(SDL_GPUCopyPass *copy_pass, const SDL_GPUTextureTransferInfo *source, const SDL_GPUTextureRegion *destination, SDL_bool cycle)
void SDL_SetGPUTextureName(SDL_GPUDevice *device, SDL_GPUTexture *texture, const char *text)
struct SDL_GPURenderPass SDL_GPURenderPass
Definition SDL_gpu.h:204
SDL_GPUFillMode
Definition SDL_gpu.h:687
@ SDL_GPU_FILLMODE_FILL
Definition SDL_gpu.h:688
@ SDL_GPU_FILLMODE_LINE
Definition SDL_gpu.h:689
SDL_GPUCopyPass * SDL_BeginGPUCopyPass(SDL_GPUCommandBuffer *command_buffer)
SDL_GPUIndexElementSize
Definition SDL_gpu.h:299
@ SDL_GPU_INDEXELEMENTSIZE_16BIT
Definition SDL_gpu.h:300
@ SDL_GPU_INDEXELEMENTSIZE_32BIT
Definition SDL_gpu.h:301
void SDL_PopGPUDebugGroup(SDL_GPUCommandBuffer *command_buffer)
void SDL_BindGPUVertexStorageTextures(SDL_GPURenderPass *render_pass, Uint32 first_slot, SDL_GPUTexture *const *storage_textures, Uint32 num_bindings)
SDL_GPUBlendFactor
Definition SDL_gpu.h:794
@ SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA
Definition SDL_gpu.h:803
@ SDL_GPU_BLENDFACTOR_CONSTANT_COLOR
Definition SDL_gpu.h:806
@ SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR
Definition SDL_gpu.h:801
@ SDL_GPU_BLENDFACTOR_INVALID
Definition SDL_gpu.h:795
@ SDL_GPU_BLENDFACTOR_DST_ALPHA
Definition SDL_gpu.h:804
@ SDL_GPU_BLENDFACTOR_ZERO
Definition SDL_gpu.h:796
@ SDL_GPU_BLENDFACTOR_DST_COLOR
Definition SDL_gpu.h:800
@ SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA
Definition SDL_gpu.h:805
@ SDL_GPU_BLENDFACTOR_SRC_ALPHA
Definition SDL_gpu.h:802
@ SDL_GPU_BLENDFACTOR_SRC_COLOR
Definition SDL_gpu.h:798
@ SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR
Definition SDL_gpu.h:799
@ SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE
Definition SDL_gpu.h:808
@ SDL_GPU_BLENDFACTOR_ONE
Definition SDL_gpu.h:797
@ SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR
Definition SDL_gpu.h:807
const char * SDL_GetGPUDriver(int index)
SDL_GPUCullMode
Definition SDL_gpu.h:700
@ SDL_GPU_CULLMODE_FRONT
Definition SDL_gpu.h:702
@ SDL_GPU_CULLMODE_NONE
Definition SDL_gpu.h:701
@ SDL_GPU_CULLMODE_BACK
Definition SDL_gpu.h:703
void SDL_InsertGPUDebugLabel(SDL_GPUCommandBuffer *command_buffer, const char *text)
SDL_GPUStoreOp
Definition SDL_gpu.h:284
@ SDL_GPU_STOREOP_RESOLVE_AND_STORE
Definition SDL_gpu.h:288
@ SDL_GPU_STOREOP_STORE
Definition SDL_gpu.h:285
@ SDL_GPU_STOREOP_DONT_CARE
Definition SDL_gpu.h:286
@ SDL_GPU_STOREOP_RESOLVE
Definition SDL_gpu.h:287
SDL_GPUShaderFormat SDL_GetGPUShaderFormats(SDL_GPUDevice *device)
SDL_GPUComputePass * SDL_BeginGPUComputePass(SDL_GPUCommandBuffer *command_buffer, const SDL_GPUStorageTextureWriteOnlyBinding *storage_texture_bindings, Uint32 num_storage_texture_bindings, const SDL_GPUStorageBufferWriteOnlyBinding *storage_buffer_bindings, Uint32 num_storage_buffer_bindings)
void SDL_UploadToGPUBuffer(SDL_GPUCopyPass *copy_pass, const SDL_GPUTransferBufferLocation *source, const SDL_GPUBufferRegion *destination, SDL_bool cycle)
void SDL_BindGPUFragmentStorageTextures(SDL_GPURenderPass *render_pass, Uint32 first_slot, SDL_GPUTexture *const *storage_textures, Uint32 num_bindings)
void SDL_DispatchGPUComputeIndirect(SDL_GPUComputePass *compute_pass, SDL_GPUBuffer *buffer, Uint32 offset)
SDL_GPUSamplerMipmapMode
Definition SDL_gpu.h:846
@ SDL_GPU_SAMPLERMIPMAPMODE_NEAREST
Definition SDL_gpu.h:847
@ SDL_GPU_SAMPLERMIPMAPMODE_LINEAR
Definition SDL_gpu.h:848
struct SDL_GPUSampler SDL_GPUSampler
Definition SDL_gpu.h:128
struct SDL_GPUCommandBuffer SDL_GPUCommandBuffer
Definition SDL_gpu.h:191
SDL_bool SDL_GPUTextureSupportsSampleCount(SDL_GPUDevice *device, SDL_GPUTextureFormat format, SDL_GPUSampleCount sample_count)
SDL_GPULoadOp
Definition SDL_gpu.h:269
@ SDL_GPU_LOADOP_DONT_CARE
Definition SDL_gpu.h:272
@ SDL_GPU_LOADOP_CLEAR
Definition SDL_gpu.h:271
@ SDL_GPU_LOADOP_LOAD
Definition SDL_gpu.h:270
SDL_GPUStencilOp
Definition SDL_gpu.h:749
@ SDL_GPU_STENCILOP_DECREMENT_AND_WRAP
Definition SDL_gpu.h:758
@ SDL_GPU_STENCILOP_ZERO
Definition SDL_gpu.h:752
@ SDL_GPU_STENCILOP_KEEP
Definition SDL_gpu.h:751
@ SDL_GPU_STENCILOP_INVERT
Definition SDL_gpu.h:756
@ SDL_GPU_STENCILOP_REPLACE
Definition SDL_gpu.h:753
@ SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP
Definition SDL_gpu.h:755
@ SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP
Definition SDL_gpu.h:754
@ SDL_GPU_STENCILOP_INCREMENT_AND_WRAP
Definition SDL_gpu.h:757
@ SDL_GPU_STENCILOP_INVALID
Definition SDL_gpu.h:750
struct SDL_GPUFence SDL_GPUFence
Definition SDL_gpu.h:242
SDL_bool SDL_WindowSupportsGPUPresentMode(SDL_GPUDevice *device, SDL_Window *window, SDL_GPUPresentMode present_mode)
Uint32 SDL_GPUTextureFormatTexelBlockSize(SDL_GPUTextureFormat format)
SDL_GPUBlendOp
Definition SDL_gpu.h:773
@ SDL_GPU_BLENDOP_MIN
Definition SDL_gpu.h:778
@ SDL_GPU_BLENDOP_INVALID
Definition SDL_gpu.h:774
@ SDL_GPU_BLENDOP_MAX
Definition SDL_gpu.h:779
@ SDL_GPU_BLENDOP_REVERSE_SUBTRACT
Definition SDL_gpu.h:777
@ SDL_GPU_BLENDOP_SUBTRACT
Definition SDL_gpu.h:776
@ SDL_GPU_BLENDOP_ADD
Definition SDL_gpu.h:775
void SDL_DrawGPUPrimitives(SDL_GPURenderPass *render_pass, Uint32 num_vertices, Uint32 num_instances, Uint32 first_vertex, Uint32 first_instance)
int SDL_GetNumGPUDrivers(void)
void SDL_ReleaseGPUSampler(SDL_GPUDevice *device, SDL_GPUSampler *sampler)
void SDL_GenerateMipmapsForGPUTexture(SDL_GPUCommandBuffer *command_buffer, SDL_GPUTexture *texture)
void SDL_BindGPUComputeStorageBuffers(SDL_GPUComputePass *compute_pass, Uint32 first_slot, SDL_GPUBuffer *const *storage_buffers, Uint32 num_bindings)
SDL_GPUGraphicsPipeline * SDL_CreateGPUGraphicsPipeline(SDL_GPUDevice *device, const SDL_GPUGraphicsPipelineCreateInfo *createinfo)
Uint8 SDL_GPUColorComponentFlags
Definition SDL_gpu.h:818
SDL_GPUSampler * SDL_CreateGPUSampler(SDL_GPUDevice *device, const SDL_GPUSamplerCreateInfo *createinfo)
SDL_bool SDL_SetGPUSwapchainParameters(SDL_GPUDevice *device, SDL_Window *window, SDL_GPUSwapchainComposition swapchain_composition, SDL_GPUPresentMode present_mode)
void SDL_SetGPUStencilReference(SDL_GPURenderPass *render_pass, Uint8 reference)
struct SDL_GPUGraphicsPipeline SDL_GPUGraphicsPipeline
Definition SDL_gpu.h:165
void SDL_SetGPUBlendConstants(SDL_GPURenderPass *render_pass, SDL_FColor blend_constants)
void SDL_DispatchGPUCompute(SDL_GPUComputePass *compute_pass, Uint32 groupcount_x, Uint32 groupcount_y, Uint32 groupcount_z)
void SDL_ReleaseGPUTexture(SDL_GPUDevice *device, SDL_GPUTexture *texture)
void SDL_UnmapGPUTransferBuffer(SDL_GPUDevice *device, SDL_GPUTransferBuffer *transfer_buffer)
void SDL_PushGPUVertexUniformData(SDL_GPUCommandBuffer *command_buffer, Uint32 slot_index, const void *data, Uint32 length)
SDL_GPUVertexElementFormat
Definition SDL_gpu.h:608
@ SDL_GPU_VERTEXELEMENTFORMAT_INT4
Definition SDL_gpu.h:615
@ SDL_GPU_VERTEXELEMENTFORMAT_INT
Definition SDL_gpu.h:612
@ SDL_GPU_VERTEXELEMENTFORMAT_INVALID
Definition SDL_gpu.h:609
@ SDL_GPU_VERTEXELEMENTFORMAT_HALF2
Definition SDL_gpu.h:662
@ SDL_GPU_VERTEXELEMENTFORMAT_BYTE2
Definition SDL_gpu.h:630
@ SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4
Definition SDL_gpu.h:635
@ SDL_GPU_VERTEXELEMENTFORMAT_USHORT4
Definition SDL_gpu.h:651
@ SDL_GPU_VERTEXELEMENTFORMAT_INT2
Definition SDL_gpu.h:613
@ SDL_GPU_VERTEXELEMENTFORMAT_BYTE2_NORM
Definition SDL_gpu.h:638
@ SDL_GPU_VERTEXELEMENTFORMAT_UINT2
Definition SDL_gpu.h:619
@ SDL_GPU_VERTEXELEMENTFORMAT_BYTE4
Definition SDL_gpu.h:631
@ SDL_GPU_VERTEXELEMENTFORMAT_SHORT2_NORM
Definition SDL_gpu.h:654
@ SDL_GPU_VERTEXELEMENTFORMAT_FLOAT4
Definition SDL_gpu.h:627
@ SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM
Definition SDL_gpu.h:642
@ SDL_GPU_VERTEXELEMENTFORMAT_UINT3
Definition SDL_gpu.h:620
@ SDL_GPU_VERTEXELEMENTFORMAT_UINT
Definition SDL_gpu.h:618
@ SDL_GPU_VERTEXELEMENTFORMAT_UINT4
Definition SDL_gpu.h:621
@ SDL_GPU_VERTEXELEMENTFORMAT_USHORT2_NORM
Definition SDL_gpu.h:658
@ SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3
Definition SDL_gpu.h:626
@ SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2
Definition SDL_gpu.h:634
@ SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2
Definition SDL_gpu.h:625
@ SDL_GPU_VERTEXELEMENTFORMAT_SHORT4
Definition SDL_gpu.h:647
@ SDL_GPU_VERTEXELEMENTFORMAT_FLOAT
Definition SDL_gpu.h:624
@ SDL_GPU_VERTEXELEMENTFORMAT_SHORT2
Definition SDL_gpu.h:646
@ SDL_GPU_VERTEXELEMENTFORMAT_BYTE4_NORM
Definition SDL_gpu.h:639
@ SDL_GPU_VERTEXELEMENTFORMAT_HALF4
Definition SDL_gpu.h:663
@ SDL_GPU_VERTEXELEMENTFORMAT_USHORT2
Definition SDL_gpu.h:650
@ SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM
Definition SDL_gpu.h:643
@ SDL_GPU_VERTEXELEMENTFORMAT_SHORT4_NORM
Definition SDL_gpu.h:655
@ SDL_GPU_VERTEXELEMENTFORMAT_USHORT4_NORM
Definition SDL_gpu.h:659
@ SDL_GPU_VERTEXELEMENTFORMAT_INT3
Definition SDL_gpu.h:614
void SDL_BindGPUComputeSamplers(SDL_GPUComputePass *compute_pass, Uint32 first_slot, const SDL_GPUTextureSamplerBinding *texture_sampler_bindings, Uint32 num_bindings)
void SDL_ReleaseGPUShader(SDL_GPUDevice *device, SDL_GPUShader *shader)
void SDL_BlitGPUTexture(SDL_GPUCommandBuffer *command_buffer, const SDL_GPUBlitInfo *info)
struct SDL_GPUComputePipeline SDL_GPUComputePipeline
Definition SDL_gpu.h:152
SDL_GPURenderPass * SDL_BeginGPURenderPass(SDL_GPUCommandBuffer *command_buffer, const SDL_GPUColorTargetInfo *color_target_infos, Uint32 num_color_targets, const SDL_GPUDepthStencilTargetInfo *depth_stencil_target_info)
void SDL_BindGPUComputePipeline(SDL_GPUComputePass *compute_pass, SDL_GPUComputePipeline *compute_pipeline)
struct SDL_GPUTexture SDL_GPUTexture
Definition SDL_gpu.h:116
void SDL_ReleaseGPUBuffer(SDL_GPUDevice *device, SDL_GPUBuffer *buffer)
Uint32 SDL_GPUTextureUsageFlags
Definition SDL_gpu.h:471
void SDL_ReleaseGPUFence(SDL_GPUDevice *device, SDL_GPUFence *fence)
Uint32 SDL_GPUBufferUsageFlags
Definition SDL_gpu.h:543
SDL_GPUPresentMode
Definition SDL_gpu.h:898
@ SDL_GPU_PRESENTMODE_VSYNC
Definition SDL_gpu.h:899
@ SDL_GPU_PRESENTMODE_IMMEDIATE
Definition SDL_gpu.h:900
@ SDL_GPU_PRESENTMODE_MAILBOX
Definition SDL_gpu.h:901
void SDL_BindGPUVertexBuffers(SDL_GPURenderPass *render_pass, Uint32 first_slot, const SDL_GPUBufferBinding *bindings, Uint32 num_bindings)
void SDL_BindGPUIndexBuffer(SDL_GPURenderPass *render_pass, const SDL_GPUBufferBinding *binding, SDL_GPUIndexElementSize index_element_size)
SDL_GPUBuffer * SDL_CreateGPUBuffer(SDL_GPUDevice *device, const SDL_GPUBufferCreateInfo *createinfo)
SDL_bool SDL_GPUTextureSupportsFormat(SDL_GPUDevice *device, SDL_GPUTextureFormat format, SDL_GPUTextureType type, SDL_GPUTextureUsageFlags usage)
struct SDL_GPUBuffer SDL_GPUBuffer
Definition SDL_gpu.h:77
SDL_GPUCompareOp
Definition SDL_gpu.h:728
@ SDL_GPU_COMPAREOP_NEVER
Definition SDL_gpu.h:730
@ SDL_GPU_COMPAREOP_INVALID
Definition SDL_gpu.h:729
@ SDL_GPU_COMPAREOP_GREATER
Definition SDL_gpu.h:734
@ SDL_GPU_COMPAREOP_LESS
Definition SDL_gpu.h:731
@ SDL_GPU_COMPAREOP_GREATER_OR_EQUAL
Definition SDL_gpu.h:736
@ SDL_GPU_COMPAREOP_ALWAYS
Definition SDL_gpu.h:737
@ SDL_GPU_COMPAREOP_LESS_OR_EQUAL
Definition SDL_gpu.h:733
@ SDL_GPU_COMPAREOP_NOT_EQUAL
Definition SDL_gpu.h:735
@ SDL_GPU_COMPAREOP_EQUAL
Definition SDL_gpu.h:732
void SDL_BindGPUVertexSamplers(SDL_GPURenderPass *render_pass, Uint32 first_slot, const SDL_GPUTextureSamplerBinding *texture_sampler_bindings, Uint32 num_bindings)
struct SDL_GPUCopyPass SDL_GPUCopyPass
Definition SDL_gpu.h:230
SDL_GPUComputePipeline * SDL_CreateGPUComputePipeline(SDL_GPUDevice *device, const SDL_GPUComputePipelineCreateInfo *createinfo)
SDL_GPUFence * SDL_SubmitGPUCommandBufferAndAcquireFence(SDL_GPUCommandBuffer *command_buffer)
SDL_bool SDL_GPUSupportsProperties(SDL_PropertiesID props)
SDL_GPUDevice * SDL_CreateGPUDevice(SDL_GPUShaderFormat format_flags, SDL_bool debug_mode, const char *name)
void SDL_DrawGPUIndexedPrimitives(SDL_GPURenderPass *render_pass, Uint32 num_indices, Uint32 num_instances, Uint32 first_index, Sint32 vertex_offset, Uint32 first_instance)
void SDL_SubmitGPUCommandBuffer(SDL_GPUCommandBuffer *command_buffer)
SDL_bool SDL_QueryGPUFence(SDL_GPUDevice *device, SDL_GPUFence *fence)
SDL_GPUFilter
Definition SDL_gpu.h:833
@ SDL_GPU_FILTER_NEAREST
Definition SDL_gpu.h:834
@ SDL_GPU_FILTER_LINEAR
Definition SDL_gpu.h:835
SDL_GPUTransferBufferUsage
Definition SDL_gpu.h:563
@ SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD
Definition SDL_gpu.h:565
@ SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD
Definition SDL_gpu.h:564
void SDL_DrawGPUPrimitivesIndirect(SDL_GPURenderPass *render_pass, SDL_GPUBuffer *buffer, Uint32 offset, Uint32 draw_count)
void SDL_BindGPUGraphicsPipeline(SDL_GPURenderPass *render_pass, SDL_GPUGraphicsPipeline *graphics_pipeline)
void SDL_SetGPUViewport(SDL_GPURenderPass *render_pass, const SDL_GPUViewport *viewport)
struct SDL_GPUShader SDL_GPUShader
Definition SDL_gpu.h:139
SDL_GPUTextureFormat SDL_GetGPUSwapchainTextureFormat(SDL_GPUDevice *device, SDL_Window *window)
SDL_GPUSwapchainComposition
Definition SDL_gpu.h:930
@ SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2048
Definition SDL_gpu.h:934
@ SDL_GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR
Definition SDL_gpu.h:932
@ SDL_GPU_SWAPCHAINCOMPOSITION_SDR
Definition SDL_gpu.h:931
@ SDL_GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR
Definition SDL_gpu.h:933
void SDL_PushGPUComputeUniformData(SDL_GPUCommandBuffer *command_buffer, Uint32 slot_index, const void *data, Uint32 length)
void SDL_SetGPUScissor(SDL_GPURenderPass *render_pass, const SDL_Rect *scissor)
void SDL_ReleaseGPUTransferBuffer(SDL_GPUDevice *device, SDL_GPUTransferBuffer *transfer_buffer)
SDL_GPUShaderStage
Definition SDL_gpu.h:576
@ SDL_GPU_SHADERSTAGE_FRAGMENT
Definition SDL_gpu.h:578
@ SDL_GPU_SHADERSTAGE_VERTEX
Definition SDL_gpu.h:577
void SDL_ReleaseWindowFromGPUDevice(SDL_GPUDevice *device, SDL_Window *window)
void SDL_SetGPUBufferName(SDL_GPUDevice *device, SDL_GPUBuffer *buffer, const char *text)
void SDL_BindGPUFragmentStorageBuffers(SDL_GPURenderPass *render_pass, Uint32 first_slot, SDL_GPUBuffer *const *storage_buffers, Uint32 num_bindings)
const char * SDL_GetGPUDeviceDriver(SDL_GPUDevice *device)
SDL_GPUTextureType
Definition SDL_gpu.h:488
@ SDL_GPU_TEXTURETYPE_CUBE_ARRAY
Definition SDL_gpu.h:493
@ SDL_GPU_TEXTURETYPE_3D
Definition SDL_gpu.h:491
@ SDL_GPU_TEXTURETYPE_CUBE
Definition SDL_gpu.h:492
@ SDL_GPU_TEXTURETYPE_2D
Definition SDL_gpu.h:489
@ SDL_GPU_TEXTURETYPE_2D_ARRAY
Definition SDL_gpu.h:490
void SDL_DrawGPUIndexedPrimitivesIndirect(SDL_GPURenderPass *render_pass, SDL_GPUBuffer *buffer, Uint32 offset, Uint32 draw_count)
void SDL_BindGPUFragmentSamplers(SDL_GPURenderPass *render_pass, Uint32 first_slot, const SDL_GPUTextureSamplerBinding *texture_sampler_bindings, Uint32 num_bindings)
SDL_GPUSamplerAddressMode
Definition SDL_gpu.h:860
@ SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT
Definition SDL_gpu.h:862
@ SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE
Definition SDL_gpu.h:863
@ SDL_GPU_SAMPLERADDRESSMODE_REPEAT
Definition SDL_gpu.h:861
void SDL_ReleaseGPUGraphicsPipeline(SDL_GPUDevice *device, SDL_GPUGraphicsPipeline *graphics_pipeline)
SDL_GPUTextureFormat
Definition SDL_gpu.h:388
@ SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM
Definition SDL_gpu.h:403
@ SDL_GPU_TEXTUREFORMAT_D16_UNORM
Definition SDL_gpu.h:454
@ SDL_GPU_TEXTUREFORMAT_R16G16_INT
Definition SDL_gpu.h:443
@ SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UINT
Definition SDL_gpu.h:437
@ SDL_GPU_TEXTUREFORMAT_R8_UINT
Definition SDL_gpu.h:432
@ SDL_GPU_TEXTUREFORMAT_R8G8_SNORM
Definition SDL_gpu.h:417
@ SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UNORM
Definition SDL_gpu.h:398
@ SDL_GPU_TEXTUREFORMAT_A8_UNORM
Definition SDL_gpu.h:392
@ SDL_GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT
Definition SDL_gpu.h:412
@ SDL_GPU_TEXTUREFORMAT_R16_UINT
Definition SDL_gpu.h:435
@ SDL_GPU_TEXTUREFORMAT_R16G16B16A16_SNORM
Definition SDL_gpu.h:421
@ SDL_GPU_TEXTUREFORMAT_BC5_RG_UNORM
Definition SDL_gpu.h:409
@ SDL_GPU_TEXTUREFORMAT_R16_INT
Definition SDL_gpu.h:442
@ SDL_GPU_TEXTUREFORMAT_BC4_R_UNORM
Definition SDL_gpu.h:408
@ SDL_GPU_TEXTUREFORMAT_R32G32_FLOAT
Definition SDL_gpu.h:427
@ SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB
Definition SDL_gpu.h:446
@ SDL_GPU_TEXTUREFORMAT_R8G8B8A8_SNORM
Definition SDL_gpu.h:418
@ SDL_GPU_TEXTUREFORMAT_R16_UNORM
Definition SDL_gpu.h:396
@ SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT
Definition SDL_gpu.h:458
@ SDL_GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT
Definition SDL_gpu.h:414
@ SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM
Definition SDL_gpu.h:410
@ SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM
Definition SDL_gpu.h:406
@ SDL_GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT
Definition SDL_gpu.h:428
@ SDL_GPU_TEXTUREFORMAT_R8_SNORM
Definition SDL_gpu.h:416
@ SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB
Definition SDL_gpu.h:449
@ SDL_GPU_TEXTUREFORMAT_R8_UNORM
Definition SDL_gpu.h:393
@ SDL_GPU_TEXTUREFORMAT_D24_UNORM
Definition SDL_gpu.h:455
@ SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB
Definition SDL_gpu.h:450
@ SDL_GPU_TEXTUREFORMAT_INVALID
Definition SDL_gpu.h:389
@ SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM
Definition SDL_gpu.h:407
@ SDL_GPU_TEXTUREFORMAT_R16G16_SNORM
Definition SDL_gpu.h:420
@ SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM
Definition SDL_gpu.h:402
@ SDL_GPU_TEXTUREFORMAT_R8G8_INT
Definition SDL_gpu.h:440
@ SDL_GPU_TEXTUREFORMAT_D32_FLOAT
Definition SDL_gpu.h:456
@ SDL_GPU_TEXTUREFORMAT_R8_INT
Definition SDL_gpu.h:439
@ SDL_GPU_TEXTUREFORMAT_R8G8_UINT
Definition SDL_gpu.h:433
@ SDL_GPU_TEXTUREFORMAT_R16G16_FLOAT
Definition SDL_gpu.h:424
@ SDL_GPU_TEXTUREFORMAT_B5G5R5A1_UNORM
Definition SDL_gpu.h:401
@ SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB
Definition SDL_gpu.h:451
@ SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM
Definition SDL_gpu.h:405
@ SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB
Definition SDL_gpu.h:452
@ SDL_GPU_TEXTUREFORMAT_R32_FLOAT
Definition SDL_gpu.h:426
@ SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT
Definition SDL_gpu.h:457
@ SDL_GPU_TEXTUREFORMAT_R8G8_UNORM
Definition SDL_gpu.h:394
@ SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB
Definition SDL_gpu.h:447
@ SDL_GPU_TEXTUREFORMAT_B5G6R5_UNORM
Definition SDL_gpu.h:400
@ SDL_GPU_TEXTUREFORMAT_R16G16_UNORM
Definition SDL_gpu.h:397
@ SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM
Definition SDL_gpu.h:395
@ SDL_GPU_TEXTUREFORMAT_R11G11B10_UFLOAT
Definition SDL_gpu.h:430
@ SDL_GPU_TEXTUREFORMAT_R16G16B16A16_INT
Definition SDL_gpu.h:444
@ SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UINT
Definition SDL_gpu.h:434
@ SDL_GPU_TEXTUREFORMAT_R16G16_UINT
Definition SDL_gpu.h:436
@ SDL_GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT
Definition SDL_gpu.h:425
@ SDL_GPU_TEXTUREFORMAT_R16_SNORM
Definition SDL_gpu.h:419
@ SDL_GPU_TEXTUREFORMAT_R8G8B8A8_INT
Definition SDL_gpu.h:441
@ SDL_GPU_TEXTUREFORMAT_R10G10B10A2_UNORM
Definition SDL_gpu.h:399
@ SDL_GPU_TEXTUREFORMAT_R16_FLOAT
Definition SDL_gpu.h:423
struct SDL_GPUComputePass SDL_GPUComputePass
Definition SDL_gpu.h:217
void SDL_CopyGPUTextureToTexture(SDL_GPUCopyPass *copy_pass, const SDL_GPUTextureLocation *source, const SDL_GPUTextureLocation *destination, Uint32 w, Uint32 h, Uint32 d, SDL_bool cycle)
void SDL_BindGPUVertexStorageBuffers(SDL_GPURenderPass *render_pass, Uint32 first_slot, SDL_GPUBuffer *const *storage_buffers, Uint32 num_bindings)
struct SDL_GPUDevice SDL_GPUDevice
Definition SDL_gpu.h:52
void SDL_WaitForGPUIdle(SDL_GPUDevice *device)
void SDL_DownloadFromGPUTexture(SDL_GPUCopyPass *copy_pass, const SDL_GPUTextureRegion *source, const SDL_GPUTextureTransferInfo *destination)
Uint32 SDL_PropertiesID
uint8_t Uint8
Definition SDL_stdinc.h:317
int32_t Sint32
Definition SDL_stdinc.h:344
SDL_MALLOC size_t size
Definition SDL_stdinc.h:717
uint32_t Uint32
Definition SDL_stdinc.h:353
bool SDL_bool
Definition SDL_stdinc.h:301
SDL_FlipMode
Definition SDL_surface.h:83
struct SDL_Window SDL_Window
Definition SDL_video.h:144
SDL_FlipMode flip_mode
Definition SDL_gpu.h:1619
SDL_FColor clear_color
Definition SDL_gpu.h:1618
SDL_GPUFilter filter
Definition SDL_gpu.h:1620
SDL_bool cycle
Definition SDL_gpu.h:1621
SDL_GPUBlitRegion source
Definition SDL_gpu.h:1615
SDL_GPUBlitRegion destination
Definition SDL_gpu.h:1616
SDL_GPULoadOp load_op
Definition SDL_gpu.h:1617
SDL_GPUTexture * texture
Definition SDL_gpu.h:1040
Uint32 layer_or_depth_plane
Definition SDL_gpu.h:1042
SDL_GPUBuffer * buffer
Definition SDL_gpu.h:1638
SDL_PropertiesID props
Definition SDL_gpu.h:1334
SDL_GPUBufferUsageFlags usage
Definition SDL_gpu.h:1331
SDL_GPUBuffer * buffer
Definition SDL_gpu.h:1060
SDL_GPUBuffer * buffer
Definition SDL_gpu.h:1076
SDL_GPUBlendOp color_blend_op
Definition SDL_gpu.h:1253
SDL_GPUColorComponentFlags color_write_mask
Definition SDL_gpu.h:1257
SDL_GPUBlendFactor src_alpha_blendfactor
Definition SDL_gpu.h:1254
SDL_GPUBlendOp alpha_blend_op
Definition SDL_gpu.h:1256
SDL_GPUBlendFactor dst_alpha_blendfactor
Definition SDL_gpu.h:1255
SDL_GPUBlendFactor src_color_blendfactor
Definition SDL_gpu.h:1251
SDL_GPUBlendFactor dst_color_blendfactor
Definition SDL_gpu.h:1252
SDL_GPUColorTargetBlendState blend_state
Definition SDL_gpu.h:1428
SDL_GPUTextureFormat format
Definition SDL_gpu.h:1427
SDL_bool cycle_resolve_texture
Definition SDL_gpu.h:1544
SDL_FColor clear_color
Definition SDL_gpu.h:1537
SDL_GPUTexture * texture
Definition SDL_gpu.h:1534
SDL_GPULoadOp load_op
Definition SDL_gpu.h:1538
SDL_GPUTexture * resolve_texture
Definition SDL_gpu.h:1540
SDL_GPUStoreOp store_op
Definition SDL_gpu.h:1539
SDL_GPUShaderFormat format
Definition SDL_gpu.h:1483
SDL_GPUStencilOpState back_stencil_state
Definition SDL_gpu.h:1405
SDL_GPUCompareOp compare_op
Definition SDL_gpu.h:1404
SDL_GPUStencilOpState front_stencil_state
Definition SDL_gpu.h:1406
SDL_GPUTexture * texture
Definition SDL_gpu.h:1595
SDL_GPUStoreOp stencil_store_op
Definition SDL_gpu.h:1600
SDL_GPULoadOp stencil_load_op
Definition SDL_gpu.h:1599
SDL_GPUMultisampleState multisample_state
Definition SDL_gpu.h:1464
SDL_GPUPrimitiveType primitive_type
Definition SDL_gpu.h:1462
SDL_GPUDepthStencilState depth_stencil_state
Definition SDL_gpu.h:1465
SDL_GPUGraphicsPipelineTargetInfo target_info
Definition SDL_gpu.h:1466
SDL_GPUVertexInputState vertex_input_state
Definition SDL_gpu.h:1461
SDL_GPURasterizerState rasterizer_state
Definition SDL_gpu.h:1463
SDL_GPUTextureFormat depth_stencil_format
Definition SDL_gpu.h:1443
const SDL_GPUColorTargetDescription * color_target_descriptions
Definition SDL_gpu.h:1441
SDL_GPUSampleCount sample_count
Definition SDL_gpu.h:1386
SDL_GPUFrontFace front_face
Definition SDL_gpu.h:1366
SDL_bool enable_depth_bias
Definition SDL_gpu.h:1370
SDL_GPUCullMode cull_mode
Definition SDL_gpu.h:1365
float depth_bias_constant_factor
Definition SDL_gpu.h:1367
SDL_GPUFillMode fill_mode
Definition SDL_gpu.h:1364
SDL_GPUFilter mag_filter
Definition SDL_gpu.h:1148
SDL_GPUSamplerAddressMode address_mode_u
Definition SDL_gpu.h:1150
SDL_GPUSamplerMipmapMode mipmap_mode
Definition SDL_gpu.h:1149
SDL_GPUSamplerAddressMode address_mode_v
Definition SDL_gpu.h:1151
SDL_GPUSamplerAddressMode address_mode_w
Definition SDL_gpu.h:1152
SDL_GPUFilter min_filter
Definition SDL_gpu.h:1147
SDL_PropertiesID props
Definition SDL_gpu.h:1163
SDL_GPUCompareOp compare_op
Definition SDL_gpu.h:1155
SDL_PropertiesID props
Definition SDL_gpu.h:1284
SDL_GPUShaderFormat format
Definition SDL_gpu.h:1277
const Uint8 * code
Definition SDL_gpu.h:1275
const char * entrypoint
Definition SDL_gpu.h:1276
SDL_GPUShaderStage stage
Definition SDL_gpu.h:1278
SDL_GPUStencilOp fail_op
Definition SDL_gpu.h:1236
SDL_GPUStencilOp depth_fail_op
Definition SDL_gpu.h:1238
SDL_GPUStencilOp pass_op
Definition SDL_gpu.h:1237
SDL_GPUCompareOp compare_op
Definition SDL_gpu.h:1239
SDL_PropertiesID props
Definition SDL_gpu.h:1309
SDL_GPUTextureUsageFlags usage
Definition SDL_gpu.h:1302
SDL_GPUTextureFormat format
Definition SDL_gpu.h:1301
SDL_GPUTextureType type
Definition SDL_gpu.h:1300
SDL_GPUSampleCount sample_count
Definition SDL_gpu.h:1307
SDL_GPUTexture * texture
Definition SDL_gpu.h:1000
SDL_GPUTexture * texture
Definition SDL_gpu.h:1020
SDL_GPUSampler * sampler
Definition SDL_gpu.h:1653
SDL_GPUTexture * texture
Definition SDL_gpu.h:1652
SDL_GPUTransferBuffer * transfer_buffer
Definition SDL_gpu.h:967
SDL_GPUTransferBufferUsage usage
Definition SDL_gpu.h:1346
SDL_GPUTransferBuffer * transfer_buffer
Definition SDL_gpu.h:985
SDL_GPUVertexElementFormat format
Definition SDL_gpu.h:1207
SDL_GPUVertexInputRate input_rate
Definition SDL_gpu.h:1188
const SDL_GPUVertexAttribute * vertex_attributes
Definition SDL_gpu.h:1223
const SDL_GPUVertexBufferDescription * vertex_buffer_descriptions
Definition SDL_gpu.h:1221
float min_depth
Definition SDL_gpu.h:952
float max_depth
Definition SDL_gpu.h:953