SDL_gpu  0.11.0
A hardware-accelerated, cross-platform 2D graphics API
Data Structures | Typedefs
Initialization

Data Structures

struct  GPU_RendererID
 

Typedefs

typedef Uint32 GPU_FeatureEnum
 
typedef Uint32 GPU_InitFlagEnum
 
DECLSPEC SDL_version SDLCALL GPU_GetLinkedVersion (void)
 
DECLSPEC void SDLCALL GPU_SetInitWindow (Uint32 windowID)
 
DECLSPEC Uint32 SDLCALL GPU_GetInitWindow (void)
 
DECLSPEC void SDLCALL GPU_SetPreInitFlags (GPU_InitFlagEnum GPU_flags)
 
DECLSPEC GPU_InitFlagEnum SDLCALL GPU_GetPreInitFlags (void)
 
DECLSPEC void SDLCALL GPU_SetRequiredFeatures (GPU_FeatureEnum features)
 
DECLSPEC GPU_FeatureEnum SDLCALL GPU_GetRequiredFeatures (void)
 
DECLSPEC void SDLCALL GPU_GetDefaultRendererOrder (int *order_size, GPU_RendererID *order)
 
DECLSPEC void SDLCALL GPU_GetRendererOrder (int *order_size, GPU_RendererID *order)
 
DECLSPEC void SDLCALL GPU_SetRendererOrder (int order_size, GPU_RendererID *order)
 
DECLSPEC GPU_Target *SDLCALL GPU_Init (Uint16 w, Uint16 h, GPU_WindowFlagEnum SDL_flags)
 
DECLSPEC GPU_Target *SDLCALL GPU_InitRenderer (GPU_RendererEnum renderer_enum, Uint16 w, Uint16 h, GPU_WindowFlagEnum SDL_flags)
 
DECLSPEC GPU_Target *SDLCALL GPU_InitRendererByID (GPU_RendererID renderer_request, Uint16 w, Uint16 h, GPU_WindowFlagEnum SDL_flags)
 
DECLSPEC GPU_bool SDLCALL GPU_IsFeatureEnabled (GPU_FeatureEnum feature)
 
DECLSPEC void SDLCALL GPU_CloseCurrentRenderer (void)
 
DECLSPEC void SDLCALL GPU_Quit (void)
 

Detailed Description

SDL_gpu has a fairly simple initialization process. If you need nothing more than the default initialization, call:

GPU_Target* screen = GPU_Init(width, height, GPU_DEFAULT_INIT_FLAGS);

Then when you're done, clean up with:

GPU_Quit();

Other functions in the Initialization module control how initialization is performed.

Typedef Documentation

◆ GPU_FeatureEnum

typedef Uint32 GPU_FeatureEnum

Important GPU features which may not be supported depending on a device's extension support. Can be bitwise OR'd together.

See also
GPU_IsFeatureEnabled()
GPU_SetRequiredFeatures()

Definition at line 434 of file SDL_gpu.h.

◆ GPU_InitFlagEnum

typedef Uint32 GPU_InitFlagEnum

Initialization flags for changing default init parameters. Can be bitwise OR'ed together. Default (0) is to use late swap vsync and double buffering.

See also
GPU_SetPreInitFlags()
GPU_GetPreInitFlags()

Definition at line 466 of file SDL_gpu.h.

Function Documentation

◆ GPU_CloseCurrentRenderer()

DECLSPEC void SDLCALL GPU_CloseCurrentRenderer ( void  )

Clean up the renderer state.

Definition at line 633 of file SDL_gpu.c.

◆ GPU_GetDefaultRendererOrder()

DECLSPEC void SDLCALL GPU_GetDefaultRendererOrder ( int *  order_size,
GPU_RendererID order 
)

Gets the default initialization renderer IDs for the current platform copied into the 'order' array and the number of renderer IDs into 'order_size'. Pass NULL for 'order' to just get the size of the renderer order array. Will return at most GPU_RENDERER_ORDER_MAX renderers.

Definition at line 323 of file SDL_gpu_renderer.c.

◆ GPU_GetInitWindow()

DECLSPEC Uint32 SDLCALL GPU_GetInitWindow ( void  )

Returns the window ID that has been set via GPU_SetInitWindow().

Definition at line 215 of file SDL_gpu.c.

◆ GPU_GetLinkedVersion()

DECLSPEC SDL_version SDLCALL GPU_GetLinkedVersion ( void  )

Definition at line 76 of file SDL_gpu.c.

◆ GPU_GetPreInitFlags()

DECLSPEC GPU_InitFlagEnum SDLCALL GPU_GetPreInitFlags ( void  )

Returns the current special flags to use for initialization.

Definition at line 225 of file SDL_gpu.c.

◆ GPU_GetRendererOrder()

DECLSPEC void SDLCALL GPU_GetRendererOrder ( int *  order_size,
GPU_RendererID order 
)

Gets the current renderer ID order for initialization copied into the 'order' array and the number of renderer IDs into 'order_size'. Pass NULL for 'order' to just get the size of the renderer order array.

Definition at line 287 of file SDL_gpu_renderer.c.

◆ GPU_GetRequiredFeatures()

DECLSPEC GPU_FeatureEnum SDLCALL GPU_GetRequiredFeatures ( void  )

Returns the current required features to use for initialization.

Definition at line 235 of file SDL_gpu.c.

◆ GPU_Init()

DECLSPEC GPU_Target* SDLCALL GPU_Init ( Uint16  w,
Uint16  h,
GPU_WindowFlagEnum  SDL_flags 
)

Initializes SDL's video subsystem (if necessary) and all of SDL_gpu's internal structures. Chooses a renderer and creates a window with the given dimensions and window creation flags. A pointer to the resulting window's render target is returned.

Parameters
wDesired window width in pixels
hDesired window height in pixels
SDL_flagsThe bit flags to pass to SDL when creating the window. Use GPU_DEFAULT_INIT_FLAGS if you don't care.
Returns
On success, returns the new context target (i.e. render target backed by a window). On failure, returns NULL.

Initializes these systems: The 'error queue': Stores error codes and description strings. The 'renderer registry': An array of information about the supported renderers on the current platform, such as the renderer name and id and its life cycle functions. The SDL library and its video subsystem: Calls SDL_Init() if SDL has not already been initialized. Use SDL_InitSubsystem() to initialize more parts of SDL. The current renderer: Walks through each renderer in the renderer registry and tries to initialize them until one succeeds.

See also
GPU_RendererID
GPU_InitRenderer()
GPU_InitRendererByID()
GPU_SetRendererOrder()
GPU_PushErrorCode()

Definition at line 405 of file SDL_gpu.c.

◆ GPU_InitRenderer()

DECLSPEC GPU_Target* SDLCALL GPU_InitRenderer ( GPU_RendererEnum  renderer_enum,
Uint16  w,
Uint16  h,
GPU_WindowFlagEnum  SDL_flags 
)

Initializes SDL and SDL_gpu. Creates a window and the requested renderer context.

Definition at line 433 of file SDL_gpu.c.

◆ GPU_InitRendererByID()

DECLSPEC GPU_Target* SDLCALL GPU_InitRendererByID ( GPU_RendererID  renderer_request,
Uint16  w,
Uint16  h,
GPU_WindowFlagEnum  SDL_flags 
)

Initializes SDL and SDL_gpu. Creates a window and the requested renderer context. By requesting a renderer via ID, you can specify the major and minor versions of an individual renderer backend.

See also
GPU_MakeRendererID

Definition at line 439 of file SDL_gpu.c.

◆ GPU_IsFeatureEnabled()

DECLSPEC GPU_bool SDLCALL GPU_IsFeatureEnabled ( GPU_FeatureEnum  feature)

Checks for important GPU features which may not be supported depending on a device's extension support. Feature flags (GPU_FEATURE_*) can be bitwise OR'd together.

Returns
1 if all of the passed features are enabled/supported
0 if any of the passed features are disabled/unsupported

Definition at line 470 of file SDL_gpu.c.

◆ GPU_Quit()

DECLSPEC void SDLCALL GPU_Quit ( void  )

Clean up the renderer state and shut down SDL_gpu.

Definition at line 642 of file SDL_gpu.c.

◆ GPU_SetInitWindow()

DECLSPEC void SDLCALL GPU_SetInitWindow ( Uint32  windowID)

The window corresponding to 'windowID' will be used to create the rendering context instead of creating a new window.

Definition at line 210 of file SDL_gpu.c.

◆ GPU_SetPreInitFlags()

DECLSPEC void SDLCALL GPU_SetPreInitFlags ( GPU_InitFlagEnum  GPU_flags)

Set special flags to use for initialization. Set these before calling GPU_Init().

Parameters
GPU_flagsAn OR'ed combination of GPU_InitFlagEnum flags. Default flags (0) enable late swap vsync and double buffering.

Definition at line 220 of file SDL_gpu.c.

◆ GPU_SetRendererOrder()

DECLSPEC void SDLCALL GPU_SetRendererOrder ( int  order_size,
GPU_RendererID order 
)

Sets the renderer ID order to use for initialization. If 'order' is NULL, it will restore the default order.

Definition at line 296 of file SDL_gpu_renderer.c.

◆ GPU_SetRequiredFeatures()

DECLSPEC void SDLCALL GPU_SetRequiredFeatures ( GPU_FeatureEnum  features)

Set required features to use for initialization. Set these before calling GPU_Init().

Parameters
featuresAn OR'ed combination of GPU_FeatureEnum flags. Required features will force GPU_Init() to create a renderer that supports all of the given flags or else fail.

Definition at line 230 of file SDL_gpu.c.