SDL 3.0
SDL_render.h
Go to the documentation of this file.
1/*
2 Simple DirectMedia Layer
3 Copyright (C) 1997-2025 Sam Lantinga <slouken@libsdl.org>
4
5 This software is provided 'as-is', without any express or implied
6 warranty. In no event will the authors be held liable for any damages
7 arising from the use of this software.
8
9 Permission is granted to anyone to use this software for any purpose,
10 including commercial applications, and to alter it and redistribute it
11 freely, subject to the following restrictions:
12
13 1. The origin of this software must not be misrepresented; you must not
14 claim that you wrote the original software. If you use this software
15 in a product, an acknowledgment in the product documentation would be
16 appreciated but is not required.
17 2. Altered source versions must be plainly marked as such, and must not be
18 misrepresented as being the original software.
19 3. This notice may not be removed or altered from any source distribution.
20*/
21
22/**
23 * # CategoryRender
24 *
25 * Header file for SDL 2D rendering functions.
26 *
27 * This API supports the following features:
28 *
29 * - single pixel points
30 * - single pixel lines
31 * - filled rectangles
32 * - texture images
33 * - 2D polygons
34 *
35 * The primitives may be drawn in opaque, blended, or additive modes.
36 *
37 * The texture images may be drawn in opaque, blended, or additive modes. They
38 * can have an additional color tint or alpha modulation applied to them, and
39 * may also be stretched with linear interpolation.
40 *
41 * This API is designed to accelerate simple 2D operations. You may want more
42 * functionality such as 3D polygons and particle effects, and in that case
43 * you should use SDL's OpenGL/Direct3D support, the SDL3 GPU API, or one of
44 * the many good 3D engines.
45 *
46 * These functions must be called from the main thread. See this bug for
47 * details: https://github.com/libsdl-org/SDL/issues/986
48 */
49
50#ifndef SDL_render_h_
51#define SDL_render_h_
52
53#include <SDL3/SDL_stdinc.h>
54#include <SDL3/SDL_blendmode.h>
55#include <SDL3/SDL_error.h>
56#include <SDL3/SDL_events.h>
57#include <SDL3/SDL_pixels.h>
58#include <SDL3/SDL_properties.h>
59#include <SDL3/SDL_rect.h>
60#include <SDL3/SDL_surface.h>
61#include <SDL3/SDL_video.h>
62#include <SDL3/SDL_gpu.h>
63
64#include <SDL3/SDL_begin_code.h>
65/* Set up for C function definitions, even when using C++ */
66#ifdef __cplusplus
67extern "C" {
68#endif
69
70/**
71 * The name of the software renderer.
72 *
73 * \since This macro is available since SDL 3.2.0.
74 */
75#define SDL_SOFTWARE_RENDERER "software"
76
77/**
78 * Vertex structure.
79 *
80 * \since This struct is available since SDL 3.2.0.
81 */
82typedef struct SDL_Vertex
83{
84 SDL_FPoint position; /**< Vertex position, in SDL_Renderer coordinates */
85 SDL_FColor color; /**< Vertex color */
86 SDL_FPoint tex_coord; /**< Normalized texture coordinates, if needed */
88
89/**
90 * The access pattern allowed for a texture.
91 *
92 * \since This enum is available since SDL 3.2.0.
93 */
95{
96 SDL_TEXTUREACCESS_STATIC, /**< Changes rarely, not lockable */
97 SDL_TEXTUREACCESS_STREAMING, /**< Changes frequently, lockable */
98 SDL_TEXTUREACCESS_TARGET /**< Texture can be used as a render target */
100
101/**
102 * The addressing mode for a texture when used in SDL_RenderGeometry().
103 *
104 * This affects how texture coordinates are interpreted outside of [0, 1]
105 *
106 * \since This enum is available since SDL 3.4.0.
107 */
109{
111 SDL_TEXTURE_ADDRESS_AUTO, /**< Wrapping is enabled if texture coordinates are outside [0, 1], this is the default */
112 SDL_TEXTURE_ADDRESS_CLAMP, /**< Texture coordinates are clamped to the [0, 1] range */
113 SDL_TEXTURE_ADDRESS_WRAP /**< The texture is repeated (tiled) */
115
116/**
117 * How the logical size is mapped to the output.
118 *
119 * \since This enum is available since SDL 3.2.0.
120 */
122{
123 SDL_LOGICAL_PRESENTATION_DISABLED, /**< There is no logical size in effect */
124 SDL_LOGICAL_PRESENTATION_STRETCH, /**< The rendered content is stretched to the output resolution */
125 SDL_LOGICAL_PRESENTATION_LETTERBOX, /**< The rendered content is fit to the largest dimension and the other dimension is letterboxed with the clear color */
126 SDL_LOGICAL_PRESENTATION_OVERSCAN, /**< The rendered content is fit to the smallest dimension and the other dimension extends beyond the output bounds */
127 SDL_LOGICAL_PRESENTATION_INTEGER_SCALE /**< The rendered content is scaled up by integer multiples to fit the output resolution */
129
130/**
131 * A structure representing rendering state
132 *
133 * \since This struct is available since SDL 3.2.0.
134 */
136
137#ifndef SDL_INTERNAL
138
139/**
140 * An efficient driver-specific representation of pixel data
141 *
142 * \since This struct is available since SDL 3.2.0.
143 *
144 * \sa SDL_CreateTexture
145 * \sa SDL_CreateTextureFromSurface
146 * \sa SDL_CreateTextureWithProperties
147 * \sa SDL_DestroyTexture
148 */
150{
151 SDL_PixelFormat format; /**< The format of the texture, read-only */
152 int w; /**< The width of the texture, read-only. */
153 int h; /**< The height of the texture, read-only. */
154
155 int refcount; /**< Application reference count, used when freeing texture */
156};
157#endif /* !SDL_INTERNAL */
158
159typedef struct SDL_Texture SDL_Texture;
160
161/* Function prototypes */
162
163/**
164 * Get the number of 2D rendering drivers available for the current display.
165 *
166 * A render driver is a set of code that handles rendering and texture
167 * management on a particular display. Normally there is only one, but some
168 * drivers may have several available with different capabilities.
169 *
170 * There may be none if SDL was compiled without render support.
171 *
172 * \returns the number of built in render drivers.
173 *
174 * \threadsafety It is safe to call this function from any thread.
175 *
176 * \since This function is available since SDL 3.2.0.
177 *
178 * \sa SDL_CreateRenderer
179 * \sa SDL_GetRenderDriver
180 */
181extern SDL_DECLSPEC int SDLCALL SDL_GetNumRenderDrivers(void);
182
183/**
184 * Use this function to get the name of a built in 2D rendering driver.
185 *
186 * The list of rendering drivers is given in the order that they are normally
187 * initialized by default; the drivers that seem more reasonable to choose
188 * first (as far as the SDL developers believe) are earlier in the list.
189 *
190 * The names of drivers are all simple, low-ASCII identifiers, like "opengl",
191 * "direct3d12" or "metal". These never have Unicode characters, and are not
192 * meant to be proper names.
193 *
194 * \param index the index of the rendering driver; the value ranges from 0 to
195 * SDL_GetNumRenderDrivers() - 1.
196 * \returns the name of the rendering driver at the requested index, or NULL
197 * if an invalid index was specified.
198 *
199 * \threadsafety It is safe to call this function from any thread.
200 *
201 * \since This function is available since SDL 3.2.0.
202 *
203 * \sa SDL_GetNumRenderDrivers
204 */
205extern SDL_DECLSPEC const char * SDLCALL SDL_GetRenderDriver(int index);
206
207/**
208 * Create a window and default renderer.
209 *
210 * \param title the title of the window, in UTF-8 encoding.
211 * \param width the width of the window.
212 * \param height the height of the window.
213 * \param window_flags the flags used to create the window (see
214 * SDL_CreateWindow()).
215 * \param window a pointer filled with the window, or NULL on error.
216 * \param renderer a pointer filled with the renderer, or NULL on error.
217 * \returns true on success or false on failure; call SDL_GetError() for more
218 * information.
219 *
220 * \threadsafety This function should only be called on the main thread.
221 *
222 * \since This function is available since SDL 3.2.0.
223 *
224 * \sa SDL_CreateRenderer
225 * \sa SDL_CreateWindow
226 */
227extern SDL_DECLSPEC bool SDLCALL SDL_CreateWindowAndRenderer(const char *title, int width, int height, SDL_WindowFlags window_flags, SDL_Window **window, SDL_Renderer **renderer);
228
229/**
230 * Create a 2D rendering context for a window.
231 *
232 * If you want a specific renderer, you can specify its name here. A list of
233 * available renderers can be obtained by calling SDL_GetRenderDriver()
234 * multiple times, with indices from 0 to SDL_GetNumRenderDrivers()-1. If you
235 * don't need a specific renderer, specify NULL and SDL will attempt to choose
236 * the best option for you, based on what is available on the user's system.
237 *
238 * If `name` is a comma-separated list, SDL will try each name, in the order
239 * listed, until one succeeds or all of them fail.
240 *
241 * By default the rendering size matches the window size in pixels, but you
242 * can call SDL_SetRenderLogicalPresentation() to change the content size and
243 * scaling options.
244 *
245 * \param window the window where rendering is displayed.
246 * \param name the name of the rendering driver to initialize, or NULL to let
247 * SDL choose one.
248 * \returns a valid rendering context or NULL if there was an error; call
249 * SDL_GetError() for more information.
250 *
251 * \threadsafety This function should only be called on the main thread.
252 *
253 * \since This function is available since SDL 3.2.0.
254 *
255 * \sa SDL_CreateRendererWithProperties
256 * \sa SDL_CreateSoftwareRenderer
257 * \sa SDL_DestroyRenderer
258 * \sa SDL_GetNumRenderDrivers
259 * \sa SDL_GetRenderDriver
260 * \sa SDL_GetRendererName
261 */
262extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window *window, const char *name);
263
264/**
265 * Create a 2D rendering context for a window, with the specified properties.
266 *
267 * These are the supported properties:
268 *
269 * - `SDL_PROP_RENDERER_CREATE_NAME_STRING`: the name of the rendering driver
270 * to use, if a specific one is desired
271 * - `SDL_PROP_RENDERER_CREATE_WINDOW_POINTER`: the window where rendering is
272 * displayed, required if this isn't a software renderer using a surface
273 * - `SDL_PROP_RENDERER_CREATE_SURFACE_POINTER`: the surface where rendering
274 * is displayed, if you want a software renderer without a window
275 * - `SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER`: an SDL_Colorspace
276 * value describing the colorspace for output to the display, defaults to
277 * SDL_COLORSPACE_SRGB. The direct3d11, direct3d12, and metal renderers
278 * support SDL_COLORSPACE_SRGB_LINEAR, which is a linear color space and
279 * supports HDR output. If you select SDL_COLORSPACE_SRGB_LINEAR, drawing
280 * still uses the sRGB colorspace, but values can go beyond 1.0 and float
281 * (linear) format textures can be used for HDR content.
282 * - `SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER`: non-zero if you want
283 * present synchronized with the refresh rate. This property can take any
284 * value that is supported by SDL_SetRenderVSync() for the renderer.
285 *
286 * With the SDL GPU renderer (since SDL 3.4.0):
287 *
288 * - `SDL_PROP_RENDERER_CREATE_GPU_SHADERS_SPIRV_BOOLEAN`: the app is able to
289 * provide SPIR-V shaders to SDL_GPURenderState, optional.
290 * - `SDL_PROP_RENDERER_CREATE_GPU_SHADERS_DXIL_BOOLEAN`: the app is able to
291 * provide DXIL shaders to SDL_GPURenderState, optional.
292 * - `SDL_PROP_RENDERER_CREATE_GPU_SHADERS_MSL_BOOLEAN`: the app is able to
293 * provide MSL shaders to SDL_GPURenderState, optional.
294 *
295 * With the vulkan renderer:
296 *
297 * - `SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER`: the VkInstance to use
298 * with the renderer, optional.
299 * - `SDL_PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER`: the VkSurfaceKHR to use
300 * with the renderer, optional.
301 * - `SDL_PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER`: the
302 * VkPhysicalDevice to use with the renderer, optional.
303 * - `SDL_PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER`: the VkDevice to use
304 * with the renderer, optional.
305 * - `SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER`: the
306 * queue family index used for rendering.
307 * - `SDL_PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER`: the
308 * queue family index used for presentation.
309 *
310 * \param props the properties to use.
311 * \returns a valid rendering context or NULL if there was an error; call
312 * SDL_GetError() for more information.
313 *
314 * \threadsafety This function should only be called on the main thread.
315 *
316 * \since This function is available since SDL 3.2.0.
317 *
318 * \sa SDL_CreateProperties
319 * \sa SDL_CreateRenderer
320 * \sa SDL_CreateSoftwareRenderer
321 * \sa SDL_DestroyRenderer
322 * \sa SDL_GetRendererName
323 */
325
326#define SDL_PROP_RENDERER_CREATE_NAME_STRING "SDL.renderer.create.name"
327#define SDL_PROP_RENDERER_CREATE_WINDOW_POINTER "SDL.renderer.create.window"
328#define SDL_PROP_RENDERER_CREATE_SURFACE_POINTER "SDL.renderer.create.surface"
329#define SDL_PROP_RENDERER_CREATE_OUTPUT_COLORSPACE_NUMBER "SDL.renderer.create.output_colorspace"
330#define SDL_PROP_RENDERER_CREATE_PRESENT_VSYNC_NUMBER "SDL.renderer.create.present_vsync"
331#define SDL_PROP_RENDERER_CREATE_GPU_SHADERS_SPIRV_BOOLEAN "SDL.renderer.create.gpu.shaders_spirv"
332#define SDL_PROP_RENDERER_CREATE_GPU_SHADERS_DXIL_BOOLEAN "SDL.renderer.create.gpu.shaders_dxil"
333#define SDL_PROP_RENDERER_CREATE_GPU_SHADERS_MSL_BOOLEAN "SDL.renderer.create.gpu.shaders_msl"
334#define SDL_PROP_RENDERER_CREATE_VULKAN_INSTANCE_POINTER "SDL.renderer.create.vulkan.instance"
335#define SDL_PROP_RENDERER_CREATE_VULKAN_SURFACE_NUMBER "SDL.renderer.create.vulkan.surface"
336#define SDL_PROP_RENDERER_CREATE_VULKAN_PHYSICAL_DEVICE_POINTER "SDL.renderer.create.vulkan.physical_device"
337#define SDL_PROP_RENDERER_CREATE_VULKAN_DEVICE_POINTER "SDL.renderer.create.vulkan.device"
338#define SDL_PROP_RENDERER_CREATE_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER "SDL.renderer.create.vulkan.graphics_queue_family_index"
339#define SDL_PROP_RENDERER_CREATE_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER "SDL.renderer.create.vulkan.present_queue_family_index"
340
341/**
342 * Create a 2D GPU rendering context for a window, with support for the
343 * specified shader format.
344 *
345 * This is a convenience function to create a SDL GPU backed renderer,
346 * intended to be used with SDL_GPURenderState. The resulting renderer will
347 * support shaders in one of the specified shader formats.
348 *
349 * If no available GPU driver supports any of the specified shader formats,
350 * this function will fail.
351 *
352 * \param window the window where rendering is displayed.
353 * \param format_flags a bitflag indicating which shader formats the app is
354 * able to provide.
355 * \param device a pointer filled with the associated GPU device, or NULL on
356 * error.
357 * \returns a valid rendering context or NULL if there was an error; call
358 * SDL_GetError() for more information.
359 *
360 * \threadsafety This function should only be called on the main thread.
361 *
362 * \since This function is available since SDL 3.4.0.
363 *
364 * \sa SDL_CreateRendererWithProperties
365 * \sa SDL_GetGPUShaderFormats
366 * \sa SDL_CreateGPUShader
367 * \sa SDL_CreateGPURenderState
368 * \sa SDL_SetRenderGPUState
369 */
370extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_CreateGPURenderer(SDL_Window *window, SDL_GPUShaderFormat format_flags, SDL_GPUDevice **device);
371
372/**
373 * Create a 2D software rendering context for a surface.
374 *
375 * Two other API which can be used to create SDL_Renderer:
376 * SDL_CreateRenderer() and SDL_CreateWindowAndRenderer(). These can _also_
377 * create a software renderer, but they are intended to be used with an
378 * SDL_Window as the final destination and not an SDL_Surface.
379 *
380 * \param surface the SDL_Surface structure representing the surface where
381 * rendering is done.
382 * \returns a valid rendering context or NULL if there was an error; call
383 * SDL_GetError() for more information.
384 *
385 * \threadsafety This function should only be called on the main thread.
386 *
387 * \since This function is available since SDL 3.2.0.
388 *
389 * \sa SDL_DestroyRenderer
390 */
391extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_CreateSoftwareRenderer(SDL_Surface *surface);
392
393/**
394 * Get the renderer associated with a window.
395 *
396 * \param window the window to query.
397 * \returns the rendering context on success or NULL on failure; call
398 * SDL_GetError() for more information.
399 *
400 * \threadsafety It is safe to call this function from any thread.
401 *
402 * \since This function is available since SDL 3.2.0.
403 */
404extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_GetRenderer(SDL_Window *window);
405
406/**
407 * Get the window associated with a renderer.
408 *
409 * \param renderer the renderer to query.
410 * \returns the window on success or NULL on failure; call SDL_GetError() for
411 * more information.
412 *
413 * \threadsafety It is safe to call this function from any thread.
414 *
415 * \since This function is available since SDL 3.2.0.
416 */
417extern SDL_DECLSPEC SDL_Window * SDLCALL SDL_GetRenderWindow(SDL_Renderer *renderer);
418
419/**
420 * Get the name of a renderer.
421 *
422 * \param renderer the rendering context.
423 * \returns the name of the selected renderer, or NULL on failure; call
424 * SDL_GetError() for more information.
425 *
426 * \threadsafety It is safe to call this function from any thread.
427 *
428 * \since This function is available since SDL 3.2.0.
429 *
430 * \sa SDL_CreateRenderer
431 * \sa SDL_CreateRendererWithProperties
432 */
433extern SDL_DECLSPEC const char * SDLCALL SDL_GetRendererName(SDL_Renderer *renderer);
434
435/**
436 * Get the properties associated with a renderer.
437 *
438 * The following read-only properties are provided by SDL:
439 *
440 * - `SDL_PROP_RENDERER_NAME_STRING`: the name of the rendering driver
441 * - `SDL_PROP_RENDERER_WINDOW_POINTER`: the window where rendering is
442 * displayed, if any
443 * - `SDL_PROP_RENDERER_SURFACE_POINTER`: the surface where rendering is
444 * displayed, if this is a software renderer without a window
445 * - `SDL_PROP_RENDERER_VSYNC_NUMBER`: the current vsync setting
446 * - `SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER`: the maximum texture width
447 * and height
448 * - `SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER`: a (const SDL_PixelFormat *)
449 * array of pixel formats, terminated with SDL_PIXELFORMAT_UNKNOWN,
450 * representing the available texture formats for this renderer.
451 * - `SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER`: an SDL_Colorspace value
452 * describing the colorspace for output to the display, defaults to
453 * SDL_COLORSPACE_SRGB.
454 * - `SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN`: true if the output colorspace is
455 * SDL_COLORSPACE_SRGB_LINEAR and the renderer is showing on a display with
456 * HDR enabled. This property can change dynamically when
457 * SDL_EVENT_WINDOW_HDR_STATE_CHANGED is sent.
458 * - `SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT`: the value of SDR white in the
459 * SDL_COLORSPACE_SRGB_LINEAR colorspace. When HDR is enabled, this value is
460 * automatically multiplied into the color scale. This property can change
461 * dynamically when SDL_EVENT_WINDOW_HDR_STATE_CHANGED is sent.
462 * - `SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT`: the additional high dynamic range
463 * that can be displayed, in terms of the SDR white point. When HDR is not
464 * enabled, this will be 1.0. This property can change dynamically when
465 * SDL_EVENT_WINDOW_HDR_STATE_CHANGED is sent.
466 *
467 * With the direct3d renderer:
468 *
469 * - `SDL_PROP_RENDERER_D3D9_DEVICE_POINTER`: the IDirect3DDevice9 associated
470 * with the renderer
471 *
472 * With the direct3d11 renderer:
473 *
474 * - `SDL_PROP_RENDERER_D3D11_DEVICE_POINTER`: the ID3D11Device associated
475 * with the renderer
476 * - `SDL_PROP_RENDERER_D3D11_SWAPCHAIN_POINTER`: the IDXGISwapChain1
477 * associated with the renderer. This may change when the window is resized.
478 *
479 * With the direct3d12 renderer:
480 *
481 * - `SDL_PROP_RENDERER_D3D12_DEVICE_POINTER`: the ID3D12Device associated
482 * with the renderer
483 * - `SDL_PROP_RENDERER_D3D12_SWAPCHAIN_POINTER`: the IDXGISwapChain4
484 * associated with the renderer.
485 * - `SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER`: the ID3D12CommandQueue
486 * associated with the renderer
487 *
488 * With the vulkan renderer:
489 *
490 * - `SDL_PROP_RENDERER_VULKAN_INSTANCE_POINTER`: the VkInstance associated
491 * with the renderer
492 * - `SDL_PROP_RENDERER_VULKAN_SURFACE_NUMBER`: the VkSurfaceKHR associated
493 * with the renderer
494 * - `SDL_PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER`: the VkPhysicalDevice
495 * associated with the renderer
496 * - `SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER`: the VkDevice associated with
497 * the renderer
498 * - `SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER`: the queue
499 * family index used for rendering
500 * - `SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER`: the queue
501 * family index used for presentation
502 * - `SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER`: the number of
503 * swapchain images, or potential frames in flight, used by the Vulkan
504 * renderer
505 *
506 * With the gpu renderer:
507 *
508 * - `SDL_PROP_RENDERER_GPU_DEVICE_POINTER`: the SDL_GPUDevice associated with
509 * the renderer
510 *
511 * \param renderer the rendering context.
512 * \returns a valid property ID on success or 0 on failure; call
513 * SDL_GetError() for more information.
514 *
515 * \threadsafety It is safe to call this function from any thread.
516 *
517 * \since This function is available since SDL 3.2.0.
518 */
520
521#define SDL_PROP_RENDERER_NAME_STRING "SDL.renderer.name"
522#define SDL_PROP_RENDERER_WINDOW_POINTER "SDL.renderer.window"
523#define SDL_PROP_RENDERER_SURFACE_POINTER "SDL.renderer.surface"
524#define SDL_PROP_RENDERER_VSYNC_NUMBER "SDL.renderer.vsync"
525#define SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER "SDL.renderer.max_texture_size"
526#define SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER "SDL.renderer.texture_formats"
527#define SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER "SDL.renderer.output_colorspace"
528#define SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN "SDL.renderer.HDR_enabled"
529#define SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT "SDL.renderer.SDR_white_point"
530#define SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT "SDL.renderer.HDR_headroom"
531#define SDL_PROP_RENDERER_D3D9_DEVICE_POINTER "SDL.renderer.d3d9.device"
532#define SDL_PROP_RENDERER_D3D11_DEVICE_POINTER "SDL.renderer.d3d11.device"
533#define SDL_PROP_RENDERER_D3D11_SWAPCHAIN_POINTER "SDL.renderer.d3d11.swap_chain"
534#define SDL_PROP_RENDERER_D3D12_DEVICE_POINTER "SDL.renderer.d3d12.device"
535#define SDL_PROP_RENDERER_D3D12_SWAPCHAIN_POINTER "SDL.renderer.d3d12.swap_chain"
536#define SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER "SDL.renderer.d3d12.command_queue"
537#define SDL_PROP_RENDERER_VULKAN_INSTANCE_POINTER "SDL.renderer.vulkan.instance"
538#define SDL_PROP_RENDERER_VULKAN_SURFACE_NUMBER "SDL.renderer.vulkan.surface"
539#define SDL_PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER "SDL.renderer.vulkan.physical_device"
540#define SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER "SDL.renderer.vulkan.device"
541#define SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER "SDL.renderer.vulkan.graphics_queue_family_index"
542#define SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER "SDL.renderer.vulkan.present_queue_family_index"
543#define SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER "SDL.renderer.vulkan.swapchain_image_count"
544#define SDL_PROP_RENDERER_GPU_DEVICE_POINTER "SDL.renderer.gpu.device"
545
546/**
547 * Get the output size in pixels of a rendering context.
548 *
549 * This returns the true output size in pixels, ignoring any render targets or
550 * logical size and presentation.
551 *
552 * For the output size of the current rendering target, with logical size
553 * adjustments, use SDL_GetCurrentRenderOutputSize() instead.
554 *
555 * \param renderer the rendering context.
556 * \param w a pointer filled in with the width in pixels.
557 * \param h a pointer filled in with the height in pixels.
558 * \returns true on success or false on failure; call SDL_GetError() for more
559 * information.
560 *
561 * \threadsafety This function should only be called on the main thread.
562 *
563 * \since This function is available since SDL 3.2.0.
564 *
565 * \sa SDL_GetCurrentRenderOutputSize
566 */
567extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderOutputSize(SDL_Renderer *renderer, int *w, int *h);
568
569/**
570 * Get the current output size in pixels of a rendering context.
571 *
572 * If a rendering target is active, this will return the size of the rendering
573 * target in pixels, otherwise return the value of SDL_GetRenderOutputSize().
574 *
575 * Rendering target or not, the output will be adjusted by the current logical
576 * presentation state, dictated by SDL_SetRenderLogicalPresentation().
577 *
578 * \param renderer the rendering context.
579 * \param w a pointer filled in with the current width.
580 * \param h a pointer filled in with the current height.
581 * \returns true on success or false on failure; call SDL_GetError() for more
582 * information.
583 *
584 * \threadsafety This function should only be called on the main thread.
585 *
586 * \since This function is available since SDL 3.2.0.
587 *
588 * \sa SDL_GetRenderOutputSize
589 */
590extern SDL_DECLSPEC bool SDLCALL SDL_GetCurrentRenderOutputSize(SDL_Renderer *renderer, int *w, int *h);
591
592/**
593 * Create a texture for a rendering context.
594 *
595 * The contents of a texture when first created are not defined.
596 *
597 * \param renderer the rendering context.
598 * \param format one of the enumerated values in SDL_PixelFormat.
599 * \param access one of the enumerated values in SDL_TextureAccess.
600 * \param w the width of the texture in pixels.
601 * \param h the height of the texture in pixels.
602 * \returns the created texture or NULL on failure; call SDL_GetError() for
603 * more information.
604 *
605 * \threadsafety This function should only be called on the main thread.
606 *
607 * \since This function is available since SDL 3.2.0.
608 *
609 * \sa SDL_CreateTextureFromSurface
610 * \sa SDL_CreateTextureWithProperties
611 * \sa SDL_DestroyTexture
612 * \sa SDL_GetTextureSize
613 * \sa SDL_UpdateTexture
614 */
616
617/**
618 * Create a texture from an existing surface.
619 *
620 * The surface is not modified or freed by this function.
621 *
622 * The SDL_TextureAccess hint for the created texture is
623 * `SDL_TEXTUREACCESS_STATIC`.
624 *
625 * The pixel format of the created texture may be different from the pixel
626 * format of the surface, and can be queried using the
627 * SDL_PROP_TEXTURE_FORMAT_NUMBER property.
628 *
629 * \param renderer the rendering context.
630 * \param surface the SDL_Surface structure containing pixel data used to fill
631 * the texture.
632 * \returns the created texture or NULL on failure; call SDL_GetError() for
633 * more information.
634 *
635 * \threadsafety This function should only be called on the main thread.
636 *
637 * \since This function is available since SDL 3.2.0.
638 *
639 * \sa SDL_CreateTexture
640 * \sa SDL_CreateTextureWithProperties
641 * \sa SDL_DestroyTexture
642 */
644
645/**
646 * Create a texture for a rendering context with the specified properties.
647 *
648 * These are the supported properties:
649 *
650 * - `SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER`: an SDL_Colorspace value
651 * describing the texture colorspace, defaults to SDL_COLORSPACE_SRGB_LINEAR
652 * for floating point textures, SDL_COLORSPACE_HDR10 for 10-bit textures,
653 * SDL_COLORSPACE_SRGB for other RGB textures and SDL_COLORSPACE_JPEG for
654 * YUV textures.
655 * - `SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER`: one of the enumerated values in
656 * SDL_PixelFormat, defaults to the best RGBA format for the renderer
657 * - `SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER`: one of the enumerated values in
658 * SDL_TextureAccess, defaults to SDL_TEXTUREACCESS_STATIC
659 * - `SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER`: the width of the texture in
660 * pixels, required
661 * - `SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER`: the height of the texture in
662 * pixels, required
663 * - `SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT`: for HDR10 and floating
664 * point textures, this defines the value of 100% diffuse white, with higher
665 * values being displayed in the High Dynamic Range headroom. This defaults
666 * to 100 for HDR10 textures and 1.0 for floating point textures.
667 * - `SDL_PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT`: for HDR10 and floating
668 * point textures, this defines the maximum dynamic range used by the
669 * content, in terms of the SDR white point. This would be equivalent to
670 * maxCLL / SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT for HDR10 content.
671 * If this is defined, any values outside the range supported by the display
672 * will be scaled into the available HDR headroom, otherwise they are
673 * clipped.
674 *
675 * With the direct3d11 renderer:
676 *
677 * - `SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER`: the ID3D11Texture2D
678 * associated with the texture, if you want to wrap an existing texture.
679 * - `SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER`: the ID3D11Texture2D
680 * associated with the U plane of a YUV texture, if you want to wrap an
681 * existing texture.
682 * - `SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER`: the ID3D11Texture2D
683 * associated with the V plane of a YUV texture, if you want to wrap an
684 * existing texture.
685 *
686 * With the direct3d12 renderer:
687 *
688 * - `SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER`: the ID3D12Resource
689 * associated with the texture, if you want to wrap an existing texture.
690 * - `SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER`: the ID3D12Resource
691 * associated with the U plane of a YUV texture, if you want to wrap an
692 * existing texture.
693 * - `SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER`: the ID3D12Resource
694 * associated with the V plane of a YUV texture, if you want to wrap an
695 * existing texture.
696 *
697 * With the metal renderer:
698 *
699 * - `SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER`: the CVPixelBufferRef
700 * associated with the texture, if you want to create a texture from an
701 * existing pixel buffer.
702 *
703 * With the opengl renderer:
704 *
705 * - `SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER`: the GLuint texture
706 * associated with the texture, if you want to wrap an existing texture.
707 * - `SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER`: the GLuint texture
708 * associated with the UV plane of an NV12 texture, if you want to wrap an
709 * existing texture.
710 * - `SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER`: the GLuint texture
711 * associated with the U plane of a YUV texture, if you want to wrap an
712 * existing texture.
713 * - `SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER`: the GLuint texture
714 * associated with the V plane of a YUV texture, if you want to wrap an
715 * existing texture.
716 *
717 * With the opengles2 renderer:
718 *
719 * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER`: the GLuint texture
720 * associated with the texture, if you want to wrap an existing texture.
721 * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER`: the GLuint texture
722 * associated with the texture, if you want to wrap an existing texture.
723 * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER`: the GLuint texture
724 * associated with the UV plane of an NV12 texture, if you want to wrap an
725 * existing texture.
726 * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER`: the GLuint texture
727 * associated with the U plane of a YUV texture, if you want to wrap an
728 * existing texture.
729 * - `SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER`: the GLuint texture
730 * associated with the V plane of a YUV texture, if you want to wrap an
731 * existing texture.
732 *
733 * With the vulkan renderer:
734 *
735 * - `SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER`: the VkImage with layout
736 * VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL associated with the texture, if
737 * you want to wrap an existing texture.
738 *
739 * \param renderer the rendering context.
740 * \param props the properties to use.
741 * \returns the created texture or NULL on failure; call SDL_GetError() for
742 * more information.
743 *
744 * \threadsafety This function should only be called on the main thread.
745 *
746 * \since This function is available since SDL 3.2.0.
747 *
748 * \sa SDL_CreateProperties
749 * \sa SDL_CreateTexture
750 * \sa SDL_CreateTextureFromSurface
751 * \sa SDL_DestroyTexture
752 * \sa SDL_GetTextureSize
753 * \sa SDL_UpdateTexture
754 */
756
757#define SDL_PROP_TEXTURE_CREATE_COLORSPACE_NUMBER "SDL.texture.create.colorspace"
758#define SDL_PROP_TEXTURE_CREATE_FORMAT_NUMBER "SDL.texture.create.format"
759#define SDL_PROP_TEXTURE_CREATE_ACCESS_NUMBER "SDL.texture.create.access"
760#define SDL_PROP_TEXTURE_CREATE_WIDTH_NUMBER "SDL.texture.create.width"
761#define SDL_PROP_TEXTURE_CREATE_HEIGHT_NUMBER "SDL.texture.create.height"
762#define SDL_PROP_TEXTURE_CREATE_SDR_WHITE_POINT_FLOAT "SDL.texture.create.SDR_white_point"
763#define SDL_PROP_TEXTURE_CREATE_HDR_HEADROOM_FLOAT "SDL.texture.create.HDR_headroom"
764#define SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_POINTER "SDL.texture.create.d3d11.texture"
765#define SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_U_POINTER "SDL.texture.create.d3d11.texture_u"
766#define SDL_PROP_TEXTURE_CREATE_D3D11_TEXTURE_V_POINTER "SDL.texture.create.d3d11.texture_v"
767#define SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_POINTER "SDL.texture.create.d3d12.texture"
768#define SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_U_POINTER "SDL.texture.create.d3d12.texture_u"
769#define SDL_PROP_TEXTURE_CREATE_D3D12_TEXTURE_V_POINTER "SDL.texture.create.d3d12.texture_v"
770#define SDL_PROP_TEXTURE_CREATE_METAL_PIXELBUFFER_POINTER "SDL.texture.create.metal.pixelbuffer"
771#define SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_NUMBER "SDL.texture.create.opengl.texture"
772#define SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_UV_NUMBER "SDL.texture.create.opengl.texture_uv"
773#define SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_U_NUMBER "SDL.texture.create.opengl.texture_u"
774#define SDL_PROP_TEXTURE_CREATE_OPENGL_TEXTURE_V_NUMBER "SDL.texture.create.opengl.texture_v"
775#define SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_NUMBER "SDL.texture.create.opengles2.texture"
776#define SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_UV_NUMBER "SDL.texture.create.opengles2.texture_uv"
777#define SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_U_NUMBER "SDL.texture.create.opengles2.texture_u"
778#define SDL_PROP_TEXTURE_CREATE_OPENGLES2_TEXTURE_V_NUMBER "SDL.texture.create.opengles2.texture_v"
779#define SDL_PROP_TEXTURE_CREATE_VULKAN_TEXTURE_NUMBER "SDL.texture.create.vulkan.texture"
780
781/**
782 * Get the properties associated with a texture.
783 *
784 * The following read-only properties are provided by SDL:
785 *
786 * - `SDL_PROP_TEXTURE_COLORSPACE_NUMBER`: an SDL_Colorspace value describing
787 * the texture colorspace.
788 * - `SDL_PROP_TEXTURE_FORMAT_NUMBER`: one of the enumerated values in
789 * SDL_PixelFormat.
790 * - `SDL_PROP_TEXTURE_ACCESS_NUMBER`: one of the enumerated values in
791 * SDL_TextureAccess.
792 * - `SDL_PROP_TEXTURE_WIDTH_NUMBER`: the width of the texture in pixels.
793 * - `SDL_PROP_TEXTURE_HEIGHT_NUMBER`: the height of the texture in pixels.
794 * - `SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT`: for HDR10 and floating point
795 * textures, this defines the value of 100% diffuse white, with higher
796 * values being displayed in the High Dynamic Range headroom. This defaults
797 * to 100 for HDR10 textures and 1.0 for other textures.
798 * - `SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT`: for HDR10 and floating point
799 * textures, this defines the maximum dynamic range used by the content, in
800 * terms of the SDR white point. If this is defined, any values outside the
801 * range supported by the display will be scaled into the available HDR
802 * headroom, otherwise they are clipped. This defaults to 1.0 for SDR
803 * textures, 4.0 for HDR10 textures, and no default for floating point
804 * textures.
805 *
806 * With the direct3d11 renderer:
807 *
808 * - `SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER`: the ID3D11Texture2D associated
809 * with the texture
810 * - `SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER`: the ID3D11Texture2D
811 * associated with the U plane of a YUV texture
812 * - `SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER`: the ID3D11Texture2D
813 * associated with the V plane of a YUV texture
814 *
815 * With the direct3d12 renderer:
816 *
817 * - `SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER`: the ID3D12Resource associated
818 * with the texture
819 * - `SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER`: the ID3D12Resource associated
820 * with the U plane of a YUV texture
821 * - `SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER`: the ID3D12Resource associated
822 * with the V plane of a YUV texture
823 *
824 * With the vulkan renderer:
825 *
826 * - `SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER`: the VkImage associated with the
827 * texture
828 *
829 * With the opengl renderer:
830 *
831 * - `SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER`: the GLuint texture associated
832 * with the texture
833 * - `SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER`: the GLuint texture
834 * associated with the UV plane of an NV12 texture
835 * - `SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER`: the GLuint texture associated
836 * with the U plane of a YUV texture
837 * - `SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER`: the GLuint texture associated
838 * with the V plane of a YUV texture
839 * - `SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER`: the GLenum for the
840 * texture target (`GL_TEXTURE_2D`, `GL_TEXTURE_RECTANGLE_ARB`, etc)
841 * - `SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT`: the texture coordinate width of
842 * the texture (0.0 - 1.0)
843 * - `SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT`: the texture coordinate height of
844 * the texture (0.0 - 1.0)
845 *
846 * With the opengles2 renderer:
847 *
848 * - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER`: the GLuint texture
849 * associated with the texture
850 * - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER`: the GLuint texture
851 * associated with the UV plane of an NV12 texture
852 * - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER`: the GLuint texture
853 * associated with the U plane of a YUV texture
854 * - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER`: the GLuint texture
855 * associated with the V plane of a YUV texture
856 * - `SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER`: the GLenum for the
857 * texture target (`GL_TEXTURE_2D`, `GL_TEXTURE_EXTERNAL_OES`, etc)
858 *
859 * With the gpu renderer:
860 *
861 * - `SDL_PROP_TEXTURE_GPU_TEXTURE_POINTER`: the SDL_GPUTexture associated
862 * with the texture
863 *
864 * \param texture the texture to query.
865 * \returns a valid property ID on success or 0 on failure; call
866 * SDL_GetError() for more information.
867 *
868 * \threadsafety It is safe to call this function from any thread.
869 *
870 * \since This function is available since SDL 3.2.0.
871 */
872extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetTextureProperties(SDL_Texture *texture);
873
874#define SDL_PROP_TEXTURE_COLORSPACE_NUMBER "SDL.texture.colorspace"
875#define SDL_PROP_TEXTURE_FORMAT_NUMBER "SDL.texture.format"
876#define SDL_PROP_TEXTURE_ACCESS_NUMBER "SDL.texture.access"
877#define SDL_PROP_TEXTURE_WIDTH_NUMBER "SDL.texture.width"
878#define SDL_PROP_TEXTURE_HEIGHT_NUMBER "SDL.texture.height"
879#define SDL_PROP_TEXTURE_SDR_WHITE_POINT_FLOAT "SDL.texture.SDR_white_point"
880#define SDL_PROP_TEXTURE_HDR_HEADROOM_FLOAT "SDL.texture.HDR_headroom"
881#define SDL_PROP_TEXTURE_D3D11_TEXTURE_POINTER "SDL.texture.d3d11.texture"
882#define SDL_PROP_TEXTURE_D3D11_TEXTURE_U_POINTER "SDL.texture.d3d11.texture_u"
883#define SDL_PROP_TEXTURE_D3D11_TEXTURE_V_POINTER "SDL.texture.d3d11.texture_v"
884#define SDL_PROP_TEXTURE_D3D12_TEXTURE_POINTER "SDL.texture.d3d12.texture"
885#define SDL_PROP_TEXTURE_D3D12_TEXTURE_U_POINTER "SDL.texture.d3d12.texture_u"
886#define SDL_PROP_TEXTURE_D3D12_TEXTURE_V_POINTER "SDL.texture.d3d12.texture_v"
887#define SDL_PROP_TEXTURE_OPENGL_TEXTURE_NUMBER "SDL.texture.opengl.texture"
888#define SDL_PROP_TEXTURE_OPENGL_TEXTURE_UV_NUMBER "SDL.texture.opengl.texture_uv"
889#define SDL_PROP_TEXTURE_OPENGL_TEXTURE_U_NUMBER "SDL.texture.opengl.texture_u"
890#define SDL_PROP_TEXTURE_OPENGL_TEXTURE_V_NUMBER "SDL.texture.opengl.texture_v"
891#define SDL_PROP_TEXTURE_OPENGL_TEXTURE_TARGET_NUMBER "SDL.texture.opengl.target"
892#define SDL_PROP_TEXTURE_OPENGL_TEX_W_FLOAT "SDL.texture.opengl.tex_w"
893#define SDL_PROP_TEXTURE_OPENGL_TEX_H_FLOAT "SDL.texture.opengl.tex_h"
894#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_NUMBER "SDL.texture.opengles2.texture"
895#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_UV_NUMBER "SDL.texture.opengles2.texture_uv"
896#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_U_NUMBER "SDL.texture.opengles2.texture_u"
897#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_V_NUMBER "SDL.texture.opengles2.texture_v"
898#define SDL_PROP_TEXTURE_OPENGLES2_TEXTURE_TARGET_NUMBER "SDL.texture.opengles2.target"
899#define SDL_PROP_TEXTURE_VULKAN_TEXTURE_NUMBER "SDL.texture.vulkan.texture"
900#define SDL_PROP_TEXTURE_GPU_TEXTURE_POINTER "SDL.texture.gpu.texture"
901
902/**
903 * Get the renderer that created an SDL_Texture.
904 *
905 * \param texture the texture to query.
906 * \returns a pointer to the SDL_Renderer that created the texture, or NULL on
907 * failure; call SDL_GetError() for more information.
908 *
909 * \threadsafety It is safe to call this function from any thread.
910 *
911 * \since This function is available since SDL 3.2.0.
912 */
913extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_GetRendererFromTexture(SDL_Texture *texture);
914
915/**
916 * Get the size of a texture, as floating point values.
917 *
918 * \param texture the texture to query.
919 * \param w a pointer filled in with the width of the texture in pixels. This
920 * argument can be NULL if you don't need this information.
921 * \param h a pointer filled in with the height of the texture in pixels. This
922 * argument can be NULL if you don't need this information.
923 * \returns true on success or false on failure; call SDL_GetError() for more
924 * information.
925 *
926 * \threadsafety This function should only be called on the main thread.
927 *
928 * \since This function is available since SDL 3.2.0.
929 */
930extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureSize(SDL_Texture *texture, float *w, float *h);
931
932/**
933 * Set an additional color value multiplied into render copy operations.
934 *
935 * When this texture is rendered, during the copy operation each source color
936 * channel is modulated by the appropriate color value according to the
937 * following formula:
938 *
939 * `srcC = srcC * (color / 255)`
940 *
941 * Color modulation is not always supported by the renderer; it will return
942 * false if color modulation is not supported.
943 *
944 * \param texture the texture to update.
945 * \param r the red color value multiplied into copy operations.
946 * \param g the green color value multiplied into copy operations.
947 * \param b the blue color value multiplied into copy operations.
948 * \returns true on success or false on failure; call SDL_GetError() for more
949 * information.
950 *
951 * \threadsafety This function should only be called on the main thread.
952 *
953 * \since This function is available since SDL 3.2.0.
954 *
955 * \sa SDL_GetTextureColorMod
956 * \sa SDL_SetTextureAlphaMod
957 * \sa SDL_SetTextureColorModFloat
958 */
959extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureColorMod(SDL_Texture *texture, Uint8 r, Uint8 g, Uint8 b);
960
961
962/**
963 * Set an additional color value multiplied into render copy operations.
964 *
965 * When this texture is rendered, during the copy operation each source color
966 * channel is modulated by the appropriate color value according to the
967 * following formula:
968 *
969 * `srcC = srcC * color`
970 *
971 * Color modulation is not always supported by the renderer; it will return
972 * false if color modulation is not supported.
973 *
974 * \param texture the texture to update.
975 * \param r the red color value multiplied into copy operations.
976 * \param g the green color value multiplied into copy operations.
977 * \param b the blue color value multiplied into copy operations.
978 * \returns true on success or false on failure; call SDL_GetError() for more
979 * information.
980 *
981 * \threadsafety This function should only be called on the main thread.
982 *
983 * \since This function is available since SDL 3.2.0.
984 *
985 * \sa SDL_GetTextureColorModFloat
986 * \sa SDL_SetTextureAlphaModFloat
987 * \sa SDL_SetTextureColorMod
988 */
989extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureColorModFloat(SDL_Texture *texture, float r, float g, float b);
990
991
992/**
993 * Get the additional color value multiplied into render copy operations.
994 *
995 * \param texture the texture to query.
996 * \param r a pointer filled in with the current red color value.
997 * \param g a pointer filled in with the current green color value.
998 * \param b a pointer filled in with the current blue color value.
999 * \returns true on success or false on failure; call SDL_GetError() for more
1000 * information.
1001 *
1002 * \threadsafety This function should only be called on the main thread.
1003 *
1004 * \since This function is available since SDL 3.2.0.
1005 *
1006 * \sa SDL_GetTextureAlphaMod
1007 * \sa SDL_GetTextureColorModFloat
1008 * \sa SDL_SetTextureColorMod
1009 */
1010extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureColorMod(SDL_Texture *texture, Uint8 *r, Uint8 *g, Uint8 *b);
1011
1012/**
1013 * Get the additional color value multiplied into render copy operations.
1014 *
1015 * \param texture the texture to query.
1016 * \param r a pointer filled in with the current red color value.
1017 * \param g a pointer filled in with the current green color value.
1018 * \param b a pointer filled in with the current blue color value.
1019 * \returns true on success or false on failure; call SDL_GetError() for more
1020 * information.
1021 *
1022 * \threadsafety This function should only be called on the main thread.
1023 *
1024 * \since This function is available since SDL 3.2.0.
1025 *
1026 * \sa SDL_GetTextureAlphaModFloat
1027 * \sa SDL_GetTextureColorMod
1028 * \sa SDL_SetTextureColorModFloat
1029 */
1030extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureColorModFloat(SDL_Texture *texture, float *r, float *g, float *b);
1031
1032/**
1033 * Set an additional alpha value multiplied into render copy operations.
1034 *
1035 * When this texture is rendered, during the copy operation the source alpha
1036 * value is modulated by this alpha value according to the following formula:
1037 *
1038 * `srcA = srcA * (alpha / 255)`
1039 *
1040 * Alpha modulation is not always supported by the renderer; it will return
1041 * false if alpha modulation is not supported.
1042 *
1043 * \param texture the texture to update.
1044 * \param alpha the source alpha value multiplied into copy operations.
1045 * \returns true on success or false on failure; call SDL_GetError() for more
1046 * information.
1047 *
1048 * \threadsafety This function should only be called on the main thread.
1049 *
1050 * \since This function is available since SDL 3.2.0.
1051 *
1052 * \sa SDL_GetTextureAlphaMod
1053 * \sa SDL_SetTextureAlphaModFloat
1054 * \sa SDL_SetTextureColorMod
1055 */
1056extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureAlphaMod(SDL_Texture *texture, Uint8 alpha);
1057
1058/**
1059 * Set an additional alpha value multiplied into render copy operations.
1060 *
1061 * When this texture is rendered, during the copy operation the source alpha
1062 * value is modulated by this alpha value according to the following formula:
1063 *
1064 * `srcA = srcA * alpha`
1065 *
1066 * Alpha modulation is not always supported by the renderer; it will return
1067 * false if alpha modulation is not supported.
1068 *
1069 * \param texture the texture to update.
1070 * \param alpha the source alpha value multiplied into copy operations.
1071 * \returns true on success or false on failure; call SDL_GetError() for more
1072 * information.
1073 *
1074 * \threadsafety This function should only be called on the main thread.
1075 *
1076 * \since This function is available since SDL 3.2.0.
1077 *
1078 * \sa SDL_GetTextureAlphaModFloat
1079 * \sa SDL_SetTextureAlphaMod
1080 * \sa SDL_SetTextureColorModFloat
1081 */
1082extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureAlphaModFloat(SDL_Texture *texture, float alpha);
1083
1084/**
1085 * Get the additional alpha value multiplied into render copy operations.
1086 *
1087 * \param texture the texture to query.
1088 * \param alpha a pointer filled in with the current alpha value.
1089 * \returns true on success or false on failure; call SDL_GetError() for more
1090 * information.
1091 *
1092 * \threadsafety This function should only be called on the main thread.
1093 *
1094 * \since This function is available since SDL 3.2.0.
1095 *
1096 * \sa SDL_GetTextureAlphaModFloat
1097 * \sa SDL_GetTextureColorMod
1098 * \sa SDL_SetTextureAlphaMod
1099 */
1100extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureAlphaMod(SDL_Texture *texture, Uint8 *alpha);
1101
1102/**
1103 * Get the additional alpha value multiplied into render copy operations.
1104 *
1105 * \param texture the texture to query.
1106 * \param alpha a pointer filled in with the current alpha value.
1107 * \returns true on success or false on failure; call SDL_GetError() for more
1108 * information.
1109 *
1110 * \threadsafety This function should only be called on the main thread.
1111 *
1112 * \since This function is available since SDL 3.2.0.
1113 *
1114 * \sa SDL_GetTextureAlphaMod
1115 * \sa SDL_GetTextureColorModFloat
1116 * \sa SDL_SetTextureAlphaModFloat
1117 */
1118extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureAlphaModFloat(SDL_Texture *texture, float *alpha);
1119
1120/**
1121 * Set the blend mode for a texture, used by SDL_RenderTexture().
1122 *
1123 * If the blend mode is not supported, the closest supported mode is chosen
1124 * and this function returns false.
1125 *
1126 * \param texture the texture to update.
1127 * \param blendMode the SDL_BlendMode to use for texture blending.
1128 * \returns true on success or false on failure; call SDL_GetError() for more
1129 * information.
1130 *
1131 * \threadsafety This function should only be called on the main thread.
1132 *
1133 * \since This function is available since SDL 3.2.0.
1134 *
1135 * \sa SDL_GetTextureBlendMode
1136 */
1137extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode blendMode);
1138
1139/**
1140 * Get the blend mode used for texture copy operations.
1141 *
1142 * \param texture the texture to query.
1143 * \param blendMode a pointer filled in with the current SDL_BlendMode.
1144 * \returns true on success or false on failure; call SDL_GetError() for more
1145 * information.
1146 *
1147 * \threadsafety This function should only be called on the main thread.
1148 *
1149 * \since This function is available since SDL 3.2.0.
1150 *
1151 * \sa SDL_SetTextureBlendMode
1152 */
1153extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode *blendMode);
1154
1155/**
1156 * Set the scale mode used for texture scale operations.
1157 *
1158 * The default texture scale mode is SDL_SCALEMODE_LINEAR.
1159 *
1160 * If the scale mode is not supported, the closest supported mode is chosen.
1161 *
1162 * \param texture the texture to update.
1163 * \param scaleMode the SDL_ScaleMode to use for texture scaling.
1164 * \returns true on success or false on failure; call SDL_GetError() for more
1165 * information.
1166 *
1167 * \threadsafety This function should only be called on the main thread.
1168 *
1169 * \since This function is available since SDL 3.2.0.
1170 *
1171 * \sa SDL_GetTextureScaleMode
1172 */
1173extern SDL_DECLSPEC bool SDLCALL SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode scaleMode);
1174
1175/**
1176 * Get the scale mode used for texture scale operations.
1177 *
1178 * \param texture the texture to query.
1179 * \param scaleMode a pointer filled in with the current scale mode.
1180 * \returns true on success or false on failure; call SDL_GetError() for more
1181 * information.
1182 *
1183 * \threadsafety This function should only be called on the main thread.
1184 *
1185 * \since This function is available since SDL 3.2.0.
1186 *
1187 * \sa SDL_SetTextureScaleMode
1188 */
1189extern SDL_DECLSPEC bool SDLCALL SDL_GetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode *scaleMode);
1190
1191/**
1192 * Update the given texture rectangle with new pixel data.
1193 *
1194 * The pixel data must be in the pixel format of the texture, which can be
1195 * queried using the SDL_PROP_TEXTURE_FORMAT_NUMBER property.
1196 *
1197 * This is a fairly slow function, intended for use with static textures that
1198 * do not change often.
1199 *
1200 * If the texture is intended to be updated often, it is preferred to create
1201 * the texture as streaming and use the locking functions referenced below.
1202 * While this function will work with streaming textures, for optimization
1203 * reasons you may not get the pixels back if you lock the texture afterward.
1204 *
1205 * \param texture the texture to update.
1206 * \param rect an SDL_Rect structure representing the area to update, or NULL
1207 * to update the entire texture.
1208 * \param pixels the raw pixel data in the format of the texture.
1209 * \param pitch the number of bytes in a row of pixel data, including padding
1210 * between lines.
1211 * \returns true on success or false on failure; call SDL_GetError() for more
1212 * information.
1213 *
1214 * \threadsafety This function should only be called on the main thread.
1215 *
1216 * \since This function is available since SDL 3.2.0.
1217 *
1218 * \sa SDL_LockTexture
1219 * \sa SDL_UnlockTexture
1220 * \sa SDL_UpdateNVTexture
1221 * \sa SDL_UpdateYUVTexture
1222 */
1223extern SDL_DECLSPEC bool SDLCALL SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch);
1224
1225/**
1226 * Update a rectangle within a planar YV12 or IYUV texture with new pixel
1227 * data.
1228 *
1229 * You can use SDL_UpdateTexture() as long as your pixel data is a contiguous
1230 * block of Y and U/V planes in the proper order, but this function is
1231 * available if your pixel data is not contiguous.
1232 *
1233 * \param texture the texture to update.
1234 * \param rect a pointer to the rectangle of pixels to update, or NULL to
1235 * update the entire texture.
1236 * \param Yplane the raw pixel data for the Y plane.
1237 * \param Ypitch the number of bytes between rows of pixel data for the Y
1238 * plane.
1239 * \param Uplane the raw pixel data for the U plane.
1240 * \param Upitch the number of bytes between rows of pixel data for the U
1241 * plane.
1242 * \param Vplane the raw pixel data for the V plane.
1243 * \param Vpitch the number of bytes between rows of pixel data for the V
1244 * plane.
1245 * \returns true on success or false on failure; call SDL_GetError() for more
1246 * information.
1247 *
1248 * \threadsafety This function should only be called on the main thread.
1249 *
1250 * \since This function is available since SDL 3.2.0.
1251 *
1252 * \sa SDL_UpdateNVTexture
1253 * \sa SDL_UpdateTexture
1254 */
1255extern SDL_DECLSPEC bool SDLCALL SDL_UpdateYUVTexture(SDL_Texture *texture,
1256 const SDL_Rect *rect,
1257 const Uint8 *Yplane, int Ypitch,
1258 const Uint8 *Uplane, int Upitch,
1259 const Uint8 *Vplane, int Vpitch);
1260
1261/**
1262 * Update a rectangle within a planar NV12 or NV21 texture with new pixels.
1263 *
1264 * You can use SDL_UpdateTexture() as long as your pixel data is a contiguous
1265 * block of NV12/21 planes in the proper order, but this function is available
1266 * if your pixel data is not contiguous.
1267 *
1268 * \param texture the texture to update.
1269 * \param rect a pointer to the rectangle of pixels to update, or NULL to
1270 * update the entire texture.
1271 * \param Yplane the raw pixel data for the Y plane.
1272 * \param Ypitch the number of bytes between rows of pixel data for the Y
1273 * plane.
1274 * \param UVplane the raw pixel data for the UV plane.
1275 * \param UVpitch the number of bytes between rows of pixel data for the UV
1276 * plane.
1277 * \returns true on success or false on failure; call SDL_GetError() for more
1278 * information.
1279 *
1280 * \threadsafety This function should only be called on the main thread.
1281 *
1282 * \since This function is available since SDL 3.2.0.
1283 *
1284 * \sa SDL_UpdateTexture
1285 * \sa SDL_UpdateYUVTexture
1286 */
1287extern SDL_DECLSPEC bool SDLCALL SDL_UpdateNVTexture(SDL_Texture *texture,
1288 const SDL_Rect *rect,
1289 const Uint8 *Yplane, int Ypitch,
1290 const Uint8 *UVplane, int UVpitch);
1291
1292/**
1293 * Lock a portion of the texture for **write-only** pixel access.
1294 *
1295 * As an optimization, the pixels made available for editing don't necessarily
1296 * contain the old texture data. This is a write-only operation, and if you
1297 * need to keep a copy of the texture data you should do that at the
1298 * application level.
1299 *
1300 * You must use SDL_UnlockTexture() to unlock the pixels and apply any
1301 * changes.
1302 *
1303 * \param texture the texture to lock for access, which was created with
1304 * `SDL_TEXTUREACCESS_STREAMING`.
1305 * \param rect an SDL_Rect structure representing the area to lock for access;
1306 * NULL to lock the entire texture.
1307 * \param pixels this is filled in with a pointer to the locked pixels,
1308 * appropriately offset by the locked area.
1309 * \param pitch this is filled in with the pitch of the locked pixels; the
1310 * pitch is the length of one row in bytes.
1311 * \returns true on success or false if the texture is not valid or was not
1312 * created with `SDL_TEXTUREACCESS_STREAMING`; call SDL_GetError()
1313 * for more information.
1314 *
1315 * \threadsafety This function should only be called on the main thread.
1316 *
1317 * \since This function is available since SDL 3.2.0.
1318 *
1319 * \sa SDL_LockTextureToSurface
1320 * \sa SDL_UnlockTexture
1321 */
1322extern SDL_DECLSPEC bool SDLCALL SDL_LockTexture(SDL_Texture *texture,
1323 const SDL_Rect *rect,
1324 void **pixels, int *pitch);
1325
1326/**
1327 * Lock a portion of the texture for **write-only** pixel access, and expose
1328 * it as a SDL surface.
1329 *
1330 * Besides providing an SDL_Surface instead of raw pixel data, this function
1331 * operates like SDL_LockTexture.
1332 *
1333 * As an optimization, the pixels made available for editing don't necessarily
1334 * contain the old texture data. This is a write-only operation, and if you
1335 * need to keep a copy of the texture data you should do that at the
1336 * application level.
1337 *
1338 * You must use SDL_UnlockTexture() to unlock the pixels and apply any
1339 * changes.
1340 *
1341 * The returned surface is freed internally after calling SDL_UnlockTexture()
1342 * or SDL_DestroyTexture(). The caller should not free it.
1343 *
1344 * \param texture the texture to lock for access, which must be created with
1345 * `SDL_TEXTUREACCESS_STREAMING`.
1346 * \param rect a pointer to the rectangle to lock for access. If the rect is
1347 * NULL, the entire texture will be locked.
1348 * \param surface a pointer to an SDL surface of size **rect**. Don't assume
1349 * any specific pixel content.
1350 * \returns true on success or false on failure; call SDL_GetError() for more
1351 * information.
1352 *
1353 * \threadsafety This function should only be called on the main thread.
1354 *
1355 * \since This function is available since SDL 3.2.0.
1356 *
1357 * \sa SDL_LockTexture
1358 * \sa SDL_UnlockTexture
1359 */
1360extern SDL_DECLSPEC bool SDLCALL SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect, SDL_Surface **surface);
1361
1362/**
1363 * Unlock a texture, uploading the changes to video memory, if needed.
1364 *
1365 * **Warning**: Please note that SDL_LockTexture() is intended to be
1366 * write-only; it will not guarantee the previous contents of the texture will
1367 * be provided. You must fully initialize any area of a texture that you lock
1368 * before unlocking it, as the pixels might otherwise be uninitialized memory.
1369 *
1370 * Which is to say: locking and immediately unlocking a texture can result in
1371 * corrupted textures, depending on the renderer in use.
1372 *
1373 * \param texture a texture locked by SDL_LockTexture().
1374 *
1375 * \threadsafety This function should only be called on the main thread.
1376 *
1377 * \since This function is available since SDL 3.2.0.
1378 *
1379 * \sa SDL_LockTexture
1380 */
1381extern SDL_DECLSPEC void SDLCALL SDL_UnlockTexture(SDL_Texture *texture);
1382
1383/**
1384 * Set a texture as the current rendering target.
1385 *
1386 * The default render target is the window for which the renderer was created.
1387 * To stop rendering to a texture and render to the window again, call this
1388 * function with a NULL `texture`.
1389 *
1390 * Viewport, cliprect, scale, and logical presentation are unique to each
1391 * render target. Get and set functions for these states apply to the current
1392 * render target set by this function, and those states persist on each target
1393 * when the current render target changes.
1394 *
1395 * \param renderer the rendering context.
1396 * \param texture the targeted texture, which must be created with the
1397 * `SDL_TEXTUREACCESS_TARGET` flag, or NULL to render to the
1398 * window instead of a texture.
1399 * \returns true on success or false on failure; call SDL_GetError() for more
1400 * information.
1401 *
1402 * \threadsafety This function should only be called on the main thread.
1403 *
1404 * \since This function is available since SDL 3.2.0.
1405 *
1406 * \sa SDL_GetRenderTarget
1407 */
1408extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture);
1409
1410/**
1411 * Get the current render target.
1412 *
1413 * The default render target is the window for which the renderer was created,
1414 * and is reported a NULL here.
1415 *
1416 * \param renderer the rendering context.
1417 * \returns the current render target or NULL for the default render target.
1418 *
1419 * \threadsafety This function should only be called on the main thread.
1420 *
1421 * \since This function is available since SDL 3.2.0.
1422 *
1423 * \sa SDL_SetRenderTarget
1424 */
1426
1427/**
1428 * Set a device-independent resolution and presentation mode for rendering.
1429 *
1430 * This function sets the width and height of the logical rendering output.
1431 * The renderer will act as if the current render target is always the
1432 * requested dimensions, scaling to the actual resolution as necessary.
1433 *
1434 * This can be useful for games that expect a fixed size, but would like to
1435 * scale the output to whatever is available, regardless of how a user resizes
1436 * a window, or if the display is high DPI.
1437 *
1438 * Logical presentation can be used with both render target textures and the
1439 * renderer's window; the state is unique to each render target, and this
1440 * function sets the state for the current render target. It might be useful
1441 * to draw to a texture that matches the window dimensions with logical
1442 * presentation enabled, and then draw that texture across the entire window
1443 * with logical presentation disabled. Be careful not to render both with
1444 * logical presentation enabled, however, as this could produce
1445 * double-letterboxing, etc.
1446 *
1447 * You can disable logical coordinates by setting the mode to
1448 * SDL_LOGICAL_PRESENTATION_DISABLED, and in that case you get the full pixel
1449 * resolution of the render target; it is safe to toggle logical presentation
1450 * during the rendering of a frame: perhaps most of the rendering is done to
1451 * specific dimensions but to make fonts look sharp, the app turns off logical
1452 * presentation while drawing text, for example.
1453 *
1454 * You can convert coordinates in an event into rendering coordinates using
1455 * SDL_ConvertEventToRenderCoordinates().
1456 *
1457 * \param renderer the rendering context.
1458 * \param w the width of the logical resolution.
1459 * \param h the height of the logical resolution.
1460 * \param mode the presentation mode used.
1461 * \returns true on success or false on failure; call SDL_GetError() for more
1462 * information.
1463 *
1464 * \threadsafety This function should only be called on the main thread.
1465 *
1466 * \since This function is available since SDL 3.2.0.
1467 *
1468 * \sa SDL_ConvertEventToRenderCoordinates
1469 * \sa SDL_GetRenderLogicalPresentation
1470 * \sa SDL_GetRenderLogicalPresentationRect
1471 */
1473
1474/**
1475 * Get device independent resolution and presentation mode for rendering.
1476 *
1477 * This function gets the width and height of the logical rendering output, or
1478 * 0 if a logical resolution is not enabled.
1479 *
1480 * Each render target has its own logical presentation state. This function
1481 * gets the state for the current render target.
1482 *
1483 * \param renderer the rendering context.
1484 * \param w an int filled with the logical presentation width.
1485 * \param h an int filled with the logical presentation height.
1486 * \param mode a variable filled with the logical presentation mode being
1487 * used.
1488 * \returns true on success or false on failure; call SDL_GetError() for more
1489 * information.
1490 *
1491 * \threadsafety This function should only be called on the main thread.
1492 *
1493 * \since This function is available since SDL 3.2.0.
1494 *
1495 * \sa SDL_SetRenderLogicalPresentation
1496 */
1497extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderLogicalPresentation(SDL_Renderer *renderer, int *w, int *h, SDL_RendererLogicalPresentation *mode);
1498
1499/**
1500 * Get the final presentation rectangle for rendering.
1501 *
1502 * This function returns the calculated rectangle used for logical
1503 * presentation, based on the presentation mode and output size. If logical
1504 * presentation is disabled, it will fill the rectangle with the output size,
1505 * in pixels.
1506 *
1507 * Each render target has its own logical presentation state. This function
1508 * gets the rectangle for the current render target.
1509 *
1510 * \param renderer the rendering context.
1511 * \param rect a pointer filled in with the final presentation rectangle, may
1512 * be NULL.
1513 * \returns true on success or false on failure; call SDL_GetError() for more
1514 * information.
1515 *
1516 * \threadsafety This function should only be called on the main thread.
1517 *
1518 * \since This function is available since SDL 3.2.0.
1519 *
1520 * \sa SDL_SetRenderLogicalPresentation
1521 */
1523
1524/**
1525 * Get a point in render coordinates when given a point in window coordinates.
1526 *
1527 * This takes into account several states:
1528 *
1529 * - The window dimensions.
1530 * - The logical presentation settings (SDL_SetRenderLogicalPresentation)
1531 * - The scale (SDL_SetRenderScale)
1532 * - The viewport (SDL_SetRenderViewport)
1533 *
1534 * \param renderer the rendering context.
1535 * \param window_x the x coordinate in window coordinates.
1536 * \param window_y the y coordinate in window coordinates.
1537 * \param x a pointer filled with the x coordinate in render coordinates.
1538 * \param y a pointer filled with the y coordinate in render coordinates.
1539 * \returns true on success or false on failure; call SDL_GetError() for more
1540 * information.
1541 *
1542 * \threadsafety This function should only be called on the main thread.
1543 *
1544 * \since This function is available since SDL 3.2.0.
1545 *
1546 * \sa SDL_SetRenderLogicalPresentation
1547 * \sa SDL_SetRenderScale
1548 */
1549extern SDL_DECLSPEC bool SDLCALL SDL_RenderCoordinatesFromWindow(SDL_Renderer *renderer, float window_x, float window_y, float *x, float *y);
1550
1551/**
1552 * Get a point in window coordinates when given a point in render coordinates.
1553 *
1554 * This takes into account several states:
1555 *
1556 * - The window dimensions.
1557 * - The logical presentation settings (SDL_SetRenderLogicalPresentation)
1558 * - The scale (SDL_SetRenderScale)
1559 * - The viewport (SDL_SetRenderViewport)
1560 *
1561 * \param renderer the rendering context.
1562 * \param x the x coordinate in render coordinates.
1563 * \param y the y coordinate in render coordinates.
1564 * \param window_x a pointer filled with the x coordinate in window
1565 * coordinates.
1566 * \param window_y a pointer filled with the y coordinate in window
1567 * coordinates.
1568 * \returns true on success or false on failure; call SDL_GetError() for more
1569 * information.
1570 *
1571 * \threadsafety This function should only be called on the main thread.
1572 *
1573 * \since This function is available since SDL 3.2.0.
1574 *
1575 * \sa SDL_SetRenderLogicalPresentation
1576 * \sa SDL_SetRenderScale
1577 * \sa SDL_SetRenderViewport
1578 */
1579extern SDL_DECLSPEC bool SDLCALL SDL_RenderCoordinatesToWindow(SDL_Renderer *renderer, float x, float y, float *window_x, float *window_y);
1580
1581/**
1582 * Convert the coordinates in an event to render coordinates.
1583 *
1584 * This takes into account several states:
1585 *
1586 * - The window dimensions.
1587 * - The logical presentation settings (SDL_SetRenderLogicalPresentation)
1588 * - The scale (SDL_SetRenderScale)
1589 * - The viewport (SDL_SetRenderViewport)
1590 *
1591 * Various event types are converted with this function: mouse, touch, pen,
1592 * etc.
1593 *
1594 * Touch coordinates are converted from normalized coordinates in the window
1595 * to non-normalized rendering coordinates.
1596 *
1597 * Relative mouse coordinates (xrel and yrel event fields) are _also_
1598 * converted. Applications that do not want these fields converted should use
1599 * SDL_RenderCoordinatesFromWindow() on the specific event fields instead of
1600 * converting the entire event structure.
1601 *
1602 * Once converted, coordinates may be outside the rendering area.
1603 *
1604 * \param renderer the rendering context.
1605 * \param event the event to modify.
1606 * \returns true on success or false on failure; call SDL_GetError() for more
1607 * information.
1608 *
1609 * \threadsafety This function should only be called on the main thread.
1610 *
1611 * \since This function is available since SDL 3.2.0.
1612 *
1613 * \sa SDL_RenderCoordinatesFromWindow
1614 */
1615extern SDL_DECLSPEC bool SDLCALL SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *event);
1616
1617/**
1618 * Set the drawing area for rendering on the current target.
1619 *
1620 * Drawing will clip to this area (separately from any clipping done with
1621 * SDL_SetRenderClipRect), and the top left of the area will become coordinate
1622 * (0, 0) for future drawing commands.
1623 *
1624 * The area's width and height must be >= 0.
1625 *
1626 * Each render target has its own viewport. This function sets the viewport
1627 * for the current render target.
1628 *
1629 * \param renderer the rendering context.
1630 * \param rect the SDL_Rect structure representing the drawing area, or NULL
1631 * to set the viewport to the entire target.
1632 * \returns true on success or false on failure; call SDL_GetError() for more
1633 * information.
1634 *
1635 * \threadsafety This function should only be called on the main thread.
1636 *
1637 * \since This function is available since SDL 3.2.0.
1638 *
1639 * \sa SDL_GetRenderViewport
1640 * \sa SDL_RenderViewportSet
1641 */
1642extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderViewport(SDL_Renderer *renderer, const SDL_Rect *rect);
1643
1644/**
1645 * Get the drawing area for the current target.
1646 *
1647 * Each render target has its own viewport. This function gets the viewport
1648 * for the current render target.
1649 *
1650 * \param renderer the rendering context.
1651 * \param rect an SDL_Rect structure filled in with the current drawing area.
1652 * \returns true on success or false on failure; call SDL_GetError() for more
1653 * information.
1654 *
1655 * \threadsafety This function should only be called on the main thread.
1656 *
1657 * \since This function is available since SDL 3.2.0.
1658 *
1659 * \sa SDL_RenderViewportSet
1660 * \sa SDL_SetRenderViewport
1661 */
1662extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_Rect *rect);
1663
1664/**
1665 * Return whether an explicit rectangle was set as the viewport.
1666 *
1667 * This is useful if you're saving and restoring the viewport and want to know
1668 * whether you should restore a specific rectangle or NULL.
1669 *
1670 * Each render target has its own viewport. This function checks the viewport
1671 * for the current render target.
1672 *
1673 * \param renderer the rendering context.
1674 * \returns true if the viewport was set to a specific rectangle, or false if
1675 * it was set to NULL (the entire target).
1676 *
1677 * \threadsafety This function should only be called on the main thread.
1678 *
1679 * \since This function is available since SDL 3.2.0.
1680 *
1681 * \sa SDL_GetRenderViewport
1682 * \sa SDL_SetRenderViewport
1683 */
1684extern SDL_DECLSPEC bool SDLCALL SDL_RenderViewportSet(SDL_Renderer *renderer);
1685
1686/**
1687 * Get the safe area for rendering within the current viewport.
1688 *
1689 * Some devices have portions of the screen which are partially obscured or
1690 * not interactive, possibly due to on-screen controls, curved edges, camera
1691 * notches, TV overscan, etc. This function provides the area of the current
1692 * viewport which is safe to have interactible content. You should continue
1693 * rendering into the rest of the render target, but it should not contain
1694 * visually important or interactible content.
1695 *
1696 * \param renderer the rendering context.
1697 * \param rect a pointer filled in with the area that is safe for interactive
1698 * content.
1699 * \returns true on success or false on failure; call SDL_GetError() for more
1700 * information.
1701 *
1702 * \threadsafety This function should only be called on the main thread.
1703 *
1704 * \since This function is available since SDL 3.2.0.
1705 */
1706extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderSafeArea(SDL_Renderer *renderer, SDL_Rect *rect);
1707
1708/**
1709 * Set the clip rectangle for rendering on the specified target.
1710 *
1711 * Each render target has its own clip rectangle. This function sets the
1712 * cliprect for the current render target.
1713 *
1714 * \param renderer the rendering context.
1715 * \param rect an SDL_Rect structure representing the clip area, relative to
1716 * the viewport, or NULL to disable clipping.
1717 * \returns true on success or false on failure; call SDL_GetError() for more
1718 * information.
1719 *
1720 * \threadsafety This function should only be called on the main thread.
1721 *
1722 * \since This function is available since SDL 3.2.0.
1723 *
1724 * \sa SDL_GetRenderClipRect
1725 * \sa SDL_RenderClipEnabled
1726 */
1727extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_Rect *rect);
1728
1729/**
1730 * Get the clip rectangle for the current target.
1731 *
1732 * Each render target has its own clip rectangle. This function gets the
1733 * cliprect for the current render target.
1734 *
1735 * \param renderer the rendering context.
1736 * \param rect an SDL_Rect structure filled in with the current clipping area
1737 * or an empty rectangle if clipping is disabled.
1738 * \returns true on success or false on failure; call SDL_GetError() for more
1739 * information.
1740 *
1741 * \threadsafety This function should only be called on the main thread.
1742 *
1743 * \since This function is available since SDL 3.2.0.
1744 *
1745 * \sa SDL_RenderClipEnabled
1746 * \sa SDL_SetRenderClipRect
1747 */
1748extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_Rect *rect);
1749
1750/**
1751 * Get whether clipping is enabled on the given render target.
1752 *
1753 * Each render target has its own clip rectangle. This function checks the
1754 * cliprect for the current render target.
1755 *
1756 * \param renderer the rendering context.
1757 * \returns true if clipping is enabled or false if not; call SDL_GetError()
1758 * for more information.
1759 *
1760 * \threadsafety This function should only be called on the main thread.
1761 *
1762 * \since This function is available since SDL 3.2.0.
1763 *
1764 * \sa SDL_GetRenderClipRect
1765 * \sa SDL_SetRenderClipRect
1766 */
1767extern SDL_DECLSPEC bool SDLCALL SDL_RenderClipEnabled(SDL_Renderer *renderer);
1768
1769/**
1770 * Set the drawing scale for rendering on the current target.
1771 *
1772 * The drawing coordinates are scaled by the x/y scaling factors before they
1773 * are used by the renderer. This allows resolution independent drawing with a
1774 * single coordinate system.
1775 *
1776 * If this results in scaling or subpixel drawing by the rendering backend, it
1777 * will be handled using the appropriate quality hints. For best results use
1778 * integer scaling factors.
1779 *
1780 * Each render target has its own scale. This function sets the scale for the
1781 * current render target.
1782 *
1783 * \param renderer the rendering context.
1784 * \param scaleX the horizontal scaling factor.
1785 * \param scaleY the vertical scaling factor.
1786 * \returns true on success or false on failure; call SDL_GetError() for more
1787 * information.
1788 *
1789 * \threadsafety This function should only be called on the main thread.
1790 *
1791 * \since This function is available since SDL 3.2.0.
1792 *
1793 * \sa SDL_GetRenderScale
1794 */
1795extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderScale(SDL_Renderer *renderer, float scaleX, float scaleY);
1796
1797/**
1798 * Get the drawing scale for the current target.
1799 *
1800 * Each render target has its own scale. This function gets the scale for the
1801 * current render target.
1802 *
1803 * \param renderer the rendering context.
1804 * \param scaleX a pointer filled in with the horizontal scaling factor.
1805 * \param scaleY a pointer filled in with the vertical scaling factor.
1806 * \returns true on success or false on failure; call SDL_GetError() for more
1807 * information.
1808 *
1809 * \threadsafety This function should only be called on the main thread.
1810 *
1811 * \since This function is available since SDL 3.2.0.
1812 *
1813 * \sa SDL_SetRenderScale
1814 */
1815extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderScale(SDL_Renderer *renderer, float *scaleX, float *scaleY);
1816
1817/**
1818 * Set the color used for drawing operations.
1819 *
1820 * Set the color for drawing or filling rectangles, lines, and points, and for
1821 * SDL_RenderClear().
1822 *
1823 * \param renderer the rendering context.
1824 * \param r the red value used to draw on the rendering target.
1825 * \param g the green value used to draw on the rendering target.
1826 * \param b the blue value used to draw on the rendering target.
1827 * \param a the alpha value used to draw on the rendering target; usually
1828 * `SDL_ALPHA_OPAQUE` (255). Use SDL_SetRenderDrawBlendMode to
1829 * specify how the alpha channel is used.
1830 * \returns true on success or false on failure; call SDL_GetError() for more
1831 * information.
1832 *
1833 * \threadsafety This function should only be called on the main thread.
1834 *
1835 * \since This function is available since SDL 3.2.0.
1836 *
1837 * \sa SDL_GetRenderDrawColor
1838 * \sa SDL_SetRenderDrawColorFloat
1839 */
1840extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderDrawColor(SDL_Renderer *renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a);
1841
1842/**
1843 * Set the color used for drawing operations (Rect, Line and Clear).
1844 *
1845 * Set the color for drawing or filling rectangles, lines, and points, and for
1846 * SDL_RenderClear().
1847 *
1848 * \param renderer the rendering context.
1849 * \param r the red value used to draw on the rendering target.
1850 * \param g the green value used to draw on the rendering target.
1851 * \param b the blue value used to draw on the rendering target.
1852 * \param a the alpha value used to draw on the rendering target. Use
1853 * SDL_SetRenderDrawBlendMode to specify how the alpha channel is
1854 * used.
1855 * \returns true on success or false on failure; call SDL_GetError() for more
1856 * information.
1857 *
1858 * \threadsafety This function should only be called on the main thread.
1859 *
1860 * \since This function is available since SDL 3.2.0.
1861 *
1862 * \sa SDL_GetRenderDrawColorFloat
1863 * \sa SDL_SetRenderDrawColor
1864 */
1865extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderDrawColorFloat(SDL_Renderer *renderer, float r, float g, float b, float a);
1866
1867/**
1868 * Get the color used for drawing operations (Rect, Line and Clear).
1869 *
1870 * \param renderer the rendering context.
1871 * \param r a pointer filled in with the red value used to draw on the
1872 * rendering target.
1873 * \param g a pointer filled in with the green value used to draw on the
1874 * rendering target.
1875 * \param b a pointer filled in with the blue value used to draw on the
1876 * rendering target.
1877 * \param a a pointer filled in with the alpha value used to draw on the
1878 * rendering target; usually `SDL_ALPHA_OPAQUE` (255).
1879 * \returns true on success or false on failure; call SDL_GetError() for more
1880 * information.
1881 *
1882 * \threadsafety This function should only be called on the main thread.
1883 *
1884 * \since This function is available since SDL 3.2.0.
1885 *
1886 * \sa SDL_GetRenderDrawColorFloat
1887 * \sa SDL_SetRenderDrawColor
1888 */
1889extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderDrawColor(SDL_Renderer *renderer, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a);
1890
1891/**
1892 * Get the color used for drawing operations (Rect, Line and Clear).
1893 *
1894 * \param renderer the rendering context.
1895 * \param r a pointer filled in with the red value used to draw on the
1896 * rendering target.
1897 * \param g a pointer filled in with the green value used to draw on the
1898 * rendering target.
1899 * \param b a pointer filled in with the blue value used to draw on the
1900 * rendering target.
1901 * \param a a pointer filled in with the alpha value used to draw on the
1902 * rendering target.
1903 * \returns true on success or false on failure; call SDL_GetError() for more
1904 * information.
1905 *
1906 * \threadsafety This function should only be called on the main thread.
1907 *
1908 * \since This function is available since SDL 3.2.0.
1909 *
1910 * \sa SDL_SetRenderDrawColorFloat
1911 * \sa SDL_GetRenderDrawColor
1912 */
1913extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderDrawColorFloat(SDL_Renderer *renderer, float *r, float *g, float *b, float *a);
1914
1915/**
1916 * Set the color scale used for render operations.
1917 *
1918 * The color scale is an additional scale multiplied into the pixel color
1919 * value while rendering. This can be used to adjust the brightness of colors
1920 * during HDR rendering, or changing HDR video brightness when playing on an
1921 * SDR display.
1922 *
1923 * The color scale does not affect the alpha channel, only the color
1924 * brightness.
1925 *
1926 * \param renderer the rendering context.
1927 * \param scale the color scale value.
1928 * \returns true on success or false on failure; call SDL_GetError() for more
1929 * information.
1930 *
1931 * \threadsafety This function should only be called on the main thread.
1932 *
1933 * \since This function is available since SDL 3.2.0.
1934 *
1935 * \sa SDL_GetRenderColorScale
1936 */
1937extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderColorScale(SDL_Renderer *renderer, float scale);
1938
1939/**
1940 * Get the color scale used for render operations.
1941 *
1942 * \param renderer the rendering context.
1943 * \param scale a pointer filled in with the current color scale value.
1944 * \returns true on success or false on failure; call SDL_GetError() for more
1945 * information.
1946 *
1947 * \threadsafety This function should only be called on the main thread.
1948 *
1949 * \since This function is available since SDL 3.2.0.
1950 *
1951 * \sa SDL_SetRenderColorScale
1952 */
1953extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderColorScale(SDL_Renderer *renderer, float *scale);
1954
1955/**
1956 * Set the blend mode used for drawing operations (Fill and Line).
1957 *
1958 * If the blend mode is not supported, the closest supported mode is chosen.
1959 *
1960 * \param renderer the rendering context.
1961 * \param blendMode the SDL_BlendMode to use for blending.
1962 * \returns true on success or false on failure; call SDL_GetError() for more
1963 * information.
1964 *
1965 * \threadsafety This function should only be called on the main thread.
1966 *
1967 * \since This function is available since SDL 3.2.0.
1968 *
1969 * \sa SDL_GetRenderDrawBlendMode
1970 */
1971extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode);
1972
1973/**
1974 * Get the blend mode used for drawing operations.
1975 *
1976 * \param renderer the rendering context.
1977 * \param blendMode a pointer filled in with the current SDL_BlendMode.
1978 * \returns true on success or false on failure; call SDL_GetError() for more
1979 * information.
1980 *
1981 * \threadsafety This function should only be called on the main thread.
1982 *
1983 * \since This function is available since SDL 3.2.0.
1984 *
1985 * \sa SDL_SetRenderDrawBlendMode
1986 */
1987extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode *blendMode);
1988
1989/**
1990 * Clear the current rendering target with the drawing color.
1991 *
1992 * This function clears the entire rendering target, ignoring the viewport and
1993 * the clip rectangle. Note, that clearing will also set/fill all pixels of
1994 * the rendering target to current renderer draw color, so make sure to invoke
1995 * SDL_SetRenderDrawColor() when needed.
1996 *
1997 * \param renderer the rendering context.
1998 * \returns true on success or false on failure; call SDL_GetError() for more
1999 * information.
2000 *
2001 * \threadsafety This function should only be called on the main thread.
2002 *
2003 * \since This function is available since SDL 3.2.0.
2004 *
2005 * \sa SDL_SetRenderDrawColor
2006 */
2007extern SDL_DECLSPEC bool SDLCALL SDL_RenderClear(SDL_Renderer *renderer);
2008
2009/**
2010 * Draw a point on the current rendering target at subpixel precision.
2011 *
2012 * \param renderer the renderer which should draw a point.
2013 * \param x the x coordinate of the point.
2014 * \param y the y coordinate of the point.
2015 * \returns true on success or false on failure; call SDL_GetError() for more
2016 * information.
2017 *
2018 * \threadsafety This function should only be called on the main thread.
2019 *
2020 * \since This function is available since SDL 3.2.0.
2021 *
2022 * \sa SDL_RenderPoints
2023 */
2024extern SDL_DECLSPEC bool SDLCALL SDL_RenderPoint(SDL_Renderer *renderer, float x, float y);
2025
2026/**
2027 * Draw multiple points on the current rendering target at subpixel precision.
2028 *
2029 * \param renderer the renderer which should draw multiple points.
2030 * \param points the points to draw.
2031 * \param count the number of points to draw.
2032 * \returns true on success or false on failure; call SDL_GetError() for more
2033 * information.
2034 *
2035 * \threadsafety This function should only be called on the main thread.
2036 *
2037 * \since This function is available since SDL 3.2.0.
2038 *
2039 * \sa SDL_RenderPoint
2040 */
2041extern SDL_DECLSPEC bool SDLCALL SDL_RenderPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int count);
2042
2043/**
2044 * Draw a line on the current rendering target at subpixel precision.
2045 *
2046 * \param renderer the renderer which should draw a line.
2047 * \param x1 the x coordinate of the start point.
2048 * \param y1 the y coordinate of the start point.
2049 * \param x2 the x coordinate of the end point.
2050 * \param y2 the y coordinate of the end point.
2051 * \returns true on success or false on failure; call SDL_GetError() for more
2052 * information.
2053 *
2054 * \threadsafety This function should only be called on the main thread.
2055 *
2056 * \since This function is available since SDL 3.2.0.
2057 *
2058 * \sa SDL_RenderLines
2059 */
2060extern SDL_DECLSPEC bool SDLCALL SDL_RenderLine(SDL_Renderer *renderer, float x1, float y1, float x2, float y2);
2061
2062/**
2063 * Draw a series of connected lines on the current rendering target at
2064 * subpixel precision.
2065 *
2066 * \param renderer the renderer which should draw multiple lines.
2067 * \param points the points along the lines.
2068 * \param count the number of points, drawing count-1 lines.
2069 * \returns true on success or false on failure; call SDL_GetError() for more
2070 * information.
2071 *
2072 * \threadsafety This function should only be called on the main thread.
2073 *
2074 * \since This function is available since SDL 3.2.0.
2075 *
2076 * \sa SDL_RenderLine
2077 */
2078extern SDL_DECLSPEC bool SDLCALL SDL_RenderLines(SDL_Renderer *renderer, const SDL_FPoint *points, int count);
2079
2080/**
2081 * Draw a rectangle on the current rendering target at subpixel precision.
2082 *
2083 * \param renderer the renderer which should draw a rectangle.
2084 * \param rect a pointer to the destination rectangle, or NULL to outline the
2085 * entire rendering target.
2086 * \returns true on success or false on failure; call SDL_GetError() for more
2087 * information.
2088 *
2089 * \threadsafety This function should only be called on the main thread.
2090 *
2091 * \since This function is available since SDL 3.2.0.
2092 *
2093 * \sa SDL_RenderRects
2094 */
2095extern SDL_DECLSPEC bool SDLCALL SDL_RenderRect(SDL_Renderer *renderer, const SDL_FRect *rect);
2096
2097/**
2098 * Draw some number of rectangles on the current rendering target at subpixel
2099 * precision.
2100 *
2101 * \param renderer the renderer which should draw multiple rectangles.
2102 * \param rects a pointer to an array of destination rectangles.
2103 * \param count the number of rectangles.
2104 * \returns true on success or false on failure; call SDL_GetError() for more
2105 * information.
2106 *
2107 * \threadsafety This function should only be called on the main thread.
2108 *
2109 * \since This function is available since SDL 3.2.0.
2110 *
2111 * \sa SDL_RenderRect
2112 */
2113extern SDL_DECLSPEC bool SDLCALL SDL_RenderRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count);
2114
2115/**
2116 * Fill a rectangle on the current rendering target with the drawing color at
2117 * subpixel precision.
2118 *
2119 * \param renderer the renderer which should fill a rectangle.
2120 * \param rect a pointer to the destination rectangle, or NULL for the entire
2121 * rendering target.
2122 * \returns true on success or false on failure; call SDL_GetError() for more
2123 * information.
2124 *
2125 * \threadsafety This function should only be called on the main thread.
2126 *
2127 * \since This function is available since SDL 3.2.0.
2128 *
2129 * \sa SDL_RenderFillRects
2130 */
2131extern SDL_DECLSPEC bool SDLCALL SDL_RenderFillRect(SDL_Renderer *renderer, const SDL_FRect *rect);
2132
2133/**
2134 * Fill some number of rectangles on the current rendering target with the
2135 * drawing color at subpixel precision.
2136 *
2137 * \param renderer the renderer which should fill multiple rectangles.
2138 * \param rects a pointer to an array of destination rectangles.
2139 * \param count the number of rectangles.
2140 * \returns true on success or false on failure; call SDL_GetError() for more
2141 * information.
2142 *
2143 * \threadsafety This function should only be called on the main thread.
2144 *
2145 * \since This function is available since SDL 3.2.0.
2146 *
2147 * \sa SDL_RenderFillRect
2148 */
2149extern SDL_DECLSPEC bool SDLCALL SDL_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count);
2150
2151/**
2152 * Copy a portion of the texture to the current rendering target at subpixel
2153 * precision.
2154 *
2155 * \param renderer the renderer which should copy parts of a texture.
2156 * \param texture the source texture.
2157 * \param srcrect a pointer to the source rectangle, or NULL for the entire
2158 * texture.
2159 * \param dstrect a pointer to the destination rectangle, or NULL for the
2160 * entire rendering target.
2161 * \returns true on success or false on failure; call SDL_GetError() for more
2162 * information.
2163 *
2164 * \threadsafety This function should only be called on the main thread.
2165 *
2166 * \since This function is available since SDL 3.2.0.
2167 *
2168 * \sa SDL_RenderTextureRotated
2169 * \sa SDL_RenderTextureTiled
2170 */
2171extern SDL_DECLSPEC bool SDLCALL SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect);
2172
2173/**
2174 * Copy a portion of the source texture to the current rendering target, with
2175 * rotation and flipping, at subpixel precision.
2176 *
2177 * \param renderer the renderer which should copy parts of a texture.
2178 * \param texture the source texture.
2179 * \param srcrect a pointer to the source rectangle, or NULL for the entire
2180 * texture.
2181 * \param dstrect a pointer to the destination rectangle, or NULL for the
2182 * entire rendering target.
2183 * \param angle an angle in degrees that indicates the rotation that will be
2184 * applied to dstrect, rotating it in a clockwise direction.
2185 * \param center a pointer to a point indicating the point around which
2186 * dstrect will be rotated (if NULL, rotation will be done
2187 * around dstrect.w/2, dstrect.h/2).
2188 * \param flip an SDL_FlipMode value stating which flipping actions should be
2189 * performed on the texture.
2190 * \returns true on success or false on failure; call SDL_GetError() for more
2191 * information.
2192 *
2193 * \threadsafety This function should only be called on the main thread.
2194 *
2195 * \since This function is available since SDL 3.2.0.
2196 *
2197 * \sa SDL_RenderTexture
2198 */
2199extern SDL_DECLSPEC bool SDLCALL SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture,
2200 const SDL_FRect *srcrect, const SDL_FRect *dstrect,
2201 double angle, const SDL_FPoint *center,
2202 SDL_FlipMode flip);
2203
2204/**
2205 * Copy a portion of the source texture to the current rendering target, with
2206 * affine transform, at subpixel precision.
2207 *
2208 * \param renderer the renderer which should copy parts of a texture.
2209 * \param texture the source texture.
2210 * \param srcrect a pointer to the source rectangle, or NULL for the entire
2211 * texture.
2212 * \param origin a pointer to a point indicating where the top-left corner of
2213 * srcrect should be mapped to, or NULL for the rendering
2214 * target's origin.
2215 * \param right a pointer to a point indicating where the top-right corner of
2216 * srcrect should be mapped to, or NULL for the rendering
2217 * target's top-right corner.
2218 * \param down a pointer to a point indicating where the bottom-left corner of
2219 * srcrect should be mapped to, or NULL for the rendering target's
2220 * bottom-left corner.
2221 * \returns true on success or false on failure; call SDL_GetError() for more
2222 * information.
2223 *
2224 * \threadsafety You may only call this function from the main thread.
2225 *
2226 * \since This function is available since SDL 3.2.0.
2227 *
2228 * \sa SDL_RenderTexture
2229 */
2230extern SDL_DECLSPEC bool SDLCALL SDL_RenderTextureAffine(SDL_Renderer *renderer, SDL_Texture *texture,
2231 const SDL_FRect *srcrect, const SDL_FPoint *origin,
2232 const SDL_FPoint *right, const SDL_FPoint *down);
2233
2234/**
2235 * Tile a portion of the texture to the current rendering target at subpixel
2236 * precision.
2237 *
2238 * The pixels in `srcrect` will be repeated as many times as needed to
2239 * completely fill `dstrect`.
2240 *
2241 * \param renderer the renderer which should copy parts of a texture.
2242 * \param texture the source texture.
2243 * \param srcrect a pointer to the source rectangle, or NULL for the entire
2244 * texture.
2245 * \param scale the scale used to transform srcrect into the destination
2246 * rectangle, e.g. a 32x32 texture with a scale of 2 would fill
2247 * 64x64 tiles.
2248 * \param dstrect a pointer to the destination rectangle, or NULL for the
2249 * entire rendering target.
2250 * \returns true on success or false on failure; call SDL_GetError() for more
2251 * information.
2252 *
2253 * \threadsafety This function should only be called on the main thread.
2254 *
2255 * \since This function is available since SDL 3.2.0.
2256 *
2257 * \sa SDL_RenderTexture
2258 */
2259extern SDL_DECLSPEC bool SDLCALL SDL_RenderTextureTiled(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float scale, const SDL_FRect *dstrect);
2260
2261/**
2262 * Perform a scaled copy using the 9-grid algorithm to the current rendering
2263 * target at subpixel precision.
2264 *
2265 * The pixels in the texture are split into a 3x3 grid, using the different
2266 * corner sizes for each corner, and the sides and center making up the
2267 * remaining pixels. The corners are then scaled using `scale` and fit into
2268 * the corners of the destination rectangle. The sides and center are then
2269 * stretched into place to cover the remaining destination rectangle.
2270 *
2271 * \param renderer the renderer which should copy parts of a texture.
2272 * \param texture the source texture.
2273 * \param srcrect the SDL_Rect structure representing the rectangle to be used
2274 * for the 9-grid, or NULL to use the entire texture.
2275 * \param left_width the width, in pixels, of the left corners in `srcrect`.
2276 * \param right_width the width, in pixels, of the right corners in `srcrect`.
2277 * \param top_height the height, in pixels, of the top corners in `srcrect`.
2278 * \param bottom_height the height, in pixels, of the bottom corners in
2279 * `srcrect`.
2280 * \param scale the scale used to transform the corner of `srcrect` into the
2281 * corner of `dstrect`, or 0.0f for an unscaled copy.
2282 * \param dstrect a pointer to the destination rectangle, or NULL for the
2283 * entire rendering target.
2284 * \returns true on success or false on failure; call SDL_GetError() for more
2285 * information.
2286 *
2287 * \threadsafety This function should only be called on the main thread.
2288 *
2289 * \since This function is available since SDL 3.2.0.
2290 *
2291 * \sa SDL_RenderTexture
2292 */
2293extern SDL_DECLSPEC bool SDLCALL SDL_RenderTexture9Grid(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, const SDL_FRect *dstrect);
2294
2295/**
2296 * Perform a scaled copy using the 9-grid algorithm to the current rendering
2297 * target at subpixel precision.
2298 *
2299 * The pixels in the texture are split into a 3x3 grid, using the different
2300 * corner sizes for each corner, and the sides and center making up the
2301 * remaining pixels. The corners are then scaled using `scale` and fit into
2302 * the corners of the destination rectangle. The sides and center are then
2303 * tiled into place to cover the remaining destination rectangle.
2304 *
2305 * \param renderer the renderer which should copy parts of a texture.
2306 * \param texture the source texture.
2307 * \param srcrect the SDL_Rect structure representing the rectangle to be used
2308 * for the 9-grid, or NULL to use the entire texture.
2309 * \param left_width the width, in pixels, of the left corners in `srcrect`.
2310 * \param right_width the width, in pixels, of the right corners in `srcrect`.
2311 * \param top_height the height, in pixels, of the top corners in `srcrect`.
2312 * \param bottom_height the height, in pixels, of the bottom corners in
2313 * `srcrect`.
2314 * \param scale the scale used to transform the corner of `srcrect` into the
2315 * corner of `dstrect`, or 0.0f for an unscaled copy.
2316 * \param dstrect a pointer to the destination rectangle, or NULL for the
2317 * entire rendering target.
2318 * \param tileScale the scale used to transform the borders and center of
2319 * `srcrect` into the borders and middle of `dstrect`, or
2320 * 1.0f for an unscaled copy.
2321 * \returns true on success or false on failure; call SDL_GetError() for more
2322 * information.
2323 *
2324 * \threadsafety This function should only be called on the main thread.
2325 *
2326 * \since This function is available since SDL 3.4.0.
2327 *
2328 * \sa SDL_RenderTexture
2329 */
2330extern SDL_DECLSPEC bool SDLCALL SDL_RenderTexture9GridTiled(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, const SDL_FRect *dstrect, float tileScale);
2331
2332/**
2333 * Render a list of triangles, optionally using a texture and indices into the
2334 * vertex array Color and alpha modulation is done per vertex
2335 * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
2336 *
2337 * \param renderer the rendering context.
2338 * \param texture (optional) The SDL texture to use.
2339 * \param vertices vertices.
2340 * \param num_vertices number of vertices.
2341 * \param indices (optional) An array of integer indices into the 'vertices'
2342 * array, if NULL all vertices will be rendered in sequential
2343 * order.
2344 * \param num_indices number of indices.
2345 * \returns true on success or false on failure; call SDL_GetError() for more
2346 * information.
2347 *
2348 * \threadsafety This function should only be called on the main thread.
2349 *
2350 * \since This function is available since SDL 3.2.0.
2351 *
2352 * \sa SDL_RenderGeometryRaw
2353 * \sa SDL_SetRenderTextureAddressMode
2354 */
2355extern SDL_DECLSPEC bool SDLCALL SDL_RenderGeometry(SDL_Renderer *renderer,
2356 SDL_Texture *texture,
2357 const SDL_Vertex *vertices, int num_vertices,
2358 const int *indices, int num_indices);
2359
2360/**
2361 * Render a list of triangles, optionally using a texture and indices into the
2362 * vertex arrays Color and alpha modulation is done per vertex
2363 * (SDL_SetTextureColorMod and SDL_SetTextureAlphaMod are ignored).
2364 *
2365 * \param renderer the rendering context.
2366 * \param texture (optional) The SDL texture to use.
2367 * \param xy vertex positions.
2368 * \param xy_stride byte size to move from one element to the next element.
2369 * \param color vertex colors (as SDL_FColor).
2370 * \param color_stride byte size to move from one element to the next element.
2371 * \param uv vertex normalized texture coordinates.
2372 * \param uv_stride byte size to move from one element to the next element.
2373 * \param num_vertices number of vertices.
2374 * \param indices (optional) An array of indices into the 'vertices' arrays,
2375 * if NULL all vertices will be rendered in sequential order.
2376 * \param num_indices number of indices.
2377 * \param size_indices index size: 1 (byte), 2 (short), 4 (int).
2378 * \returns true on success or false on failure; call SDL_GetError() for more
2379 * information.
2380 *
2381 * \threadsafety This function should only be called on the main thread.
2382 *
2383 * \since This function is available since SDL 3.2.0.
2384 *
2385 * \sa SDL_RenderGeometry
2386 * \sa SDL_SetRenderTextureAddressMode
2387 */
2388extern SDL_DECLSPEC bool SDLCALL SDL_RenderGeometryRaw(SDL_Renderer *renderer,
2389 SDL_Texture *texture,
2390 const float *xy, int xy_stride,
2391 const SDL_FColor *color, int color_stride,
2392 const float *uv, int uv_stride,
2393 int num_vertices,
2394 const void *indices, int num_indices, int size_indices);
2395
2396/**
2397 * Set the texture addressing mode used in SDL_RenderGeometry().
2398 *
2399 * \param renderer the rendering context.
2400 * \param u_mode the SDL_TextureAddressMode to use for horizontal texture
2401 * coordinates in SDL_RenderGeometry().
2402 * \param v_mode the SDL_TextureAddressMode to use for vertical texture
2403 * coordinates in SDL_RenderGeometry().
2404 * \returns true on success or false on failure; call SDL_GetError() for more
2405 * information.
2406 *
2407 * \since This function is available since SDL 3.4.0.
2408 *
2409 * \sa SDL_RenderGeometry
2410 * \sa SDL_RenderGeometryRaw
2411 * \sa SDL_GetRenderTextureAddressMode
2412 */
2414
2415/**
2416 * Get the texture addressing mode used in SDL_RenderGeometry().
2417 *
2418 * \param renderer the rendering context.
2419 * \param u_mode a pointer filled in with the SDL_TextureAddressMode to use
2420 * for horizontal texture coordinates in SDL_RenderGeometry(),
2421 * may be NULL.
2422 * \param v_mode a pointer filled in with the SDL_TextureAddressMode to use
2423 * for vertical texture coordinates in SDL_RenderGeometry(), may
2424 * be NULL.
2425 * \returns true on success or false on failure; call SDL_GetError() for more
2426 * information.
2427 *
2428 * \since This function is available since SDL 3.4.0.
2429 *
2430 * \sa SDL_SetRenderTextureAddressMode
2431 */
2433
2434/**
2435 * Read pixels from the current rendering target.
2436 *
2437 * The returned surface contains pixels inside the desired area clipped to the
2438 * current viewport, and should be freed with SDL_DestroySurface().
2439 *
2440 * Note that this returns the actual pixels on the screen, so if you are using
2441 * logical presentation you should use SDL_GetRenderLogicalPresentationRect()
2442 * to get the area containing your content.
2443 *
2444 * **WARNING**: This is a very slow operation, and should not be used
2445 * frequently. If you're using this on the main rendering target, it should be
2446 * called after rendering and before SDL_RenderPresent().
2447 *
2448 * \param renderer the rendering context.
2449 * \param rect an SDL_Rect structure representing the area to read, which will
2450 * be clipped to the current viewport, or NULL for the entire
2451 * viewport.
2452 * \returns a new SDL_Surface on success or NULL on failure; call
2453 * SDL_GetError() for more information.
2454 *
2455 * \threadsafety This function should only be called on the main thread.
2456 *
2457 * \since This function is available since SDL 3.2.0.
2458 */
2459extern SDL_DECLSPEC SDL_Surface * SDLCALL SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect);
2460
2461/**
2462 * Update the screen with any rendering performed since the previous call.
2463 *
2464 * SDL's rendering functions operate on a backbuffer; that is, calling a
2465 * rendering function such as SDL_RenderLine() does not directly put a line on
2466 * the screen, but rather updates the backbuffer. As such, you compose your
2467 * entire scene and *present* the composed backbuffer to the screen as a
2468 * complete picture.
2469 *
2470 * Therefore, when using SDL's rendering API, one does all drawing intended
2471 * for the frame, and then calls this function once per frame to present the
2472 * final drawing to the user.
2473 *
2474 * The backbuffer should be considered invalidated after each present; do not
2475 * assume that previous contents will exist between frames. You are strongly
2476 * encouraged to call SDL_RenderClear() to initialize the backbuffer before
2477 * starting each new frame's drawing, even if you plan to overwrite every
2478 * pixel.
2479 *
2480 * Please note, that in case of rendering to a texture - there is **no need**
2481 * to call `SDL_RenderPresent` after drawing needed objects to a texture, and
2482 * should not be done; you are only required to change back the rendering
2483 * target to default via `SDL_SetRenderTarget(renderer, NULL)` afterwards, as
2484 * textures by themselves do not have a concept of backbuffers. Calling
2485 * SDL_RenderPresent while rendering to a texture will fail.
2486 *
2487 * \param renderer the rendering context.
2488 * \returns true on success or false on failure; call SDL_GetError() for more
2489 * information.
2490 *
2491 * \threadsafety This function should only be called on the main thread.
2492 *
2493 * \since This function is available since SDL 3.2.0.
2494 *
2495 * \sa SDL_CreateRenderer
2496 * \sa SDL_RenderClear
2497 * \sa SDL_RenderFillRect
2498 * \sa SDL_RenderFillRects
2499 * \sa SDL_RenderLine
2500 * \sa SDL_RenderLines
2501 * \sa SDL_RenderPoint
2502 * \sa SDL_RenderPoints
2503 * \sa SDL_RenderRect
2504 * \sa SDL_RenderRects
2505 * \sa SDL_SetRenderDrawBlendMode
2506 * \sa SDL_SetRenderDrawColor
2507 */
2508extern SDL_DECLSPEC bool SDLCALL SDL_RenderPresent(SDL_Renderer *renderer);
2509
2510/**
2511 * Destroy the specified texture.
2512 *
2513 * Passing NULL or an otherwise invalid texture will set the SDL error message
2514 * to "Invalid texture".
2515 *
2516 * \param texture the texture to destroy.
2517 *
2518 * \threadsafety This function should only be called on the main thread.
2519 *
2520 * \since This function is available since SDL 3.2.0.
2521 *
2522 * \sa SDL_CreateTexture
2523 * \sa SDL_CreateTextureFromSurface
2524 */
2525extern SDL_DECLSPEC void SDLCALL SDL_DestroyTexture(SDL_Texture *texture);
2526
2527/**
2528 * Destroy the rendering context for a window and free all associated
2529 * textures.
2530 *
2531 * This should be called before destroying the associated window.
2532 *
2533 * \param renderer the rendering context.
2534 *
2535 * \threadsafety This function should only be called on the main thread.
2536 *
2537 * \since This function is available since SDL 3.2.0.
2538 *
2539 * \sa SDL_CreateRenderer
2540 */
2541extern SDL_DECLSPEC void SDLCALL SDL_DestroyRenderer(SDL_Renderer *renderer);
2542
2543/**
2544 * Force the rendering context to flush any pending commands and state.
2545 *
2546 * You do not need to (and in fact, shouldn't) call this function unless you
2547 * are planning to call into OpenGL/Direct3D/Metal/whatever directly, in
2548 * addition to using an SDL_Renderer.
2549 *
2550 * This is for a very-specific case: if you are using SDL's render API, and
2551 * you plan to make OpenGL/D3D/whatever calls in addition to SDL render API
2552 * calls. If this applies, you should call this function between calls to
2553 * SDL's render API and the low-level API you're using in cooperation.
2554 *
2555 * In all other cases, you can ignore this function.
2556 *
2557 * This call makes SDL flush any pending rendering work it was queueing up to
2558 * do later in a single batch, and marks any internal cached state as invalid,
2559 * so it'll prepare all its state again later, from scratch.
2560 *
2561 * This means you do not need to save state in your rendering code to protect
2562 * the SDL renderer. However, there lots of arbitrary pieces of Direct3D and
2563 * OpenGL state that can confuse things; you should use your best judgment and
2564 * be prepared to make changes if specific state needs to be protected.
2565 *
2566 * \param renderer the rendering context.
2567 * \returns true on success or false on failure; call SDL_GetError() for more
2568 * information.
2569 *
2570 * \threadsafety This function should only be called on the main thread.
2571 *
2572 * \since This function is available since SDL 3.2.0.
2573 */
2574extern SDL_DECLSPEC bool SDLCALL SDL_FlushRenderer(SDL_Renderer *renderer);
2575
2576/**
2577 * Get the CAMetalLayer associated with the given Metal renderer.
2578 *
2579 * This function returns `void *`, so SDL doesn't have to include Metal's
2580 * headers, but it can be safely cast to a `CAMetalLayer *`.
2581 *
2582 * \param renderer the renderer to query.
2583 * \returns a `CAMetalLayer *` on success, or NULL if the renderer isn't a
2584 * Metal renderer.
2585 *
2586 * \threadsafety This function should only be called on the main thread.
2587 *
2588 * \since This function is available since SDL 3.2.0.
2589 *
2590 * \sa SDL_GetRenderMetalCommandEncoder
2591 */
2592extern SDL_DECLSPEC void * SDLCALL SDL_GetRenderMetalLayer(SDL_Renderer *renderer);
2593
2594/**
2595 * Get the Metal command encoder for the current frame.
2596 *
2597 * This function returns `void *`, so SDL doesn't have to include Metal's
2598 * headers, but it can be safely cast to an `id<MTLRenderCommandEncoder>`.
2599 *
2600 * This will return NULL if Metal refuses to give SDL a drawable to render to,
2601 * which might happen if the window is hidden/minimized/offscreen. This
2602 * doesn't apply to command encoders for render targets, just the window's
2603 * backbuffer. Check your return values!
2604 *
2605 * \param renderer the renderer to query.
2606 * \returns an `id<MTLRenderCommandEncoder>` on success, or NULL if the
2607 * renderer isn't a Metal renderer or there was an error.
2608 *
2609 * \threadsafety This function should only be called on the main thread.
2610 *
2611 * \since This function is available since SDL 3.2.0.
2612 *
2613 * \sa SDL_GetRenderMetalLayer
2614 */
2615extern SDL_DECLSPEC void * SDLCALL SDL_GetRenderMetalCommandEncoder(SDL_Renderer *renderer);
2616
2617
2618/**
2619 * Add a set of synchronization semaphores for the current frame.
2620 *
2621 * The Vulkan renderer will wait for `wait_semaphore` before submitting
2622 * rendering commands and signal `signal_semaphore` after rendering commands
2623 * are complete for this frame.
2624 *
2625 * This should be called each frame that you want semaphore synchronization.
2626 * The Vulkan renderer may have multiple frames in flight on the GPU, so you
2627 * should have multiple semaphores that are used for synchronization. Querying
2628 * SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER will give you the
2629 * maximum number of semaphores you'll need.
2630 *
2631 * \param renderer the rendering context.
2632 * \param wait_stage_mask the VkPipelineStageFlags for the wait.
2633 * \param wait_semaphore a VkSempahore to wait on before rendering the current
2634 * frame, or 0 if not needed.
2635 * \param signal_semaphore a VkSempahore that SDL will signal when rendering
2636 * for the current frame is complete, or 0 if not
2637 * needed.
2638 * \returns true on success or false on failure; call SDL_GetError() for more
2639 * information.
2640 *
2641 * \threadsafety It is **NOT** safe to call this function from two threads at
2642 * once.
2643 *
2644 * \since This function is available since SDL 3.2.0.
2645 */
2646extern SDL_DECLSPEC bool SDLCALL SDL_AddVulkanRenderSemaphores(SDL_Renderer *renderer, Uint32 wait_stage_mask, Sint64 wait_semaphore, Sint64 signal_semaphore);
2647
2648/**
2649 * Toggle VSync of the given renderer.
2650 *
2651 * When a renderer is created, vsync defaults to SDL_RENDERER_VSYNC_DISABLED.
2652 *
2653 * The `vsync` parameter can be 1 to synchronize present with every vertical
2654 * refresh, 2 to synchronize present with every second vertical refresh, etc.,
2655 * SDL_RENDERER_VSYNC_ADAPTIVE for late swap tearing (adaptive vsync), or
2656 * SDL_RENDERER_VSYNC_DISABLED to disable. Not every value is supported by
2657 * every driver, so you should check the return value to see whether the
2658 * requested setting is supported.
2659 *
2660 * \param renderer the renderer to toggle.
2661 * \param vsync the vertical refresh sync interval.
2662 * \returns true on success or false on failure; call SDL_GetError() for more
2663 * information.
2664 *
2665 * \threadsafety This function should only be called on the main thread.
2666 *
2667 * \since This function is available since SDL 3.2.0.
2668 *
2669 * \sa SDL_GetRenderVSync
2670 */
2671extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderVSync(SDL_Renderer *renderer, int vsync);
2672
2673#define SDL_RENDERER_VSYNC_DISABLED 0
2674#define SDL_RENDERER_VSYNC_ADAPTIVE (-1)
2675
2676/**
2677 * Get VSync of the given renderer.
2678 *
2679 * \param renderer the renderer to toggle.
2680 * \param vsync an int filled with the current vertical refresh sync interval.
2681 * See SDL_SetRenderVSync() for the meaning of the value.
2682 * \returns true on success or false on failure; call SDL_GetError() for more
2683 * information.
2684 *
2685 * \threadsafety This function should only be called on the main thread.
2686 *
2687 * \since This function is available since SDL 3.2.0.
2688 *
2689 * \sa SDL_SetRenderVSync
2690 */
2691extern SDL_DECLSPEC bool SDLCALL SDL_GetRenderVSync(SDL_Renderer *renderer, int *vsync);
2692
2693/**
2694 * The size, in pixels, of a single SDL_RenderDebugText() character.
2695 *
2696 * The font is monospaced and square, so this applies to all characters.
2697 *
2698 * \since This macro is available since SDL 3.2.0.
2699 *
2700 * \sa SDL_RenderDebugText
2701 */
2702#define SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE 8
2703
2704/**
2705 * Draw debug text to an SDL_Renderer.
2706 *
2707 * This function will render a string of text to an SDL_Renderer. Note that
2708 * this is a convenience function for debugging, with severe limitations, and
2709 * not intended to be used for production apps and games.
2710 *
2711 * Among these limitations:
2712 *
2713 * - It accepts UTF-8 strings, but will only renders ASCII characters.
2714 * - It has a single, tiny size (8x8 pixels). One can use logical presentation
2715 * or scaling to adjust it, but it will be blurry.
2716 * - It uses a simple, hardcoded bitmap font. It does not allow different font
2717 * selections and it does not support truetype, for proper scaling.
2718 * - It does no word-wrapping and does not treat newline characters as a line
2719 * break. If the text goes out of the window, it's gone.
2720 *
2721 * For serious text rendering, there are several good options, such as
2722 * SDL_ttf, stb_truetype, or other external libraries.
2723 *
2724 * On first use, this will create an internal texture for rendering glyphs.
2725 * This texture will live until the renderer is destroyed.
2726 *
2727 * The text is drawn in the color specified by SDL_SetRenderDrawColor().
2728 *
2729 * \param renderer the renderer which should draw a line of text.
2730 * \param x the x coordinate where the top-left corner of the text will draw.
2731 * \param y the y coordinate where the top-left corner of the text will draw.
2732 * \param str the string to render.
2733 * \returns true on success or false on failure; call SDL_GetError() for more
2734 * information.
2735 *
2736 * \threadsafety This function should only be called on the main thread.
2737 *
2738 * \since This function is available since SDL 3.2.0.
2739 *
2740 * \sa SDL_RenderDebugTextFormat
2741 * \sa SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE
2742 */
2743extern SDL_DECLSPEC bool SDLCALL SDL_RenderDebugText(SDL_Renderer *renderer, float x, float y, const char *str);
2744
2745/**
2746 * Draw debug text to an SDL_Renderer.
2747 *
2748 * This function will render a printf()-style format string to a renderer.
2749 * Note that this is a convenience function for debugging, with severe
2750 * limitations, and is not intended to be used for production apps and games.
2751 *
2752 * For the full list of limitations and other useful information, see
2753 * SDL_RenderDebugText.
2754 *
2755 * \param renderer the renderer which should draw the text.
2756 * \param x the x coordinate where the top-left corner of the text will draw.
2757 * \param y the y coordinate where the top-left corner of the text will draw.
2758 * \param fmt the format string to draw.
2759 * \param ... additional parameters matching % tokens in the `fmt` string, if
2760 * any.
2761 * \returns true on success or false on failure; call SDL_GetError() for more
2762 * information.
2763 *
2764 * \threadsafety This function should only be called on the main thread.
2765 *
2766 * \since This function is available since SDL 3.2.0.
2767 *
2768 * \sa SDL_RenderDebugText
2769 * \sa SDL_DEBUG_TEXT_FONT_CHARACTER_SIZE
2770 */
2771extern SDL_DECLSPEC bool SDLCALL SDL_RenderDebugTextFormat(SDL_Renderer *renderer, float x, float y, SDL_PRINTF_FORMAT_STRING const char *fmt, ...) SDL_PRINTF_VARARG_FUNC(4);
2772
2773/**
2774 * Set default scale mode for new textures for given renderer.
2775 *
2776 * When a renderer is created, scale_mode defaults to SDL_SCALEMODE_LINEAR.
2777 *
2778 * \param renderer the renderer to update.
2779 * \param scale_mode the scale mode to change to for new textures.
2780 * \returns true on success or false on failure; call SDL_GetError() for more
2781 * information.
2782 *
2783 * \threadsafety This function should only be called on the main thread.
2784 *
2785 * \since This function is available since SDL 3.4.0.
2786 *
2787 * \sa SDL_GetDefaultTextureScaleMode
2788 */
2789extern SDL_DECLSPEC bool SDLCALL SDL_SetDefaultTextureScaleMode(SDL_Renderer *renderer, SDL_ScaleMode scale_mode);
2790
2791/**
2792 * Get default texture scale mode of the given renderer.
2793 *
2794 * \param renderer the renderer to get data from.
2795 * \param scale_mode a SDL_ScaleMode filled with current default scale mode.
2796 * See SDL_SetDefaultTextureScaleMode() for the meaning of
2797 * the value.
2798 * \returns true on success or false on failure; call SDL_GetError() for more
2799 * information.
2800 *
2801 * \threadsafety This function should only be called on the main thread.
2802 *
2803 * \since This function is available since SDL 3.4.0.
2804 *
2805 * \sa SDL_SetDefaultTextureScaleMode
2806 */
2807extern SDL_DECLSPEC bool SDLCALL SDL_GetDefaultTextureScaleMode(SDL_Renderer *renderer, SDL_ScaleMode *scale_mode);
2808
2809/**
2810 * A structure specifying the parameters of a GPU render state.
2811 *
2812 * \since This struct is available since SDL 3.4.0.
2813 *
2814 * \sa SDL_CreateGPURenderState
2815 */
2817{
2818 SDL_GPUShader *fragment_shader; /**< The fragment shader to use when this render state is active */
2819
2820 Sint32 num_sampler_bindings; /**< The number of additional fragment samplers to bind when this render state is active */
2821 const SDL_GPUTextureSamplerBinding *sampler_bindings; /**< Additional fragment samplers to bind when this render state is active */
2822
2823 Sint32 num_storage_textures; /**< The number of storage textures to bind when this render state is active */
2824 SDL_GPUTexture *const *storage_textures; /**< Storage textures to bind when this render state is active */
2825
2826 Sint32 num_storage_buffers; /**< The number of storage buffers to bind when this render state is active */
2827 SDL_GPUBuffer *const *storage_buffers; /**< Storage buffers to bind when this render state is active */
2828
2829 SDL_PropertiesID props; /**< A properties ID for extensions. Should be 0 if no extensions are needed. */
2831
2832/**
2833 * A custom GPU render state.
2834 *
2835 * \since This struct is available since SDL 3.4.0.
2836 *
2837 * \sa SDL_CreateGPURenderState
2838 * \sa SDL_SetGPURenderStateFragmentUniforms
2839 * \sa SDL_SetRenderGPUState
2840 * \sa SDL_DestroyGPURenderState
2841 */
2843
2844/**
2845 * Create custom GPU render state.
2846 *
2847 * \param renderer the renderer to use.
2848 * \param createinfo a struct describing the GPU render state to create.
2849 * \returns a custom GPU render state or NULL on failure; call SDL_GetError()
2850 * for more information.
2851 *
2852 * \threadsafety This function should be called on the thread that created the
2853 * renderer.
2854 *
2855 * \since This function is available since SDL 3.4.0.
2856 *
2857 * \sa SDL_SetGPURenderStateFragmentUniforms
2858 * \sa SDL_SetRenderGPUState
2859 * \sa SDL_DestroyGPURenderState
2860 */
2862
2863/**
2864 * Set fragment shader uniform variables in a custom GPU render state.
2865 *
2866 * The data is copied and will be pushed using
2867 * SDL_PushGPUFragmentUniformData() during draw call execution.
2868 *
2869 * \param state the state to modify.
2870 * \param slot_index the fragment uniform slot to push data to.
2871 * \param data client data to write.
2872 * \param length the length of the data to write.
2873 * \returns true on success or false on failure; call SDL_GetError() for more
2874 * information.
2875 *
2876 * \threadsafety This function should be called on the thread that created the
2877 * renderer.
2878 *
2879 * \since This function is available since SDL 3.4.0.
2880 */
2881extern SDL_DECLSPEC bool SDLCALL SDL_SetGPURenderStateFragmentUniforms(SDL_GPURenderState *state, Uint32 slot_index, const void *data, Uint32 length);
2882
2883/**
2884 * Set custom GPU render state.
2885 *
2886 * This function sets custom GPU render state for subsequent draw calls. This
2887 * allows using custom shaders with the GPU renderer.
2888 *
2889 * \param renderer the renderer to use.
2890 * \param state the state to to use, or NULL to clear custom GPU render state.
2891 * \returns true on success or false on failure; call SDL_GetError() for more
2892 * information.
2893 *
2894 * \threadsafety This function should be called on the thread that created the
2895 * renderer.
2896 *
2897 * \since This function is available since SDL 3.4.0.
2898 */
2899extern SDL_DECLSPEC bool SDLCALL SDL_SetRenderGPUState(SDL_Renderer *renderer, SDL_GPURenderState *state);
2900
2901/**
2902 * Destroy custom GPU render state.
2903 *
2904 * \param state the state to destroy.
2905 *
2906 * \threadsafety This function should be called on the thread that created the
2907 * renderer.
2908 *
2909 * \since This function is available since SDL 3.4.0.
2910 *
2911 * \sa SDL_CreateGPURenderState
2912 */
2913extern SDL_DECLSPEC void SDLCALL SDL_DestroyGPURenderState(SDL_GPURenderState *state);
2914
2915/* Ends C function definitions when using C++ */
2916#ifdef __cplusplus
2917}
2918#endif
2919#include <SDL3/SDL_close_code.h>
2920
2921#endif /* SDL_render_h_ */
Uint32 SDL_BlendMode
Uint32 SDL_GPUShaderFormat
Definition SDL_gpu.h:1016
struct SDL_GPUTexture SDL_GPUTexture
Definition SDL_gpu.h:458
struct SDL_GPUBuffer SDL_GPUBuffer
Definition SDL_gpu.h:420
struct SDL_GPUShader SDL_GPUShader
Definition SDL_gpu.h:481
struct SDL_GPUDevice SDL_GPUDevice
Definition SDL_gpu.h:396
SDL_PixelFormat
Definition SDL_pixels.h:549
Uint32 SDL_PropertiesID
void SDL_DestroyTexture(SDL_Texture *texture)
bool SDL_GetTextureAlphaMod(SDL_Texture *texture, Uint8 *alpha)
bool SDL_SetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode blendMode)
bool SDL_GetRenderScale(SDL_Renderer *renderer, float *scaleX, float *scaleY)
bool SDL_GetRenderViewport(SDL_Renderer *renderer, SDL_Rect *rect)
bool SDL_RenderPresent(SDL_Renderer *renderer)
bool SDL_RenderTexture9Grid(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, const SDL_FRect *dstrect)
bool SDL_SetRenderViewport(SDL_Renderer *renderer, const SDL_Rect *rect)
bool SDL_UpdateNVTexture(SDL_Texture *texture, const SDL_Rect *rect, const Uint8 *Yplane, int Ypitch, const Uint8 *UVplane, int UVpitch)
bool SDL_RenderGeometry(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_Vertex *vertices, int num_vertices, const int *indices, int num_indices)
bool SDL_RenderFillRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count)
SDL_Texture * SDL_CreateTextureWithProperties(SDL_Renderer *renderer, SDL_PropertiesID props)
bool SDL_ConvertEventToRenderCoordinates(SDL_Renderer *renderer, SDL_Event *event)
SDL_Window * SDL_GetRenderWindow(SDL_Renderer *renderer)
bool SDL_SetRenderScale(SDL_Renderer *renderer, float scaleX, float scaleY)
bool SDL_GetTextureSize(SDL_Texture *texture, float *w, float *h)
bool SDL_GetRenderLogicalPresentationRect(SDL_Renderer *renderer, SDL_FRect *rect)
bool SDL_SetRenderLogicalPresentation(SDL_Renderer *renderer, int w, int h, SDL_RendererLogicalPresentation mode)
void SDL_DestroyRenderer(SDL_Renderer *renderer)
bool SDL_SetRenderDrawColorFloat(SDL_Renderer *renderer, float r, float g, float b, float a)
void SDL_UnlockTexture(SDL_Texture *texture)
bool SDL_SetRenderTarget(SDL_Renderer *renderer, SDL_Texture *texture)
bool SDL_RenderDebugText(SDL_Renderer *renderer, float x, float y, const char *str)
bool SDL_GetTextureBlendMode(SDL_Texture *texture, SDL_BlendMode *blendMode)
bool SDL_SetRenderTextureAddressMode(SDL_Renderer *renderer, SDL_TextureAddressMode u_mode, SDL_TextureAddressMode v_mode)
SDL_Surface * SDL_RenderReadPixels(SDL_Renderer *renderer, const SDL_Rect *rect)
int SDL_GetNumRenderDrivers(void)
bool SDL_SetGPURenderStateFragmentUniforms(SDL_GPURenderState *state, Uint32 slot_index, const void *data, Uint32 length)
bool SDL_CreateWindowAndRenderer(const char *title, int width, int height, SDL_WindowFlags window_flags, SDL_Window **window, SDL_Renderer **renderer)
bool SDL_LockTexture(SDL_Texture *texture, const SDL_Rect *rect, void **pixels, int *pitch)
SDL_Renderer * SDL_CreateRendererWithProperties(SDL_PropertiesID props)
bool SDL_RenderLines(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
bool SDL_GetDefaultTextureScaleMode(SDL_Renderer *renderer, SDL_ScaleMode *scale_mode)
bool SDL_RenderTexture9GridTiled(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float left_width, float right_width, float top_height, float bottom_height, float scale, const SDL_FRect *dstrect, float tileScale)
bool SDL_RenderRect(SDL_Renderer *renderer, const SDL_FRect *rect)
SDL_TextureAddressMode
Definition SDL_render.h:109
@ SDL_TEXTURE_ADDRESS_INVALID
Definition SDL_render.h:110
@ SDL_TEXTURE_ADDRESS_WRAP
Definition SDL_render.h:113
@ SDL_TEXTURE_ADDRESS_CLAMP
Definition SDL_render.h:112
@ SDL_TEXTURE_ADDRESS_AUTO
Definition SDL_render.h:111
bool SDL_SetTextureColorModFloat(SDL_Texture *texture, float r, float g, float b)
bool SDL_GetRenderTextureAddressMode(SDL_Renderer *renderer, SDL_TextureAddressMode *u_mode, SDL_TextureAddressMode *v_mode)
bool SDL_GetRenderClipRect(SDL_Renderer *renderer, SDL_Rect *rect)
bool SDL_GetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode *blendMode)
bool SDL_GetTextureAlphaModFloat(SDL_Texture *texture, float *alpha)
bool SDL_SetTextureColorMod(SDL_Texture *texture, Uint8 r, Uint8 g, Uint8 b)
SDL_GPURenderState * SDL_CreateGPURenderState(SDL_Renderer *renderer, SDL_GPURenderStateCreateInfo *createinfo)
SDL_Texture * SDL_CreateTexture(SDL_Renderer *renderer, SDL_PixelFormat format, SDL_TextureAccess access, int w, int h)
bool SDL_SetRenderClipRect(SDL_Renderer *renderer, const SDL_Rect *rect)
bool SDL_GetCurrentRenderOutputSize(SDL_Renderer *renderer, int *w, int *h)
bool SDL_GetRenderDrawColor(SDL_Renderer *renderer, Uint8 *r, Uint8 *g, Uint8 *b, Uint8 *a)
SDL_Texture * SDL_CreateTextureFromSurface(SDL_Renderer *renderer, SDL_Surface *surface)
bool SDL_SetRenderDrawBlendMode(SDL_Renderer *renderer, SDL_BlendMode blendMode)
bool SDL_RenderLine(SDL_Renderer *renderer, float x1, float y1, float x2, float y2)
SDL_Renderer * SDL_GetRendererFromTexture(SDL_Texture *texture)
SDL_Renderer * SDL_CreateRenderer(SDL_Window *window, const char *name)
SDL_TextureAccess
Definition SDL_render.h:95
@ SDL_TEXTUREACCESS_STATIC
Definition SDL_render.h:96
@ SDL_TEXTUREACCESS_STREAMING
Definition SDL_render.h:97
@ SDL_TEXTUREACCESS_TARGET
Definition SDL_render.h:98
bool SDL_FlushRenderer(SDL_Renderer *renderer)
bool SDL_RenderCoordinatesToWindow(SDL_Renderer *renderer, float x, float y, float *window_x, float *window_y)
bool SDL_GetTextureColorMod(SDL_Texture *texture, Uint8 *r, Uint8 *g, Uint8 *b)
bool SDL_GetRenderSafeArea(SDL_Renderer *renderer, SDL_Rect *rect)
SDL_Renderer * SDL_CreateSoftwareRenderer(SDL_Surface *surface)
bool SDL_SetDefaultTextureScaleMode(SDL_Renderer *renderer, SDL_ScaleMode scale_mode)
bool SDL_GetRenderOutputSize(SDL_Renderer *renderer, int *w, int *h)
bool SDL_RenderClear(SDL_Renderer *renderer)
void * SDL_GetRenderMetalLayer(SDL_Renderer *renderer)
bool SDL_RenderViewportSet(SDL_Renderer *renderer)
bool SDL_GetRenderLogicalPresentation(SDL_Renderer *renderer, int *w, int *h, SDL_RendererLogicalPresentation *mode)
bool SDL_RenderRects(SDL_Renderer *renderer, const SDL_FRect *rects, int count)
SDL_RendererLogicalPresentation
Definition SDL_render.h:122
@ SDL_LOGICAL_PRESENTATION_LETTERBOX
Definition SDL_render.h:125
@ SDL_LOGICAL_PRESENTATION_DISABLED
Definition SDL_render.h:123
@ SDL_LOGICAL_PRESENTATION_OVERSCAN
Definition SDL_render.h:126
@ SDL_LOGICAL_PRESENTATION_STRETCH
Definition SDL_render.h:124
@ SDL_LOGICAL_PRESENTATION_INTEGER_SCALE
Definition SDL_render.h:127
SDL_Renderer * SDL_CreateGPURenderer(SDL_Window *window, SDL_GPUShaderFormat format_flags, SDL_GPUDevice **device)
bool SDL_RenderPoint(SDL_Renderer *renderer, float x, float y)
bool SDL_SetRenderVSync(SDL_Renderer *renderer, int vsync)
SDL_PropertiesID SDL_GetTextureProperties(SDL_Texture *texture)
SDL_Renderer * SDL_GetRenderer(SDL_Window *window)
bool SDL_RenderClipEnabled(SDL_Renderer *renderer)
const char * SDL_GetRenderDriver(int index)
void * SDL_GetRenderMetalCommandEncoder(SDL_Renderer *renderer)
struct SDL_Renderer SDL_Renderer
Definition SDL_render.h:135
bool SDL_SetRenderDrawColor(SDL_Renderer *renderer, Uint8 r, Uint8 g, Uint8 b, Uint8 a)
bool SDL_RenderTextureTiled(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, float scale, const SDL_FRect *dstrect)
SDL_PropertiesID SDL_GetRendererProperties(SDL_Renderer *renderer)
bool SDL_GetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode *scaleMode)
bool SDL_RenderFillRect(SDL_Renderer *renderer, const SDL_FRect *rect)
SDL_Texture * SDL_GetRenderTarget(SDL_Renderer *renderer)
bool SDL_UpdateYUVTexture(SDL_Texture *texture, const SDL_Rect *rect, const Uint8 *Yplane, int Ypitch, const Uint8 *Uplane, int Upitch, const Uint8 *Vplane, int Vpitch)
bool SDL_SetTextureAlphaMod(SDL_Texture *texture, Uint8 alpha)
bool SDL_RenderPoints(SDL_Renderer *renderer, const SDL_FPoint *points, int count)
bool SDL_AddVulkanRenderSemaphores(SDL_Renderer *renderer, Uint32 wait_stage_mask, Sint64 wait_semaphore, Sint64 signal_semaphore)
bool SDL_SetTextureAlphaModFloat(SDL_Texture *texture, float alpha)
bool SDL_UpdateTexture(SDL_Texture *texture, const SDL_Rect *rect, const void *pixels, int pitch)
bool SDL_LockTextureToSurface(SDL_Texture *texture, const SDL_Rect *rect, SDL_Surface **surface)
bool SDL_RenderTexture(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect)
bool SDL_RenderCoordinatesFromWindow(SDL_Renderer *renderer, float window_x, float window_y, float *x, float *y)
bool SDL_SetRenderColorScale(SDL_Renderer *renderer, float scale)
bool SDL_GetRenderVSync(SDL_Renderer *renderer, int *vsync)
bool SDL_GetRenderDrawColorFloat(SDL_Renderer *renderer, float *r, float *g, float *b, float *a)
bool SDL_SetRenderGPUState(SDL_Renderer *renderer, SDL_GPURenderState *state)
struct SDL_GPURenderState SDL_GPURenderState
bool SDL_GetRenderColorScale(SDL_Renderer *renderer, float *scale)
bool SDL_GetTextureColorModFloat(SDL_Texture *texture, float *r, float *g, float *b)
void SDL_DestroyGPURenderState(SDL_GPURenderState *state)
bool SDL_RenderTextureRotated(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FRect *dstrect, double angle, const SDL_FPoint *center, SDL_FlipMode flip)
const char * SDL_GetRendererName(SDL_Renderer *renderer)
bool SDL_RenderDebugTextFormat(SDL_Renderer *renderer, float x, float y, SDL_PRINTF_FORMAT_STRING const char *fmt,...) SDL_PRINTF_VARARG_FUNC(4)
bool SDL_RenderGeometryRaw(SDL_Renderer *renderer, SDL_Texture *texture, const float *xy, int xy_stride, const SDL_FColor *color, int color_stride, const float *uv, int uv_stride, int num_vertices, const void *indices, int num_indices, int size_indices)
bool SDL_RenderTextureAffine(SDL_Renderer *renderer, SDL_Texture *texture, const SDL_FRect *srcrect, const SDL_FPoint *origin, const SDL_FPoint *right, const SDL_FPoint *down)
bool SDL_SetTextureScaleMode(SDL_Texture *texture, SDL_ScaleMode scaleMode)
uint8_t Uint8
Definition SDL_stdinc.h:445
int64_t Sint64
Definition SDL_stdinc.h:492
int32_t Sint32
Definition SDL_stdinc.h:472
#define SDL_PRINTF_FORMAT_STRING
#define SDL_PRINTF_VARARG_FUNC(fmtargnumber)
uint32_t Uint32
Definition SDL_stdinc.h:481
SDL_ScaleMode
Definition SDL_surface.h:85
SDL_FlipMode
Definition SDL_surface.h:98
struct SDL_Window SDL_Window
Definition SDL_video.h:173
Uint64 SDL_WindowFlags
Definition SDL_video.h:193
static SDL_Renderer * renderer
Definition hello.c:17
static SDL_Window * window
Definition hello.c:16
SDL_GPUShader * fragment_shader
SDL_GPUTexture *const * storage_textures
SDL_GPUBuffer *const * storage_buffers
const SDL_GPUTextureSamplerBinding * sampler_bindings
SDL_PixelFormat format
Definition SDL_render.h:151
SDL_FPoint tex_coord
Definition SDL_render.h:86
SDL_FPoint position
Definition SDL_render.h:84
SDL_FColor color
Definition SDL_render.h:85