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