The Battle for Wesnoth  1.13.4+dev
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Macros | Typedefs | Functions | Variables
SDL_gpu_Renderer.c File Reference
#include "SDL_gpu.h"
#include "SDL_platform.h"
#include <string.h>
#include <strings.h>
Include dependency graph for SDL_gpu_Renderer.c:

Go to the source code of this file.

Classes

struct  RendererRegistration
 

Macros

#define MAX_ACTIVE_RENDERERS   20
 
#define MAX_REGISTERED_RENDERERS   10
 

Typedefs

typedef struct RendererRegistration RendererRegistration
 

Functions

static GPU_RendererID makeRendererID (GPU_RendererEnum id, int major_version, int minor_version, int index)
 
void GPU_InitRendererRegister (void)
 
int GPU_GetNumActiveRenderers (void)
 
void GPU_GetActiveRendererList (GPU_RendererID *renderers_array)
 
int GPU_GetNumRegisteredRenderers (void)
 
void GPU_GetRegisteredRendererList (GPU_RendererID *renderers_array)
 
GPU_RendererID GPU_GetRendererID (unsigned int index)
 
GPU_RendererGPU_CreateRenderer_OpenGL_1_BASE (GPU_RendererID request)
 
void GPU_FreeRenderer_OpenGL_1_BASE (GPU_Renderer *renderer)
 
GPU_RendererGPU_CreateRenderer_OpenGL_1 (GPU_RendererID request)
 
void GPU_FreeRenderer_OpenGL_1 (GPU_Renderer *renderer)
 
GPU_RendererGPU_CreateRenderer_OpenGL_2 (GPU_RendererID request)
 
void GPU_FreeRenderer_OpenGL_2 (GPU_Renderer *renderer)
 
GPU_RendererGPU_CreateRenderer_OpenGL_3 (GPU_RendererID request)
 
void GPU_FreeRenderer_OpenGL_3 (GPU_Renderer *renderer)
 
GPU_RendererGPU_CreateRenderer_GLES_1 (GPU_RendererID request)
 
void GPU_FreeRenderer_GLES_1 (GPU_Renderer *renderer)
 
GPU_RendererGPU_CreateRenderer_GLES_2 (GPU_RendererID request)
 
void GPU_FreeRenderer_GLES_2 (GPU_Renderer *renderer)
 
void GPU_RegisterRenderers ()
 
void GPU_GetRendererOrder (int *order_size, GPU_RendererID *order)
 
void GPU_SetRendererOrder (int order_size, GPU_RendererID *order)
 
void GPU_GetDefaultRendererOrder (int *order_size, GPU_RendererID *order)
 
const char * GPU_GetRendererEnumString (GPU_RendererEnum id)
 
GPU_RendererGPU_CreateRenderer (GPU_RendererID id)
 
GPU_RendererGPU_GetRenderer (unsigned int index)
 
GPU_RendererGPU_GetRendererByID (GPU_RendererID id)
 
GPU_RendererGPU_AddRenderer (GPU_RendererID id)
 
void GPU_FreeRenderer (GPU_Renderer *renderer)
 
void GPU_RemoveRenderer (GPU_RendererID id)
 

Variables

static Uint8 initialized = 0
 
static GPU_RendererrendererMap [MAX_ACTIVE_RENDERERS]
 
static RendererRegistration rendererRegister [MAX_REGISTERED_RENDERERS]
 
static int renderer_order_size = 0
 
static GPU_RendererID renderer_order [GPU_RENDERER_ORDER_MAX]
 

Macro Definition Documentation

#define MAX_ACTIVE_RENDERERS   20
#define MAX_REGISTERED_RENDERERS   10

Typedef Documentation

Function Documentation

GPU_Renderer* GPU_AddRenderer ( GPU_RendererID  id)

Creates a new renderer matching the given identifier.

Definition at line 364 of file SDL_gpu_Renderer.c.

References GPU_CreateRenderer(), GPU_ERROR_BACKEND_ERROR, GPU_PushErrorCode(), i, GPU_Renderer::id, GPU_RendererID::index, and MAX_ACTIVE_RENDERERS.

Referenced by GPU_InitRendererByID().

GPU_Renderer* GPU_CreateRenderer ( GPU_RendererID  id)
GPU_Renderer* GPU_CreateRenderer_GLES_1 ( GPU_RendererID  request)
GPU_Renderer* GPU_CreateRenderer_GLES_2 ( GPU_RendererID  request)
GPU_Renderer* GPU_CreateRenderer_OpenGL_1 ( GPU_RendererID  request)
GPU_Renderer* GPU_CreateRenderer_OpenGL_1_BASE ( GPU_RendererID  request)
GPU_Renderer* GPU_CreateRenderer_OpenGL_2 ( GPU_RendererID  request)
GPU_Renderer* GPU_CreateRenderer_OpenGL_3 ( GPU_RendererID  request)
void GPU_FreeRenderer ( GPU_Renderer renderer)
void GPU_FreeRenderer_GLES_1 ( GPU_Renderer renderer)

Definition at line 44 of file SDL_gpu_GLES_1.c.

Referenced by GPU_RegisterRenderers().

void GPU_FreeRenderer_GLES_2 ( GPU_Renderer renderer)

Definition at line 44 of file SDL_gpu_GLES_2.c.

Referenced by GPU_RegisterRenderers().

void GPU_FreeRenderer_OpenGL_1 ( GPU_Renderer renderer)

Definition at line 43 of file SDL_gpu_OpenGL_1.c.

Referenced by GPU_RegisterRenderers().

void GPU_FreeRenderer_OpenGL_1_BASE ( GPU_Renderer renderer)

Definition at line 44 of file SDL_gpu_OpenGL_1_BASE.c.

Referenced by GPU_RegisterRenderers().

void GPU_FreeRenderer_OpenGL_2 ( GPU_Renderer renderer)

Definition at line 43 of file SDL_gpu_OpenGL_2.c.

Referenced by GPU_RegisterRenderers().

void GPU_FreeRenderer_OpenGL_3 ( GPU_Renderer renderer)

Definition at line 43 of file SDL_gpu_OpenGL_3.c.

Referenced by GPU_RegisterRenderers().

void GPU_GetActiveRendererList ( GPU_RendererID renderers_array)

Gets an array of identifiers for the active renderers.

Definition at line 53 of file SDL_gpu_Renderer.c.

References GPU_InitRendererRegister(), i, GPU_Renderer::id, and MAX_ACTIVE_RENDERERS.

void 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 267 of file SDL_gpu_Renderer.c.

References GPU_MakeRendererID(), GPU_RENDERER_GLES_1, GPU_RENDERER_GLES_2, GPU_RENDERER_OPENGL_1, GPU_RENDERER_OPENGL_2, GPU_RENDERER_OPENGL_3, and GPU_RENDERER_ORDER_MAX.

Referenced by GPU_InitRendererRegister(), and GPU_SetRendererOrder().

int GPU_GetNumActiveRenderers ( void  )

Gets the number of active (created) renderers.

Definition at line 37 of file SDL_gpu_Renderer.c.

References GPU_InitRendererRegister(), i, and MAX_ACTIVE_RENDERERS.

Referenced by GPU_Quit(), and init_SDL().

int GPU_GetNumRegisteredRenderers ( void  )

Gets the number of registered (available) renderers.

Definition at line 72 of file SDL_gpu_Renderer.c.

References GPU_InitRendererRegister(), GPU_RENDERER_UNKNOWN, i, and MAX_REGISTERED_RENDERERS.

void GPU_GetRegisteredRendererList ( GPU_RendererID renderers_array)

Gets an array of identifiers for the registered (available) renderers.

Definition at line 88 of file SDL_gpu_Renderer.c.

References GPU_InitRendererRegister(), GPU_RENDERER_UNKNOWN, i, RendererRegistration::id, and MAX_REGISTERED_RENDERERS.

GPU_Renderer* GPU_GetRenderer ( unsigned int  index)

Gets the renderer for the given renderer index.

Definition at line 344 of file SDL_gpu_Renderer.c.

References MAX_ACTIVE_RENDERERS.

Referenced by GPU_GetRendererByID().

GPU_Renderer* GPU_GetRendererByID ( GPU_RendererID  id)
Returns
The renderer matching the given identifier.

Definition at line 353 of file SDL_gpu_Renderer.c.

References GPU_GetRenderer(), and GPU_InitRendererRegister().

Referenced by GPU_SetCurrentRenderer().

const char* GPU_GetRendererEnumString ( GPU_RendererEnum  id)
GPU_RendererID GPU_GetRendererID ( unsigned int  index)

Gets the renderer identifier for the given registration index.

Definition at line 107 of file SDL_gpu_Renderer.c.

References GPU_RENDERER_UNKNOWN, RendererRegistration::id, makeRendererID(), and MAX_REGISTERED_RENDERERS.

void 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 231 of file SDL_gpu_Renderer.c.

References renderer_order_size.

Referenced by GPU_Init().

void GPU_InitRendererRegister ( void  )
void GPU_RegisterRenderers ( )
void GPU_RemoveRenderer ( GPU_RendererID  id)

Deletes the renderer matching the given identifier.

Definition at line 407 of file SDL_gpu_Renderer.c.

References GPU_FreeRenderer(), i, and MAX_ACTIVE_RENDERERS.

Referenced by GPU_CloseCurrentRenderer(), and GPU_Quit().

void 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 240 of file SDL_gpu_Renderer.c.

References GPU_ERROR_USER_ERROR, GPU_GetDefaultRendererOrder(), GPU_PushErrorCode(), GPU_RENDERER_ORDER_MAX, and renderer_order_size.

static GPU_RendererID makeRendererID ( GPU_RendererEnum  id,
int  major_version,
int  minor_version,
int  index 
)
static

Definition at line 28 of file SDL_gpu_Renderer.c.

Referenced by GPU_GetRendererID(), and GPU_RegisterRenderers().

Variable Documentation

Uint8 initialized = 0
static

Definition at line 21 of file SDL_gpu_Renderer.c.

Referenced by GPU_InitRendererRegister(), and toptions::singleton().

GPU_RendererID renderer_order[GPU_RENDERER_ORDER_MAX]
static

Definition at line 202 of file SDL_gpu_Renderer.c.

Referenced by GPU_Init().

int renderer_order_size = 0
static
GPU_Renderer* rendererMap[MAX_ACTIVE_RENDERERS]
static

Definition at line 23 of file SDL_gpu_Renderer.c.

Definition at line 24 of file SDL_gpu_Renderer.c.