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