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