sdl3_sys/generated/gpu.rs
1//! The GPU API offers a cross-platform way for apps to talk to modern graphics
2//! hardware. It offers both 3D graphics and compute support, in the style of
3//! Metal, Vulkan, and Direct3D 12.
4//!
5//! A basic workflow might be something like this:
6//!
7//! The app creates a GPU device with [`SDL_CreateGPUDevice()`], and assigns it to
8//! a window with [`SDL_ClaimWindowForGPUDevice()`]--although strictly speaking you
9//! can render offscreen entirely, perhaps for image processing, and not use a
10//! window at all.
11//!
12//! Next, the app prepares static data (things that are created once and used
13//! over and over). For example:
14//!
15//! - Shaders (programs that run on the GPU): use [`SDL_CreateGPUShader()`].
16//! - Vertex buffers (arrays of geometry data) and other rendering data: use
17//! [`SDL_CreateGPUBuffer()`] and [`SDL_UploadToGPUBuffer()`].
18//! - Textures (images): use [`SDL_CreateGPUTexture()`] and
19//! [`SDL_UploadToGPUTexture()`].
20//! - Samplers (how textures should be read from): use [`SDL_CreateGPUSampler()`].
21//! - Render pipelines (precalculated rendering state): use
22//! [`SDL_CreateGPUGraphicsPipeline()`]
23//!
24//! To render, the app creates one or more command buffers, with
25//! [`SDL_AcquireGPUCommandBuffer()`]. Command buffers collect rendering
26//! instructions that will be submitted to the GPU in batch. Complex scenes can
27//! use multiple command buffers, maybe configured across multiple threads in
28//! parallel, as long as they are submitted in the correct order, but many apps
29//! will just need one command buffer per frame.
30//!
31//! Rendering can happen to a texture (what other APIs call a "render target")
32//! or it can happen to the swapchain texture (which is just a special texture
33//! that represents a window's contents). The app can use
34//! [`SDL_WaitAndAcquireGPUSwapchainTexture()`] to render to the window.
35//!
36//! Rendering actually happens in a Render Pass, which is encoded into a
37//! command buffer. One can encode multiple render passes (or alternate between
38//! render and compute passes) in a single command buffer, but many apps might
39//! simply need a single render pass in a single command buffer. Render Passes
40//! can render to up to four color textures and one depth texture
41//! simultaneously. If the set of textures being rendered to needs to change,
42//! the Render Pass must be ended and a new one must be begun.
43//!
44//! The app calls [`SDL_BeginGPURenderPass()`]. Then it sets states it needs for
45//! each draw:
46//!
47//! - [`SDL_BindGPUGraphicsPipeline()`]
48//! - [`SDL_SetGPUViewport()`]
49//! - [`SDL_BindGPUVertexBuffers()`]
50//! - [`SDL_BindGPUVertexSamplers()`]
51//! - etc
52//!
53//! Then, make the actual draw commands with these states:
54//!
55//! - [`SDL_DrawGPUPrimitives()`]
56//! - [`SDL_DrawGPUPrimitivesIndirect()`]
57//! - [`SDL_DrawGPUIndexedPrimitivesIndirect()`]
58//! - etc
59//!
60//! After all the drawing commands for a pass are complete, the app should call
61//! [`SDL_EndGPURenderPass()`]. Once a render pass ends all render-related state is
62//! reset.
63//!
64//! The app can begin new Render Passes and make new draws in the same command
65//! buffer until the entire scene is rendered.
66//!
67//! Once all of the render commands for the scene are complete, the app calls
68//! [`SDL_SubmitGPUCommandBuffer()`] to send it to the GPU for processing.
69//!
70//! If the app needs to read back data from texture or buffers, the API has an
71//! efficient way of doing this, provided that the app is willing to tolerate
72//! some latency. When the app uses [`SDL_DownloadFromGPUTexture()`] or
73//! [`SDL_DownloadFromGPUBuffer()`], submitting the command buffer with
74//! [`SDL_SubmitGPUCommandBufferAndAcquireFence()`] will return a fence handle that
75//! the app can poll or wait on in a thread. Once the fence indicates that the
76//! command buffer is done processing, it is safe to read the downloaded data.
77//! Make sure to call [`SDL_ReleaseGPUFence()`] when done with the fence.
78//!
79//! The API also has "compute" support. The app calls [`SDL_BeginGPUComputePass()`]
80//! with compute-writeable textures and/or buffers, which can be written to in
81//! a compute shader. Then it sets states it needs for the compute dispatches:
82//!
83//! - [`SDL_BindGPUComputePipeline()`]
84//! - [`SDL_BindGPUComputeStorageBuffers()`]
85//! - [`SDL_BindGPUComputeStorageTextures()`]
86//!
87//! Then, dispatch compute work:
88//!
89//! - [`SDL_DispatchGPUCompute()`]
90//!
91//! For advanced users, this opens up powerful GPU-driven workflows.
92//!
93//! Graphics and compute pipelines require the use of shaders, which as
94//! mentioned above are small programs executed on the GPU. Each backend
95//! (Vulkan, Metal, D3D12) requires a different shader format. When the app
96//! creates the GPU device, the app lets the device know which shader formats
97//! the app can provide. It will then select the appropriate backend depending
98//! on the available shader formats and the backends available on the platform.
99//! When creating shaders, the app must provide the correct shader format for
100//! the selected backend. If you would like to learn more about why the API
101//! works this way, there is a detailed
102//! [blog post](https://moonside.games/posts/layers-all-the-way-down/)
103//! explaining this situation.
104//!
105//! It is optimal for apps to pre-compile the shader formats they might use,
106//! but for ease of use SDL provides a separate project,
107//! [SDL_shadercross](https://github.com/libsdl-org/SDL_shadercross)
108//! , for performing runtime shader cross-compilation. It also has a CLI
109//! interface for offline precompilation as well.
110//!
111//! This is an extremely quick overview that leaves out several important
112//! details. Already, though, one can see that GPU programming can be quite
113//! complex! If you just need simple 2D graphics, the
114//! [Render API](https://wiki.libsdl.org/SDL3/CategoryRender)
115//! is much easier to use but still hardware-accelerated. That said, even for
116//! 2D applications the performance benefits and expressiveness of the GPU API
117//! are significant.
118//!
119//! The GPU API targets a feature set with a wide range of hardware support and
120//! ease of portability. It is designed so that the app won't have to branch
121//! itself by querying feature support. If you need cutting-edge features with
122//! limited hardware support, this API is probably not for you.
123//!
124//! Examples demonstrating proper usage of this API can be found
125//! [here](https://github.com/TheSpydog/SDL_gpu_examples)
126//! .
127//!
128//! ## Performance considerations
129//!
130//! Here are some basic tips for maximizing your rendering performance.
131//!
132//! - Beginning a new render pass is relatively expensive. Use as few render
133//! passes as you can.
134//! - Minimize the amount of state changes. For example, binding a pipeline is
135//! relatively cheap, but doing it hundreds of times when you don't need to
136//! will slow the performance significantly.
137//! - Perform your data uploads as early as possible in the frame.
138//! - Don't churn resources. Creating and releasing resources is expensive.
139//! It's better to create what you need up front and cache it.
140//! - Don't use uniform buffers for large amounts of data (more than a matrix
141//! or so). Use a storage buffer instead.
142//! - Use cycling correctly. There is a detailed explanation of cycling further
143//! below.
144//! - Use culling techniques to minimize pixel writes. The less writing the GPU
145//! has to do the better. Culling can be a very advanced topic but even
146//! simple culling techniques can boost performance significantly.
147//!
148//! In general try to remember the golden rule of performance: doing things is
149//! more expensive than not doing things. Don't Touch The Driver!
150//!
151//! ## FAQ
152//!
153//! **Question: When are you adding more advanced features, like ray tracing or
154//! mesh shaders?**
155//!
156//! Answer: We don't have immediate plans to add more bleeding-edge features,
157//! but we certainly might in the future, when these features prove worthwhile,
158//! and reasonable to implement across several platforms and underlying APIs.
159//! So while these things are not in the "never" category, they are definitely
160//! not "near future" items either.
161//!
162//! **Question: Why is my shader not working?**
163//!
164//! Answer: A common oversight when using shaders is not properly laying out
165//! the shader resources/registers correctly. The GPU API is very strict with
166//! how it wants resources to be laid out and it's difficult for the API to
167//! automatically validate shaders to see if they have a compatible layout. See
168//! the documentation for [`SDL_CreateGPUShader()`] and
169//! [`SDL_CreateGPUComputePipeline()`] for information on the expected layout.
170//!
171//! Another common issue is not setting the correct number of samplers,
172//! textures, and buffers in [`SDL_GPUShaderCreateInfo`]. If possible use shader
173//! reflection to extract the required information from the shader
174//! automatically instead of manually filling in the struct's values.
175//!
176//! **Question: My application isn't performing very well. Is this the GPU
177//! API's fault?**
178//!
179//! Answer: No. Long answer: The GPU API is a relatively thin layer over the
180//! underlying graphics API. While it's possible that we have done something
181//! inefficiently, it's very unlikely especially if you are relatively
182//! inexperienced with GPU rendering. Please see the performance tips above and
183//! make sure you are following them. Additionally, tools like
184//! [RenderDoc](https://renderdoc.org/)
185//! can be very helpful for diagnosing incorrect behavior and performance
186//! issues.
187//!
188//! ## System Requirements
189//!
190//! ### Vulkan
191//!
192//! SDL driver name: "vulkan" (for use in [`SDL_CreateGPUDevice()`] and
193//! [`SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING`])
194//!
195//! Supported on Windows, Linux, Nintendo Switch, and certain Android devices.
196//! Requires Vulkan 1.0 with the following extensions and device features:
197//!
198//! - `VK_KHR_swapchain`
199//! - `VK_KHR_maintenance1`
200//! - `independentBlend`
201//! - `imageCubeArray`
202//! - `depthClamp`
203//! - `shaderClipDistance`
204//! - `drawIndirectFirstInstance`
205//! - `sampleRateShading`
206//!
207//! You can remove some of these requirements to increase compatibility with
208//! Android devices by using these properties when creating the GPU device with
209//! [`SDL_CreateGPUDeviceWithProperties()`]\:
210//!
211//! - [`SDL_PROP_GPU_DEVICE_CREATE_FEATURE_CLIP_DISTANCE_BOOLEAN`]
212//! - [`SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN`]
213//! - [`SDL_PROP_GPU_DEVICE_CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN`]
214//! - [`SDL_PROP_GPU_DEVICE_CREATE_FEATURE_ANISOTROPY_BOOLEAN`]
215//!
216//! ### D3D12
217//!
218//! SDL driver name: "direct3d12"
219//!
220//! Supported on Windows 10 or newer, Xbox One (GDK), and Xbox Series X|S
221//! (GDK). Requires a GPU that supports DirectX 12 Feature Level 11_0 and
222//! Resource Binding Tier 2 or above.
223//!
224//! You can remove the Tier 2 resource binding requirement to support Intel
225//! Haswell and Broadwell GPUs by using this property when creating the GPU
226//! device with [`SDL_CreateGPUDeviceWithProperties()`]\:
227//!
228//! - [`SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN`]
229//!
230//! ### Metal
231//!
232//! SDL driver name: "metal"
233//!
234//! Supported on macOS 10.14+ and iOS/tvOS 13.0+. Hardware requirements vary by
235//! operating system:
236//!
237//! - macOS requires an Apple Silicon or
238//! [Intel Mac2 family](https://developer.apple.com/documentation/metal/mtlfeatureset/mtlfeatureset_macos_gpufamily2_v1?language=objc)
239//! GPU
240//! - iOS/tvOS requires an A9 GPU or newer
241//! - iOS Simulator and tvOS Simulator are unsupported
242//!
243//! ## Coordinate System
244//!
245//! The GPU API uses a left-handed coordinate system, following the convention
246//! of D3D12 and Metal. Specifically:
247//!
248//! - **Normalized Device Coordinates:** The lower-left corner has an x,y
249//! coordinate of `(-1.0, -1.0)`. The upper-right corner is `(1.0, 1.0)`. Z
250//! values range from `[0.0, 1.0]` where 0 is the near plane.
251//! - **Viewport Coordinates:** The top-left corner has an x,y coordinate of
252//! `(0, 0)` and extends to the bottom-right corner at `(viewportWidth,
253//! viewportHeight)`. +Y is down.
254//! - **Texture Coordinates:** The top-left corner has an x,y coordinate of
255//! `(0, 0)` and extends to the bottom-right corner at `(1.0, 1.0)`. +Y is
256//! down.
257//!
258//! If the backend driver differs from this convention (e.g. Vulkan, which has
259//! an NDC that assumes +Y is down), SDL will automatically convert the
260//! coordinate system behind the scenes, so you don't need to perform any
261//! coordinate flipping logic in your shaders.
262//!
263//! ## Uniform Data
264//!
265//! Uniforms are for passing data to shaders. The uniform data will be constant
266//! across all executions of the shader.
267//!
268//! There are 4 available uniform slots per shader stage (where the stages are
269//! vertex, fragment, and compute). Uniform data pushed to a slot on a stage
270//! keeps its value throughout the command buffer until you call the relevant
271//! Push function on that slot again.
272//!
273//! For example, you could write your vertex shaders to read a camera matrix
274//! from uniform binding slot 0, push the camera matrix at the start of the
275//! command buffer, and that data will be used for every subsequent draw call.
276//!
277//! It is valid to push uniform data during a render or compute pass.
278//!
279//! Uniforms are best for pushing small amounts of data. If you are pushing
280//! more than a matrix or two per call you should consider using a storage
281//! buffer instead.
282//!
283//! ## A Note On Cycling
284//!
285//! When using a command buffer, operations do not occur immediately - they
286//! occur some time after the command buffer is submitted.
287//!
288//! When a resource is used in a pending or active command buffer, it is
289//! considered to be "bound". When a resource is no longer used in any pending
290//! or active command buffers, it is considered to be "unbound".
291//!
292//! If data resources are bound, it is unspecified when that data will be
293//! unbound unless you acquire a fence when submitting the command buffer and
294//! wait on it. However, this doesn't mean you need to track resource usage
295//! manually.
296//!
297//! All of the functions and structs that involve writing to a resource have a
298//! "cycle" bool. [`SDL_GPUTransferBuffer`], [`SDL_GPUBuffer`], and [`SDL_GPUTexture`] all
299//! effectively function as ring buffers on internal resources. When cycle is
300//! true, if the resource is bound, the cycle rotates to the next unbound
301//! internal resource, or if none are available, a new one is created. This
302//! means you don't have to worry about complex state tracking and
303//! synchronization as long as cycling is correctly employed.
304//!
305//! For example: you can call [`SDL_MapGPUTransferBuffer()`], write texture data,
306//! [`SDL_UnmapGPUTransferBuffer()`], and then [`SDL_UploadToGPUTexture()`]. The next
307//! time you write texture data to the transfer buffer, if you set the cycle
308//! param to true, you don't have to worry about overwriting any data that is
309//! not yet uploaded.
310//!
311//! Another example: If you are using a texture in a render pass every frame,
312//! this can cause a data dependency between frames. If you set cycle to true
313//! in the [`SDL_GPUColorTargetInfo`] struct, you can prevent this data dependency.
314//!
315//! Cycling will never undefine already bound data. When cycling, all data in
316//! the resource is considered to be undefined for subsequent commands until
317//! that data is written again. You must take care not to read undefined data.
318//!
319//! Note that when cycling a texture, the entire texture will be cycled, even
320//! if only part of the texture is used in the call, so you must consider the
321//! entire texture to contain undefined data after cycling.
322//!
323//! You must also take care not to overwrite a section of data that has been
324//! referenced in a command without cycling first. It is OK to overwrite
325//! unreferenced data in a bound resource without cycling, but overwriting a
326//! section of data that has already been referenced will produce unexpected
327//! results.
328//!
329//! ## Debugging
330//!
331//! At some point of your GPU journey, you will probably encounter issues that
332//! are not traceable with regular debugger - for example, your code compiles
333//! but you get an empty screen, or your shader fails in runtime.
334//!
335//! For debugging such cases, there are tools that allow visually inspecting
336//! the whole GPU frame, every drawcall, every bound resource, memory buffers,
337//! etc. They are the following, per platform:
338//!
339//! * For Windows/Linux, use
340//! [RenderDoc](https://renderdoc.org/)
341//! * For MacOS (Metal), use Xcode built-in debugger (Open XCode, go to Debug >
342//! Debug Executable..., select your application, set "GPU Frame Capture" to
343//! "Metal" in scheme "Options" window, run your app, and click the small
344//! Metal icon on the bottom to capture a frame)
345//!
346//! Aside from that, you may want to enable additional debug layers to receive
347//! more detailed error messages, based on your GPU backend:
348//!
349//! * For D3D12, the debug layer is an optional feature that can be installed
350//! via "Windows Settings -> System -> Optional features" and adding the
351//! "Graphics Tools" optional feature.
352//! * For Vulkan, you will need to install Vulkan SDK on Windows, and on Linux,
353//! you usually have some sort of `vulkan-validation-layers` system package
354//! that should be installed.
355//! * For Metal, it should be enough just to run the application from XCode to
356//! receive detailed errors or warnings in the output.
357//!
358//! Don't hesitate to use tools as RenderDoc when encountering runtime issues
359//! or unexpected output on screen, quick GPU frame inspection can usually help
360//! you fix the majority of such problems.
361
362use super::stdinc::*;
363
364use super::pixels::*;
365
366use super::properties::*;
367
368use super::rect::*;
369
370use super::surface::*;
371
372use super::video::*;
373
374/// Specifies the primitive topology of a graphics pipeline.
375///
376/// If you are using POINTLIST you must include a point size output in the
377/// vertex shader.
378///
379/// - For HLSL compiling to SPIRV you must decorate a float output with
380/// \[\[vk::builtin("PointSize")\]\].
381/// - For GLSL you must set the gl_PointSize builtin.
382/// - For MSL you must include a float output with the \[\[point_size\]\]
383/// decorator.
384///
385/// Note that sized point topology is totally unsupported on D3D12. Any size
386/// other than 1 will be ignored. In general, you should avoid using point
387/// topology for both compatibility and performance reasons. You WILL regret
388/// using it.
389///
390/// ## Availability
391/// This enum is available since SDL 3.2.0.
392///
393/// ## See also
394/// - [`SDL_CreateGPUGraphicsPipeline`]
395///
396/// ## Known values (`sdl3-sys`)
397/// | Associated constant | Global constant | Description |
398/// | ------------------- | --------------- | ----------- |
399/// | [`TRIANGLELIST`](SDL_GPUPrimitiveType::TRIANGLELIST) | [`SDL_GPU_PRIMITIVETYPE_TRIANGLELIST`] | A series of separate triangles. |
400/// | [`TRIANGLESTRIP`](SDL_GPUPrimitiveType::TRIANGLESTRIP) | [`SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP`] | A series of connected triangles. |
401/// | [`LINELIST`](SDL_GPUPrimitiveType::LINELIST) | [`SDL_GPU_PRIMITIVETYPE_LINELIST`] | A series of separate lines. |
402/// | [`LINESTRIP`](SDL_GPUPrimitiveType::LINESTRIP) | [`SDL_GPU_PRIMITIVETYPE_LINESTRIP`] | A series of connected lines. |
403/// | [`POINTLIST`](SDL_GPUPrimitiveType::POINTLIST) | [`SDL_GPU_PRIMITIVETYPE_POINTLIST`] | A series of separate points. |
404#[repr(transparent)]
405#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
406pub struct SDL_GPUPrimitiveType(pub ::core::ffi::c_int);
407
408impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUPrimitiveType {
409 #[inline(always)]
410 fn eq(&self, other: &::core::ffi::c_int) -> bool {
411 &self.0 == other
412 }
413}
414
415impl ::core::cmp::PartialEq<SDL_GPUPrimitiveType> for ::core::ffi::c_int {
416 #[inline(always)]
417 fn eq(&self, other: &SDL_GPUPrimitiveType) -> bool {
418 self == &other.0
419 }
420}
421
422impl From<SDL_GPUPrimitiveType> for ::core::ffi::c_int {
423 #[inline(always)]
424 fn from(value: SDL_GPUPrimitiveType) -> Self {
425 value.0
426 }
427}
428
429#[cfg(feature = "debug-impls")]
430impl ::core::fmt::Debug for SDL_GPUPrimitiveType {
431 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
432 #[allow(unreachable_patterns)]
433 f.write_str(match *self {
434 Self::TRIANGLELIST => "SDL_GPU_PRIMITIVETYPE_TRIANGLELIST",
435 Self::TRIANGLESTRIP => "SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP",
436 Self::LINELIST => "SDL_GPU_PRIMITIVETYPE_LINELIST",
437 Self::LINESTRIP => "SDL_GPU_PRIMITIVETYPE_LINESTRIP",
438 Self::POINTLIST => "SDL_GPU_PRIMITIVETYPE_POINTLIST",
439
440 _ => return write!(f, "SDL_GPUPrimitiveType({})", self.0),
441 })
442 }
443}
444
445impl SDL_GPUPrimitiveType {
446 /// A series of separate triangles.
447 pub const TRIANGLELIST: Self = Self((0 as ::core::ffi::c_int));
448 /// A series of connected triangles.
449 pub const TRIANGLESTRIP: Self = Self((1 as ::core::ffi::c_int));
450 /// A series of separate lines.
451 pub const LINELIST: Self = Self((2 as ::core::ffi::c_int));
452 /// A series of connected lines.
453 pub const LINESTRIP: Self = Self((3 as ::core::ffi::c_int));
454 /// A series of separate points.
455 pub const POINTLIST: Self = Self((4 as ::core::ffi::c_int));
456}
457
458/// A series of separate triangles.
459pub const SDL_GPU_PRIMITIVETYPE_TRIANGLELIST: SDL_GPUPrimitiveType =
460 SDL_GPUPrimitiveType::TRIANGLELIST;
461/// A series of connected triangles.
462pub const SDL_GPU_PRIMITIVETYPE_TRIANGLESTRIP: SDL_GPUPrimitiveType =
463 SDL_GPUPrimitiveType::TRIANGLESTRIP;
464/// A series of separate lines.
465pub const SDL_GPU_PRIMITIVETYPE_LINELIST: SDL_GPUPrimitiveType = SDL_GPUPrimitiveType::LINELIST;
466/// A series of connected lines.
467pub const SDL_GPU_PRIMITIVETYPE_LINESTRIP: SDL_GPUPrimitiveType = SDL_GPUPrimitiveType::LINESTRIP;
468/// A series of separate points.
469pub const SDL_GPU_PRIMITIVETYPE_POINTLIST: SDL_GPUPrimitiveType = SDL_GPUPrimitiveType::POINTLIST;
470
471#[cfg(feature = "metadata")]
472impl sdl3_sys::metadata::GroupMetadata for SDL_GPUPrimitiveType {
473 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
474 &crate::metadata::gpu::METADATA_SDL_GPUPrimitiveType;
475}
476
477/// Specifies how the contents of a texture attached to a render pass are
478/// treated at the beginning of the render pass.
479///
480/// ## Availability
481/// This enum is available since SDL 3.2.0.
482///
483/// ## See also
484/// - [`SDL_BeginGPURenderPass`]
485///
486/// ## Known values (`sdl3-sys`)
487/// | Associated constant | Global constant | Description |
488/// | ------------------- | --------------- | ----------- |
489/// | [`LOAD`](SDL_GPULoadOp::LOAD) | [`SDL_GPU_LOADOP_LOAD`] | The previous contents of the texture will be preserved. |
490/// | [`CLEAR`](SDL_GPULoadOp::CLEAR) | [`SDL_GPU_LOADOP_CLEAR`] | The contents of the texture will be cleared to a color. |
491/// | [`DONT_CARE`](SDL_GPULoadOp::DONT_CARE) | [`SDL_GPU_LOADOP_DONT_CARE`] | The previous contents of the texture need not be preserved. The contents will be undefined. |
492#[repr(transparent)]
493#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
494pub struct SDL_GPULoadOp(pub ::core::ffi::c_int);
495
496impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPULoadOp {
497 #[inline(always)]
498 fn eq(&self, other: &::core::ffi::c_int) -> bool {
499 &self.0 == other
500 }
501}
502
503impl ::core::cmp::PartialEq<SDL_GPULoadOp> for ::core::ffi::c_int {
504 #[inline(always)]
505 fn eq(&self, other: &SDL_GPULoadOp) -> bool {
506 self == &other.0
507 }
508}
509
510impl From<SDL_GPULoadOp> for ::core::ffi::c_int {
511 #[inline(always)]
512 fn from(value: SDL_GPULoadOp) -> Self {
513 value.0
514 }
515}
516
517#[cfg(feature = "debug-impls")]
518impl ::core::fmt::Debug for SDL_GPULoadOp {
519 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
520 #[allow(unreachable_patterns)]
521 f.write_str(match *self {
522 Self::LOAD => "SDL_GPU_LOADOP_LOAD",
523 Self::CLEAR => "SDL_GPU_LOADOP_CLEAR",
524 Self::DONT_CARE => "SDL_GPU_LOADOP_DONT_CARE",
525
526 _ => return write!(f, "SDL_GPULoadOp({})", self.0),
527 })
528 }
529}
530
531impl SDL_GPULoadOp {
532 /// The previous contents of the texture will be preserved.
533 pub const LOAD: Self = Self((0 as ::core::ffi::c_int));
534 /// The contents of the texture will be cleared to a color.
535 pub const CLEAR: Self = Self((1 as ::core::ffi::c_int));
536 /// The previous contents of the texture need not be preserved. The contents will be undefined.
537 pub const DONT_CARE: Self = Self((2 as ::core::ffi::c_int));
538}
539
540/// The previous contents of the texture will be preserved.
541pub const SDL_GPU_LOADOP_LOAD: SDL_GPULoadOp = SDL_GPULoadOp::LOAD;
542/// The contents of the texture will be cleared to a color.
543pub const SDL_GPU_LOADOP_CLEAR: SDL_GPULoadOp = SDL_GPULoadOp::CLEAR;
544/// The previous contents of the texture need not be preserved. The contents will be undefined.
545pub const SDL_GPU_LOADOP_DONT_CARE: SDL_GPULoadOp = SDL_GPULoadOp::DONT_CARE;
546
547#[cfg(feature = "metadata")]
548impl sdl3_sys::metadata::GroupMetadata for SDL_GPULoadOp {
549 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
550 &crate::metadata::gpu::METADATA_SDL_GPULoadOp;
551}
552
553/// Specifies how the contents of a texture attached to a render pass are
554/// treated at the end of the render pass.
555///
556/// ## Availability
557/// This enum is available since SDL 3.2.0.
558///
559/// ## See also
560/// - [`SDL_BeginGPURenderPass`]
561///
562/// ## Known values (`sdl3-sys`)
563/// | Associated constant | Global constant | Description |
564/// | ------------------- | --------------- | ----------- |
565/// | [`STORE`](SDL_GPUStoreOp::STORE) | [`SDL_GPU_STOREOP_STORE`] | The contents generated during the render pass will be written to memory. |
566/// | [`DONT_CARE`](SDL_GPUStoreOp::DONT_CARE) | [`SDL_GPU_STOREOP_DONT_CARE`] | The contents generated during the render pass are not needed and may be discarded. The contents will be undefined. |
567/// | [`RESOLVE`](SDL_GPUStoreOp::RESOLVE) | [`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. |
568/// | [`RESOLVE_AND_STORE`](SDL_GPUStoreOp::RESOLVE_AND_STORE) | [`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. |
569#[repr(transparent)]
570#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
571pub struct SDL_GPUStoreOp(pub ::core::ffi::c_int);
572
573impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUStoreOp {
574 #[inline(always)]
575 fn eq(&self, other: &::core::ffi::c_int) -> bool {
576 &self.0 == other
577 }
578}
579
580impl ::core::cmp::PartialEq<SDL_GPUStoreOp> for ::core::ffi::c_int {
581 #[inline(always)]
582 fn eq(&self, other: &SDL_GPUStoreOp) -> bool {
583 self == &other.0
584 }
585}
586
587impl From<SDL_GPUStoreOp> for ::core::ffi::c_int {
588 #[inline(always)]
589 fn from(value: SDL_GPUStoreOp) -> Self {
590 value.0
591 }
592}
593
594#[cfg(feature = "debug-impls")]
595impl ::core::fmt::Debug for SDL_GPUStoreOp {
596 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
597 #[allow(unreachable_patterns)]
598 f.write_str(match *self {
599 Self::STORE => "SDL_GPU_STOREOP_STORE",
600 Self::DONT_CARE => "SDL_GPU_STOREOP_DONT_CARE",
601 Self::RESOLVE => "SDL_GPU_STOREOP_RESOLVE",
602 Self::RESOLVE_AND_STORE => "SDL_GPU_STOREOP_RESOLVE_AND_STORE",
603
604 _ => return write!(f, "SDL_GPUStoreOp({})", self.0),
605 })
606 }
607}
608
609impl SDL_GPUStoreOp {
610 /// The contents generated during the render pass will be written to memory.
611 pub const STORE: Self = Self((0 as ::core::ffi::c_int));
612 /// The contents generated during the render pass are not needed and may be discarded. The contents will be undefined.
613 pub const DONT_CARE: Self = Self((1 as ::core::ffi::c_int));
614 /// 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.
615 pub const RESOLVE: Self = Self((2 as ::core::ffi::c_int));
616 /// 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.
617 pub const RESOLVE_AND_STORE: Self = Self((3 as ::core::ffi::c_int));
618}
619
620/// The contents generated during the render pass will be written to memory.
621pub const SDL_GPU_STOREOP_STORE: SDL_GPUStoreOp = SDL_GPUStoreOp::STORE;
622/// The contents generated during the render pass are not needed and may be discarded. The contents will be undefined.
623pub const SDL_GPU_STOREOP_DONT_CARE: SDL_GPUStoreOp = SDL_GPUStoreOp::DONT_CARE;
624/// 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.
625pub const SDL_GPU_STOREOP_RESOLVE: SDL_GPUStoreOp = SDL_GPUStoreOp::RESOLVE;
626/// 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.
627pub const SDL_GPU_STOREOP_RESOLVE_AND_STORE: SDL_GPUStoreOp = SDL_GPUStoreOp::RESOLVE_AND_STORE;
628
629#[cfg(feature = "metadata")]
630impl sdl3_sys::metadata::GroupMetadata for SDL_GPUStoreOp {
631 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
632 &crate::metadata::gpu::METADATA_SDL_GPUStoreOp;
633}
634
635/// Specifies the size of elements in an index buffer.
636///
637/// ## Availability
638/// This enum is available since SDL 3.2.0.
639///
640/// ## See also
641/// - [`SDL_CreateGPUGraphicsPipeline`]
642///
643/// ## Known values (`sdl3-sys`)
644/// | Associated constant | Global constant | Description |
645/// | ------------------- | --------------- | ----------- |
646/// | [`_16BIT`](SDL_GPUIndexElementSize::_16BIT) | [`SDL_GPU_INDEXELEMENTSIZE_16BIT`] | The index elements are 16-bit. |
647/// | [`_32BIT`](SDL_GPUIndexElementSize::_32BIT) | [`SDL_GPU_INDEXELEMENTSIZE_32BIT`] | The index elements are 32-bit. |
648#[repr(transparent)]
649#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
650pub struct SDL_GPUIndexElementSize(pub ::core::ffi::c_int);
651
652impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUIndexElementSize {
653 #[inline(always)]
654 fn eq(&self, other: &::core::ffi::c_int) -> bool {
655 &self.0 == other
656 }
657}
658
659impl ::core::cmp::PartialEq<SDL_GPUIndexElementSize> for ::core::ffi::c_int {
660 #[inline(always)]
661 fn eq(&self, other: &SDL_GPUIndexElementSize) -> bool {
662 self == &other.0
663 }
664}
665
666impl From<SDL_GPUIndexElementSize> for ::core::ffi::c_int {
667 #[inline(always)]
668 fn from(value: SDL_GPUIndexElementSize) -> Self {
669 value.0
670 }
671}
672
673#[cfg(feature = "debug-impls")]
674impl ::core::fmt::Debug for SDL_GPUIndexElementSize {
675 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
676 #[allow(unreachable_patterns)]
677 f.write_str(match *self {
678 Self::_16BIT => "SDL_GPU_INDEXELEMENTSIZE_16BIT",
679 Self::_32BIT => "SDL_GPU_INDEXELEMENTSIZE_32BIT",
680
681 _ => return write!(f, "SDL_GPUIndexElementSize({})", self.0),
682 })
683 }
684}
685
686impl SDL_GPUIndexElementSize {
687 /// The index elements are 16-bit.
688 pub const _16BIT: Self = Self((0 as ::core::ffi::c_int));
689 /// The index elements are 32-bit.
690 pub const _32BIT: Self = Self((1 as ::core::ffi::c_int));
691}
692
693/// The index elements are 16-bit.
694pub const SDL_GPU_INDEXELEMENTSIZE_16BIT: SDL_GPUIndexElementSize = SDL_GPUIndexElementSize::_16BIT;
695/// The index elements are 32-bit.
696pub const SDL_GPU_INDEXELEMENTSIZE_32BIT: SDL_GPUIndexElementSize = SDL_GPUIndexElementSize::_32BIT;
697
698#[cfg(feature = "metadata")]
699impl sdl3_sys::metadata::GroupMetadata for SDL_GPUIndexElementSize {
700 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
701 &crate::metadata::gpu::METADATA_SDL_GPUIndexElementSize;
702}
703
704/// Specifies the pixel format of a texture.
705///
706/// Texture format support varies depending on driver, hardware, and usage
707/// flags. In general, you should use [`SDL_GPUTextureSupportsFormat`] to query if
708/// a format is supported before using it. However, there are a few guaranteed
709/// formats.
710///
711/// FIXME: Check universal support for 32-bit component formats FIXME: Check
712/// universal support for SIMULTANEOUS_READ_WRITE
713///
714/// For SAMPLER usage, the following formats are universally supported:
715///
716/// - R8G8B8A8_UNORM
717/// - B8G8R8A8_UNORM
718/// - R8_UNORM
719/// - R8_SNORM
720/// - R8G8_UNORM
721/// - R8G8_SNORM
722/// - R8G8B8A8_SNORM
723/// - R16_FLOAT
724/// - R16G16_FLOAT
725/// - R16G16B16A16_FLOAT
726/// - R32_FLOAT
727/// - R32G32_FLOAT
728/// - R32G32B32A32_FLOAT
729/// - R11G11B10_UFLOAT
730/// - R8G8B8A8_UNORM_SRGB
731/// - B8G8R8A8_UNORM_SRGB
732/// - D16_UNORM
733///
734/// For COLOR_TARGET usage, the following formats are universally supported:
735///
736/// - R8G8B8A8_UNORM
737/// - B8G8R8A8_UNORM
738/// - R8_UNORM
739/// - R16_FLOAT
740/// - R16G16_FLOAT
741/// - R16G16B16A16_FLOAT
742/// - R32_FLOAT
743/// - R32G32_FLOAT
744/// - R32G32B32A32_FLOAT
745/// - R8_UINT
746/// - R8G8_UINT
747/// - R8G8B8A8_UINT
748/// - R16_UINT
749/// - R16G16_UINT
750/// - R16G16B16A16_UINT
751/// - R8_INT
752/// - R8G8_INT
753/// - R8G8B8A8_INT
754/// - R16_INT
755/// - R16G16_INT
756/// - R16G16B16A16_INT
757/// - R8G8B8A8_UNORM_SRGB
758/// - B8G8R8A8_UNORM_SRGB
759///
760/// For STORAGE usages, the following formats are universally supported:
761///
762/// - R8G8B8A8_UNORM
763/// - R8G8B8A8_SNORM
764/// - R16G16B16A16_FLOAT
765/// - R32_FLOAT
766/// - R32G32_FLOAT
767/// - R32G32B32A32_FLOAT
768/// - R8G8B8A8_UINT
769/// - R16G16B16A16_UINT
770/// - R8G8B8A8_INT
771/// - R16G16B16A16_INT
772///
773/// For DEPTH_STENCIL_TARGET usage, the following formats are universally
774/// supported:
775///
776/// - D16_UNORM
777/// - Either (but not necessarily both!) D24_UNORM or D32_FLOAT
778/// - Either (but not necessarily both!) D24_UNORM_S8_UINT or D32_FLOAT_S8_UINT
779///
780/// Unless D16_UNORM is sufficient for your purposes, always check which of
781/// D24/D32 is supported before creating a depth-stencil texture!
782///
783/// ## Availability
784/// This enum is available since SDL 3.2.0.
785///
786/// ## See also
787/// - [`SDL_CreateGPUTexture`]
788/// - [`SDL_GPUTextureSupportsFormat`]
789///
790/// ## Known values (`sdl3-sys`)
791/// | Associated constant | Global constant | Description |
792/// | ------------------- | --------------- | ----------- |
793/// | [`INVALID`](SDL_GPUTextureFormat::INVALID) | [`SDL_GPU_TEXTUREFORMAT_INVALID`] | |
794/// | [`A8_UNORM`](SDL_GPUTextureFormat::A8_UNORM) | [`SDL_GPU_TEXTUREFORMAT_A8_UNORM`] | |
795/// | [`R8_UNORM`](SDL_GPUTextureFormat::R8_UNORM) | [`SDL_GPU_TEXTUREFORMAT_R8_UNORM`] | |
796/// | [`R8G8_UNORM`](SDL_GPUTextureFormat::R8G8_UNORM) | [`SDL_GPU_TEXTUREFORMAT_R8G8_UNORM`] | |
797/// | [`R8G8B8A8_UNORM`](SDL_GPUTextureFormat::R8G8B8A8_UNORM) | [`SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM`] | |
798/// | [`R16_UNORM`](SDL_GPUTextureFormat::R16_UNORM) | [`SDL_GPU_TEXTUREFORMAT_R16_UNORM`] | |
799/// | [`R16G16_UNORM`](SDL_GPUTextureFormat::R16G16_UNORM) | [`SDL_GPU_TEXTUREFORMAT_R16G16_UNORM`] | |
800/// | [`R16G16B16A16_UNORM`](SDL_GPUTextureFormat::R16G16B16A16_UNORM) | [`SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UNORM`] | |
801/// | [`R10G10B10A2_UNORM`](SDL_GPUTextureFormat::R10G10B10A2_UNORM) | [`SDL_GPU_TEXTUREFORMAT_R10G10B10A2_UNORM`] | |
802/// | [`B5G6R5_UNORM`](SDL_GPUTextureFormat::B5G6R5_UNORM) | [`SDL_GPU_TEXTUREFORMAT_B5G6R5_UNORM`] | |
803/// | [`B5G5R5A1_UNORM`](SDL_GPUTextureFormat::B5G5R5A1_UNORM) | [`SDL_GPU_TEXTUREFORMAT_B5G5R5A1_UNORM`] | |
804/// | [`B4G4R4A4_UNORM`](SDL_GPUTextureFormat::B4G4R4A4_UNORM) | [`SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM`] | |
805/// | [`B8G8R8A8_UNORM`](SDL_GPUTextureFormat::B8G8R8A8_UNORM) | [`SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM`] | |
806/// | [`BC1_RGBA_UNORM`](SDL_GPUTextureFormat::BC1_RGBA_UNORM) | [`SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM`] | |
807/// | [`BC2_RGBA_UNORM`](SDL_GPUTextureFormat::BC2_RGBA_UNORM) | [`SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM`] | |
808/// | [`BC3_RGBA_UNORM`](SDL_GPUTextureFormat::BC3_RGBA_UNORM) | [`SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM`] | |
809/// | [`BC4_R_UNORM`](SDL_GPUTextureFormat::BC4_R_UNORM) | [`SDL_GPU_TEXTUREFORMAT_BC4_R_UNORM`] | |
810/// | [`BC5_RG_UNORM`](SDL_GPUTextureFormat::BC5_RG_UNORM) | [`SDL_GPU_TEXTUREFORMAT_BC5_RG_UNORM`] | |
811/// | [`BC7_RGBA_UNORM`](SDL_GPUTextureFormat::BC7_RGBA_UNORM) | [`SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM`] | |
812/// | [`BC6H_RGB_FLOAT`](SDL_GPUTextureFormat::BC6H_RGB_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT`] | |
813/// | [`BC6H_RGB_UFLOAT`](SDL_GPUTextureFormat::BC6H_RGB_UFLOAT) | [`SDL_GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT`] | |
814/// | [`R8_SNORM`](SDL_GPUTextureFormat::R8_SNORM) | [`SDL_GPU_TEXTUREFORMAT_R8_SNORM`] | |
815/// | [`R8G8_SNORM`](SDL_GPUTextureFormat::R8G8_SNORM) | [`SDL_GPU_TEXTUREFORMAT_R8G8_SNORM`] | |
816/// | [`R8G8B8A8_SNORM`](SDL_GPUTextureFormat::R8G8B8A8_SNORM) | [`SDL_GPU_TEXTUREFORMAT_R8G8B8A8_SNORM`] | |
817/// | [`R16_SNORM`](SDL_GPUTextureFormat::R16_SNORM) | [`SDL_GPU_TEXTUREFORMAT_R16_SNORM`] | |
818/// | [`R16G16_SNORM`](SDL_GPUTextureFormat::R16G16_SNORM) | [`SDL_GPU_TEXTUREFORMAT_R16G16_SNORM`] | |
819/// | [`R16G16B16A16_SNORM`](SDL_GPUTextureFormat::R16G16B16A16_SNORM) | [`SDL_GPU_TEXTUREFORMAT_R16G16B16A16_SNORM`] | |
820/// | [`R16_FLOAT`](SDL_GPUTextureFormat::R16_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_R16_FLOAT`] | |
821/// | [`R16G16_FLOAT`](SDL_GPUTextureFormat::R16G16_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_R16G16_FLOAT`] | |
822/// | [`R16G16B16A16_FLOAT`](SDL_GPUTextureFormat::R16G16B16A16_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT`] | |
823/// | [`R32_FLOAT`](SDL_GPUTextureFormat::R32_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_R32_FLOAT`] | |
824/// | [`R32G32_FLOAT`](SDL_GPUTextureFormat::R32G32_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_R32G32_FLOAT`] | |
825/// | [`R32G32B32A32_FLOAT`](SDL_GPUTextureFormat::R32G32B32A32_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT`] | |
826/// | [`R11G11B10_UFLOAT`](SDL_GPUTextureFormat::R11G11B10_UFLOAT) | [`SDL_GPU_TEXTUREFORMAT_R11G11B10_UFLOAT`] | |
827/// | [`R8_UINT`](SDL_GPUTextureFormat::R8_UINT) | [`SDL_GPU_TEXTUREFORMAT_R8_UINT`] | |
828/// | [`R8G8_UINT`](SDL_GPUTextureFormat::R8G8_UINT) | [`SDL_GPU_TEXTUREFORMAT_R8G8_UINT`] | |
829/// | [`R8G8B8A8_UINT`](SDL_GPUTextureFormat::R8G8B8A8_UINT) | [`SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UINT`] | |
830/// | [`R16_UINT`](SDL_GPUTextureFormat::R16_UINT) | [`SDL_GPU_TEXTUREFORMAT_R16_UINT`] | |
831/// | [`R16G16_UINT`](SDL_GPUTextureFormat::R16G16_UINT) | [`SDL_GPU_TEXTUREFORMAT_R16G16_UINT`] | |
832/// | [`R16G16B16A16_UINT`](SDL_GPUTextureFormat::R16G16B16A16_UINT) | [`SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UINT`] | |
833/// | [`R32_UINT`](SDL_GPUTextureFormat::R32_UINT) | [`SDL_GPU_TEXTUREFORMAT_R32_UINT`] | |
834/// | [`R32G32_UINT`](SDL_GPUTextureFormat::R32G32_UINT) | [`SDL_GPU_TEXTUREFORMAT_R32G32_UINT`] | |
835/// | [`R32G32B32A32_UINT`](SDL_GPUTextureFormat::R32G32B32A32_UINT) | [`SDL_GPU_TEXTUREFORMAT_R32G32B32A32_UINT`] | |
836/// | [`R8_INT`](SDL_GPUTextureFormat::R8_INT) | [`SDL_GPU_TEXTUREFORMAT_R8_INT`] | |
837/// | [`R8G8_INT`](SDL_GPUTextureFormat::R8G8_INT) | [`SDL_GPU_TEXTUREFORMAT_R8G8_INT`] | |
838/// | [`R8G8B8A8_INT`](SDL_GPUTextureFormat::R8G8B8A8_INT) | [`SDL_GPU_TEXTUREFORMAT_R8G8B8A8_INT`] | |
839/// | [`R16_INT`](SDL_GPUTextureFormat::R16_INT) | [`SDL_GPU_TEXTUREFORMAT_R16_INT`] | |
840/// | [`R16G16_INT`](SDL_GPUTextureFormat::R16G16_INT) | [`SDL_GPU_TEXTUREFORMAT_R16G16_INT`] | |
841/// | [`R16G16B16A16_INT`](SDL_GPUTextureFormat::R16G16B16A16_INT) | [`SDL_GPU_TEXTUREFORMAT_R16G16B16A16_INT`] | |
842/// | [`R32_INT`](SDL_GPUTextureFormat::R32_INT) | [`SDL_GPU_TEXTUREFORMAT_R32_INT`] | |
843/// | [`R32G32_INT`](SDL_GPUTextureFormat::R32G32_INT) | [`SDL_GPU_TEXTUREFORMAT_R32G32_INT`] | |
844/// | [`R32G32B32A32_INT`](SDL_GPUTextureFormat::R32G32B32A32_INT) | [`SDL_GPU_TEXTUREFORMAT_R32G32B32A32_INT`] | |
845/// | [`R8G8B8A8_UNORM_SRGB`](SDL_GPUTextureFormat::R8G8B8A8_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB`] | |
846/// | [`B8G8R8A8_UNORM_SRGB`](SDL_GPUTextureFormat::B8G8R8A8_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB`] | |
847/// | [`BC1_RGBA_UNORM_SRGB`](SDL_GPUTextureFormat::BC1_RGBA_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB`] | |
848/// | [`BC2_RGBA_UNORM_SRGB`](SDL_GPUTextureFormat::BC2_RGBA_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB`] | |
849/// | [`BC3_RGBA_UNORM_SRGB`](SDL_GPUTextureFormat::BC3_RGBA_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB`] | |
850/// | [`BC7_RGBA_UNORM_SRGB`](SDL_GPUTextureFormat::BC7_RGBA_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB`] | |
851/// | [`D16_UNORM`](SDL_GPUTextureFormat::D16_UNORM) | [`SDL_GPU_TEXTUREFORMAT_D16_UNORM`] | |
852/// | [`D24_UNORM`](SDL_GPUTextureFormat::D24_UNORM) | [`SDL_GPU_TEXTUREFORMAT_D24_UNORM`] | |
853/// | [`D32_FLOAT`](SDL_GPUTextureFormat::D32_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_D32_FLOAT`] | |
854/// | [`D24_UNORM_S8_UINT`](SDL_GPUTextureFormat::D24_UNORM_S8_UINT) | [`SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT`] | |
855/// | [`D32_FLOAT_S8_UINT`](SDL_GPUTextureFormat::D32_FLOAT_S8_UINT) | [`SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT`] | |
856/// | [`ASTC_4x4_UNORM`](SDL_GPUTextureFormat::ASTC_4x4_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM`] | |
857/// | [`ASTC_5x4_UNORM`](SDL_GPUTextureFormat::ASTC_5x4_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM`] | |
858/// | [`ASTC_5x5_UNORM`](SDL_GPUTextureFormat::ASTC_5x5_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM`] | |
859/// | [`ASTC_6x5_UNORM`](SDL_GPUTextureFormat::ASTC_6x5_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM`] | |
860/// | [`ASTC_6x6_UNORM`](SDL_GPUTextureFormat::ASTC_6x6_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM`] | |
861/// | [`ASTC_8x5_UNORM`](SDL_GPUTextureFormat::ASTC_8x5_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM`] | |
862/// | [`ASTC_8x6_UNORM`](SDL_GPUTextureFormat::ASTC_8x6_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM`] | |
863/// | [`ASTC_8x8_UNORM`](SDL_GPUTextureFormat::ASTC_8x8_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM`] | |
864/// | [`ASTC_10x5_UNORM`](SDL_GPUTextureFormat::ASTC_10x5_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM`] | |
865/// | [`ASTC_10x6_UNORM`](SDL_GPUTextureFormat::ASTC_10x6_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM`] | |
866/// | [`ASTC_10x8_UNORM`](SDL_GPUTextureFormat::ASTC_10x8_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM`] | |
867/// | [`ASTC_10x10_UNORM`](SDL_GPUTextureFormat::ASTC_10x10_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM`] | |
868/// | [`ASTC_12x10_UNORM`](SDL_GPUTextureFormat::ASTC_12x10_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM`] | |
869/// | [`ASTC_12x12_UNORM`](SDL_GPUTextureFormat::ASTC_12x12_UNORM) | [`SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM`] | |
870/// | [`ASTC_4x4_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_4x4_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM_SRGB`] | |
871/// | [`ASTC_5x4_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_5x4_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM_SRGB`] | |
872/// | [`ASTC_5x5_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_5x5_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM_SRGB`] | |
873/// | [`ASTC_6x5_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_6x5_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM_SRGB`] | |
874/// | [`ASTC_6x6_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_6x6_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM_SRGB`] | |
875/// | [`ASTC_8x5_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_8x5_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM_SRGB`] | |
876/// | [`ASTC_8x6_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_8x6_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM_SRGB`] | |
877/// | [`ASTC_8x8_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_8x8_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM_SRGB`] | |
878/// | [`ASTC_10x5_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_10x5_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM_SRGB`] | |
879/// | [`ASTC_10x6_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_10x6_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM_SRGB`] | |
880/// | [`ASTC_10x8_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_10x8_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM_SRGB`] | |
881/// | [`ASTC_10x10_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_10x10_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM_SRGB`] | |
882/// | [`ASTC_12x10_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_12x10_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM_SRGB`] | |
883/// | [`ASTC_12x12_UNORM_SRGB`](SDL_GPUTextureFormat::ASTC_12x12_UNORM_SRGB) | [`SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM_SRGB`] | |
884/// | [`ASTC_4x4_FLOAT`](SDL_GPUTextureFormat::ASTC_4x4_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_4x4_FLOAT`] | |
885/// | [`ASTC_5x4_FLOAT`](SDL_GPUTextureFormat::ASTC_5x4_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_5x4_FLOAT`] | |
886/// | [`ASTC_5x5_FLOAT`](SDL_GPUTextureFormat::ASTC_5x5_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_5x5_FLOAT`] | |
887/// | [`ASTC_6x5_FLOAT`](SDL_GPUTextureFormat::ASTC_6x5_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_6x5_FLOAT`] | |
888/// | [`ASTC_6x6_FLOAT`](SDL_GPUTextureFormat::ASTC_6x6_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_6x6_FLOAT`] | |
889/// | [`ASTC_8x5_FLOAT`](SDL_GPUTextureFormat::ASTC_8x5_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_8x5_FLOAT`] | |
890/// | [`ASTC_8x6_FLOAT`](SDL_GPUTextureFormat::ASTC_8x6_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_8x6_FLOAT`] | |
891/// | [`ASTC_8x8_FLOAT`](SDL_GPUTextureFormat::ASTC_8x8_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_8x8_FLOAT`] | |
892/// | [`ASTC_10x5_FLOAT`](SDL_GPUTextureFormat::ASTC_10x5_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_10x5_FLOAT`] | |
893/// | [`ASTC_10x6_FLOAT`](SDL_GPUTextureFormat::ASTC_10x6_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_10x6_FLOAT`] | |
894/// | [`ASTC_10x8_FLOAT`](SDL_GPUTextureFormat::ASTC_10x8_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_10x8_FLOAT`] | |
895/// | [`ASTC_10x10_FLOAT`](SDL_GPUTextureFormat::ASTC_10x10_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_10x10_FLOAT`] | |
896/// | [`ASTC_12x10_FLOAT`](SDL_GPUTextureFormat::ASTC_12x10_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_12x10_FLOAT`] | |
897/// | [`ASTC_12x12_FLOAT`](SDL_GPUTextureFormat::ASTC_12x12_FLOAT) | [`SDL_GPU_TEXTUREFORMAT_ASTC_12x12_FLOAT`] | |
898#[repr(transparent)]
899#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
900pub struct SDL_GPUTextureFormat(pub ::core::ffi::c_int);
901
902impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUTextureFormat {
903 #[inline(always)]
904 fn eq(&self, other: &::core::ffi::c_int) -> bool {
905 &self.0 == other
906 }
907}
908
909impl ::core::cmp::PartialEq<SDL_GPUTextureFormat> for ::core::ffi::c_int {
910 #[inline(always)]
911 fn eq(&self, other: &SDL_GPUTextureFormat) -> bool {
912 self == &other.0
913 }
914}
915
916impl From<SDL_GPUTextureFormat> for ::core::ffi::c_int {
917 #[inline(always)]
918 fn from(value: SDL_GPUTextureFormat) -> Self {
919 value.0
920 }
921}
922
923#[cfg(feature = "debug-impls")]
924impl ::core::fmt::Debug for SDL_GPUTextureFormat {
925 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
926 #[allow(unreachable_patterns)]
927 f.write_str(match *self {
928 Self::INVALID => "SDL_GPU_TEXTUREFORMAT_INVALID",
929 Self::A8_UNORM => "SDL_GPU_TEXTUREFORMAT_A8_UNORM",
930 Self::R8_UNORM => "SDL_GPU_TEXTUREFORMAT_R8_UNORM",
931 Self::R8G8_UNORM => "SDL_GPU_TEXTUREFORMAT_R8G8_UNORM",
932 Self::R8G8B8A8_UNORM => "SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM",
933 Self::R16_UNORM => "SDL_GPU_TEXTUREFORMAT_R16_UNORM",
934 Self::R16G16_UNORM => "SDL_GPU_TEXTUREFORMAT_R16G16_UNORM",
935 Self::R16G16B16A16_UNORM => "SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UNORM",
936 Self::R10G10B10A2_UNORM => "SDL_GPU_TEXTUREFORMAT_R10G10B10A2_UNORM",
937 Self::B5G6R5_UNORM => "SDL_GPU_TEXTUREFORMAT_B5G6R5_UNORM",
938 Self::B5G5R5A1_UNORM => "SDL_GPU_TEXTUREFORMAT_B5G5R5A1_UNORM",
939 Self::B4G4R4A4_UNORM => "SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM",
940 Self::B8G8R8A8_UNORM => "SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM",
941 Self::BC1_RGBA_UNORM => "SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM",
942 Self::BC2_RGBA_UNORM => "SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM",
943 Self::BC3_RGBA_UNORM => "SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM",
944 Self::BC4_R_UNORM => "SDL_GPU_TEXTUREFORMAT_BC4_R_UNORM",
945 Self::BC5_RG_UNORM => "SDL_GPU_TEXTUREFORMAT_BC5_RG_UNORM",
946 Self::BC7_RGBA_UNORM => "SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM",
947 Self::BC6H_RGB_FLOAT => "SDL_GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT",
948 Self::BC6H_RGB_UFLOAT => "SDL_GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT",
949 Self::R8_SNORM => "SDL_GPU_TEXTUREFORMAT_R8_SNORM",
950 Self::R8G8_SNORM => "SDL_GPU_TEXTUREFORMAT_R8G8_SNORM",
951 Self::R8G8B8A8_SNORM => "SDL_GPU_TEXTUREFORMAT_R8G8B8A8_SNORM",
952 Self::R16_SNORM => "SDL_GPU_TEXTUREFORMAT_R16_SNORM",
953 Self::R16G16_SNORM => "SDL_GPU_TEXTUREFORMAT_R16G16_SNORM",
954 Self::R16G16B16A16_SNORM => "SDL_GPU_TEXTUREFORMAT_R16G16B16A16_SNORM",
955 Self::R16_FLOAT => "SDL_GPU_TEXTUREFORMAT_R16_FLOAT",
956 Self::R16G16_FLOAT => "SDL_GPU_TEXTUREFORMAT_R16G16_FLOAT",
957 Self::R16G16B16A16_FLOAT => "SDL_GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT",
958 Self::R32_FLOAT => "SDL_GPU_TEXTUREFORMAT_R32_FLOAT",
959 Self::R32G32_FLOAT => "SDL_GPU_TEXTUREFORMAT_R32G32_FLOAT",
960 Self::R32G32B32A32_FLOAT => "SDL_GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT",
961 Self::R11G11B10_UFLOAT => "SDL_GPU_TEXTUREFORMAT_R11G11B10_UFLOAT",
962 Self::R8_UINT => "SDL_GPU_TEXTUREFORMAT_R8_UINT",
963 Self::R8G8_UINT => "SDL_GPU_TEXTUREFORMAT_R8G8_UINT",
964 Self::R8G8B8A8_UINT => "SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UINT",
965 Self::R16_UINT => "SDL_GPU_TEXTUREFORMAT_R16_UINT",
966 Self::R16G16_UINT => "SDL_GPU_TEXTUREFORMAT_R16G16_UINT",
967 Self::R16G16B16A16_UINT => "SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UINT",
968 Self::R32_UINT => "SDL_GPU_TEXTUREFORMAT_R32_UINT",
969 Self::R32G32_UINT => "SDL_GPU_TEXTUREFORMAT_R32G32_UINT",
970 Self::R32G32B32A32_UINT => "SDL_GPU_TEXTUREFORMAT_R32G32B32A32_UINT",
971 Self::R8_INT => "SDL_GPU_TEXTUREFORMAT_R8_INT",
972 Self::R8G8_INT => "SDL_GPU_TEXTUREFORMAT_R8G8_INT",
973 Self::R8G8B8A8_INT => "SDL_GPU_TEXTUREFORMAT_R8G8B8A8_INT",
974 Self::R16_INT => "SDL_GPU_TEXTUREFORMAT_R16_INT",
975 Self::R16G16_INT => "SDL_GPU_TEXTUREFORMAT_R16G16_INT",
976 Self::R16G16B16A16_INT => "SDL_GPU_TEXTUREFORMAT_R16G16B16A16_INT",
977 Self::R32_INT => "SDL_GPU_TEXTUREFORMAT_R32_INT",
978 Self::R32G32_INT => "SDL_GPU_TEXTUREFORMAT_R32G32_INT",
979 Self::R32G32B32A32_INT => "SDL_GPU_TEXTUREFORMAT_R32G32B32A32_INT",
980 Self::R8G8B8A8_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB",
981 Self::B8G8R8A8_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB",
982 Self::BC1_RGBA_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB",
983 Self::BC2_RGBA_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB",
984 Self::BC3_RGBA_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB",
985 Self::BC7_RGBA_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB",
986 Self::D16_UNORM => "SDL_GPU_TEXTUREFORMAT_D16_UNORM",
987 Self::D24_UNORM => "SDL_GPU_TEXTUREFORMAT_D24_UNORM",
988 Self::D32_FLOAT => "SDL_GPU_TEXTUREFORMAT_D32_FLOAT",
989 Self::D24_UNORM_S8_UINT => "SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT",
990 Self::D32_FLOAT_S8_UINT => "SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT",
991 Self::ASTC_4x4_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM",
992 Self::ASTC_5x4_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM",
993 Self::ASTC_5x5_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM",
994 Self::ASTC_6x5_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM",
995 Self::ASTC_6x6_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM",
996 Self::ASTC_8x5_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM",
997 Self::ASTC_8x6_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM",
998 Self::ASTC_8x8_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM",
999 Self::ASTC_10x5_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM",
1000 Self::ASTC_10x6_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM",
1001 Self::ASTC_10x8_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM",
1002 Self::ASTC_10x10_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM",
1003 Self::ASTC_12x10_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM",
1004 Self::ASTC_12x12_UNORM => "SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM",
1005 Self::ASTC_4x4_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM_SRGB",
1006 Self::ASTC_5x4_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM_SRGB",
1007 Self::ASTC_5x5_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM_SRGB",
1008 Self::ASTC_6x5_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM_SRGB",
1009 Self::ASTC_6x6_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM_SRGB",
1010 Self::ASTC_8x5_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM_SRGB",
1011 Self::ASTC_8x6_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM_SRGB",
1012 Self::ASTC_8x8_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM_SRGB",
1013 Self::ASTC_10x5_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM_SRGB",
1014 Self::ASTC_10x6_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM_SRGB",
1015 Self::ASTC_10x8_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM_SRGB",
1016 Self::ASTC_10x10_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM_SRGB",
1017 Self::ASTC_12x10_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM_SRGB",
1018 Self::ASTC_12x12_UNORM_SRGB => "SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM_SRGB",
1019 Self::ASTC_4x4_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_4x4_FLOAT",
1020 Self::ASTC_5x4_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_5x4_FLOAT",
1021 Self::ASTC_5x5_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_5x5_FLOAT",
1022 Self::ASTC_6x5_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_6x5_FLOAT",
1023 Self::ASTC_6x6_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_6x6_FLOAT",
1024 Self::ASTC_8x5_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_8x5_FLOAT",
1025 Self::ASTC_8x6_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_8x6_FLOAT",
1026 Self::ASTC_8x8_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_8x8_FLOAT",
1027 Self::ASTC_10x5_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_10x5_FLOAT",
1028 Self::ASTC_10x6_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_10x6_FLOAT",
1029 Self::ASTC_10x8_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_10x8_FLOAT",
1030 Self::ASTC_10x10_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_10x10_FLOAT",
1031 Self::ASTC_12x10_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_12x10_FLOAT",
1032 Self::ASTC_12x12_FLOAT => "SDL_GPU_TEXTUREFORMAT_ASTC_12x12_FLOAT",
1033
1034 _ => return write!(f, "SDL_GPUTextureFormat({})", self.0),
1035 })
1036 }
1037}
1038
1039impl SDL_GPUTextureFormat {
1040 pub const INVALID: Self = Self((0 as ::core::ffi::c_int));
1041 pub const A8_UNORM: Self = Self((1 as ::core::ffi::c_int));
1042 pub const R8_UNORM: Self = Self((2 as ::core::ffi::c_int));
1043 pub const R8G8_UNORM: Self = Self((3 as ::core::ffi::c_int));
1044 pub const R8G8B8A8_UNORM: Self = Self((4 as ::core::ffi::c_int));
1045 pub const R16_UNORM: Self = Self((5 as ::core::ffi::c_int));
1046 pub const R16G16_UNORM: Self = Self((6 as ::core::ffi::c_int));
1047 pub const R16G16B16A16_UNORM: Self = Self((7 as ::core::ffi::c_int));
1048 pub const R10G10B10A2_UNORM: Self = Self((8 as ::core::ffi::c_int));
1049 pub const B5G6R5_UNORM: Self = Self((9 as ::core::ffi::c_int));
1050 pub const B5G5R5A1_UNORM: Self = Self((10 as ::core::ffi::c_int));
1051 pub const B4G4R4A4_UNORM: Self = Self((11 as ::core::ffi::c_int));
1052 pub const B8G8R8A8_UNORM: Self = Self((12 as ::core::ffi::c_int));
1053 pub const BC1_RGBA_UNORM: Self = Self((13 as ::core::ffi::c_int));
1054 pub const BC2_RGBA_UNORM: Self = Self((14 as ::core::ffi::c_int));
1055 pub const BC3_RGBA_UNORM: Self = Self((15 as ::core::ffi::c_int));
1056 pub const BC4_R_UNORM: Self = Self((16 as ::core::ffi::c_int));
1057 pub const BC5_RG_UNORM: Self = Self((17 as ::core::ffi::c_int));
1058 pub const BC7_RGBA_UNORM: Self = Self((18 as ::core::ffi::c_int));
1059 pub const BC6H_RGB_FLOAT: Self = Self((19 as ::core::ffi::c_int));
1060 pub const BC6H_RGB_UFLOAT: Self = Self((20 as ::core::ffi::c_int));
1061 pub const R8_SNORM: Self = Self((21 as ::core::ffi::c_int));
1062 pub const R8G8_SNORM: Self = Self((22 as ::core::ffi::c_int));
1063 pub const R8G8B8A8_SNORM: Self = Self((23 as ::core::ffi::c_int));
1064 pub const R16_SNORM: Self = Self((24 as ::core::ffi::c_int));
1065 pub const R16G16_SNORM: Self = Self((25 as ::core::ffi::c_int));
1066 pub const R16G16B16A16_SNORM: Self = Self((26 as ::core::ffi::c_int));
1067 pub const R16_FLOAT: Self = Self((27 as ::core::ffi::c_int));
1068 pub const R16G16_FLOAT: Self = Self((28 as ::core::ffi::c_int));
1069 pub const R16G16B16A16_FLOAT: Self = Self((29 as ::core::ffi::c_int));
1070 pub const R32_FLOAT: Self = Self((30 as ::core::ffi::c_int));
1071 pub const R32G32_FLOAT: Self = Self((31 as ::core::ffi::c_int));
1072 pub const R32G32B32A32_FLOAT: Self = Self((32 as ::core::ffi::c_int));
1073 pub const R11G11B10_UFLOAT: Self = Self((33 as ::core::ffi::c_int));
1074 pub const R8_UINT: Self = Self((34 as ::core::ffi::c_int));
1075 pub const R8G8_UINT: Self = Self((35 as ::core::ffi::c_int));
1076 pub const R8G8B8A8_UINT: Self = Self((36 as ::core::ffi::c_int));
1077 pub const R16_UINT: Self = Self((37 as ::core::ffi::c_int));
1078 pub const R16G16_UINT: Self = Self((38 as ::core::ffi::c_int));
1079 pub const R16G16B16A16_UINT: Self = Self((39 as ::core::ffi::c_int));
1080 pub const R32_UINT: Self = Self((40 as ::core::ffi::c_int));
1081 pub const R32G32_UINT: Self = Self((41 as ::core::ffi::c_int));
1082 pub const R32G32B32A32_UINT: Self = Self((42 as ::core::ffi::c_int));
1083 pub const R8_INT: Self = Self((43 as ::core::ffi::c_int));
1084 pub const R8G8_INT: Self = Self((44 as ::core::ffi::c_int));
1085 pub const R8G8B8A8_INT: Self = Self((45 as ::core::ffi::c_int));
1086 pub const R16_INT: Self = Self((46 as ::core::ffi::c_int));
1087 pub const R16G16_INT: Self = Self((47 as ::core::ffi::c_int));
1088 pub const R16G16B16A16_INT: Self = Self((48 as ::core::ffi::c_int));
1089 pub const R32_INT: Self = Self((49 as ::core::ffi::c_int));
1090 pub const R32G32_INT: Self = Self((50 as ::core::ffi::c_int));
1091 pub const R32G32B32A32_INT: Self = Self((51 as ::core::ffi::c_int));
1092 pub const R8G8B8A8_UNORM_SRGB: Self = Self((52 as ::core::ffi::c_int));
1093 pub const B8G8R8A8_UNORM_SRGB: Self = Self((53 as ::core::ffi::c_int));
1094 pub const BC1_RGBA_UNORM_SRGB: Self = Self((54 as ::core::ffi::c_int));
1095 pub const BC2_RGBA_UNORM_SRGB: Self = Self((55 as ::core::ffi::c_int));
1096 pub const BC3_RGBA_UNORM_SRGB: Self = Self((56 as ::core::ffi::c_int));
1097 pub const BC7_RGBA_UNORM_SRGB: Self = Self((57 as ::core::ffi::c_int));
1098 pub const D16_UNORM: Self = Self((58 as ::core::ffi::c_int));
1099 pub const D24_UNORM: Self = Self((59 as ::core::ffi::c_int));
1100 pub const D32_FLOAT: Self = Self((60 as ::core::ffi::c_int));
1101 pub const D24_UNORM_S8_UINT: Self = Self((61 as ::core::ffi::c_int));
1102 pub const D32_FLOAT_S8_UINT: Self = Self((62 as ::core::ffi::c_int));
1103 pub const ASTC_4x4_UNORM: Self = Self((63 as ::core::ffi::c_int));
1104 pub const ASTC_5x4_UNORM: Self = Self((64 as ::core::ffi::c_int));
1105 pub const ASTC_5x5_UNORM: Self = Self((65 as ::core::ffi::c_int));
1106 pub const ASTC_6x5_UNORM: Self = Self((66 as ::core::ffi::c_int));
1107 pub const ASTC_6x6_UNORM: Self = Self((67 as ::core::ffi::c_int));
1108 pub const ASTC_8x5_UNORM: Self = Self((68 as ::core::ffi::c_int));
1109 pub const ASTC_8x6_UNORM: Self = Self((69 as ::core::ffi::c_int));
1110 pub const ASTC_8x8_UNORM: Self = Self((70 as ::core::ffi::c_int));
1111 pub const ASTC_10x5_UNORM: Self = Self((71 as ::core::ffi::c_int));
1112 pub const ASTC_10x6_UNORM: Self = Self((72 as ::core::ffi::c_int));
1113 pub const ASTC_10x8_UNORM: Self = Self((73 as ::core::ffi::c_int));
1114 pub const ASTC_10x10_UNORM: Self = Self((74 as ::core::ffi::c_int));
1115 pub const ASTC_12x10_UNORM: Self = Self((75 as ::core::ffi::c_int));
1116 pub const ASTC_12x12_UNORM: Self = Self((76 as ::core::ffi::c_int));
1117 pub const ASTC_4x4_UNORM_SRGB: Self = Self((77 as ::core::ffi::c_int));
1118 pub const ASTC_5x4_UNORM_SRGB: Self = Self((78 as ::core::ffi::c_int));
1119 pub const ASTC_5x5_UNORM_SRGB: Self = Self((79 as ::core::ffi::c_int));
1120 pub const ASTC_6x5_UNORM_SRGB: Self = Self((80 as ::core::ffi::c_int));
1121 pub const ASTC_6x6_UNORM_SRGB: Self = Self((81 as ::core::ffi::c_int));
1122 pub const ASTC_8x5_UNORM_SRGB: Self = Self((82 as ::core::ffi::c_int));
1123 pub const ASTC_8x6_UNORM_SRGB: Self = Self((83 as ::core::ffi::c_int));
1124 pub const ASTC_8x8_UNORM_SRGB: Self = Self((84 as ::core::ffi::c_int));
1125 pub const ASTC_10x5_UNORM_SRGB: Self = Self((85 as ::core::ffi::c_int));
1126 pub const ASTC_10x6_UNORM_SRGB: Self = Self((86 as ::core::ffi::c_int));
1127 pub const ASTC_10x8_UNORM_SRGB: Self = Self((87 as ::core::ffi::c_int));
1128 pub const ASTC_10x10_UNORM_SRGB: Self = Self((88 as ::core::ffi::c_int));
1129 pub const ASTC_12x10_UNORM_SRGB: Self = Self((89 as ::core::ffi::c_int));
1130 pub const ASTC_12x12_UNORM_SRGB: Self = Self((90 as ::core::ffi::c_int));
1131 pub const ASTC_4x4_FLOAT: Self = Self((91 as ::core::ffi::c_int));
1132 pub const ASTC_5x4_FLOAT: Self = Self((92 as ::core::ffi::c_int));
1133 pub const ASTC_5x5_FLOAT: Self = Self((93 as ::core::ffi::c_int));
1134 pub const ASTC_6x5_FLOAT: Self = Self((94 as ::core::ffi::c_int));
1135 pub const ASTC_6x6_FLOAT: Self = Self((95 as ::core::ffi::c_int));
1136 pub const ASTC_8x5_FLOAT: Self = Self((96 as ::core::ffi::c_int));
1137 pub const ASTC_8x6_FLOAT: Self = Self((97 as ::core::ffi::c_int));
1138 pub const ASTC_8x8_FLOAT: Self = Self((98 as ::core::ffi::c_int));
1139 pub const ASTC_10x5_FLOAT: Self = Self((99 as ::core::ffi::c_int));
1140 pub const ASTC_10x6_FLOAT: Self = Self((100 as ::core::ffi::c_int));
1141 pub const ASTC_10x8_FLOAT: Self = Self((101 as ::core::ffi::c_int));
1142 pub const ASTC_10x10_FLOAT: Self = Self((102 as ::core::ffi::c_int));
1143 pub const ASTC_12x10_FLOAT: Self = Self((103 as ::core::ffi::c_int));
1144 pub const ASTC_12x12_FLOAT: Self = Self((104 as ::core::ffi::c_int));
1145}
1146
1147pub const SDL_GPU_TEXTUREFORMAT_INVALID: SDL_GPUTextureFormat = SDL_GPUTextureFormat::INVALID;
1148pub const SDL_GPU_TEXTUREFORMAT_A8_UNORM: SDL_GPUTextureFormat = SDL_GPUTextureFormat::A8_UNORM;
1149pub const SDL_GPU_TEXTUREFORMAT_R8_UNORM: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R8_UNORM;
1150pub const SDL_GPU_TEXTUREFORMAT_R8G8_UNORM: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R8G8_UNORM;
1151pub const SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM: SDL_GPUTextureFormat =
1152 SDL_GPUTextureFormat::R8G8B8A8_UNORM;
1153pub const SDL_GPU_TEXTUREFORMAT_R16_UNORM: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R16_UNORM;
1154pub const SDL_GPU_TEXTUREFORMAT_R16G16_UNORM: SDL_GPUTextureFormat =
1155 SDL_GPUTextureFormat::R16G16_UNORM;
1156pub const SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UNORM: SDL_GPUTextureFormat =
1157 SDL_GPUTextureFormat::R16G16B16A16_UNORM;
1158pub const SDL_GPU_TEXTUREFORMAT_R10G10B10A2_UNORM: SDL_GPUTextureFormat =
1159 SDL_GPUTextureFormat::R10G10B10A2_UNORM;
1160pub const SDL_GPU_TEXTUREFORMAT_B5G6R5_UNORM: SDL_GPUTextureFormat =
1161 SDL_GPUTextureFormat::B5G6R5_UNORM;
1162pub const SDL_GPU_TEXTUREFORMAT_B5G5R5A1_UNORM: SDL_GPUTextureFormat =
1163 SDL_GPUTextureFormat::B5G5R5A1_UNORM;
1164pub const SDL_GPU_TEXTUREFORMAT_B4G4R4A4_UNORM: SDL_GPUTextureFormat =
1165 SDL_GPUTextureFormat::B4G4R4A4_UNORM;
1166pub const SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM: SDL_GPUTextureFormat =
1167 SDL_GPUTextureFormat::B8G8R8A8_UNORM;
1168pub const SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM: SDL_GPUTextureFormat =
1169 SDL_GPUTextureFormat::BC1_RGBA_UNORM;
1170pub const SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM: SDL_GPUTextureFormat =
1171 SDL_GPUTextureFormat::BC2_RGBA_UNORM;
1172pub const SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM: SDL_GPUTextureFormat =
1173 SDL_GPUTextureFormat::BC3_RGBA_UNORM;
1174pub const SDL_GPU_TEXTUREFORMAT_BC4_R_UNORM: SDL_GPUTextureFormat =
1175 SDL_GPUTextureFormat::BC4_R_UNORM;
1176pub const SDL_GPU_TEXTUREFORMAT_BC5_RG_UNORM: SDL_GPUTextureFormat =
1177 SDL_GPUTextureFormat::BC5_RG_UNORM;
1178pub const SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM: SDL_GPUTextureFormat =
1179 SDL_GPUTextureFormat::BC7_RGBA_UNORM;
1180pub const SDL_GPU_TEXTUREFORMAT_BC6H_RGB_FLOAT: SDL_GPUTextureFormat =
1181 SDL_GPUTextureFormat::BC6H_RGB_FLOAT;
1182pub const SDL_GPU_TEXTUREFORMAT_BC6H_RGB_UFLOAT: SDL_GPUTextureFormat =
1183 SDL_GPUTextureFormat::BC6H_RGB_UFLOAT;
1184pub const SDL_GPU_TEXTUREFORMAT_R8_SNORM: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R8_SNORM;
1185pub const SDL_GPU_TEXTUREFORMAT_R8G8_SNORM: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R8G8_SNORM;
1186pub const SDL_GPU_TEXTUREFORMAT_R8G8B8A8_SNORM: SDL_GPUTextureFormat =
1187 SDL_GPUTextureFormat::R8G8B8A8_SNORM;
1188pub const SDL_GPU_TEXTUREFORMAT_R16_SNORM: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R16_SNORM;
1189pub const SDL_GPU_TEXTUREFORMAT_R16G16_SNORM: SDL_GPUTextureFormat =
1190 SDL_GPUTextureFormat::R16G16_SNORM;
1191pub const SDL_GPU_TEXTUREFORMAT_R16G16B16A16_SNORM: SDL_GPUTextureFormat =
1192 SDL_GPUTextureFormat::R16G16B16A16_SNORM;
1193pub const SDL_GPU_TEXTUREFORMAT_R16_FLOAT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R16_FLOAT;
1194pub const SDL_GPU_TEXTUREFORMAT_R16G16_FLOAT: SDL_GPUTextureFormat =
1195 SDL_GPUTextureFormat::R16G16_FLOAT;
1196pub const SDL_GPU_TEXTUREFORMAT_R16G16B16A16_FLOAT: SDL_GPUTextureFormat =
1197 SDL_GPUTextureFormat::R16G16B16A16_FLOAT;
1198pub const SDL_GPU_TEXTUREFORMAT_R32_FLOAT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R32_FLOAT;
1199pub const SDL_GPU_TEXTUREFORMAT_R32G32_FLOAT: SDL_GPUTextureFormat =
1200 SDL_GPUTextureFormat::R32G32_FLOAT;
1201pub const SDL_GPU_TEXTUREFORMAT_R32G32B32A32_FLOAT: SDL_GPUTextureFormat =
1202 SDL_GPUTextureFormat::R32G32B32A32_FLOAT;
1203pub const SDL_GPU_TEXTUREFORMAT_R11G11B10_UFLOAT: SDL_GPUTextureFormat =
1204 SDL_GPUTextureFormat::R11G11B10_UFLOAT;
1205pub const SDL_GPU_TEXTUREFORMAT_R8_UINT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R8_UINT;
1206pub const SDL_GPU_TEXTUREFORMAT_R8G8_UINT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R8G8_UINT;
1207pub const SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UINT: SDL_GPUTextureFormat =
1208 SDL_GPUTextureFormat::R8G8B8A8_UINT;
1209pub const SDL_GPU_TEXTUREFORMAT_R16_UINT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R16_UINT;
1210pub const SDL_GPU_TEXTUREFORMAT_R16G16_UINT: SDL_GPUTextureFormat =
1211 SDL_GPUTextureFormat::R16G16_UINT;
1212pub const SDL_GPU_TEXTUREFORMAT_R16G16B16A16_UINT: SDL_GPUTextureFormat =
1213 SDL_GPUTextureFormat::R16G16B16A16_UINT;
1214pub const SDL_GPU_TEXTUREFORMAT_R32_UINT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R32_UINT;
1215pub const SDL_GPU_TEXTUREFORMAT_R32G32_UINT: SDL_GPUTextureFormat =
1216 SDL_GPUTextureFormat::R32G32_UINT;
1217pub const SDL_GPU_TEXTUREFORMAT_R32G32B32A32_UINT: SDL_GPUTextureFormat =
1218 SDL_GPUTextureFormat::R32G32B32A32_UINT;
1219pub const SDL_GPU_TEXTUREFORMAT_R8_INT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R8_INT;
1220pub const SDL_GPU_TEXTUREFORMAT_R8G8_INT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R8G8_INT;
1221pub const SDL_GPU_TEXTUREFORMAT_R8G8B8A8_INT: SDL_GPUTextureFormat =
1222 SDL_GPUTextureFormat::R8G8B8A8_INT;
1223pub const SDL_GPU_TEXTUREFORMAT_R16_INT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R16_INT;
1224pub const SDL_GPU_TEXTUREFORMAT_R16G16_INT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R16G16_INT;
1225pub const SDL_GPU_TEXTUREFORMAT_R16G16B16A16_INT: SDL_GPUTextureFormat =
1226 SDL_GPUTextureFormat::R16G16B16A16_INT;
1227pub const SDL_GPU_TEXTUREFORMAT_R32_INT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R32_INT;
1228pub const SDL_GPU_TEXTUREFORMAT_R32G32_INT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::R32G32_INT;
1229pub const SDL_GPU_TEXTUREFORMAT_R32G32B32A32_INT: SDL_GPUTextureFormat =
1230 SDL_GPUTextureFormat::R32G32B32A32_INT;
1231pub const SDL_GPU_TEXTUREFORMAT_R8G8B8A8_UNORM_SRGB: SDL_GPUTextureFormat =
1232 SDL_GPUTextureFormat::R8G8B8A8_UNORM_SRGB;
1233pub const SDL_GPU_TEXTUREFORMAT_B8G8R8A8_UNORM_SRGB: SDL_GPUTextureFormat =
1234 SDL_GPUTextureFormat::B8G8R8A8_UNORM_SRGB;
1235pub const SDL_GPU_TEXTUREFORMAT_BC1_RGBA_UNORM_SRGB: SDL_GPUTextureFormat =
1236 SDL_GPUTextureFormat::BC1_RGBA_UNORM_SRGB;
1237pub const SDL_GPU_TEXTUREFORMAT_BC2_RGBA_UNORM_SRGB: SDL_GPUTextureFormat =
1238 SDL_GPUTextureFormat::BC2_RGBA_UNORM_SRGB;
1239pub const SDL_GPU_TEXTUREFORMAT_BC3_RGBA_UNORM_SRGB: SDL_GPUTextureFormat =
1240 SDL_GPUTextureFormat::BC3_RGBA_UNORM_SRGB;
1241pub const SDL_GPU_TEXTUREFORMAT_BC7_RGBA_UNORM_SRGB: SDL_GPUTextureFormat =
1242 SDL_GPUTextureFormat::BC7_RGBA_UNORM_SRGB;
1243pub const SDL_GPU_TEXTUREFORMAT_D16_UNORM: SDL_GPUTextureFormat = SDL_GPUTextureFormat::D16_UNORM;
1244pub const SDL_GPU_TEXTUREFORMAT_D24_UNORM: SDL_GPUTextureFormat = SDL_GPUTextureFormat::D24_UNORM;
1245pub const SDL_GPU_TEXTUREFORMAT_D32_FLOAT: SDL_GPUTextureFormat = SDL_GPUTextureFormat::D32_FLOAT;
1246pub const SDL_GPU_TEXTUREFORMAT_D24_UNORM_S8_UINT: SDL_GPUTextureFormat =
1247 SDL_GPUTextureFormat::D24_UNORM_S8_UINT;
1248pub const SDL_GPU_TEXTUREFORMAT_D32_FLOAT_S8_UINT: SDL_GPUTextureFormat =
1249 SDL_GPUTextureFormat::D32_FLOAT_S8_UINT;
1250pub const SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM: SDL_GPUTextureFormat =
1251 SDL_GPUTextureFormat::ASTC_4x4_UNORM;
1252pub const SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM: SDL_GPUTextureFormat =
1253 SDL_GPUTextureFormat::ASTC_5x4_UNORM;
1254pub const SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM: SDL_GPUTextureFormat =
1255 SDL_GPUTextureFormat::ASTC_5x5_UNORM;
1256pub const SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM: SDL_GPUTextureFormat =
1257 SDL_GPUTextureFormat::ASTC_6x5_UNORM;
1258pub const SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM: SDL_GPUTextureFormat =
1259 SDL_GPUTextureFormat::ASTC_6x6_UNORM;
1260pub const SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM: SDL_GPUTextureFormat =
1261 SDL_GPUTextureFormat::ASTC_8x5_UNORM;
1262pub const SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM: SDL_GPUTextureFormat =
1263 SDL_GPUTextureFormat::ASTC_8x6_UNORM;
1264pub const SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM: SDL_GPUTextureFormat =
1265 SDL_GPUTextureFormat::ASTC_8x8_UNORM;
1266pub const SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM: SDL_GPUTextureFormat =
1267 SDL_GPUTextureFormat::ASTC_10x5_UNORM;
1268pub const SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM: SDL_GPUTextureFormat =
1269 SDL_GPUTextureFormat::ASTC_10x6_UNORM;
1270pub const SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM: SDL_GPUTextureFormat =
1271 SDL_GPUTextureFormat::ASTC_10x8_UNORM;
1272pub const SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM: SDL_GPUTextureFormat =
1273 SDL_GPUTextureFormat::ASTC_10x10_UNORM;
1274pub const SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM: SDL_GPUTextureFormat =
1275 SDL_GPUTextureFormat::ASTC_12x10_UNORM;
1276pub const SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM: SDL_GPUTextureFormat =
1277 SDL_GPUTextureFormat::ASTC_12x12_UNORM;
1278pub const SDL_GPU_TEXTUREFORMAT_ASTC_4x4_UNORM_SRGB: SDL_GPUTextureFormat =
1279 SDL_GPUTextureFormat::ASTC_4x4_UNORM_SRGB;
1280pub const SDL_GPU_TEXTUREFORMAT_ASTC_5x4_UNORM_SRGB: SDL_GPUTextureFormat =
1281 SDL_GPUTextureFormat::ASTC_5x4_UNORM_SRGB;
1282pub const SDL_GPU_TEXTUREFORMAT_ASTC_5x5_UNORM_SRGB: SDL_GPUTextureFormat =
1283 SDL_GPUTextureFormat::ASTC_5x5_UNORM_SRGB;
1284pub const SDL_GPU_TEXTUREFORMAT_ASTC_6x5_UNORM_SRGB: SDL_GPUTextureFormat =
1285 SDL_GPUTextureFormat::ASTC_6x5_UNORM_SRGB;
1286pub const SDL_GPU_TEXTUREFORMAT_ASTC_6x6_UNORM_SRGB: SDL_GPUTextureFormat =
1287 SDL_GPUTextureFormat::ASTC_6x6_UNORM_SRGB;
1288pub const SDL_GPU_TEXTUREFORMAT_ASTC_8x5_UNORM_SRGB: SDL_GPUTextureFormat =
1289 SDL_GPUTextureFormat::ASTC_8x5_UNORM_SRGB;
1290pub const SDL_GPU_TEXTUREFORMAT_ASTC_8x6_UNORM_SRGB: SDL_GPUTextureFormat =
1291 SDL_GPUTextureFormat::ASTC_8x6_UNORM_SRGB;
1292pub const SDL_GPU_TEXTUREFORMAT_ASTC_8x8_UNORM_SRGB: SDL_GPUTextureFormat =
1293 SDL_GPUTextureFormat::ASTC_8x8_UNORM_SRGB;
1294pub const SDL_GPU_TEXTUREFORMAT_ASTC_10x5_UNORM_SRGB: SDL_GPUTextureFormat =
1295 SDL_GPUTextureFormat::ASTC_10x5_UNORM_SRGB;
1296pub const SDL_GPU_TEXTUREFORMAT_ASTC_10x6_UNORM_SRGB: SDL_GPUTextureFormat =
1297 SDL_GPUTextureFormat::ASTC_10x6_UNORM_SRGB;
1298pub const SDL_GPU_TEXTUREFORMAT_ASTC_10x8_UNORM_SRGB: SDL_GPUTextureFormat =
1299 SDL_GPUTextureFormat::ASTC_10x8_UNORM_SRGB;
1300pub const SDL_GPU_TEXTUREFORMAT_ASTC_10x10_UNORM_SRGB: SDL_GPUTextureFormat =
1301 SDL_GPUTextureFormat::ASTC_10x10_UNORM_SRGB;
1302pub const SDL_GPU_TEXTUREFORMAT_ASTC_12x10_UNORM_SRGB: SDL_GPUTextureFormat =
1303 SDL_GPUTextureFormat::ASTC_12x10_UNORM_SRGB;
1304pub const SDL_GPU_TEXTUREFORMAT_ASTC_12x12_UNORM_SRGB: SDL_GPUTextureFormat =
1305 SDL_GPUTextureFormat::ASTC_12x12_UNORM_SRGB;
1306pub const SDL_GPU_TEXTUREFORMAT_ASTC_4x4_FLOAT: SDL_GPUTextureFormat =
1307 SDL_GPUTextureFormat::ASTC_4x4_FLOAT;
1308pub const SDL_GPU_TEXTUREFORMAT_ASTC_5x4_FLOAT: SDL_GPUTextureFormat =
1309 SDL_GPUTextureFormat::ASTC_5x4_FLOAT;
1310pub const SDL_GPU_TEXTUREFORMAT_ASTC_5x5_FLOAT: SDL_GPUTextureFormat =
1311 SDL_GPUTextureFormat::ASTC_5x5_FLOAT;
1312pub const SDL_GPU_TEXTUREFORMAT_ASTC_6x5_FLOAT: SDL_GPUTextureFormat =
1313 SDL_GPUTextureFormat::ASTC_6x5_FLOAT;
1314pub const SDL_GPU_TEXTUREFORMAT_ASTC_6x6_FLOAT: SDL_GPUTextureFormat =
1315 SDL_GPUTextureFormat::ASTC_6x6_FLOAT;
1316pub const SDL_GPU_TEXTUREFORMAT_ASTC_8x5_FLOAT: SDL_GPUTextureFormat =
1317 SDL_GPUTextureFormat::ASTC_8x5_FLOAT;
1318pub const SDL_GPU_TEXTUREFORMAT_ASTC_8x6_FLOAT: SDL_GPUTextureFormat =
1319 SDL_GPUTextureFormat::ASTC_8x6_FLOAT;
1320pub const SDL_GPU_TEXTUREFORMAT_ASTC_8x8_FLOAT: SDL_GPUTextureFormat =
1321 SDL_GPUTextureFormat::ASTC_8x8_FLOAT;
1322pub const SDL_GPU_TEXTUREFORMAT_ASTC_10x5_FLOAT: SDL_GPUTextureFormat =
1323 SDL_GPUTextureFormat::ASTC_10x5_FLOAT;
1324pub const SDL_GPU_TEXTUREFORMAT_ASTC_10x6_FLOAT: SDL_GPUTextureFormat =
1325 SDL_GPUTextureFormat::ASTC_10x6_FLOAT;
1326pub const SDL_GPU_TEXTUREFORMAT_ASTC_10x8_FLOAT: SDL_GPUTextureFormat =
1327 SDL_GPUTextureFormat::ASTC_10x8_FLOAT;
1328pub const SDL_GPU_TEXTUREFORMAT_ASTC_10x10_FLOAT: SDL_GPUTextureFormat =
1329 SDL_GPUTextureFormat::ASTC_10x10_FLOAT;
1330pub const SDL_GPU_TEXTUREFORMAT_ASTC_12x10_FLOAT: SDL_GPUTextureFormat =
1331 SDL_GPUTextureFormat::ASTC_12x10_FLOAT;
1332pub const SDL_GPU_TEXTUREFORMAT_ASTC_12x12_FLOAT: SDL_GPUTextureFormat =
1333 SDL_GPUTextureFormat::ASTC_12x12_FLOAT;
1334
1335#[cfg(feature = "metadata")]
1336impl sdl3_sys::metadata::GroupMetadata for SDL_GPUTextureFormat {
1337 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
1338 &crate::metadata::gpu::METADATA_SDL_GPUTextureFormat;
1339}
1340
1341/// Specifies how a texture is intended to be used by the client.
1342///
1343/// A texture must have at least one usage flag. Note that some usage flag
1344/// combinations are invalid.
1345///
1346/// With regards to compute storage usage, READ | WRITE means that you can have
1347/// shader A that only writes into the texture and shader B that only reads
1348/// from the texture and bind the same texture to either shader respectively.
1349/// SIMULTANEOUS means that you can do reads and writes within the same shader
1350/// or compute pass. It also implies that atomic ops can be used, since those
1351/// are read-modify-write operations. If you use SIMULTANEOUS, you are
1352/// responsible for avoiding data races, as there is no data synchronization
1353/// within a compute pass. Note that SIMULTANEOUS usage is only supported by a
1354/// limited number of texture formats.
1355///
1356/// ## Availability
1357/// This datatype is available since SDL 3.2.0.
1358///
1359/// ## See also
1360/// - [`SDL_CreateGPUTexture`]
1361///
1362/// ## Known values (`sdl3-sys`)
1363/// | Associated constant | Global constant | Description |
1364/// | ------------------- | --------------- | ----------- |
1365/// | [`SAMPLER`](SDL_GPUTextureUsageFlags::SAMPLER) | [`SDL_GPU_TEXTUREUSAGE_SAMPLER`] | Texture supports sampling. |
1366/// | [`COLOR_TARGET`](SDL_GPUTextureUsageFlags::COLOR_TARGET) | [`SDL_GPU_TEXTUREUSAGE_COLOR_TARGET`] | Texture is a color render target. |
1367/// | [`DEPTH_STENCIL_TARGET`](SDL_GPUTextureUsageFlags::DEPTH_STENCIL_TARGET) | [`SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET`] | Texture is a depth stencil target. |
1368/// | [`GRAPHICS_STORAGE_READ`](SDL_GPUTextureUsageFlags::GRAPHICS_STORAGE_READ) | [`SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ`] | Texture supports storage reads in graphics stages. |
1369/// | [`COMPUTE_STORAGE_READ`](SDL_GPUTextureUsageFlags::COMPUTE_STORAGE_READ) | [`SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ`] | Texture supports storage reads in the compute stage. |
1370/// | [`COMPUTE_STORAGE_WRITE`](SDL_GPUTextureUsageFlags::COMPUTE_STORAGE_WRITE) | [`SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE`] | Texture supports storage writes in the compute stage. |
1371/// | [`COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE`](SDL_GPUTextureUsageFlags::COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE) | [`SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE`] | Texture supports reads and writes in the same compute shader. This is NOT equivalent to READ | WRITE. |
1372#[repr(transparent)]
1373#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
1374pub struct SDL_GPUTextureUsageFlags(pub Uint32);
1375
1376impl ::core::cmp::PartialEq<Uint32> for SDL_GPUTextureUsageFlags {
1377 #[inline(always)]
1378 fn eq(&self, other: &Uint32) -> bool {
1379 &self.0 == other
1380 }
1381}
1382
1383impl ::core::cmp::PartialEq<SDL_GPUTextureUsageFlags> for Uint32 {
1384 #[inline(always)]
1385 fn eq(&self, other: &SDL_GPUTextureUsageFlags) -> bool {
1386 self == &other.0
1387 }
1388}
1389
1390impl From<SDL_GPUTextureUsageFlags> for Uint32 {
1391 #[inline(always)]
1392 fn from(value: SDL_GPUTextureUsageFlags) -> Self {
1393 value.0
1394 }
1395}
1396
1397#[cfg(feature = "debug-impls")]
1398impl ::core::fmt::Debug for SDL_GPUTextureUsageFlags {
1399 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1400 let mut first = true;
1401 let all_bits = 0;
1402 write!(f, "SDL_GPUTextureUsageFlags(")?;
1403 let all_bits = all_bits | Self::SAMPLER.0;
1404 if (Self::SAMPLER != 0 || self.0 == 0) && *self & Self::SAMPLER == Self::SAMPLER {
1405 if !first {
1406 write!(f, " | ")?;
1407 }
1408 first = false;
1409 write!(f, "SAMPLER")?;
1410 }
1411 let all_bits = all_bits | Self::COLOR_TARGET.0;
1412 if (Self::COLOR_TARGET != 0 || self.0 == 0)
1413 && *self & Self::COLOR_TARGET == Self::COLOR_TARGET
1414 {
1415 if !first {
1416 write!(f, " | ")?;
1417 }
1418 first = false;
1419 write!(f, "COLOR_TARGET")?;
1420 }
1421 let all_bits = all_bits | Self::DEPTH_STENCIL_TARGET.0;
1422 if (Self::DEPTH_STENCIL_TARGET != 0 || self.0 == 0)
1423 && *self & Self::DEPTH_STENCIL_TARGET == Self::DEPTH_STENCIL_TARGET
1424 {
1425 if !first {
1426 write!(f, " | ")?;
1427 }
1428 first = false;
1429 write!(f, "DEPTH_STENCIL_TARGET")?;
1430 }
1431 let all_bits = all_bits | Self::GRAPHICS_STORAGE_READ.0;
1432 if (Self::GRAPHICS_STORAGE_READ != 0 || self.0 == 0)
1433 && *self & Self::GRAPHICS_STORAGE_READ == Self::GRAPHICS_STORAGE_READ
1434 {
1435 if !first {
1436 write!(f, " | ")?;
1437 }
1438 first = false;
1439 write!(f, "GRAPHICS_STORAGE_READ")?;
1440 }
1441 let all_bits = all_bits | Self::COMPUTE_STORAGE_READ.0;
1442 if (Self::COMPUTE_STORAGE_READ != 0 || self.0 == 0)
1443 && *self & Self::COMPUTE_STORAGE_READ == Self::COMPUTE_STORAGE_READ
1444 {
1445 if !first {
1446 write!(f, " | ")?;
1447 }
1448 first = false;
1449 write!(f, "COMPUTE_STORAGE_READ")?;
1450 }
1451 let all_bits = all_bits | Self::COMPUTE_STORAGE_WRITE.0;
1452 if (Self::COMPUTE_STORAGE_WRITE != 0 || self.0 == 0)
1453 && *self & Self::COMPUTE_STORAGE_WRITE == Self::COMPUTE_STORAGE_WRITE
1454 {
1455 if !first {
1456 write!(f, " | ")?;
1457 }
1458 first = false;
1459 write!(f, "COMPUTE_STORAGE_WRITE")?;
1460 }
1461 let all_bits = all_bits | Self::COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE.0;
1462 if (Self::COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE != 0 || self.0 == 0)
1463 && *self & Self::COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE
1464 == Self::COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE
1465 {
1466 if !first {
1467 write!(f, " | ")?;
1468 }
1469 first = false;
1470 write!(f, "COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE")?;
1471 }
1472
1473 if self.0 & !all_bits != 0 {
1474 if !first {
1475 write!(f, " | ")?;
1476 }
1477 write!(f, "{:#x}", self.0)?;
1478 } else if first {
1479 write!(f, "0")?;
1480 }
1481 write!(f, ")")
1482 }
1483}
1484
1485impl ::core::ops::BitAnd for SDL_GPUTextureUsageFlags {
1486 type Output = Self;
1487
1488 #[inline(always)]
1489 fn bitand(self, rhs: Self) -> Self::Output {
1490 Self(self.0 & rhs.0)
1491 }
1492}
1493
1494impl ::core::ops::BitAndAssign for SDL_GPUTextureUsageFlags {
1495 #[inline(always)]
1496 fn bitand_assign(&mut self, rhs: Self) {
1497 self.0 &= rhs.0;
1498 }
1499}
1500
1501impl ::core::ops::BitOr for SDL_GPUTextureUsageFlags {
1502 type Output = Self;
1503
1504 #[inline(always)]
1505 fn bitor(self, rhs: Self) -> Self::Output {
1506 Self(self.0 | rhs.0)
1507 }
1508}
1509
1510impl ::core::ops::BitOrAssign for SDL_GPUTextureUsageFlags {
1511 #[inline(always)]
1512 fn bitor_assign(&mut self, rhs: Self) {
1513 self.0 |= rhs.0;
1514 }
1515}
1516
1517impl ::core::ops::BitXor for SDL_GPUTextureUsageFlags {
1518 type Output = Self;
1519
1520 #[inline(always)]
1521 fn bitxor(self, rhs: Self) -> Self::Output {
1522 Self(self.0 ^ rhs.0)
1523 }
1524}
1525
1526impl ::core::ops::BitXorAssign for SDL_GPUTextureUsageFlags {
1527 #[inline(always)]
1528 fn bitxor_assign(&mut self, rhs: Self) {
1529 self.0 ^= rhs.0;
1530 }
1531}
1532
1533impl ::core::ops::Not for SDL_GPUTextureUsageFlags {
1534 type Output = Self;
1535
1536 #[inline(always)]
1537 fn not(self) -> Self::Output {
1538 Self(!self.0)
1539 }
1540}
1541
1542impl SDL_GPUTextureUsageFlags {
1543 /// Texture supports sampling.
1544 pub const SAMPLER: Self = Self((1_u32 as Uint32));
1545 /// Texture is a color render target.
1546 pub const COLOR_TARGET: Self = Self((2_u32 as Uint32));
1547 /// Texture is a depth stencil target.
1548 pub const DEPTH_STENCIL_TARGET: Self = Self((4_u32 as Uint32));
1549 /// Texture supports storage reads in graphics stages.
1550 pub const GRAPHICS_STORAGE_READ: Self = Self((8_u32 as Uint32));
1551 /// Texture supports storage reads in the compute stage.
1552 pub const COMPUTE_STORAGE_READ: Self = Self((16_u32 as Uint32));
1553 /// Texture supports storage writes in the compute stage.
1554 pub const COMPUTE_STORAGE_WRITE: Self = Self((32_u32 as Uint32));
1555 /// Texture supports reads and writes in the same compute shader. This is NOT equivalent to READ | WRITE.
1556 pub const COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE: Self = Self((64_u32 as Uint32));
1557}
1558
1559/// Texture supports sampling.
1560pub const SDL_GPU_TEXTUREUSAGE_SAMPLER: SDL_GPUTextureUsageFlags =
1561 SDL_GPUTextureUsageFlags::SAMPLER;
1562/// Texture is a color render target.
1563pub const SDL_GPU_TEXTUREUSAGE_COLOR_TARGET: SDL_GPUTextureUsageFlags =
1564 SDL_GPUTextureUsageFlags::COLOR_TARGET;
1565/// Texture is a depth stencil target.
1566pub const SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET: SDL_GPUTextureUsageFlags =
1567 SDL_GPUTextureUsageFlags::DEPTH_STENCIL_TARGET;
1568/// Texture supports storage reads in graphics stages.
1569pub const SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ: SDL_GPUTextureUsageFlags =
1570 SDL_GPUTextureUsageFlags::GRAPHICS_STORAGE_READ;
1571/// Texture supports storage reads in the compute stage.
1572pub const SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ: SDL_GPUTextureUsageFlags =
1573 SDL_GPUTextureUsageFlags::COMPUTE_STORAGE_READ;
1574/// Texture supports storage writes in the compute stage.
1575pub const SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE: SDL_GPUTextureUsageFlags =
1576 SDL_GPUTextureUsageFlags::COMPUTE_STORAGE_WRITE;
1577/// Texture supports reads and writes in the same compute shader. This is NOT equivalent to READ | WRITE.
1578pub const SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE: SDL_GPUTextureUsageFlags =
1579 SDL_GPUTextureUsageFlags::COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE;
1580
1581#[cfg(feature = "metadata")]
1582impl sdl3_sys::metadata::GroupMetadata for SDL_GPUTextureUsageFlags {
1583 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
1584 &crate::metadata::gpu::METADATA_SDL_GPUTextureUsageFlags;
1585}
1586
1587/// Specifies the type of a texture.
1588///
1589/// ## Availability
1590/// This enum is available since SDL 3.2.0.
1591///
1592/// ## See also
1593/// - [`SDL_CreateGPUTexture`]
1594///
1595/// ## Known values (`sdl3-sys`)
1596/// | Associated constant | Global constant | Description |
1597/// | ------------------- | --------------- | ----------- |
1598/// | [`_2D`](SDL_GPUTextureType::_2D) | [`SDL_GPU_TEXTURETYPE_2D`] | The texture is a 2-dimensional image. |
1599/// | [`_2D_ARRAY`](SDL_GPUTextureType::_2D_ARRAY) | [`SDL_GPU_TEXTURETYPE_2D_ARRAY`] | The texture is a 2-dimensional array image. |
1600/// | [`_3D`](SDL_GPUTextureType::_3D) | [`SDL_GPU_TEXTURETYPE_3D`] | The texture is a 3-dimensional image. |
1601/// | [`CUBE`](SDL_GPUTextureType::CUBE) | [`SDL_GPU_TEXTURETYPE_CUBE`] | The texture is a cube image. |
1602/// | [`CUBE_ARRAY`](SDL_GPUTextureType::CUBE_ARRAY) | [`SDL_GPU_TEXTURETYPE_CUBE_ARRAY`] | The texture is a cube array image. |
1603#[repr(transparent)]
1604#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
1605pub struct SDL_GPUTextureType(pub ::core::ffi::c_int);
1606
1607impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUTextureType {
1608 #[inline(always)]
1609 fn eq(&self, other: &::core::ffi::c_int) -> bool {
1610 &self.0 == other
1611 }
1612}
1613
1614impl ::core::cmp::PartialEq<SDL_GPUTextureType> for ::core::ffi::c_int {
1615 #[inline(always)]
1616 fn eq(&self, other: &SDL_GPUTextureType) -> bool {
1617 self == &other.0
1618 }
1619}
1620
1621impl From<SDL_GPUTextureType> for ::core::ffi::c_int {
1622 #[inline(always)]
1623 fn from(value: SDL_GPUTextureType) -> Self {
1624 value.0
1625 }
1626}
1627
1628#[cfg(feature = "debug-impls")]
1629impl ::core::fmt::Debug for SDL_GPUTextureType {
1630 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1631 #[allow(unreachable_patterns)]
1632 f.write_str(match *self {
1633 Self::_2D => "SDL_GPU_TEXTURETYPE_2D",
1634 Self::_2D_ARRAY => "SDL_GPU_TEXTURETYPE_2D_ARRAY",
1635 Self::_3D => "SDL_GPU_TEXTURETYPE_3D",
1636 Self::CUBE => "SDL_GPU_TEXTURETYPE_CUBE",
1637 Self::CUBE_ARRAY => "SDL_GPU_TEXTURETYPE_CUBE_ARRAY",
1638
1639 _ => return write!(f, "SDL_GPUTextureType({})", self.0),
1640 })
1641 }
1642}
1643
1644impl SDL_GPUTextureType {
1645 /// The texture is a 2-dimensional image.
1646 pub const _2D: Self = Self((0 as ::core::ffi::c_int));
1647 /// The texture is a 2-dimensional array image.
1648 pub const _2D_ARRAY: Self = Self((1 as ::core::ffi::c_int));
1649 /// The texture is a 3-dimensional image.
1650 pub const _3D: Self = Self((2 as ::core::ffi::c_int));
1651 /// The texture is a cube image.
1652 pub const CUBE: Self = Self((3 as ::core::ffi::c_int));
1653 /// The texture is a cube array image.
1654 pub const CUBE_ARRAY: Self = Self((4 as ::core::ffi::c_int));
1655}
1656
1657/// The texture is a 2-dimensional image.
1658pub const SDL_GPU_TEXTURETYPE_2D: SDL_GPUTextureType = SDL_GPUTextureType::_2D;
1659/// The texture is a 2-dimensional array image.
1660pub const SDL_GPU_TEXTURETYPE_2D_ARRAY: SDL_GPUTextureType = SDL_GPUTextureType::_2D_ARRAY;
1661/// The texture is a 3-dimensional image.
1662pub const SDL_GPU_TEXTURETYPE_3D: SDL_GPUTextureType = SDL_GPUTextureType::_3D;
1663/// The texture is a cube image.
1664pub const SDL_GPU_TEXTURETYPE_CUBE: SDL_GPUTextureType = SDL_GPUTextureType::CUBE;
1665/// The texture is a cube array image.
1666pub const SDL_GPU_TEXTURETYPE_CUBE_ARRAY: SDL_GPUTextureType = SDL_GPUTextureType::CUBE_ARRAY;
1667
1668#[cfg(feature = "metadata")]
1669impl sdl3_sys::metadata::GroupMetadata for SDL_GPUTextureType {
1670 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
1671 &crate::metadata::gpu::METADATA_SDL_GPUTextureType;
1672}
1673
1674/// Specifies the sample count of a texture.
1675///
1676/// Used in multisampling. Note that this value only applies when the texture
1677/// is used as a render target.
1678///
1679/// ## Availability
1680/// This enum is available since SDL 3.2.0.
1681///
1682/// ## See also
1683/// - [`SDL_CreateGPUTexture`]
1684/// - [`SDL_GPUTextureSupportsSampleCount`]
1685///
1686/// ## Known values (`sdl3-sys`)
1687/// | Associated constant | Global constant | Description |
1688/// | ------------------- | --------------- | ----------- |
1689/// | [`_1`](SDL_GPUSampleCount::_1) | [`SDL_GPU_SAMPLECOUNT_1`] | No multisampling. |
1690/// | [`_2`](SDL_GPUSampleCount::_2) | [`SDL_GPU_SAMPLECOUNT_2`] | MSAA 2x |
1691/// | [`_4`](SDL_GPUSampleCount::_4) | [`SDL_GPU_SAMPLECOUNT_4`] | MSAA 4x |
1692/// | [`_8`](SDL_GPUSampleCount::_8) | [`SDL_GPU_SAMPLECOUNT_8`] | MSAA 8x |
1693#[repr(transparent)]
1694#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
1695pub struct SDL_GPUSampleCount(pub ::core::ffi::c_int);
1696
1697impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUSampleCount {
1698 #[inline(always)]
1699 fn eq(&self, other: &::core::ffi::c_int) -> bool {
1700 &self.0 == other
1701 }
1702}
1703
1704impl ::core::cmp::PartialEq<SDL_GPUSampleCount> for ::core::ffi::c_int {
1705 #[inline(always)]
1706 fn eq(&self, other: &SDL_GPUSampleCount) -> bool {
1707 self == &other.0
1708 }
1709}
1710
1711impl From<SDL_GPUSampleCount> for ::core::ffi::c_int {
1712 #[inline(always)]
1713 fn from(value: SDL_GPUSampleCount) -> Self {
1714 value.0
1715 }
1716}
1717
1718#[cfg(feature = "debug-impls")]
1719impl ::core::fmt::Debug for SDL_GPUSampleCount {
1720 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1721 #[allow(unreachable_patterns)]
1722 f.write_str(match *self {
1723 Self::_1 => "SDL_GPU_SAMPLECOUNT_1",
1724 Self::_2 => "SDL_GPU_SAMPLECOUNT_2",
1725 Self::_4 => "SDL_GPU_SAMPLECOUNT_4",
1726 Self::_8 => "SDL_GPU_SAMPLECOUNT_8",
1727
1728 _ => return write!(f, "SDL_GPUSampleCount({})", self.0),
1729 })
1730 }
1731}
1732
1733impl SDL_GPUSampleCount {
1734 /// No multisampling.
1735 pub const _1: Self = Self((0 as ::core::ffi::c_int));
1736 /// MSAA 2x
1737 pub const _2: Self = Self((1 as ::core::ffi::c_int));
1738 /// MSAA 4x
1739 pub const _4: Self = Self((2 as ::core::ffi::c_int));
1740 /// MSAA 8x
1741 pub const _8: Self = Self((3 as ::core::ffi::c_int));
1742}
1743
1744/// No multisampling.
1745pub const SDL_GPU_SAMPLECOUNT_1: SDL_GPUSampleCount = SDL_GPUSampleCount::_1;
1746/// MSAA 2x
1747pub const SDL_GPU_SAMPLECOUNT_2: SDL_GPUSampleCount = SDL_GPUSampleCount::_2;
1748/// MSAA 4x
1749pub const SDL_GPU_SAMPLECOUNT_4: SDL_GPUSampleCount = SDL_GPUSampleCount::_4;
1750/// MSAA 8x
1751pub const SDL_GPU_SAMPLECOUNT_8: SDL_GPUSampleCount = SDL_GPUSampleCount::_8;
1752
1753#[cfg(feature = "metadata")]
1754impl sdl3_sys::metadata::GroupMetadata for SDL_GPUSampleCount {
1755 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
1756 &crate::metadata::gpu::METADATA_SDL_GPUSampleCount;
1757}
1758
1759/// Specifies the face of a cube map.
1760///
1761/// Can be passed in as the layer field in texture-related structs.
1762///
1763/// ## Availability
1764/// This enum is available since SDL 3.2.0.
1765///
1766/// ## Known values (`sdl3-sys`)
1767/// | Associated constant | Global constant | Description |
1768/// | ------------------- | --------------- | ----------- |
1769/// | [`POSITIVEX`](SDL_GPUCubeMapFace::POSITIVEX) | [`SDL_GPU_CUBEMAPFACE_POSITIVEX`] | |
1770/// | [`NEGATIVEX`](SDL_GPUCubeMapFace::NEGATIVEX) | [`SDL_GPU_CUBEMAPFACE_NEGATIVEX`] | |
1771/// | [`POSITIVEY`](SDL_GPUCubeMapFace::POSITIVEY) | [`SDL_GPU_CUBEMAPFACE_POSITIVEY`] | |
1772/// | [`NEGATIVEY`](SDL_GPUCubeMapFace::NEGATIVEY) | [`SDL_GPU_CUBEMAPFACE_NEGATIVEY`] | |
1773/// | [`POSITIVEZ`](SDL_GPUCubeMapFace::POSITIVEZ) | [`SDL_GPU_CUBEMAPFACE_POSITIVEZ`] | |
1774/// | [`NEGATIVEZ`](SDL_GPUCubeMapFace::NEGATIVEZ) | [`SDL_GPU_CUBEMAPFACE_NEGATIVEZ`] | |
1775#[repr(transparent)]
1776#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
1777pub struct SDL_GPUCubeMapFace(pub ::core::ffi::c_int);
1778
1779impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUCubeMapFace {
1780 #[inline(always)]
1781 fn eq(&self, other: &::core::ffi::c_int) -> bool {
1782 &self.0 == other
1783 }
1784}
1785
1786impl ::core::cmp::PartialEq<SDL_GPUCubeMapFace> for ::core::ffi::c_int {
1787 #[inline(always)]
1788 fn eq(&self, other: &SDL_GPUCubeMapFace) -> bool {
1789 self == &other.0
1790 }
1791}
1792
1793impl From<SDL_GPUCubeMapFace> for ::core::ffi::c_int {
1794 #[inline(always)]
1795 fn from(value: SDL_GPUCubeMapFace) -> Self {
1796 value.0
1797 }
1798}
1799
1800#[cfg(feature = "debug-impls")]
1801impl ::core::fmt::Debug for SDL_GPUCubeMapFace {
1802 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1803 #[allow(unreachable_patterns)]
1804 f.write_str(match *self {
1805 Self::POSITIVEX => "SDL_GPU_CUBEMAPFACE_POSITIVEX",
1806 Self::NEGATIVEX => "SDL_GPU_CUBEMAPFACE_NEGATIVEX",
1807 Self::POSITIVEY => "SDL_GPU_CUBEMAPFACE_POSITIVEY",
1808 Self::NEGATIVEY => "SDL_GPU_CUBEMAPFACE_NEGATIVEY",
1809 Self::POSITIVEZ => "SDL_GPU_CUBEMAPFACE_POSITIVEZ",
1810 Self::NEGATIVEZ => "SDL_GPU_CUBEMAPFACE_NEGATIVEZ",
1811
1812 _ => return write!(f, "SDL_GPUCubeMapFace({})", self.0),
1813 })
1814 }
1815}
1816
1817impl SDL_GPUCubeMapFace {
1818 pub const POSITIVEX: Self = Self((0 as ::core::ffi::c_int));
1819 pub const NEGATIVEX: Self = Self((1 as ::core::ffi::c_int));
1820 pub const POSITIVEY: Self = Self((2 as ::core::ffi::c_int));
1821 pub const NEGATIVEY: Self = Self((3 as ::core::ffi::c_int));
1822 pub const POSITIVEZ: Self = Self((4 as ::core::ffi::c_int));
1823 pub const NEGATIVEZ: Self = Self((5 as ::core::ffi::c_int));
1824}
1825
1826pub const SDL_GPU_CUBEMAPFACE_POSITIVEX: SDL_GPUCubeMapFace = SDL_GPUCubeMapFace::POSITIVEX;
1827pub const SDL_GPU_CUBEMAPFACE_NEGATIVEX: SDL_GPUCubeMapFace = SDL_GPUCubeMapFace::NEGATIVEX;
1828pub const SDL_GPU_CUBEMAPFACE_POSITIVEY: SDL_GPUCubeMapFace = SDL_GPUCubeMapFace::POSITIVEY;
1829pub const SDL_GPU_CUBEMAPFACE_NEGATIVEY: SDL_GPUCubeMapFace = SDL_GPUCubeMapFace::NEGATIVEY;
1830pub const SDL_GPU_CUBEMAPFACE_POSITIVEZ: SDL_GPUCubeMapFace = SDL_GPUCubeMapFace::POSITIVEZ;
1831pub const SDL_GPU_CUBEMAPFACE_NEGATIVEZ: SDL_GPUCubeMapFace = SDL_GPUCubeMapFace::NEGATIVEZ;
1832
1833#[cfg(feature = "metadata")]
1834impl sdl3_sys::metadata::GroupMetadata for SDL_GPUCubeMapFace {
1835 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
1836 &crate::metadata::gpu::METADATA_SDL_GPUCubeMapFace;
1837}
1838
1839/// Specifies how a buffer is intended to be used by the client.
1840///
1841/// A buffer must have at least one usage flag. Note that some usage flag
1842/// combinations are invalid.
1843///
1844/// Unlike textures, READ | WRITE can be used for simultaneous read-write
1845/// usage. The same data synchronization concerns as textures apply.
1846///
1847/// If you use a STORAGE flag, the data in the buffer must respect std140
1848/// layout conventions. In practical terms this means you must ensure that vec3
1849/// and vec4 fields are 16-byte aligned.
1850///
1851/// ## Availability
1852/// This datatype is available since SDL 3.2.0.
1853///
1854/// ## See also
1855/// - [`SDL_CreateGPUBuffer`]
1856///
1857/// ## Known values (`sdl3-sys`)
1858/// | Associated constant | Global constant | Description |
1859/// | ------------------- | --------------- | ----------- |
1860/// | [`VERTEX`](SDL_GPUBufferUsageFlags::VERTEX) | [`SDL_GPU_BUFFERUSAGE_VERTEX`] | Buffer is a vertex buffer. |
1861/// | [`INDEX`](SDL_GPUBufferUsageFlags::INDEX) | [`SDL_GPU_BUFFERUSAGE_INDEX`] | Buffer is an index buffer. |
1862/// | [`INDIRECT`](SDL_GPUBufferUsageFlags::INDIRECT) | [`SDL_GPU_BUFFERUSAGE_INDIRECT`] | Buffer is an indirect buffer. |
1863/// | [`GRAPHICS_STORAGE_READ`](SDL_GPUBufferUsageFlags::GRAPHICS_STORAGE_READ) | [`SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ`] | Buffer supports storage reads in graphics stages. |
1864/// | [`COMPUTE_STORAGE_READ`](SDL_GPUBufferUsageFlags::COMPUTE_STORAGE_READ) | [`SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ`] | Buffer supports storage reads in the compute stage. |
1865/// | [`COMPUTE_STORAGE_WRITE`](SDL_GPUBufferUsageFlags::COMPUTE_STORAGE_WRITE) | [`SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE`] | Buffer supports storage writes in the compute stage. |
1866#[repr(transparent)]
1867#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
1868pub struct SDL_GPUBufferUsageFlags(pub Uint32);
1869
1870impl ::core::cmp::PartialEq<Uint32> for SDL_GPUBufferUsageFlags {
1871 #[inline(always)]
1872 fn eq(&self, other: &Uint32) -> bool {
1873 &self.0 == other
1874 }
1875}
1876
1877impl ::core::cmp::PartialEq<SDL_GPUBufferUsageFlags> for Uint32 {
1878 #[inline(always)]
1879 fn eq(&self, other: &SDL_GPUBufferUsageFlags) -> bool {
1880 self == &other.0
1881 }
1882}
1883
1884impl From<SDL_GPUBufferUsageFlags> for Uint32 {
1885 #[inline(always)]
1886 fn from(value: SDL_GPUBufferUsageFlags) -> Self {
1887 value.0
1888 }
1889}
1890
1891#[cfg(feature = "debug-impls")]
1892impl ::core::fmt::Debug for SDL_GPUBufferUsageFlags {
1893 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
1894 let mut first = true;
1895 let all_bits = 0;
1896 write!(f, "SDL_GPUBufferUsageFlags(")?;
1897 let all_bits = all_bits | Self::VERTEX.0;
1898 if (Self::VERTEX != 0 || self.0 == 0) && *self & Self::VERTEX == Self::VERTEX {
1899 if !first {
1900 write!(f, " | ")?;
1901 }
1902 first = false;
1903 write!(f, "VERTEX")?;
1904 }
1905 let all_bits = all_bits | Self::INDEX.0;
1906 if (Self::INDEX != 0 || self.0 == 0) && *self & Self::INDEX == Self::INDEX {
1907 if !first {
1908 write!(f, " | ")?;
1909 }
1910 first = false;
1911 write!(f, "INDEX")?;
1912 }
1913 let all_bits = all_bits | Self::INDIRECT.0;
1914 if (Self::INDIRECT != 0 || self.0 == 0) && *self & Self::INDIRECT == Self::INDIRECT {
1915 if !first {
1916 write!(f, " | ")?;
1917 }
1918 first = false;
1919 write!(f, "INDIRECT")?;
1920 }
1921 let all_bits = all_bits | Self::GRAPHICS_STORAGE_READ.0;
1922 if (Self::GRAPHICS_STORAGE_READ != 0 || self.0 == 0)
1923 && *self & Self::GRAPHICS_STORAGE_READ == Self::GRAPHICS_STORAGE_READ
1924 {
1925 if !first {
1926 write!(f, " | ")?;
1927 }
1928 first = false;
1929 write!(f, "GRAPHICS_STORAGE_READ")?;
1930 }
1931 let all_bits = all_bits | Self::COMPUTE_STORAGE_READ.0;
1932 if (Self::COMPUTE_STORAGE_READ != 0 || self.0 == 0)
1933 && *self & Self::COMPUTE_STORAGE_READ == Self::COMPUTE_STORAGE_READ
1934 {
1935 if !first {
1936 write!(f, " | ")?;
1937 }
1938 first = false;
1939 write!(f, "COMPUTE_STORAGE_READ")?;
1940 }
1941 let all_bits = all_bits | Self::COMPUTE_STORAGE_WRITE.0;
1942 if (Self::COMPUTE_STORAGE_WRITE != 0 || self.0 == 0)
1943 && *self & Self::COMPUTE_STORAGE_WRITE == Self::COMPUTE_STORAGE_WRITE
1944 {
1945 if !first {
1946 write!(f, " | ")?;
1947 }
1948 first = false;
1949 write!(f, "COMPUTE_STORAGE_WRITE")?;
1950 }
1951
1952 if self.0 & !all_bits != 0 {
1953 if !first {
1954 write!(f, " | ")?;
1955 }
1956 write!(f, "{:#x}", self.0)?;
1957 } else if first {
1958 write!(f, "0")?;
1959 }
1960 write!(f, ")")
1961 }
1962}
1963
1964impl ::core::ops::BitAnd for SDL_GPUBufferUsageFlags {
1965 type Output = Self;
1966
1967 #[inline(always)]
1968 fn bitand(self, rhs: Self) -> Self::Output {
1969 Self(self.0 & rhs.0)
1970 }
1971}
1972
1973impl ::core::ops::BitAndAssign for SDL_GPUBufferUsageFlags {
1974 #[inline(always)]
1975 fn bitand_assign(&mut self, rhs: Self) {
1976 self.0 &= rhs.0;
1977 }
1978}
1979
1980impl ::core::ops::BitOr for SDL_GPUBufferUsageFlags {
1981 type Output = Self;
1982
1983 #[inline(always)]
1984 fn bitor(self, rhs: Self) -> Self::Output {
1985 Self(self.0 | rhs.0)
1986 }
1987}
1988
1989impl ::core::ops::BitOrAssign for SDL_GPUBufferUsageFlags {
1990 #[inline(always)]
1991 fn bitor_assign(&mut self, rhs: Self) {
1992 self.0 |= rhs.0;
1993 }
1994}
1995
1996impl ::core::ops::BitXor for SDL_GPUBufferUsageFlags {
1997 type Output = Self;
1998
1999 #[inline(always)]
2000 fn bitxor(self, rhs: Self) -> Self::Output {
2001 Self(self.0 ^ rhs.0)
2002 }
2003}
2004
2005impl ::core::ops::BitXorAssign for SDL_GPUBufferUsageFlags {
2006 #[inline(always)]
2007 fn bitxor_assign(&mut self, rhs: Self) {
2008 self.0 ^= rhs.0;
2009 }
2010}
2011
2012impl ::core::ops::Not for SDL_GPUBufferUsageFlags {
2013 type Output = Self;
2014
2015 #[inline(always)]
2016 fn not(self) -> Self::Output {
2017 Self(!self.0)
2018 }
2019}
2020
2021impl SDL_GPUBufferUsageFlags {
2022 /// Buffer is a vertex buffer.
2023 pub const VERTEX: Self = Self((1_u32 as Uint32));
2024 /// Buffer is an index buffer.
2025 pub const INDEX: Self = Self((2_u32 as Uint32));
2026 /// Buffer is an indirect buffer.
2027 pub const INDIRECT: Self = Self((4_u32 as Uint32));
2028 /// Buffer supports storage reads in graphics stages.
2029 pub const GRAPHICS_STORAGE_READ: Self = Self((8_u32 as Uint32));
2030 /// Buffer supports storage reads in the compute stage.
2031 pub const COMPUTE_STORAGE_READ: Self = Self((16_u32 as Uint32));
2032 /// Buffer supports storage writes in the compute stage.
2033 pub const COMPUTE_STORAGE_WRITE: Self = Self((32_u32 as Uint32));
2034}
2035
2036/// Buffer is a vertex buffer.
2037pub const SDL_GPU_BUFFERUSAGE_VERTEX: SDL_GPUBufferUsageFlags = SDL_GPUBufferUsageFlags::VERTEX;
2038/// Buffer is an index buffer.
2039pub const SDL_GPU_BUFFERUSAGE_INDEX: SDL_GPUBufferUsageFlags = SDL_GPUBufferUsageFlags::INDEX;
2040/// Buffer is an indirect buffer.
2041pub const SDL_GPU_BUFFERUSAGE_INDIRECT: SDL_GPUBufferUsageFlags = SDL_GPUBufferUsageFlags::INDIRECT;
2042/// Buffer supports storage reads in graphics stages.
2043pub const SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ: SDL_GPUBufferUsageFlags =
2044 SDL_GPUBufferUsageFlags::GRAPHICS_STORAGE_READ;
2045/// Buffer supports storage reads in the compute stage.
2046pub const SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ: SDL_GPUBufferUsageFlags =
2047 SDL_GPUBufferUsageFlags::COMPUTE_STORAGE_READ;
2048/// Buffer supports storage writes in the compute stage.
2049pub const SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE: SDL_GPUBufferUsageFlags =
2050 SDL_GPUBufferUsageFlags::COMPUTE_STORAGE_WRITE;
2051
2052#[cfg(feature = "metadata")]
2053impl sdl3_sys::metadata::GroupMetadata for SDL_GPUBufferUsageFlags {
2054 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
2055 &crate::metadata::gpu::METADATA_SDL_GPUBufferUsageFlags;
2056}
2057
2058/// Specifies how a transfer buffer is intended to be used by the client.
2059///
2060/// Note that mapping and copying FROM an upload transfer buffer or TO a
2061/// download transfer buffer is undefined behavior.
2062///
2063/// ## Availability
2064/// This enum is available since SDL 3.2.0.
2065///
2066/// ## See also
2067/// - [`SDL_CreateGPUTransferBuffer`]
2068///
2069/// ## Known values (`sdl3-sys`)
2070/// | Associated constant | Global constant | Description |
2071/// | ------------------- | --------------- | ----------- |
2072/// | [`UPLOAD`](SDL_GPUTransferBufferUsage::UPLOAD) | [`SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD`] | |
2073/// | [`DOWNLOAD`](SDL_GPUTransferBufferUsage::DOWNLOAD) | [`SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD`] | |
2074#[repr(transparent)]
2075#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
2076pub struct SDL_GPUTransferBufferUsage(pub ::core::ffi::c_int);
2077
2078impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUTransferBufferUsage {
2079 #[inline(always)]
2080 fn eq(&self, other: &::core::ffi::c_int) -> bool {
2081 &self.0 == other
2082 }
2083}
2084
2085impl ::core::cmp::PartialEq<SDL_GPUTransferBufferUsage> for ::core::ffi::c_int {
2086 #[inline(always)]
2087 fn eq(&self, other: &SDL_GPUTransferBufferUsage) -> bool {
2088 self == &other.0
2089 }
2090}
2091
2092impl From<SDL_GPUTransferBufferUsage> for ::core::ffi::c_int {
2093 #[inline(always)]
2094 fn from(value: SDL_GPUTransferBufferUsage) -> Self {
2095 value.0
2096 }
2097}
2098
2099#[cfg(feature = "debug-impls")]
2100impl ::core::fmt::Debug for SDL_GPUTransferBufferUsage {
2101 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2102 #[allow(unreachable_patterns)]
2103 f.write_str(match *self {
2104 Self::UPLOAD => "SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD",
2105 Self::DOWNLOAD => "SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD",
2106
2107 _ => return write!(f, "SDL_GPUTransferBufferUsage({})", self.0),
2108 })
2109 }
2110}
2111
2112impl SDL_GPUTransferBufferUsage {
2113 pub const UPLOAD: Self = Self((0 as ::core::ffi::c_int));
2114 pub const DOWNLOAD: Self = Self((1 as ::core::ffi::c_int));
2115}
2116
2117pub const SDL_GPU_TRANSFERBUFFERUSAGE_UPLOAD: SDL_GPUTransferBufferUsage =
2118 SDL_GPUTransferBufferUsage::UPLOAD;
2119pub const SDL_GPU_TRANSFERBUFFERUSAGE_DOWNLOAD: SDL_GPUTransferBufferUsage =
2120 SDL_GPUTransferBufferUsage::DOWNLOAD;
2121
2122#[cfg(feature = "metadata")]
2123impl sdl3_sys::metadata::GroupMetadata for SDL_GPUTransferBufferUsage {
2124 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
2125 &crate::metadata::gpu::METADATA_SDL_GPUTransferBufferUsage;
2126}
2127
2128/// Specifies which stage a shader program corresponds to.
2129///
2130/// ## Availability
2131/// This enum is available since SDL 3.2.0.
2132///
2133/// ## See also
2134/// - [`SDL_CreateGPUShader`]
2135///
2136/// ## Known values (`sdl3-sys`)
2137/// | Associated constant | Global constant | Description |
2138/// | ------------------- | --------------- | ----------- |
2139/// | [`VERTEX`](SDL_GPUShaderStage::VERTEX) | [`SDL_GPU_SHADERSTAGE_VERTEX`] | |
2140/// | [`FRAGMENT`](SDL_GPUShaderStage::FRAGMENT) | [`SDL_GPU_SHADERSTAGE_FRAGMENT`] | |
2141#[repr(transparent)]
2142#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
2143pub struct SDL_GPUShaderStage(pub ::core::ffi::c_int);
2144
2145impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUShaderStage {
2146 #[inline(always)]
2147 fn eq(&self, other: &::core::ffi::c_int) -> bool {
2148 &self.0 == other
2149 }
2150}
2151
2152impl ::core::cmp::PartialEq<SDL_GPUShaderStage> for ::core::ffi::c_int {
2153 #[inline(always)]
2154 fn eq(&self, other: &SDL_GPUShaderStage) -> bool {
2155 self == &other.0
2156 }
2157}
2158
2159impl From<SDL_GPUShaderStage> for ::core::ffi::c_int {
2160 #[inline(always)]
2161 fn from(value: SDL_GPUShaderStage) -> Self {
2162 value.0
2163 }
2164}
2165
2166#[cfg(feature = "debug-impls")]
2167impl ::core::fmt::Debug for SDL_GPUShaderStage {
2168 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2169 #[allow(unreachable_patterns)]
2170 f.write_str(match *self {
2171 Self::VERTEX => "SDL_GPU_SHADERSTAGE_VERTEX",
2172 Self::FRAGMENT => "SDL_GPU_SHADERSTAGE_FRAGMENT",
2173
2174 _ => return write!(f, "SDL_GPUShaderStage({})", self.0),
2175 })
2176 }
2177}
2178
2179impl SDL_GPUShaderStage {
2180 pub const VERTEX: Self = Self((0 as ::core::ffi::c_int));
2181 pub const FRAGMENT: Self = Self((1 as ::core::ffi::c_int));
2182}
2183
2184pub const SDL_GPU_SHADERSTAGE_VERTEX: SDL_GPUShaderStage = SDL_GPUShaderStage::VERTEX;
2185pub const SDL_GPU_SHADERSTAGE_FRAGMENT: SDL_GPUShaderStage = SDL_GPUShaderStage::FRAGMENT;
2186
2187#[cfg(feature = "metadata")]
2188impl sdl3_sys::metadata::GroupMetadata for SDL_GPUShaderStage {
2189 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
2190 &crate::metadata::gpu::METADATA_SDL_GPUShaderStage;
2191}
2192
2193/// Specifies the format of shader code.
2194///
2195/// Each format corresponds to a specific backend that accepts it.
2196///
2197/// ## Availability
2198/// This datatype is available since SDL 3.2.0.
2199///
2200/// ## See also
2201/// - [`SDL_CreateGPUShader`]
2202///
2203/// ## Known values (`sdl3-sys`)
2204/// | Associated constant | Global constant | Description |
2205/// | ------------------- | --------------- | ----------- |
2206/// | [`INVALID`](SDL_GPUShaderFormat::INVALID) | [`SDL_GPU_SHADERFORMAT_INVALID`] | |
2207/// | [`PRIVATE`](SDL_GPUShaderFormat::PRIVATE) | [`SDL_GPU_SHADERFORMAT_PRIVATE`] | Shaders for NDA'd platforms. |
2208/// | [`SPIRV`](SDL_GPUShaderFormat::SPIRV) | [`SDL_GPU_SHADERFORMAT_SPIRV`] | SPIR-V shaders for Vulkan. |
2209/// | [`DXBC`](SDL_GPUShaderFormat::DXBC) | [`SDL_GPU_SHADERFORMAT_DXBC`] | DXBC SM5_1 shaders for D3D12. |
2210/// | [`DXIL`](SDL_GPUShaderFormat::DXIL) | [`SDL_GPU_SHADERFORMAT_DXIL`] | DXIL SM6_0 shaders for D3D12. |
2211/// | [`MSL`](SDL_GPUShaderFormat::MSL) | [`SDL_GPU_SHADERFORMAT_MSL`] | MSL shaders for Metal. |
2212/// | [`METALLIB`](SDL_GPUShaderFormat::METALLIB) | [`SDL_GPU_SHADERFORMAT_METALLIB`] | Precompiled metallib shaders for Metal. |
2213#[repr(transparent)]
2214#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
2215pub struct SDL_GPUShaderFormat(pub Uint32);
2216
2217impl ::core::cmp::PartialEq<Uint32> for SDL_GPUShaderFormat {
2218 #[inline(always)]
2219 fn eq(&self, other: &Uint32) -> bool {
2220 &self.0 == other
2221 }
2222}
2223
2224impl ::core::cmp::PartialEq<SDL_GPUShaderFormat> for Uint32 {
2225 #[inline(always)]
2226 fn eq(&self, other: &SDL_GPUShaderFormat) -> bool {
2227 self == &other.0
2228 }
2229}
2230
2231impl From<SDL_GPUShaderFormat> for Uint32 {
2232 #[inline(always)]
2233 fn from(value: SDL_GPUShaderFormat) -> Self {
2234 value.0
2235 }
2236}
2237
2238#[cfg(feature = "debug-impls")]
2239impl ::core::fmt::Debug for SDL_GPUShaderFormat {
2240 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2241 let mut first = true;
2242 let all_bits = 0;
2243 write!(f, "SDL_GPUShaderFormat(")?;
2244 let all_bits = all_bits | Self::INVALID.0;
2245 if (Self::INVALID != 0 || self.0 == 0) && *self & Self::INVALID == Self::INVALID {
2246 if !first {
2247 write!(f, " | ")?;
2248 }
2249 first = false;
2250 write!(f, "INVALID")?;
2251 }
2252 let all_bits = all_bits | Self::PRIVATE.0;
2253 if (Self::PRIVATE != 0 || self.0 == 0) && *self & Self::PRIVATE == Self::PRIVATE {
2254 if !first {
2255 write!(f, " | ")?;
2256 }
2257 first = false;
2258 write!(f, "PRIVATE")?;
2259 }
2260 let all_bits = all_bits | Self::SPIRV.0;
2261 if (Self::SPIRV != 0 || self.0 == 0) && *self & Self::SPIRV == Self::SPIRV {
2262 if !first {
2263 write!(f, " | ")?;
2264 }
2265 first = false;
2266 write!(f, "SPIRV")?;
2267 }
2268 let all_bits = all_bits | Self::DXBC.0;
2269 if (Self::DXBC != 0 || self.0 == 0) && *self & Self::DXBC == Self::DXBC {
2270 if !first {
2271 write!(f, " | ")?;
2272 }
2273 first = false;
2274 write!(f, "DXBC")?;
2275 }
2276 let all_bits = all_bits | Self::DXIL.0;
2277 if (Self::DXIL != 0 || self.0 == 0) && *self & Self::DXIL == Self::DXIL {
2278 if !first {
2279 write!(f, " | ")?;
2280 }
2281 first = false;
2282 write!(f, "DXIL")?;
2283 }
2284 let all_bits = all_bits | Self::MSL.0;
2285 if (Self::MSL != 0 || self.0 == 0) && *self & Self::MSL == Self::MSL {
2286 if !first {
2287 write!(f, " | ")?;
2288 }
2289 first = false;
2290 write!(f, "MSL")?;
2291 }
2292 let all_bits = all_bits | Self::METALLIB.0;
2293 if (Self::METALLIB != 0 || self.0 == 0) && *self & Self::METALLIB == Self::METALLIB {
2294 if !first {
2295 write!(f, " | ")?;
2296 }
2297 first = false;
2298 write!(f, "METALLIB")?;
2299 }
2300
2301 if self.0 & !all_bits != 0 {
2302 if !first {
2303 write!(f, " | ")?;
2304 }
2305 write!(f, "{:#x}", self.0)?;
2306 } else if first {
2307 write!(f, "0")?;
2308 }
2309 write!(f, ")")
2310 }
2311}
2312
2313impl ::core::ops::BitAnd for SDL_GPUShaderFormat {
2314 type Output = Self;
2315
2316 #[inline(always)]
2317 fn bitand(self, rhs: Self) -> Self::Output {
2318 Self(self.0 & rhs.0)
2319 }
2320}
2321
2322impl ::core::ops::BitAndAssign for SDL_GPUShaderFormat {
2323 #[inline(always)]
2324 fn bitand_assign(&mut self, rhs: Self) {
2325 self.0 &= rhs.0;
2326 }
2327}
2328
2329impl ::core::ops::BitOr for SDL_GPUShaderFormat {
2330 type Output = Self;
2331
2332 #[inline(always)]
2333 fn bitor(self, rhs: Self) -> Self::Output {
2334 Self(self.0 | rhs.0)
2335 }
2336}
2337
2338impl ::core::ops::BitOrAssign for SDL_GPUShaderFormat {
2339 #[inline(always)]
2340 fn bitor_assign(&mut self, rhs: Self) {
2341 self.0 |= rhs.0;
2342 }
2343}
2344
2345impl ::core::ops::BitXor for SDL_GPUShaderFormat {
2346 type Output = Self;
2347
2348 #[inline(always)]
2349 fn bitxor(self, rhs: Self) -> Self::Output {
2350 Self(self.0 ^ rhs.0)
2351 }
2352}
2353
2354impl ::core::ops::BitXorAssign for SDL_GPUShaderFormat {
2355 #[inline(always)]
2356 fn bitxor_assign(&mut self, rhs: Self) {
2357 self.0 ^= rhs.0;
2358 }
2359}
2360
2361impl ::core::ops::Not for SDL_GPUShaderFormat {
2362 type Output = Self;
2363
2364 #[inline(always)]
2365 fn not(self) -> Self::Output {
2366 Self(!self.0)
2367 }
2368}
2369
2370impl SDL_GPUShaderFormat {
2371 pub const INVALID: Self = Self((0 as Uint32));
2372 /// Shaders for NDA'd platforms.
2373 pub const PRIVATE: Self = Self((1_u32 as Uint32));
2374 /// SPIR-V shaders for Vulkan.
2375 pub const SPIRV: Self = Self((2_u32 as Uint32));
2376 /// DXBC SM5_1 shaders for D3D12.
2377 pub const DXBC: Self = Self((4_u32 as Uint32));
2378 /// DXIL SM6_0 shaders for D3D12.
2379 pub const DXIL: Self = Self((8_u32 as Uint32));
2380 /// MSL shaders for Metal.
2381 pub const MSL: Self = Self((16_u32 as Uint32));
2382 /// Precompiled metallib shaders for Metal.
2383 pub const METALLIB: Self = Self((32_u32 as Uint32));
2384}
2385
2386pub const SDL_GPU_SHADERFORMAT_INVALID: SDL_GPUShaderFormat = SDL_GPUShaderFormat::INVALID;
2387/// Shaders for NDA'd platforms.
2388pub const SDL_GPU_SHADERFORMAT_PRIVATE: SDL_GPUShaderFormat = SDL_GPUShaderFormat::PRIVATE;
2389/// SPIR-V shaders for Vulkan.
2390pub const SDL_GPU_SHADERFORMAT_SPIRV: SDL_GPUShaderFormat = SDL_GPUShaderFormat::SPIRV;
2391/// DXBC SM5_1 shaders for D3D12.
2392pub const SDL_GPU_SHADERFORMAT_DXBC: SDL_GPUShaderFormat = SDL_GPUShaderFormat::DXBC;
2393/// DXIL SM6_0 shaders for D3D12.
2394pub const SDL_GPU_SHADERFORMAT_DXIL: SDL_GPUShaderFormat = SDL_GPUShaderFormat::DXIL;
2395/// MSL shaders for Metal.
2396pub const SDL_GPU_SHADERFORMAT_MSL: SDL_GPUShaderFormat = SDL_GPUShaderFormat::MSL;
2397/// Precompiled metallib shaders for Metal.
2398pub const SDL_GPU_SHADERFORMAT_METALLIB: SDL_GPUShaderFormat = SDL_GPUShaderFormat::METALLIB;
2399
2400#[cfg(feature = "metadata")]
2401impl sdl3_sys::metadata::GroupMetadata for SDL_GPUShaderFormat {
2402 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
2403 &crate::metadata::gpu::METADATA_SDL_GPUShaderFormat;
2404}
2405
2406/// Specifies the format of a vertex attribute.
2407///
2408/// ## Availability
2409/// This enum is available since SDL 3.2.0.
2410///
2411/// ## See also
2412/// - [`SDL_CreateGPUGraphicsPipeline`]
2413///
2414/// ## Known values (`sdl3-sys`)
2415/// | Associated constant | Global constant | Description |
2416/// | ------------------- | --------------- | ----------- |
2417/// | [`INVALID`](SDL_GPUVertexElementFormat::INVALID) | [`SDL_GPU_VERTEXELEMENTFORMAT_INVALID`] | |
2418/// | [`INT`](SDL_GPUVertexElementFormat::INT) | [`SDL_GPU_VERTEXELEMENTFORMAT_INT`] | |
2419/// | [`INT2`](SDL_GPUVertexElementFormat::INT2) | [`SDL_GPU_VERTEXELEMENTFORMAT_INT2`] | |
2420/// | [`INT3`](SDL_GPUVertexElementFormat::INT3) | [`SDL_GPU_VERTEXELEMENTFORMAT_INT3`] | |
2421/// | [`INT4`](SDL_GPUVertexElementFormat::INT4) | [`SDL_GPU_VERTEXELEMENTFORMAT_INT4`] | |
2422/// | [`UINT`](SDL_GPUVertexElementFormat::UINT) | [`SDL_GPU_VERTEXELEMENTFORMAT_UINT`] | |
2423/// | [`UINT2`](SDL_GPUVertexElementFormat::UINT2) | [`SDL_GPU_VERTEXELEMENTFORMAT_UINT2`] | |
2424/// | [`UINT3`](SDL_GPUVertexElementFormat::UINT3) | [`SDL_GPU_VERTEXELEMENTFORMAT_UINT3`] | |
2425/// | [`UINT4`](SDL_GPUVertexElementFormat::UINT4) | [`SDL_GPU_VERTEXELEMENTFORMAT_UINT4`] | |
2426/// | [`FLOAT`](SDL_GPUVertexElementFormat::FLOAT) | [`SDL_GPU_VERTEXELEMENTFORMAT_FLOAT`] | |
2427/// | [`FLOAT2`](SDL_GPUVertexElementFormat::FLOAT2) | [`SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2`] | |
2428/// | [`FLOAT3`](SDL_GPUVertexElementFormat::FLOAT3) | [`SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3`] | |
2429/// | [`FLOAT4`](SDL_GPUVertexElementFormat::FLOAT4) | [`SDL_GPU_VERTEXELEMENTFORMAT_FLOAT4`] | |
2430/// | [`BYTE2`](SDL_GPUVertexElementFormat::BYTE2) | [`SDL_GPU_VERTEXELEMENTFORMAT_BYTE2`] | |
2431/// | [`BYTE4`](SDL_GPUVertexElementFormat::BYTE4) | [`SDL_GPU_VERTEXELEMENTFORMAT_BYTE4`] | |
2432/// | [`UBYTE2`](SDL_GPUVertexElementFormat::UBYTE2) | [`SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2`] | |
2433/// | [`UBYTE4`](SDL_GPUVertexElementFormat::UBYTE4) | [`SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4`] | |
2434/// | [`BYTE2_NORM`](SDL_GPUVertexElementFormat::BYTE2_NORM) | [`SDL_GPU_VERTEXELEMENTFORMAT_BYTE2_NORM`] | |
2435/// | [`BYTE4_NORM`](SDL_GPUVertexElementFormat::BYTE4_NORM) | [`SDL_GPU_VERTEXELEMENTFORMAT_BYTE4_NORM`] | |
2436/// | [`UBYTE2_NORM`](SDL_GPUVertexElementFormat::UBYTE2_NORM) | [`SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM`] | |
2437/// | [`UBYTE4_NORM`](SDL_GPUVertexElementFormat::UBYTE4_NORM) | [`SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM`] | |
2438/// | [`SHORT2`](SDL_GPUVertexElementFormat::SHORT2) | [`SDL_GPU_VERTEXELEMENTFORMAT_SHORT2`] | |
2439/// | [`SHORT4`](SDL_GPUVertexElementFormat::SHORT4) | [`SDL_GPU_VERTEXELEMENTFORMAT_SHORT4`] | |
2440/// | [`USHORT2`](SDL_GPUVertexElementFormat::USHORT2) | [`SDL_GPU_VERTEXELEMENTFORMAT_USHORT2`] | |
2441/// | [`USHORT4`](SDL_GPUVertexElementFormat::USHORT4) | [`SDL_GPU_VERTEXELEMENTFORMAT_USHORT4`] | |
2442/// | [`SHORT2_NORM`](SDL_GPUVertexElementFormat::SHORT2_NORM) | [`SDL_GPU_VERTEXELEMENTFORMAT_SHORT2_NORM`] | |
2443/// | [`SHORT4_NORM`](SDL_GPUVertexElementFormat::SHORT4_NORM) | [`SDL_GPU_VERTEXELEMENTFORMAT_SHORT4_NORM`] | |
2444/// | [`USHORT2_NORM`](SDL_GPUVertexElementFormat::USHORT2_NORM) | [`SDL_GPU_VERTEXELEMENTFORMAT_USHORT2_NORM`] | |
2445/// | [`USHORT4_NORM`](SDL_GPUVertexElementFormat::USHORT4_NORM) | [`SDL_GPU_VERTEXELEMENTFORMAT_USHORT4_NORM`] | |
2446/// | [`HALF2`](SDL_GPUVertexElementFormat::HALF2) | [`SDL_GPU_VERTEXELEMENTFORMAT_HALF2`] | |
2447/// | [`HALF4`](SDL_GPUVertexElementFormat::HALF4) | [`SDL_GPU_VERTEXELEMENTFORMAT_HALF4`] | |
2448#[repr(transparent)]
2449#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
2450pub struct SDL_GPUVertexElementFormat(pub ::core::ffi::c_int);
2451
2452impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUVertexElementFormat {
2453 #[inline(always)]
2454 fn eq(&self, other: &::core::ffi::c_int) -> bool {
2455 &self.0 == other
2456 }
2457}
2458
2459impl ::core::cmp::PartialEq<SDL_GPUVertexElementFormat> for ::core::ffi::c_int {
2460 #[inline(always)]
2461 fn eq(&self, other: &SDL_GPUVertexElementFormat) -> bool {
2462 self == &other.0
2463 }
2464}
2465
2466impl From<SDL_GPUVertexElementFormat> for ::core::ffi::c_int {
2467 #[inline(always)]
2468 fn from(value: SDL_GPUVertexElementFormat) -> Self {
2469 value.0
2470 }
2471}
2472
2473#[cfg(feature = "debug-impls")]
2474impl ::core::fmt::Debug for SDL_GPUVertexElementFormat {
2475 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2476 #[allow(unreachable_patterns)]
2477 f.write_str(match *self {
2478 Self::INVALID => "SDL_GPU_VERTEXELEMENTFORMAT_INVALID",
2479 Self::INT => "SDL_GPU_VERTEXELEMENTFORMAT_INT",
2480 Self::INT2 => "SDL_GPU_VERTEXELEMENTFORMAT_INT2",
2481 Self::INT3 => "SDL_GPU_VERTEXELEMENTFORMAT_INT3",
2482 Self::INT4 => "SDL_GPU_VERTEXELEMENTFORMAT_INT4",
2483 Self::UINT => "SDL_GPU_VERTEXELEMENTFORMAT_UINT",
2484 Self::UINT2 => "SDL_GPU_VERTEXELEMENTFORMAT_UINT2",
2485 Self::UINT3 => "SDL_GPU_VERTEXELEMENTFORMAT_UINT3",
2486 Self::UINT4 => "SDL_GPU_VERTEXELEMENTFORMAT_UINT4",
2487 Self::FLOAT => "SDL_GPU_VERTEXELEMENTFORMAT_FLOAT",
2488 Self::FLOAT2 => "SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2",
2489 Self::FLOAT3 => "SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3",
2490 Self::FLOAT4 => "SDL_GPU_VERTEXELEMENTFORMAT_FLOAT4",
2491 Self::BYTE2 => "SDL_GPU_VERTEXELEMENTFORMAT_BYTE2",
2492 Self::BYTE4 => "SDL_GPU_VERTEXELEMENTFORMAT_BYTE4",
2493 Self::UBYTE2 => "SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2",
2494 Self::UBYTE4 => "SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4",
2495 Self::BYTE2_NORM => "SDL_GPU_VERTEXELEMENTFORMAT_BYTE2_NORM",
2496 Self::BYTE4_NORM => "SDL_GPU_VERTEXELEMENTFORMAT_BYTE4_NORM",
2497 Self::UBYTE2_NORM => "SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM",
2498 Self::UBYTE4_NORM => "SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM",
2499 Self::SHORT2 => "SDL_GPU_VERTEXELEMENTFORMAT_SHORT2",
2500 Self::SHORT4 => "SDL_GPU_VERTEXELEMENTFORMAT_SHORT4",
2501 Self::USHORT2 => "SDL_GPU_VERTEXELEMENTFORMAT_USHORT2",
2502 Self::USHORT4 => "SDL_GPU_VERTEXELEMENTFORMAT_USHORT4",
2503 Self::SHORT2_NORM => "SDL_GPU_VERTEXELEMENTFORMAT_SHORT2_NORM",
2504 Self::SHORT4_NORM => "SDL_GPU_VERTEXELEMENTFORMAT_SHORT4_NORM",
2505 Self::USHORT2_NORM => "SDL_GPU_VERTEXELEMENTFORMAT_USHORT2_NORM",
2506 Self::USHORT4_NORM => "SDL_GPU_VERTEXELEMENTFORMAT_USHORT4_NORM",
2507 Self::HALF2 => "SDL_GPU_VERTEXELEMENTFORMAT_HALF2",
2508 Self::HALF4 => "SDL_GPU_VERTEXELEMENTFORMAT_HALF4",
2509
2510 _ => return write!(f, "SDL_GPUVertexElementFormat({})", self.0),
2511 })
2512 }
2513}
2514
2515impl SDL_GPUVertexElementFormat {
2516 pub const INVALID: Self = Self((0 as ::core::ffi::c_int));
2517 pub const INT: Self = Self((1 as ::core::ffi::c_int));
2518 pub const INT2: Self = Self((2 as ::core::ffi::c_int));
2519 pub const INT3: Self = Self((3 as ::core::ffi::c_int));
2520 pub const INT4: Self = Self((4 as ::core::ffi::c_int));
2521 pub const UINT: Self = Self((5 as ::core::ffi::c_int));
2522 pub const UINT2: Self = Self((6 as ::core::ffi::c_int));
2523 pub const UINT3: Self = Self((7 as ::core::ffi::c_int));
2524 pub const UINT4: Self = Self((8 as ::core::ffi::c_int));
2525 pub const FLOAT: Self = Self((9 as ::core::ffi::c_int));
2526 pub const FLOAT2: Self = Self((10 as ::core::ffi::c_int));
2527 pub const FLOAT3: Self = Self((11 as ::core::ffi::c_int));
2528 pub const FLOAT4: Self = Self((12 as ::core::ffi::c_int));
2529 pub const BYTE2: Self = Self((13 as ::core::ffi::c_int));
2530 pub const BYTE4: Self = Self((14 as ::core::ffi::c_int));
2531 pub const UBYTE2: Self = Self((15 as ::core::ffi::c_int));
2532 pub const UBYTE4: Self = Self((16 as ::core::ffi::c_int));
2533 pub const BYTE2_NORM: Self = Self((17 as ::core::ffi::c_int));
2534 pub const BYTE4_NORM: Self = Self((18 as ::core::ffi::c_int));
2535 pub const UBYTE2_NORM: Self = Self((19 as ::core::ffi::c_int));
2536 pub const UBYTE4_NORM: Self = Self((20 as ::core::ffi::c_int));
2537 pub const SHORT2: Self = Self((21 as ::core::ffi::c_int));
2538 pub const SHORT4: Self = Self((22 as ::core::ffi::c_int));
2539 pub const USHORT2: Self = Self((23 as ::core::ffi::c_int));
2540 pub const USHORT4: Self = Self((24 as ::core::ffi::c_int));
2541 pub const SHORT2_NORM: Self = Self((25 as ::core::ffi::c_int));
2542 pub const SHORT4_NORM: Self = Self((26 as ::core::ffi::c_int));
2543 pub const USHORT2_NORM: Self = Self((27 as ::core::ffi::c_int));
2544 pub const USHORT4_NORM: Self = Self((28 as ::core::ffi::c_int));
2545 pub const HALF2: Self = Self((29 as ::core::ffi::c_int));
2546 pub const HALF4: Self = Self((30 as ::core::ffi::c_int));
2547}
2548
2549pub const SDL_GPU_VERTEXELEMENTFORMAT_INVALID: SDL_GPUVertexElementFormat =
2550 SDL_GPUVertexElementFormat::INVALID;
2551pub const SDL_GPU_VERTEXELEMENTFORMAT_INT: SDL_GPUVertexElementFormat =
2552 SDL_GPUVertexElementFormat::INT;
2553pub const SDL_GPU_VERTEXELEMENTFORMAT_INT2: SDL_GPUVertexElementFormat =
2554 SDL_GPUVertexElementFormat::INT2;
2555pub const SDL_GPU_VERTEXELEMENTFORMAT_INT3: SDL_GPUVertexElementFormat =
2556 SDL_GPUVertexElementFormat::INT3;
2557pub const SDL_GPU_VERTEXELEMENTFORMAT_INT4: SDL_GPUVertexElementFormat =
2558 SDL_GPUVertexElementFormat::INT4;
2559pub const SDL_GPU_VERTEXELEMENTFORMAT_UINT: SDL_GPUVertexElementFormat =
2560 SDL_GPUVertexElementFormat::UINT;
2561pub const SDL_GPU_VERTEXELEMENTFORMAT_UINT2: SDL_GPUVertexElementFormat =
2562 SDL_GPUVertexElementFormat::UINT2;
2563pub const SDL_GPU_VERTEXELEMENTFORMAT_UINT3: SDL_GPUVertexElementFormat =
2564 SDL_GPUVertexElementFormat::UINT3;
2565pub const SDL_GPU_VERTEXELEMENTFORMAT_UINT4: SDL_GPUVertexElementFormat =
2566 SDL_GPUVertexElementFormat::UINT4;
2567pub const SDL_GPU_VERTEXELEMENTFORMAT_FLOAT: SDL_GPUVertexElementFormat =
2568 SDL_GPUVertexElementFormat::FLOAT;
2569pub const SDL_GPU_VERTEXELEMENTFORMAT_FLOAT2: SDL_GPUVertexElementFormat =
2570 SDL_GPUVertexElementFormat::FLOAT2;
2571pub const SDL_GPU_VERTEXELEMENTFORMAT_FLOAT3: SDL_GPUVertexElementFormat =
2572 SDL_GPUVertexElementFormat::FLOAT3;
2573pub const SDL_GPU_VERTEXELEMENTFORMAT_FLOAT4: SDL_GPUVertexElementFormat =
2574 SDL_GPUVertexElementFormat::FLOAT4;
2575pub const SDL_GPU_VERTEXELEMENTFORMAT_BYTE2: SDL_GPUVertexElementFormat =
2576 SDL_GPUVertexElementFormat::BYTE2;
2577pub const SDL_GPU_VERTEXELEMENTFORMAT_BYTE4: SDL_GPUVertexElementFormat =
2578 SDL_GPUVertexElementFormat::BYTE4;
2579pub const SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2: SDL_GPUVertexElementFormat =
2580 SDL_GPUVertexElementFormat::UBYTE2;
2581pub const SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4: SDL_GPUVertexElementFormat =
2582 SDL_GPUVertexElementFormat::UBYTE4;
2583pub const SDL_GPU_VERTEXELEMENTFORMAT_BYTE2_NORM: SDL_GPUVertexElementFormat =
2584 SDL_GPUVertexElementFormat::BYTE2_NORM;
2585pub const SDL_GPU_VERTEXELEMENTFORMAT_BYTE4_NORM: SDL_GPUVertexElementFormat =
2586 SDL_GPUVertexElementFormat::BYTE4_NORM;
2587pub const SDL_GPU_VERTEXELEMENTFORMAT_UBYTE2_NORM: SDL_GPUVertexElementFormat =
2588 SDL_GPUVertexElementFormat::UBYTE2_NORM;
2589pub const SDL_GPU_VERTEXELEMENTFORMAT_UBYTE4_NORM: SDL_GPUVertexElementFormat =
2590 SDL_GPUVertexElementFormat::UBYTE4_NORM;
2591pub const SDL_GPU_VERTEXELEMENTFORMAT_SHORT2: SDL_GPUVertexElementFormat =
2592 SDL_GPUVertexElementFormat::SHORT2;
2593pub const SDL_GPU_VERTEXELEMENTFORMAT_SHORT4: SDL_GPUVertexElementFormat =
2594 SDL_GPUVertexElementFormat::SHORT4;
2595pub const SDL_GPU_VERTEXELEMENTFORMAT_USHORT2: SDL_GPUVertexElementFormat =
2596 SDL_GPUVertexElementFormat::USHORT2;
2597pub const SDL_GPU_VERTEXELEMENTFORMAT_USHORT4: SDL_GPUVertexElementFormat =
2598 SDL_GPUVertexElementFormat::USHORT4;
2599pub const SDL_GPU_VERTEXELEMENTFORMAT_SHORT2_NORM: SDL_GPUVertexElementFormat =
2600 SDL_GPUVertexElementFormat::SHORT2_NORM;
2601pub const SDL_GPU_VERTEXELEMENTFORMAT_SHORT4_NORM: SDL_GPUVertexElementFormat =
2602 SDL_GPUVertexElementFormat::SHORT4_NORM;
2603pub const SDL_GPU_VERTEXELEMENTFORMAT_USHORT2_NORM: SDL_GPUVertexElementFormat =
2604 SDL_GPUVertexElementFormat::USHORT2_NORM;
2605pub const SDL_GPU_VERTEXELEMENTFORMAT_USHORT4_NORM: SDL_GPUVertexElementFormat =
2606 SDL_GPUVertexElementFormat::USHORT4_NORM;
2607pub const SDL_GPU_VERTEXELEMENTFORMAT_HALF2: SDL_GPUVertexElementFormat =
2608 SDL_GPUVertexElementFormat::HALF2;
2609pub const SDL_GPU_VERTEXELEMENTFORMAT_HALF4: SDL_GPUVertexElementFormat =
2610 SDL_GPUVertexElementFormat::HALF4;
2611
2612#[cfg(feature = "metadata")]
2613impl sdl3_sys::metadata::GroupMetadata for SDL_GPUVertexElementFormat {
2614 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
2615 &crate::metadata::gpu::METADATA_SDL_GPUVertexElementFormat;
2616}
2617
2618/// Specifies the rate at which vertex attributes are pulled from buffers.
2619///
2620/// ## Availability
2621/// This enum is available since SDL 3.2.0.
2622///
2623/// ## See also
2624/// - [`SDL_CreateGPUGraphicsPipeline`]
2625///
2626/// ## Known values (`sdl3-sys`)
2627/// | Associated constant | Global constant | Description |
2628/// | ------------------- | --------------- | ----------- |
2629/// | [`VERTEX`](SDL_GPUVertexInputRate::VERTEX) | [`SDL_GPU_VERTEXINPUTRATE_VERTEX`] | Attribute addressing is a function of the vertex index. |
2630/// | [`INSTANCE`](SDL_GPUVertexInputRate::INSTANCE) | [`SDL_GPU_VERTEXINPUTRATE_INSTANCE`] | Attribute addressing is a function of the instance index. |
2631#[repr(transparent)]
2632#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
2633pub struct SDL_GPUVertexInputRate(pub ::core::ffi::c_int);
2634
2635impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUVertexInputRate {
2636 #[inline(always)]
2637 fn eq(&self, other: &::core::ffi::c_int) -> bool {
2638 &self.0 == other
2639 }
2640}
2641
2642impl ::core::cmp::PartialEq<SDL_GPUVertexInputRate> for ::core::ffi::c_int {
2643 #[inline(always)]
2644 fn eq(&self, other: &SDL_GPUVertexInputRate) -> bool {
2645 self == &other.0
2646 }
2647}
2648
2649impl From<SDL_GPUVertexInputRate> for ::core::ffi::c_int {
2650 #[inline(always)]
2651 fn from(value: SDL_GPUVertexInputRate) -> Self {
2652 value.0
2653 }
2654}
2655
2656#[cfg(feature = "debug-impls")]
2657impl ::core::fmt::Debug for SDL_GPUVertexInputRate {
2658 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2659 #[allow(unreachable_patterns)]
2660 f.write_str(match *self {
2661 Self::VERTEX => "SDL_GPU_VERTEXINPUTRATE_VERTEX",
2662 Self::INSTANCE => "SDL_GPU_VERTEXINPUTRATE_INSTANCE",
2663
2664 _ => return write!(f, "SDL_GPUVertexInputRate({})", self.0),
2665 })
2666 }
2667}
2668
2669impl SDL_GPUVertexInputRate {
2670 /// Attribute addressing is a function of the vertex index.
2671 pub const VERTEX: Self = Self((0 as ::core::ffi::c_int));
2672 /// Attribute addressing is a function of the instance index.
2673 pub const INSTANCE: Self = Self((1 as ::core::ffi::c_int));
2674}
2675
2676/// Attribute addressing is a function of the vertex index.
2677pub const SDL_GPU_VERTEXINPUTRATE_VERTEX: SDL_GPUVertexInputRate = SDL_GPUVertexInputRate::VERTEX;
2678/// Attribute addressing is a function of the instance index.
2679pub const SDL_GPU_VERTEXINPUTRATE_INSTANCE: SDL_GPUVertexInputRate =
2680 SDL_GPUVertexInputRate::INSTANCE;
2681
2682#[cfg(feature = "metadata")]
2683impl sdl3_sys::metadata::GroupMetadata for SDL_GPUVertexInputRate {
2684 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
2685 &crate::metadata::gpu::METADATA_SDL_GPUVertexInputRate;
2686}
2687
2688/// Specifies the fill mode of the graphics pipeline.
2689///
2690/// ## Availability
2691/// This enum is available since SDL 3.2.0.
2692///
2693/// ## See also
2694/// - [`SDL_CreateGPUGraphicsPipeline`]
2695///
2696/// ## Known values (`sdl3-sys`)
2697/// | Associated constant | Global constant | Description |
2698/// | ------------------- | --------------- | ----------- |
2699/// | [`FILL`](SDL_GPUFillMode::FILL) | [`SDL_GPU_FILLMODE_FILL`] | Polygons will be rendered via rasterization. |
2700/// | [`LINE`](SDL_GPUFillMode::LINE) | [`SDL_GPU_FILLMODE_LINE`] | Polygon edges will be drawn as line segments. |
2701#[repr(transparent)]
2702#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
2703pub struct SDL_GPUFillMode(pub ::core::ffi::c_int);
2704
2705impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUFillMode {
2706 #[inline(always)]
2707 fn eq(&self, other: &::core::ffi::c_int) -> bool {
2708 &self.0 == other
2709 }
2710}
2711
2712impl ::core::cmp::PartialEq<SDL_GPUFillMode> for ::core::ffi::c_int {
2713 #[inline(always)]
2714 fn eq(&self, other: &SDL_GPUFillMode) -> bool {
2715 self == &other.0
2716 }
2717}
2718
2719impl From<SDL_GPUFillMode> for ::core::ffi::c_int {
2720 #[inline(always)]
2721 fn from(value: SDL_GPUFillMode) -> Self {
2722 value.0
2723 }
2724}
2725
2726#[cfg(feature = "debug-impls")]
2727impl ::core::fmt::Debug for SDL_GPUFillMode {
2728 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2729 #[allow(unreachable_patterns)]
2730 f.write_str(match *self {
2731 Self::FILL => "SDL_GPU_FILLMODE_FILL",
2732 Self::LINE => "SDL_GPU_FILLMODE_LINE",
2733
2734 _ => return write!(f, "SDL_GPUFillMode({})", self.0),
2735 })
2736 }
2737}
2738
2739impl SDL_GPUFillMode {
2740 /// Polygons will be rendered via rasterization.
2741 pub const FILL: Self = Self((0 as ::core::ffi::c_int));
2742 /// Polygon edges will be drawn as line segments.
2743 pub const LINE: Self = Self((1 as ::core::ffi::c_int));
2744}
2745
2746/// Polygons will be rendered via rasterization.
2747pub const SDL_GPU_FILLMODE_FILL: SDL_GPUFillMode = SDL_GPUFillMode::FILL;
2748/// Polygon edges will be drawn as line segments.
2749pub const SDL_GPU_FILLMODE_LINE: SDL_GPUFillMode = SDL_GPUFillMode::LINE;
2750
2751#[cfg(feature = "metadata")]
2752impl sdl3_sys::metadata::GroupMetadata for SDL_GPUFillMode {
2753 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
2754 &crate::metadata::gpu::METADATA_SDL_GPUFillMode;
2755}
2756
2757/// Specifies the facing direction in which triangle faces will be culled.
2758///
2759/// ## Availability
2760/// This enum is available since SDL 3.2.0.
2761///
2762/// ## See also
2763/// - [`SDL_CreateGPUGraphicsPipeline`]
2764///
2765/// ## Known values (`sdl3-sys`)
2766/// | Associated constant | Global constant | Description |
2767/// | ------------------- | --------------- | ----------- |
2768/// | [`NONE`](SDL_GPUCullMode::NONE) | [`SDL_GPU_CULLMODE_NONE`] | No triangles are culled. |
2769/// | [`FRONT`](SDL_GPUCullMode::FRONT) | [`SDL_GPU_CULLMODE_FRONT`] | Front-facing triangles are culled. |
2770/// | [`BACK`](SDL_GPUCullMode::BACK) | [`SDL_GPU_CULLMODE_BACK`] | Back-facing triangles are culled. |
2771#[repr(transparent)]
2772#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
2773pub struct SDL_GPUCullMode(pub ::core::ffi::c_int);
2774
2775impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUCullMode {
2776 #[inline(always)]
2777 fn eq(&self, other: &::core::ffi::c_int) -> bool {
2778 &self.0 == other
2779 }
2780}
2781
2782impl ::core::cmp::PartialEq<SDL_GPUCullMode> for ::core::ffi::c_int {
2783 #[inline(always)]
2784 fn eq(&self, other: &SDL_GPUCullMode) -> bool {
2785 self == &other.0
2786 }
2787}
2788
2789impl From<SDL_GPUCullMode> for ::core::ffi::c_int {
2790 #[inline(always)]
2791 fn from(value: SDL_GPUCullMode) -> Self {
2792 value.0
2793 }
2794}
2795
2796#[cfg(feature = "debug-impls")]
2797impl ::core::fmt::Debug for SDL_GPUCullMode {
2798 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2799 #[allow(unreachable_patterns)]
2800 f.write_str(match *self {
2801 Self::NONE => "SDL_GPU_CULLMODE_NONE",
2802 Self::FRONT => "SDL_GPU_CULLMODE_FRONT",
2803 Self::BACK => "SDL_GPU_CULLMODE_BACK",
2804
2805 _ => return write!(f, "SDL_GPUCullMode({})", self.0),
2806 })
2807 }
2808}
2809
2810impl SDL_GPUCullMode {
2811 /// No triangles are culled.
2812 pub const NONE: Self = Self((0 as ::core::ffi::c_int));
2813 /// Front-facing triangles are culled.
2814 pub const FRONT: Self = Self((1 as ::core::ffi::c_int));
2815 /// Back-facing triangles are culled.
2816 pub const BACK: Self = Self((2 as ::core::ffi::c_int));
2817}
2818
2819/// No triangles are culled.
2820pub const SDL_GPU_CULLMODE_NONE: SDL_GPUCullMode = SDL_GPUCullMode::NONE;
2821/// Front-facing triangles are culled.
2822pub const SDL_GPU_CULLMODE_FRONT: SDL_GPUCullMode = SDL_GPUCullMode::FRONT;
2823/// Back-facing triangles are culled.
2824pub const SDL_GPU_CULLMODE_BACK: SDL_GPUCullMode = SDL_GPUCullMode::BACK;
2825
2826#[cfg(feature = "metadata")]
2827impl sdl3_sys::metadata::GroupMetadata for SDL_GPUCullMode {
2828 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
2829 &crate::metadata::gpu::METADATA_SDL_GPUCullMode;
2830}
2831
2832/// Specifies the vertex winding that will cause a triangle to be determined to
2833/// be front-facing.
2834///
2835/// ## Availability
2836/// This enum is available since SDL 3.2.0.
2837///
2838/// ## See also
2839/// - [`SDL_CreateGPUGraphicsPipeline`]
2840///
2841/// ## Known values (`sdl3-sys`)
2842/// | Associated constant | Global constant | Description |
2843/// | ------------------- | --------------- | ----------- |
2844/// | [`COUNTER_CLOCKWISE`](SDL_GPUFrontFace::COUNTER_CLOCKWISE) | [`SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE`] | A triangle with counter-clockwise vertex winding will be considered front-facing. |
2845/// | [`CLOCKWISE`](SDL_GPUFrontFace::CLOCKWISE) | [`SDL_GPU_FRONTFACE_CLOCKWISE`] | A triangle with clockwise vertex winding will be considered front-facing. |
2846#[repr(transparent)]
2847#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
2848pub struct SDL_GPUFrontFace(pub ::core::ffi::c_int);
2849
2850impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUFrontFace {
2851 #[inline(always)]
2852 fn eq(&self, other: &::core::ffi::c_int) -> bool {
2853 &self.0 == other
2854 }
2855}
2856
2857impl ::core::cmp::PartialEq<SDL_GPUFrontFace> for ::core::ffi::c_int {
2858 #[inline(always)]
2859 fn eq(&self, other: &SDL_GPUFrontFace) -> bool {
2860 self == &other.0
2861 }
2862}
2863
2864impl From<SDL_GPUFrontFace> for ::core::ffi::c_int {
2865 #[inline(always)]
2866 fn from(value: SDL_GPUFrontFace) -> Self {
2867 value.0
2868 }
2869}
2870
2871#[cfg(feature = "debug-impls")]
2872impl ::core::fmt::Debug for SDL_GPUFrontFace {
2873 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2874 #[allow(unreachable_patterns)]
2875 f.write_str(match *self {
2876 Self::COUNTER_CLOCKWISE => "SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE",
2877 Self::CLOCKWISE => "SDL_GPU_FRONTFACE_CLOCKWISE",
2878
2879 _ => return write!(f, "SDL_GPUFrontFace({})", self.0),
2880 })
2881 }
2882}
2883
2884impl SDL_GPUFrontFace {
2885 /// A triangle with counter-clockwise vertex winding will be considered front-facing.
2886 pub const COUNTER_CLOCKWISE: Self = Self((0 as ::core::ffi::c_int));
2887 /// A triangle with clockwise vertex winding will be considered front-facing.
2888 pub const CLOCKWISE: Self = Self((1 as ::core::ffi::c_int));
2889}
2890
2891/// A triangle with counter-clockwise vertex winding will be considered front-facing.
2892pub const SDL_GPU_FRONTFACE_COUNTER_CLOCKWISE: SDL_GPUFrontFace =
2893 SDL_GPUFrontFace::COUNTER_CLOCKWISE;
2894/// A triangle with clockwise vertex winding will be considered front-facing.
2895pub const SDL_GPU_FRONTFACE_CLOCKWISE: SDL_GPUFrontFace = SDL_GPUFrontFace::CLOCKWISE;
2896
2897#[cfg(feature = "metadata")]
2898impl sdl3_sys::metadata::GroupMetadata for SDL_GPUFrontFace {
2899 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
2900 &crate::metadata::gpu::METADATA_SDL_GPUFrontFace;
2901}
2902
2903/// Specifies a comparison operator for depth, stencil and sampler operations.
2904///
2905/// ## Availability
2906/// This enum is available since SDL 3.2.0.
2907///
2908/// ## See also
2909/// - [`SDL_CreateGPUGraphicsPipeline`]
2910///
2911/// ## Known values (`sdl3-sys`)
2912/// | Associated constant | Global constant | Description |
2913/// | ------------------- | --------------- | ----------- |
2914/// | [`INVALID`](SDL_GPUCompareOp::INVALID) | [`SDL_GPU_COMPAREOP_INVALID`] | |
2915/// | [`NEVER`](SDL_GPUCompareOp::NEVER) | [`SDL_GPU_COMPAREOP_NEVER`] | The comparison always evaluates false. |
2916/// | [`LESS`](SDL_GPUCompareOp::LESS) | [`SDL_GPU_COMPAREOP_LESS`] | The comparison evaluates reference < test. |
2917/// | [`EQUAL`](SDL_GPUCompareOp::EQUAL) | [`SDL_GPU_COMPAREOP_EQUAL`] | The comparison evaluates reference == test. |
2918/// | [`LESS_OR_EQUAL`](SDL_GPUCompareOp::LESS_OR_EQUAL) | [`SDL_GPU_COMPAREOP_LESS_OR_EQUAL`] | The comparison evaluates reference <= test. |
2919/// | [`GREATER`](SDL_GPUCompareOp::GREATER) | [`SDL_GPU_COMPAREOP_GREATER`] | The comparison evaluates reference > test. |
2920/// | [`NOT_EQUAL`](SDL_GPUCompareOp::NOT_EQUAL) | [`SDL_GPU_COMPAREOP_NOT_EQUAL`] | The comparison evaluates reference != test. |
2921/// | [`GREATER_OR_EQUAL`](SDL_GPUCompareOp::GREATER_OR_EQUAL) | [`SDL_GPU_COMPAREOP_GREATER_OR_EQUAL`] | The comparison evaluates reference >= test. |
2922/// | [`ALWAYS`](SDL_GPUCompareOp::ALWAYS) | [`SDL_GPU_COMPAREOP_ALWAYS`] | The comparison always evaluates true. |
2923#[repr(transparent)]
2924#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
2925pub struct SDL_GPUCompareOp(pub ::core::ffi::c_int);
2926
2927impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUCompareOp {
2928 #[inline(always)]
2929 fn eq(&self, other: &::core::ffi::c_int) -> bool {
2930 &self.0 == other
2931 }
2932}
2933
2934impl ::core::cmp::PartialEq<SDL_GPUCompareOp> for ::core::ffi::c_int {
2935 #[inline(always)]
2936 fn eq(&self, other: &SDL_GPUCompareOp) -> bool {
2937 self == &other.0
2938 }
2939}
2940
2941impl From<SDL_GPUCompareOp> for ::core::ffi::c_int {
2942 #[inline(always)]
2943 fn from(value: SDL_GPUCompareOp) -> Self {
2944 value.0
2945 }
2946}
2947
2948#[cfg(feature = "debug-impls")]
2949impl ::core::fmt::Debug for SDL_GPUCompareOp {
2950 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
2951 #[allow(unreachable_patterns)]
2952 f.write_str(match *self {
2953 Self::INVALID => "SDL_GPU_COMPAREOP_INVALID",
2954 Self::NEVER => "SDL_GPU_COMPAREOP_NEVER",
2955 Self::LESS => "SDL_GPU_COMPAREOP_LESS",
2956 Self::EQUAL => "SDL_GPU_COMPAREOP_EQUAL",
2957 Self::LESS_OR_EQUAL => "SDL_GPU_COMPAREOP_LESS_OR_EQUAL",
2958 Self::GREATER => "SDL_GPU_COMPAREOP_GREATER",
2959 Self::NOT_EQUAL => "SDL_GPU_COMPAREOP_NOT_EQUAL",
2960 Self::GREATER_OR_EQUAL => "SDL_GPU_COMPAREOP_GREATER_OR_EQUAL",
2961 Self::ALWAYS => "SDL_GPU_COMPAREOP_ALWAYS",
2962
2963 _ => return write!(f, "SDL_GPUCompareOp({})", self.0),
2964 })
2965 }
2966}
2967
2968impl SDL_GPUCompareOp {
2969 pub const INVALID: Self = Self((0 as ::core::ffi::c_int));
2970 /// The comparison always evaluates false.
2971 pub const NEVER: Self = Self((1 as ::core::ffi::c_int));
2972 /// The comparison evaluates reference < test.
2973 pub const LESS: Self = Self((2 as ::core::ffi::c_int));
2974 /// The comparison evaluates reference == test.
2975 pub const EQUAL: Self = Self((3 as ::core::ffi::c_int));
2976 /// The comparison evaluates reference <= test.
2977 pub const LESS_OR_EQUAL: Self = Self((4 as ::core::ffi::c_int));
2978 /// The comparison evaluates reference > test.
2979 pub const GREATER: Self = Self((5 as ::core::ffi::c_int));
2980 /// The comparison evaluates reference != test.
2981 pub const NOT_EQUAL: Self = Self((6 as ::core::ffi::c_int));
2982 /// The comparison evaluates reference >= test.
2983 pub const GREATER_OR_EQUAL: Self = Self((7 as ::core::ffi::c_int));
2984 /// The comparison always evaluates true.
2985 pub const ALWAYS: Self = Self((8 as ::core::ffi::c_int));
2986}
2987
2988pub const SDL_GPU_COMPAREOP_INVALID: SDL_GPUCompareOp = SDL_GPUCompareOp::INVALID;
2989/// The comparison always evaluates false.
2990pub const SDL_GPU_COMPAREOP_NEVER: SDL_GPUCompareOp = SDL_GPUCompareOp::NEVER;
2991/// The comparison evaluates reference < test.
2992pub const SDL_GPU_COMPAREOP_LESS: SDL_GPUCompareOp = SDL_GPUCompareOp::LESS;
2993/// The comparison evaluates reference == test.
2994pub const SDL_GPU_COMPAREOP_EQUAL: SDL_GPUCompareOp = SDL_GPUCompareOp::EQUAL;
2995/// The comparison evaluates reference <= test.
2996pub const SDL_GPU_COMPAREOP_LESS_OR_EQUAL: SDL_GPUCompareOp = SDL_GPUCompareOp::LESS_OR_EQUAL;
2997/// The comparison evaluates reference > test.
2998pub const SDL_GPU_COMPAREOP_GREATER: SDL_GPUCompareOp = SDL_GPUCompareOp::GREATER;
2999/// The comparison evaluates reference != test.
3000pub const SDL_GPU_COMPAREOP_NOT_EQUAL: SDL_GPUCompareOp = SDL_GPUCompareOp::NOT_EQUAL;
3001/// The comparison evaluates reference >= test.
3002pub const SDL_GPU_COMPAREOP_GREATER_OR_EQUAL: SDL_GPUCompareOp = SDL_GPUCompareOp::GREATER_OR_EQUAL;
3003/// The comparison always evaluates true.
3004pub const SDL_GPU_COMPAREOP_ALWAYS: SDL_GPUCompareOp = SDL_GPUCompareOp::ALWAYS;
3005
3006#[cfg(feature = "metadata")]
3007impl sdl3_sys::metadata::GroupMetadata for SDL_GPUCompareOp {
3008 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
3009 &crate::metadata::gpu::METADATA_SDL_GPUCompareOp;
3010}
3011
3012/// Specifies what happens to a stored stencil value if stencil tests fail or
3013/// pass.
3014///
3015/// ## Availability
3016/// This enum is available since SDL 3.2.0.
3017///
3018/// ## See also
3019/// - [`SDL_CreateGPUGraphicsPipeline`]
3020///
3021/// ## Known values (`sdl3-sys`)
3022/// | Associated constant | Global constant | Description |
3023/// | ------------------- | --------------- | ----------- |
3024/// | [`INVALID`](SDL_GPUStencilOp::INVALID) | [`SDL_GPU_STENCILOP_INVALID`] | |
3025/// | [`KEEP`](SDL_GPUStencilOp::KEEP) | [`SDL_GPU_STENCILOP_KEEP`] | Keeps the current value. |
3026/// | [`ZERO`](SDL_GPUStencilOp::ZERO) | [`SDL_GPU_STENCILOP_ZERO`] | Sets the value to 0. |
3027/// | [`REPLACE`](SDL_GPUStencilOp::REPLACE) | [`SDL_GPU_STENCILOP_REPLACE`] | Sets the value to reference. |
3028/// | [`INCREMENT_AND_CLAMP`](SDL_GPUStencilOp::INCREMENT_AND_CLAMP) | [`SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP`] | Increments the current value and clamps to the maximum value. |
3029/// | [`DECREMENT_AND_CLAMP`](SDL_GPUStencilOp::DECREMENT_AND_CLAMP) | [`SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP`] | Decrements the current value and clamps to 0. |
3030/// | [`INVERT`](SDL_GPUStencilOp::INVERT) | [`SDL_GPU_STENCILOP_INVERT`] | Bitwise-inverts the current value. |
3031/// | [`INCREMENT_AND_WRAP`](SDL_GPUStencilOp::INCREMENT_AND_WRAP) | [`SDL_GPU_STENCILOP_INCREMENT_AND_WRAP`] | Increments the current value and wraps back to 0. |
3032/// | [`DECREMENT_AND_WRAP`](SDL_GPUStencilOp::DECREMENT_AND_WRAP) | [`SDL_GPU_STENCILOP_DECREMENT_AND_WRAP`] | Decrements the current value and wraps to the maximum value. |
3033#[repr(transparent)]
3034#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
3035pub struct SDL_GPUStencilOp(pub ::core::ffi::c_int);
3036
3037impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUStencilOp {
3038 #[inline(always)]
3039 fn eq(&self, other: &::core::ffi::c_int) -> bool {
3040 &self.0 == other
3041 }
3042}
3043
3044impl ::core::cmp::PartialEq<SDL_GPUStencilOp> for ::core::ffi::c_int {
3045 #[inline(always)]
3046 fn eq(&self, other: &SDL_GPUStencilOp) -> bool {
3047 self == &other.0
3048 }
3049}
3050
3051impl From<SDL_GPUStencilOp> for ::core::ffi::c_int {
3052 #[inline(always)]
3053 fn from(value: SDL_GPUStencilOp) -> Self {
3054 value.0
3055 }
3056}
3057
3058#[cfg(feature = "debug-impls")]
3059impl ::core::fmt::Debug for SDL_GPUStencilOp {
3060 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3061 #[allow(unreachable_patterns)]
3062 f.write_str(match *self {
3063 Self::INVALID => "SDL_GPU_STENCILOP_INVALID",
3064 Self::KEEP => "SDL_GPU_STENCILOP_KEEP",
3065 Self::ZERO => "SDL_GPU_STENCILOP_ZERO",
3066 Self::REPLACE => "SDL_GPU_STENCILOP_REPLACE",
3067 Self::INCREMENT_AND_CLAMP => "SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP",
3068 Self::DECREMENT_AND_CLAMP => "SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP",
3069 Self::INVERT => "SDL_GPU_STENCILOP_INVERT",
3070 Self::INCREMENT_AND_WRAP => "SDL_GPU_STENCILOP_INCREMENT_AND_WRAP",
3071 Self::DECREMENT_AND_WRAP => "SDL_GPU_STENCILOP_DECREMENT_AND_WRAP",
3072
3073 _ => return write!(f, "SDL_GPUStencilOp({})", self.0),
3074 })
3075 }
3076}
3077
3078impl SDL_GPUStencilOp {
3079 pub const INVALID: Self = Self((0 as ::core::ffi::c_int));
3080 /// Keeps the current value.
3081 pub const KEEP: Self = Self((1 as ::core::ffi::c_int));
3082 /// Sets the value to 0.
3083 pub const ZERO: Self = Self((2 as ::core::ffi::c_int));
3084 /// Sets the value to reference.
3085 pub const REPLACE: Self = Self((3 as ::core::ffi::c_int));
3086 /// Increments the current value and clamps to the maximum value.
3087 pub const INCREMENT_AND_CLAMP: Self = Self((4 as ::core::ffi::c_int));
3088 /// Decrements the current value and clamps to 0.
3089 pub const DECREMENT_AND_CLAMP: Self = Self((5 as ::core::ffi::c_int));
3090 /// Bitwise-inverts the current value.
3091 pub const INVERT: Self = Self((6 as ::core::ffi::c_int));
3092 /// Increments the current value and wraps back to 0.
3093 pub const INCREMENT_AND_WRAP: Self = Self((7 as ::core::ffi::c_int));
3094 /// Decrements the current value and wraps to the maximum value.
3095 pub const DECREMENT_AND_WRAP: Self = Self((8 as ::core::ffi::c_int));
3096}
3097
3098pub const SDL_GPU_STENCILOP_INVALID: SDL_GPUStencilOp = SDL_GPUStencilOp::INVALID;
3099/// Keeps the current value.
3100pub const SDL_GPU_STENCILOP_KEEP: SDL_GPUStencilOp = SDL_GPUStencilOp::KEEP;
3101/// Sets the value to 0.
3102pub const SDL_GPU_STENCILOP_ZERO: SDL_GPUStencilOp = SDL_GPUStencilOp::ZERO;
3103/// Sets the value to reference.
3104pub const SDL_GPU_STENCILOP_REPLACE: SDL_GPUStencilOp = SDL_GPUStencilOp::REPLACE;
3105/// Increments the current value and clamps to the maximum value.
3106pub const SDL_GPU_STENCILOP_INCREMENT_AND_CLAMP: SDL_GPUStencilOp =
3107 SDL_GPUStencilOp::INCREMENT_AND_CLAMP;
3108/// Decrements the current value and clamps to 0.
3109pub const SDL_GPU_STENCILOP_DECREMENT_AND_CLAMP: SDL_GPUStencilOp =
3110 SDL_GPUStencilOp::DECREMENT_AND_CLAMP;
3111/// Bitwise-inverts the current value.
3112pub const SDL_GPU_STENCILOP_INVERT: SDL_GPUStencilOp = SDL_GPUStencilOp::INVERT;
3113/// Increments the current value and wraps back to 0.
3114pub const SDL_GPU_STENCILOP_INCREMENT_AND_WRAP: SDL_GPUStencilOp =
3115 SDL_GPUStencilOp::INCREMENT_AND_WRAP;
3116/// Decrements the current value and wraps to the maximum value.
3117pub const SDL_GPU_STENCILOP_DECREMENT_AND_WRAP: SDL_GPUStencilOp =
3118 SDL_GPUStencilOp::DECREMENT_AND_WRAP;
3119
3120#[cfg(feature = "metadata")]
3121impl sdl3_sys::metadata::GroupMetadata for SDL_GPUStencilOp {
3122 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
3123 &crate::metadata::gpu::METADATA_SDL_GPUStencilOp;
3124}
3125
3126/// Specifies the operator to be used when pixels in a render target are
3127/// blended with existing pixels in the texture.
3128///
3129/// The source color is the value written by the fragment shader. The
3130/// destination color is the value currently existing in the texture.
3131///
3132/// ## Availability
3133/// This enum is available since SDL 3.2.0.
3134///
3135/// ## See also
3136/// - [`SDL_CreateGPUGraphicsPipeline`]
3137///
3138/// ## Known values (`sdl3-sys`)
3139/// | Associated constant | Global constant | Description |
3140/// | ------------------- | --------------- | ----------- |
3141/// | [`INVALID`](SDL_GPUBlendOp::INVALID) | [`SDL_GPU_BLENDOP_INVALID`] | |
3142/// | [`ADD`](SDL_GPUBlendOp::ADD) | [`SDL_GPU_BLENDOP_ADD`] | (source * source_factor) + (destination * destination_factor) |
3143/// | [`SUBTRACT`](SDL_GPUBlendOp::SUBTRACT) | [`SDL_GPU_BLENDOP_SUBTRACT`] | (source * source_factor) - (destination * destination_factor) |
3144/// | [`REVERSE_SUBTRACT`](SDL_GPUBlendOp::REVERSE_SUBTRACT) | [`SDL_GPU_BLENDOP_REVERSE_SUBTRACT`] | (destination * destination_factor) - (source * source_factor) |
3145/// | [`MIN`](SDL_GPUBlendOp::MIN) | [`SDL_GPU_BLENDOP_MIN`] | min(source, destination) |
3146/// | [`MAX`](SDL_GPUBlendOp::MAX) | [`SDL_GPU_BLENDOP_MAX`] | max(source, destination) |
3147#[repr(transparent)]
3148#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
3149pub struct SDL_GPUBlendOp(pub ::core::ffi::c_int);
3150
3151impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUBlendOp {
3152 #[inline(always)]
3153 fn eq(&self, other: &::core::ffi::c_int) -> bool {
3154 &self.0 == other
3155 }
3156}
3157
3158impl ::core::cmp::PartialEq<SDL_GPUBlendOp> for ::core::ffi::c_int {
3159 #[inline(always)]
3160 fn eq(&self, other: &SDL_GPUBlendOp) -> bool {
3161 self == &other.0
3162 }
3163}
3164
3165impl From<SDL_GPUBlendOp> for ::core::ffi::c_int {
3166 #[inline(always)]
3167 fn from(value: SDL_GPUBlendOp) -> Self {
3168 value.0
3169 }
3170}
3171
3172#[cfg(feature = "debug-impls")]
3173impl ::core::fmt::Debug for SDL_GPUBlendOp {
3174 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3175 #[allow(unreachable_patterns)]
3176 f.write_str(match *self {
3177 Self::INVALID => "SDL_GPU_BLENDOP_INVALID",
3178 Self::ADD => "SDL_GPU_BLENDOP_ADD",
3179 Self::SUBTRACT => "SDL_GPU_BLENDOP_SUBTRACT",
3180 Self::REVERSE_SUBTRACT => "SDL_GPU_BLENDOP_REVERSE_SUBTRACT",
3181 Self::MIN => "SDL_GPU_BLENDOP_MIN",
3182 Self::MAX => "SDL_GPU_BLENDOP_MAX",
3183
3184 _ => return write!(f, "SDL_GPUBlendOp({})", self.0),
3185 })
3186 }
3187}
3188
3189impl SDL_GPUBlendOp {
3190 pub const INVALID: Self = Self((0 as ::core::ffi::c_int));
3191 /// (source * source_factor) + (destination * destination_factor)
3192 pub const ADD: Self = Self((1 as ::core::ffi::c_int));
3193 /// (source * source_factor) - (destination * destination_factor)
3194 pub const SUBTRACT: Self = Self((2 as ::core::ffi::c_int));
3195 /// (destination * destination_factor) - (source * source_factor)
3196 pub const REVERSE_SUBTRACT: Self = Self((3 as ::core::ffi::c_int));
3197 /// min(source, destination)
3198 pub const MIN: Self = Self((4 as ::core::ffi::c_int));
3199 /// max(source, destination)
3200 pub const MAX: Self = Self((5 as ::core::ffi::c_int));
3201}
3202
3203pub const SDL_GPU_BLENDOP_INVALID: SDL_GPUBlendOp = SDL_GPUBlendOp::INVALID;
3204/// (source * source_factor) + (destination * destination_factor)
3205pub const SDL_GPU_BLENDOP_ADD: SDL_GPUBlendOp = SDL_GPUBlendOp::ADD;
3206/// (source * source_factor) - (destination * destination_factor)
3207pub const SDL_GPU_BLENDOP_SUBTRACT: SDL_GPUBlendOp = SDL_GPUBlendOp::SUBTRACT;
3208/// (destination * destination_factor) - (source * source_factor)
3209pub const SDL_GPU_BLENDOP_REVERSE_SUBTRACT: SDL_GPUBlendOp = SDL_GPUBlendOp::REVERSE_SUBTRACT;
3210/// min(source, destination)
3211pub const SDL_GPU_BLENDOP_MIN: SDL_GPUBlendOp = SDL_GPUBlendOp::MIN;
3212/// max(source, destination)
3213pub const SDL_GPU_BLENDOP_MAX: SDL_GPUBlendOp = SDL_GPUBlendOp::MAX;
3214
3215#[cfg(feature = "metadata")]
3216impl sdl3_sys::metadata::GroupMetadata for SDL_GPUBlendOp {
3217 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
3218 &crate::metadata::gpu::METADATA_SDL_GPUBlendOp;
3219}
3220
3221/// Specifies a blending factor to be used when pixels in a render target are
3222/// blended with existing pixels in the texture.
3223///
3224/// The source color is the value written by the fragment shader. The
3225/// destination color is the value currently existing in the texture.
3226///
3227/// ## Availability
3228/// This enum is available since SDL 3.2.0.
3229///
3230/// ## See also
3231/// - [`SDL_CreateGPUGraphicsPipeline`]
3232///
3233/// ## Known values (`sdl3-sys`)
3234/// | Associated constant | Global constant | Description |
3235/// | ------------------- | --------------- | ----------- |
3236/// | [`INVALID`](SDL_GPUBlendFactor::INVALID) | [`SDL_GPU_BLENDFACTOR_INVALID`] | |
3237/// | [`ZERO`](SDL_GPUBlendFactor::ZERO) | [`SDL_GPU_BLENDFACTOR_ZERO`] | 0 |
3238/// | [`ONE`](SDL_GPUBlendFactor::ONE) | [`SDL_GPU_BLENDFACTOR_ONE`] | 1 |
3239/// | [`SRC_COLOR`](SDL_GPUBlendFactor::SRC_COLOR) | [`SDL_GPU_BLENDFACTOR_SRC_COLOR`] | source color |
3240/// | [`ONE_MINUS_SRC_COLOR`](SDL_GPUBlendFactor::ONE_MINUS_SRC_COLOR) | [`SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR`] | 1 - source color |
3241/// | [`DST_COLOR`](SDL_GPUBlendFactor::DST_COLOR) | [`SDL_GPU_BLENDFACTOR_DST_COLOR`] | destination color |
3242/// | [`ONE_MINUS_DST_COLOR`](SDL_GPUBlendFactor::ONE_MINUS_DST_COLOR) | [`SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR`] | 1 - destination color |
3243/// | [`SRC_ALPHA`](SDL_GPUBlendFactor::SRC_ALPHA) | [`SDL_GPU_BLENDFACTOR_SRC_ALPHA`] | source alpha |
3244/// | [`ONE_MINUS_SRC_ALPHA`](SDL_GPUBlendFactor::ONE_MINUS_SRC_ALPHA) | [`SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA`] | 1 - source alpha |
3245/// | [`DST_ALPHA`](SDL_GPUBlendFactor::DST_ALPHA) | [`SDL_GPU_BLENDFACTOR_DST_ALPHA`] | destination alpha |
3246/// | [`ONE_MINUS_DST_ALPHA`](SDL_GPUBlendFactor::ONE_MINUS_DST_ALPHA) | [`SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA`] | 1 - destination alpha |
3247/// | [`CONSTANT_COLOR`](SDL_GPUBlendFactor::CONSTANT_COLOR) | [`SDL_GPU_BLENDFACTOR_CONSTANT_COLOR`] | blend constant |
3248/// | [`ONE_MINUS_CONSTANT_COLOR`](SDL_GPUBlendFactor::ONE_MINUS_CONSTANT_COLOR) | [`SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR`] | 1 - blend constant |
3249/// | [`SRC_ALPHA_SATURATE`](SDL_GPUBlendFactor::SRC_ALPHA_SATURATE) | [`SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE`] | min(source alpha, 1 - destination alpha) |
3250#[repr(transparent)]
3251#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
3252pub struct SDL_GPUBlendFactor(pub ::core::ffi::c_int);
3253
3254impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUBlendFactor {
3255 #[inline(always)]
3256 fn eq(&self, other: &::core::ffi::c_int) -> bool {
3257 &self.0 == other
3258 }
3259}
3260
3261impl ::core::cmp::PartialEq<SDL_GPUBlendFactor> for ::core::ffi::c_int {
3262 #[inline(always)]
3263 fn eq(&self, other: &SDL_GPUBlendFactor) -> bool {
3264 self == &other.0
3265 }
3266}
3267
3268impl From<SDL_GPUBlendFactor> for ::core::ffi::c_int {
3269 #[inline(always)]
3270 fn from(value: SDL_GPUBlendFactor) -> Self {
3271 value.0
3272 }
3273}
3274
3275#[cfg(feature = "debug-impls")]
3276impl ::core::fmt::Debug for SDL_GPUBlendFactor {
3277 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3278 #[allow(unreachable_patterns)]
3279 f.write_str(match *self {
3280 Self::INVALID => "SDL_GPU_BLENDFACTOR_INVALID",
3281 Self::ZERO => "SDL_GPU_BLENDFACTOR_ZERO",
3282 Self::ONE => "SDL_GPU_BLENDFACTOR_ONE",
3283 Self::SRC_COLOR => "SDL_GPU_BLENDFACTOR_SRC_COLOR",
3284 Self::ONE_MINUS_SRC_COLOR => "SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR",
3285 Self::DST_COLOR => "SDL_GPU_BLENDFACTOR_DST_COLOR",
3286 Self::ONE_MINUS_DST_COLOR => "SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR",
3287 Self::SRC_ALPHA => "SDL_GPU_BLENDFACTOR_SRC_ALPHA",
3288 Self::ONE_MINUS_SRC_ALPHA => "SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA",
3289 Self::DST_ALPHA => "SDL_GPU_BLENDFACTOR_DST_ALPHA",
3290 Self::ONE_MINUS_DST_ALPHA => "SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA",
3291 Self::CONSTANT_COLOR => "SDL_GPU_BLENDFACTOR_CONSTANT_COLOR",
3292 Self::ONE_MINUS_CONSTANT_COLOR => "SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR",
3293 Self::SRC_ALPHA_SATURATE => "SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE",
3294
3295 _ => return write!(f, "SDL_GPUBlendFactor({})", self.0),
3296 })
3297 }
3298}
3299
3300impl SDL_GPUBlendFactor {
3301 pub const INVALID: Self = Self((0 as ::core::ffi::c_int));
3302 /// 0
3303 pub const ZERO: Self = Self((1 as ::core::ffi::c_int));
3304 /// 1
3305 pub const ONE: Self = Self((2 as ::core::ffi::c_int));
3306 /// source color
3307 pub const SRC_COLOR: Self = Self((3 as ::core::ffi::c_int));
3308 /// 1 - source color
3309 pub const ONE_MINUS_SRC_COLOR: Self = Self((4 as ::core::ffi::c_int));
3310 /// destination color
3311 pub const DST_COLOR: Self = Self((5 as ::core::ffi::c_int));
3312 /// 1 - destination color
3313 pub const ONE_MINUS_DST_COLOR: Self = Self((6 as ::core::ffi::c_int));
3314 /// source alpha
3315 pub const SRC_ALPHA: Self = Self((7 as ::core::ffi::c_int));
3316 /// 1 - source alpha
3317 pub const ONE_MINUS_SRC_ALPHA: Self = Self((8 as ::core::ffi::c_int));
3318 /// destination alpha
3319 pub const DST_ALPHA: Self = Self((9 as ::core::ffi::c_int));
3320 /// 1 - destination alpha
3321 pub const ONE_MINUS_DST_ALPHA: Self = Self((10 as ::core::ffi::c_int));
3322 /// blend constant
3323 pub const CONSTANT_COLOR: Self = Self((11 as ::core::ffi::c_int));
3324 /// 1 - blend constant
3325 pub const ONE_MINUS_CONSTANT_COLOR: Self = Self((12 as ::core::ffi::c_int));
3326 /// min(source alpha, 1 - destination alpha)
3327 pub const SRC_ALPHA_SATURATE: Self = Self((13 as ::core::ffi::c_int));
3328}
3329
3330pub const SDL_GPU_BLENDFACTOR_INVALID: SDL_GPUBlendFactor = SDL_GPUBlendFactor::INVALID;
3331/// 0
3332pub const SDL_GPU_BLENDFACTOR_ZERO: SDL_GPUBlendFactor = SDL_GPUBlendFactor::ZERO;
3333/// 1
3334pub const SDL_GPU_BLENDFACTOR_ONE: SDL_GPUBlendFactor = SDL_GPUBlendFactor::ONE;
3335/// source color
3336pub const SDL_GPU_BLENDFACTOR_SRC_COLOR: SDL_GPUBlendFactor = SDL_GPUBlendFactor::SRC_COLOR;
3337/// 1 - source color
3338pub const SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_COLOR: SDL_GPUBlendFactor =
3339 SDL_GPUBlendFactor::ONE_MINUS_SRC_COLOR;
3340/// destination color
3341pub const SDL_GPU_BLENDFACTOR_DST_COLOR: SDL_GPUBlendFactor = SDL_GPUBlendFactor::DST_COLOR;
3342/// 1 - destination color
3343pub const SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_COLOR: SDL_GPUBlendFactor =
3344 SDL_GPUBlendFactor::ONE_MINUS_DST_COLOR;
3345/// source alpha
3346pub const SDL_GPU_BLENDFACTOR_SRC_ALPHA: SDL_GPUBlendFactor = SDL_GPUBlendFactor::SRC_ALPHA;
3347/// 1 - source alpha
3348pub const SDL_GPU_BLENDFACTOR_ONE_MINUS_SRC_ALPHA: SDL_GPUBlendFactor =
3349 SDL_GPUBlendFactor::ONE_MINUS_SRC_ALPHA;
3350/// destination alpha
3351pub const SDL_GPU_BLENDFACTOR_DST_ALPHA: SDL_GPUBlendFactor = SDL_GPUBlendFactor::DST_ALPHA;
3352/// 1 - destination alpha
3353pub const SDL_GPU_BLENDFACTOR_ONE_MINUS_DST_ALPHA: SDL_GPUBlendFactor =
3354 SDL_GPUBlendFactor::ONE_MINUS_DST_ALPHA;
3355/// blend constant
3356pub const SDL_GPU_BLENDFACTOR_CONSTANT_COLOR: SDL_GPUBlendFactor =
3357 SDL_GPUBlendFactor::CONSTANT_COLOR;
3358/// 1 - blend constant
3359pub const SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR: SDL_GPUBlendFactor =
3360 SDL_GPUBlendFactor::ONE_MINUS_CONSTANT_COLOR;
3361/// min(source alpha, 1 - destination alpha)
3362pub const SDL_GPU_BLENDFACTOR_SRC_ALPHA_SATURATE: SDL_GPUBlendFactor =
3363 SDL_GPUBlendFactor::SRC_ALPHA_SATURATE;
3364
3365#[cfg(feature = "metadata")]
3366impl sdl3_sys::metadata::GroupMetadata for SDL_GPUBlendFactor {
3367 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
3368 &crate::metadata::gpu::METADATA_SDL_GPUBlendFactor;
3369}
3370
3371/// Specifies which color components are written in a graphics pipeline.
3372///
3373/// ## Availability
3374/// This datatype is available since SDL 3.2.0.
3375///
3376/// ## See also
3377/// - [`SDL_CreateGPUGraphicsPipeline`]
3378///
3379/// ## Known values (`sdl3-sys`)
3380/// | Associated constant | Global constant | Description |
3381/// | ------------------- | --------------- | ----------- |
3382/// | [`R`](SDL_GPUColorComponentFlags::R) | [`SDL_GPU_COLORCOMPONENT_R`] | the red component |
3383/// | [`G`](SDL_GPUColorComponentFlags::G) | [`SDL_GPU_COLORCOMPONENT_G`] | the green component |
3384/// | [`B`](SDL_GPUColorComponentFlags::B) | [`SDL_GPU_COLORCOMPONENT_B`] | the blue component |
3385/// | [`A`](SDL_GPUColorComponentFlags::A) | [`SDL_GPU_COLORCOMPONENT_A`] | the alpha component |
3386#[repr(transparent)]
3387#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
3388pub struct SDL_GPUColorComponentFlags(pub Uint8);
3389
3390impl ::core::cmp::PartialEq<Uint8> for SDL_GPUColorComponentFlags {
3391 #[inline(always)]
3392 fn eq(&self, other: &Uint8) -> bool {
3393 &self.0 == other
3394 }
3395}
3396
3397impl ::core::cmp::PartialEq<SDL_GPUColorComponentFlags> for Uint8 {
3398 #[inline(always)]
3399 fn eq(&self, other: &SDL_GPUColorComponentFlags) -> bool {
3400 self == &other.0
3401 }
3402}
3403
3404impl From<SDL_GPUColorComponentFlags> for Uint8 {
3405 #[inline(always)]
3406 fn from(value: SDL_GPUColorComponentFlags) -> Self {
3407 value.0
3408 }
3409}
3410
3411#[cfg(feature = "debug-impls")]
3412impl ::core::fmt::Debug for SDL_GPUColorComponentFlags {
3413 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3414 let mut first = true;
3415 let all_bits = 0;
3416 write!(f, "SDL_GPUColorComponentFlags(")?;
3417 let all_bits = all_bits | Self::R.0;
3418 if (Self::R != 0 || self.0 == 0) && *self & Self::R == Self::R {
3419 if !first {
3420 write!(f, " | ")?;
3421 }
3422 first = false;
3423 write!(f, "R")?;
3424 }
3425 let all_bits = all_bits | Self::G.0;
3426 if (Self::G != 0 || self.0 == 0) && *self & Self::G == Self::G {
3427 if !first {
3428 write!(f, " | ")?;
3429 }
3430 first = false;
3431 write!(f, "G")?;
3432 }
3433 let all_bits = all_bits | Self::B.0;
3434 if (Self::B != 0 || self.0 == 0) && *self & Self::B == Self::B {
3435 if !first {
3436 write!(f, " | ")?;
3437 }
3438 first = false;
3439 write!(f, "B")?;
3440 }
3441 let all_bits = all_bits | Self::A.0;
3442 if (Self::A != 0 || self.0 == 0) && *self & Self::A == Self::A {
3443 if !first {
3444 write!(f, " | ")?;
3445 }
3446 first = false;
3447 write!(f, "A")?;
3448 }
3449
3450 if self.0 & !all_bits != 0 {
3451 if !first {
3452 write!(f, " | ")?;
3453 }
3454 write!(f, "{:#x}", self.0)?;
3455 } else if first {
3456 write!(f, "0")?;
3457 }
3458 write!(f, ")")
3459 }
3460}
3461
3462impl ::core::ops::BitAnd for SDL_GPUColorComponentFlags {
3463 type Output = Self;
3464
3465 #[inline(always)]
3466 fn bitand(self, rhs: Self) -> Self::Output {
3467 Self(self.0 & rhs.0)
3468 }
3469}
3470
3471impl ::core::ops::BitAndAssign for SDL_GPUColorComponentFlags {
3472 #[inline(always)]
3473 fn bitand_assign(&mut self, rhs: Self) {
3474 self.0 &= rhs.0;
3475 }
3476}
3477
3478impl ::core::ops::BitOr for SDL_GPUColorComponentFlags {
3479 type Output = Self;
3480
3481 #[inline(always)]
3482 fn bitor(self, rhs: Self) -> Self::Output {
3483 Self(self.0 | rhs.0)
3484 }
3485}
3486
3487impl ::core::ops::BitOrAssign for SDL_GPUColorComponentFlags {
3488 #[inline(always)]
3489 fn bitor_assign(&mut self, rhs: Self) {
3490 self.0 |= rhs.0;
3491 }
3492}
3493
3494impl ::core::ops::BitXor for SDL_GPUColorComponentFlags {
3495 type Output = Self;
3496
3497 #[inline(always)]
3498 fn bitxor(self, rhs: Self) -> Self::Output {
3499 Self(self.0 ^ rhs.0)
3500 }
3501}
3502
3503impl ::core::ops::BitXorAssign for SDL_GPUColorComponentFlags {
3504 #[inline(always)]
3505 fn bitxor_assign(&mut self, rhs: Self) {
3506 self.0 ^= rhs.0;
3507 }
3508}
3509
3510impl ::core::ops::Not for SDL_GPUColorComponentFlags {
3511 type Output = Self;
3512
3513 #[inline(always)]
3514 fn not(self) -> Self::Output {
3515 Self(!self.0)
3516 }
3517}
3518
3519impl SDL_GPUColorComponentFlags {
3520 /// the red component
3521 pub const R: Self = Self((1_u32 as Uint8));
3522 /// the green component
3523 pub const G: Self = Self((2_u32 as Uint8));
3524 /// the blue component
3525 pub const B: Self = Self((4_u32 as Uint8));
3526 /// the alpha component
3527 pub const A: Self = Self((8_u32 as Uint8));
3528}
3529
3530/// the red component
3531pub const SDL_GPU_COLORCOMPONENT_R: SDL_GPUColorComponentFlags = SDL_GPUColorComponentFlags::R;
3532/// the green component
3533pub const SDL_GPU_COLORCOMPONENT_G: SDL_GPUColorComponentFlags = SDL_GPUColorComponentFlags::G;
3534/// the blue component
3535pub const SDL_GPU_COLORCOMPONENT_B: SDL_GPUColorComponentFlags = SDL_GPUColorComponentFlags::B;
3536/// the alpha component
3537pub const SDL_GPU_COLORCOMPONENT_A: SDL_GPUColorComponentFlags = SDL_GPUColorComponentFlags::A;
3538
3539#[cfg(feature = "metadata")]
3540impl sdl3_sys::metadata::GroupMetadata for SDL_GPUColorComponentFlags {
3541 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
3542 &crate::metadata::gpu::METADATA_SDL_GPUColorComponentFlags;
3543}
3544
3545/// Specifies a filter operation used by a sampler.
3546///
3547/// ## Availability
3548/// This enum is available since SDL 3.2.0.
3549///
3550/// ## See also
3551/// - [`SDL_CreateGPUSampler`]
3552///
3553/// ## Known values (`sdl3-sys`)
3554/// | Associated constant | Global constant | Description |
3555/// | ------------------- | --------------- | ----------- |
3556/// | [`NEAREST`](SDL_GPUFilter::NEAREST) | [`SDL_GPU_FILTER_NEAREST`] | Point filtering. |
3557/// | [`LINEAR`](SDL_GPUFilter::LINEAR) | [`SDL_GPU_FILTER_LINEAR`] | Linear filtering. |
3558#[repr(transparent)]
3559#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
3560pub struct SDL_GPUFilter(pub ::core::ffi::c_int);
3561
3562impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUFilter {
3563 #[inline(always)]
3564 fn eq(&self, other: &::core::ffi::c_int) -> bool {
3565 &self.0 == other
3566 }
3567}
3568
3569impl ::core::cmp::PartialEq<SDL_GPUFilter> for ::core::ffi::c_int {
3570 #[inline(always)]
3571 fn eq(&self, other: &SDL_GPUFilter) -> bool {
3572 self == &other.0
3573 }
3574}
3575
3576impl From<SDL_GPUFilter> for ::core::ffi::c_int {
3577 #[inline(always)]
3578 fn from(value: SDL_GPUFilter) -> Self {
3579 value.0
3580 }
3581}
3582
3583#[cfg(feature = "debug-impls")]
3584impl ::core::fmt::Debug for SDL_GPUFilter {
3585 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3586 #[allow(unreachable_patterns)]
3587 f.write_str(match *self {
3588 Self::NEAREST => "SDL_GPU_FILTER_NEAREST",
3589 Self::LINEAR => "SDL_GPU_FILTER_LINEAR",
3590
3591 _ => return write!(f, "SDL_GPUFilter({})", self.0),
3592 })
3593 }
3594}
3595
3596impl SDL_GPUFilter {
3597 /// Point filtering.
3598 pub const NEAREST: Self = Self((0 as ::core::ffi::c_int));
3599 /// Linear filtering.
3600 pub const LINEAR: Self = Self((1 as ::core::ffi::c_int));
3601}
3602
3603/// Point filtering.
3604pub const SDL_GPU_FILTER_NEAREST: SDL_GPUFilter = SDL_GPUFilter::NEAREST;
3605/// Linear filtering.
3606pub const SDL_GPU_FILTER_LINEAR: SDL_GPUFilter = SDL_GPUFilter::LINEAR;
3607
3608#[cfg(feature = "metadata")]
3609impl sdl3_sys::metadata::GroupMetadata for SDL_GPUFilter {
3610 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
3611 &crate::metadata::gpu::METADATA_SDL_GPUFilter;
3612}
3613
3614/// Specifies a mipmap mode used by a sampler.
3615///
3616/// ## Availability
3617/// This enum is available since SDL 3.2.0.
3618///
3619/// ## See also
3620/// - [`SDL_CreateGPUSampler`]
3621///
3622/// ## Known values (`sdl3-sys`)
3623/// | Associated constant | Global constant | Description |
3624/// | ------------------- | --------------- | ----------- |
3625/// | [`NEAREST`](SDL_GPUSamplerMipmapMode::NEAREST) | [`SDL_GPU_SAMPLERMIPMAPMODE_NEAREST`] | Point filtering. |
3626/// | [`LINEAR`](SDL_GPUSamplerMipmapMode::LINEAR) | [`SDL_GPU_SAMPLERMIPMAPMODE_LINEAR`] | Linear filtering. |
3627#[repr(transparent)]
3628#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
3629pub struct SDL_GPUSamplerMipmapMode(pub ::core::ffi::c_int);
3630
3631impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUSamplerMipmapMode {
3632 #[inline(always)]
3633 fn eq(&self, other: &::core::ffi::c_int) -> bool {
3634 &self.0 == other
3635 }
3636}
3637
3638impl ::core::cmp::PartialEq<SDL_GPUSamplerMipmapMode> for ::core::ffi::c_int {
3639 #[inline(always)]
3640 fn eq(&self, other: &SDL_GPUSamplerMipmapMode) -> bool {
3641 self == &other.0
3642 }
3643}
3644
3645impl From<SDL_GPUSamplerMipmapMode> for ::core::ffi::c_int {
3646 #[inline(always)]
3647 fn from(value: SDL_GPUSamplerMipmapMode) -> Self {
3648 value.0
3649 }
3650}
3651
3652#[cfg(feature = "debug-impls")]
3653impl ::core::fmt::Debug for SDL_GPUSamplerMipmapMode {
3654 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3655 #[allow(unreachable_patterns)]
3656 f.write_str(match *self {
3657 Self::NEAREST => "SDL_GPU_SAMPLERMIPMAPMODE_NEAREST",
3658 Self::LINEAR => "SDL_GPU_SAMPLERMIPMAPMODE_LINEAR",
3659
3660 _ => return write!(f, "SDL_GPUSamplerMipmapMode({})", self.0),
3661 })
3662 }
3663}
3664
3665impl SDL_GPUSamplerMipmapMode {
3666 /// Point filtering.
3667 pub const NEAREST: Self = Self((0 as ::core::ffi::c_int));
3668 /// Linear filtering.
3669 pub const LINEAR: Self = Self((1 as ::core::ffi::c_int));
3670}
3671
3672/// Point filtering.
3673pub const SDL_GPU_SAMPLERMIPMAPMODE_NEAREST: SDL_GPUSamplerMipmapMode =
3674 SDL_GPUSamplerMipmapMode::NEAREST;
3675/// Linear filtering.
3676pub const SDL_GPU_SAMPLERMIPMAPMODE_LINEAR: SDL_GPUSamplerMipmapMode =
3677 SDL_GPUSamplerMipmapMode::LINEAR;
3678
3679#[cfg(feature = "metadata")]
3680impl sdl3_sys::metadata::GroupMetadata for SDL_GPUSamplerMipmapMode {
3681 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
3682 &crate::metadata::gpu::METADATA_SDL_GPUSamplerMipmapMode;
3683}
3684
3685/// Specifies behavior of texture sampling when the coordinates exceed the 0-1
3686/// range.
3687///
3688/// ## Availability
3689/// This enum is available since SDL 3.2.0.
3690///
3691/// ## See also
3692/// - [`SDL_CreateGPUSampler`]
3693///
3694/// ## Known values (`sdl3-sys`)
3695/// | Associated constant | Global constant | Description |
3696/// | ------------------- | --------------- | ----------- |
3697/// | [`REPEAT`](SDL_GPUSamplerAddressMode::REPEAT) | [`SDL_GPU_SAMPLERADDRESSMODE_REPEAT`] | Specifies that the coordinates will wrap around. |
3698/// | [`MIRRORED_REPEAT`](SDL_GPUSamplerAddressMode::MIRRORED_REPEAT) | [`SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT`] | Specifies that the coordinates will wrap around mirrored. |
3699/// | [`CLAMP_TO_EDGE`](SDL_GPUSamplerAddressMode::CLAMP_TO_EDGE) | [`SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE`] | Specifies that the coordinates will clamp to the 0-1 range. |
3700#[repr(transparent)]
3701#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
3702pub struct SDL_GPUSamplerAddressMode(pub ::core::ffi::c_int);
3703
3704impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUSamplerAddressMode {
3705 #[inline(always)]
3706 fn eq(&self, other: &::core::ffi::c_int) -> bool {
3707 &self.0 == other
3708 }
3709}
3710
3711impl ::core::cmp::PartialEq<SDL_GPUSamplerAddressMode> for ::core::ffi::c_int {
3712 #[inline(always)]
3713 fn eq(&self, other: &SDL_GPUSamplerAddressMode) -> bool {
3714 self == &other.0
3715 }
3716}
3717
3718impl From<SDL_GPUSamplerAddressMode> for ::core::ffi::c_int {
3719 #[inline(always)]
3720 fn from(value: SDL_GPUSamplerAddressMode) -> Self {
3721 value.0
3722 }
3723}
3724
3725#[cfg(feature = "debug-impls")]
3726impl ::core::fmt::Debug for SDL_GPUSamplerAddressMode {
3727 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3728 #[allow(unreachable_patterns)]
3729 f.write_str(match *self {
3730 Self::REPEAT => "SDL_GPU_SAMPLERADDRESSMODE_REPEAT",
3731 Self::MIRRORED_REPEAT => "SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT",
3732 Self::CLAMP_TO_EDGE => "SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE",
3733
3734 _ => return write!(f, "SDL_GPUSamplerAddressMode({})", self.0),
3735 })
3736 }
3737}
3738
3739impl SDL_GPUSamplerAddressMode {
3740 /// Specifies that the coordinates will wrap around.
3741 pub const REPEAT: Self = Self((0 as ::core::ffi::c_int));
3742 /// Specifies that the coordinates will wrap around mirrored.
3743 pub const MIRRORED_REPEAT: Self = Self((1 as ::core::ffi::c_int));
3744 /// Specifies that the coordinates will clamp to the 0-1 range.
3745 pub const CLAMP_TO_EDGE: Self = Self((2 as ::core::ffi::c_int));
3746}
3747
3748/// Specifies that the coordinates will wrap around.
3749pub const SDL_GPU_SAMPLERADDRESSMODE_REPEAT: SDL_GPUSamplerAddressMode =
3750 SDL_GPUSamplerAddressMode::REPEAT;
3751/// Specifies that the coordinates will wrap around mirrored.
3752pub const SDL_GPU_SAMPLERADDRESSMODE_MIRRORED_REPEAT: SDL_GPUSamplerAddressMode =
3753 SDL_GPUSamplerAddressMode::MIRRORED_REPEAT;
3754/// Specifies that the coordinates will clamp to the 0-1 range.
3755pub const SDL_GPU_SAMPLERADDRESSMODE_CLAMP_TO_EDGE: SDL_GPUSamplerAddressMode =
3756 SDL_GPUSamplerAddressMode::CLAMP_TO_EDGE;
3757
3758#[cfg(feature = "metadata")]
3759impl sdl3_sys::metadata::GroupMetadata for SDL_GPUSamplerAddressMode {
3760 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
3761 &crate::metadata::gpu::METADATA_SDL_GPUSamplerAddressMode;
3762}
3763
3764/// Specifies the timing that will be used to present swapchain textures to the
3765/// OS.
3766///
3767/// VSYNC mode will always be supported. IMMEDIATE and MAILBOX modes may not be
3768/// supported on certain systems.
3769///
3770/// It is recommended to query [`SDL_WindowSupportsGPUPresentMode`] after claiming
3771/// the window if you wish to change the present mode to IMMEDIATE or MAILBOX.
3772///
3773/// - VSYNC: Waits for vblank before presenting. No tearing is possible. If
3774/// there is a pending image to present, the new image is enqueued for
3775/// presentation. Disallows tearing at the cost of visual latency.
3776/// - IMMEDIATE: Immediately presents. Lowest latency option, but tearing may
3777/// occur.
3778/// - MAILBOX: Waits for vblank before presenting. No tearing is possible. If
3779/// there is a pending image to present, the pending image is replaced by the
3780/// new image. Similar to VSYNC, but with reduced visual latency.
3781///
3782/// ## Availability
3783/// This enum is available since SDL 3.2.0.
3784///
3785/// ## See also
3786/// - [`SDL_SetGPUSwapchainParameters`]
3787/// - [`SDL_WindowSupportsGPUPresentMode`]
3788/// - [`SDL_WaitAndAcquireGPUSwapchainTexture`]
3789///
3790/// ## Known values (`sdl3-sys`)
3791/// | Associated constant | Global constant | Description |
3792/// | ------------------- | --------------- | ----------- |
3793/// | [`VSYNC`](SDL_GPUPresentMode::VSYNC) | [`SDL_GPU_PRESENTMODE_VSYNC`] | |
3794/// | [`IMMEDIATE`](SDL_GPUPresentMode::IMMEDIATE) | [`SDL_GPU_PRESENTMODE_IMMEDIATE`] | |
3795/// | [`MAILBOX`](SDL_GPUPresentMode::MAILBOX) | [`SDL_GPU_PRESENTMODE_MAILBOX`] | |
3796#[repr(transparent)]
3797#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
3798pub struct SDL_GPUPresentMode(pub ::core::ffi::c_int);
3799
3800impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUPresentMode {
3801 #[inline(always)]
3802 fn eq(&self, other: &::core::ffi::c_int) -> bool {
3803 &self.0 == other
3804 }
3805}
3806
3807impl ::core::cmp::PartialEq<SDL_GPUPresentMode> for ::core::ffi::c_int {
3808 #[inline(always)]
3809 fn eq(&self, other: &SDL_GPUPresentMode) -> bool {
3810 self == &other.0
3811 }
3812}
3813
3814impl From<SDL_GPUPresentMode> for ::core::ffi::c_int {
3815 #[inline(always)]
3816 fn from(value: SDL_GPUPresentMode) -> Self {
3817 value.0
3818 }
3819}
3820
3821#[cfg(feature = "debug-impls")]
3822impl ::core::fmt::Debug for SDL_GPUPresentMode {
3823 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3824 #[allow(unreachable_patterns)]
3825 f.write_str(match *self {
3826 Self::VSYNC => "SDL_GPU_PRESENTMODE_VSYNC",
3827 Self::IMMEDIATE => "SDL_GPU_PRESENTMODE_IMMEDIATE",
3828 Self::MAILBOX => "SDL_GPU_PRESENTMODE_MAILBOX",
3829
3830 _ => return write!(f, "SDL_GPUPresentMode({})", self.0),
3831 })
3832 }
3833}
3834
3835impl SDL_GPUPresentMode {
3836 pub const VSYNC: Self = Self((0 as ::core::ffi::c_int));
3837 pub const IMMEDIATE: Self = Self((1 as ::core::ffi::c_int));
3838 pub const MAILBOX: Self = Self((2 as ::core::ffi::c_int));
3839}
3840
3841pub const SDL_GPU_PRESENTMODE_VSYNC: SDL_GPUPresentMode = SDL_GPUPresentMode::VSYNC;
3842pub const SDL_GPU_PRESENTMODE_IMMEDIATE: SDL_GPUPresentMode = SDL_GPUPresentMode::IMMEDIATE;
3843pub const SDL_GPU_PRESENTMODE_MAILBOX: SDL_GPUPresentMode = SDL_GPUPresentMode::MAILBOX;
3844
3845#[cfg(feature = "metadata")]
3846impl sdl3_sys::metadata::GroupMetadata for SDL_GPUPresentMode {
3847 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
3848 &crate::metadata::gpu::METADATA_SDL_GPUPresentMode;
3849}
3850
3851/// Specifies the texture format and colorspace of the swapchain textures.
3852///
3853/// SDR will always be supported. Other compositions may not be supported on
3854/// certain systems.
3855///
3856/// It is recommended to query [`SDL_WindowSupportsGPUSwapchainComposition`] after
3857/// claiming the window if you wish to change the swapchain composition from
3858/// SDR.
3859///
3860/// - SDR: B8G8R8A8 or R8G8B8A8 swapchain. Pixel values are in sRGB encoding.
3861/// - SDR_LINEAR: B8G8R8A8_SRGB or R8G8B8A8_SRGB swapchain. Pixel values are
3862/// stored in memory in sRGB encoding but accessed in shaders in "linear
3863/// sRGB" encoding which is sRGB but with a linear transfer function.
3864/// - HDR_EXTENDED_LINEAR: R16G16B16A16_FLOAT swapchain. Pixel values are in
3865/// extended linear sRGB encoding and permits values outside of the \[0, 1\]
3866/// range.
3867/// - HDR10_ST2084: A2R10G10B10 or A2B10G10R10 swapchain. Pixel values are in
3868/// BT.2020 ST2084 (PQ) encoding.
3869///
3870/// ## Availability
3871/// This enum is available since SDL 3.2.0.
3872///
3873/// ## See also
3874/// - [`SDL_SetGPUSwapchainParameters`]
3875/// - [`SDL_WindowSupportsGPUSwapchainComposition`]
3876/// - [`SDL_WaitAndAcquireGPUSwapchainTexture`]
3877///
3878/// ## Known values (`sdl3-sys`)
3879/// | Associated constant | Global constant | Description |
3880/// | ------------------- | --------------- | ----------- |
3881/// | [`SDR`](SDL_GPUSwapchainComposition::SDR) | [`SDL_GPU_SWAPCHAINCOMPOSITION_SDR`] | |
3882/// | [`SDR_LINEAR`](SDL_GPUSwapchainComposition::SDR_LINEAR) | [`SDL_GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR`] | |
3883/// | [`HDR_EXTENDED_LINEAR`](SDL_GPUSwapchainComposition::HDR_EXTENDED_LINEAR) | [`SDL_GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR`] | |
3884/// | [`HDR10_ST2084`](SDL_GPUSwapchainComposition::HDR10_ST2084) | [`SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084`] | |
3885#[repr(transparent)]
3886#[derive(Clone, Copy, Default, PartialEq, Eq, PartialOrd, Ord, Hash)]
3887pub struct SDL_GPUSwapchainComposition(pub ::core::ffi::c_int);
3888
3889impl ::core::cmp::PartialEq<::core::ffi::c_int> for SDL_GPUSwapchainComposition {
3890 #[inline(always)]
3891 fn eq(&self, other: &::core::ffi::c_int) -> bool {
3892 &self.0 == other
3893 }
3894}
3895
3896impl ::core::cmp::PartialEq<SDL_GPUSwapchainComposition> for ::core::ffi::c_int {
3897 #[inline(always)]
3898 fn eq(&self, other: &SDL_GPUSwapchainComposition) -> bool {
3899 self == &other.0
3900 }
3901}
3902
3903impl From<SDL_GPUSwapchainComposition> for ::core::ffi::c_int {
3904 #[inline(always)]
3905 fn from(value: SDL_GPUSwapchainComposition) -> Self {
3906 value.0
3907 }
3908}
3909
3910#[cfg(feature = "debug-impls")]
3911impl ::core::fmt::Debug for SDL_GPUSwapchainComposition {
3912 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
3913 #[allow(unreachable_patterns)]
3914 f.write_str(match *self {
3915 Self::SDR => "SDL_GPU_SWAPCHAINCOMPOSITION_SDR",
3916 Self::SDR_LINEAR => "SDL_GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR",
3917 Self::HDR_EXTENDED_LINEAR => "SDL_GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR",
3918 Self::HDR10_ST2084 => "SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084",
3919
3920 _ => return write!(f, "SDL_GPUSwapchainComposition({})", self.0),
3921 })
3922 }
3923}
3924
3925impl SDL_GPUSwapchainComposition {
3926 pub const SDR: Self = Self((0 as ::core::ffi::c_int));
3927 pub const SDR_LINEAR: Self = Self((1 as ::core::ffi::c_int));
3928 pub const HDR_EXTENDED_LINEAR: Self = Self((2 as ::core::ffi::c_int));
3929 pub const HDR10_ST2084: Self = Self((3 as ::core::ffi::c_int));
3930}
3931
3932pub const SDL_GPU_SWAPCHAINCOMPOSITION_SDR: SDL_GPUSwapchainComposition =
3933 SDL_GPUSwapchainComposition::SDR;
3934pub const SDL_GPU_SWAPCHAINCOMPOSITION_SDR_LINEAR: SDL_GPUSwapchainComposition =
3935 SDL_GPUSwapchainComposition::SDR_LINEAR;
3936pub const SDL_GPU_SWAPCHAINCOMPOSITION_HDR_EXTENDED_LINEAR: SDL_GPUSwapchainComposition =
3937 SDL_GPUSwapchainComposition::HDR_EXTENDED_LINEAR;
3938pub const SDL_GPU_SWAPCHAINCOMPOSITION_HDR10_ST2084: SDL_GPUSwapchainComposition =
3939 SDL_GPUSwapchainComposition::HDR10_ST2084;
3940
3941#[cfg(feature = "metadata")]
3942impl sdl3_sys::metadata::GroupMetadata for SDL_GPUSwapchainComposition {
3943 const GROUP_METADATA: &'static sdl3_sys::metadata::Group =
3944 &crate::metadata::gpu::METADATA_SDL_GPUSwapchainComposition;
3945}
3946
3947/// A structure specifying a viewport.
3948///
3949/// ## Availability
3950/// This struct is available since SDL 3.2.0.
3951///
3952/// ## See also
3953/// - [`SDL_SetGPUViewport`]
3954#[repr(C)]
3955#[derive(Clone, Copy, Default, PartialEq)]
3956#[cfg_attr(feature = "debug-impls", derive(Debug))]
3957pub struct SDL_GPUViewport {
3958 /// The left offset of the viewport.
3959 pub x: ::core::ffi::c_float,
3960 /// The top offset of the viewport.
3961 pub y: ::core::ffi::c_float,
3962 /// The width of the viewport.
3963 pub w: ::core::ffi::c_float,
3964 /// The height of the viewport.
3965 pub h: ::core::ffi::c_float,
3966 /// The minimum depth of the viewport.
3967 pub min_depth: ::core::ffi::c_float,
3968 /// The maximum depth of the viewport.
3969 pub max_depth: ::core::ffi::c_float,
3970}
3971
3972/// A structure specifying parameters related to transferring data to or from a
3973/// texture.
3974///
3975/// If either of `pixels_per_row` or `rows_per_layer` is zero, then width and
3976/// height of passed [`SDL_GPUTextureRegion`] to [`SDL_UploadToGPUTexture`] or
3977/// [`SDL_DownloadFromGPUTexture`] are used as default values respectively and data
3978/// is considered to be tightly packed.
3979///
3980/// **WARNING**: Direct3D 12 requires texture data row pitch to be 256 byte
3981/// aligned, and offsets to be aligned to 512 bytes. If they are not, SDL will
3982/// make a temporary copy of the data that is properly aligned, but this adds
3983/// overhead to the transfer process. Apps can avoid this by aligning their
3984/// data appropriately, or using a different GPU backend than Direct3D 12.
3985///
3986/// ## Availability
3987/// This struct is available since SDL 3.2.0.
3988///
3989/// ## See also
3990/// - [`SDL_UploadToGPUTexture`]
3991/// - [`SDL_DownloadFromGPUTexture`]
3992#[repr(C)]
3993#[derive(Clone, Copy)]
3994#[cfg_attr(feature = "debug-impls", derive(Debug))]
3995pub struct SDL_GPUTextureTransferInfo {
3996 /// The transfer buffer used in the transfer operation.
3997 pub transfer_buffer: *mut SDL_GPUTransferBuffer,
3998 /// The starting byte of the image data in the transfer buffer.
3999 pub offset: Uint32,
4000 /// The number of pixels from one row to the next.
4001 pub pixels_per_row: Uint32,
4002 /// The number of rows from one layer/depth-slice to the next.
4003 pub rows_per_layer: Uint32,
4004}
4005
4006impl ::core::default::Default for SDL_GPUTextureTransferInfo {
4007 /// Initialize all fields to zero
4008 #[inline(always)]
4009 fn default() -> Self {
4010 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
4011 }
4012}
4013
4014/// A structure specifying a location in a transfer buffer.
4015///
4016/// Used when transferring buffer data to or from a transfer buffer.
4017///
4018/// ## Availability
4019/// This struct is available since SDL 3.2.0.
4020///
4021/// ## See also
4022/// - [`SDL_UploadToGPUBuffer`]
4023/// - [`SDL_DownloadFromGPUBuffer`]
4024#[repr(C)]
4025#[derive(Clone, Copy)]
4026#[cfg_attr(feature = "debug-impls", derive(Debug))]
4027pub struct SDL_GPUTransferBufferLocation {
4028 /// The transfer buffer used in the transfer operation.
4029 pub transfer_buffer: *mut SDL_GPUTransferBuffer,
4030 /// The starting byte of the buffer data in the transfer buffer.
4031 pub offset: Uint32,
4032}
4033
4034impl ::core::default::Default for SDL_GPUTransferBufferLocation {
4035 /// Initialize all fields to zero
4036 #[inline(always)]
4037 fn default() -> Self {
4038 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
4039 }
4040}
4041
4042/// A structure specifying a location in a texture.
4043///
4044/// Used when copying data from one texture to another.
4045///
4046/// ## Availability
4047/// This struct is available since SDL 3.2.0.
4048///
4049/// ## See also
4050/// - [`SDL_CopyGPUTextureToTexture`]
4051#[repr(C)]
4052#[derive(Clone, Copy)]
4053#[cfg_attr(feature = "debug-impls", derive(Debug))]
4054pub struct SDL_GPUTextureLocation {
4055 /// The texture used in the copy operation.
4056 pub texture: *mut SDL_GPUTexture,
4057 /// The mip level index of the location.
4058 pub mip_level: Uint32,
4059 /// The layer index of the location.
4060 pub layer: Uint32,
4061 /// The left offset of the location.
4062 pub x: Uint32,
4063 /// The top offset of the location.
4064 pub y: Uint32,
4065 /// The front offset of the location.
4066 pub z: Uint32,
4067}
4068
4069impl ::core::default::Default for SDL_GPUTextureLocation {
4070 /// Initialize all fields to zero
4071 #[inline(always)]
4072 fn default() -> Self {
4073 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
4074 }
4075}
4076
4077/// A structure specifying a region of a texture.
4078///
4079/// Used when transferring data to or from a texture.
4080///
4081/// ## Availability
4082/// This struct is available since SDL 3.2.0.
4083///
4084/// ## See also
4085/// - [`SDL_UploadToGPUTexture`]
4086/// - [`SDL_DownloadFromGPUTexture`]
4087/// - [`SDL_CreateGPUTexture`]
4088#[repr(C)]
4089#[derive(Clone, Copy)]
4090#[cfg_attr(feature = "debug-impls", derive(Debug))]
4091pub struct SDL_GPUTextureRegion {
4092 /// The texture used in the copy operation.
4093 pub texture: *mut SDL_GPUTexture,
4094 /// The mip level index to transfer.
4095 pub mip_level: Uint32,
4096 /// The layer index to transfer.
4097 pub layer: Uint32,
4098 /// The left offset of the region.
4099 pub x: Uint32,
4100 /// The top offset of the region.
4101 pub y: Uint32,
4102 /// The front offset of the region.
4103 pub z: Uint32,
4104 /// The width of the region.
4105 pub w: Uint32,
4106 /// The height of the region.
4107 pub h: Uint32,
4108 /// The depth of the region.
4109 pub d: Uint32,
4110}
4111
4112impl ::core::default::Default for SDL_GPUTextureRegion {
4113 /// Initialize all fields to zero
4114 #[inline(always)]
4115 fn default() -> Self {
4116 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
4117 }
4118}
4119
4120/// A structure specifying a region of a texture used in the blit operation.
4121///
4122/// ## Availability
4123/// This struct is available since SDL 3.2.0.
4124///
4125/// ## See also
4126/// - [`SDL_BlitGPUTexture`]
4127#[repr(C)]
4128#[derive(Clone, Copy)]
4129#[cfg_attr(feature = "debug-impls", derive(Debug))]
4130pub struct SDL_GPUBlitRegion {
4131 /// The texture.
4132 pub texture: *mut SDL_GPUTexture,
4133 /// The mip level index of the region.
4134 pub mip_level: Uint32,
4135 /// 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.
4136 pub layer_or_depth_plane: Uint32,
4137 /// The left offset of the region.
4138 pub x: Uint32,
4139 /// The top offset of the region.
4140 pub y: Uint32,
4141 /// The width of the region.
4142 pub w: Uint32,
4143 /// The height of the region.
4144 pub h: Uint32,
4145}
4146
4147impl ::core::default::Default for SDL_GPUBlitRegion {
4148 /// Initialize all fields to zero
4149 #[inline(always)]
4150 fn default() -> Self {
4151 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
4152 }
4153}
4154
4155/// A structure specifying a location in a buffer.
4156///
4157/// Used when copying data between buffers.
4158///
4159/// ## Availability
4160/// This struct is available since SDL 3.2.0.
4161///
4162/// ## See also
4163/// - [`SDL_CopyGPUBufferToBuffer`]
4164#[repr(C)]
4165#[derive(Clone, Copy)]
4166#[cfg_attr(feature = "debug-impls", derive(Debug))]
4167pub struct SDL_GPUBufferLocation {
4168 /// The buffer.
4169 pub buffer: *mut SDL_GPUBuffer,
4170 /// The starting byte within the buffer.
4171 pub offset: Uint32,
4172}
4173
4174impl ::core::default::Default for SDL_GPUBufferLocation {
4175 /// Initialize all fields to zero
4176 #[inline(always)]
4177 fn default() -> Self {
4178 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
4179 }
4180}
4181
4182/// A structure specifying a region of a buffer.
4183///
4184/// Used when transferring data to or from buffers.
4185///
4186/// ## Availability
4187/// This struct is available since SDL 3.2.0.
4188///
4189/// ## See also
4190/// - [`SDL_UploadToGPUBuffer`]
4191/// - [`SDL_DownloadFromGPUBuffer`]
4192#[repr(C)]
4193#[derive(Clone, Copy)]
4194#[cfg_attr(feature = "debug-impls", derive(Debug))]
4195pub struct SDL_GPUBufferRegion {
4196 /// The buffer.
4197 pub buffer: *mut SDL_GPUBuffer,
4198 /// The starting byte within the buffer.
4199 pub offset: Uint32,
4200 /// The size in bytes of the region.
4201 pub size: Uint32,
4202}
4203
4204impl ::core::default::Default for SDL_GPUBufferRegion {
4205 /// Initialize all fields to zero
4206 #[inline(always)]
4207 fn default() -> Self {
4208 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
4209 }
4210}
4211
4212/// A structure specifying the parameters of an indirect draw command.
4213///
4214/// Note that the `first_vertex` and `first_instance` parameters are NOT
4215/// compatible with built-in vertex/instance ID variables in shaders (for
4216/// example, SV_VertexID); GPU APIs and shader languages do not define these
4217/// built-in variables consistently, so if your shader depends on them, the
4218/// only way to keep behavior consistent and portable is to always pass 0 for
4219/// the correlating parameter in the draw calls.
4220///
4221/// ## Availability
4222/// This struct is available since SDL 3.2.0.
4223///
4224/// ## See also
4225/// - [`SDL_DrawGPUPrimitivesIndirect`]
4226#[repr(C)]
4227#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
4228#[cfg_attr(feature = "debug-impls", derive(Debug))]
4229pub struct SDL_GPUIndirectDrawCommand {
4230 /// The number of vertices to draw.
4231 pub num_vertices: Uint32,
4232 /// The number of instances to draw.
4233 pub num_instances: Uint32,
4234 /// The index of the first vertex to draw.
4235 pub first_vertex: Uint32,
4236 /// The ID of the first instance to draw.
4237 pub first_instance: Uint32,
4238}
4239
4240/// A structure specifying the parameters of an indexed indirect draw command.
4241///
4242/// Note that the `first_vertex` and `first_instance` parameters are NOT
4243/// compatible with built-in vertex/instance ID variables in shaders (for
4244/// example, SV_VertexID); GPU APIs and shader languages do not define these
4245/// built-in variables consistently, so if your shader depends on them, the
4246/// only way to keep behavior consistent and portable is to always pass 0 for
4247/// the correlating parameter in the draw calls.
4248///
4249/// ## Availability
4250/// This struct is available since SDL 3.2.0.
4251///
4252/// ## See also
4253/// - [`SDL_DrawGPUIndexedPrimitivesIndirect`]
4254#[repr(C)]
4255#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
4256#[cfg_attr(feature = "debug-impls", derive(Debug))]
4257pub struct SDL_GPUIndexedIndirectDrawCommand {
4258 /// The number of indices to draw per instance.
4259 pub num_indices: Uint32,
4260 /// The number of instances to draw.
4261 pub num_instances: Uint32,
4262 /// The base index within the index buffer.
4263 pub first_index: Uint32,
4264 /// The value added to the vertex index before indexing into the vertex buffer.
4265 pub vertex_offset: Sint32,
4266 /// The ID of the first instance to draw.
4267 pub first_instance: Uint32,
4268}
4269
4270/// A structure specifying the parameters of an indexed dispatch command.
4271///
4272/// ## Availability
4273/// This struct is available since SDL 3.2.0.
4274///
4275/// ## See also
4276/// - [`SDL_DispatchGPUComputeIndirect`]
4277#[repr(C)]
4278#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
4279#[cfg_attr(feature = "debug-impls", derive(Debug))]
4280pub struct SDL_GPUIndirectDispatchCommand {
4281 /// The number of local workgroups to dispatch in the X dimension.
4282 pub groupcount_x: Uint32,
4283 /// The number of local workgroups to dispatch in the Y dimension.
4284 pub groupcount_y: Uint32,
4285 /// The number of local workgroups to dispatch in the Z dimension.
4286 pub groupcount_z: Uint32,
4287}
4288
4289/// A structure specifying the parameters of a sampler.
4290///
4291/// Note that mip_lod_bias is a no-op for the Metal driver. For Metal, LOD bias
4292/// must be applied via shader instead.
4293///
4294/// ## Availability
4295/// This function is available since SDL 3.2.0.
4296///
4297/// ## See also
4298/// - [`SDL_CreateGPUSampler`]
4299/// - [`SDL_GPUFilter`]
4300/// - [`SDL_GPUSamplerMipmapMode`]
4301/// - [`SDL_GPUSamplerAddressMode`]
4302/// - [`SDL_GPUCompareOp`]
4303///
4304/// ## Notes for `sdl3-sys`
4305/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.
4306#[repr(C)]
4307#[derive(Clone, Copy, Default, PartialEq)]
4308#[cfg_attr(feature = "debug-impls", derive(Debug))]
4309pub struct SDL_GPUSamplerCreateInfo {
4310 /// The minification filter to apply to lookups.
4311 pub min_filter: SDL_GPUFilter,
4312 /// The magnification filter to apply to lookups.
4313 pub mag_filter: SDL_GPUFilter,
4314 /// The mipmap filter to apply to lookups.
4315 pub mipmap_mode: SDL_GPUSamplerMipmapMode,
4316 /// The addressing mode for U coordinates outside [0, 1).
4317 pub address_mode_u: SDL_GPUSamplerAddressMode,
4318 /// The addressing mode for V coordinates outside [0, 1).
4319 pub address_mode_v: SDL_GPUSamplerAddressMode,
4320 /// The addressing mode for W coordinates outside [0, 1).
4321 pub address_mode_w: SDL_GPUSamplerAddressMode,
4322 /// The bias to be added to mipmap LOD calculation.
4323 pub mip_lod_bias: ::core::ffi::c_float,
4324 /// The anisotropy value clamp used by the sampler. If enable_anisotropy is false, this is ignored.
4325 pub max_anisotropy: ::core::ffi::c_float,
4326 /// The comparison operator to apply to fetched data before filtering.
4327 pub compare_op: SDL_GPUCompareOp,
4328 /// Clamps the minimum of the computed LOD value.
4329 pub min_lod: ::core::ffi::c_float,
4330 /// Clamps the maximum of the computed LOD value.
4331 pub max_lod: ::core::ffi::c_float,
4332 /// true to enable anisotropic filtering.
4333 pub enable_anisotropy: ::core::primitive::bool,
4334 /// true to enable comparison against a reference value during lookups.
4335 pub enable_compare: ::core::primitive::bool,
4336 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
4337 pub padding1: Uint8,
4338 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
4339 pub padding2: Uint8,
4340 /// A properties ID for extensions. Should be 0 if no extensions are needed.
4341 pub props: SDL_PropertiesID,
4342}
4343
4344/// A structure specifying the parameters of vertex buffers used in a graphics
4345/// pipeline.
4346///
4347/// When you call [`SDL_BindGPUVertexBuffers`], you specify the binding slots of
4348/// the vertex buffers. For example if you called [`SDL_BindGPUVertexBuffers`] with
4349/// a first_slot of 2 and num_bindings of 3, the binding slots 2, 3, 4 would be
4350/// used by the vertex buffers you pass in.
4351///
4352/// Vertex attributes are linked to buffers via the buffer_slot field of
4353/// [`SDL_GPUVertexAttribute`]. For example, if an attribute has a buffer_slot of
4354/// 0, then that attribute belongs to the vertex buffer bound at slot 0.
4355///
4356/// ## Availability
4357/// This struct is available since SDL 3.2.0.
4358///
4359/// ## See also
4360/// - [`SDL_GPUVertexAttribute`]
4361/// - [`SDL_GPUVertexInputRate`]
4362#[repr(C)]
4363#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
4364#[cfg_attr(feature = "debug-impls", derive(Debug))]
4365pub struct SDL_GPUVertexBufferDescription {
4366 /// The binding slot of the vertex buffer.
4367 pub slot: Uint32,
4368 /// The size of a single element + the offset between elements.
4369 pub pitch: Uint32,
4370 /// Whether attribute addressing is a function of the vertex index or instance index.
4371 pub input_rate: SDL_GPUVertexInputRate,
4372 /// Reserved for future use. Must be set to 0.
4373 pub instance_step_rate: Uint32,
4374}
4375
4376/// A structure specifying a vertex attribute.
4377///
4378/// All vertex attribute locations provided to an [`SDL_GPUVertexInputState`] must
4379/// be unique.
4380///
4381/// ## Availability
4382/// This struct is available since SDL 3.2.0.
4383///
4384/// ## See also
4385/// - [`SDL_GPUVertexBufferDescription`]
4386/// - [`SDL_GPUVertexInputState`]
4387/// - [`SDL_GPUVertexElementFormat`]
4388#[repr(C)]
4389#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
4390#[cfg_attr(feature = "debug-impls", derive(Debug))]
4391pub struct SDL_GPUVertexAttribute {
4392 /// The shader input location index.
4393 pub location: Uint32,
4394 /// The binding slot of the associated vertex buffer.
4395 pub buffer_slot: Uint32,
4396 /// The size and type of the attribute data.
4397 pub format: SDL_GPUVertexElementFormat,
4398 /// The byte offset of this attribute relative to the start of the vertex element.
4399 pub offset: Uint32,
4400}
4401
4402/// A structure specifying the parameters of a graphics pipeline vertex input
4403/// state.
4404///
4405/// ## Availability
4406/// This struct is available since SDL 3.2.0.
4407///
4408/// ## See also
4409/// - [`SDL_GPUGraphicsPipelineCreateInfo`]
4410/// - [`SDL_GPUVertexBufferDescription`]
4411/// - [`SDL_GPUVertexAttribute`]
4412#[repr(C)]
4413#[derive(Clone, Copy)]
4414#[cfg_attr(feature = "debug-impls", derive(Debug))]
4415pub struct SDL_GPUVertexInputState {
4416 /// A pointer to an array of vertex buffer descriptions.
4417 pub vertex_buffer_descriptions: *const SDL_GPUVertexBufferDescription,
4418 /// The number of vertex buffer descriptions in the above array.
4419 pub num_vertex_buffers: Uint32,
4420 /// A pointer to an array of vertex attribute descriptions.
4421 pub vertex_attributes: *const SDL_GPUVertexAttribute,
4422 /// The number of vertex attribute descriptions in the above array.
4423 pub num_vertex_attributes: Uint32,
4424}
4425
4426impl ::core::default::Default for SDL_GPUVertexInputState {
4427 /// Initialize all fields to zero
4428 #[inline(always)]
4429 fn default() -> Self {
4430 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
4431 }
4432}
4433
4434/// A structure specifying the stencil operation state of a graphics pipeline.
4435///
4436/// ## Availability
4437/// This struct is available since SDL 3.2.0.
4438///
4439/// ## See also
4440/// - [`SDL_GPUDepthStencilState`]
4441#[repr(C)]
4442#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
4443#[cfg_attr(feature = "debug-impls", derive(Debug))]
4444pub struct SDL_GPUStencilOpState {
4445 /// The action performed on samples that fail the stencil test.
4446 pub fail_op: SDL_GPUStencilOp,
4447 /// The action performed on samples that pass the depth and stencil tests.
4448 pub pass_op: SDL_GPUStencilOp,
4449 /// The action performed on samples that pass the stencil test and fail the depth test.
4450 pub depth_fail_op: SDL_GPUStencilOp,
4451 /// The comparison operator used in the stencil test.
4452 pub compare_op: SDL_GPUCompareOp,
4453}
4454
4455/// A structure specifying the blend state of a color target.
4456///
4457/// ## Availability
4458/// This struct is available since SDL 3.2.0.
4459///
4460/// ## See also
4461/// - [`SDL_GPUColorTargetDescription`]
4462/// - [`SDL_GPUBlendFactor`]
4463/// - [`SDL_GPUBlendOp`]
4464/// - [`SDL_GPUColorComponentFlags`]
4465///
4466/// ## Notes for `sdl3-sys`
4467/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.
4468#[repr(C)]
4469#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
4470#[cfg_attr(feature = "debug-impls", derive(Debug))]
4471pub struct SDL_GPUColorTargetBlendState {
4472 /// The value to be multiplied by the source RGB value.
4473 pub src_color_blendfactor: SDL_GPUBlendFactor,
4474 /// The value to be multiplied by the destination RGB value.
4475 pub dst_color_blendfactor: SDL_GPUBlendFactor,
4476 /// The blend operation for the RGB components.
4477 pub color_blend_op: SDL_GPUBlendOp,
4478 /// The value to be multiplied by the source alpha.
4479 pub src_alpha_blendfactor: SDL_GPUBlendFactor,
4480 /// The value to be multiplied by the destination alpha.
4481 pub dst_alpha_blendfactor: SDL_GPUBlendFactor,
4482 /// The blend operation for the alpha component.
4483 pub alpha_blend_op: SDL_GPUBlendOp,
4484 /// A bitmask specifying which of the RGBA components are enabled for writing. Writes to all channels if enable_color_write_mask is false.
4485 pub color_write_mask: SDL_GPUColorComponentFlags,
4486 /// Whether blending is enabled for the color target.
4487 pub enable_blend: ::core::primitive::bool,
4488 /// Whether the color write mask is enabled.
4489 pub enable_color_write_mask: ::core::primitive::bool,
4490 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
4491 pub padding1: Uint8,
4492 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
4493 pub padding2: Uint8,
4494}
4495
4496/// A structure specifying code and metadata for creating a shader object.
4497///
4498/// ## Availability
4499/// This struct is available since SDL 3.2.0.
4500///
4501/// ## See also
4502/// - [`SDL_CreateGPUShader`]
4503/// - [`SDL_GPUShaderFormat`]
4504/// - [`SDL_GPUShaderStage`]
4505#[repr(C)]
4506#[derive(Clone, Copy)]
4507#[cfg_attr(feature = "debug-impls", derive(Debug))]
4508pub struct SDL_GPUShaderCreateInfo {
4509 /// The size in bytes of the code pointed to.
4510 pub code_size: ::core::primitive::usize,
4511 /// A pointer to shader code.
4512 pub code: *const Uint8,
4513 /// A pointer to a null-terminated UTF-8 string specifying the entry point function name for the shader.
4514 pub entrypoint: *const ::core::ffi::c_char,
4515 /// The format of the shader code.
4516 pub format: SDL_GPUShaderFormat,
4517 /// The stage the shader program corresponds to.
4518 pub stage: SDL_GPUShaderStage,
4519 /// The number of samplers defined in the shader.
4520 pub num_samplers: Uint32,
4521 /// The number of storage textures defined in the shader.
4522 pub num_storage_textures: Uint32,
4523 /// The number of storage buffers defined in the shader.
4524 pub num_storage_buffers: Uint32,
4525 /// The number of uniform buffers defined in the shader.
4526 pub num_uniform_buffers: Uint32,
4527 /// A properties ID for extensions. Should be 0 if no extensions are needed.
4528 pub props: SDL_PropertiesID,
4529}
4530
4531impl ::core::default::Default for SDL_GPUShaderCreateInfo {
4532 /// Initialize all fields to zero
4533 #[inline(always)]
4534 fn default() -> Self {
4535 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
4536 }
4537}
4538
4539/// A structure specifying the parameters of a texture.
4540///
4541/// Usage flags can be bitwise OR'd together for combinations of usages. Note
4542/// that certain usage combinations are invalid, for example SAMPLER and
4543/// GRAPHICS_STORAGE.
4544///
4545/// ## Availability
4546/// This struct is available since SDL 3.2.0.
4547///
4548/// ## See also
4549/// - [`SDL_CreateGPUTexture`]
4550/// - [`SDL_GPUTextureType`]
4551/// - [`SDL_GPUTextureFormat`]
4552/// - [`SDL_GPUTextureUsageFlags`]
4553/// - [`SDL_GPUSampleCount`]
4554#[repr(C)]
4555#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
4556#[cfg_attr(feature = "debug-impls", derive(Debug))]
4557pub struct SDL_GPUTextureCreateInfo {
4558 /// The base dimensionality of the texture.
4559 pub r#type: SDL_GPUTextureType,
4560 /// The pixel format of the texture.
4561 pub format: SDL_GPUTextureFormat,
4562 /// How the texture is intended to be used by the client.
4563 pub usage: SDL_GPUTextureUsageFlags,
4564 /// The width of the texture.
4565 pub width: Uint32,
4566 /// The height of the texture.
4567 pub height: Uint32,
4568 /// 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.
4569 pub layer_count_or_depth: Uint32,
4570 /// The number of mip levels in the texture.
4571 pub num_levels: Uint32,
4572 /// The number of samples per texel. Only applies if the texture is used as a render target.
4573 pub sample_count: SDL_GPUSampleCount,
4574 /// A properties ID for extensions. Should be 0 if no extensions are needed.
4575 pub props: SDL_PropertiesID,
4576}
4577
4578/// A structure specifying the parameters of a buffer.
4579///
4580/// Usage flags can be bitwise OR'd together for combinations of usages. Note
4581/// that certain combinations are invalid, for example VERTEX and INDEX.
4582///
4583/// ## Availability
4584/// This struct is available since SDL 3.2.0.
4585///
4586/// ## See also
4587/// - [`SDL_CreateGPUBuffer`]
4588/// - [`SDL_GPUBufferUsageFlags`]
4589#[repr(C)]
4590#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
4591#[cfg_attr(feature = "debug-impls", derive(Debug))]
4592pub struct SDL_GPUBufferCreateInfo {
4593 /// How the buffer is intended to be used by the client.
4594 pub usage: SDL_GPUBufferUsageFlags,
4595 /// The size in bytes of the buffer.
4596 pub size: Uint32,
4597 /// A properties ID for extensions. Should be 0 if no extensions are needed.
4598 pub props: SDL_PropertiesID,
4599}
4600
4601/// A structure specifying the parameters of a transfer buffer.
4602///
4603/// ## Availability
4604/// This struct is available since SDL 3.2.0.
4605///
4606/// ## See also
4607/// - [`SDL_CreateGPUTransferBuffer`]
4608#[repr(C)]
4609#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
4610#[cfg_attr(feature = "debug-impls", derive(Debug))]
4611pub struct SDL_GPUTransferBufferCreateInfo {
4612 /// How the transfer buffer is intended to be used by the client.
4613 pub usage: SDL_GPUTransferBufferUsage,
4614 /// The size in bytes of the transfer buffer.
4615 pub size: Uint32,
4616 /// A properties ID for extensions. Should be 0 if no extensions are needed.
4617 pub props: SDL_PropertiesID,
4618}
4619
4620/// A structure specifying the parameters of the graphics pipeline rasterizer
4621/// state.
4622///
4623/// Note that [`SDL_GPU_FILLMODE_LINE`] is not supported on many Android devices.
4624/// For those devices, the fill mode will automatically fall back to FILL.
4625///
4626/// Also note that the D3D12 driver will enable depth clamping even if
4627/// enable_depth_clip is true. If you need this clamp+clip behavior, consider
4628/// enabling depth clip and then manually clamping depth in your fragment
4629/// shaders on Metal and Vulkan.
4630///
4631/// ## Availability
4632/// This struct is available since SDL 3.2.0.
4633///
4634/// ## See also
4635/// - [`SDL_GPUGraphicsPipelineCreateInfo`]
4636///
4637/// ## Notes for `sdl3-sys`
4638/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.
4639#[repr(C)]
4640#[derive(Clone, Copy, Default, PartialEq)]
4641#[cfg_attr(feature = "debug-impls", derive(Debug))]
4642pub struct SDL_GPURasterizerState {
4643 /// Whether polygons will be filled in or drawn as lines.
4644 pub fill_mode: SDL_GPUFillMode,
4645 /// The facing direction in which triangles will be culled.
4646 pub cull_mode: SDL_GPUCullMode,
4647 /// The vertex winding that will cause a triangle to be determined as front-facing.
4648 pub front_face: SDL_GPUFrontFace,
4649 /// A scalar factor controlling the depth value added to each fragment.
4650 pub depth_bias_constant_factor: ::core::ffi::c_float,
4651 /// The maximum depth bias of a fragment.
4652 pub depth_bias_clamp: ::core::ffi::c_float,
4653 /// A scalar factor applied to a fragment's slope in depth calculations.
4654 pub depth_bias_slope_factor: ::core::ffi::c_float,
4655 /// true to bias fragment depth values.
4656 pub enable_depth_bias: ::core::primitive::bool,
4657 /// true to enable depth clip, false to enable depth clamp.
4658 pub enable_depth_clip: ::core::primitive::bool,
4659 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
4660 pub padding1: Uint8,
4661 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
4662 pub padding2: Uint8,
4663}
4664
4665/// A structure specifying the parameters of the graphics pipeline multisample
4666/// state.
4667///
4668/// ## Availability
4669/// This struct is available since SDL 3.2.0.
4670///
4671/// ## See also
4672/// - [`SDL_GPUGraphicsPipelineCreateInfo`]
4673///
4674/// ## Notes for `sdl3-sys`
4675/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.
4676#[repr(C)]
4677#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
4678#[cfg_attr(feature = "debug-impls", derive(Debug))]
4679pub struct SDL_GPUMultisampleState {
4680 /// The number of samples to be used in rasterization.
4681 pub sample_count: SDL_GPUSampleCount,
4682 /// Reserved for future use. Must be set to 0.
4683 pub sample_mask: Uint32,
4684 /// Reserved for future use. Must be set to false.
4685 pub enable_mask: ::core::primitive::bool,
4686 /// true enables the alpha-to-coverage feature.
4687 pub enable_alpha_to_coverage: ::core::primitive::bool,
4688 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
4689 pub padding2: Uint8,
4690 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
4691 pub padding3: Uint8,
4692}
4693
4694/// A structure specifying the parameters of the graphics pipeline depth
4695/// stencil state.
4696///
4697/// ## Availability
4698/// This struct is available since SDL 3.2.0.
4699///
4700/// ## See also
4701/// - [`SDL_GPUGraphicsPipelineCreateInfo`]
4702///
4703/// ## Notes for `sdl3-sys`
4704/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.
4705#[repr(C)]
4706#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
4707#[cfg_attr(feature = "debug-impls", derive(Debug))]
4708pub struct SDL_GPUDepthStencilState {
4709 /// The comparison operator used for depth testing.
4710 pub compare_op: SDL_GPUCompareOp,
4711 /// The stencil op state for back-facing triangles.
4712 pub back_stencil_state: SDL_GPUStencilOpState,
4713 /// The stencil op state for front-facing triangles.
4714 pub front_stencil_state: SDL_GPUStencilOpState,
4715 /// Selects the bits of the stencil values participating in the stencil test.
4716 pub compare_mask: Uint8,
4717 /// Selects the bits of the stencil values updated by the stencil test.
4718 pub write_mask: Uint8,
4719 /// true enables the depth test.
4720 pub enable_depth_test: ::core::primitive::bool,
4721 /// true enables depth writes. Depth writes are always disabled when enable_depth_test is false.
4722 pub enable_depth_write: ::core::primitive::bool,
4723 /// true enables the stencil test.
4724 pub enable_stencil_test: ::core::primitive::bool,
4725 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
4726 pub padding1: Uint8,
4727 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
4728 pub padding2: Uint8,
4729 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
4730 pub padding3: Uint8,
4731}
4732
4733/// A structure specifying the parameters of color targets used in a graphics
4734/// pipeline.
4735///
4736/// ## Availability
4737/// This struct is available since SDL 3.2.0.
4738///
4739/// ## See also
4740/// - [`SDL_GPUGraphicsPipelineTargetInfo`]
4741#[repr(C)]
4742#[derive(Clone, Copy, Default, PartialEq, Eq, Hash)]
4743#[cfg_attr(feature = "debug-impls", derive(Debug))]
4744pub struct SDL_GPUColorTargetDescription {
4745 /// The pixel format of the texture to be used as a color target.
4746 pub format: SDL_GPUTextureFormat,
4747 /// The blend state to be used for the color target.
4748 pub blend_state: SDL_GPUColorTargetBlendState,
4749}
4750
4751/// A structure specifying the descriptions of render targets used in a
4752/// graphics pipeline.
4753///
4754/// ## Availability
4755/// This struct is available since SDL 3.2.0.
4756///
4757/// ## See also
4758/// - [`SDL_GPUGraphicsPipelineCreateInfo`]
4759/// - [`SDL_GPUColorTargetDescription`]
4760/// - [`SDL_GPUTextureFormat`]
4761///
4762/// ## Notes for `sdl3-sys`
4763/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.
4764#[repr(C)]
4765#[derive(Clone, Copy)]
4766#[cfg_attr(feature = "debug-impls", derive(Debug))]
4767pub struct SDL_GPUGraphicsPipelineTargetInfo {
4768 /// A pointer to an array of color target descriptions.
4769 pub color_target_descriptions: *const SDL_GPUColorTargetDescription,
4770 /// The number of color target descriptions in the above array.
4771 pub num_color_targets: Uint32,
4772 /// The pixel format of the depth-stencil target. Ignored if has_depth_stencil_target is false.
4773 pub depth_stencil_format: SDL_GPUTextureFormat,
4774 /// true specifies that the pipeline uses a depth-stencil target.
4775 pub has_depth_stencil_target: ::core::primitive::bool,
4776 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
4777 pub padding1: Uint8,
4778 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
4779 pub padding2: Uint8,
4780 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
4781 pub padding3: Uint8,
4782}
4783
4784impl ::core::default::Default for SDL_GPUGraphicsPipelineTargetInfo {
4785 /// Initialize all fields to zero
4786 #[inline(always)]
4787 fn default() -> Self {
4788 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
4789 }
4790}
4791
4792/// A structure specifying the parameters of a graphics pipeline state.
4793///
4794/// ## Availability
4795/// This struct is available since SDL 3.2.0.
4796///
4797/// ## See also
4798/// - [`SDL_CreateGPUGraphicsPipeline`]
4799/// - [`SDL_GPUShader`]
4800/// - [`SDL_GPUVertexInputState`]
4801/// - [`SDL_GPUPrimitiveType`]
4802/// - [`SDL_GPURasterizerState`]
4803/// - [`SDL_GPUMultisampleState`]
4804/// - [`SDL_GPUDepthStencilState`]
4805/// - [`SDL_GPUGraphicsPipelineTargetInfo`]
4806#[repr(C)]
4807#[derive(Clone, Copy)]
4808#[cfg_attr(feature = "debug-impls", derive(Debug))]
4809pub struct SDL_GPUGraphicsPipelineCreateInfo {
4810 /// The vertex shader used by the graphics pipeline.
4811 pub vertex_shader: *mut SDL_GPUShader,
4812 /// The fragment shader used by the graphics pipeline.
4813 pub fragment_shader: *mut SDL_GPUShader,
4814 /// The vertex layout of the graphics pipeline.
4815 pub vertex_input_state: SDL_GPUVertexInputState,
4816 /// The primitive topology of the graphics pipeline.
4817 pub primitive_type: SDL_GPUPrimitiveType,
4818 /// The rasterizer state of the graphics pipeline.
4819 pub rasterizer_state: SDL_GPURasterizerState,
4820 /// The multisample state of the graphics pipeline.
4821 pub multisample_state: SDL_GPUMultisampleState,
4822 /// The depth-stencil state of the graphics pipeline.
4823 pub depth_stencil_state: SDL_GPUDepthStencilState,
4824 /// Formats and blend modes for the render targets of the graphics pipeline.
4825 pub target_info: SDL_GPUGraphicsPipelineTargetInfo,
4826 /// A properties ID for extensions. Should be 0 if no extensions are needed.
4827 pub props: SDL_PropertiesID,
4828}
4829
4830impl ::core::default::Default for SDL_GPUGraphicsPipelineCreateInfo {
4831 /// Initialize all fields to zero
4832 #[inline(always)]
4833 fn default() -> Self {
4834 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
4835 }
4836}
4837
4838/// A structure specifying the parameters of a compute pipeline state.
4839///
4840/// ## Availability
4841/// This struct is available since SDL 3.2.0.
4842///
4843/// ## See also
4844/// - [`SDL_CreateGPUComputePipeline`]
4845/// - [`SDL_GPUShaderFormat`]
4846#[repr(C)]
4847#[derive(Clone, Copy)]
4848#[cfg_attr(feature = "debug-impls", derive(Debug))]
4849pub struct SDL_GPUComputePipelineCreateInfo {
4850 /// The size in bytes of the compute shader code pointed to.
4851 pub code_size: ::core::primitive::usize,
4852 /// A pointer to compute shader code.
4853 pub code: *const Uint8,
4854 /// A pointer to a null-terminated UTF-8 string specifying the entry point function name for the shader.
4855 pub entrypoint: *const ::core::ffi::c_char,
4856 /// The format of the compute shader code.
4857 pub format: SDL_GPUShaderFormat,
4858 /// The number of samplers defined in the shader.
4859 pub num_samplers: Uint32,
4860 /// The number of readonly storage textures defined in the shader.
4861 pub num_readonly_storage_textures: Uint32,
4862 /// The number of readonly storage buffers defined in the shader.
4863 pub num_readonly_storage_buffers: Uint32,
4864 /// The number of read-write storage textures defined in the shader.
4865 pub num_readwrite_storage_textures: Uint32,
4866 /// The number of read-write storage buffers defined in the shader.
4867 pub num_readwrite_storage_buffers: Uint32,
4868 /// The number of uniform buffers defined in the shader.
4869 pub num_uniform_buffers: Uint32,
4870 /// The number of threads in the X dimension. This should match the value in the shader.
4871 pub threadcount_x: Uint32,
4872 /// The number of threads in the Y dimension. This should match the value in the shader.
4873 pub threadcount_y: Uint32,
4874 /// The number of threads in the Z dimension. This should match the value in the shader.
4875 pub threadcount_z: Uint32,
4876 /// A properties ID for extensions. Should be 0 if no extensions are needed.
4877 pub props: SDL_PropertiesID,
4878}
4879
4880impl ::core::default::Default for SDL_GPUComputePipelineCreateInfo {
4881 /// Initialize all fields to zero
4882 #[inline(always)]
4883 fn default() -> Self {
4884 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
4885 }
4886}
4887
4888/// A structure specifying the parameters of a color target used by a render
4889/// pass.
4890///
4891/// The load_op field determines what is done with the texture at the beginning
4892/// of the render pass.
4893///
4894/// - LOAD: Loads the data currently in the texture. Not recommended for
4895/// multisample textures as it requires significant memory bandwidth.
4896/// - CLEAR: Clears the texture to a single color.
4897/// - DONT_CARE: The driver will do whatever it wants with the texture memory.
4898/// This is a good option if you know that every single pixel will be touched
4899/// in the render pass.
4900///
4901/// The store_op field determines what is done with the color results of the
4902/// render pass.
4903///
4904/// - STORE: Stores the results of the render pass in the texture. Not
4905/// recommended for multisample textures as it requires significant memory
4906/// bandwidth.
4907/// - DONT_CARE: The driver will do whatever it wants with the texture memory.
4908/// This is often a good option for depth/stencil textures.
4909/// - RESOLVE: Resolves a multisample texture into resolve_texture, which must
4910/// have a sample count of 1. Then the driver may discard the multisample
4911/// texture memory. This is the most performant method of resolving a
4912/// multisample target.
4913/// - RESOLVE_AND_STORE: Resolves a multisample texture into the
4914/// resolve_texture, which must have a sample count of 1. Then the driver
4915/// stores the multisample texture's contents. Not recommended as it requires
4916/// significant memory bandwidth.
4917///
4918/// ## Availability
4919/// This struct is available since SDL 3.2.0.
4920///
4921/// ## See also
4922/// - [`SDL_BeginGPURenderPass`]
4923/// - [`SDL_FColor`]
4924///
4925/// ## Notes for `sdl3-sys`
4926/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.
4927#[repr(C)]
4928#[derive(Clone, Copy)]
4929#[cfg_attr(feature = "debug-impls", derive(Debug))]
4930pub struct SDL_GPUColorTargetInfo {
4931 /// The texture that will be used as a color target by a render pass.
4932 pub texture: *mut SDL_GPUTexture,
4933 /// The mip level to use as a color target.
4934 pub mip_level: Uint32,
4935 /// 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.
4936 pub layer_or_depth_plane: Uint32,
4937 /// The color to clear the color target to at the start of the render pass. Ignored if [`SDL_GPU_LOADOP_CLEAR`] is not used.
4938 pub clear_color: SDL_FColor,
4939 /// What is done with the contents of the color target at the beginning of the render pass.
4940 pub load_op: SDL_GPULoadOp,
4941 /// What is done with the results of the render pass.
4942 pub store_op: SDL_GPUStoreOp,
4943 /// The texture that will receive the results of a multisample resolve operation. Ignored if a RESOLVE* store_op is not used.
4944 pub resolve_texture: *mut SDL_GPUTexture,
4945 /// The mip level of the resolve texture to use for the resolve operation. Ignored if a RESOLVE* store_op is not used.
4946 pub resolve_mip_level: Uint32,
4947 /// The layer index of the resolve texture to use for the resolve operation. Ignored if a RESOLVE* store_op is not used.
4948 pub resolve_layer: Uint32,
4949 /// true cycles the texture if the texture is bound and load_op is not LOAD
4950 pub cycle: ::core::primitive::bool,
4951 /// true cycles the resolve texture if the resolve texture is bound. Ignored if a RESOLVE* store_op is not used.
4952 pub cycle_resolve_texture: ::core::primitive::bool,
4953 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
4954 pub padding1: Uint8,
4955 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
4956 pub padding2: Uint8,
4957}
4958
4959impl ::core::default::Default for SDL_GPUColorTargetInfo {
4960 /// Initialize all fields to zero
4961 #[inline(always)]
4962 fn default() -> Self {
4963 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
4964 }
4965}
4966
4967/// A structure specifying the parameters of a depth-stencil target used by a
4968/// render pass.
4969///
4970/// The load_op field determines what is done with the depth contents of the
4971/// texture at the beginning of the render pass.
4972///
4973/// - LOAD: Loads the depth values currently in the texture.
4974/// - CLEAR: Clears the texture to a single depth.
4975/// - DONT_CARE: The driver will do whatever it wants with the memory. This is
4976/// a good option if you know that every single pixel will be touched in the
4977/// render pass.
4978///
4979/// The store_op field determines what is done with the depth results of the
4980/// render pass.
4981///
4982/// - STORE: Stores the depth results in the texture.
4983/// - DONT_CARE: The driver will do whatever it wants with the depth results.
4984/// This is often a good option for depth/stencil textures that don't need to
4985/// be reused again.
4986///
4987/// The stencil_load_op field determines what is done with the stencil contents
4988/// of the texture at the beginning of the render pass.
4989///
4990/// - LOAD: Loads the stencil values currently in the texture.
4991/// - CLEAR: Clears the stencil values to a single value.
4992/// - DONT_CARE: The driver will do whatever it wants with the memory. This is
4993/// a good option if you know that every single pixel will be touched in the
4994/// render pass.
4995///
4996/// The stencil_store_op field determines what is done with the stencil results
4997/// of the render pass.
4998///
4999/// - STORE: Stores the stencil results in the texture.
5000/// - DONT_CARE: The driver will do whatever it wants with the stencil results.
5001/// This is often a good option for depth/stencil textures that don't need to
5002/// be reused again.
5003///
5004/// Note that depth/stencil targets do not support multisample resolves.
5005///
5006/// Due to ABI limitations, depth textures with more than 255 layers are not
5007/// supported.
5008///
5009/// ## Availability
5010/// This struct is available since SDL 3.2.0.
5011///
5012/// ## See also
5013/// - [`SDL_BeginGPURenderPass`]
5014#[repr(C)]
5015#[derive(Clone, Copy)]
5016#[cfg_attr(feature = "debug-impls", derive(Debug))]
5017pub struct SDL_GPUDepthStencilTargetInfo {
5018 /// The texture that will be used as the depth stencil target by the render pass.
5019 pub texture: *mut SDL_GPUTexture,
5020 /// The value to clear the depth component to at the beginning of the render pass. Ignored if [`SDL_GPU_LOADOP_CLEAR`] is not used.
5021 pub clear_depth: ::core::ffi::c_float,
5022 /// What is done with the depth contents at the beginning of the render pass.
5023 pub load_op: SDL_GPULoadOp,
5024 /// What is done with the depth results of the render pass.
5025 pub store_op: SDL_GPUStoreOp,
5026 /// What is done with the stencil contents at the beginning of the render pass.
5027 pub stencil_load_op: SDL_GPULoadOp,
5028 /// What is done with the stencil results of the render pass.
5029 pub stencil_store_op: SDL_GPUStoreOp,
5030 /// true cycles the texture if the texture is bound and any load ops are not LOAD
5031 pub cycle: ::core::primitive::bool,
5032 /// The value to clear the stencil component to at the beginning of the render pass. Ignored if [`SDL_GPU_LOADOP_CLEAR`] is not used.
5033 pub clear_stencil: Uint8,
5034 /// The mip level to use as the depth stencil target.
5035 pub mip_level: Uint8,
5036 /// The layer index to use as the depth stencil target.
5037 pub layer: Uint8,
5038}
5039
5040impl ::core::default::Default for SDL_GPUDepthStencilTargetInfo {
5041 /// Initialize all fields to zero
5042 #[inline(always)]
5043 fn default() -> Self {
5044 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
5045 }
5046}
5047
5048/// A structure containing parameters for a blit command.
5049///
5050/// ## Availability
5051/// This struct is available since SDL 3.2.0.
5052///
5053/// ## See also
5054/// - [`SDL_BlitGPUTexture`]
5055///
5056/// ## Notes for `sdl3-sys`
5057/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.
5058#[repr(C)]
5059#[derive(Clone, Copy)]
5060#[cfg_attr(feature = "debug-impls", derive(Debug))]
5061pub struct SDL_GPUBlitInfo {
5062 /// The source region for the blit.
5063 pub source: SDL_GPUBlitRegion,
5064 /// The destination region for the blit.
5065 pub destination: SDL_GPUBlitRegion,
5066 /// What is done with the contents of the destination before the blit.
5067 pub load_op: SDL_GPULoadOp,
5068 /// The color to clear the destination region to before the blit. Ignored if load_op is not [`SDL_GPU_LOADOP_CLEAR`].
5069 pub clear_color: SDL_FColor,
5070 /// The flip mode for the source region.
5071 pub flip_mode: SDL_FlipMode,
5072 /// The filter mode used when blitting.
5073 pub filter: SDL_GPUFilter,
5074 /// true cycles the destination texture if it is already bound.
5075 pub cycle: ::core::primitive::bool,
5076 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
5077 pub padding1: Uint8,
5078 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
5079 pub padding2: Uint8,
5080 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
5081 pub padding3: Uint8,
5082}
5083
5084impl ::core::default::Default for SDL_GPUBlitInfo {
5085 /// Initialize all fields to zero
5086 #[inline(always)]
5087 fn default() -> Self {
5088 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
5089 }
5090}
5091
5092/// A structure specifying parameters in a buffer binding call.
5093///
5094/// ## Availability
5095/// This struct is available since SDL 3.2.0.
5096///
5097/// ## See also
5098/// - [`SDL_BindGPUVertexBuffers`]
5099/// - [`SDL_BindGPUIndexBuffer`]
5100#[repr(C)]
5101#[derive(Clone, Copy)]
5102#[cfg_attr(feature = "debug-impls", derive(Debug))]
5103pub struct SDL_GPUBufferBinding {
5104 /// The buffer to bind. Must have been created with [`SDL_GPU_BUFFERUSAGE_VERTEX`] for [`SDL_BindGPUVertexBuffers`], or [`SDL_GPU_BUFFERUSAGE_INDEX`] for [`SDL_BindGPUIndexBuffer`].
5105 pub buffer: *mut SDL_GPUBuffer,
5106 /// The starting byte of the data to bind in the buffer.
5107 pub offset: Uint32,
5108}
5109
5110impl ::core::default::Default for SDL_GPUBufferBinding {
5111 /// Initialize all fields to zero
5112 #[inline(always)]
5113 fn default() -> Self {
5114 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
5115 }
5116}
5117
5118/// A structure specifying parameters in a sampler binding call.
5119///
5120/// ## Availability
5121/// This struct is available since SDL 3.2.0.
5122///
5123/// ## See also
5124/// - [`SDL_BindGPUVertexSamplers`]
5125/// - [`SDL_BindGPUFragmentSamplers`]
5126/// - [`SDL_GPUTexture`]
5127/// - [`SDL_GPUSampler`]
5128#[repr(C)]
5129#[derive(Clone, Copy)]
5130#[cfg_attr(feature = "debug-impls", derive(Debug))]
5131pub struct SDL_GPUTextureSamplerBinding {
5132 /// The texture to bind. Must have been created with [`SDL_GPU_TEXTUREUSAGE_SAMPLER`].
5133 pub texture: *mut SDL_GPUTexture,
5134 /// The sampler to bind.
5135 pub sampler: *mut SDL_GPUSampler,
5136}
5137
5138impl ::core::default::Default for SDL_GPUTextureSamplerBinding {
5139 /// Initialize all fields to zero
5140 #[inline(always)]
5141 fn default() -> Self {
5142 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
5143 }
5144}
5145
5146/// A structure specifying parameters related to binding buffers in a compute
5147/// pass.
5148///
5149/// ## Availability
5150/// This struct is available since SDL 3.2.0.
5151///
5152/// ## See also
5153/// - [`SDL_BeginGPUComputePass`]
5154///
5155/// ## Notes for `sdl3-sys`
5156/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.
5157#[repr(C)]
5158#[derive(Clone, Copy)]
5159#[cfg_attr(feature = "debug-impls", derive(Debug))]
5160pub struct SDL_GPUStorageBufferReadWriteBinding {
5161 /// The buffer to bind. Must have been created with [`SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_WRITE`].
5162 pub buffer: *mut SDL_GPUBuffer,
5163 /// true cycles the buffer if it is already bound.
5164 pub cycle: ::core::primitive::bool,
5165 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
5166 pub padding1: Uint8,
5167 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
5168 pub padding2: Uint8,
5169 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
5170 pub padding3: Uint8,
5171}
5172
5173impl ::core::default::Default for SDL_GPUStorageBufferReadWriteBinding {
5174 /// Initialize all fields to zero
5175 #[inline(always)]
5176 fn default() -> Self {
5177 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
5178 }
5179}
5180
5181/// A structure specifying parameters related to binding textures in a compute
5182/// pass.
5183///
5184/// ## Availability
5185/// This struct is available since SDL 3.2.0.
5186///
5187/// ## See also
5188/// - [`SDL_BeginGPUComputePass`]
5189///
5190/// ## Notes for `sdl3-sys`
5191/// This struct has padding fields which shouldn't be accessed directly; use struct update syntax with e.g. `..Default::default()` for manual construction.
5192#[repr(C)]
5193#[derive(Clone, Copy)]
5194#[cfg_attr(feature = "debug-impls", derive(Debug))]
5195pub struct SDL_GPUStorageTextureReadWriteBinding {
5196 /// The texture to bind. Must have been created with [`SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_WRITE`] or [`SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE`].
5197 pub texture: *mut SDL_GPUTexture,
5198 /// The mip level index to bind.
5199 pub mip_level: Uint32,
5200 /// The layer index to bind.
5201 pub layer: Uint32,
5202 /// true cycles the texture if it is already bound.
5203 pub cycle: ::core::primitive::bool,
5204 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
5205 pub padding1: Uint8,
5206 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
5207 pub padding2: Uint8,
5208 #[deprecated(note = "padding fields are exempt from semver; init with `..Default::default()`")]
5209 pub padding3: Uint8,
5210}
5211
5212impl ::core::default::Default for SDL_GPUStorageTextureReadWriteBinding {
5213 /// Initialize all fields to zero
5214 #[inline(always)]
5215 fn default() -> Self {
5216 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
5217 }
5218}
5219
5220unsafe extern "C" {
5221 /// Checks for GPU runtime support.
5222 ///
5223 /// ## Parameters
5224 /// - `format_flags`: a bitflag indicating which shader formats the app is
5225 /// able to provide.
5226 /// - `name`: the preferred GPU driver, or NULL to let SDL pick the optimal
5227 /// driver.
5228 ///
5229 /// ## Return value
5230 /// Returns true if supported, false otherwise.
5231 ///
5232 /// ## Availability
5233 /// This function is available since SDL 3.2.0.
5234 ///
5235 /// ## See also
5236 /// - [`SDL_CreateGPUDevice`]
5237 pub fn SDL_GPUSupportsShaderFormats(
5238 format_flags: SDL_GPUShaderFormat,
5239 name: *const ::core::ffi::c_char,
5240 ) -> ::core::primitive::bool;
5241}
5242
5243unsafe extern "C" {
5244 /// Checks for GPU runtime support.
5245 ///
5246 /// ## Parameters
5247 /// - `props`: the properties to use.
5248 ///
5249 /// ## Return value
5250 /// Returns true if supported, false otherwise.
5251 ///
5252 /// ## Availability
5253 /// This function is available since SDL 3.2.0.
5254 ///
5255 /// ## See also
5256 /// - [`SDL_CreateGPUDeviceWithProperties`]
5257 pub fn SDL_GPUSupportsProperties(props: SDL_PropertiesID) -> ::core::primitive::bool;
5258}
5259
5260unsafe extern "C" {
5261 /// Creates a GPU context.
5262 ///
5263 /// The GPU driver name can be one of the following:
5264 ///
5265 /// - "vulkan": [Vulkan](CategoryGPU#vulkan)
5266 /// - "direct3d12": [D3D12](CategoryGPU#d3d12)
5267 /// - "metal": [Metal](CategoryGPU#metal)
5268 /// - NULL: let SDL pick the optimal driver
5269 ///
5270 /// ## Parameters
5271 /// - `format_flags`: a bitflag indicating which shader formats the app is
5272 /// able to provide.
5273 /// - `debug_mode`: enable debug mode properties and validations.
5274 /// - `name`: the preferred GPU driver, or NULL to let SDL pick the optimal
5275 /// driver.
5276 ///
5277 /// ## Return value
5278 /// Returns a GPU context on success or NULL on failure; call [`SDL_GetError()`]
5279 /// for more information.
5280 ///
5281 /// ## Availability
5282 /// This function is available since SDL 3.2.0.
5283 ///
5284 /// ## See also
5285 /// - [`SDL_CreateGPUDeviceWithProperties`]
5286 /// - [`SDL_GetGPUShaderFormats`]
5287 /// - [`SDL_GetGPUDeviceDriver`]
5288 /// - [`SDL_DestroyGPUDevice`]
5289 /// - [`SDL_GPUSupportsShaderFormats`]
5290 pub fn SDL_CreateGPUDevice(
5291 format_flags: SDL_GPUShaderFormat,
5292 debug_mode: ::core::primitive::bool,
5293 name: *const ::core::ffi::c_char,
5294 ) -> *mut SDL_GPUDevice;
5295}
5296
5297unsafe extern "C" {
5298 /// Creates a GPU context.
5299 ///
5300 /// These are the supported properties:
5301 ///
5302 /// - [`SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN`]\: enable debug mode
5303 /// properties and validations, defaults to true.
5304 /// - [`SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN`]\: enable to prefer
5305 /// energy efficiency over maximum GPU performance, defaults to false.
5306 /// - [`SDL_PROP_GPU_DEVICE_CREATE_VERBOSE_BOOLEAN`]\: enable to automatically log
5307 /// useful debug information on device creation, defaults to true.
5308 /// - [`SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING`]\: the name of the GPU driver to
5309 /// use, if a specific one is desired.
5310 /// - [`SDL_PROP_GPU_DEVICE_CREATE_FEATURE_CLIP_DISTANCE_BOOLEAN`]\: Enable Vulkan
5311 /// device feature shaderClipDistance. If disabled, clip distances are not
5312 /// supported in shader code: gl_ClipDistance\[\] built-ins of GLSL,
5313 /// SV_ClipDistance0/1 semantics of HLSL and \[\[clip_distance\]\] attribute of
5314 /// Metal. Disabling optional features allows the application to run on some
5315 /// older Android devices. Defaults to true.
5316 /// - [`SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN`]\: Enable
5317 /// Vulkan device feature depthClamp. If disabled, there is no depth clamp
5318 /// support and enable_depth_clip in [`SDL_GPURasterizerState`] must always be
5319 /// set to true. Disabling optional features allows the application to run on
5320 /// some older Android devices. Defaults to true.
5321 /// - [`SDL_PROP_GPU_DEVICE_CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN`]\:
5322 /// Enable Vulkan device feature drawIndirectFirstInstance. If disabled, the
5323 /// argument first_instance of [`SDL_GPUIndirectDrawCommand`] must be set to
5324 /// zero. Disabling optional features allows the application to run on some
5325 /// older Android devices. Defaults to true.
5326 /// - [`SDL_PROP_GPU_DEVICE_CREATE_FEATURE_ANISOTROPY_BOOLEAN`]\: Enable Vulkan
5327 /// device feature samplerAnisotropy. If disabled, enable_anisotropy of
5328 /// [`SDL_GPUSamplerCreateInfo`] must be set to false. Disabling optional
5329 /// features allows the application to run on some older Android devices.
5330 /// Defaults to true.
5331 ///
5332 /// These are the current shader format properties:
5333 ///
5334 /// - [`SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN`]\: The app is able to
5335 /// provide shaders for an NDA platform.
5336 /// - [`SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOLEAN`]\: The app is able to
5337 /// provide SPIR-V shaders if applicable.
5338 /// - [`SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN`]\: The app is able to
5339 /// provide DXBC shaders if applicable
5340 /// - [`SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN`]\: The app is able to
5341 /// provide DXIL shaders if applicable.
5342 /// - [`SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN`]\: The app is able to
5343 /// provide MSL shaders if applicable.
5344 /// - [`SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN`]\: The app is able to
5345 /// provide Metal shader libraries if applicable.
5346 ///
5347 /// With the D3D12 backend:
5348 ///
5349 /// - [`SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING`]\: the prefix to
5350 /// use for all vertex semantics, default is "TEXCOORD".
5351 /// - [`SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN`]\: By
5352 /// default, Resourcing Binding Tier 2 is required for D3D12 support.
5353 /// However, an application can set this property to true to enable Tier 1
5354 /// support, if (and only if) the application uses 8 or fewer storage
5355 /// resources across all shader stages. As of writing, this property is
5356 /// useful for targeting Intel Haswell and Broadwell GPUs; other hardware
5357 /// either supports Tier 2 Resource Binding or does not support D3D12 in any
5358 /// capacity. Defaults to false.
5359 ///
5360 /// With the Vulkan backend:
5361 ///
5362 /// - [`SDL_PROP_GPU_DEVICE_CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN`]\:
5363 /// By default, Vulkan device enumeration includes drivers of all types,
5364 /// including software renderers (for example, the Lavapipe Mesa driver).
5365 /// This can be useful if your application _requires_ SDL_GPU, but if you can
5366 /// provide your own fallback renderer (for example, an OpenGL renderer) this
5367 /// property can be set to true. Defaults to false.
5368 /// - [`SDL_PROP_GPU_DEVICE_CREATE_VULKAN_OPTIONS_POINTER`]\: a pointer to an
5369 /// [`SDL_GPUVulkanOptions`] structure to be processed during device creation.
5370 /// This allows configuring a variety of Vulkan-specific options such as
5371 /// increasing the API version and opting into extensions aside from the
5372 /// minimal set SDL requires.
5373 ///
5374 /// ## Parameters
5375 /// - `props`: the properties to use.
5376 ///
5377 /// ## Return value
5378 /// Returns a GPU context on success or NULL on failure; call [`SDL_GetError()`]
5379 /// for more information.
5380 ///
5381 /// ## Availability
5382 /// This function is available since SDL 3.2.0.
5383 ///
5384 /// ## See also
5385 /// - [`SDL_GetGPUShaderFormats`]
5386 /// - [`SDL_GetGPUDeviceDriver`]
5387 /// - [`SDL_DestroyGPUDevice`]
5388 /// - [`SDL_GPUSupportsProperties`]
5389 pub fn SDL_CreateGPUDeviceWithProperties(props: SDL_PropertiesID) -> *mut SDL_GPUDevice;
5390}
5391
5392pub const SDL_PROP_GPU_DEVICE_CREATE_DEBUGMODE_BOOLEAN: *const ::core::ffi::c_char =
5393 c"SDL.gpu.device.create.debugmode".as_ptr();
5394
5395pub const SDL_PROP_GPU_DEVICE_CREATE_PREFERLOWPOWER_BOOLEAN: *const ::core::ffi::c_char =
5396 c"SDL.gpu.device.create.preferlowpower".as_ptr();
5397
5398pub const SDL_PROP_GPU_DEVICE_CREATE_VERBOSE_BOOLEAN: *const ::core::ffi::c_char =
5399 c"SDL.gpu.device.create.verbose".as_ptr();
5400
5401pub const SDL_PROP_GPU_DEVICE_CREATE_NAME_STRING: *const ::core::ffi::c_char =
5402 c"SDL.gpu.device.create.name".as_ptr();
5403
5404pub const SDL_PROP_GPU_DEVICE_CREATE_FEATURE_CLIP_DISTANCE_BOOLEAN: *const ::core::ffi::c_char =
5405 c"SDL.gpu.device.create.feature.clip_distance".as_ptr();
5406
5407pub const SDL_PROP_GPU_DEVICE_CREATE_FEATURE_DEPTH_CLAMPING_BOOLEAN: *const ::core::ffi::c_char =
5408 c"SDL.gpu.device.create.feature.depth_clamping".as_ptr();
5409
5410pub const SDL_PROP_GPU_DEVICE_CREATE_FEATURE_INDIRECT_DRAW_FIRST_INSTANCE_BOOLEAN:
5411 *const ::core::ffi::c_char =
5412 c"SDL.gpu.device.create.feature.indirect_draw_first_instance".as_ptr();
5413
5414pub const SDL_PROP_GPU_DEVICE_CREATE_FEATURE_ANISOTROPY_BOOLEAN: *const ::core::ffi::c_char =
5415 c"SDL.gpu.device.create.feature.anisotropy".as_ptr();
5416
5417pub const SDL_PROP_GPU_DEVICE_CREATE_SHADERS_PRIVATE_BOOLEAN: *const ::core::ffi::c_char =
5418 c"SDL.gpu.device.create.shaders.private".as_ptr();
5419
5420pub const SDL_PROP_GPU_DEVICE_CREATE_SHADERS_SPIRV_BOOLEAN: *const ::core::ffi::c_char =
5421 c"SDL.gpu.device.create.shaders.spirv".as_ptr();
5422
5423pub const SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXBC_BOOLEAN: *const ::core::ffi::c_char =
5424 c"SDL.gpu.device.create.shaders.dxbc".as_ptr();
5425
5426pub const SDL_PROP_GPU_DEVICE_CREATE_SHADERS_DXIL_BOOLEAN: *const ::core::ffi::c_char =
5427 c"SDL.gpu.device.create.shaders.dxil".as_ptr();
5428
5429pub const SDL_PROP_GPU_DEVICE_CREATE_SHADERS_MSL_BOOLEAN: *const ::core::ffi::c_char =
5430 c"SDL.gpu.device.create.shaders.msl".as_ptr();
5431
5432pub const SDL_PROP_GPU_DEVICE_CREATE_SHADERS_METALLIB_BOOLEAN: *const ::core::ffi::c_char =
5433 c"SDL.gpu.device.create.shaders.metallib".as_ptr();
5434
5435pub const SDL_PROP_GPU_DEVICE_CREATE_D3D12_ALLOW_FEWER_RESOURCE_SLOTS_BOOLEAN:
5436 *const ::core::ffi::c_char = c"SDL.gpu.device.create.d3d12.allowtier1resourcebinding".as_ptr();
5437
5438pub const SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING: *const ::core::ffi::c_char =
5439 c"SDL.gpu.device.create.d3d12.semantic".as_ptr();
5440
5441pub const SDL_PROP_GPU_DEVICE_CREATE_VULKAN_REQUIRE_HARDWARE_ACCELERATION_BOOLEAN:
5442 *const ::core::ffi::c_char =
5443 c"SDL.gpu.device.create.vulkan.requirehardwareacceleration".as_ptr();
5444
5445pub const SDL_PROP_GPU_DEVICE_CREATE_VULKAN_OPTIONS_POINTER: *const ::core::ffi::c_char =
5446 c"SDL.gpu.device.create.vulkan.options".as_ptr();
5447
5448/// A structure specifying additional options when using Vulkan.
5449///
5450/// When no such structure is provided, SDL will use Vulkan API version 1.0 and
5451/// a minimal set of features. The requested API version influences how the
5452/// feature_list is processed by SDL. When requesting API version 1.0, the
5453/// feature_list is ignored. Only the vulkan_10_physical_device_features and
5454/// the extension lists are used. When requesting API version 1.1, the
5455/// feature_list is scanned for feature structures introduced in Vulkan 1.1.
5456/// When requesting Vulkan 1.2 or higher, the feature_list is additionally
5457/// scanned for compound feature structs such as
5458/// VkPhysicalDeviceVulkan11Features. The device and instance extension lists,
5459/// as well as vulkan_10_physical_device_features, are always processed.
5460///
5461/// ## Availability
5462/// This struct is available since SDL 3.4.0.
5463#[repr(C)]
5464#[cfg_attr(feature = "debug-impls", derive(Debug))]
5465pub struct SDL_GPUVulkanOptions {
5466 /// The Vulkan API version to request for the instance. Use Vulkan's VK_MAKE_VERSION or VK_MAKE_API_VERSION.
5467 pub vulkan_api_version: Uint32,
5468 /// Pointer to the first element of a chain of Vulkan feature structs. (Requires API version 1.1 or higher.)
5469 pub feature_list: *mut ::core::ffi::c_void,
5470 /// Pointer to a VkPhysicalDeviceFeatures struct to enable additional Vulkan 1.0 features.
5471 pub vulkan_10_physical_device_features: *mut ::core::ffi::c_void,
5472 /// Number of additional device extensions to require.
5473 pub device_extension_count: Uint32,
5474 /// Pointer to a list of additional device extensions to require.
5475 pub device_extension_names: *mut *const ::core::ffi::c_char,
5476 /// Number of additional instance extensions to require.
5477 pub instance_extension_count: Uint32,
5478 /// Pointer to a list of additional instance extensions to require.
5479 pub instance_extension_names: *mut *const ::core::ffi::c_char,
5480}
5481
5482impl ::core::default::Default for SDL_GPUVulkanOptions {
5483 /// Initialize all fields to zero
5484 #[inline(always)]
5485 fn default() -> Self {
5486 unsafe { ::core::mem::MaybeUninit::<Self>::zeroed().assume_init() }
5487 }
5488}
5489
5490unsafe extern "C" {
5491 /// Destroys a GPU context previously returned by [`SDL_CreateGPUDevice`].
5492 ///
5493 /// ## Parameters
5494 /// - `device`: a GPU Context to destroy.
5495 ///
5496 /// ## Availability
5497 /// This function is available since SDL 3.2.0.
5498 ///
5499 /// ## See also
5500 /// - [`SDL_CreateGPUDevice`]
5501 pub fn SDL_DestroyGPUDevice(device: *mut SDL_GPUDevice);
5502}
5503
5504unsafe extern "C" {
5505 /// Get the number of GPU drivers compiled into SDL.
5506 ///
5507 /// ## Return value
5508 /// Returns the number of built in GPU drivers.
5509 ///
5510 /// ## Availability
5511 /// This function is available since SDL 3.2.0.
5512 ///
5513 /// ## See also
5514 /// - [`SDL_GetGPUDriver`]
5515 pub fn SDL_GetNumGPUDrivers() -> ::core::ffi::c_int;
5516}
5517
5518unsafe extern "C" {
5519 /// Get the name of a built in GPU driver.
5520 ///
5521 /// The GPU drivers are presented in the order in which they are normally
5522 /// checked during initialization.
5523 ///
5524 /// The names of drivers are all simple, low-ASCII identifiers, like "vulkan",
5525 /// "metal" or "direct3d12". These never have Unicode characters, and are not
5526 /// meant to be proper names.
5527 ///
5528 /// ## Parameters
5529 /// - `index`: the index of a GPU driver.
5530 ///
5531 /// ## Return value
5532 /// Returns the name of the GPU driver with the given **index**.
5533 ///
5534 /// ## Availability
5535 /// This function is available since SDL 3.2.0.
5536 ///
5537 /// ## See also
5538 /// - [`SDL_GetNumGPUDrivers`]
5539 pub fn SDL_GetGPUDriver(index: ::core::ffi::c_int) -> *const ::core::ffi::c_char;
5540}
5541
5542unsafe extern "C" {
5543 /// Returns the name of the backend used to create this GPU context.
5544 ///
5545 /// ## Parameters
5546 /// - `device`: a GPU context to query.
5547 ///
5548 /// ## Return value
5549 /// Returns the name of the device's driver, or NULL on error.
5550 ///
5551 /// ## Availability
5552 /// This function is available since SDL 3.2.0.
5553 pub fn SDL_GetGPUDeviceDriver(device: *mut SDL_GPUDevice) -> *const ::core::ffi::c_char;
5554}
5555
5556unsafe extern "C" {
5557 /// Returns the supported shader formats for this GPU context.
5558 ///
5559 /// ## Parameters
5560 /// - `device`: a GPU context to query.
5561 ///
5562 /// ## Return value
5563 /// Returns a bitflag indicating which shader formats the driver is able to
5564 /// consume.
5565 ///
5566 /// ## Availability
5567 /// This function is available since SDL 3.2.0.
5568 pub fn SDL_GetGPUShaderFormats(device: *mut SDL_GPUDevice) -> SDL_GPUShaderFormat;
5569}
5570
5571unsafe extern "C" {
5572 /// Get the properties associated with a GPU device.
5573 ///
5574 /// All properties are optional and may differ between GPU backends and SDL
5575 /// versions.
5576 ///
5577 /// The following properties are provided by SDL:
5578 ///
5579 /// [`SDL_PROP_GPU_DEVICE_NAME_STRING`]\: Contains the name of the underlying
5580 /// device as reported by the system driver. This string has no standardized
5581 /// format, is highly inconsistent between hardware devices and drivers, and is
5582 /// able to change at any time. Do not attempt to parse this string as it is
5583 /// bound to fail at some point in the future when system drivers are updated,
5584 /// new hardware devices are introduced, or when SDL adds new GPU backends or
5585 /// modifies existing ones.
5586 ///
5587 /// Strings that have been found in the wild include:
5588 ///
5589 /// - GTX 970
5590 /// - GeForce GTX 970
5591 /// - NVIDIA GeForce GTX 970
5592 /// - Microsoft Direct3D12 (NVIDIA GeForce GTX 970)
5593 /// - NVIDIA Graphics Device
5594 /// - GeForce GPU
5595 /// - P106-100
5596 /// - AMD 15D8:C9
5597 /// - AMD Custom GPU 0405
5598 /// - AMD Radeon (TM) Graphics
5599 /// - ASUS Radeon RX 470 Series
5600 /// - Intel(R) Arc(tm) A380 Graphics (DG2)
5601 /// - Virtio-GPU Venus (NVIDIA TITAN V)
5602 /// - SwiftShader Device (LLVM 16.0.0)
5603 /// - llvmpipe (LLVM 15.0.4, 256 bits)
5604 /// - Microsoft Basic Render Driver
5605 /// - unknown device
5606 ///
5607 /// The above list shows that the same device can have different formats, the
5608 /// vendor name may or may not appear in the string, the included vendor name
5609 /// may not be the vendor of the chipset on the device, some manufacturers
5610 /// include pseudo-legal marks while others don't, some devices may not use a
5611 /// marketing name in the string, the device string may be wrapped by the name
5612 /// of a translation interface, the device may be emulated in software, or the
5613 /// string may contain generic text that does not identify the device at all.
5614 ///
5615 /// [`SDL_PROP_GPU_DEVICE_DRIVER_NAME_STRING`]\: Contains the self-reported name
5616 /// of the underlying system driver.
5617 ///
5618 /// Strings that have been found in the wild include:
5619 ///
5620 /// - Intel Corporation
5621 /// - Intel open-source Mesa driver
5622 /// - Qualcomm Technologies Inc. Adreno Vulkan Driver
5623 /// - MoltenVK
5624 /// - Mali-G715
5625 /// - venus
5626 ///
5627 /// [`SDL_PROP_GPU_DEVICE_DRIVER_VERSION_STRING`]\: Contains the self-reported
5628 /// version of the underlying system driver. This is a relatively short version
5629 /// string in an unspecified format. If [`SDL_PROP_GPU_DEVICE_DRIVER_INFO_STRING`]
5630 /// is available then that property should be preferred over this one as it may
5631 /// contain additional information that is useful for identifying the exact
5632 /// driver version used.
5633 ///
5634 /// Strings that have been found in the wild include:
5635 ///
5636 /// - 53.0.0
5637 /// - 0.405.2463
5638 /// - 32.0.15.6614
5639 ///
5640 /// [`SDL_PROP_GPU_DEVICE_DRIVER_INFO_STRING`]\: Contains the detailed version
5641 /// information of the underlying system driver as reported by the driver. This
5642 /// is an arbitrary string with no standardized format and it may contain
5643 /// newlines. This property should be preferred over
5644 /// [`SDL_PROP_GPU_DEVICE_DRIVER_VERSION_STRING`] if it is available as it usually
5645 /// contains the same information but in a format that is easier to read.
5646 ///
5647 /// Strings that have been found in the wild include:
5648 ///
5649 /// - 101.6559
5650 /// - 1.2.11
5651 /// - Mesa 21.2.2 (LLVM 12.0.1)
5652 /// - Mesa 22.2.0-devel (git-f226222 2022-04-14 impish-oibaf-ppa)
5653 /// - v1.r53p0-00eac0.824c4f31403fb1fbf8ee1042422c2129
5654 ///
5655 /// This string has also been observed to be a multiline string (which has a
5656 /// trailing newline):
5657 ///
5658 /// ```text
5659 /// Driver Build: 85da404, I46ff5fc46f, 1606794520
5660 /// Date: 11/30/20
5661 /// Compiler Version: EV031.31.04.01
5662 /// Driver Branch: promo490_3_Google
5663 /// ```
5664 ///
5665 /// ## Parameters
5666 /// - `device`: a GPU context to query.
5667 ///
5668 /// ## Return value
5669 /// Returns a valid property ID on success or 0 on failure; call
5670 /// [`SDL_GetError()`] for more information.
5671 ///
5672 /// ## Thread safety
5673 /// It is safe to call this function from any thread.
5674 ///
5675 /// ## Availability
5676 /// This function is available since SDL 3.4.0.
5677 pub fn SDL_GetGPUDeviceProperties(device: *mut SDL_GPUDevice) -> SDL_PropertiesID;
5678}
5679
5680pub const SDL_PROP_GPU_DEVICE_NAME_STRING: *const ::core::ffi::c_char =
5681 c"SDL.gpu.device.name".as_ptr();
5682
5683pub const SDL_PROP_GPU_DEVICE_DRIVER_NAME_STRING: *const ::core::ffi::c_char =
5684 c"SDL.gpu.device.driver_name".as_ptr();
5685
5686pub const SDL_PROP_GPU_DEVICE_DRIVER_VERSION_STRING: *const ::core::ffi::c_char =
5687 c"SDL.gpu.device.driver_version".as_ptr();
5688
5689pub const SDL_PROP_GPU_DEVICE_DRIVER_INFO_STRING: *const ::core::ffi::c_char =
5690 c"SDL.gpu.device.driver_info".as_ptr();
5691
5692unsafe extern "C" {
5693 /// Creates a pipeline object to be used in a compute workflow.
5694 ///
5695 /// Shader resource bindings must be authored to follow a particular order
5696 /// depending on the shader format.
5697 ///
5698 /// For SPIR-V shaders, use the following resource sets:
5699 ///
5700 /// - 0: Sampled textures, followed by read-only storage textures, followed by
5701 /// read-only storage buffers
5702 /// - 1: Read-write storage textures, followed by read-write storage buffers
5703 /// - 2: Uniform buffers
5704 ///
5705 /// For DXBC and DXIL shaders, use the following register order:
5706 ///
5707 /// - (t\[n\], space0): Sampled textures, followed by read-only storage textures,
5708 /// followed by read-only storage buffers
5709 /// - (u\[n\], space1): Read-write storage textures, followed by read-write
5710 /// storage buffers
5711 /// - (b\[n\], space2): Uniform buffers
5712 ///
5713 /// For MSL/metallib, use the following order:
5714 ///
5715 /// - \[\[buffer\]\]: Uniform buffers, followed by read-only storage buffers,
5716 /// followed by read-write storage buffers
5717 /// - \[\[texture\]\]: Sampled textures, followed by read-only storage textures,
5718 /// followed by read-write storage textures
5719 ///
5720 /// There are optional properties that can be provided through `props`. These
5721 /// are the supported properties:
5722 ///
5723 /// - [`SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING`]\: a name that can be
5724 /// displayed in debugging tools.
5725 ///
5726 /// ## Parameters
5727 /// - `device`: a GPU Context.
5728 /// - `createinfo`: a struct describing the state of the compute pipeline to
5729 /// create.
5730 ///
5731 /// ## Return value
5732 /// Returns a compute pipeline object on success, or NULL on failure; call
5733 /// [`SDL_GetError()`] for more information.
5734 ///
5735 /// ## Availability
5736 /// This function is available since SDL 3.2.0.
5737 ///
5738 /// ## See also
5739 /// - [`SDL_BindGPUComputePipeline`]
5740 /// - [`SDL_ReleaseGPUComputePipeline`]
5741 pub fn SDL_CreateGPUComputePipeline(
5742 device: *mut SDL_GPUDevice,
5743 createinfo: *const SDL_GPUComputePipelineCreateInfo,
5744 ) -> *mut SDL_GPUComputePipeline;
5745}
5746
5747pub const SDL_PROP_GPU_COMPUTEPIPELINE_CREATE_NAME_STRING: *const ::core::ffi::c_char =
5748 c"SDL.gpu.computepipeline.create.name".as_ptr();
5749
5750unsafe extern "C" {
5751 /// Creates a pipeline object to be used in a graphics workflow.
5752 ///
5753 /// There are optional properties that can be provided through `props`. These
5754 /// are the supported properties:
5755 ///
5756 /// - [`SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING`]\: a name that can be
5757 /// displayed in debugging tools.
5758 ///
5759 /// ## Parameters
5760 /// - `device`: a GPU Context.
5761 /// - `createinfo`: a struct describing the state of the graphics pipeline to
5762 /// create.
5763 ///
5764 /// ## Return value
5765 /// Returns a graphics pipeline object on success, or NULL on failure; call
5766 /// [`SDL_GetError()`] for more information.
5767 ///
5768 /// ## Availability
5769 /// This function is available since SDL 3.2.0.
5770 ///
5771 /// ## See also
5772 /// - [`SDL_CreateGPUShader`]
5773 /// - [`SDL_BindGPUGraphicsPipeline`]
5774 /// - [`SDL_ReleaseGPUGraphicsPipeline`]
5775 pub fn SDL_CreateGPUGraphicsPipeline(
5776 device: *mut SDL_GPUDevice,
5777 createinfo: *const SDL_GPUGraphicsPipelineCreateInfo,
5778 ) -> *mut SDL_GPUGraphicsPipeline;
5779}
5780
5781pub const SDL_PROP_GPU_GRAPHICSPIPELINE_CREATE_NAME_STRING: *const ::core::ffi::c_char =
5782 c"SDL.gpu.graphicspipeline.create.name".as_ptr();
5783
5784unsafe extern "C" {
5785 /// Creates a sampler object to be used when binding textures in a graphics
5786 /// workflow.
5787 ///
5788 /// There are optional properties that can be provided through `props`. These
5789 /// are the supported properties:
5790 ///
5791 /// - [`SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING`]\: a name that can be displayed
5792 /// in debugging tools.
5793 ///
5794 /// ## Parameters
5795 /// - `device`: a GPU Context.
5796 /// - `createinfo`: a struct describing the state of the sampler to create.
5797 ///
5798 /// ## Return value
5799 /// Returns a sampler object on success, or NULL on failure; call
5800 /// [`SDL_GetError()`] for more information.
5801 ///
5802 /// ## Availability
5803 /// This function is available since SDL 3.2.0.
5804 ///
5805 /// ## See also
5806 /// - [`SDL_BindGPUVertexSamplers`]
5807 /// - [`SDL_BindGPUFragmentSamplers`]
5808 /// - [`SDL_ReleaseGPUSampler`]
5809 pub fn SDL_CreateGPUSampler(
5810 device: *mut SDL_GPUDevice,
5811 createinfo: *const SDL_GPUSamplerCreateInfo,
5812 ) -> *mut SDL_GPUSampler;
5813}
5814
5815pub const SDL_PROP_GPU_SAMPLER_CREATE_NAME_STRING: *const ::core::ffi::c_char =
5816 c"SDL.gpu.sampler.create.name".as_ptr();
5817
5818unsafe extern "C" {
5819 /// Creates a shader to be used when creating a graphics pipeline.
5820 ///
5821 /// Shader resource bindings must be authored to follow a particular order
5822 /// depending on the shader format.
5823 ///
5824 /// For SPIR-V shaders, use the following resource sets:
5825 ///
5826 /// For vertex shaders:
5827 ///
5828 /// - 0: Sampled textures, followed by storage textures, followed by storage
5829 /// buffers
5830 /// - 1: Uniform buffers
5831 ///
5832 /// For fragment shaders:
5833 ///
5834 /// - 2: Sampled textures, followed by storage textures, followed by storage
5835 /// buffers
5836 /// - 3: Uniform buffers
5837 ///
5838 /// For DXBC and DXIL shaders, use the following register order:
5839 ///
5840 /// For vertex shaders:
5841 ///
5842 /// - (t\[n\], space0): Sampled textures, followed by storage textures, followed
5843 /// by storage buffers
5844 /// - (s\[n\], space0): Samplers with indices corresponding to the sampled
5845 /// textures
5846 /// - (b\[n\], space1): Uniform buffers
5847 ///
5848 /// For pixel shaders:
5849 ///
5850 /// - (t\[n\], space2): Sampled textures, followed by storage textures, followed
5851 /// by storage buffers
5852 /// - (s\[n\], space2): Samplers with indices corresponding to the sampled
5853 /// textures
5854 /// - (b\[n\], space3): Uniform buffers
5855 ///
5856 /// For MSL/metallib, use the following order:
5857 ///
5858 /// - \[\[texture\]\]: Sampled textures, followed by storage textures
5859 /// - \[\[sampler\]\]: Samplers with indices corresponding to the sampled textures
5860 /// - \[\[buffer\]\]: Uniform buffers, followed by storage buffers. Vertex buffer 0
5861 /// is bound at \[\[buffer(14)\]\], vertex buffer 1 at \[\[buffer(15)\]\], and so on.
5862 /// Rather than manually authoring vertex buffer indices, use the
5863 /// \[\[stage_in\]\] attribute which will automatically use the vertex input
5864 /// information from the [`SDL_GPUGraphicsPipeline`].
5865 ///
5866 /// Shader semantics other than system-value semantics do not matter in D3D12
5867 /// and for ease of use the SDL implementation assumes that non system-value
5868 /// semantics will all be TEXCOORD. If you are using HLSL as the shader source
5869 /// language, your vertex semantics should start at TEXCOORD0 and increment
5870 /// like so: TEXCOORD1, TEXCOORD2, etc. If you wish to change the semantic
5871 /// prefix to something other than TEXCOORD you can use
5872 /// [`SDL_PROP_GPU_DEVICE_CREATE_D3D12_SEMANTIC_NAME_STRING`] with
5873 /// [`SDL_CreateGPUDeviceWithProperties()`].
5874 ///
5875 /// There are optional properties that can be provided through `props`. These
5876 /// are the supported properties:
5877 ///
5878 /// - [`SDL_PROP_GPU_SHADER_CREATE_NAME_STRING`]\: a name that can be displayed in
5879 /// debugging tools.
5880 ///
5881 /// ## Parameters
5882 /// - `device`: a GPU Context.
5883 /// - `createinfo`: a struct describing the state of the shader to create.
5884 ///
5885 /// ## Return value
5886 /// Returns a shader object on success, or NULL on failure; call
5887 /// [`SDL_GetError()`] for more information.
5888 ///
5889 /// ## Availability
5890 /// This function is available since SDL 3.2.0.
5891 ///
5892 /// ## See also
5893 /// - [`SDL_CreateGPUGraphicsPipeline`]
5894 /// - [`SDL_ReleaseGPUShader`]
5895 pub fn SDL_CreateGPUShader(
5896 device: *mut SDL_GPUDevice,
5897 createinfo: *const SDL_GPUShaderCreateInfo,
5898 ) -> *mut SDL_GPUShader;
5899}
5900
5901pub const SDL_PROP_GPU_SHADER_CREATE_NAME_STRING: *const ::core::ffi::c_char =
5902 c"SDL.gpu.shader.create.name".as_ptr();
5903
5904unsafe extern "C" {
5905 /// Creates a texture object to be used in graphics or compute workflows.
5906 ///
5907 /// The contents of this texture are undefined until data is written to the
5908 /// texture, either via [`SDL_UploadToGPUTexture`] or by performing a render or
5909 /// compute pass with this texture as a target.
5910 ///
5911 /// Note that certain combinations of usage flags are invalid. For example, a
5912 /// texture cannot have both the SAMPLER and GRAPHICS_STORAGE_READ flags.
5913 ///
5914 /// If you request a sample count higher than the hardware supports, the
5915 /// implementation will automatically fall back to the highest available sample
5916 /// count.
5917 ///
5918 /// There are optional properties that can be provided through
5919 /// SDL_GPUTextureCreateInfo's `props`. These are the supported properties:
5920 ///
5921 /// - [`SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT`]\: (Direct3D 12 only) if
5922 /// the texture usage is [`SDL_GPU_TEXTUREUSAGE_COLOR_TARGET`], clear the texture
5923 /// to a color with this red intensity. Defaults to zero.
5924 /// - [`SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT`]\: (Direct3D 12 only) if
5925 /// the texture usage is [`SDL_GPU_TEXTUREUSAGE_COLOR_TARGET`], clear the texture
5926 /// to a color with this green intensity. Defaults to zero.
5927 /// - [`SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT`]\: (Direct3D 12 only) if
5928 /// the texture usage is [`SDL_GPU_TEXTUREUSAGE_COLOR_TARGET`], clear the texture
5929 /// to a color with this blue intensity. Defaults to zero.
5930 /// - [`SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT`]\: (Direct3D 12 only) if
5931 /// the texture usage is [`SDL_GPU_TEXTUREUSAGE_COLOR_TARGET`], clear the texture
5932 /// to a color with this alpha intensity. Defaults to zero.
5933 /// - [`SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT`]\: (Direct3D 12 only)
5934 /// if the texture usage is [`SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET`], clear
5935 /// the texture to a depth of this value. Defaults to zero.
5936 /// - [`SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_NUMBER`]\: (Direct3D 12
5937 /// only) if the texture usage is [`SDL_GPU_TEXTUREUSAGE_DEPTH_STENCIL_TARGET`],
5938 /// clear the texture to a stencil of this Uint8 value. Defaults to zero.
5939 /// - [`SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING`]\: a name that can be displayed
5940 /// in debugging tools.
5941 ///
5942 /// ## Parameters
5943 /// - `device`: a GPU Context.
5944 /// - `createinfo`: a struct describing the state of the texture to create.
5945 ///
5946 /// ## Return value
5947 /// Returns a texture object on success, or NULL on failure; call
5948 /// [`SDL_GetError()`] for more information.
5949 ///
5950 /// ## Availability
5951 /// This function is available since SDL 3.2.0.
5952 ///
5953 /// ## See also
5954 /// - [`SDL_UploadToGPUTexture`]
5955 /// - [`SDL_DownloadFromGPUTexture`]
5956 /// - [`SDL_BeginGPURenderPass`]
5957 /// - [`SDL_BeginGPUComputePass`]
5958 /// - [`SDL_BindGPUVertexSamplers`]
5959 /// - [`SDL_BindGPUVertexStorageTextures`]
5960 /// - [`SDL_BindGPUFragmentSamplers`]
5961 /// - [`SDL_BindGPUFragmentStorageTextures`]
5962 /// - [`SDL_BindGPUComputeStorageTextures`]
5963 /// - [`SDL_BlitGPUTexture`]
5964 /// - [`SDL_ReleaseGPUTexture`]
5965 /// - [`SDL_GPUTextureSupportsFormat`]
5966 pub fn SDL_CreateGPUTexture(
5967 device: *mut SDL_GPUDevice,
5968 createinfo: *const SDL_GPUTextureCreateInfo,
5969 ) -> *mut SDL_GPUTexture;
5970}
5971
5972pub const SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_R_FLOAT: *const ::core::ffi::c_char =
5973 c"SDL.gpu.texture.create.d3d12.clear.r".as_ptr();
5974
5975pub const SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_G_FLOAT: *const ::core::ffi::c_char =
5976 c"SDL.gpu.texture.create.d3d12.clear.g".as_ptr();
5977
5978pub const SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_B_FLOAT: *const ::core::ffi::c_char =
5979 c"SDL.gpu.texture.create.d3d12.clear.b".as_ptr();
5980
5981pub const SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_A_FLOAT: *const ::core::ffi::c_char =
5982 c"SDL.gpu.texture.create.d3d12.clear.a".as_ptr();
5983
5984pub const SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_DEPTH_FLOAT: *const ::core::ffi::c_char =
5985 c"SDL.gpu.texture.create.d3d12.clear.depth".as_ptr();
5986
5987pub const SDL_PROP_GPU_TEXTURE_CREATE_D3D12_CLEAR_STENCIL_NUMBER: *const ::core::ffi::c_char =
5988 c"SDL.gpu.texture.create.d3d12.clear.stencil".as_ptr();
5989
5990pub const SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING: *const ::core::ffi::c_char =
5991 c"SDL.gpu.texture.create.name".as_ptr();
5992
5993unsafe extern "C" {
5994 /// Creates a buffer object to be used in graphics or compute workflows.
5995 ///
5996 /// The contents of this buffer are undefined until data is written to the
5997 /// buffer.
5998 ///
5999 /// Note that certain combinations of usage flags are invalid. For example, a
6000 /// buffer cannot have both the VERTEX and INDEX flags.
6001 ///
6002 /// If you use a STORAGE flag, the data in the buffer must respect std140
6003 /// layout conventions. In practical terms this means you must ensure that vec3
6004 /// and vec4 fields are 16-byte aligned.
6005 ///
6006 /// For better understanding of underlying concepts and memory management with
6007 /// SDL GPU API, you may refer
6008 /// [this blog post](https://moonside.games/posts/sdl-gpu-concepts-cycling/)
6009 /// .
6010 ///
6011 /// There are optional properties that can be provided through `props`. These
6012 /// are the supported properties:
6013 ///
6014 /// - [`SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING`]\: a name that can be displayed in
6015 /// debugging tools.
6016 ///
6017 /// ## Parameters
6018 /// - `device`: a GPU Context.
6019 /// - `createinfo`: a struct describing the state of the buffer to create.
6020 ///
6021 /// ## Return value
6022 /// Returns a buffer object on success, or NULL on failure; call
6023 /// [`SDL_GetError()`] for more information.
6024 ///
6025 /// ## Availability
6026 /// This function is available since SDL 3.2.0.
6027 ///
6028 /// ## See also
6029 /// - [`SDL_UploadToGPUBuffer`]
6030 /// - [`SDL_DownloadFromGPUBuffer`]
6031 /// - [`SDL_CopyGPUBufferToBuffer`]
6032 /// - [`SDL_BindGPUVertexBuffers`]
6033 /// - [`SDL_BindGPUIndexBuffer`]
6034 /// - [`SDL_BindGPUVertexStorageBuffers`]
6035 /// - [`SDL_BindGPUFragmentStorageBuffers`]
6036 /// - [`SDL_DrawGPUPrimitivesIndirect`]
6037 /// - [`SDL_DrawGPUIndexedPrimitivesIndirect`]
6038 /// - [`SDL_BindGPUComputeStorageBuffers`]
6039 /// - [`SDL_DispatchGPUComputeIndirect`]
6040 /// - [`SDL_ReleaseGPUBuffer`]
6041 pub fn SDL_CreateGPUBuffer(
6042 device: *mut SDL_GPUDevice,
6043 createinfo: *const SDL_GPUBufferCreateInfo,
6044 ) -> *mut SDL_GPUBuffer;
6045}
6046
6047pub const SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING: *const ::core::ffi::c_char =
6048 c"SDL.gpu.buffer.create.name".as_ptr();
6049
6050unsafe extern "C" {
6051 /// Creates a transfer buffer to be used when uploading to or downloading from
6052 /// graphics resources.
6053 ///
6054 /// Download buffers can be particularly expensive to create, so it is good
6055 /// practice to reuse them if data will be downloaded regularly.
6056 ///
6057 /// There are optional properties that can be provided through `props`. These
6058 /// are the supported properties:
6059 ///
6060 /// - [`SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING`]\: a name that can be
6061 /// displayed in debugging tools.
6062 ///
6063 /// ## Parameters
6064 /// - `device`: a GPU Context.
6065 /// - `createinfo`: a struct describing the state of the transfer buffer to
6066 /// create.
6067 ///
6068 /// ## Return value
6069 /// Returns a transfer buffer on success, or NULL on failure; call
6070 /// [`SDL_GetError()`] for more information.
6071 ///
6072 /// ## Availability
6073 /// This function is available since SDL 3.2.0.
6074 ///
6075 /// ## See also
6076 /// - [`SDL_UploadToGPUBuffer`]
6077 /// - [`SDL_DownloadFromGPUBuffer`]
6078 /// - [`SDL_UploadToGPUTexture`]
6079 /// - [`SDL_DownloadFromGPUTexture`]
6080 /// - [`SDL_ReleaseGPUTransferBuffer`]
6081 pub fn SDL_CreateGPUTransferBuffer(
6082 device: *mut SDL_GPUDevice,
6083 createinfo: *const SDL_GPUTransferBufferCreateInfo,
6084 ) -> *mut SDL_GPUTransferBuffer;
6085}
6086
6087pub const SDL_PROP_GPU_TRANSFERBUFFER_CREATE_NAME_STRING: *const ::core::ffi::c_char =
6088 c"SDL.gpu.transferbuffer.create.name".as_ptr();
6089
6090unsafe extern "C" {
6091 /// Sets an arbitrary string constant to label a buffer.
6092 ///
6093 /// You should use [`SDL_PROP_GPU_BUFFER_CREATE_NAME_STRING`] with
6094 /// [`SDL_CreateGPUBuffer`] instead of this function to avoid thread safety issues.
6095 ///
6096 /// ## Parameters
6097 /// - `device`: a GPU Context.
6098 /// - `buffer`: a buffer to attach the name to.
6099 /// - `text`: a UTF-8 string constant to mark as the name of the buffer.
6100 ///
6101 /// ## Thread safety
6102 /// This function is not thread safe, you must make sure the
6103 /// buffer is not simultaneously used by any other thread.
6104 ///
6105 /// ## Availability
6106 /// This function is available since SDL 3.2.0.
6107 ///
6108 /// ## See also
6109 /// - [`SDL_CreateGPUBuffer`]
6110 pub fn SDL_SetGPUBufferName(
6111 device: *mut SDL_GPUDevice,
6112 buffer: *mut SDL_GPUBuffer,
6113 text: *const ::core::ffi::c_char,
6114 );
6115}
6116
6117unsafe extern "C" {
6118 /// Sets an arbitrary string constant to label a texture.
6119 ///
6120 /// You should use [`SDL_PROP_GPU_TEXTURE_CREATE_NAME_STRING`] with
6121 /// [`SDL_CreateGPUTexture`] instead of this function to avoid thread safety
6122 /// issues.
6123 ///
6124 /// ## Parameters
6125 /// - `device`: a GPU Context.
6126 /// - `texture`: a texture to attach the name to.
6127 /// - `text`: a UTF-8 string constant to mark as the name of the texture.
6128 ///
6129 /// ## Thread safety
6130 /// This function is not thread safe, you must make sure the
6131 /// texture is not simultaneously used by any other thread.
6132 ///
6133 /// ## Availability
6134 /// This function is available since SDL 3.2.0.
6135 ///
6136 /// ## See also
6137 /// - [`SDL_CreateGPUTexture`]
6138 pub fn SDL_SetGPUTextureName(
6139 device: *mut SDL_GPUDevice,
6140 texture: *mut SDL_GPUTexture,
6141 text: *const ::core::ffi::c_char,
6142 );
6143}
6144
6145unsafe extern "C" {
6146 /// Inserts an arbitrary string label into the command buffer callstream.
6147 ///
6148 /// Useful for debugging.
6149 ///
6150 /// On Direct3D 12, using [`SDL_InsertGPUDebugLabel`] requires
6151 /// WinPixEventRuntime.dll to be in your PATH or in the same directory as your
6152 /// executable. See
6153 /// [here](https://devblogs.microsoft.com/pix/winpixeventruntime/)
6154 /// for instructions on how to obtain it.
6155 ///
6156 /// ## Parameters
6157 /// - `command_buffer`: a command buffer.
6158 /// - `text`: a UTF-8 string constant to insert as the label.
6159 ///
6160 /// ## Availability
6161 /// This function is available since SDL 3.2.0.
6162 pub fn SDL_InsertGPUDebugLabel(
6163 command_buffer: *mut SDL_GPUCommandBuffer,
6164 text: *const ::core::ffi::c_char,
6165 );
6166}
6167
6168unsafe extern "C" {
6169 /// Begins a debug group with an arbitrary name.
6170 ///
6171 /// Used for denoting groups of calls when viewing the command buffer
6172 /// callstream in a graphics debugging tool.
6173 ///
6174 /// Each call to [`SDL_PushGPUDebugGroup`] must have a corresponding call to
6175 /// [`SDL_PopGPUDebugGroup`].
6176 ///
6177 /// On Direct3D 12, using [`SDL_PushGPUDebugGroup`] requires WinPixEventRuntime.dll
6178 /// to be in your PATH or in the same directory as your executable. See
6179 /// [here](https://devblogs.microsoft.com/pix/winpixeventruntime/)
6180 /// for instructions on how to obtain it.
6181 ///
6182 /// On some backends (e.g. Metal), pushing a debug group during a
6183 /// render/blit/compute pass will create a group that is scoped to the native
6184 /// pass rather than the command buffer. For best results, if you push a debug
6185 /// group during a pass, always pop it in the same pass.
6186 ///
6187 /// ## Parameters
6188 /// - `command_buffer`: a command buffer.
6189 /// - `name`: a UTF-8 string constant that names the group.
6190 ///
6191 /// ## Availability
6192 /// This function is available since SDL 3.2.0.
6193 ///
6194 /// ## See also
6195 /// - [`SDL_PopGPUDebugGroup`]
6196 pub fn SDL_PushGPUDebugGroup(
6197 command_buffer: *mut SDL_GPUCommandBuffer,
6198 name: *const ::core::ffi::c_char,
6199 );
6200}
6201
6202unsafe extern "C" {
6203 /// Ends the most-recently pushed debug group.
6204 ///
6205 /// On Direct3D 12, using [`SDL_PopGPUDebugGroup`] requires WinPixEventRuntime.dll
6206 /// to be in your PATH or in the same directory as your executable. See
6207 /// [here](https://devblogs.microsoft.com/pix/winpixeventruntime/)
6208 /// for instructions on how to obtain it.
6209 ///
6210 /// ## Parameters
6211 /// - `command_buffer`: a command buffer.
6212 ///
6213 /// ## Availability
6214 /// This function is available since SDL 3.2.0.
6215 ///
6216 /// ## See also
6217 /// - [`SDL_PushGPUDebugGroup`]
6218 pub fn SDL_PopGPUDebugGroup(command_buffer: *mut SDL_GPUCommandBuffer);
6219}
6220
6221unsafe extern "C" {
6222 /// Frees the given texture as soon as it is safe to do so.
6223 ///
6224 /// You must not reference the texture after calling this function.
6225 ///
6226 /// ## Parameters
6227 /// - `device`: a GPU context.
6228 /// - `texture`: a texture to be destroyed.
6229 ///
6230 /// ## Availability
6231 /// This function is available since SDL 3.2.0.
6232 pub fn SDL_ReleaseGPUTexture(device: *mut SDL_GPUDevice, texture: *mut SDL_GPUTexture);
6233}
6234
6235unsafe extern "C" {
6236 /// Frees the given sampler as soon as it is safe to do so.
6237 ///
6238 /// You must not reference the sampler after calling this function.
6239 ///
6240 /// ## Parameters
6241 /// - `device`: a GPU context.
6242 /// - `sampler`: a sampler to be destroyed.
6243 ///
6244 /// ## Availability
6245 /// This function is available since SDL 3.2.0.
6246 pub fn SDL_ReleaseGPUSampler(device: *mut SDL_GPUDevice, sampler: *mut SDL_GPUSampler);
6247}
6248
6249unsafe extern "C" {
6250 /// Frees the given buffer as soon as it is safe to do so.
6251 ///
6252 /// You must not reference the buffer after calling this function.
6253 ///
6254 /// ## Parameters
6255 /// - `device`: a GPU context.
6256 /// - `buffer`: a buffer to be destroyed.
6257 ///
6258 /// ## Availability
6259 /// This function is available since SDL 3.2.0.
6260 pub fn SDL_ReleaseGPUBuffer(device: *mut SDL_GPUDevice, buffer: *mut SDL_GPUBuffer);
6261}
6262
6263unsafe extern "C" {
6264 /// Frees the given transfer buffer as soon as it is safe to do so.
6265 ///
6266 /// You must not reference the transfer buffer after calling this function.
6267 ///
6268 /// ## Parameters
6269 /// - `device`: a GPU context.
6270 /// - `transfer_buffer`: a transfer buffer to be destroyed.
6271 ///
6272 /// ## Availability
6273 /// This function is available since SDL 3.2.0.
6274 pub fn SDL_ReleaseGPUTransferBuffer(
6275 device: *mut SDL_GPUDevice,
6276 transfer_buffer: *mut SDL_GPUTransferBuffer,
6277 );
6278}
6279
6280unsafe extern "C" {
6281 /// Frees the given compute pipeline as soon as it is safe to do so.
6282 ///
6283 /// You must not reference the compute pipeline after calling this function.
6284 ///
6285 /// ## Parameters
6286 /// - `device`: a GPU context.
6287 /// - `compute_pipeline`: a compute pipeline to be destroyed.
6288 ///
6289 /// ## Availability
6290 /// This function is available since SDL 3.2.0.
6291 pub fn SDL_ReleaseGPUComputePipeline(
6292 device: *mut SDL_GPUDevice,
6293 compute_pipeline: *mut SDL_GPUComputePipeline,
6294 );
6295}
6296
6297unsafe extern "C" {
6298 /// Frees the given shader as soon as it is safe to do so.
6299 ///
6300 /// You must not reference the shader after calling this function.
6301 ///
6302 /// ## Parameters
6303 /// - `device`: a GPU context.
6304 /// - `shader`: a shader to be destroyed.
6305 ///
6306 /// ## Availability
6307 /// This function is available since SDL 3.2.0.
6308 pub fn SDL_ReleaseGPUShader(device: *mut SDL_GPUDevice, shader: *mut SDL_GPUShader);
6309}
6310
6311unsafe extern "C" {
6312 /// Frees the given graphics pipeline as soon as it is safe to do so.
6313 ///
6314 /// You must not reference the graphics pipeline after calling this function.
6315 ///
6316 /// ## Parameters
6317 /// - `device`: a GPU context.
6318 /// - `graphics_pipeline`: a graphics pipeline to be destroyed.
6319 ///
6320 /// ## Availability
6321 /// This function is available since SDL 3.2.0.
6322 pub fn SDL_ReleaseGPUGraphicsPipeline(
6323 device: *mut SDL_GPUDevice,
6324 graphics_pipeline: *mut SDL_GPUGraphicsPipeline,
6325 );
6326}
6327
6328unsafe extern "C" {
6329 /// Acquire a command buffer.
6330 ///
6331 /// This command buffer is managed by the implementation and should not be
6332 /// freed by the user. The command buffer may only be used on the thread it was
6333 /// acquired on. The command buffer should be submitted on the thread it was
6334 /// acquired on.
6335 ///
6336 /// It is valid to acquire multiple command buffers on the same thread at once.
6337 /// In fact a common design pattern is to acquire two command buffers per frame
6338 /// where one is dedicated to render and compute passes and the other is
6339 /// dedicated to copy passes and other preparatory work such as generating
6340 /// mipmaps. Interleaving commands between the two command buffers reduces the
6341 /// total amount of passes overall which improves rendering performance.
6342 ///
6343 /// ## Parameters
6344 /// - `device`: a GPU context.
6345 ///
6346 /// ## Return value
6347 /// Returns a command buffer, or NULL on failure; call [`SDL_GetError()`] for more
6348 /// information.
6349 ///
6350 /// ## Availability
6351 /// This function is available since SDL 3.2.0.
6352 ///
6353 /// ## See also
6354 /// - [`SDL_SubmitGPUCommandBuffer`]
6355 /// - [`SDL_SubmitGPUCommandBufferAndAcquireFence`]
6356 pub fn SDL_AcquireGPUCommandBuffer(device: *mut SDL_GPUDevice) -> *mut SDL_GPUCommandBuffer;
6357}
6358
6359unsafe extern "C" {
6360 /// Pushes data to a vertex uniform slot on the command buffer.
6361 ///
6362 /// Subsequent draw calls in this command buffer will use this uniform data.
6363 ///
6364 /// The data being pushed must respect std140 layout conventions. In practical
6365 /// terms this means you must ensure that vec3 and vec4 fields are 16-byte
6366 /// aligned.
6367 ///
6368 /// For detailed information about accessing uniform data from a shader, please
6369 /// refer to [`SDL_CreateGPUShader`].
6370 ///
6371 /// ## Parameters
6372 /// - `command_buffer`: a command buffer.
6373 /// - `slot_index`: the vertex uniform slot to push data to.
6374 /// - `data`: client data to write.
6375 /// - `length`: the length of the data to write.
6376 ///
6377 /// ## Availability
6378 /// This function is available since SDL 3.2.0.
6379 pub fn SDL_PushGPUVertexUniformData(
6380 command_buffer: *mut SDL_GPUCommandBuffer,
6381 slot_index: Uint32,
6382 data: *const ::core::ffi::c_void,
6383 length: Uint32,
6384 );
6385}
6386
6387unsafe extern "C" {
6388 /// Pushes data to a fragment uniform slot on the command buffer.
6389 ///
6390 /// Subsequent draw calls in this command buffer will use this uniform data.
6391 ///
6392 /// The data being pushed must respect std140 layout conventions. In practical
6393 /// terms this means you must ensure that vec3 and vec4 fields are 16-byte
6394 /// aligned.
6395 ///
6396 /// ## Parameters
6397 /// - `command_buffer`: a command buffer.
6398 /// - `slot_index`: the fragment uniform slot to push data to.
6399 /// - `data`: client data to write.
6400 /// - `length`: the length of the data to write.
6401 ///
6402 /// ## Availability
6403 /// This function is available since SDL 3.2.0.
6404 pub fn SDL_PushGPUFragmentUniformData(
6405 command_buffer: *mut SDL_GPUCommandBuffer,
6406 slot_index: Uint32,
6407 data: *const ::core::ffi::c_void,
6408 length: Uint32,
6409 );
6410}
6411
6412unsafe extern "C" {
6413 /// Pushes data to a uniform slot on the command buffer.
6414 ///
6415 /// Subsequent draw calls in this command buffer will use this uniform data.
6416 ///
6417 /// The data being pushed must respect std140 layout conventions. In practical
6418 /// terms this means you must ensure that vec3 and vec4 fields are 16-byte
6419 /// aligned.
6420 ///
6421 /// ## Parameters
6422 /// - `command_buffer`: a command buffer.
6423 /// - `slot_index`: the uniform slot to push data to.
6424 /// - `data`: client data to write.
6425 /// - `length`: the length of the data to write.
6426 ///
6427 /// ## Availability
6428 /// This function is available since SDL 3.2.0.
6429 pub fn SDL_PushGPUComputeUniformData(
6430 command_buffer: *mut SDL_GPUCommandBuffer,
6431 slot_index: Uint32,
6432 data: *const ::core::ffi::c_void,
6433 length: Uint32,
6434 );
6435}
6436
6437unsafe extern "C" {
6438 /// Begins a render pass on a command buffer.
6439 ///
6440 /// A render pass consists of a set of texture subresources (or depth slices in
6441 /// the 3D texture case) which will be rendered to during the render pass,
6442 /// along with corresponding clear values and load/store operations. All
6443 /// operations related to graphics pipelines must take place inside of a render
6444 /// pass. A default viewport and scissor state are automatically set when this
6445 /// is called. You cannot begin another render pass, or begin a compute pass or
6446 /// copy pass until you have ended the render pass.
6447 ///
6448 /// Using [`SDL_GPU_LOADOP_LOAD`] before any contents have been written to the
6449 /// texture subresource will result in undefined behavior. [`SDL_GPU_LOADOP_CLEAR`]
6450 /// will set the contents of the texture subresource to a single value before
6451 /// any rendering is performed. It's fine to do an empty render pass using
6452 /// [`SDL_GPU_STOREOP_STORE`] to clear a texture, but in general it's better to
6453 /// think of clearing not as an independent operation but as something that's
6454 /// done as the beginning of a render pass.
6455 ///
6456 /// ## Parameters
6457 /// - `command_buffer`: a command buffer.
6458 /// - `color_target_infos`: an array of texture subresources with
6459 /// corresponding clear values and load/store ops.
6460 /// - `num_color_targets`: the number of color targets in the
6461 /// color_target_infos array.
6462 /// - `depth_stencil_target_info`: a texture subresource with corresponding
6463 /// clear value and load/store ops, may be
6464 /// NULL.
6465 ///
6466 /// ## Return value
6467 /// Returns a render pass handle.
6468 ///
6469 /// ## Availability
6470 /// This function is available since SDL 3.2.0.
6471 ///
6472 /// ## See also
6473 /// - [`SDL_EndGPURenderPass`]
6474 pub fn SDL_BeginGPURenderPass(
6475 command_buffer: *mut SDL_GPUCommandBuffer,
6476 color_target_infos: *const SDL_GPUColorTargetInfo,
6477 num_color_targets: Uint32,
6478 depth_stencil_target_info: *const SDL_GPUDepthStencilTargetInfo,
6479 ) -> *mut SDL_GPURenderPass;
6480}
6481
6482unsafe extern "C" {
6483 /// Binds a graphics pipeline on a render pass to be used in rendering.
6484 ///
6485 /// A graphics pipeline must be bound before making any draw calls.
6486 ///
6487 /// ## Parameters
6488 /// - `render_pass`: a render pass handle.
6489 /// - `graphics_pipeline`: the graphics pipeline to bind.
6490 ///
6491 /// ## Availability
6492 /// This function is available since SDL 3.2.0.
6493 pub fn SDL_BindGPUGraphicsPipeline(
6494 render_pass: *mut SDL_GPURenderPass,
6495 graphics_pipeline: *mut SDL_GPUGraphicsPipeline,
6496 );
6497}
6498
6499unsafe extern "C" {
6500 /// Sets the current viewport state on a command buffer.
6501 ///
6502 /// ## Parameters
6503 /// - `render_pass`: a render pass handle.
6504 /// - `viewport`: the viewport to set.
6505 ///
6506 /// ## Availability
6507 /// This function is available since SDL 3.2.0.
6508 pub fn SDL_SetGPUViewport(
6509 render_pass: *mut SDL_GPURenderPass,
6510 viewport: *const SDL_GPUViewport,
6511 );
6512}
6513
6514unsafe extern "C" {
6515 /// Sets the current scissor state on a command buffer.
6516 ///
6517 /// ## Parameters
6518 /// - `render_pass`: a render pass handle.
6519 /// - `scissor`: the scissor area to set.
6520 ///
6521 /// ## Availability
6522 /// This function is available since SDL 3.2.0.
6523 pub fn SDL_SetGPUScissor(render_pass: *mut SDL_GPURenderPass, scissor: *const SDL_Rect);
6524}
6525
6526unsafe extern "C" {
6527 /// Sets the current blend constants on a command buffer.
6528 ///
6529 /// ## Parameters
6530 /// - `render_pass`: a render pass handle.
6531 /// - `blend_constants`: the blend constant color.
6532 ///
6533 /// ## Availability
6534 /// This function is available since SDL 3.2.0.
6535 ///
6536 /// ## See also
6537 /// - [`SDL_GPU_BLENDFACTOR_CONSTANT_COLOR`]
6538 /// - [`SDL_GPU_BLENDFACTOR_ONE_MINUS_CONSTANT_COLOR`]
6539 pub fn SDL_SetGPUBlendConstants(
6540 render_pass: *mut SDL_GPURenderPass,
6541 blend_constants: SDL_FColor,
6542 );
6543}
6544
6545unsafe extern "C" {
6546 /// Sets the current stencil reference value on a command buffer.
6547 ///
6548 /// ## Parameters
6549 /// - `render_pass`: a render pass handle.
6550 /// - `reference`: the stencil reference value to set.
6551 ///
6552 /// ## Availability
6553 /// This function is available since SDL 3.2.0.
6554 pub fn SDL_SetGPUStencilReference(render_pass: *mut SDL_GPURenderPass, reference: Uint8);
6555}
6556
6557unsafe extern "C" {
6558 /// Binds vertex buffers on a command buffer for use with subsequent draw
6559 /// calls.
6560 ///
6561 /// ## Parameters
6562 /// - `render_pass`: a render pass handle.
6563 /// - `first_slot`: the vertex buffer slot to begin binding from.
6564 /// - `bindings`: an array of [`SDL_GPUBufferBinding`] structs containing vertex
6565 /// buffers and offset values.
6566 /// - `num_bindings`: the number of bindings in the bindings array.
6567 ///
6568 /// ## Availability
6569 /// This function is available since SDL 3.2.0.
6570 pub fn SDL_BindGPUVertexBuffers(
6571 render_pass: *mut SDL_GPURenderPass,
6572 first_slot: Uint32,
6573 bindings: *const SDL_GPUBufferBinding,
6574 num_bindings: Uint32,
6575 );
6576}
6577
6578unsafe extern "C" {
6579 /// Binds an index buffer on a command buffer for use with subsequent draw
6580 /// calls.
6581 ///
6582 /// ## Parameters
6583 /// - `render_pass`: a render pass handle.
6584 /// - `binding`: a pointer to a struct containing an index buffer and offset.
6585 /// - `index_element_size`: whether the index values in the buffer are 16- or
6586 /// 32-bit.
6587 ///
6588 /// ## Availability
6589 /// This function is available since SDL 3.2.0.
6590 pub fn SDL_BindGPUIndexBuffer(
6591 render_pass: *mut SDL_GPURenderPass,
6592 binding: *const SDL_GPUBufferBinding,
6593 index_element_size: SDL_GPUIndexElementSize,
6594 );
6595}
6596
6597unsafe extern "C" {
6598 /// Binds texture-sampler pairs for use on the vertex shader.
6599 ///
6600 /// The textures must have been created with [`SDL_GPU_TEXTUREUSAGE_SAMPLER`].
6601 ///
6602 /// Be sure your shader is set up according to the requirements documented in
6603 /// [`SDL_CreateGPUShader()`].
6604 ///
6605 /// ## Parameters
6606 /// - `render_pass`: a render pass handle.
6607 /// - `first_slot`: the vertex sampler slot to begin binding from.
6608 /// - `texture_sampler_bindings`: an array of texture-sampler binding
6609 /// structs.
6610 /// - `num_bindings`: the number of texture-sampler pairs to bind from the
6611 /// array.
6612 ///
6613 /// ## Availability
6614 /// This function is available since SDL 3.2.0.
6615 ///
6616 /// ## See also
6617 /// - [`SDL_CreateGPUShader`]
6618 pub fn SDL_BindGPUVertexSamplers(
6619 render_pass: *mut SDL_GPURenderPass,
6620 first_slot: Uint32,
6621 texture_sampler_bindings: *const SDL_GPUTextureSamplerBinding,
6622 num_bindings: Uint32,
6623 );
6624}
6625
6626unsafe extern "C" {
6627 /// Binds storage textures for use on the vertex shader.
6628 ///
6629 /// These textures must have been created with
6630 /// [`SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ`].
6631 ///
6632 /// Be sure your shader is set up according to the requirements documented in
6633 /// [`SDL_CreateGPUShader()`].
6634 ///
6635 /// ## Parameters
6636 /// - `render_pass`: a render pass handle.
6637 /// - `first_slot`: the vertex storage texture slot to begin binding from.
6638 /// - `storage_textures`: an array of storage textures.
6639 /// - `num_bindings`: the number of storage texture to bind from the array.
6640 ///
6641 /// ## Availability
6642 /// This function is available since SDL 3.2.0.
6643 ///
6644 /// ## See also
6645 /// - [`SDL_CreateGPUShader`]
6646 pub fn SDL_BindGPUVertexStorageTextures(
6647 render_pass: *mut SDL_GPURenderPass,
6648 first_slot: Uint32,
6649 storage_textures: *const *mut SDL_GPUTexture,
6650 num_bindings: Uint32,
6651 );
6652}
6653
6654unsafe extern "C" {
6655 /// Binds storage buffers for use on the vertex shader.
6656 ///
6657 /// These buffers must have been created with
6658 /// [`SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ`].
6659 ///
6660 /// Be sure your shader is set up according to the requirements documented in
6661 /// [`SDL_CreateGPUShader()`].
6662 ///
6663 /// ## Parameters
6664 /// - `render_pass`: a render pass handle.
6665 /// - `first_slot`: the vertex storage buffer slot to begin binding from.
6666 /// - `storage_buffers`: an array of buffers.
6667 /// - `num_bindings`: the number of buffers to bind from the array.
6668 ///
6669 /// ## Availability
6670 /// This function is available since SDL 3.2.0.
6671 ///
6672 /// ## See also
6673 /// - [`SDL_CreateGPUShader`]
6674 pub fn SDL_BindGPUVertexStorageBuffers(
6675 render_pass: *mut SDL_GPURenderPass,
6676 first_slot: Uint32,
6677 storage_buffers: *const *mut SDL_GPUBuffer,
6678 num_bindings: Uint32,
6679 );
6680}
6681
6682unsafe extern "C" {
6683 /// Binds texture-sampler pairs for use on the fragment shader.
6684 ///
6685 /// The textures must have been created with [`SDL_GPU_TEXTUREUSAGE_SAMPLER`].
6686 ///
6687 /// Be sure your shader is set up according to the requirements documented in
6688 /// [`SDL_CreateGPUShader()`].
6689 ///
6690 /// ## Parameters
6691 /// - `render_pass`: a render pass handle.
6692 /// - `first_slot`: the fragment sampler slot to begin binding from.
6693 /// - `texture_sampler_bindings`: an array of texture-sampler binding
6694 /// structs.
6695 /// - `num_bindings`: the number of texture-sampler pairs to bind from the
6696 /// array.
6697 ///
6698 /// ## Availability
6699 /// This function is available since SDL 3.2.0.
6700 ///
6701 /// ## See also
6702 /// - [`SDL_CreateGPUShader`]
6703 pub fn SDL_BindGPUFragmentSamplers(
6704 render_pass: *mut SDL_GPURenderPass,
6705 first_slot: Uint32,
6706 texture_sampler_bindings: *const SDL_GPUTextureSamplerBinding,
6707 num_bindings: Uint32,
6708 );
6709}
6710
6711unsafe extern "C" {
6712 /// Binds storage textures for use on the fragment shader.
6713 ///
6714 /// These textures must have been created with
6715 /// [`SDL_GPU_TEXTUREUSAGE_GRAPHICS_STORAGE_READ`].
6716 ///
6717 /// Be sure your shader is set up according to the requirements documented in
6718 /// [`SDL_CreateGPUShader()`].
6719 ///
6720 /// ## Parameters
6721 /// - `render_pass`: a render pass handle.
6722 /// - `first_slot`: the fragment storage texture slot to begin binding from.
6723 /// - `storage_textures`: an array of storage textures.
6724 /// - `num_bindings`: the number of storage textures to bind from the array.
6725 ///
6726 /// ## Availability
6727 /// This function is available since SDL 3.2.0.
6728 ///
6729 /// ## See also
6730 /// - [`SDL_CreateGPUShader`]
6731 pub fn SDL_BindGPUFragmentStorageTextures(
6732 render_pass: *mut SDL_GPURenderPass,
6733 first_slot: Uint32,
6734 storage_textures: *const *mut SDL_GPUTexture,
6735 num_bindings: Uint32,
6736 );
6737}
6738
6739unsafe extern "C" {
6740 /// Binds storage buffers for use on the fragment shader.
6741 ///
6742 /// These buffers must have been created with
6743 /// [`SDL_GPU_BUFFERUSAGE_GRAPHICS_STORAGE_READ`].
6744 ///
6745 /// Be sure your shader is set up according to the requirements documented in
6746 /// [`SDL_CreateGPUShader()`].
6747 ///
6748 /// ## Parameters
6749 /// - `render_pass`: a render pass handle.
6750 /// - `first_slot`: the fragment storage buffer slot to begin binding from.
6751 /// - `storage_buffers`: an array of storage buffers.
6752 /// - `num_bindings`: the number of storage buffers to bind from the array.
6753 ///
6754 /// ## Availability
6755 /// This function is available since SDL 3.2.0.
6756 ///
6757 /// ## See also
6758 /// - [`SDL_CreateGPUShader`]
6759 pub fn SDL_BindGPUFragmentStorageBuffers(
6760 render_pass: *mut SDL_GPURenderPass,
6761 first_slot: Uint32,
6762 storage_buffers: *const *mut SDL_GPUBuffer,
6763 num_bindings: Uint32,
6764 );
6765}
6766
6767unsafe extern "C" {
6768 /// Draws data using bound graphics state with an index buffer and instancing
6769 /// enabled.
6770 ///
6771 /// You must not call this function before binding a graphics pipeline.
6772 ///
6773 /// Note that the `first_vertex` and `first_instance` parameters are NOT
6774 /// compatible with built-in vertex/instance ID variables in shaders (for
6775 /// example, SV_VertexID); GPU APIs and shader languages do not define these
6776 /// built-in variables consistently, so if your shader depends on them, the
6777 /// only way to keep behavior consistent and portable is to always pass 0 for
6778 /// the correlating parameter in the draw calls.
6779 ///
6780 /// ## Parameters
6781 /// - `render_pass`: a render pass handle.
6782 /// - `num_indices`: the number of indices to draw per instance.
6783 /// - `num_instances`: the number of instances to draw.
6784 /// - `first_index`: the starting index within the index buffer.
6785 /// - `vertex_offset`: value added to vertex index before indexing into the
6786 /// vertex buffer.
6787 /// - `first_instance`: the ID of the first instance to draw.
6788 ///
6789 /// ## Availability
6790 /// This function is available since SDL 3.2.0.
6791 pub fn SDL_DrawGPUIndexedPrimitives(
6792 render_pass: *mut SDL_GPURenderPass,
6793 num_indices: Uint32,
6794 num_instances: Uint32,
6795 first_index: Uint32,
6796 vertex_offset: Sint32,
6797 first_instance: Uint32,
6798 );
6799}
6800
6801unsafe extern "C" {
6802 /// Draws data using bound graphics state.
6803 ///
6804 /// You must not call this function before binding a graphics pipeline.
6805 ///
6806 /// Note that the `first_vertex` and `first_instance` parameters are NOT
6807 /// compatible with built-in vertex/instance ID variables in shaders (for
6808 /// example, SV_VertexID); GPU APIs and shader languages do not define these
6809 /// built-in variables consistently, so if your shader depends on them, the
6810 /// only way to keep behavior consistent and portable is to always pass 0 for
6811 /// the correlating parameter in the draw calls.
6812 ///
6813 /// ## Parameters
6814 /// - `render_pass`: a render pass handle.
6815 /// - `num_vertices`: the number of vertices to draw.
6816 /// - `num_instances`: the number of instances that will be drawn.
6817 /// - `first_vertex`: the index of the first vertex to draw.
6818 /// - `first_instance`: the ID of the first instance to draw.
6819 ///
6820 /// ## Availability
6821 /// This function is available since SDL 3.2.0.
6822 pub fn SDL_DrawGPUPrimitives(
6823 render_pass: *mut SDL_GPURenderPass,
6824 num_vertices: Uint32,
6825 num_instances: Uint32,
6826 first_vertex: Uint32,
6827 first_instance: Uint32,
6828 );
6829}
6830
6831unsafe extern "C" {
6832 /// Draws data using bound graphics state and with draw parameters set from a
6833 /// buffer.
6834 ///
6835 /// The buffer must consist of tightly-packed draw parameter sets that each
6836 /// match the layout of [`SDL_GPUIndirectDrawCommand`]. You must not call this
6837 /// function before binding a graphics pipeline.
6838 ///
6839 /// ## Parameters
6840 /// - `render_pass`: a render pass handle.
6841 /// - `buffer`: a buffer containing draw parameters.
6842 /// - `offset`: the offset to start reading from the draw buffer.
6843 /// - `draw_count`: the number of draw parameter sets that should be read
6844 /// from the draw buffer.
6845 ///
6846 /// ## Availability
6847 /// This function is available since SDL 3.2.0.
6848 pub fn SDL_DrawGPUPrimitivesIndirect(
6849 render_pass: *mut SDL_GPURenderPass,
6850 buffer: *mut SDL_GPUBuffer,
6851 offset: Uint32,
6852 draw_count: Uint32,
6853 );
6854}
6855
6856unsafe extern "C" {
6857 /// Draws data using bound graphics state with an index buffer enabled and with
6858 /// draw parameters set from a buffer.
6859 ///
6860 /// The buffer must consist of tightly-packed draw parameter sets that each
6861 /// match the layout of [`SDL_GPUIndexedIndirectDrawCommand`]. You must not call
6862 /// this function before binding a graphics pipeline.
6863 ///
6864 /// ## Parameters
6865 /// - `render_pass`: a render pass handle.
6866 /// - `buffer`: a buffer containing draw parameters.
6867 /// - `offset`: the offset to start reading from the draw buffer.
6868 /// - `draw_count`: the number of draw parameter sets that should be read
6869 /// from the draw buffer.
6870 ///
6871 /// ## Availability
6872 /// This function is available since SDL 3.2.0.
6873 pub fn SDL_DrawGPUIndexedPrimitivesIndirect(
6874 render_pass: *mut SDL_GPURenderPass,
6875 buffer: *mut SDL_GPUBuffer,
6876 offset: Uint32,
6877 draw_count: Uint32,
6878 );
6879}
6880
6881unsafe extern "C" {
6882 /// Ends the given render pass.
6883 ///
6884 /// All bound graphics state on the render pass command buffer is unset. The
6885 /// render pass handle is now invalid.
6886 ///
6887 /// ## Parameters
6888 /// - `render_pass`: a render pass handle.
6889 ///
6890 /// ## Availability
6891 /// This function is available since SDL 3.2.0.
6892 pub fn SDL_EndGPURenderPass(render_pass: *mut SDL_GPURenderPass);
6893}
6894
6895unsafe extern "C" {
6896 /// Begins a compute pass on a command buffer.
6897 ///
6898 /// A compute pass is defined by a set of texture subresources and buffers that
6899 /// may be written to by compute pipelines. These textures and buffers must
6900 /// have been created with the COMPUTE_STORAGE_WRITE bit or the
6901 /// COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE bit. If you do not create a texture
6902 /// with COMPUTE_STORAGE_SIMULTANEOUS_READ_WRITE, you must not read from the
6903 /// texture in the compute pass. All operations related to compute pipelines
6904 /// must take place inside of a compute pass. You must not begin another
6905 /// compute pass, or a render pass or copy pass before ending the compute pass.
6906 ///
6907 /// A VERY IMPORTANT NOTE - Reads and writes in compute passes are NOT
6908 /// implicitly synchronized. This means you may cause data races by both
6909 /// reading and writing a resource region in a compute pass, or by writing
6910 /// multiple times to a resource region. If your compute work depends on
6911 /// reading the completed output from a previous dispatch, you MUST end the
6912 /// current compute pass and begin a new one before you can safely access the
6913 /// data. Otherwise you will receive unexpected results. Reading and writing a
6914 /// texture in the same compute pass is only supported by specific texture
6915 /// formats. Make sure you check the format support!
6916 ///
6917 /// ## Parameters
6918 /// - `command_buffer`: a command buffer.
6919 /// - `storage_texture_bindings`: an array of writeable storage texture
6920 /// binding structs.
6921 /// - `num_storage_texture_bindings`: the number of storage textures to bind
6922 /// from the array.
6923 /// - `storage_buffer_bindings`: an array of writeable storage buffer binding
6924 /// structs.
6925 /// - `num_storage_buffer_bindings`: the number of storage buffers to bind
6926 /// from the array.
6927 ///
6928 /// ## Return value
6929 /// Returns a compute pass handle.
6930 ///
6931 /// ## Availability
6932 /// This function is available since SDL 3.2.0.
6933 ///
6934 /// ## See also
6935 /// - [`SDL_EndGPUComputePass`]
6936 pub fn SDL_BeginGPUComputePass(
6937 command_buffer: *mut SDL_GPUCommandBuffer,
6938 storage_texture_bindings: *const SDL_GPUStorageTextureReadWriteBinding,
6939 num_storage_texture_bindings: Uint32,
6940 storage_buffer_bindings: *const SDL_GPUStorageBufferReadWriteBinding,
6941 num_storage_buffer_bindings: Uint32,
6942 ) -> *mut SDL_GPUComputePass;
6943}
6944
6945unsafe extern "C" {
6946 /// Binds a compute pipeline on a command buffer for use in compute dispatch.
6947 ///
6948 /// ## Parameters
6949 /// - `compute_pass`: a compute pass handle.
6950 /// - `compute_pipeline`: a compute pipeline to bind.
6951 ///
6952 /// ## Availability
6953 /// This function is available since SDL 3.2.0.
6954 pub fn SDL_BindGPUComputePipeline(
6955 compute_pass: *mut SDL_GPUComputePass,
6956 compute_pipeline: *mut SDL_GPUComputePipeline,
6957 );
6958}
6959
6960unsafe extern "C" {
6961 /// Binds texture-sampler pairs for use on the compute shader.
6962 ///
6963 /// The textures must have been created with [`SDL_GPU_TEXTUREUSAGE_SAMPLER`].
6964 ///
6965 /// Be sure your shader is set up according to the requirements documented in
6966 /// [`SDL_CreateGPUComputePipeline()`].
6967 ///
6968 /// ## Parameters
6969 /// - `compute_pass`: a compute pass handle.
6970 /// - `first_slot`: the compute sampler slot to begin binding from.
6971 /// - `texture_sampler_bindings`: an array of texture-sampler binding
6972 /// structs.
6973 /// - `num_bindings`: the number of texture-sampler bindings to bind from the
6974 /// array.
6975 ///
6976 /// ## Availability
6977 /// This function is available since SDL 3.2.0.
6978 ///
6979 /// ## See also
6980 /// - [`SDL_CreateGPUComputePipeline`]
6981 pub fn SDL_BindGPUComputeSamplers(
6982 compute_pass: *mut SDL_GPUComputePass,
6983 first_slot: Uint32,
6984 texture_sampler_bindings: *const SDL_GPUTextureSamplerBinding,
6985 num_bindings: Uint32,
6986 );
6987}
6988
6989unsafe extern "C" {
6990 /// Binds storage textures as readonly for use on the compute pipeline.
6991 ///
6992 /// These textures must have been created with
6993 /// [`SDL_GPU_TEXTUREUSAGE_COMPUTE_STORAGE_READ`].
6994 ///
6995 /// Be sure your shader is set up according to the requirements documented in
6996 /// [`SDL_CreateGPUComputePipeline()`].
6997 ///
6998 /// ## Parameters
6999 /// - `compute_pass`: a compute pass handle.
7000 /// - `first_slot`: the compute storage texture slot to begin binding from.
7001 /// - `storage_textures`: an array of storage textures.
7002 /// - `num_bindings`: the number of storage textures to bind from the array.
7003 ///
7004 /// ## Availability
7005 /// This function is available since SDL 3.2.0.
7006 ///
7007 /// ## See also
7008 /// - [`SDL_CreateGPUComputePipeline`]
7009 pub fn SDL_BindGPUComputeStorageTextures(
7010 compute_pass: *mut SDL_GPUComputePass,
7011 first_slot: Uint32,
7012 storage_textures: *const *mut SDL_GPUTexture,
7013 num_bindings: Uint32,
7014 );
7015}
7016
7017unsafe extern "C" {
7018 /// Binds storage buffers as readonly for use on the compute pipeline.
7019 ///
7020 /// These buffers must have been created with
7021 /// [`SDL_GPU_BUFFERUSAGE_COMPUTE_STORAGE_READ`].
7022 ///
7023 /// Be sure your shader is set up according to the requirements documented in
7024 /// [`SDL_CreateGPUComputePipeline()`].
7025 ///
7026 /// ## Parameters
7027 /// - `compute_pass`: a compute pass handle.
7028 /// - `first_slot`: the compute storage buffer slot to begin binding from.
7029 /// - `storage_buffers`: an array of storage buffer binding structs.
7030 /// - `num_bindings`: the number of storage buffers to bind from the array.
7031 ///
7032 /// ## Availability
7033 /// This function is available since SDL 3.2.0.
7034 ///
7035 /// ## See also
7036 /// - [`SDL_CreateGPUComputePipeline`]
7037 pub fn SDL_BindGPUComputeStorageBuffers(
7038 compute_pass: *mut SDL_GPUComputePass,
7039 first_slot: Uint32,
7040 storage_buffers: *const *mut SDL_GPUBuffer,
7041 num_bindings: Uint32,
7042 );
7043}
7044
7045unsafe extern "C" {
7046 /// Dispatches compute work.
7047 ///
7048 /// You must not call this function before binding a compute pipeline.
7049 ///
7050 /// A VERY IMPORTANT NOTE If you dispatch multiple times in a compute pass, and
7051 /// the dispatches write to the same resource region as each other, there is no
7052 /// guarantee of which order the writes will occur. If the write order matters,
7053 /// you MUST end the compute pass and begin another one.
7054 ///
7055 /// ## Parameters
7056 /// - `compute_pass`: a compute pass handle.
7057 /// - `groupcount_x`: number of local workgroups to dispatch in the X
7058 /// dimension.
7059 /// - `groupcount_y`: number of local workgroups to dispatch in the Y
7060 /// dimension.
7061 /// - `groupcount_z`: number of local workgroups to dispatch in the Z
7062 /// dimension.
7063 ///
7064 /// ## Availability
7065 /// This function is available since SDL 3.2.0.
7066 pub fn SDL_DispatchGPUCompute(
7067 compute_pass: *mut SDL_GPUComputePass,
7068 groupcount_x: Uint32,
7069 groupcount_y: Uint32,
7070 groupcount_z: Uint32,
7071 );
7072}
7073
7074unsafe extern "C" {
7075 /// Dispatches compute work with parameters set from a buffer.
7076 ///
7077 /// The buffer layout should match the layout of
7078 /// [`SDL_GPUIndirectDispatchCommand`]. You must not call this function before
7079 /// binding a compute pipeline.
7080 ///
7081 /// A VERY IMPORTANT NOTE If you dispatch multiple times in a compute pass, and
7082 /// the dispatches write to the same resource region as each other, there is no
7083 /// guarantee of which order the writes will occur. If the write order matters,
7084 /// you MUST end the compute pass and begin another one.
7085 ///
7086 /// ## Parameters
7087 /// - `compute_pass`: a compute pass handle.
7088 /// - `buffer`: a buffer containing dispatch parameters.
7089 /// - `offset`: the offset to start reading from the dispatch buffer.
7090 ///
7091 /// ## Availability
7092 /// This function is available since SDL 3.2.0.
7093 pub fn SDL_DispatchGPUComputeIndirect(
7094 compute_pass: *mut SDL_GPUComputePass,
7095 buffer: *mut SDL_GPUBuffer,
7096 offset: Uint32,
7097 );
7098}
7099
7100unsafe extern "C" {
7101 /// Ends the current compute pass.
7102 ///
7103 /// All bound compute state on the command buffer is unset. The compute pass
7104 /// handle is now invalid.
7105 ///
7106 /// ## Parameters
7107 /// - `compute_pass`: a compute pass handle.
7108 ///
7109 /// ## Availability
7110 /// This function is available since SDL 3.2.0.
7111 pub fn SDL_EndGPUComputePass(compute_pass: *mut SDL_GPUComputePass);
7112}
7113
7114unsafe extern "C" {
7115 /// Maps a transfer buffer into application address space.
7116 ///
7117 /// You must unmap the transfer buffer before encoding upload commands. The
7118 /// memory is owned by the graphics driver - do NOT call [`SDL_free()`] on the
7119 /// returned pointer.
7120 ///
7121 /// ## Parameters
7122 /// - `device`: a GPU context.
7123 /// - `transfer_buffer`: a transfer buffer.
7124 /// - `cycle`: if true, cycles the transfer buffer if it is already bound.
7125 ///
7126 /// ## Return value
7127 /// Returns the address of the mapped transfer buffer memory, or NULL on
7128 /// failure; call [`SDL_GetError()`] for more information.
7129 ///
7130 /// ## Availability
7131 /// This function is available since SDL 3.2.0.
7132 pub fn SDL_MapGPUTransferBuffer(
7133 device: *mut SDL_GPUDevice,
7134 transfer_buffer: *mut SDL_GPUTransferBuffer,
7135 cycle: ::core::primitive::bool,
7136 ) -> *mut ::core::ffi::c_void;
7137}
7138
7139unsafe extern "C" {
7140 /// Unmaps a previously mapped transfer buffer.
7141 ///
7142 /// ## Parameters
7143 /// - `device`: a GPU context.
7144 /// - `transfer_buffer`: a previously mapped transfer buffer.
7145 ///
7146 /// ## Availability
7147 /// This function is available since SDL 3.2.0.
7148 pub fn SDL_UnmapGPUTransferBuffer(
7149 device: *mut SDL_GPUDevice,
7150 transfer_buffer: *mut SDL_GPUTransferBuffer,
7151 );
7152}
7153
7154unsafe extern "C" {
7155 /// Begins a copy pass on a command buffer.
7156 ///
7157 /// All operations related to copying to or from buffers or textures take place
7158 /// inside a copy pass. You must not begin another copy pass, or a render pass
7159 /// or compute pass before ending the copy pass.
7160 ///
7161 /// ## Parameters
7162 /// - `command_buffer`: a command buffer.
7163 ///
7164 /// ## Return value
7165 /// Returns a copy pass handle.
7166 ///
7167 /// ## Availability
7168 /// This function is available since SDL 3.2.0.
7169 ///
7170 /// ## See also
7171 /// - [`SDL_EndGPUCopyPass`]
7172 pub fn SDL_BeginGPUCopyPass(command_buffer: *mut SDL_GPUCommandBuffer) -> *mut SDL_GPUCopyPass;
7173}
7174
7175unsafe extern "C" {
7176 /// Uploads data from a transfer buffer to a texture.
7177 ///
7178 /// The upload occurs on the GPU timeline. You may assume that the upload has
7179 /// finished in subsequent commands.
7180 ///
7181 /// You must align the data in the transfer buffer to a multiple of the texel
7182 /// size of the texture format.
7183 ///
7184 /// ## Parameters
7185 /// - `copy_pass`: a copy pass handle.
7186 /// - `source`: the source transfer buffer with image layout information.
7187 /// - `destination`: the destination texture region.
7188 /// - `cycle`: if true, cycles the texture if the texture is bound, otherwise
7189 /// overwrites the data.
7190 ///
7191 /// ## Availability
7192 /// This function is available since SDL 3.2.0.
7193 pub fn SDL_UploadToGPUTexture(
7194 copy_pass: *mut SDL_GPUCopyPass,
7195 source: *const SDL_GPUTextureTransferInfo,
7196 destination: *const SDL_GPUTextureRegion,
7197 cycle: ::core::primitive::bool,
7198 );
7199}
7200
7201unsafe extern "C" {
7202 /// Uploads data from a transfer buffer to a buffer.
7203 ///
7204 /// The upload occurs on the GPU timeline. You may assume that the upload has
7205 /// finished in subsequent commands.
7206 ///
7207 /// ## Parameters
7208 /// - `copy_pass`: a copy pass handle.
7209 /// - `source`: the source transfer buffer with offset.
7210 /// - `destination`: the destination buffer with offset and size.
7211 /// - `cycle`: if true, cycles the buffer if it is already bound, otherwise
7212 /// overwrites the data.
7213 ///
7214 /// ## Availability
7215 /// This function is available since SDL 3.2.0.
7216 pub fn SDL_UploadToGPUBuffer(
7217 copy_pass: *mut SDL_GPUCopyPass,
7218 source: *const SDL_GPUTransferBufferLocation,
7219 destination: *const SDL_GPUBufferRegion,
7220 cycle: ::core::primitive::bool,
7221 );
7222}
7223
7224unsafe extern "C" {
7225 /// Performs a texture-to-texture copy.
7226 ///
7227 /// This copy occurs on the GPU timeline. You may assume the copy has finished
7228 /// in subsequent commands.
7229 ///
7230 /// This function does not support copying between depth and color textures.
7231 /// For those, copy the texture to a buffer and then to the destination
7232 /// texture.
7233 ///
7234 /// ## Parameters
7235 /// - `copy_pass`: a copy pass handle.
7236 /// - `source`: a source texture region.
7237 /// - `destination`: a destination texture region.
7238 /// - `w`: the width of the region to copy.
7239 /// - `h`: the height of the region to copy.
7240 /// - `d`: the depth of the region to copy.
7241 /// - `cycle`: if true, cycles the destination texture if the destination
7242 /// texture is bound, otherwise overwrites the data.
7243 ///
7244 /// ## Availability
7245 /// This function is available since SDL 3.2.0.
7246 pub fn SDL_CopyGPUTextureToTexture(
7247 copy_pass: *mut SDL_GPUCopyPass,
7248 source: *const SDL_GPUTextureLocation,
7249 destination: *const SDL_GPUTextureLocation,
7250 w: Uint32,
7251 h: Uint32,
7252 d: Uint32,
7253 cycle: ::core::primitive::bool,
7254 );
7255}
7256
7257unsafe extern "C" {
7258 /// Performs a buffer-to-buffer copy.
7259 ///
7260 /// This copy occurs on the GPU timeline. You may assume the copy has finished
7261 /// in subsequent commands.
7262 ///
7263 /// ## Parameters
7264 /// - `copy_pass`: a copy pass handle.
7265 /// - `source`: the buffer and offset to copy from.
7266 /// - `destination`: the buffer and offset to copy to.
7267 /// - `size`: the length of the buffer to copy.
7268 /// - `cycle`: if true, cycles the destination buffer if it is already bound,
7269 /// otherwise overwrites the data.
7270 ///
7271 /// ## Availability
7272 /// This function is available since SDL 3.2.0.
7273 pub fn SDL_CopyGPUBufferToBuffer(
7274 copy_pass: *mut SDL_GPUCopyPass,
7275 source: *const SDL_GPUBufferLocation,
7276 destination: *const SDL_GPUBufferLocation,
7277 size: Uint32,
7278 cycle: ::core::primitive::bool,
7279 );
7280}
7281
7282unsafe extern "C" {
7283 /// Copies data from a texture to a transfer buffer on the GPU timeline.
7284 ///
7285 /// This data is not guaranteed to be copied until the command buffer fence is
7286 /// signaled.
7287 ///
7288 /// ## Parameters
7289 /// - `copy_pass`: a copy pass handle.
7290 /// - `source`: the source texture region.
7291 /// - `destination`: the destination transfer buffer with image layout
7292 /// information.
7293 ///
7294 /// ## Availability
7295 /// This function is available since SDL 3.2.0.
7296 pub fn SDL_DownloadFromGPUTexture(
7297 copy_pass: *mut SDL_GPUCopyPass,
7298 source: *const SDL_GPUTextureRegion,
7299 destination: *const SDL_GPUTextureTransferInfo,
7300 );
7301}
7302
7303unsafe extern "C" {
7304 /// Copies data from a buffer to a transfer buffer on the GPU timeline.
7305 ///
7306 /// This data is not guaranteed to be copied until the command buffer fence is
7307 /// signaled.
7308 ///
7309 /// ## Parameters
7310 /// - `copy_pass`: a copy pass handle.
7311 /// - `source`: the source buffer with offset and size.
7312 /// - `destination`: the destination transfer buffer with offset.
7313 ///
7314 /// ## Availability
7315 /// This function is available since SDL 3.2.0.
7316 pub fn SDL_DownloadFromGPUBuffer(
7317 copy_pass: *mut SDL_GPUCopyPass,
7318 source: *const SDL_GPUBufferRegion,
7319 destination: *const SDL_GPUTransferBufferLocation,
7320 );
7321}
7322
7323unsafe extern "C" {
7324 /// Ends the current copy pass.
7325 ///
7326 /// ## Parameters
7327 /// - `copy_pass`: a copy pass handle.
7328 ///
7329 /// ## Availability
7330 /// This function is available since SDL 3.2.0.
7331 pub fn SDL_EndGPUCopyPass(copy_pass: *mut SDL_GPUCopyPass);
7332}
7333
7334unsafe extern "C" {
7335 /// Generates mipmaps for the given texture.
7336 ///
7337 /// This function must not be called inside of any pass.
7338 ///
7339 /// ## Parameters
7340 /// - `command_buffer`: a command_buffer.
7341 /// - `texture`: a texture with more than 1 mip level.
7342 ///
7343 /// ## Availability
7344 /// This function is available since SDL 3.2.0.
7345 pub fn SDL_GenerateMipmapsForGPUTexture(
7346 command_buffer: *mut SDL_GPUCommandBuffer,
7347 texture: *mut SDL_GPUTexture,
7348 );
7349}
7350
7351unsafe extern "C" {
7352 /// Blits from a source texture region to a destination texture region.
7353 ///
7354 /// This function must not be called inside of any pass.
7355 ///
7356 /// ## Parameters
7357 /// - `command_buffer`: a command buffer.
7358 /// - `info`: the blit info struct containing the blit parameters.
7359 ///
7360 /// ## Availability
7361 /// This function is available since SDL 3.2.0.
7362 pub fn SDL_BlitGPUTexture(
7363 command_buffer: *mut SDL_GPUCommandBuffer,
7364 info: *const SDL_GPUBlitInfo,
7365 );
7366}
7367
7368unsafe extern "C" {
7369 /// Determines whether a swapchain composition is supported by the window.
7370 ///
7371 /// The window must be claimed before calling this function.
7372 ///
7373 /// ## Parameters
7374 /// - `device`: a GPU context.
7375 /// - `window`: an [`SDL_Window`].
7376 /// - `swapchain_composition`: the swapchain composition to check.
7377 ///
7378 /// ## Return value
7379 /// Returns true if supported, false if unsupported.
7380 ///
7381 /// ## Availability
7382 /// This function is available since SDL 3.2.0.
7383 ///
7384 /// ## See also
7385 /// - [`SDL_ClaimWindowForGPUDevice`]
7386 pub fn SDL_WindowSupportsGPUSwapchainComposition(
7387 device: *mut SDL_GPUDevice,
7388 window: *mut SDL_Window,
7389 swapchain_composition: SDL_GPUSwapchainComposition,
7390 ) -> ::core::primitive::bool;
7391}
7392
7393unsafe extern "C" {
7394 /// Determines whether a presentation mode is supported by the window.
7395 ///
7396 /// The window must be claimed before calling this function.
7397 ///
7398 /// ## Parameters
7399 /// - `device`: a GPU context.
7400 /// - `window`: an [`SDL_Window`].
7401 /// - `present_mode`: the presentation mode to check.
7402 ///
7403 /// ## Return value
7404 /// Returns true if supported, false if unsupported.
7405 ///
7406 /// ## Availability
7407 /// This function is available since SDL 3.2.0.
7408 ///
7409 /// ## See also
7410 /// - [`SDL_ClaimWindowForGPUDevice`]
7411 pub fn SDL_WindowSupportsGPUPresentMode(
7412 device: *mut SDL_GPUDevice,
7413 window: *mut SDL_Window,
7414 present_mode: SDL_GPUPresentMode,
7415 ) -> ::core::primitive::bool;
7416}
7417
7418unsafe extern "C" {
7419 /// Claims a window, creating a swapchain structure for it.
7420 ///
7421 /// This must be called before [`SDL_AcquireGPUSwapchainTexture`] is called using
7422 /// the window. You should only call this function from the thread that created
7423 /// the window.
7424 ///
7425 /// The swapchain will be created with [`SDL_GPU_SWAPCHAINCOMPOSITION_SDR`] and
7426 /// [`SDL_GPU_PRESENTMODE_VSYNC`]. If you want to have different swapchain
7427 /// parameters, you must call [`SDL_SetGPUSwapchainParameters`] after claiming the
7428 /// window.
7429 ///
7430 /// ## Parameters
7431 /// - `device`: a GPU context.
7432 /// - `window`: an [`SDL_Window`].
7433 ///
7434 /// ## Return value
7435 /// Returns true on success, or false on failure; call [`SDL_GetError()`] for more
7436 /// information.
7437 ///
7438 /// ## Thread safety
7439 /// This function should only be called from the thread that
7440 /// created the window.
7441 ///
7442 /// ## Availability
7443 /// This function is available since SDL 3.2.0.
7444 ///
7445 /// ## See also
7446 /// - [`SDL_WaitAndAcquireGPUSwapchainTexture`]
7447 /// - [`SDL_ReleaseWindowFromGPUDevice`]
7448 /// - [`SDL_WindowSupportsGPUPresentMode`]
7449 /// - [`SDL_WindowSupportsGPUSwapchainComposition`]
7450 pub fn SDL_ClaimWindowForGPUDevice(
7451 device: *mut SDL_GPUDevice,
7452 window: *mut SDL_Window,
7453 ) -> ::core::primitive::bool;
7454}
7455
7456unsafe extern "C" {
7457 /// Unclaims a window, destroying its swapchain structure.
7458 ///
7459 /// ## Parameters
7460 /// - `device`: a GPU context.
7461 /// - `window`: an [`SDL_Window`] that has been claimed.
7462 ///
7463 /// ## Availability
7464 /// This function is available since SDL 3.2.0.
7465 ///
7466 /// ## See also
7467 /// - [`SDL_ClaimWindowForGPUDevice`]
7468 pub fn SDL_ReleaseWindowFromGPUDevice(device: *mut SDL_GPUDevice, window: *mut SDL_Window);
7469}
7470
7471unsafe extern "C" {
7472 /// Changes the swapchain parameters for the given claimed window.
7473 ///
7474 /// This function will fail if the requested present mode or swapchain
7475 /// composition are unsupported by the device. Check if the parameters are
7476 /// supported via [`SDL_WindowSupportsGPUPresentMode`] /
7477 /// [`SDL_WindowSupportsGPUSwapchainComposition`] prior to calling this function.
7478 ///
7479 /// [`SDL_GPU_PRESENTMODE_VSYNC`] with [`SDL_GPU_SWAPCHAINCOMPOSITION_SDR`] is always
7480 /// supported.
7481 ///
7482 /// ## Parameters
7483 /// - `device`: a GPU context.
7484 /// - `window`: an [`SDL_Window`] that has been claimed.
7485 /// - `swapchain_composition`: the desired composition of the swapchain.
7486 /// - `present_mode`: the desired present mode for the swapchain.
7487 ///
7488 /// ## Return value
7489 /// Returns true if successful, false on error; call [`SDL_GetError()`] for more
7490 /// information.
7491 ///
7492 /// ## Availability
7493 /// This function is available since SDL 3.2.0.
7494 ///
7495 /// ## See also
7496 /// - [`SDL_WindowSupportsGPUPresentMode`]
7497 /// - [`SDL_WindowSupportsGPUSwapchainComposition`]
7498 pub fn SDL_SetGPUSwapchainParameters(
7499 device: *mut SDL_GPUDevice,
7500 window: *mut SDL_Window,
7501 swapchain_composition: SDL_GPUSwapchainComposition,
7502 present_mode: SDL_GPUPresentMode,
7503 ) -> ::core::primitive::bool;
7504}
7505
7506unsafe extern "C" {
7507 /// Configures the maximum allowed number of frames in flight.
7508 ///
7509 /// The default value when the device is created is 2. This means that after
7510 /// you have submitted 2 frames for presentation, if the GPU has not finished
7511 /// working on the first frame, [`SDL_AcquireGPUSwapchainTexture()`] will fill the
7512 /// swapchain texture pointer with NULL, and
7513 /// [`SDL_WaitAndAcquireGPUSwapchainTexture()`] will block.
7514 ///
7515 /// Higher values increase throughput at the expense of visual latency. Lower
7516 /// values decrease visual latency at the expense of throughput.
7517 ///
7518 /// Note that calling this function will stall and flush the command queue to
7519 /// prevent synchronization issues.
7520 ///
7521 /// The minimum value of allowed frames in flight is 1, and the maximum is 3.
7522 ///
7523 /// ## Parameters
7524 /// - `device`: a GPU context.
7525 /// - `allowed_frames_in_flight`: the maximum number of frames that can be
7526 /// pending on the GPU.
7527 ///
7528 /// ## Return value
7529 /// Returns true if successful, false on error; call [`SDL_GetError()`] for more
7530 /// information.
7531 ///
7532 /// ## Availability
7533 /// This function is available since SDL 3.2.0.
7534 pub fn SDL_SetGPUAllowedFramesInFlight(
7535 device: *mut SDL_GPUDevice,
7536 allowed_frames_in_flight: Uint32,
7537 ) -> ::core::primitive::bool;
7538}
7539
7540unsafe extern "C" {
7541 /// Obtains the texture format of the swapchain for the given window.
7542 ///
7543 /// Note that this format can change if the swapchain parameters change.
7544 ///
7545 /// ## Parameters
7546 /// - `device`: a GPU context.
7547 /// - `window`: an [`SDL_Window`] that has been claimed.
7548 ///
7549 /// ## Return value
7550 /// Returns the texture format of the swapchain.
7551 ///
7552 /// ## Availability
7553 /// This function is available since SDL 3.2.0.
7554 pub fn SDL_GetGPUSwapchainTextureFormat(
7555 device: *mut SDL_GPUDevice,
7556 window: *mut SDL_Window,
7557 ) -> SDL_GPUTextureFormat;
7558}
7559
7560unsafe extern "C" {
7561 /// Acquire a texture to use in presentation.
7562 ///
7563 /// When a swapchain texture is acquired on a command buffer, it will
7564 /// automatically be submitted for presentation when the command buffer is
7565 /// submitted. The swapchain texture should only be referenced by the command
7566 /// buffer used to acquire it.
7567 ///
7568 /// This function will fill the swapchain texture handle with NULL if too many
7569 /// frames are in flight. This is not an error. This NULL pointer should not be
7570 /// passed back into SDL. Instead, it should be considered as an indication to
7571 /// wait until the swapchain is available.
7572 ///
7573 /// If you use this function, it is possible to create a situation where many
7574 /// command buffers are allocated while the rendering context waits for the GPU
7575 /// to catch up, which will cause memory usage to grow. You should use
7576 /// [`SDL_WaitAndAcquireGPUSwapchainTexture()`] unless you know what you are doing
7577 /// with timing.
7578 ///
7579 /// The swapchain texture is managed by the implementation and must not be
7580 /// freed by the user. You MUST NOT call this function from any thread other
7581 /// than the one that created the window.
7582 ///
7583 /// ## Parameters
7584 /// - `command_buffer`: a command buffer.
7585 /// - `window`: a window that has been claimed.
7586 /// - `swapchain_texture`: a pointer filled in with a swapchain texture
7587 /// handle.
7588 /// - `swapchain_texture_width`: a pointer filled in with the swapchain
7589 /// texture width, may be NULL.
7590 /// - `swapchain_texture_height`: a pointer filled in with the swapchain
7591 /// texture height, may be NULL.
7592 ///
7593 /// ## Return value
7594 /// Returns true on success, false on error; call [`SDL_GetError()`] for more
7595 /// information.
7596 ///
7597 /// ## Thread safety
7598 /// This function should only be called from the thread that
7599 /// created the window.
7600 ///
7601 /// ## Availability
7602 /// This function is available since SDL 3.2.0.
7603 ///
7604 /// ## See also
7605 /// - [`SDL_ClaimWindowForGPUDevice`]
7606 /// - [`SDL_SubmitGPUCommandBuffer`]
7607 /// - [`SDL_SubmitGPUCommandBufferAndAcquireFence`]
7608 /// - [`SDL_CancelGPUCommandBuffer`]
7609 /// - [`SDL_GetWindowSizeInPixels`]
7610 /// - [`SDL_WaitForGPUSwapchain`]
7611 /// - [`SDL_WaitAndAcquireGPUSwapchainTexture`]
7612 /// - [`SDL_SetGPUAllowedFramesInFlight`]
7613 pub fn SDL_AcquireGPUSwapchainTexture(
7614 command_buffer: *mut SDL_GPUCommandBuffer,
7615 window: *mut SDL_Window,
7616 swapchain_texture: *mut *mut SDL_GPUTexture,
7617 swapchain_texture_width: *mut Uint32,
7618 swapchain_texture_height: *mut Uint32,
7619 ) -> ::core::primitive::bool;
7620}
7621
7622unsafe extern "C" {
7623 /// Blocks the thread until a swapchain texture is available to be acquired.
7624 ///
7625 /// ## Parameters
7626 /// - `device`: a GPU context.
7627 /// - `window`: a window that has been claimed.
7628 ///
7629 /// ## Return value
7630 /// Returns true on success, false on failure; call [`SDL_GetError()`] for more
7631 /// information.
7632 ///
7633 /// ## Thread safety
7634 /// This function should only be called from the thread that
7635 /// created the window.
7636 ///
7637 /// ## Availability
7638 /// This function is available since SDL 3.2.0.
7639 ///
7640 /// ## See also
7641 /// - [`SDL_AcquireGPUSwapchainTexture`]
7642 /// - [`SDL_WaitAndAcquireGPUSwapchainTexture`]
7643 /// - [`SDL_SetGPUAllowedFramesInFlight`]
7644 pub fn SDL_WaitForGPUSwapchain(
7645 device: *mut SDL_GPUDevice,
7646 window: *mut SDL_Window,
7647 ) -> ::core::primitive::bool;
7648}
7649
7650unsafe extern "C" {
7651 /// Blocks the thread until a swapchain texture is available to be acquired,
7652 /// and then acquires it.
7653 ///
7654 /// When a swapchain texture is acquired on a command buffer, it will
7655 /// automatically be submitted for presentation when the command buffer is
7656 /// submitted. The swapchain texture should only be referenced by the command
7657 /// buffer used to acquire it. It is an error to call
7658 /// [`SDL_CancelGPUCommandBuffer()`] after a swapchain texture is acquired.
7659 ///
7660 /// This function can fill the swapchain texture handle with NULL in certain
7661 /// cases, for example if the window is minimized. This is not an error. You
7662 /// should always make sure to check whether the pointer is NULL before
7663 /// actually using it.
7664 ///
7665 /// The swapchain texture is managed by the implementation and must not be
7666 /// freed by the user. You MUST NOT call this function from any thread other
7667 /// than the one that created the window.
7668 ///
7669 /// The swapchain texture is write-only and cannot be used as a sampler or for
7670 /// another reading operation.
7671 ///
7672 /// ## Parameters
7673 /// - `command_buffer`: a command buffer.
7674 /// - `window`: a window that has been claimed.
7675 /// - `swapchain_texture`: a pointer filled in with a swapchain texture
7676 /// handle.
7677 /// - `swapchain_texture_width`: a pointer filled in with the swapchain
7678 /// texture width, may be NULL.
7679 /// - `swapchain_texture_height`: a pointer filled in with the swapchain
7680 /// texture height, may be NULL.
7681 ///
7682 /// ## Return value
7683 /// Returns true on success, false on error; call [`SDL_GetError()`] for more
7684 /// information.
7685 ///
7686 /// ## Thread safety
7687 /// This function should only be called from the thread that
7688 /// created the window.
7689 ///
7690 /// ## Availability
7691 /// This function is available since SDL 3.2.0.
7692 ///
7693 /// ## See also
7694 /// - [`SDL_SubmitGPUCommandBuffer`]
7695 /// - [`SDL_SubmitGPUCommandBufferAndAcquireFence`]
7696 /// - [`SDL_AcquireGPUSwapchainTexture`]
7697 pub fn SDL_WaitAndAcquireGPUSwapchainTexture(
7698 command_buffer: *mut SDL_GPUCommandBuffer,
7699 window: *mut SDL_Window,
7700 swapchain_texture: *mut *mut SDL_GPUTexture,
7701 swapchain_texture_width: *mut Uint32,
7702 swapchain_texture_height: *mut Uint32,
7703 ) -> ::core::primitive::bool;
7704}
7705
7706unsafe extern "C" {
7707 /// Submits a command buffer so its commands can be processed on the GPU.
7708 ///
7709 /// It is invalid to use the command buffer after this is called.
7710 ///
7711 /// This must be called from the thread the command buffer was acquired on.
7712 ///
7713 /// All commands in the submission are guaranteed to begin executing before any
7714 /// command in a subsequent submission begins executing.
7715 ///
7716 /// ## Parameters
7717 /// - `command_buffer`: a command buffer.
7718 ///
7719 /// ## Return value
7720 /// Returns true on success, false on failure; call [`SDL_GetError()`] for more
7721 /// information.
7722 ///
7723 /// ## Availability
7724 /// This function is available since SDL 3.2.0.
7725 ///
7726 /// ## See also
7727 /// - [`SDL_AcquireGPUCommandBuffer`]
7728 /// - [`SDL_WaitAndAcquireGPUSwapchainTexture`]
7729 /// - [`SDL_AcquireGPUSwapchainTexture`]
7730 /// - [`SDL_SubmitGPUCommandBufferAndAcquireFence`]
7731 pub fn SDL_SubmitGPUCommandBuffer(
7732 command_buffer: *mut SDL_GPUCommandBuffer,
7733 ) -> ::core::primitive::bool;
7734}
7735
7736unsafe extern "C" {
7737 /// Submits a command buffer so its commands can be processed on the GPU, and
7738 /// acquires a fence associated with the command buffer.
7739 ///
7740 /// You must release this fence when it is no longer needed or it will cause a
7741 /// leak. It is invalid to use the command buffer after this is called.
7742 ///
7743 /// This must be called from the thread the command buffer was acquired on.
7744 ///
7745 /// All commands in the submission are guaranteed to begin executing before any
7746 /// command in a subsequent submission begins executing.
7747 ///
7748 /// ## Parameters
7749 /// - `command_buffer`: a command buffer.
7750 ///
7751 /// ## Return value
7752 /// Returns a fence associated with the command buffer, or NULL on failure;
7753 /// call [`SDL_GetError()`] for more information.
7754 ///
7755 /// ## Availability
7756 /// This function is available since SDL 3.2.0.
7757 ///
7758 /// ## See also
7759 /// - [`SDL_AcquireGPUCommandBuffer`]
7760 /// - [`SDL_WaitAndAcquireGPUSwapchainTexture`]
7761 /// - [`SDL_AcquireGPUSwapchainTexture`]
7762 /// - [`SDL_SubmitGPUCommandBuffer`]
7763 /// - [`SDL_ReleaseGPUFence`]
7764 pub fn SDL_SubmitGPUCommandBufferAndAcquireFence(
7765 command_buffer: *mut SDL_GPUCommandBuffer,
7766 ) -> *mut SDL_GPUFence;
7767}
7768
7769unsafe extern "C" {
7770 /// Cancels a command buffer.
7771 ///
7772 /// None of the enqueued commands are executed.
7773 ///
7774 /// It is an error to call this function after a swapchain texture has been
7775 /// acquired.
7776 ///
7777 /// This must be called from the thread the command buffer was acquired on.
7778 ///
7779 /// You must not reference the command buffer after calling this function.
7780 ///
7781 /// ## Parameters
7782 /// - `command_buffer`: a command buffer.
7783 ///
7784 /// ## Return value
7785 /// Returns true on success, false on error; call [`SDL_GetError()`] for more
7786 /// information.
7787 ///
7788 /// ## Availability
7789 /// This function is available since SDL 3.2.0.
7790 ///
7791 /// ## See also
7792 /// - [`SDL_WaitAndAcquireGPUSwapchainTexture`]
7793 /// - [`SDL_AcquireGPUCommandBuffer`]
7794 /// - [`SDL_AcquireGPUSwapchainTexture`]
7795 pub fn SDL_CancelGPUCommandBuffer(
7796 command_buffer: *mut SDL_GPUCommandBuffer,
7797 ) -> ::core::primitive::bool;
7798}
7799
7800unsafe extern "C" {
7801 /// Blocks the thread until the GPU is completely idle.
7802 ///
7803 /// ## Parameters
7804 /// - `device`: a GPU context.
7805 ///
7806 /// ## Return value
7807 /// Returns true on success, false on failure; call [`SDL_GetError()`] for more
7808 /// information.
7809 ///
7810 /// ## Availability
7811 /// This function is available since SDL 3.2.0.
7812 ///
7813 /// ## See also
7814 /// - [`SDL_WaitForGPUFences`]
7815 pub fn SDL_WaitForGPUIdle(device: *mut SDL_GPUDevice) -> ::core::primitive::bool;
7816}
7817
7818unsafe extern "C" {
7819 /// Blocks the thread until the given fences are signaled.
7820 ///
7821 /// ## Parameters
7822 /// - `device`: a GPU context.
7823 /// - `wait_all`: if 0, wait for any fence to be signaled, if 1, wait for all
7824 /// fences to be signaled.
7825 /// - `fences`: an array of fences to wait on.
7826 /// - `num_fences`: the number of fences in the fences array.
7827 ///
7828 /// ## Return value
7829 /// Returns true on success, false on failure; call [`SDL_GetError()`] for more
7830 /// information.
7831 ///
7832 /// ## Availability
7833 /// This function is available since SDL 3.2.0.
7834 ///
7835 /// ## See also
7836 /// - [`SDL_SubmitGPUCommandBufferAndAcquireFence`]
7837 /// - [`SDL_WaitForGPUIdle`]
7838 pub fn SDL_WaitForGPUFences(
7839 device: *mut SDL_GPUDevice,
7840 wait_all: ::core::primitive::bool,
7841 fences: *const *mut SDL_GPUFence,
7842 num_fences: Uint32,
7843 ) -> ::core::primitive::bool;
7844}
7845
7846unsafe extern "C" {
7847 /// Checks the status of a fence.
7848 ///
7849 /// ## Parameters
7850 /// - `device`: a GPU context.
7851 /// - `fence`: a fence.
7852 ///
7853 /// ## Return value
7854 /// Returns true if the fence is signaled, false if it is not.
7855 ///
7856 /// ## Availability
7857 /// This function is available since SDL 3.2.0.
7858 ///
7859 /// ## See also
7860 /// - [`SDL_SubmitGPUCommandBufferAndAcquireFence`]
7861 pub fn SDL_QueryGPUFence(
7862 device: *mut SDL_GPUDevice,
7863 fence: *mut SDL_GPUFence,
7864 ) -> ::core::primitive::bool;
7865}
7866
7867unsafe extern "C" {
7868 /// Releases a fence obtained from [`SDL_SubmitGPUCommandBufferAndAcquireFence`].
7869 ///
7870 /// You must not reference the fence after calling this function.
7871 ///
7872 /// ## Parameters
7873 /// - `device`: a GPU context.
7874 /// - `fence`: a fence.
7875 ///
7876 /// ## Availability
7877 /// This function is available since SDL 3.2.0.
7878 ///
7879 /// ## See also
7880 /// - [`SDL_SubmitGPUCommandBufferAndAcquireFence`]
7881 pub fn SDL_ReleaseGPUFence(device: *mut SDL_GPUDevice, fence: *mut SDL_GPUFence);
7882}
7883
7884unsafe extern "C" {
7885 /// Obtains the texel block size for a texture format.
7886 ///
7887 /// ## Parameters
7888 /// - `format`: the texture format you want to know the texel size of.
7889 ///
7890 /// ## Return value
7891 /// Returns the texel block size of the texture format.
7892 ///
7893 /// ## Availability
7894 /// This function is available since SDL 3.2.0.
7895 ///
7896 /// ## See also
7897 /// - [`SDL_UploadToGPUTexture`]
7898 pub fn SDL_GPUTextureFormatTexelBlockSize(format: SDL_GPUTextureFormat) -> Uint32;
7899}
7900
7901unsafe extern "C" {
7902 /// Determines whether a texture format is supported for a given type and
7903 /// usage.
7904 ///
7905 /// ## Parameters
7906 /// - `device`: a GPU context.
7907 /// - `format`: the texture format to check.
7908 /// - `type`: the type of texture (2D, 3D, Cube).
7909 /// - `usage`: a bitmask of all usage scenarios to check.
7910 ///
7911 /// ## Return value
7912 /// Returns whether the texture format is supported for this type and usage.
7913 ///
7914 /// ## Availability
7915 /// This function is available since SDL 3.2.0.
7916 pub fn SDL_GPUTextureSupportsFormat(
7917 device: *mut SDL_GPUDevice,
7918 format: SDL_GPUTextureFormat,
7919 r#type: SDL_GPUTextureType,
7920 usage: SDL_GPUTextureUsageFlags,
7921 ) -> ::core::primitive::bool;
7922}
7923
7924unsafe extern "C" {
7925 /// Determines if a sample count for a texture format is supported.
7926 ///
7927 /// ## Parameters
7928 /// - `device`: a GPU context.
7929 /// - `format`: the texture format to check.
7930 /// - `sample_count`: the sample count to check.
7931 ///
7932 /// ## Return value
7933 /// Returns whether the sample count is supported for this texture format.
7934 ///
7935 /// ## Availability
7936 /// This function is available since SDL 3.2.0.
7937 pub fn SDL_GPUTextureSupportsSampleCount(
7938 device: *mut SDL_GPUDevice,
7939 format: SDL_GPUTextureFormat,
7940 sample_count: SDL_GPUSampleCount,
7941 ) -> ::core::primitive::bool;
7942}
7943
7944unsafe extern "C" {
7945 /// Calculate the size in bytes of a texture format with dimensions.
7946 ///
7947 /// ## Parameters
7948 /// - `format`: a texture format.
7949 /// - `width`: width in pixels.
7950 /// - `height`: height in pixels.
7951 /// - `depth_or_layer_count`: depth for 3D textures or layer count otherwise.
7952 ///
7953 /// ## Return value
7954 /// Returns the size of a texture with this format and dimensions.
7955 ///
7956 /// ## Availability
7957 /// This function is available since SDL 3.2.0.
7958 pub fn SDL_CalculateGPUTextureFormatSize(
7959 format: SDL_GPUTextureFormat,
7960 width: Uint32,
7961 height: Uint32,
7962 depth_or_layer_count: Uint32,
7963 ) -> Uint32;
7964}
7965
7966unsafe extern "C" {
7967 /// Get the SDL pixel format corresponding to a GPU texture format.
7968 ///
7969 /// ## Parameters
7970 /// - `format`: a texture format.
7971 ///
7972 /// ## Return value
7973 /// Returns the corresponding pixel format, or [`SDL_PIXELFORMAT_UNKNOWN`] if
7974 /// there is no corresponding pixel format.
7975 ///
7976 /// ## Availability
7977 /// This function is available since SDL 3.4.0.
7978 pub safe fn SDL_GetPixelFormatFromGPUTextureFormat(
7979 format: SDL_GPUTextureFormat,
7980 ) -> SDL_PixelFormat;
7981}
7982
7983unsafe extern "C" {
7984 /// Get the GPU texture format corresponding to an SDL pixel format.
7985 ///
7986 /// ## Parameters
7987 /// - `format`: a pixel format.
7988 ///
7989 /// ## Return value
7990 /// Returns the corresponding GPU texture format, or
7991 /// [`SDL_GPU_TEXTUREFORMAT_INVALID`] if there is no corresponding GPU
7992 /// texture format.
7993 ///
7994 /// ## Availability
7995 /// This function is available since SDL 3.4.0.
7996 pub safe fn SDL_GetGPUTextureFormatFromPixelFormat(
7997 format: SDL_PixelFormat,
7998 ) -> SDL_GPUTextureFormat;
7999}
8000
8001apply_cfg!(#[cfg(any(doc, all(windows, feature = "target-gdk")))] => {
8002 unsafe extern "C" {
8003 /// Call this to suspend GPU operation on Xbox when you receive the
8004 /// [`SDL_EVENT_DID_ENTER_BACKGROUND`] event.
8005 ///
8006 /// Do NOT call any SDL_GPU functions after calling this function! This must
8007 /// also be called before calling [`SDL_GDKSuspendComplete`].
8008 ///
8009 /// ## Parameters
8010 /// - `device`: a GPU context.
8011 ///
8012 /// ## Availability
8013 /// This function is available since SDL 3.2.0.
8014 ///
8015 /// ## See also
8016 /// - [`SDL_AddEventWatch`]
8017 pub fn SDL_GDKSuspendGPU(device: *mut SDL_GPUDevice);
8018 }
8019
8020 unsafe extern "C" {
8021 /// Call this to resume GPU operation on Xbox when you receive the
8022 /// [`SDL_EVENT_WILL_ENTER_FOREGROUND`] event.
8023 ///
8024 /// When resuming, this function MUST be called before calling any other
8025 /// SDL_GPU functions.
8026 ///
8027 /// ## Parameters
8028 /// - `device`: a GPU context.
8029 ///
8030 /// ## Availability
8031 /// This function is available since SDL 3.2.0.
8032 ///
8033 /// ## See also
8034 /// - [`SDL_AddEventWatch`]
8035 pub fn SDL_GDKResumeGPU(device: *mut SDL_GPUDevice);
8036 }
8037
8038});
8039
8040/// An opaque handle representing a buffer.
8041///
8042/// Used for vertices, indices, indirect draw commands, and general compute
8043/// data.
8044///
8045/// ## Availability
8046/// This struct is available since SDL 3.2.0.
8047///
8048/// ## See also
8049/// - [`SDL_CreateGPUBuffer`]
8050/// - [`SDL_UploadToGPUBuffer`]
8051/// - [`SDL_DownloadFromGPUBuffer`]
8052/// - [`SDL_CopyGPUBufferToBuffer`]
8053/// - [`SDL_BindGPUVertexBuffers`]
8054/// - [`SDL_BindGPUIndexBuffer`]
8055/// - [`SDL_BindGPUVertexStorageBuffers`]
8056/// - [`SDL_BindGPUFragmentStorageBuffers`]
8057/// - [`SDL_DrawGPUPrimitivesIndirect`]
8058/// - [`SDL_DrawGPUIndexedPrimitivesIndirect`]
8059/// - [`SDL_BindGPUComputeStorageBuffers`]
8060/// - [`SDL_DispatchGPUComputeIndirect`]
8061/// - [`SDL_ReleaseGPUBuffer`]
8062#[repr(C)]
8063pub struct SDL_GPUBuffer {
8064 _opaque: [::core::primitive::u8; 0],
8065}
8066
8067/// An opaque handle representing a command buffer.
8068///
8069/// Most state is managed via command buffers. When setting state using a
8070/// command buffer, that state is local to the command buffer.
8071///
8072/// Commands only begin execution on the GPU once [`SDL_SubmitGPUCommandBuffer`] is
8073/// called. Once the command buffer is submitted, it is no longer valid to use
8074/// it.
8075///
8076/// Command buffers are executed in submission order. If you submit command
8077/// buffer A and then command buffer B all commands in A will begin executing
8078/// before any command in B begins executing.
8079///
8080/// In multi-threading scenarios, you should only access a command buffer on
8081/// the thread you acquired it from.
8082///
8083/// ## Availability
8084/// This struct is available since SDL 3.2.0.
8085///
8086/// ## See also
8087/// - [`SDL_AcquireGPUCommandBuffer`]
8088/// - [`SDL_SubmitGPUCommandBuffer`]
8089/// - [`SDL_SubmitGPUCommandBufferAndAcquireFence`]
8090#[repr(C)]
8091pub struct SDL_GPUCommandBuffer {
8092 _opaque: [::core::primitive::u8; 0],
8093}
8094
8095/// An opaque handle representing a compute pass.
8096///
8097/// This handle is transient and should not be held or referenced after
8098/// [`SDL_EndGPUComputePass`] is called.
8099///
8100/// ## Availability
8101/// This struct is available since SDL 3.2.0.
8102///
8103/// ## See also
8104/// - [`SDL_BeginGPUComputePass`]
8105/// - [`SDL_EndGPUComputePass`]
8106#[repr(C)]
8107pub struct SDL_GPUComputePass {
8108 _opaque: [::core::primitive::u8; 0],
8109}
8110
8111/// An opaque handle representing a compute pipeline.
8112///
8113/// Used during compute passes.
8114///
8115/// ## Availability
8116/// This struct is available since SDL 3.2.0.
8117///
8118/// ## See also
8119/// - [`SDL_CreateGPUComputePipeline`]
8120/// - [`SDL_BindGPUComputePipeline`]
8121/// - [`SDL_ReleaseGPUComputePipeline`]
8122#[repr(C)]
8123pub struct SDL_GPUComputePipeline {
8124 _opaque: [::core::primitive::u8; 0],
8125}
8126
8127/// An opaque handle representing a copy pass.
8128///
8129/// This handle is transient and should not be held or referenced after
8130/// [`SDL_EndGPUCopyPass`] is called.
8131///
8132/// ## Availability
8133/// This struct is available since SDL 3.2.0.
8134///
8135/// ## See also
8136/// - [`SDL_BeginGPUCopyPass`]
8137/// - [`SDL_EndGPUCopyPass`]
8138#[repr(C)]
8139pub struct SDL_GPUCopyPass {
8140 _opaque: [::core::primitive::u8; 0],
8141}
8142
8143/// An opaque handle representing the SDL_GPU context.
8144///
8145/// ## Availability
8146/// This struct is available since SDL 3.2.0.
8147#[repr(C)]
8148pub struct SDL_GPUDevice {
8149 _opaque: [::core::primitive::u8; 0],
8150}
8151
8152/// An opaque handle representing a fence.
8153///
8154/// ## Availability
8155/// This struct is available since SDL 3.2.0.
8156///
8157/// ## See also
8158/// - [`SDL_SubmitGPUCommandBufferAndAcquireFence`]
8159/// - [`SDL_QueryGPUFence`]
8160/// - [`SDL_WaitForGPUFences`]
8161/// - [`SDL_ReleaseGPUFence`]
8162#[repr(C)]
8163pub struct SDL_GPUFence {
8164 _opaque: [::core::primitive::u8; 0],
8165}
8166
8167/// An opaque handle representing a graphics pipeline.
8168///
8169/// Used during render passes.
8170///
8171/// ## Availability
8172/// This struct is available since SDL 3.2.0.
8173///
8174/// ## See also
8175/// - [`SDL_CreateGPUGraphicsPipeline`]
8176/// - [`SDL_BindGPUGraphicsPipeline`]
8177/// - [`SDL_ReleaseGPUGraphicsPipeline`]
8178#[repr(C)]
8179pub struct SDL_GPUGraphicsPipeline {
8180 _opaque: [::core::primitive::u8; 0],
8181}
8182
8183/// An opaque handle representing a render pass.
8184///
8185/// This handle is transient and should not be held or referenced after
8186/// [`SDL_EndGPURenderPass`] is called.
8187///
8188/// ## Availability
8189/// This struct is available since SDL 3.2.0.
8190///
8191/// ## See also
8192/// - [`SDL_BeginGPURenderPass`]
8193/// - [`SDL_EndGPURenderPass`]
8194#[repr(C)]
8195pub struct SDL_GPURenderPass {
8196 _opaque: [::core::primitive::u8; 0],
8197}
8198
8199/// An opaque handle representing a sampler.
8200///
8201/// ## Availability
8202/// This struct is available since SDL 3.2.0.
8203///
8204/// ## See also
8205/// - [`SDL_CreateGPUSampler`]
8206/// - [`SDL_BindGPUVertexSamplers`]
8207/// - [`SDL_BindGPUFragmentSamplers`]
8208/// - [`SDL_ReleaseGPUSampler`]
8209#[repr(C)]
8210pub struct SDL_GPUSampler {
8211 _opaque: [::core::primitive::u8; 0],
8212}
8213
8214/// An opaque handle representing a compiled shader object.
8215///
8216/// ## Availability
8217/// This struct is available since SDL 3.2.0.
8218///
8219/// ## See also
8220/// - [`SDL_CreateGPUShader`]
8221/// - [`SDL_CreateGPUGraphicsPipeline`]
8222/// - [`SDL_ReleaseGPUShader`]
8223#[repr(C)]
8224pub struct SDL_GPUShader {
8225 _opaque: [::core::primitive::u8; 0],
8226}
8227
8228/// An opaque handle representing a texture.
8229///
8230/// ## Availability
8231/// This struct is available since SDL 3.2.0.
8232///
8233/// ## See also
8234/// - [`SDL_CreateGPUTexture`]
8235/// - [`SDL_UploadToGPUTexture`]
8236/// - [`SDL_DownloadFromGPUTexture`]
8237/// - [`SDL_CopyGPUTextureToTexture`]
8238/// - [`SDL_BindGPUVertexSamplers`]
8239/// - [`SDL_BindGPUVertexStorageTextures`]
8240/// - [`SDL_BindGPUFragmentSamplers`]
8241/// - [`SDL_BindGPUFragmentStorageTextures`]
8242/// - [`SDL_BindGPUComputeStorageTextures`]
8243/// - [`SDL_GenerateMipmapsForGPUTexture`]
8244/// - [`SDL_BlitGPUTexture`]
8245/// - [`SDL_ReleaseGPUTexture`]
8246#[repr(C)]
8247pub struct SDL_GPUTexture {
8248 _opaque: [::core::primitive::u8; 0],
8249}
8250
8251/// An opaque handle representing a transfer buffer.
8252///
8253/// Used for transferring data to and from the device.
8254///
8255/// ## Availability
8256/// This struct is available since SDL 3.2.0.
8257///
8258/// ## See also
8259/// - [`SDL_CreateGPUTransferBuffer`]
8260/// - [`SDL_MapGPUTransferBuffer`]
8261/// - [`SDL_UnmapGPUTransferBuffer`]
8262/// - [`SDL_UploadToGPUBuffer`]
8263/// - [`SDL_UploadToGPUTexture`]
8264/// - [`SDL_DownloadFromGPUBuffer`]
8265/// - [`SDL_DownloadFromGPUTexture`]
8266/// - [`SDL_ReleaseGPUTransferBuffer`]
8267#[repr(C)]
8268pub struct SDL_GPUTransferBuffer {
8269 _opaque: [::core::primitive::u8; 0],
8270}
8271
8272#[cfg(doc)]
8273use crate::everything::*;