include/SDL_config.h.in
author Sam Lantinga <slouken@libsdl.org>
Sun, 08 Jan 2012 02:23:37 -0500
changeset 6188 e82023802002
parent 6138 4c64952a58fb
permissions -rw-r--r--
Fixed bug 1242 - PATCH: Improve support for OpenGL ES under X11

Scott Percival 2011-07-03 06:41:51 PDT

This submission is aimed at making life easier for OpenGL ES capable devices
running a X11 stack (e.g. Maemo, Meego, TrimSlice, other ARM SoC boards not
running Android). SDL's Pandora support already has the neccesary GLES-to-X11
glue code, however it's all ghetto'd off in Makefile.pandora and not very
flexible.

The patch:
- adds an awesome --enable-video-opengles option to configure
- re-modifies the opengles and opengles2 SDL_renderers to use function pointers
- no idea why this was removed?
- for SDL_Renderers, links in libGLESv1_CM, libGLES_CM (for PowerVR fans) or
libGLESv2 at runtime
- links in libEGL.so at runtime - the old code made an assumption that
eglFunctions could be pulled from the active GLES library, PowerVR for one
doesn't let you do that with their libGLESv2
- allows you to pick which of GLES v1 or v2 to load via
SDL_GL_CONTEXT_MAJOR_VERSION

So far I've tested this on a Nokia N900 (OMAP 3430/SGX 530 running Maemo 5) and
a Toshiba AC100 (Tegra 2 running Ubuntu 10.10). I haven't tested it on... well,
everything that isn't those two, such as a Pandora, iOS or Android device. The
Pandora specific code should be kept intact (fingers crossed), and nothing
painfully drastic has been added to the SDL_renderers. The library loading
sequence in SDL_x11opengles has been updated to accomodate both NVIDIA's
propensity to let developers get away with murder and PowerVR's alternative of
punishing every missed step.

The test apps work okay with GLES or GLES2 as the renderer. For some reason
alpha blending doesn't seem to work on the Tegra 2; last week NVIDIA pushed out
a new set of X11 GLES drivers, so I'll try and investigate once I upgrade
those. Also, this patch adds things to configure.in, include/SDL_config.h.in
and test/configure.in. I didn't know what the policy was re. committing
generated spaghetti from autotools, so ./autogen.sh has to be run again. Sorry.

I think that's about everything, let me know if there's anything I've
overlooked.
slouken@1341
     1
/*
slouken@5535
     2
  Simple DirectMedia Layer
slouken@6138
     3
  Copyright (C) 1997-2012 Sam Lantinga <slouken@libsdl.org>
slouken@1341
     4
slouken@5535
     5
  This software is provided 'as-is', without any express or implied
slouken@5535
     6
  warranty.  In no event will the authors be held liable for any damages
slouken@5535
     7
  arising from the use of this software.
slouken@1341
     8
slouken@5535
     9
  Permission is granted to anyone to use this software for any purpose,
slouken@5535
    10
  including commercial applications, and to alter it and redistribute it
slouken@5535
    11
  freely, subject to the following restrictions:
slouken@1341
    12
slouken@5535
    13
  1. The origin of this software must not be misrepresented; you must not
slouken@5535
    14
     claim that you wrote the original software. If you use this software
slouken@5535
    15
     in a product, an acknowledgment in the product documentation would be
slouken@5535
    16
     appreciated but is not required.
slouken@5535
    17
  2. Altered source versions must be plainly marked as such, and must not be
slouken@5535
    18
     misrepresented as being the original software.
slouken@5535
    19
  3. This notice may not be removed or altered from any source distribution.
slouken@1341
    20
*/
slouken@1341
    21
slouken@1341
    22
#ifndef _SDL_config_h
slouken@1341
    23
#define _SDL_config_h
slouken@1341
    24
slouken@3407
    25
/**
slouken@3407
    26
 *  \file SDL_config.h.in
slouken@3407
    27
 *
slouken@3407
    28
 *  This is a set of defines to configure the SDL features
slouken@3407
    29
 */
slouken@1341
    30
slouken@1402
    31
/* General platform specific identifiers */
slouken@1402
    32
#include "SDL_platform.h"
slouken@1402
    33
slouken@2175
    34
/* Make sure that this isn't included by Visual C++ */
slouken@2175
    35
#ifdef _MSC_VER
slouken@5389
    36
#error You should run hg revert SDL_config.h 
slouken@2175
    37
#endif
slouken@2175
    38
slouken@1353
    39
/* C language features */
slouken@1353
    40
#undef const
slouken@1353
    41
#undef inline
slouken@1353
    42
#undef volatile
slouken@1352
    43
slouken@1353
    44
/* C datatypes */
bob@3180
    45
#undef SIZEOF_VOIDP
slouken@5004
    46
#undef HAVE_GCC_ATOMICS
slouken@5069
    47
#undef HAVE_GCC_SYNC_LOCK_TEST_AND_SET
nathanheisey@5557
    48
#undef HAVE_PTHREAD_SPINLOCK
slouken@1353
    49
slouken@1353
    50
/* Comment this if you want to build without any C library requirements */
slouken@1341
    51
#undef HAVE_LIBC
slouken@1402
    52
#if HAVE_LIBC
slouken@1341
    53
slouken@1353
    54
/* Useful headers */
slouken@1367
    55
#undef HAVE_ALLOCA_H
slouken@1353
    56
#undef HAVE_SYS_TYPES_H
slouken@1352
    57
#undef HAVE_STDIO_H
slouken@1353
    58
#undef STDC_HEADERS
slouken@1352
    59
#undef HAVE_STDLIB_H
slouken@1353
    60
#undef HAVE_STDARG_H
slouken@1352
    61
#undef HAVE_MALLOC_H
slouken@1353
    62
#undef HAVE_MEMORY_H
slouken@1352
    63
#undef HAVE_STRING_H
slouken@1353
    64
#undef HAVE_STRINGS_H
slouken@1353
    65
#undef HAVE_INTTYPES_H
slouken@1353
    66
#undef HAVE_STDINT_H
slouken@1352
    67
#undef HAVE_CTYPE_H
slouken@1361
    68
#undef HAVE_MATH_H
slouken@1501
    69
#undef HAVE_ICONV_H
slouken@1352
    70
#undef HAVE_SIGNAL_H
slouken@5389
    71
#undef HAVE_ALTIVEC_H
icculus@5969
    72
#undef HAVE_PTHREAD_NP_H
slouken@1341
    73
slouken@1353
    74
/* C library functions */
slouken@1352
    75
#undef HAVE_MALLOC
slouken@1352
    76
#undef HAVE_CALLOC
slouken@1352
    77
#undef HAVE_REALLOC
slouken@1352
    78
#undef HAVE_FREE
slouken@1352
    79
#undef HAVE_ALLOCA
slouken@5093
    80
#ifndef __WIN32__ /* Don't use C runtime versions of these on Windows */
slouken@1352
    81
#undef HAVE_GETENV
icculus@3581
    82
#undef HAVE_SETENV
slouken@1352
    83
#undef HAVE_PUTENV
slouken@1352
    84
#undef HAVE_UNSETENV
slouken@1352
    85
#endif
slouken@1352
    86
#undef HAVE_QSORT
slouken@1341
    87
#undef HAVE_ABS
slouken@1353
    88
#undef HAVE_BCOPY
slouken@1352
    89
#undef HAVE_MEMSET
slouken@1352
    90
#undef HAVE_MEMCPY
slouken@1352
    91
#undef HAVE_MEMMOVE
slouken@1352
    92
#undef HAVE_MEMCMP
slouken@1352
    93
#undef HAVE_STRLEN
slouken@1379
    94
#undef HAVE_STRLCPY
slouken@1379
    95
#undef HAVE_STRLCAT
slouken@1352
    96
#undef HAVE_STRDUP
slouken@1352
    97
#undef HAVE__STRREV
slouken@1352
    98
#undef HAVE__STRUPR
slouken@1352
    99
#undef HAVE__STRLWR
slouken@1353
   100
#undef HAVE_INDEX
slouken@1353
   101
#undef HAVE_RINDEX
slouken@1352
   102
#undef HAVE_STRCHR
slouken@1352
   103
#undef HAVE_STRRCHR
slouken@1352
   104
#undef HAVE_STRSTR
slouken@1352
   105
#undef HAVE_ITOA
slouken@1352
   106
#undef HAVE__LTOA
slouken@1352
   107
#undef HAVE__UITOA
slouken@1352
   108
#undef HAVE__ULTOA
slouken@1352
   109
#undef HAVE_STRTOL
slouken@1461
   110
#undef HAVE_STRTOUL
slouken@1352
   111
#undef HAVE__I64TOA
slouken@1352
   112
#undef HAVE__UI64TOA
slouken@1352
   113
#undef HAVE_STRTOLL
slouken@1461
   114
#undef HAVE_STRTOULL
slouken@1352
   115
#undef HAVE_STRTOD
slouken@1352
   116
#undef HAVE_ATOI
slouken@1341
   117
#undef HAVE_ATOF
slouken@1352
   118
#undef HAVE_STRCMP
slouken@1352
   119
#undef HAVE_STRNCMP
slouken@1510
   120
#undef HAVE__STRICMP
slouken@1352
   121
#undef HAVE_STRCASECMP
slouken@1512
   122
#undef HAVE__STRNICMP
slouken@1501
   123
#undef HAVE_STRNCASECMP
slouken@1352
   124
#undef HAVE_SSCANF
slouken@1341
   125
#undef HAVE_SNPRINTF
slouken@1341
   126
#undef HAVE_VSNPRINTF
slouken@3012
   127
#undef HAVE_M_PI
slouken@4873
   128
#undef HAVE_ATAN
slouken@4870
   129
#undef HAVE_ATAN2
slouken@3032
   130
#undef HAVE_CEIL
slouken@3012
   131
#undef HAVE_COPYSIGN
slouken@3012
   132
#undef HAVE_COS
slouken@3012
   133
#undef HAVE_COSF
slouken@3012
   134
#undef HAVE_FABS
slouken@3012
   135
#undef HAVE_FLOOR
slouken@3012
   136
#undef HAVE_LOG
slouken@3012
   137
#undef HAVE_POW
slouken@3012
   138
#undef HAVE_SCALBN
slouken@3012
   139
#undef HAVE_SIN
slouken@3012
   140
#undef HAVE_SINF
slouken@3012
   141
#undef HAVE_SQRT
slouken@1361
   142
#undef HAVE_SIGACTION
icculus@5577
   143
#undef HAVE_SA_SIGACTION
slouken@1361
   144
#undef HAVE_SETJMP
slouken@1361
   145
#undef HAVE_NANOSLEEP
slouken@3586
   146
#undef HAVE_SYSCONF
slouken@3579
   147
#undef HAVE_SYSCTLBYNAME
slouken@1361
   148
#undef HAVE_CLOCK_GETTIME
icculus@2093
   149
#undef HAVE_GETPAGESIZE
slouken@3405
   150
#undef HAVE_MPROTECT
slouken@5041
   151
#undef HAVE_ICONV
icculus@5969
   152
#undef HAVE_PTHREAD_SETNAME_NP
icculus@5969
   153
#undef HAVE_PTHREAD_SET_NAME_NP
slouken@1341
   154
slouken@1361
   155
#else
slouken@1361
   156
/* We may need some replacement for stdarg.h here */
slouken@1361
   157
#include <stdarg.h>
slouken@1341
   158
#endif /* HAVE_LIBC */
slouken@1341
   159
slouken@3647
   160
/* SDL internal assertion support */
slouken@3649
   161
#undef SDL_DEFAULT_ASSERT_LEVEL
slouken@3647
   162
slouken@1353
   163
/* Allow disabling of core subsystems */
slouken@5225
   164
#undef SDL_ATOMIC_DISABLED
slouken@1361
   165
#undef SDL_AUDIO_DISABLED
slouken@1361
   166
#undef SDL_CPUINFO_DISABLED
slouken@1361
   167
#undef SDL_EVENTS_DISABLED
slouken@1361
   168
#undef SDL_FILE_DISABLED
slouken@1361
   169
#undef SDL_JOYSTICK_DISABLED
slouken@2713
   170
#undef SDL_HAPTIC_DISABLED
slouken@1361
   171
#undef SDL_LOADSO_DISABLED
slouken@5226
   172
#undef SDL_RENDER_DISABLED
slouken@1361
   173
#undef SDL_THREADS_DISABLED
slouken@1361
   174
#undef SDL_TIMERS_DISABLED
slouken@1361
   175
#undef SDL_VIDEO_DISABLED
icculus@3170
   176
#undef SDL_POWER_DISABLED
slouken@1361
   177
slouken@1361
   178
/* Enable various audio drivers */
slouken@1361
   179
#undef SDL_AUDIO_DRIVER_ALSA
slouken@1361
   180
#undef SDL_AUDIO_DRIVER_ALSA_DYNAMIC
slouken@1361
   181
#undef SDL_AUDIO_DRIVER_ARTS
slouken@1361
   182
#undef SDL_AUDIO_DRIVER_ARTS_DYNAMIC
icculus@2271
   183
#undef SDL_AUDIO_DRIVER_PULSEAUDIO
icculus@2271
   184
#undef SDL_AUDIO_DRIVER_PULSEAUDIO_DYNAMIC
icculus@2049
   185
#undef SDL_AUDIO_DRIVER_BEOSAUDIO
slouken@1568
   186
#undef SDL_AUDIO_DRIVER_BSD
slouken@1361
   187
#undef SDL_AUDIO_DRIVER_COREAUDIO
slouken@1361
   188
#undef SDL_AUDIO_DRIVER_DISK
icculus@1532
   189
#undef SDL_AUDIO_DRIVER_DUMMY
icculus@5592
   190
#undef SDL_AUDIO_DRIVER_XAUDIO2
slouken@1361
   191
#undef SDL_AUDIO_DRIVER_DSOUND
slouken@1361
   192
#undef SDL_AUDIO_DRIVER_ESD
slouken@1361
   193
#undef SDL_AUDIO_DRIVER_ESD_DYNAMIC
slouken@1361
   194
#undef SDL_AUDIO_DRIVER_NAS
icculus@2049
   195
#undef SDL_AUDIO_DRIVER_NAS_DYNAMIC
slouken@2735
   196
#undef SDL_AUDIO_DRIVER_NDS
slouken@1361
   197
#undef SDL_AUDIO_DRIVER_OSS
slouken@1361
   198
#undef SDL_AUDIO_DRIVER_OSS_SOUNDCARD_H
icculus@2049
   199
#undef SDL_AUDIO_DRIVER_PAUDIO
slouken@3099
   200
#undef SDL_AUDIO_DRIVER_QSA
slouken@1361
   201
#undef SDL_AUDIO_DRIVER_SUNAUDIO
icculus@5588
   202
#undef SDL_AUDIO_DRIVER_WINMM
slouken@2947
   203
#undef SDL_AUDIO_DRIVER_FUSIONSOUND
slouken@2947
   204
#undef SDL_AUDIO_DRIVER_FUSIONSOUND_DYNAMIC
slouken@1361
   205
slouken@1361
   206
/* Enable various input drivers */
icculus@2276
   207
#undef SDL_INPUT_LINUXEV
slouken@1361
   208
#undef SDL_INPUT_TSLIB
slouken@1361
   209
#undef SDL_JOYSTICK_BEOS
slouken@1895
   210
#undef SDL_JOYSTICK_DINPUT
slouken@1361
   211
#undef SDL_JOYSTICK_DUMMY
slouken@1361
   212
#undef SDL_JOYSTICK_IOKIT
slouken@1361
   213
#undef SDL_JOYSTICK_LINUX
slouken@2735
   214
#undef SDL_JOYSTICK_NDS
slouken@1361
   215
#undef SDL_JOYSTICK_WINMM
slouken@1361
   216
#undef SDL_JOYSTICK_USBHID
slouken@1565
   217
#undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
slouken@2713
   218
#undef SDL_HAPTIC_DUMMY
slouken@2713
   219
#undef SDL_HAPTIC_LINUX
slouken@2713
   220
#undef SDL_HAPTIC_IOKIT
slouken@2713
   221
#undef SDL_HAPTIC_DINPUT
slouken@1361
   222
slouken@1361
   223
/* Enable various shared object loading systems */
slouken@1361
   224
#undef SDL_LOADSO_BEOS
slouken@1361
   225
#undef SDL_LOADSO_DLOPEN
slouken@1635
   226
#undef SDL_LOADSO_DUMMY
slouken@1361
   227
#undef SDL_LOADSO_LDG
slouken@5062
   228
#undef SDL_LOADSO_WINDOWS
slouken@1361
   229
slouken@1361
   230
/* Enable various threading systems */
slouken@1361
   231
#undef SDL_THREAD_BEOS
slouken@2735
   232
#undef SDL_THREAD_NDS
slouken@1361
   233
#undef SDL_THREAD_PTHREAD
slouken@1361
   234
#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX
slouken@1361
   235
#undef SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP
slouken@5062
   236
#undef SDL_THREAD_WINDOWS
slouken@1361
   237
slouken@1361
   238
/* Enable various timer systems */
slouken@1361
   239
#undef SDL_TIMER_BEOS
slouken@1635
   240
#undef SDL_TIMER_DUMMY
slouken@2735
   241
#undef SDL_TIMER_NDS
slouken@1361
   242
#undef SDL_TIMER_UNIX
slouken@5062
   243
#undef SDL_TIMER_WINDOWS
slouken@1361
   244
#undef SDL_TIMER_WINCE
slouken@1361
   245
slouken@1361
   246
/* Enable various video drivers */
slouken@1361
   247
#undef SDL_VIDEO_DRIVER_BWINDOW
slouken@1931
   248
#undef SDL_VIDEO_DRIVER_COCOA
slouken@1361
   249
#undef SDL_VIDEO_DRIVER_DIRECTFB
slouken@2998
   250
#undef SDL_VIDEO_DRIVER_DIRECTFB_DYNAMIC
slouken@1361
   251
#undef SDL_VIDEO_DRIVER_DUMMY
slouken@2735
   252
#undef SDL_VIDEO_DRIVER_NDS
slouken@5062
   253
#undef SDL_VIDEO_DRIVER_WINDOWS
slouken@1361
   254
#undef SDL_VIDEO_DRIVER_X11
slouken@1361
   255
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
slouken@1361
   256
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
slouken@5471
   257
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR
slouken@5408
   258
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINERAMA
slouken@5408
   259
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XINPUT
icculus@1589
   260
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XRANDR
slouken@3025
   261
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XSS
slouken@5408
   262
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XVIDMODE
slouken@5471
   263
#undef SDL_VIDEO_DRIVER_X11_XCURSOR
slouken@1361
   264
#undef SDL_VIDEO_DRIVER_X11_XINERAMA
slouken@5408
   265
#undef SDL_VIDEO_DRIVER_X11_XINPUT
icculus@1589
   266
#undef SDL_VIDEO_DRIVER_X11_XRANDR
slouken@5408
   267
#undef SDL_VIDEO_DRIVER_X11_XSCRNSAVER
icculus@4793
   268
#undef SDL_VIDEO_DRIVER_X11_XSHAPE
slouken@5408
   269
#undef SDL_VIDEO_DRIVER_X11_XVIDMODE
slouken@1361
   270
slouken@1895
   271
#undef SDL_VIDEO_RENDER_D3D
slouken@1895
   272
#undef SDL_VIDEO_RENDER_OGL
slouken@3087
   273
#undef SDL_VIDEO_RENDER_OGL_ES
slouken@6188
   274
#undef SDL_VIDEO_RENDER_OGL_ES2
slouken@5199
   275
#undef SDL_VIDEO_RENDER_DIRECTFB
slouken@1895
   276
slouken@1361
   277
/* Enable OpenGL support */
slouken@1361
   278
#undef SDL_VIDEO_OPENGL
slouken@3087
   279
#undef SDL_VIDEO_OPENGL_ES
slouken@1952
   280
#undef SDL_VIDEO_OPENGL_BGL
slouken@1952
   281
#undef SDL_VIDEO_OPENGL_CGL
slouken@1361
   282
#undef SDL_VIDEO_OPENGL_GLX
slouken@1361
   283
#undef SDL_VIDEO_OPENGL_WGL
slouken@1361
   284
#undef SDL_VIDEO_OPENGL_OSMESA
slouken@1361
   285
#undef SDL_VIDEO_OPENGL_OSMESA_DYNAMIC
slouken@1361
   286
icculus@3170
   287
/* Enable system power support */
icculus@3170
   288
#undef SDL_POWER_LINUX
icculus@3170
   289
#undef SDL_POWER_WINDOWS
icculus@3170
   290
#undef SDL_POWER_MACOSX
icculus@3173
   291
#undef SDL_POWER_BEOS
icculus@3170
   292
#undef SDL_POWER_NINTENDODS
icculus@3170
   293
#undef SDL_POWER_HARDWIRED
icculus@3170
   294
slouken@1402
   295
/* Enable assembly routines */
slouken@1402
   296
#undef SDL_ASSEMBLY_ROUTINES
slouken@5389
   297
#undef SDL_ALTIVEC_BLITTERS
slouken@1353
   298
slouken@1341
   299
#endif /* _SDL_config_h */