Replaced SDL_GetRendererInfo() with SDL_GetRendererName()

The texture formats are available via the SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER property

Fixes https://github.com/libsdl-org/SDL/issues/9851
This commit is contained in:
Sam Lantinga 2024-06-03 19:26:43 -07:00
parent ca28bcb3b8
commit a0d1445ccb
23 changed files with 106 additions and 116 deletions
include/SDL3

View file

@ -70,18 +70,6 @@ extern "C" {
*/
#define SDL_SOFTWARE_RENDERER "software"
/**
* Information on the capabilities of a render driver or context.
*
* \since This struct is available since SDL 3.0.0.
*/
typedef struct SDL_RendererInfo
{
const char *name; /**< The name of the renderer */
int num_texture_formats; /**< The number of available texture formats */
const SDL_PixelFormatEnum *texture_formats; /**< The available texture formats */
} SDL_RendererInfo;
/**
* Vertex structure.
*
@ -225,7 +213,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_CreateWindowAndRenderer(const char *title, i
* \sa SDL_DestroyRenderer
* \sa SDL_GetNumRenderDrivers
* \sa SDL_GetRenderDriver
* \sa SDL_GetRendererInfo
* \sa SDL_GetRendererName
*/
extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window *window, const char *name);
@ -276,7 +264,7 @@ extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRenderer(SDL_Window *window
* \sa SDL_CreateRenderer
* \sa SDL_CreateSoftwareRenderer
* \sa SDL_DestroyRenderer
* \sa SDL_GetRendererInfo
* \sa SDL_GetRendererName
*/
extern SDL_DECLSPEC SDL_Renderer * SDLCALL SDL_CreateRendererWithProperties(SDL_PropertiesID props);
@ -334,20 +322,19 @@ extern SDL_DECLSPEC SDL_Renderer *SDLCALL SDL_GetRenderer(SDL_Window *window);
extern SDL_DECLSPEC SDL_Window *SDLCALL SDL_GetRenderWindow(SDL_Renderer *renderer);
/**
* Get information about a rendering context.
* Get the name of a renderer.
*
* The returned string follows the SDL_GetStringRule.
*
* \param renderer the rendering context
* \param info an SDL_RendererInfo structure filled with information about the
* current renderer
* \returns 0 on success or a negative error code on failure; call
* SDL_GetError() for more information.
* \returns the name of the selected renderer, or NULL if the renderer is invalid.
*
* \since This function is available since SDL 3.0.0.
*
* \sa SDL_CreateRenderer
* \sa SDL_CreateRendererWithProperties
*/
extern SDL_DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer *renderer, SDL_RendererInfo *info);
extern SDL_DECLSPEC const char *SDLCALL SDL_GetRendererName(SDL_Renderer *renderer);
/**
* Get the properties associated with a renderer.
@ -362,6 +349,7 @@ extern SDL_DECLSPEC int SDLCALL SDL_GetRendererInfo(SDL_Renderer *renderer, SDL_
* - `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_PixelFormatEnum *) array of pixel formats, terminated with SDL_PIXELFORMAT_UNKNOWN, representing the available texture formats for this renderer.
* - `SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER`: an SDL_ColorSpace value
* describing the colorspace for output to the display, defaults to
* SDL_COLORSPACE_SRGB.
@ -433,6 +421,7 @@ extern SDL_DECLSPEC SDL_PropertiesID SDLCALL SDL_GetRendererProperties(SDL_Rende
#define SDL_PROP_RENDERER_SURFACE_POINTER "SDL.renderer.surface"
#define SDL_PROP_RENDERER_VSYNC_NUMBER "SDL.renderer.vsync"
#define SDL_PROP_RENDERER_MAX_TEXTURE_SIZE_NUMBER "SDL.renderer.max_texture_size"
#define SDL_PROP_RENDERER_TEXTURE_FORMATS_POINTER "SDL.renderer.texture_formats"
#define SDL_PROP_RENDERER_OUTPUT_COLORSPACE_NUMBER "SDL.renderer.output_colorspace"
#define SDL_PROP_RENDERER_HDR_ENABLED_BOOLEAN "SDL.renderer.HDR_enabled"
#define SDL_PROP_RENDERER_SDR_WHITE_POINT_FLOAT "SDL.renderer.SDR_white_point"