2 #include "SDL_platform.h"
8 #define __func__ __FUNCTION__
11 #define MAX_ACTIVE_RENDERERS 20
12 #define MAX_REGISTERED_RENDERERS 10
47 if(rendererMap[i] != NULL)
63 if(rendererMap[i] != NULL)
65 renderers_array[
count] = rendererMap[
i]->
id;
100 renderers_array[
count] = rendererRegister[
i].
id;
112 return rendererRegister[
index].
id;
135 #ifndef SDL_GPU_DISABLE_OPENGL
136 #ifndef SDL_GPU_DISABLE_OPENGL_1_BASE
146 #ifndef SDL_GPU_DISABLE_OPENGL_1
156 #ifndef SDL_GPU_DISABLE_OPENGL_2
166 #ifndef SDL_GPU_DISABLE_OPENGL_3
177 #ifndef SDL_GPU_DISABLE_GLES
178 #ifndef SDL_GPU_DISABLE_GLES_1
187 #ifndef SDL_GPU_DISABLE_GLES_2
216 rendererRegister[
i].
freeFn = NULL;
220 rendererMap[
i] = NULL;
233 if(order_size != NULL)
272 #if defined(__ANDROID__) || defined(__IPHONEOS__)
281 if(order_size != NULL)
284 if(order != NULL && count > 0)
291 return "OpenGL 1 BASE";
301 return "OpenGLES 1.x";
303 return "OpenGLES 2.x";
305 return "OpenGLES 3.x";
309 return "Direct3D 10";
311 return "Direct3D 11";
326 if(
id.
id == rendererRegister[i].
id.
id)
328 if(rendererRegister[i].createFn != NULL)
330 result = rendererRegister[
i].
createFn(
id);
349 return rendererMap[
index];
369 if(rendererMap[i] == NULL)
380 rendererMap[
i] = renderer;
398 if(renderer->
id.
id == rendererRegister[i].
id.
id)
400 rendererRegister[
i].
freeFn(renderer);
412 if(rendererMap[i] == NULL)
415 if(i ==
id.
index &&
id.
id == rendererMap[i]->
id.
id)
418 rendererMap[
i] = NULL;
static int renderer_order_size
void GPU_GetActiveRendererList(GPU_RendererID *renderers_array)
GPU_Renderer * GPU_CreateRenderer(GPU_RendererID id)
static const GPU_RendererEnum GPU_RENDERER_OPENGL_2
GLuint GLdouble GLdouble GLint GLint order
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
static const GPU_RendererEnum GPU_RENDERER_D3D9
void GPU_InitRendererRegister(void)
void GPU_RemoveRenderer(GPU_RendererID id)
GPU_RendererID GPU_MakeRendererID(GPU_RendererEnum id, int major_version, int minor_version)
static const GPU_RendererEnum GPU_RENDERER_D3D11
GPU_Renderer * GPU_GetRendererByID(GPU_RendererID id)
void GPU_PushErrorCode(const char *function, GPU_ErrorEnum error, const char *details,...)
void GPU_FreeRenderer_GLES_1(GPU_Renderer *renderer)
void GPU_FreeRenderer_OpenGL_2(GPU_Renderer *renderer)
void GPU_FreeRenderer_OpenGL_1_BASE(GPU_Renderer *renderer)
static const GPU_RendererEnum GPU_RENDERER_GLES_3
void(* freeFn)(GPU_Renderer *)
void GPU_FreeRenderer_OpenGL_3(GPU_Renderer *renderer)
static const GPU_RendererEnum GPU_RENDERER_GLES_1
#define GPU_RENDERER_ORDER_MAX
static const GPU_RendererEnum GPU_RENDERER_OPENGL_4
GPU_Renderer * GPU_GetRenderer(unsigned int index)
struct RendererRegistration RendererRegistration
void GPU_RegisterRenderers()
GLuint GLuint GLsizei count
GPU_Renderer * GPU_CreateRenderer_GLES_1(GPU_RendererID request)
#define MAX_ACTIVE_RENDERERS
GPU_Renderer * GPU_CreateRenderer_OpenGL_1(GPU_RendererID request)
static const GPU_RendererEnum GPU_RENDERER_OPENGL_3
void GPU_GetRegisteredRendererList(GPU_RendererID *renderers_array)
static const GPU_RendererEnum GPU_RENDERER_OPENGL_1
GPU_RendererID GPU_GetRendererID(unsigned int index)
void GPU_FreeRenderer(GPU_Renderer *renderer)
static const GPU_RendererEnum GPU_RENDERER_UNKNOWN
int GPU_GetNumRegisteredRenderers(void)
#define MAX_REGISTERED_RENDERERS
void GPU_FreeRenderer_GLES_2(GPU_Renderer *renderer)
static const GPU_RendererEnum GPU_RENDERER_D3D10
GLdouble GLdouble GLdouble r
static const GPU_RendererEnum GPU_RENDERER_GLES_2
static const GPU_RendererEnum GPU_RENDERER_OPENGL_1_BASE
static GPU_RendererID makeRendererID(GPU_RendererEnum id, int major_version, int minor_version, int index)
GPU_Renderer * GPU_CreateRenderer_OpenGL_1_BASE(GPU_RendererID request)
GPU_Renderer * GPU_CreateRenderer_GLES_2(GPU_RendererID request)
static GPU_Renderer * rendererMap[MAX_ACTIVE_RENDERERS]
GPU_Renderer * GPU_AddRenderer(GPU_RendererID id)
void GPU_GetDefaultRendererOrder(int *order_size, GPU_RendererID *order)
GPU_Renderer *(* createFn)(GPU_RendererID request)
void GPU_FreeRenderer_OpenGL_1(GPU_Renderer *renderer)
int GPU_GetNumActiveRenderers(void)
const char * GPU_GetRendererEnumString(GPU_RendererEnum id)
GPU_Renderer * GPU_CreateRenderer_OpenGL_3(GPU_RendererID request)
static GPU_RendererID renderer_order[GPU_RENDERER_ORDER_MAX]
void GPU_GetRendererOrder(int *order_size, GPU_RendererID *order)
static RendererRegistration rendererRegister[MAX_REGISTERED_RENDERERS]
GPU_Renderer * GPU_CreateRenderer_OpenGL_2(GPU_RendererID request)
void GPU_SetRendererOrder(int order_size, GPU_RendererID *order)