Added support for OpenGL ES renderer
--HG-- extra : convert_revision : svn%3Ac70aab31-4412-0410-b14c-859654838e24/trunk%403198
This commit is contained in:
parent
a2abb3b66b
commit
6367fbe6e0
1 changed files with 50 additions and 3 deletions
|
@ -28,10 +28,15 @@
|
||||||
#include "SDL_blit.h"
|
#include "SDL_blit.h"
|
||||||
#include "SDL_pixels_c.h"
|
#include "SDL_pixels_c.h"
|
||||||
#include "SDL_renderer_gl.h"
|
#include "SDL_renderer_gl.h"
|
||||||
|
#include "SDL_renderer_gles.h"
|
||||||
#include "SDL_renderer_sw.h"
|
#include "SDL_renderer_sw.h"
|
||||||
#include "../events/SDL_sysevents.h"
|
#include "../events/SDL_sysevents.h"
|
||||||
#include "../events/SDL_events_c.h"
|
#include "../events/SDL_events_c.h"
|
||||||
|
|
||||||
|
#if SDL_VIDEO_OPENGL_ES
|
||||||
|
#include "SDL_opengles.h"
|
||||||
|
#endif /* SDL_VIDEO_OPENGL_ES */
|
||||||
|
|
||||||
#if SDL_VIDEO_OPENGL
|
#if SDL_VIDEO_OPENGL
|
||||||
#include "SDL_opengl.h"
|
#include "SDL_opengl.h"
|
||||||
|
|
||||||
|
@ -106,6 +111,9 @@ static VideoBootStrap *bootstrap[] = {
|
||||||
#if SDL_VIDEO_DRIVER_NDS
|
#if SDL_VIDEO_DRIVER_NDS
|
||||||
&NDS_bootstrap,
|
&NDS_bootstrap,
|
||||||
#endif
|
#endif
|
||||||
|
#if SDL_VIDEO_DRIVER_UIKIT
|
||||||
|
&UIKIT_bootstrap,
|
||||||
|
#endif
|
||||||
#if SDL_VIDEO_DRIVER_DUMMY
|
#if SDL_VIDEO_DRIVER_DUMMY
|
||||||
&DUMMY_bootstrap,
|
&DUMMY_bootstrap,
|
||||||
#endif
|
#endif
|
||||||
|
@ -244,6 +252,7 @@ SDL_VideoInit(const char *driver_name, Uint32 flags)
|
||||||
_this->gl_config.stereo = 0;
|
_this->gl_config.stereo = 0;
|
||||||
_this->gl_config.multisamplebuffers = 0;
|
_this->gl_config.multisamplebuffers = 0;
|
||||||
_this->gl_config.multisamplesamples = 0;
|
_this->gl_config.multisamplesamples = 0;
|
||||||
|
_this->gl_config.retained_backing = 1;
|
||||||
_this->gl_config.accelerated = -1; /* not known, don't set */
|
_this->gl_config.accelerated = -1; /* not known, don't set */
|
||||||
|
|
||||||
/* Initialize the video subsystem */
|
/* Initialize the video subsystem */
|
||||||
|
@ -262,6 +271,10 @@ SDL_VideoInit(const char *driver_name, Uint32 flags)
|
||||||
#if SDL_VIDEO_RENDER_OGL
|
#if SDL_VIDEO_RENDER_OGL
|
||||||
SDL_AddRenderDriver(i, &GL_RenderDriver);
|
SDL_AddRenderDriver(i, &GL_RenderDriver);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if SDL_VIDEO_RENDER_OGL_ES
|
||||||
|
SDL_AddRenderDriver(i, &GL_ES_RenderDriver);
|
||||||
|
#endif
|
||||||
if (_this->displays[i].num_render_drivers > 0) {
|
if (_this->displays[i].num_render_drivers > 0) {
|
||||||
SDL_AddRenderDriver(i, &SW_RenderDriver);
|
SDL_AddRenderDriver(i, &SW_RenderDriver);
|
||||||
}
|
}
|
||||||
|
@ -2202,7 +2215,7 @@ SDL_GL_GetProcAddress(const char *proc)
|
||||||
SDL_bool
|
SDL_bool
|
||||||
SDL_GL_ExtensionSupported(const char *extension)
|
SDL_GL_ExtensionSupported(const char *extension)
|
||||||
{
|
{
|
||||||
#if SDL_VIDEO_OPENGL
|
#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES
|
||||||
const GLubyte *(APIENTRY * glGetStringFunc) (GLenum);
|
const GLubyte *(APIENTRY * glGetStringFunc) (GLenum);
|
||||||
const char *extensions;
|
const char *extensions;
|
||||||
const char *start;
|
const char *start;
|
||||||
|
@ -2256,7 +2269,7 @@ SDL_GL_ExtensionSupported(const char *extension)
|
||||||
int
|
int
|
||||||
SDL_GL_SetAttribute(SDL_GLattr attr, int value)
|
SDL_GL_SetAttribute(SDL_GLattr attr, int value)
|
||||||
{
|
{
|
||||||
#if SDL_VIDEO_OPENGL
|
#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES
|
||||||
int retval;
|
int retval;
|
||||||
|
|
||||||
if (!_this) {
|
if (!_this) {
|
||||||
|
@ -2313,6 +2326,9 @@ SDL_GL_SetAttribute(SDL_GLattr attr, int value)
|
||||||
case SDL_GL_ACCELERATED_VISUAL:
|
case SDL_GL_ACCELERATED_VISUAL:
|
||||||
_this->gl_config.accelerated = value;
|
_this->gl_config.accelerated = value;
|
||||||
break;
|
break;
|
||||||
|
case SDL_GL_RETAINED_BACKING:
|
||||||
|
_this->gl_config.retained_backing = value;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
SDL_SetError("Unknown OpenGL attribute");
|
SDL_SetError("Unknown OpenGL attribute");
|
||||||
retval = -1;
|
retval = -1;
|
||||||
|
@ -2328,7 +2344,7 @@ SDL_GL_SetAttribute(SDL_GLattr attr, int value)
|
||||||
int
|
int
|
||||||
SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
|
SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
|
||||||
{
|
{
|
||||||
#if SDL_VIDEO_OPENGL
|
#if SDL_VIDEO_OPENGL || SDL_VIDEO_OPENGL_ES
|
||||||
void (APIENTRY * glGetIntegervFunc) (GLenum pname, GLint * params);
|
void (APIENTRY * glGetIntegervFunc) (GLenum pname, GLint * params);
|
||||||
GLenum attrib = 0;
|
GLenum attrib = 0;
|
||||||
|
|
||||||
|
@ -2337,6 +2353,9 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
switch (attr) {
|
switch (attr) {
|
||||||
|
case SDL_GL_RETAINED_BACKING:
|
||||||
|
*value = _this->gl_config.retained_backing;
|
||||||
|
return 0;
|
||||||
case SDL_GL_RED_SIZE:
|
case SDL_GL_RED_SIZE:
|
||||||
attrib = GL_RED_BITS;
|
attrib = GL_RED_BITS;
|
||||||
break;
|
break;
|
||||||
|
@ -2350,14 +2369,24 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
|
||||||
attrib = GL_ALPHA_BITS;
|
attrib = GL_ALPHA_BITS;
|
||||||
break;
|
break;
|
||||||
case SDL_GL_DOUBLEBUFFER:
|
case SDL_GL_DOUBLEBUFFER:
|
||||||
|
#ifndef SDL_VIDEO_OPENGL_ES
|
||||||
attrib = GL_DOUBLEBUFFER;
|
attrib = GL_DOUBLEBUFFER;
|
||||||
break;
|
break;
|
||||||
|
#else
|
||||||
|
/*
|
||||||
|
* I believe double buffering is the only option in OpenGL ES
|
||||||
|
* -- in any case, GL_DOUBLEBUFFER doesn't exist
|
||||||
|
*/
|
||||||
|
*value = 1;
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
case SDL_GL_DEPTH_SIZE:
|
case SDL_GL_DEPTH_SIZE:
|
||||||
attrib = GL_DEPTH_BITS;
|
attrib = GL_DEPTH_BITS;
|
||||||
break;
|
break;
|
||||||
case SDL_GL_STENCIL_SIZE:
|
case SDL_GL_STENCIL_SIZE:
|
||||||
attrib = GL_STENCIL_BITS;
|
attrib = GL_STENCIL_BITS;
|
||||||
break;
|
break;
|
||||||
|
#ifndef SDL_VIDEO_OPENGL_ES
|
||||||
case SDL_GL_ACCUM_RED_SIZE:
|
case SDL_GL_ACCUM_RED_SIZE:
|
||||||
attrib = GL_ACCUM_RED_BITS;
|
attrib = GL_ACCUM_RED_BITS;
|
||||||
break;
|
break;
|
||||||
|
@ -2373,11 +2402,29 @@ SDL_GL_GetAttribute(SDL_GLattr attr, int *value)
|
||||||
case SDL_GL_STEREO:
|
case SDL_GL_STEREO:
|
||||||
attrib = GL_STEREO;
|
attrib = GL_STEREO;
|
||||||
break;
|
break;
|
||||||
|
#else
|
||||||
|
case SDL_GL_ACCUM_RED_SIZE:
|
||||||
|
case SDL_GL_ACCUM_GREEN_SIZE:
|
||||||
|
case SDL_GL_ACCUM_BLUE_SIZE:
|
||||||
|
case SDL_GL_ACCUM_ALPHA_SIZE:
|
||||||
|
case SDL_GL_STEREO:
|
||||||
|
/* none of these are supported in OpenGL ES */
|
||||||
|
*value = 0;
|
||||||
|
return 0;
|
||||||
|
#endif
|
||||||
case SDL_GL_MULTISAMPLEBUFFERS:
|
case SDL_GL_MULTISAMPLEBUFFERS:
|
||||||
|
#ifndef SDL_VIDEO_OPENGL_ES
|
||||||
attrib = GL_SAMPLE_BUFFERS_ARB;
|
attrib = GL_SAMPLE_BUFFERS_ARB;
|
||||||
|
#else
|
||||||
|
attrib = GL_SAMPLE_BUFFERS;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case SDL_GL_MULTISAMPLESAMPLES:
|
case SDL_GL_MULTISAMPLESAMPLES:
|
||||||
|
#ifndef SDL_VIDEO_OPENGL_ES
|
||||||
attrib = GL_SAMPLES_ARB;
|
attrib = GL_SAMPLES_ARB;
|
||||||
|
#else
|
||||||
|
attrib = GL_SAMPLES;
|
||||||
|
#endif
|
||||||
break;
|
break;
|
||||||
case SDL_GL_BUFFER_SIZE:
|
case SDL_GL_BUFFER_SIZE:
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue