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