annotate src/video/ataricommon/SDL_atarigl_c.h @ 2663:0caed045d01b gsoc2008_audio_resampling

General cleanup and fixed a buffer overrun bug. It may be necessary to normalize filter gain differently or something.
author Aaron Wishnick <schnarf@gmail.com>
date Tue, 12 Aug 2008 00:24:42 +0000
parents b657f0bc72c2
children 99210400e8b9
rev   line source
989
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
1 /*
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
2 SDL - Simple DirectMedia Layer
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
3 Copyright (C) 1997-2004 Sam Lantinga
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
4
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
5 This library is free software; you can redistribute it and/or
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
6 modify it under the terms of the GNU Library General Public
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
7 License as published by the Free Software Foundation; either
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
8 version 2 of the License, or (at your option) any later version.
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
9
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
10 This library is distributed in the hope that it will be useful,
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
13 Library General Public License for more details.
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
14
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
15 You should have received a copy of the GNU Library General Public
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
16 License along with this library; if not, write to the Free
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
18
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
19 Sam Lantinga
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
20 slouken@libsdl.org
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
21 */
1402
d910939febfa Use consistent identifiers for the various platforms we support.
Sam Lantinga <slouken@libsdl.org>
parents: 1361
diff changeset
22 #include "SDL_config.h"
989
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
23
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
24 /* Atari OSMesa.ldg implementation of SDL OpenGL support */
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
25
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
26 #ifndef _SDL_ATARIGL_H_
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
27 #define _SDL_ATARIGL_H_
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
28
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1005
diff changeset
29 #if SDL_VIDEO_OPENGL
989
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
30 #include <GL/osmesa.h>
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
31 #endif
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
32
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1005
diff changeset
33 #include "../SDL_sysvideo.h"
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1005
diff changeset
34
2033
b657f0bc72c2 More work for 1.3
Patrice Mandin <patmandin@gmail.com>
parents: 1895
diff changeset
35 struct SDL_GLDriverData
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
36 {
991
12b13601a544 Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents: 989
diff changeset
37
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
38 int gl_active; /* to stop switching drivers while we have a valid context */
991
12b13601a544 Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents: 989
diff changeset
39
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
40 int gl_oldmesa; /* Old OpenGL support ? */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
41
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
42 int gl_pixelsize; /* for CopyShadow functions */
991
12b13601a544 Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents: 989
diff changeset
43
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
44 SDL_bool gl_upsidedown; /* Some implementations draw upside down */
1005
2ab1cb02a44e Some Atari OpenGL implementations draw upside down
Patrice Mandin <patmandin@gmail.com>
parents: 1004
diff changeset
45
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
46 Uint8 *gl_shadow; /* Shadow buffer for old implementations */
989
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
47
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
48 /* for unsupported OSMesa buffer formats */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
49 void (*ConvertSurface) (_THIS, SDL_Surface * surface);
991
12b13601a544 Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents: 989
diff changeset
50
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
51 /* to convert the shadow buffer to the screen format */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
52 void (*CopyShadow) (_THIS, SDL_Surface * surface);
991
12b13601a544 Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents: 989
diff changeset
53
1361
19418e4422cb New configure-based build system. Still work in progress, but much improved
Sam Lantinga <slouken@libsdl.org>
parents: 1005
diff changeset
54 #if SDL_VIDEO_OPENGL
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
55 OSMesaContext ctx;
989
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
56
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
57 /* OpenGL functions */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
58 void (*glGetIntegerv) (GLenum pname, GLint * value);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
59 void (*glFinish) (void);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
60 void (*glFlush) (void);
993
2662da16d668 Forgot to flush OpenGL buffer using glFinish
Patrice Mandin <patmandin@gmail.com>
parents: 992
diff changeset
61
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
62 /* osmesa.ldg */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
63 OSMesaContext(*OSMesaCreateContextExt) (GLenum format, GLint depthBits,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
64 GLint stencilBits,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
65 GLint accumBits,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
66 OSMesaContext sharelist);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
67 void (*OSMesaDestroyContext) (OSMesaContext ctx);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
68 GLboolean(*OSMesaMakeCurrent) (OSMesaContext ctx, void *buffer,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
69 GLenum type, GLsizei width,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
70 GLsizei height);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
71 void (*OSMesaPixelStore) (GLint pname, GLint value);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
72 void *(*OSMesaGetProcAddress) (const char *funcName);
991
12b13601a544 Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents: 989
diff changeset
73
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
74 /* mesa_gl.ldg, tiny_gl.ldg */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
75 void *(*OSMesaCreateLDG) (long format, long type, long width,
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
76 long height);
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
77 void (*OSMesaDestroyLDG) (void);
992
0324ce32b2d9 Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents: 991
diff changeset
78
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
79 /* Info needed to compare existing context with new asked one */
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
80 int width, height;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
81 GLenum format;
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
82 GLint depth, stencil, accum;
1004
d1cd674b2ecd Be sure to compile without OpenGL enabled
Patrice Mandin <patmandin@gmail.com>
parents: 995
diff changeset
83 #endif
989
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
84 };
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
85
991
12b13601a544 Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents: 989
diff changeset
86 /* Variable names */
2033
b657f0bc72c2 More work for 1.3
Patrice Mandin <patmandin@gmail.com>
parents: 1895
diff changeset
87 #define gl_active (_this->gl_data->gl_active)
b657f0bc72c2 More work for 1.3
Patrice Mandin <patmandin@gmail.com>
parents: 1895
diff changeset
88 #define gl_ctx (_this->gl_data->ctx)
b657f0bc72c2 More work for 1.3
Patrice Mandin <patmandin@gmail.com>
parents: 1895
diff changeset
89 #define gl_oldmesa (_this->gl_data->gl_oldmesa)
b657f0bc72c2 More work for 1.3
Patrice Mandin <patmandin@gmail.com>
parents: 1895
diff changeset
90 #define gl_pixelsize (_this->gl_data->gl_pixelsize)
b657f0bc72c2 More work for 1.3
Patrice Mandin <patmandin@gmail.com>
parents: 1895
diff changeset
91 #define gl_upsidedown (_this->gl_data->gl_upsidedown)
b657f0bc72c2 More work for 1.3
Patrice Mandin <patmandin@gmail.com>
parents: 1895
diff changeset
92 #define gl_shadow (_this->gl_data->gl_shadow)
b657f0bc72c2 More work for 1.3
Patrice Mandin <patmandin@gmail.com>
parents: 1895
diff changeset
93 #define gl_convert (_this->gl_data->ConvertSurface)
b657f0bc72c2 More work for 1.3
Patrice Mandin <patmandin@gmail.com>
parents: 1895
diff changeset
94 #define gl_copyshadow (_this->gl_data->CopyShadow)
b657f0bc72c2 More work for 1.3
Patrice Mandin <patmandin@gmail.com>
parents: 1895
diff changeset
95 #define gl_curformat (_this->gl_data->format)
b657f0bc72c2 More work for 1.3
Patrice Mandin <patmandin@gmail.com>
parents: 1895
diff changeset
96 #define gl_curdepth (_this->gl_data->depth)
b657f0bc72c2 More work for 1.3
Patrice Mandin <patmandin@gmail.com>
parents: 1895
diff changeset
97 #define gl_curstencil (_this->gl_data->stencil)
b657f0bc72c2 More work for 1.3
Patrice Mandin <patmandin@gmail.com>
parents: 1895
diff changeset
98 #define gl_curaccum (_this->gl_data->accum)
b657f0bc72c2 More work for 1.3
Patrice Mandin <patmandin@gmail.com>
parents: 1895
diff changeset
99 #define gl_curwidth (_this->gl_data->width)
b657f0bc72c2 More work for 1.3
Patrice Mandin <patmandin@gmail.com>
parents: 1895
diff changeset
100 #define gl_curheight (_this->gl_data->height)
989
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
101
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
102 /* OpenGL functions */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
103 extern int SDL_AtariGL_Init(_THIS, SDL_Surface * current);
992
0324ce32b2d9 Keep current OpenGL context when possible
Patrice Mandin <patmandin@gmail.com>
parents: 991
diff changeset
104 extern void SDL_AtariGL_Quit(_THIS, SDL_bool unload);
991
12b13601a544 Final touches to OSMesa OpenGL support on Atari, using loadable libraries. Hope SDL 1.2.8 is out soon.
Patrice Mandin <patmandin@gmail.com>
parents: 989
diff changeset
105 extern void SDL_AtariGL_InitPointers(_THIS);
989
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
106
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
107 extern int SDL_AtariGL_LoadLibrary(_THIS, const char *path);
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
108 extern void *SDL_AtariGL_GetProcAddress(_THIS, const char *proc);
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
109 extern int SDL_AtariGL_GetAttribute(_THIS, SDL_GLattr attrib, int *value);
989
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
110 extern int SDL_AtariGL_MakeCurrent(_THIS);
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
111 extern void SDL_AtariGL_SwapBuffers(_THIS);
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
112
475166d13b44 Factorize OSMesa OpenGL code for Atari drivers
Patrice Mandin <patmandin@gmail.com>
parents:
diff changeset
113 #endif /* _SDL_ATARIGL_H_ */
1895
c121d94672cb SDL 1.2 is moving to a branch, and SDL 1.3 is becoming the head.
Sam Lantinga <slouken@libsdl.org>
parents: 1402
diff changeset
114 /* vi: set ts=4 sw=4 expandtab: */