SDL_GetRendererProperties(3)

๐Ÿ’– SDL_GetRendererProperties ๐Ÿ’–

okay so bestie, welcome to the SDL3 FUNCTIONS corner of the manual, and today's main character is SDL_GetRendererProperties โ€” she's the one who tells you literally everything the renderer is thinking. no cap.


โœจ NAME โœจ

SDL_GetRendererProperties โ€” get the properties associated with a renderer. that's it, that's the whole vibe. ๐ŸŽ€


๐ŸŒธ SYNOPSIS ๐ŸŒธ

#include <SDL3/SDL_render.h>

SDL_PropertiesID SDL_GetRendererProperties(SDL_Renderer *renderer);

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

so SDL hands you a whole lil gift bag of read-only properties, and here's the full inventory, no skipping, we're going through all of it:

  • SDL_PROP_RENDERER_NAME_STRING โ€” the name of the rendering driver ๐Ÿท๏ธ
  • SDL_PROP_RENDERER_WINDOW_POINTER โ€” the window where rendering is displayed, if any ๐ŸชŸ
  • SDL_PROP_RENDERER_SURFACE_POINTER โ€” the surface where rendering is displayed, if this is a software renderer without a window
  • SDL_PROP_RENDERER_VSYNC_NUMBER โ€” the current vsync setting ๐ŸงŠ
  • SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER โ€” the maximum texture width and height ๐Ÿ“
  • SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER โ€” a (const SDL_PixelFormat *) array of pixel formats, terminated with SDL_PIXELFORMAT_UNKNOWN, representing the available texture formats for this renderer. so like, a lil list that just... ends. iconic behavior honestly.
  • SDL_PROP_RENDERER_TEXTURE_WRAPPING_BOOLEAN โ€” true if the renderer supports SDL_TEXTURE_ADDRESS_WRAP on non-power-of-two textures. ๐Ÿ’ซ
  • SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER โ€” an SDL_Colorspace value describing the colorspace for output to the display, defaults to SDL_COLORSPACE_SRGB.
  • SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN โ€” true if the output colorspace is SDL_COLORSPACE_SRGB_LINEAR and the renderer is showing on a display with HDR enabled. bestie this one is shifty โ€” this property can change dynamically when SDL_EVENT_WINDOW_HDR_STATE_CHANGED is sent. keep an eye on her. ๐Ÿ‘€
  • SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT โ€” the value of SDR white in the SDL_COLORSPACE_SRGB_LINEAR colorspace. When HDR is enabled, this value is automatically multiplied into the color scale. This property can change dynamically when SDL_EVENT_WINDOW_HDR_STATE_CHANGED is sent. โœจ
  • SDL_PROP_RENDERER_HDR_HEADROOM_FLOAT โ€” the additional high dynamic range that can be displayed, in terms of the SDR white point. When HDR is not enabled, this will be 1.0. This property can change dynamically when SDL_EVENT_WINDOW_HDR_STATE_CHANGED is sent. ๐Ÿ”ฅ

๐ŸŽฎ With the direct3d renderer:

  • SDL_PROP_RENDERER_D3D9_DEVICE_POINTER โ€” the IDirect3DDevice9 associated with the renderer

๐ŸŽฎ With the direct3d11 renderer:

  • SDL_PROP_RENDERER_D3D11_DEVICE_POINTER โ€” the ID3D11Device associated with the renderer
  • SDL_PROP_RENDERER_D3D11_SWAPCHAIN_POINTER โ€” the IDXGISwapChain1 associated with the renderer. This may change when the window is resized. ๐Ÿ‘€

๐ŸŽฎ With the direct3d12 renderer:

  • SDL_PROP_RENDERER_D3D12_DEVICE_POINTER โ€” the ID3D12Device associated with the renderer
  • SDL_PROP_RENDERER_D3D12_SWAPCHAIN_POINTER โ€” the IDXGISwapChain4 associated with the renderer.
  • SDL_PROP_RENDERER_D3D12_COMMAND_QUEUE_POINTER โ€” the ID3D12CommandQueue associated with the renderer

๐ŸŽฎ With the vulkan renderer:

  • SDL_PROP_RENDERER_VULKAN_INSTANCE_POINTER โ€” the VkInstance associated with the renderer
  • SDL_PROP_RENDERER_VULKAN_SURFACE_NUMBER โ€” the VkSurfaceKHR associated with the renderer
  • SDL_PROP_RENDERER_VULKAN_PHYSICAL_DEVICE_POINTER โ€” the VkPhysicalDevice associated with the renderer
  • SDL_PROP_RENDERER_VULKAN_DEVICE_POINTER โ€” the VkDevice associated with the renderer
  • SDL_PROP_RENDERER_VULKAN_GRAPHICS_QUEUE_FAMILY_INDEX_NUMBER โ€” the queue family index used for rendering
  • SDL_PROP_RENDERER_VULKAN_PRESENT_QUEUE_FAMILY_INDEX_NUMBER โ€” the queue family index used for presentation
  • SDL_PROP_RENDERER_VULKAN_SWAPCHAIN_IMAGE_COUNT_NUMBER โ€” the number of swapchain images, or potential frames in flight, used by the Vulkan renderer ๐ŸŒˆ

๐ŸŽฎ With the gpu renderer:

  • SDL_PROP_RENDERER_GPU_DEVICE_POINTER โ€” the SDL_GPUDevice associated with the renderer

๐Ÿซถ FUNCTION PARAMETERS ๐Ÿซถ

  • renderer โ€” the rendering context. that's your girl right there ๐Ÿ’…

โญ RETURN VALUE โญ

Returns a valid property ID on success or 0 on failure; call SDL_GetError() for more information. so if you get a 0, bestie, go ask SDL_GetError() what's wrong, she always spills the tea. ๐Ÿ˜ญ


๐Ÿงš THREAD SAFETY ๐Ÿงš

It is safe to call this function from any thread. yes queen, thread-safe, go off from wherever you're standing ๐Ÿƒโ™€๏ธ๐Ÿ’จ


๐Ÿ‘‘ AVAILABILITY ๐Ÿ‘‘

This function is available since SDL 3.2.0. periodt.


๐Ÿ’œ SEE ALSO ๐Ÿ’œ

no extra reading list on this one bestie, this page is self-sufficient and honestly? that's the energy. ๐ŸŒŸ


and that's a wrap on the Simple Directmedia Layer docs, SDL 3.4.18 era, from the SDL3 FUNCTIONS crew ๐ŸŽ€ โ€” go forth and read your properties, you're doing amazing sweetie ๐Ÿ’–โœจ๐Ÿฆ‹

๐Ÿ“ฆ where this page comes from