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