diff --git a/reactos/lib/opengl32/Makefile b/reactos/lib/opengl32/Makefile index 9dad8f5aaba..b8064cf21d6 100644 --- a/reactos/lib/opengl32/Makefile +++ b/reactos/lib/opengl32/Makefile @@ -7,14 +7,18 @@ TARGET_NORC = yes TARGET_NAME = opengl32 # -fno-builtin -TARGET_CFLAGS = -D__USE_W32API +TARGET_CFLAGS = -D__USE_W32API -DUNICODE -D_M_IX86 # require os code to explicitly request A/W version of structs/functions TARGET_CFLAGS += -D_DISABLE_TIDENTS -Wall -Werror -TARGET_SDKLIBS = ntdll.a gdi32.a +TARGET_LFLAGS = -lgdi32 -lntdll + +TARGET_SDKLIBS = opengl32.a gdi32.a +# ntdll.a gdi32.a - may still need these TARGET_OBJECTS = \ + gl.o \ opengl32.o \ wgl.o diff --git a/reactos/lib/opengl32/gl.c b/reactos/lib/opengl32/gl.c new file mode 100644 index 00000000000..39a8210a9bc --- /dev/null +++ b/reactos/lib/opengl32/gl.c @@ -0,0 +1,62 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: lib/opengl32/gl.c + * PURPOSE: OpenGL32 lib, glXXX functions + * PROGRAMMER: Anich Gregor (blight) + * UPDATE HISTORY: + * Feb 2, 2004: Created + */ + +/* FIXME: everything in this file ;-) */ + +/* On a x86 we call the ICD functions in a special-way: + * + * For every glXXX function we export a glXXX entry-point which loads the + * matching "real" function pointer from the NtCurrentTeb()->glDispatch table + * and jmps to the address, leaving the stack alone and letting the "real" + * function return for us. + * + * On other machines we use C to forward the calls (slow...) + */ + +#define WIN32_LEAN_AND_MEAN +#include +/*#include */ +/* -- complains about conflicting types of GL functions we export */ +/* either fix that or put the GLxxx typedefs in here */ + +#include "opengl32.h" + +/*#if defined(_M_IX86)*/ +#if 1 +#define X(func, ret, args) \ +void WINAPI func () \ +{ \ + __asm__( \ + "movl %%fs:0x18, %%eax" "\n\t" \ + "addl %0, %%eax" "\n\t" \ + "jmpl *(%%eax)" "\n\t" \ + : \ + : "n"(0x714+(GLIDX_##func*sizeof(PVOID))) ); \ +} + +#else /* defined(_M_IX86) */ + +/* FIXME: need more info for X (to pass on arguments) */ +/* +#define X(func, ret, args) \ + +ret func args +{ + PVOID fn = (PVOID)( ((char *)NtCurrentTeb()) + + (0x714+(GLIDX_func*sizeof(PVOID))) ); + return (ret)((ret (*func) args)fn)(); +}*/ + +#endif /* !defined(_M_IX86) */ + +GLFUNCS_MACRO +#undef X + +/* EOF */ diff --git a/reactos/lib/opengl32/glfuncs.h b/reactos/lib/opengl32/glfuncs.h new file mode 100644 index 00000000000..5bc7682e388 --- /dev/null +++ b/reactos/lib/opengl32/glfuncs.h @@ -0,0 +1,490 @@ +/* + * COPYRIGHT: See COPYING in the top level directory + * PROJECT: ReactOS kernel + * FILE: lib/opengl32/glfuncs.h + * PURPOSE: OpenGL32 lib, GLFUNCS_MACRO + * PROGRAMMER: gen_glfuncs_macro.sh + * UPDATE HISTORY: + * !!! AUTOMATICALLY CREATED FROM gl.h !!! + */ + +/* To use this macro define a macro X(name, ret, args). + * It gets called for every glXXX function. For glVertex3f name would be "glVertex3f", + * ret would be "void" and args would be "(GLfloat x, GLfloat y, GLfloat z)". + * Don't forget to undefine X ;-) + */ + +#define GLFUNCS_MACRO \ + X(glAccum, void, (GLenum op, GLfloat value)) \ + X(glActiveTexture, void, (GLenum texture)) \ + X(glAddSwapHintRectWIN, void, (GLint x, GLint y, GLsizei width, GLsizei height)) \ + X(glAlphaFunc, void, (GLenum func, GLclampf ref)) \ + X(glAreTexturesResident, GLboolean, (GLsizei n, const GLuint *textures, GLboolean *residences)) \ + X(glArrayElement, void, (GLint i)) \ + X(glBegin, void, (GLenum mode)) \ + X(glBindTexture, void, (GLenum target, GLuint texture)) \ + X(glBitmap, void, (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap)) \ + X(glBlendColor, void, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)) \ + X(glBlendEquation, void, (GLenum mode)) \ + X(glBlendFunc, void, (GLenum sfactor, GLenum dfactor)) \ + X(glBlendFuncSeparate, void, (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)) \ + X(glCallList, void, (GLuint list)) \ + X(glCallLists, void, (GLsizei n, GLenum type, const GLvoid *lists)) \ + X(glClear, void, (GLbitfield mask)) \ + X(glClearAccum, void, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)) \ + X(glClearColor, void, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha)) \ + X(glClearDepth, void, (GLclampd depth)) \ + X(glClearIndex, void, (GLfloat c)) \ + X(glClearStencil, void, (GLint s)) \ + X(glClientActiveTexture, void, (GLenum texture)) \ + X(glClipPlane, void, (GLenum plane, const GLdouble *equation)) \ + X(glColor3b, void, (GLbyte red, GLbyte green, GLbyte blue)) \ + X(glColor3bv, void, (const GLbyte *v)) \ + X(glColor3d, void, (GLdouble red, GLdouble green, GLdouble blue)) \ + X(glColor3dv, void, (const GLdouble *v)) \ + X(glColor3f, void, (GLfloat red, GLfloat green, GLfloat blue)) \ + X(glColor3fv, void, (const GLfloat *v)) \ + X(glColor3i, void, (GLint red, GLint green, GLint blue)) \ + X(glColor3iv, void, (const GLint *v)) \ + X(glColor3s, void, (GLshort red, GLshort green, GLshort blue)) \ + X(glColor3sv, void, (const GLshort *v)) \ + X(glColor3ub, void, (GLubyte red, GLubyte green, GLubyte blue)) \ + X(glColor3ubv, void, (const GLubyte *v)) \ + X(glColor3ui, void, (GLuint red, GLuint green, GLuint blue)) \ + X(glColor3uiv, void, (const GLuint *v)) \ + X(glColor3us, void, (GLushort red, GLushort green, GLushort blue)) \ + X(glColor3usv, void, (const GLushort *v)) \ + X(glColor4b, void, (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha)) \ + X(glColor4bv, void, (const GLbyte *v)) \ + X(glColor4d, void, (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha)) \ + X(glColor4dv, void, (const GLdouble *v)) \ + X(glColor4f, void, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha)) \ + X(glColor4fv, void, (const GLfloat *v)) \ + X(glColor4i, void, (GLint red, GLint green, GLint blue, GLint alpha)) \ + X(glColor4iv, void, (const GLint *v)) \ + X(glColor4s, void, (GLshort red, GLshort green, GLshort blue, GLshort alpha)) \ + X(glColor4sv, void, (const GLshort *v)) \ + X(glColor4ub, void, (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha)) \ + X(glColor4ubv, void, (const GLubyte *v)) \ + X(glColor4ui, void, (GLuint red, GLuint green, GLuint blue, GLuint alpha)) \ + X(glColor4uiv, void, (const GLuint *v)) \ + X(glColor4us, void, (GLushort red, GLushort green, GLushort blue, GLushort alpha)) \ + X(glColor4usv, void, (const GLushort *v)) \ + X(glColorMask, void, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha)) \ + X(glColorMaterial, void, (GLenum face, GLenum mode)) \ + X(glColorPointer, void, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) \ + X(glColorSubTable, void, (GLenum target, GLsizei start, GLsizei count, GLenum format, GLenum type, const GLvoid *data)) \ + X(glColorTable, void, (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *table)) \ + X(glColorTableParameterfv, void, (GLenum target, GLenum pname, const GLfloat *params)) \ + X(glColorTableParameteriv, void, (GLenum target, GLenum pname, const GLint *params)) \ + X(glCompressedTexImage1D, void, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLint border, GLsizei imageSize, const GLvoid *data)) \ + X(glCompressedTexImage2D, void, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data)) \ + X(glCompressedTexImage3D, void, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data)) \ + X(glCompressedTexSubImage1D, void, (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLsizei imageSize, const GLvoid *data)) \ + X(glCompressedTexSubImage2D, void, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data)) \ + X(glCompressedTexSubImage3D, void, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data)) \ + X(glConvolutionFilter1D, void, (GLenum target, GLenum internalformat, GLsizei width, GLenum format, GLenum type, const GLvoid *image)) \ + X(glConvolutionFilter2D, void, (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *image)) \ + X(glConvolutionParameterf, void, (GLenum target, GLenum pname, GLfloat params)) \ + X(glConvolutionParameterfv, void, (GLenum target, GLenum pname, const GLfloat *params)) \ + X(glConvolutionParameteri, void, (GLenum target, GLenum pname, GLint params)) \ + X(glConvolutionParameteriv, void, (GLenum target, GLenum pname, const GLint *params)) \ + X(glCopyColorSubTable, void, (GLenum target, GLsizei start, GLint x, GLint y, GLsizei width)) \ + X(glCopyColorTable, void, (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)) \ + X(glCopyConvolutionFilter1D, void, (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width)) \ + X(glCopyConvolutionFilter2D, void, (GLenum target, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height)) \ + X(glCopyPixels, void, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type)) \ + X(glCopyTexImage1D, void, (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border)) \ + X(glCopyTexImage2D, void, (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border)) \ + X(glCopyTexSubImage1D, void, (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width)) \ + X(glCopyTexSubImage2D, void, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height)) \ + X(glCopyTexSubImage3D, void, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height)) \ + X(glCullFace, void, (GLenum mode)) \ + X(glDeleteLists, void, (GLuint list, GLsizei range)) \ + X(glDeleteTextures, void, (GLsizei n, const GLuint *textures)) \ + X(glDepthFunc, void, (GLenum func)) \ + X(glDepthMask, void, (GLboolean flag)) \ + X(glDepthRange, void, (GLclampd zNear, GLclampd zFar)) \ + X(glDisable, void, (GLenum cap)) \ + X(glDisableClientState, void, (GLenum array)) \ + X(glDrawArrays, void, (GLenum mode, GLint first, GLsizei count)) \ + X(glDrawBuffer, void, (GLenum mode)) \ + X(glDrawElements, void, (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices)) \ + X(glDrawPixels, void, (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)) \ + X(glDrawRangeElements, void, (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices)) \ + X(glEdgeFlag, void, (GLboolean flag)) \ + X(glEdgeFlagPointer, void, (GLsizei stride, const GLboolean *pointer)) \ + X(glEdgeFlagv, void, (const GLboolean *flag)) \ + X(glEnable, void, (GLenum cap)) \ + X(glEnableClientState, void, (GLenum array)) \ + X(glEnd, void, (void)) \ + X(glEndList, void, (void)) \ + X(glEvalCoord1d, void, (GLdouble u)) \ + X(glEvalCoord1dv, void, (const GLdouble *u)) \ + X(glEvalCoord1f, void, (GLfloat u)) \ + X(glEvalCoord1fv, void, (const GLfloat *u)) \ + X(glEvalCoord2d, void, (GLdouble u, GLdouble v)) \ + X(glEvalCoord2dv, void, (const GLdouble *u)) \ + X(glEvalCoord2f, void, (GLfloat u, GLfloat v)) \ + X(glEvalCoord2fv, void, (const GLfloat *u)) \ + X(glEvalMesh1, void, (GLenum mode, GLint i1, GLint i2)) \ + X(glEvalMesh2, void, (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2)) \ + X(glEvalPoint1, void, (GLint i)) \ + X(glEvalPoint2, void, (GLint i, GLint j)) \ + X(glFeedbackBuffer, void, (GLsizei size, GLenum type, GLfloat *buffer)) \ + X(glFinish, void, (void)) \ + X(glFlush, void, (void)) \ + X(glFlushHold, GLuint, (void)) \ + X(glFogCoordPointer, void, (GLenum type, GLsizei stride, const GLvoid *pointer)) \ + X(glFogCoordd, void, (GLdouble fog)) \ + X(glFogCoorddv, void, (const GLdouble *fog)) \ + X(glFogCoordf, void, (GLfloat fog)) \ + X(glFogCoordfv, void, (const GLfloat *fog)) \ + X(glFogf, void, (GLenum pname, GLfloat param)) \ + X(glFogfv, void, (GLenum pname, const GLfloat *params)) \ + X(glFogi, void, (GLenum pname, GLint param)) \ + X(glFogiv, void, (GLenum pname, const GLint *params)) \ + X(glFrontFace, void, (GLenum mode)) \ + X(glFrustum, void, (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)) \ + X(glGenLists, GLuint, (GLsizei range)) \ + X(glGenTextures, void, (GLsizei n, GLuint *textures)) \ + X(glGetBooleanv, void, (GLenum pname, GLboolean *params)) \ + X(glGetClipPlane, void, (GLenum plane, GLdouble *equation)) \ + X(glGetColorTable, void, (GLenum target, GLenum format, GLenum type, GLvoid *table)) \ + X(glGetColorTableParameterfv, void, (GLenum target, GLenum pname, GLfloat *params)) \ + X(glGetColorTableParameteriv, void, (GLenum target, GLenum pname, GLint *params)) \ + X(glGetCompressedTexImage, void, (GLenum target, GLint lod, GLvoid *img)) \ + X(glGetConvolutionFilter, void, (GLenum target, GLenum format, GLenum type, GLvoid *image)) \ + X(glGetConvolutionParameterfv, void, (GLenum target, GLenum pname, GLfloat *params)) \ + X(glGetConvolutionParameteriv, void, (GLenum target, GLenum pname, GLint *params)) \ + X(glGetDoublev, void, (GLenum pname, GLdouble *params)) \ + X(glGetError, GLenum, (void)) \ + X(glGetFloatv, void, (GLenum pname, GLfloat *params)) \ + X(glGetHistogram, void, (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)) \ + X(glGetHistogramParameterfv, void, (GLenum target, GLenum pname, GLfloat *params)) \ + X(glGetHistogramParameteriv, void, (GLenum target, GLenum pname, GLint *params)) \ + X(glGetIntegerv, void, (GLenum pname, GLint *params)) \ + X(glGetLightfv, void, (GLenum light, GLenum pname, GLfloat *params)) \ + X(glGetLightiv, void, (GLenum light, GLenum pname, GLint *params)) \ + X(glGetMapdv, void, (GLenum target, GLenum query, GLdouble *v)) \ + X(glGetMapfv, void, (GLenum target, GLenum query, GLfloat *v)) \ + X(glGetMapiv, void, (GLenum target, GLenum query, GLint *v)) \ + X(glGetMaterialfv, void, (GLenum face, GLenum pname, GLfloat *params)) \ + X(glGetMaterialiv, void, (GLenum face, GLenum pname, GLint *params)) \ + X(glGetMinmax, void, (GLenum target, GLboolean reset, GLenum format, GLenum type, GLvoid *values)) \ + X(glGetMinmaxParameterfv, void, (GLenum target, GLenum pname, GLfloat *params)) \ + X(glGetMinmaxParameteriv, void, (GLenum target, GLenum pname, GLint *params)) \ + X(glGetPixelMapfv, void, (GLenum map, GLfloat *values)) \ + X(glGetPixelMapuiv, void, (GLenum map, GLuint *values)) \ + X(glGetPixelMapusv, void, (GLenum map, GLushort *values)) \ + X(glGetPointerv, void, (GLenum pname, GLvoid* *params)) \ + X(glGetPolygonStipple, void, (GLubyte *mask)) \ + X(glGetSeparableFilter, void, (GLenum target, GLenum format, GLenum type, GLvoid *row, GLvoid *column, GLvoid *span)) \ + X(glGetString, const, (GLenum name)) \ + X(glGetTexEnvfv, void, (GLenum target, GLenum pname, GLfloat *params)) \ + X(glGetTexEnviv, void, (GLenum target, GLenum pname, GLint *params)) \ + X(glGetTexGendv, void, (GLenum coord, GLenum pname, GLdouble *params)) \ + X(glGetTexGenfv, void, (GLenum coord, GLenum pname, GLfloat *params)) \ + X(glGetTexGeniv, void, (GLenum coord, GLenum pname, GLint *params)) \ + X(glGetTexImage, void, (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels)) \ + X(glGetTexLevelParameterfv, void, (GLenum target, GLint level, GLenum pname, GLfloat *params)) \ + X(glGetTexLevelParameteriv, void, (GLenum target, GLint level, GLenum pname, GLint *params)) \ + X(glGetTexParameterfv, void, (GLenum target, GLenum pname, GLfloat *params)) \ + X(glGetTexParameteriv, void, (GLenum target, GLenum pname, GLint *params)) \ + X(glHint, void, (GLenum target, GLenum mode)) \ + X(glHistogram, void, (GLenum target, GLsizei width, GLenum internalformat, GLboolean sink)) \ + X(glIndexMask, void, (GLuint mask)) \ + X(glIndexPointer, void, (GLenum type, GLsizei stride, const GLvoid *pointer)) \ + X(glIndexd, void, (GLdouble c)) \ + X(glIndexdv, void, (const GLdouble *c)) \ + X(glIndexf, void, (GLfloat c)) \ + X(glIndexfv, void, (const GLfloat *c)) \ + X(glIndexi, void, (GLint c)) \ + X(glIndexiv, void, (const GLint *c)) \ + X(glIndexs, void, (GLshort c)) \ + X(glIndexsv, void, (const GLshort *c)) \ + X(glIndexub, void, (GLubyte c)) \ + X(glIndexubv, void, (const GLubyte *c)) \ + X(glInitNames, void, (void)) \ + X(glInterleavedArrays, void, (GLenum format, GLsizei stride, const GLvoid *pointer)) \ + X(glIsEnabled, GLboolean, (GLenum cap)) \ + X(glIsList, GLboolean, (GLuint list)) \ + X(glIsTexture, GLboolean, (GLuint texture)) \ + X(glLightModelf, void, (GLenum pname, GLfloat param)) \ + X(glLightModelfv, void, (GLenum pname, const GLfloat *params)) \ + X(glLightModeli, void, (GLenum pname, GLint param)) \ + X(glLightModeliv, void, (GLenum pname, const GLint *params)) \ + X(glLightf, void, (GLenum light, GLenum pname, GLfloat param)) \ + X(glLightfv, void, (GLenum light, GLenum pname, const GLfloat *params)) \ + X(glLighti, void, (GLenum light, GLenum pname, GLint param)) \ + X(glLightiv, void, (GLenum light, GLenum pname, const GLint *params)) \ + X(glLineStipple, void, (GLint factor, GLushort pattern)) \ + X(glLineWidth, void, (GLfloat width)) \ + X(glListBase, void, (GLuint base)) \ + X(glLoadIdentity, void, (void)) \ + X(glLoadMatrixd, void, (const GLdouble *m)) \ + X(glLoadMatrixf, void, (const GLfloat *m)) \ + X(glLoadName, void, (GLuint name)) \ + X(glLoadTransposeMatrixd, void, (const GLdouble *m)) \ + X(glLoadTransposeMatrixf, void, (const GLfloat *m)) \ + X(glLogicOp, void, (GLenum opcode)) \ + X(glMap1d, void, (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points)) \ + X(glMap1f, void, (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points)) \ + X(glMap2d, void, (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points)) \ + X(glMap2f, void, (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points)) \ + X(glMapGrid1d, void, (GLint un, GLdouble u1, GLdouble u2)) \ + X(glMapGrid1f, void, (GLint un, GLfloat u1, GLfloat u2)) \ + X(glMapGrid2d, void, (GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2)) \ + X(glMapGrid2f, void, (GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2)) \ + X(glMaterialf, void, (GLenum face, GLenum pname, GLfloat param)) \ + X(glMaterialfv, void, (GLenum face, GLenum pname, const GLfloat *params)) \ + X(glMateriali, void, (GLenum face, GLenum pname, GLint param)) \ + X(glMaterialiv, void, (GLenum face, GLenum pname, const GLint *params)) \ + X(glMatrixMode, void, (GLenum mode)) \ + X(glMinmax, void, (GLenum target, GLenum internalformat, GLboolean sink)) \ + X(glMultMatrixd, void, (const GLdouble *m)) \ + X(glMultMatrixf, void, (const GLfloat *m)) \ + X(glMultTransposeMatrixd, void, (const GLdouble *m)) \ + X(glMultTransposeMatrixf, void, (const GLfloat *m)) \ + X(glMultiDrawArrays, void, (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount)) \ + X(glMultiDrawElements, void, (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount)) \ + X(glMultiTexCoord1d, void, (GLenum target, GLdouble s)) \ + X(glMultiTexCoord1dv, void, (GLenum target, const GLdouble *v)) \ + X(glMultiTexCoord1f, void, (GLenum target, GLfloat s)) \ + X(glMultiTexCoord1fv, void, (GLenum target, const GLfloat *v)) \ + X(glMultiTexCoord1i, void, (GLenum target, GLint s)) \ + X(glMultiTexCoord1iv, void, (GLenum target, const GLint *v)) \ + X(glMultiTexCoord1s, void, (GLenum target, GLshort s)) \ + X(glMultiTexCoord1sv, void, (GLenum target, const GLshort *v)) \ + X(glMultiTexCoord2d, void, (GLenum target, GLdouble s, GLdouble t)) \ + X(glMultiTexCoord2dv, void, (GLenum target, const GLdouble *v)) \ + X(glMultiTexCoord2f, void, (GLenum target, GLfloat s, GLfloat t)) \ + X(glMultiTexCoord2fv, void, (GLenum target, const GLfloat *v)) \ + X(glMultiTexCoord2i, void, (GLenum target, GLint s, GLint t)) \ + X(glMultiTexCoord2iv, void, (GLenum target, const GLint *v)) \ + X(glMultiTexCoord2s, void, (GLenum target, GLshort s, GLshort t)) \ + X(glMultiTexCoord2sv, void, (GLenum target, const GLshort *v)) \ + X(glMultiTexCoord3d, void, (GLenum target, GLdouble s, GLdouble t, GLdouble r)) \ + X(glMultiTexCoord3dv, void, (GLenum target, const GLdouble *v)) \ + X(glMultiTexCoord3f, void, (GLenum target, GLfloat s, GLfloat t, GLfloat r)) \ + X(glMultiTexCoord3fv, void, (GLenum target, const GLfloat *v)) \ + X(glMultiTexCoord3i, void, (GLenum target, GLint s, GLint t, GLint r)) \ + X(glMultiTexCoord3iv, void, (GLenum target, const GLint *v)) \ + X(glMultiTexCoord3s, void, (GLenum target, GLshort s, GLshort t, GLshort r)) \ + X(glMultiTexCoord3sv, void, (GLenum target, const GLshort *v)) \ + X(glMultiTexCoord4d, void, (GLenum target, GLdouble s, GLdouble t, GLdouble r, GLdouble q)) \ + X(glMultiTexCoord4dv, void, (GLenum target, const GLdouble *v)) \ + X(glMultiTexCoord4f, void, (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q)) \ + X(glMultiTexCoord4fv, void, (GLenum target, const GLfloat *v)) \ + X(glMultiTexCoord4i, void, (GLenum target, GLint s, GLint t, GLint r, GLint q)) \ + X(glMultiTexCoord4iv, void, (GLenum target, const GLint *v)) \ + X(glMultiTexCoord4s, void, (GLenum target, GLshort s, GLshort t, GLshort r, GLshort q)) \ + X(glMultiTexCoord4sv, void, (GLenum target, const GLshort *v)) \ + X(glNewList, void, (GLuint list, GLenum mode)) \ + X(glNormal3b, void, (GLbyte nx, GLbyte ny, GLbyte nz)) \ + X(glNormal3bv, void, (const GLbyte *v)) \ + X(glNormal3d, void, (GLdouble nx, GLdouble ny, GLdouble nz)) \ + X(glNormal3dv, void, (const GLdouble *v)) \ + X(glNormal3f, void, (GLfloat nx, GLfloat ny, GLfloat nz)) \ + X(glNormal3fv, void, (const GLfloat *v)) \ + X(glNormal3i, void, (GLint nx, GLint ny, GLint nz)) \ + X(glNormal3iv, void, (const GLint *v)) \ + X(glNormal3s, void, (GLshort nx, GLshort ny, GLshort nz)) \ + X(glNormal3sv, void, (const GLshort *v)) \ + X(glNormalPointer, void, (GLenum type, GLsizei stride, const GLvoid *pointer)) \ + X(glOrtho, void, (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar)) \ + X(glPassThrough, void, (GLfloat token)) \ + X(glPixelMapfv, void, (GLenum map, GLint mapsize, const GLfloat *values)) \ + X(glPixelMapuiv, void, (GLenum map, GLint mapsize, const GLuint *values)) \ + X(glPixelMapusv, void, (GLenum map, GLint mapsize, const GLushort *values)) \ + X(glPixelStoref, void, (GLenum pname, GLfloat param)) \ + X(glPixelStorei, void, (GLenum pname, GLint param)) \ + X(glPixelTransferf, void, (GLenum pname, GLfloat param)) \ + X(glPixelTransferi, void, (GLenum pname, GLint param)) \ + X(glPixelZoom, void, (GLfloat xfactor, GLfloat yfactor)) \ + X(glPointParameterf, void, (GLenum pname, GLfloat param)) \ + X(glPointParameterfv, void, (GLenum pname, const GLfloat *params)) \ + X(glPointParameteri, void, (GLenum pname, GLint param)) \ + X(glPointParameteriv, void, (GLenum pname, const GLint *params)) \ + X(glPointSize, void, (GLfloat size)) \ + X(glPolygonMode, void, (GLenum face, GLenum mode)) \ + X(glPolygonOffset, void, (GLfloat factor, GLfloat units)) \ + X(glPolygonStipple, void, (const GLubyte *mask)) \ + X(glPopAttrib, void, (void)) \ + X(glPopClientAttrib, void, (void)) \ + X(glPopMatrix, void, (void)) \ + X(glPopName, void, (void)) \ + X(glPrioritizeTextures, void, (GLsizei n, const GLuint *textures, const GLclampf *priorities)) \ + X(glPushAttrib, void, (GLbitfield mask)) \ + X(glPushClientAttrib, void, (GLbitfield mask)) \ + X(glPushMatrix, void, (void)) \ + X(glPushName, void, (GLuint name)) \ + X(glRasterPos2d, void, (GLdouble x, GLdouble y)) \ + X(glRasterPos2dv, void, (const GLdouble *v)) \ + X(glRasterPos2f, void, (GLfloat x, GLfloat y)) \ + X(glRasterPos2fv, void, (const GLfloat *v)) \ + X(glRasterPos2i, void, (GLint x, GLint y)) \ + X(glRasterPos2iv, void, (const GLint *v)) \ + X(glRasterPos2s, void, (GLshort x, GLshort y)) \ + X(glRasterPos2sv, void, (const GLshort *v)) \ + X(glRasterPos3d, void, (GLdouble x, GLdouble y, GLdouble z)) \ + X(glRasterPos3dv, void, (const GLdouble *v)) \ + X(glRasterPos3f, void, (GLfloat x, GLfloat y, GLfloat z)) \ + X(glRasterPos3fv, void, (const GLfloat *v)) \ + X(glRasterPos3i, void, (GLint x, GLint y, GLint z)) \ + X(glRasterPos3iv, void, (const GLint *v)) \ + X(glRasterPos3s, void, (GLshort x, GLshort y, GLshort z)) \ + X(glRasterPos3sv, void, (const GLshort *v)) \ + X(glRasterPos4d, void, (GLdouble x, GLdouble y, GLdouble z, GLdouble w)) \ + X(glRasterPos4dv, void, (const GLdouble *v)) \ + X(glRasterPos4f, void, (GLfloat x, GLfloat y, GLfloat z, GLfloat w)) \ + X(glRasterPos4fv, void, (const GLfloat *v)) \ + X(glRasterPos4i, void, (GLint x, GLint y, GLint z, GLint w)) \ + X(glRasterPos4iv, void, (const GLint *v)) \ + X(glRasterPos4s, void, (GLshort x, GLshort y, GLshort z, GLshort w)) \ + X(glRasterPos4sv, void, (const GLshort *v)) \ + X(glReadBuffer, void, (GLenum mode)) \ + X(glReadPixels, void, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels)) \ + X(glRectd, void, (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2)) \ + X(glRectdv, void, (const GLdouble *v1, const GLdouble *v2)) \ + X(glRectf, void, (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2)) \ + X(glRectfv, void, (const GLfloat *v1, const GLfloat *v2)) \ + X(glRecti, void, (GLint x1, GLint y1, GLint x2, GLint y2)) \ + X(glRectiv, void, (const GLint *v1, const GLint *v2)) \ + X(glRects, void, (GLshort x1, GLshort y1, GLshort x2, GLshort y2)) \ + X(glRectsv, void, (const GLshort *v1, const GLshort *v2)) \ + X(glReleaseFlushHold, GLenum, (GLuint id)) \ + X(glRenderMode, GLint, (GLenum mode)) \ + X(glResetHistogram, void, (GLenum target)) \ + X(glResetMinmax, void, (GLenum target)) \ + X(glRotated, void, (GLdouble angle, GLdouble x, GLdouble y, GLdouble z)) \ + X(glRotatef, void, (GLfloat angle, GLfloat x, GLfloat y, GLfloat z)) \ + X(glSampleCoverage, void, (GLclampf value, GLboolean invert)) \ + X(glScaled, void, (GLdouble x, GLdouble y, GLdouble z)) \ + X(glScalef, void, (GLfloat x, GLfloat y, GLfloat z)) \ + X(glScissor, void, (GLint x, GLint y, GLsizei width, GLsizei height)) \ + X(glSecondaryColor3b, void, (GLbyte red, GLbyte green, GLbyte blue)) \ + X(glSecondaryColor3bv, void, (const GLbyte *v)) \ + X(glSecondaryColor3d, void, (GLdouble red, GLdouble green, GLdouble blue)) \ + X(glSecondaryColor3dv, void, (const GLdouble *v)) \ + X(glSecondaryColor3f, void, (GLfloat red, GLfloat green, GLfloat blue)) \ + X(glSecondaryColor3fv, void, (const GLfloat *v)) \ + X(glSecondaryColor3i, void, (GLint red, GLint green, GLint blue)) \ + X(glSecondaryColor3iv, void, (const GLint *v)) \ + X(glSecondaryColor3s, void, (GLshort red, GLshort green, GLshort blue)) \ + X(glSecondaryColor3sv, void, (const GLshort *v)) \ + X(glSecondaryColor3ub, void, (GLubyte red, GLubyte green, GLubyte blue)) \ + X(glSecondaryColor3ubv, void, (const GLubyte *v)) \ + X(glSecondaryColor3ui, void, (GLuint red, GLuint green, GLuint blue)) \ + X(glSecondaryColor3uiv, void, (const GLuint *v)) \ + X(glSecondaryColor3us, void, (GLushort red, GLushort green, GLushort blue)) \ + X(glSecondaryColor3usv, void, (const GLushort *v)) \ + X(glSecondaryColorPointer, void, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) \ + X(glSelectBuffer, void, (GLsizei size, GLuint *buffer)) \ + X(glSeparableFilter2D, void, (GLenum target, GLenum internalformat, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *row, const GLvoid *column)) \ + X(glShadeModel, void, (GLenum mode)) \ + X(glStencilFunc, void, (GLenum func, GLint ref, GLuint mask)) \ + X(glStencilMask, void, (GLuint mask)) \ + X(glStencilOp, void, (GLenum fail, GLenum zfail, GLenum zpass)) \ + X(glTexCoord1d, void, (GLdouble s)) \ + X(glTexCoord1dv, void, (const GLdouble *v)) \ + X(glTexCoord1f, void, (GLfloat s)) \ + X(glTexCoord1fv, void, (const GLfloat *v)) \ + X(glTexCoord1i, void, (GLint s)) \ + X(glTexCoord1iv, void, (const GLint *v)) \ + X(glTexCoord1s, void, (GLshort s)) \ + X(glTexCoord1sv, void, (const GLshort *v)) \ + X(glTexCoord2d, void, (GLdouble s, GLdouble t)) \ + X(glTexCoord2dv, void, (const GLdouble *v)) \ + X(glTexCoord2f, void, (GLfloat s, GLfloat t)) \ + X(glTexCoord2fv, void, (const GLfloat *v)) \ + X(glTexCoord2i, void, (GLint s, GLint t)) \ + X(glTexCoord2iv, void, (const GLint *v)) \ + X(glTexCoord2s, void, (GLshort s, GLshort t)) \ + X(glTexCoord2sv, void, (const GLshort *v)) \ + X(glTexCoord3d, void, (GLdouble s, GLdouble t, GLdouble r)) \ + X(glTexCoord3dv, void, (const GLdouble *v)) \ + X(glTexCoord3f, void, (GLfloat s, GLfloat t, GLfloat r)) \ + X(glTexCoord3fv, void, (const GLfloat *v)) \ + X(glTexCoord3i, void, (GLint s, GLint t, GLint r)) \ + X(glTexCoord3iv, void, (const GLint *v)) \ + X(glTexCoord3s, void, (GLshort s, GLshort t, GLshort r)) \ + X(glTexCoord3sv, void, (const GLshort *v)) \ + X(glTexCoord4d, void, (GLdouble s, GLdouble t, GLdouble r, GLdouble q)) \ + X(glTexCoord4dv, void, (const GLdouble *v)) \ + X(glTexCoord4f, void, (GLfloat s, GLfloat t, GLfloat r, GLfloat q)) \ + X(glTexCoord4fv, void, (const GLfloat *v)) \ + X(glTexCoord4i, void, (GLint s, GLint t, GLint r, GLint q)) \ + X(glTexCoord4iv, void, (const GLint *v)) \ + X(glTexCoord4s, void, (GLshort s, GLshort t, GLshort r, GLshort q)) \ + X(glTexCoord4sv, void, (const GLshort *v)) \ + X(glTexCoordPointer, void, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) \ + X(glTexEnvf, void, (GLenum target, GLenum pname, GLfloat param)) \ + X(glTexEnvfv, void, (GLenum target, GLenum pname, const GLfloat *params)) \ + X(glTexEnvi, void, (GLenum target, GLenum pname, GLint param)) \ + X(glTexEnviv, void, (GLenum target, GLenum pname, const GLint *params)) \ + X(glTexGend, void, (GLenum coord, GLenum pname, GLdouble param)) \ + X(glTexGendv, void, (GLenum coord, GLenum pname, const GLdouble *params)) \ + X(glTexGenf, void, (GLenum coord, GLenum pname, GLfloat param)) \ + X(glTexGenfv, void, (GLenum coord, GLenum pname, const GLfloat *params)) \ + X(glTexGeni, void, (GLenum coord, GLenum pname, GLint param)) \ + X(glTexGeniv, void, (GLenum coord, GLenum pname, const GLint *params)) \ + X(glTexImage1D, void, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels)) \ + X(glTexImage2D, void, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels)) \ + X(glTexImage3D, void, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels)) \ + X(glTexParameterf, void, (GLenum target, GLenum pname, GLfloat param)) \ + X(glTexParameterfv, void, (GLenum target, GLenum pname, const GLfloat *params)) \ + X(glTexParameteri, void, (GLenum target, GLenum pname, GLint param)) \ + X(glTexParameteriv, void, (GLenum target, GLenum pname, const GLint *params)) \ + X(glTexSubImage1D, void, (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels)) \ + X(glTexSubImage2D, void, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels)) \ + X(glTexSubImage3D, void, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels)) \ + X(glTranslated, void, (GLdouble x, GLdouble y, GLdouble z)) \ + X(glTranslatef, void, (GLfloat x, GLfloat y, GLfloat z)) \ + X(glValidBackBufferHintAutodesk, GLboolean, (GLint x, GLint y, GLsizei width, GLsizei height)) \ + X(glVertex2d, void, (GLdouble x, GLdouble y)) \ + X(glVertex2dv, void, (const GLdouble *v)) \ + X(glVertex2f, void, (GLfloat x, GLfloat y)) \ + X(glVertex2fv, void, (const GLfloat *v)) \ + X(glVertex2i, void, (GLint x, GLint y)) \ + X(glVertex2iv, void, (const GLint *v)) \ + X(glVertex2s, void, (GLshort x, GLshort y)) \ + X(glVertex2sv, void, (const GLshort *v)) \ + X(glVertex3d, void, (GLdouble x, GLdouble y, GLdouble z)) \ + X(glVertex3dv, void, (const GLdouble *v)) \ + X(glVertex3f, void, (GLfloat x, GLfloat y, GLfloat z)) \ + X(glVertex3fv, void, (const GLfloat *v)) \ + X(glVertex3i, void, (GLint x, GLint y, GLint z)) \ + X(glVertex3iv, void, (const GLint *v)) \ + X(glVertex3s, void, (GLshort x, GLshort y, GLshort z)) \ + X(glVertex3sv, void, (const GLshort *v)) \ + X(glVertex4d, void, (GLdouble x, GLdouble y, GLdouble z, GLdouble w)) \ + X(glVertex4dv, void, (const GLdouble *v)) \ + X(glVertex4f, void, (GLfloat x, GLfloat y, GLfloat z, GLfloat w)) \ + X(glVertex4fv, void, (const GLfloat *v)) \ + X(glVertex4i, void, (GLint x, GLint y, GLint z, GLint w)) \ + X(glVertex4iv, void, (const GLint *v)) \ + X(glVertex4s, void, (GLshort x, GLshort y, GLshort z, GLshort w)) \ + X(glVertex4sv, void, (const GLshort *v)) \ + X(glVertexPointer, void, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)) \ + X(glViewport, void, (GLint x, GLint y, GLsizei width, GLsizei height)) \ + X(glWindowBackBufferHintAutodesk, void, (void)) \ + X(glWindowPos2d, void, (GLdouble x, GLdouble y)) \ + X(glWindowPos2dv, void, (const GLdouble *p)) \ + X(glWindowPos2f, void, (GLfloat x, GLfloat y)) \ + X(glWindowPos2fv, void, (const GLfloat *p)) \ + X(glWindowPos2i, void, (GLint x, GLint y)) \ + X(glWindowPos2iv, void, (const GLint *p)) \ + X(glWindowPos2s, void, (GLshort x, GLshort y)) \ + X(glWindowPos2sv, void, (const GLshort *p)) \ + X(glWindowPos3d, void, (GLdouble x, GLdouble y, GLdouble z)) \ + X(glWindowPos3dv, void, (const GLdouble *p)) \ + X(glWindowPos3f, void, (GLfloat x, GLfloat y, GLfloat z)) \ + X(glWindowPos3fv, void, (const GLfloat *p)) \ + X(glWindowPos3i, void, (GLint x, GLint y, GLint z)) \ + X(glWindowPos3iv, void, (const GLint *p)) \ + X(glWindowPos3s, void, (GLshort x, GLshort y, GLshort z)) \ + X(glWindowPos3sv, void, (const GLshort *p)) \ + + +/* EOF */ diff --git a/reactos/lib/opengl32/opengl32.c b/reactos/lib/opengl32/opengl32.c index ee70d5cba7e..78c5eb262d4 100644 --- a/reactos/lib/opengl32/opengl32.c +++ b/reactos/lib/opengl32/opengl32.c @@ -1,4 +1,4 @@ -/* $Id: opengl32.c,v 1.7 2004/02/02 18:21:32 royce Exp $ +/* $Id: opengl32.c,v 1.8 2004/02/03 14:23:42 royce Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -17,11 +17,8 @@ //#include #include "opengl32.h" -#define EXPORT __declspec(dllexport) -#define NAKED __attribute__((naked)) - /* function prototypes */ -static BOOL OPENGL32_LoadDrivers(); +/*static BOOL OPENGL32_LoadDrivers();*/ static void OPENGL32_AppendICD( GLDRIVERDATA *icd ); static void OPENGL32_RemoveICD( GLDRIVERDATA *icd ); static GLDRIVERDATA *OPENGL32_LoadDriver ( LPCWSTR regKey ); @@ -29,32 +26,35 @@ static DWORD OPENGL32_InitializeDriver( GLDRIVERDATA *icd ); static BOOL OPENGL32_UnloadDriver( GLDRIVERDATA *icd ); /* global vars */ -const char* OPENGL32_funcnames[GLIDX_COUNT] - __attribute__((section("shared"), shared)) = +const char* OPENGL32_funcnames[GLIDX_COUNT] SHARED = { -#define X(X) #X, +#define X(func, ret, args) #func, GLFUNCS_MACRO #undef X }; -GLPROCESSDATA OPENGL32_processdata; DWORD OPENGL32_tls; +GLPROCESSDATA OPENGL32_processdata; + static void OPENGL32_ThreadDetach() { - GLTHREADDATA *lpvData; - /* FIXME - do we need to release some HDC or something? */ - lpvData = (GLTHREADDATA *)TlsGetValue ( OPENGL32_tls ); - if ( lpvData != NULL ) - LocalFree((HLOCAL) lpvData ); + GLTHREADDATA* lpData = NULL; + lpData = (GLTHREADDATA*)TlsGetValue( OPENGL32_tls ); + if (lpData != NULL) + { + if (!HeapFree( GetProcessHeap(), 0, lpData )) + DBGPRINT( "Warning: HeapFree() on GLTHREADDATA failed (%d)", + GetLastError() ); + } } BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved) { GLTHREADDATA* lpData = NULL; - DBGPRINT( "DllMain called!\n" ); + DBGPRINT( "Info: Called!" ); switch ( Reason ) { @@ -68,23 +68,22 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved) memset( &OPENGL32_processdata, 0, sizeof (OPENGL32_processdata) ); - /* get list of ICDs from registry: */ - OPENGL32_LoadDrivers(); + /* get list of ICDs from registry: -- not needed (blight)*/ + /*OPENGL32_LoadDrivers();*/ /* No break: Initialize the index for first thread. */ /* The attached process creates a new thread. */ case DLL_THREAD_ATTACH: - lpData = (GLTHREADDATA*)LocalAlloc(LPTR, sizeof(GLTHREADDATA)); - if ( lpData != NULL ) + //lpData = (GLTHREADDATA*)LocalAlloc(LPTR, sizeof(GLTHREADDATA)); + lpData = (GLTHREADDATA*)HeapAlloc( GetProcessHeap(), + HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY, + sizeof (GLTHREADDATA) ); + if (lpData == NULL) { - memset ( lpData, 0, sizeof(GLTHREADDATA) ); - (void)TlsSetValue ( OPENGL32_tls, lpData ); + DBGPRINT( "Error: Couldn't allocate GLTHREADDATA" ); + return FALSE; } -#if 0 - lpData->hdc = NULL; - /* FIXME - defaulting to mesa3d, but shouldn't */ - lpData->list = OPENGL32_processdata.list[0]; -#endif + TlsSetValue( OPENGL32_tls, lpData ); break; /* The thread of the attached process terminates. */ @@ -110,12 +109,12 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved) */ static void OPENGL32_AppendICD( GLDRIVERDATA *icd ) { - if (!OPENGL32_processdata.driver_list) + if (OPENGL32_processdata.driver_list == NULL) OPENGL32_processdata.driver_list = icd; else { GLDRIVERDATA *p = OPENGL32_processdata.driver_list; - while (p->next) + while (p->next != NULL) p = p->next; p->next = icd; } @@ -133,7 +132,7 @@ static void OPENGL32_RemoveICD( GLDRIVERDATA *icd ) else { GLDRIVERDATA *p = OPENGL32_processdata.driver_list; - while (p) + while (p != NULL) { if (p->next == icd) { @@ -142,28 +141,29 @@ static void OPENGL32_RemoveICD( GLDRIVERDATA *icd ) } p = p->next; } - DBGPRINT( "RemoveICD: ICD 0x%08x not found in list!\n" ); + DBGPRINT( "Error: ICD 0x%08x not found in list!", icd ); } } /* FIXME - I'm assuming we want to return TRUE if we find at least *one* ICD */ +/* not needed at the moment -- blight */ +#if 0 static BOOL OPENGL32_LoadDrivers() { const WCHAR* OpenGLDrivers = L"SOFTWARE\\Microsoft\\Windows NT\\" "CurrentVersion\\OpenGLDrivers\\"; HKEY hkey; WCHAR name[1024]; - int i; /* FIXME - detect if we've already done this from another process */ /* FIXME - special-case load of MESA3D as generic implementation ICD. */ - if ( ERROR_SUCCESS != RegOpenKeyW( HKEY_LOCAL_MACHINE, OpenGLDrivers, &hkey ) ) + if ( ERROR_SUCCESS != RegOpenKey ( HKEY_LOCAL_MACHINE, OpenGLDrivers, &hkey ) ) return FALSE; - for ( i = 0; RegEnumKeyW(hkey,i,name,sizeof(name)/sizeof(name[0])) == ERROR_SUCCESS; i++ ) + for ( int i = 0; RegEnumKeyW(hkey,i,name,sizeof(name)/sizeof(name[0])) == ERROR_SUCCESS; i++ ) { /* ignoring return value, because OPENGL32_LoadICD() is doing *all* the work... */ - /* GLDRIVERDATA* gldd =*/ OPENGL32_LoadICD ( name ); + /*GLDRIVERDATA* gldd =*/ OPENGL32_LoadICD ( name ); } RegCloseKey ( hkey ); if ( i > 0 ) @@ -171,6 +171,7 @@ static BOOL OPENGL32_LoadDrivers() else return FALSE; } +#endif /* 0 */ /* FUNCTION: Load an ICD. * ARGUMENTS: [IN] driver: Name of display driver. @@ -190,32 +191,32 @@ static GLDRIVERDATA *OPENGL32_LoadDriver ( LPCWSTR driver ) WCHAR dll[256]; GLDRIVERDATA *icd; - DBGPRINT( "Loading driver %ws...\n", driver ); + DBGPRINT( "Info: Loading driver %ws...", driver ); /* open registry key */ wcsncat( subKey, driver, 1024 ); ret = RegOpenKeyExW( HKEY_LOCAL_MACHINE, subKey, 0, KEY_READ, &hKey ); if (ret != ERROR_SUCCESS) { - DBGPRINT( "Error: Couldn't open registry key '%ws'\n", subKey ); - return 0; + DBGPRINT( "Error: Couldn't open registry key '%ws'", subKey ); + return NULL; } /* query values */ - size = sizeof (dll); + size = sizeof (dll) * sizeof (dll[0]); ret = RegQueryValueExW( hKey, L"Dll", 0, &type, (LPBYTE)dll, &size ); if (ret != ERROR_SUCCESS || type != REG_SZ) { - DBGPRINT( "Error: Couldn't query Dll value or not a string\n" ); + DBGPRINT( "Error: Couldn't query Dll value or not a string" ); RegCloseKey( hKey ); - return 0; + return NULL; } size = sizeof (DWORD); ret = RegQueryValueExW( hKey, L"Version", 0, &type, (LPBYTE)&version, &size ); if (ret != ERROR_SUCCESS || type != REG_DWORD) { - DBGPRINT( "Warning: Couldn't query Version value or not a DWORD\n" ); + DBGPRINT( "Warning: Couldn't query Version value or not a DWORD" ); version = 0; } @@ -224,7 +225,7 @@ static GLDRIVERDATA *OPENGL32_LoadDriver ( LPCWSTR driver ) (LPBYTE)&driverVersion, &size ); if (ret != ERROR_SUCCESS || type != REG_DWORD) { - DBGPRINT( "Warning: Couldn't query DriverVersion value or not a DWORD\n" ); + DBGPRINT( "Warning: Couldn't query DriverVersion value or not a DWORD" ); driverVersion = 0; } @@ -232,24 +233,26 @@ static GLDRIVERDATA *OPENGL32_LoadDriver ( LPCWSTR driver ) ret = RegQueryValueExW( hKey, L"Flags", 0, &type, (LPBYTE)&flags, &size ); if (ret != ERROR_SUCCESS || type != REG_DWORD) { - DBGPRINT( "Warning: Couldn't query Flags value or not a DWORD\n" ); + DBGPRINT( "Warning: Couldn't query Flags value or not a DWORD" ); flags = 0; } /* close key */ RegCloseKey( hKey ); - DBGPRINT( "Dll = %ws\n", dll ); - DBGPRINT( "Version = 0x%08x\n", version ); - DBGPRINT( "DriverVersion = 0x%08x\n", driverVersion ); - DBGPRINT( "Flags = 0x%08x\n", flags ); + DBGPRINT( "Info: Dll = %ws", dll ); + DBGPRINT( "Info: Version = 0x%08x", version ); + DBGPRINT( "Info: DriverVersion = 0x%08x", driverVersion ); + DBGPRINT( "Info: Flags = 0x%08x", flags ); /* allocate driver data */ - icd = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof (GLDRIVERDATA) ); - if (!icd) + icd = (GLDRIVERDATA*)HeapAlloc( GetProcessHeap(), + HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY, + sizeof (GLDRIVERDATA) ); + if (icd == NULL) { - DBGPRINT( "Error: Couldnt allocate GLDRIVERDATA!\n" ); - return 0; + DBGPRINT( "Error: Couldnt allocate GLDRIVERDATA!" ); + return NULL; } wcsncpy( icd->driver_name, driver, 256 ); wcsncpy( icd->dll, dll, 256 ); @@ -262,15 +265,15 @@ static GLDRIVERDATA *OPENGL32_LoadDriver ( LPCWSTR driver ) if (ret != ERROR_SUCCESS) { if (!HeapFree( GetProcessHeap(), 0, icd )) - DBGPRINT( "Error: HeapFree() returned false, error code = %d\n", + DBGPRINT( "Error: HeapFree() returned false, error code = %d", GetLastError() ); - DBGPRINT( "Error: Couldnt initialize ICD!\n" ); - return 0; + DBGPRINT( "Error: Couldnt initialize ICD!" ); + return NULL; } /* append ICD to list */ OPENGL32_AppendICD( icd ); - DBGPRINT( "ICD loaded.\n" ); + DBGPRINT( "Info: ICD loaded." ); return icd; } @@ -282,8 +285,8 @@ static GLDRIVERDATA *OPENGL32_LoadDriver ( LPCWSTR driver ) * RETURNS: error code; ERROR_SUCCESS on success */ #define LOAD_DRV_PROC( icd, proc, required ) \ - *(char**)&(icd->proc) = (char*)GetProcAddress( icd->handle, #proc ); \ - if (required && !icd->proc) { \ + ((FARPROC)(icd->proc)) = GetProcAddress( icd->handle, #proc ); \ + if (required && icd->proc == NULL) { \ DBGPRINT( "Error: GetProcAddress(\"%s\") failed!", #proc ); \ return GetLastError(); \ } @@ -294,10 +297,11 @@ static DWORD OPENGL32_InitializeDriver( GLDRIVERDATA *icd ) /* load dll */ icd->handle = LoadLibraryW( icd->dll ); - if (!icd->handle) + if (icd->handle == NULL) { - DBGPRINT( "Error: Couldn't load DLL! (%d)\n", GetLastError() ); - return GetLastError(); + DWORD err = GetLastError(); + DBGPRINT( "Error: Couldn't load DLL! (%d)", err ); + return err; } /* load DrvXXX procs */ @@ -322,12 +326,10 @@ static DWORD OPENGL32_InitializeDriver( GLDRIVERDATA *icd ) /* now load the glXXX functions */ for (i = 0; i < GLIDX_COUNT; i++) { - icd->func_list[i] = icd->DrvGetProcAddress( OPENGL32_funcnames[i] ); + icd->func_list[i] = (PVOID)(icd->DrvGetProcAddress( OPENGL32_funcnames[i] )); #ifdef DEBUG_OPENGL32_ICD_EXPORTS - if ( icd->func_list[i] ) - { - DBGPRINT( "Found function %s in ICD.\n", OPENGL32_funcnames[i] ); - } + DBGPRINT( "Info: Function %s %sfound in ICD.", OPENGL32_funcnames[i], + (icd->func_list[i] == NULL) ? ("NOT ") : ("") ); #endif } @@ -342,15 +344,15 @@ static BOOL OPENGL32_UnloadDriver( GLDRIVERDATA *icd ) { BOOL allOk = TRUE; - DBGPRINT( "Unloading driver %ws...\n", icd->driver_name ); - if (icd->refcount) - DBGPRINT( "Warning: ICD refcount = %d (should be 0)\n", icd->refcount ); + DBGPRINT( "Info: Unloading driver %ws...", icd->driver_name ); + if (icd->refcount != 0) + DBGPRINT( "Warning: ICD refcount = %d (should be 0)", icd->refcount ); /* unload dll */ if (!FreeLibrary( icd->handle )) { allOk = FALSE; - DBGPRINT( "Warning: FreeLibrary on ICD %ws failed!\n", icd->dll ); + DBGPRINT( "Warning: FreeLibrary on ICD %ws failed!", icd->dll ); } /* free resources */ @@ -380,7 +382,7 @@ GLDRIVERDATA *OPENGL32_LoadICD ( LPCWSTR driver ) /* not found - try to load */ icd = OPENGL32_LoadDriver ( driver ); - if (icd) + if (icd != NULL) icd->refcount = 1; return icd; } @@ -398,3 +400,4 @@ BOOL OPENGL32_UnloadICD( GLDRIVERDATA *icd ) return TRUE; } +/* EOF */ diff --git a/reactos/lib/opengl32/opengl32.def b/reactos/lib/opengl32/opengl32.def new file mode 100644 index 00000000000..89a8e2a6817 --- /dev/null +++ b/reactos/lib/opengl32/opengl32.def @@ -0,0 +1,401 @@ +; $Id: opengl32.def,v 1.1 2004/02/03 14:23:42 royce Exp $ +; +; opengl32.edf +; +; ReactOS Operating System +; +LIBRARY opengl32.dll +EXPORTS +;DllInitialize + +glAccum=glAccum@8 +glAlphaFunc=glAlphaFunc@8 +glAreTexturesResident=glAreTexturesResident@12 +glArrayElement=glArrayElement@4 +glBegin=glBegin@4 +glBindTexture=glBindTexture@8 +glBitmap=glBitmap@28 +glBlendFunc=glBlendFunc@8 +glCallList=glCallList@4 +glCallLists=glCallLists@12 +glClear=glClear@4 +glClearAccum=glClearAccum@16 +glClearColor=glClearColor@16 +glClearDepth=glClearDepth@4 +glClearIndex=glClearIndex@4 +glClearStencil=glClearStencil@4 +glClipPlane=glClipPlane@8 + +glColor3b=glColor3b@3 +glColor3bv=glColor3b@4 +glColor3d=glColor3d@24 +glColor3dv=glColor3d@4 +glColor3f=glColor3f@12 +glColor3fv=glColor3fv@4 +glColor3i=glColor3i@12 +glColor3iv=glColor3iv@4 +glColor3s=glColor3s@6 +glColor3sv=glColor3sv@4 +glColor3ub=glColor3ub@3 +glColor3ubv=glColor3ubv@4 +glColor3ui=glColor3ui@12 +glColor3uiv=glColor3uiv@4 +glColor3us=glColor3us@6 +glColor3usv=glColor3usv@4 + +glColor4b=glColor4b@4 +glColor4bv=glColor4bv@4 +glColor4d=glColor4d@32 +glColor4dv=glColor4dv@4 +glColor4f=glColor4f@16 +glColor4fv=glColor4fv@4 +glColor4i=glColor4i@16 +glColor4iv=glColor4iv@4 +glColor4s=glColor4s@8 +glColor4sv=glColor4sv@4 +glColor4ub=glColor4ub@4 +glColor4ubv=glColor4ubv@4 +glColor4ui=glColor4ui@16 +glColor4uiv=glColor4uiv@4 +glColor4us=glColor4us@8 +glColor4usv=glColor4usv@4 + +glColorMask=glColorMask@4 +glColorMaterial=glColorMaterial@8 +glColorPointer=glColorPointer@16 +glCopyPixels=glCopyPixels@20 +glCopyTexImage1D=glCopyTexImage1D@28 +glCopyTexImage2D=glCopyTexImage2D@32 +glCopyTexSubImage1D=glCopyTexSubImage1D@24 +glCopyTexSubImage2D=glCopyTexSubImage2D@32 +glCullFace=glCullFace@4 +;glDebugEntry +glDeleteLists=glDeleteLists@8 +glDeleteTextures=glDeleteTextues@8 +glDepthFunc=glDepthFunc@4 +glDepthMask=glDepthMask@4 +glDepthRange=glDepthRange@8 +glDisable=glDisable@4 +glDisableClientState=glDisableClientState@4 +glDrawArrays=glDrawArrays@12 +glDrawBuffer=glDrawBuffer@4 +glDrawElements=glDrawElements@16 +glDrawPixels=glDrawPixels@20 +glEdgeFlag=glEdgeFlag@1 +glEdgeFlagPointer=glEdgeFlagPointer@8 +glEdgeFlagv=glEdgeFlagv@4 +glEnable=glEnable@4 +glEnableClientState=glEnableClientState@4 +glEnd=glEnd@0 +glEndList=glEndList@0 + +glEvalCoord1d=glEvalCoord1d@8 +glEvalCoord1dv=glEvalCoord1dv@4 +glEvalCoord1f=glEvalCoord1f@4 +glEvalCoord1fv=glEvalCoord1fv@4 +glEvalCoord2d=glEvalCoord2d@16 +glEvalCoord2dv=glEvalCoord2dv@4 +glEvalCoord2f=glEvalCoord2f@8 +glEvalCoord2fv=glEvalCoord2fv@4 + +glEvalMesh1=glEvalMesh1@12 +glEvalMesh2=glEvalMesh2@12 +glEvalPoint1=glEvalPoint1@4 +glEvalPoint2=glEvalPoint2@8 +glFeedbackBuffer=glFeedbackBuffer@12 +glFinish=glFinish@0 +glFlush=glFlush@0 +glFogf=glFogf@8 +glFogfv=glFogv@8 +glFogi=glFogi@8 +glFogiv=glFogiv@8 +glFrontFace=glFrontFace@4 +glFrustum=glFrustum@48 +glGenLists=glGenLists@4 +glGenTextures=glGenTextires@8 +glGetBooleanv=glGetBooleanv@8 +glGetClipPlane=glGetClipPlane@8 +glGetDoublev=glGetDoublev@8 +glGetError=glGetError@0 +glGetFloatv=glGetFloatv@8 +glGetIntegerv=glGetIntegerv@8 +glGetLightfv=glGetLightfv@12 +glGetLightiv=glGetLightiv@12 +glGetMapdv=glGetMapdv@12 +glGetMapfv=glGetMapfv@12 +glGetMapiv=glGetMapiv@12 +glGetMaterialfv=glGetMaterialfv@12 +glGetMaterialiv=glGetMaterialiv@12 +glGetPixelMapfv=glGetPixelMapfv@8 +glGetPixelMapuiv=glGetPixelMapuiv@8 +glGetPixelMapusv=glGetPixelMapusv@8 +glGetPointerv=glGetPointerv@8 +glGetPolygonStipple=glGetPolygonStipple@4 +glGetString=glGetString@4 +glGetTexEnvfv=glGetTexEnvfv@12 +glGetTexEnviv=glGetTexEnviv@12 +glGetTexGendv=glGetTexGendv@12 +glGetTexGenfv=glGetTexGenfv@12 +glGetTexGeniv=glGetTexGeniv@12 +glGetTexImage=glGetTexImage@20 +glGetTexLevelParameterfv=glGetTexLevelParameterfv@16 +glGetTexLevelParameteriv=glGetTexLevelParameteriv@16 +glGetTexParameterfv=glGetTexParameterfv@12 +glGetTexParameteriv=glGetTexParameteriv@12 +glHint=glHint@8 +glIndexd=glIndexd@8 +glIndexdv=glIndexdv@4 +glIndexf=glIndexf@4 +glIndexfv=glIndexfv@4 +glIndexi=glIndexi@4 +glIndexiv=glIndexiv@4 +glIndexMask=glIndexMask@4 +glIndexPointer=glIndexPointer@12 +glIndexs=glIndexs@2 +glIndexsv=glIndexsv@4 +glIndexub=glIndexub@1 +glIndexubv=glIndexubv@4 +glInitNames=glInitNames@0 +glInterleavedArrays=glInterleavedArrays@12 +glIsEnabled=glIsEnabled@4 +glIsList=glIsList@4 +glIsTexture=glTexture@4 + +glLightf=glLightf@12 +glLightfv=glLightfv@12 +glLighti=glLighti@12 +glLightiv=glLightiv@12 +glLightModelf=glLightModelf@8 +glLightModelfv=glLightModelfv@8 +glLightModeli=glLightModeli@8 +glLightModeliv=glLightModeliv@8 + +glLineStipple=glLineStipple@6 +glLineWidth=glLineWidth@4 +glListBase=glListBase@4 +glLoadIdentity=glLoadIdentity@0 +glLoadMatrixd=glLoadMatrixd@4 +glLoadMatrixf=glLoadMatrixf@4 +glLoadName=glLoadName@4 +glLogicOp=glLogicOp@4 + +glMap1d=glMap1d@32 +glMap1f=glMap1f@24 +glMap2d=glMap2d@56 +glMap2f=glMap2f@40 +glMapGrid1d=glMapGrid1d@20 +glMapGrid1f=glMapGrid1f@12 +glMapGrid2d=glMapGrid2d@40 +glMapGrid2f=glMapGrid2f@24 + +glMaterialf=glMaterialf@12 +glMaterialfv=glMaterialfv@12 +glMateriali=glMateriali@12 +glMaterialiv=glMaterialiv@12 + +glMatrixMode=glMatrixMode@4 +;GlmfBeginGlsBlock +;GlmfCloseMetaFile +;GlmfEndGlsBlock +;GlmfEndPlayback +;GlmfInitPlayback +;GlmfPlayGlsRecord +glMultMatrixd=glMultMatrixd@4 +glMultMatrixf=glMultMatrixf@4 +glNewList=glNewList@8 + +glNormal3b=glNormal3b@3 +glNormal3bv=glNormal3bv@4 +glNormal3d=glNormal3d@24 +glNormal3dv=glNormal3dv@4 +glNormal3f=glNormal3f@12 +glNormal3fv=glNormal3fv@4 +glNormal3i=glNormal3i@12 +glNormal3iv=glNormal3iv@4 +glNormal3s=glNormal3s@6 +glNormal3sv=glNormal3sv@4 +glNormalPointer=glNormalPointer@12 + +glOrtho=glOrtho@24 +glPassThrough=glPassThrough@4 +glPixelMapfv=glPixelMapfv@12 +glPixelMapuiv=glPixelMapuiv@12 +glPixelMapusv=glPixelMapusv@12 +glPixelStoref=glPixelStoref@8 +glPixelStorei=glPixelStorei@8 +glPixelTransferf=glPixelTransferf@8 +glPixelTransferi=glPixelTransferi@8 +glPixelZoom=glPixelZoom@8 +glPointSize=glPointSize@4 +glPolygonMode=glPolygonMode@8 +glPolygonOffset=glPolygonOffset@8 +glPolygonStipple=glPolygonStipple@4 +glPopAttrib=glPopAttrib@0 +glPopClientAttrib=glPopClientAttrib@0 +glPopMatrix=glPopMatrix@0 +glPopName=glPopName@0 +glPrioritizeTextures=glPrioritizeTextures@12 +glPushAttrib=glPushAttrib@4 +glPushClientAttrib=glPushClientAttrib@4 +glPushMatrix=glPushMatrix@0 +glPushName=glPushName@4 +glRasterPos2d=glRasterPos2d@16 +glRasterPos2dv=glRasterPos2dv@4 +glRasterPos2f=glRasterPos2f@8 +glRasterPos2fv=glRasterPos2fv@4 +glRasterPos2i=glRasterPos2i@8 +glRasterPos2iv=glRasterPos2iv@4 +glRasterPos2s=glRasterPos2s@8 +glRasterPos2sv=glRasterPos2sv@8 +glRasterPos3d=glRasterPos3d@24 +glRasterPos3dv=glRasterPos3dv@4 +glRasterPos3f=glRasterPos3f@12 +glRasterPos3fv=glRasterPos3fv@4 +glRasterPos3i=glRasterPos3i@12 +glRasterPos3iv=glRasterPos3iv@4 +glRasterPos3s=glRasterPos3s@12 +glRasterPos3sv=glRasterPos3sv@4 +glRasterPos4d=glRasterPos4d@32 +glRasterPos4dv=glRasterPos4dv@4 +glRasterPos4f=glRasterPos4f@16 +glRasterPos4fv=glRasterPos4fv@4 +glRasterPos4i=glRasterPos4i@16 +glRasterPos4iv=glRasterPos4iv@4 +glRasterPos4s=glRasterPos4s@16 +glRasterPos4sv=glRasterPos4sv@4 +glReadBuffer=glReadBuffer@4 +glReadPixels=glReadPixels@28 +glRectd=glRectd@32 +glRectdv=glRectdv@4 +glRectf=glRectf@16 +glRectfv=glRectfv@4 +glRecti=glRecti@16 +glRectiv=glRectiv@4 +glRects=glRects@16 +glRectsv=glRectsv@4 +glRenderMode=glRenderMode@4 +glRotated=glRotated@32 +glRotatef=glRotatef@16 +glScaled=glScaled@24 +glScalef=glScalef@12 +glScissor=glScissor@16 +glSelectBuffer=glSelectBuffer@8 +glShadeModel=glShadeModel@4 +glStencilFunc=glStencilFunc@12 +glStencilMask=glStencilMask@4 +glStencilOp=glStencilOp@12 + +glTexCoord1d=glTexCoord1d@8 +glTexCoord1dv=glTexCoord1dv@4 +glTexCoord1f=glTexCoord1f@4 +glTexCoord1fv=glTexCoord1fv@4 +glTexCoord1i=glTexCoord1i@4 +glTexCoord1iv=glTexCoord1iv@4 +glTexCoord1s=glTexCoord1s@2 +glTexCoord1sv=glTexCoord1sv@4 + +glTexCoord2d=glTexCoord2d@16 +glTexCoord2dv=glTexCoord2dv@4 +glTexCoord2f=glTexCoord2f@8 +glTexCoord2fv=glTexCoord2fv@4 +glTexCoord2i=glTexCoord2i@8 +glTexCoord2iv=glTexCoord2iv@4 +glTexCoord2s=glTexCoord2s@4 +glTexCoord2sv=glTexCoord2sv@4 + +glTexCoord3d=glTexCoord3d@24 +glTexCoord3dv=glTexCoord3dv@4 +glTexCoord3f=glTexCoord3f@12 +glTexCoord3fv=glTexCoord3fv@4 +glTexCoord3i=glTexCoord3i@12 +glTexCoord3iv=glTexCoord3iv@4 +glTexCoord3s=glTexCoord3s@6 +glTexCoord3sv=glTexCoord3sv@4 + +glTexCoord4d=glTexCoord4d@32 +glTexCoord4dv=glTexCoord4dv@4 +glTexCoord4f=glTexCoord4f@16 +glTexCoord4fv=glTexCoord4fv@4 +glTexCoord4i=glTexCoord4i@16 +glTexCoord4iv=glTexCoord4iv@4 +glTexCoord4s=glTexCoord4s@8 +glTexCoord4sv=glTexCoord4sv@4 + +glTexCoordPointer=glTexCoordPointer@16 +glTexEnvf=glTexEnvf@12 +glTexEnvfv=glTexEnvfv@12 +glTexEnvi=glTexEnvi@12 +glTexEnviv=glTexEnviv@12 +glTexGend=glTexGend@16 +glTexGendv=glTexGendv@12 +glTexGenf=glTexGenf@12 +glTexGenfv=glTexGenfv@12 +glTexGeni=glTexGeni@12 +glTexGeniv=glTexGeniv@12 +glTexImage1D=glTexImage1D@32 +glTexImage2D=glTexImage2d@36 +glTexParameterf=glTexParameterf@12 +glTexParameterfv=glTexParameterfv@12 +glTexParameteri=glTexParameteri@12 +glTexParameteriv=glTexParameteriv@12 +glTexSubImage1D=glTexSubImage1D@28 +glTexSubImage2D=glTexSubImage2D@36 + +glTranslated=glTranslated@32 +glTranslatef=glTranslated@16 + +glVertex2d=glVertex2d@16 +glVertex2dv=glVertex2dv@4 +glVertex2f=glVertex2f@8 +glVertex2fv=glVertex2fv@4 +glVertex2i=glVertex2i@8 +glVertex2iv=glVertex2iv@4 +glVertex2s=glVertex2s@4 +glVertex2sv=glVertex2sv@4 + +glVertex3d=glVertex3d@24 +glVertex3dv=glVertex3dv@4 +glVertex3f=glVertex3f@12 +glVertex3fv=glVertex3fv@4 +glVertex3i=glVertex3i@12 +glVertex3iv=glVertex3iv@4 +glVertex3s=glVertex3s@6 +glVertex3sv=glVertex3sv@4 + +glVertex4d=glVertex4d@32 +glVertex4dv=glVertex4dv@4 +glVertex4f=glVertex4f@16 +glVertex4fv=glVertex4fv@4 +glVertex4i=glVertex4i@16 +glVertex4iv=glVertex4iv@4 +glVertex4s=glVertex4s@8 +glVertex4sv=glVertex4sv@4 + +glVertexPointer=glVertexPointer@16 +glViewport=glViewport@16 + +wglChoosePixelFormat=GDI32.ChoosePixelFormat +wglCopyContext=wglCopyContext@12 +wglCreateContext=wglCreateContext@4 +wglCreateLayerContext=wglCreateLayerContext@8 +wglDeleteContext=wglDeleteContext@4 +wglDescribeLayerPlane=wglDescribeLayerPlane@20 +wglDescribePixelFormat=GDI32.DescribePixelFormat +wglGetCurrentContext=wglGetCurrentContext@0 +wglGetCurrentDC=wglGetCurrentDC@0 +;wglGetDefaultProcAddress=wglGetDefaultProcAddress@ +wglGetLayerPaletteEntries=wglGetLayerPaletteEntries@20 +wglGetPixelFormat=GDI32.GetPixelFormat +wglGetProcAddress=wglGetProcAddress@4 +wglMakeCurrent=wglMakeCurrent@8 +wglRealizeLayerPalette=wglRealizeLayerPalette@12 +wglSetLayerPaletteEntries=wglSetLayerPaletteEntries@20 +wglSetPixelFormat=GDI32.SetPixelFormat +wglShareLists=wglShareLists@8 +wglSwapBuffers=GDI32.SwapBuffers +wglSwapLayerBuffers=wglSwapLayerBuffers@8 +;wglSwapMultipleBuffers=wglSwapMultipleBuffers@ +wglUseFontBitmapsA=wglUseFontBitmapsA@16 +wglUseFontBitmapsW=wglUseFontBitmapsW@16 +wglUseFontOutlinesA=wglUseFontOutlinesA@32 +wglUseFontOutlinesW=wglUseFontOutlinesW@32 diff --git a/reactos/lib/opengl32/opengl32.h b/reactos/lib/opengl32/opengl32.h index de047bd154f..eed4ad1da48 100644 --- a/reactos/lib/opengl32/opengl32.h +++ b/reactos/lib/opengl32/opengl32.h @@ -1,4 +1,4 @@ -/* $Id: opengl32.h,v 1.6 2004/02/02 17:59:23 navaraf Exp $ +/* $Id: opengl32.h,v 1.7 2004/02/03 14:23:42 royce Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -14,17 +14,27 @@ /* debug flags */ #define DEBUG_OPENGL32 -#define DEBUG_OPENGL32_ICD_EXPORTS /* dumps the list of supported glXXX +#define DEBUG_OPENGL32_ICD_EXPORTS /* dumps the list of (un)supported glXXX functions when an ICD is loaded. */ -#ifdef DEBUG_OPENGL32 -ULONG DbgPrint(PCH Format,...); -# define DBGPRINT DbgPrint( "OpenGL32.DLL: " ), DbgPrint +/* debug macros */ +#if 0//def DEBUG_OPENGL32 +# include +# define DBGPRINT( fmt, args... ) \ + DPRINT( "OpenGL32.DLL: %s: "fmt, __FUNCTION__, ##args ) #else # define DBGPRINT( ... ) do {} while (0) #endif +/* function/data attributes */ +#define EXPORT __declspec(dllexport) +#define NAKED __attribute__((naked)) +#define SHARED __attribute__((section("shared"), shared)) + + /* gl function list */ +#include "glfuncs.h" +#if 0 #define GLFUNCS_MACRO \ X(glAccum) \ X(glAddSwapHintRectWIN) \ @@ -364,12 +374,13 @@ ULONG DbgPrint(PCH Format,...); X(glVertex4sv) \ X(glVertexPointer) \ X(glViewport) +#endif /* 0 */ /* table indices for funcnames and function pointers */ enum glfunc_indices { GLIDX_INVALID = -1, -#define X(X) GLIDX_##X, +#define X(func, ret, args) GLIDX_##func, GLFUNCS_MACRO #undef X GLIDX_COUNT @@ -422,7 +433,8 @@ typedef struct tagGLRC GLDRIVERDATA *icd; /* driver used for this context */ INT iFormat; /* current pixel format index - ? */ HDC hdc; /* DC handle */ - DWORD threadid; /* thread holding this context */ + BOOL is_current; /* wether this context is current for some DC */ + DWORD thread_id; /* thread holding this context */ HGLRC hglrc; /* GLRC from DrvCreateContext */ PVOID func_list[GLIDX_COUNT]; /* glXXX function pointers */ @@ -440,14 +452,17 @@ typedef struct tagGLPROCESSDATA /* TLS data */ typedef struct tagGLTHREADDATA { - GLRC *hglrc; /* current GL rendering context */ + GLRC *glrc; /* current GL rendering context */ } GLTHREADDATA; extern DWORD OPENGL32_tls; extern GLPROCESSDATA OPENGL32_processdata; +#define OPENGL32_threaddata ((GLTHREADDATA *)TlsGetValue( OPENGL32_tls )) /* function prototypes */ GLDRIVERDATA *OPENGL32_LoadICD( LPCWSTR driver ); BOOL OPENGL32_UnloadICD( GLDRIVERDATA *icd ); #endif//OPENGL32_PRIVATE_H + +/* EOF */ diff --git a/reactos/lib/opengl32/stubs.c b/reactos/lib/opengl32/stubs.c index 679f0a2915b..6900e9d92db 100644 --- a/reactos/lib/opengl32/stubs.c +++ b/reactos/lib/opengl32/stubs.c @@ -1,4 +1,4 @@ -/* $Id: stubs.c,v 1.2 2004/02/01 17:07:16 royce Exp $ +/* $Id: stubs.c,v 1.3 2004/02/03 14:23:42 royce Exp $ * * COPYRIGHT: See COPYING in the top level directory * PROJECT: ReactOS kernel @@ -11,7 +11,7 @@ #define WIN32_LEAN_AND_MEAN #include -#include +/*#include */ #include "opengl32.h" GLFUNCLIST* diff --git a/reactos/lib/opengl32/wgl.c b/reactos/lib/opengl32/wgl.c index 76b93c5fcd6..b2362ed73db 100644 --- a/reactos/lib/opengl32/wgl.c +++ b/reactos/lib/opengl32/wgl.c @@ -15,18 +15,200 @@ #include "opengl32.h" -BOOL WINAPI wglCopyContext( HGLRC src, HGLRC dst, UINT mask ) +/* FUNCTION: Append OpenGL Rendering Context (GLRC) to list + * ARGUMENTS: [IN] glrc: GLRC to append to list + * TODO: protect from race conditions + */ +static void WGL_AppendContext( GLRC *glrc ) { + if (OPENGL32_processdata.glrc_list == NULL) + OPENGL32_processdata.glrc_list = glrc; + else + { + GLRC *p = OPENGL32_processdata.glrc_list; + while (p->next != NULL) + p = p->next; + p->next = glrc; + } +} + + +/* FUNCTION: Remove OpenGL Rendering Context (GLRC) from list + * ARGUMENTS: [IN] glrc: GLRC to remove from list + * TODO: protect from race conditions + */ +static void WGL_RemoveContext( GLRC *glrc ) +{ + if (glrc == OPENGL32_processdata.glrc_list) + OPENGL32_processdata.glrc_list = glrc->next; + else + { + GLRC *p = OPENGL32_processdata.glrc_list; + while (p != NULL) + { + if (p->next == glrc) + { + p->next = glrc->next; + return; + } + p = p->next; + } + DBGPRINT( "Error: GLRC 0x%08x not found in list!", glrc ); + } +} + +/* FUNCTION: Check wether a GLRC is in the list + * ARGUMENTS: [IN] glrc: GLRC to remove from list + */ +static BOOL WGL_ContainsContext( GLRC *glrc ) +{ + GLRC *p = OPENGL32_processdata.glrc_list; + + while (p != NULL) + { + if (p == glrc) + return TRUE; + p = p->next; + } + return FALSE; } -HGLRC WINAPI wglCreateContext( HDC hdc ) + + +/* FUNCTION: Copy data specified by mask from one GLRC to another. + * ARGUMENTS: [IN] src Source GLRC + * [OUT] dst Destination GLRC + * [IN] mask Bitfield like given to glPushAttrib() + * RETURN: TRUE on success, FALSE on failure + */ +BOOL WINAPI wglCopyContext( HGLRC hsrc, HGLRC hdst, UINT mask ) { - return wglCreateLayerContext( hdc, 0 ); + GLRC *src = (GLRC *)hsrc; + GLRC *dst = (GLRC *)hdst; + + /* check glrcs */ + if (!WGL_ContainsContext( src )) + { + DBGPRINT( "Error: src GLRC not found!" ); + return FALSE; /* FIXME: SetLastError() */ + } + if (!WGL_ContainsContext( dst )) + { + DBGPRINT( "Error: dst GLRC not found!" ); + return FALSE; /* FIXME: SetLastError() */ + } + + /* I think this is only possible within one ICD */ + if (src->icd != src->icd) + { + DBGPRINT( "Error: src and dst GLRC use different ICDs!" ); + return FALSE; + } + + /* copy data (call ICD) */ + return src->icd->DrvCopyContext( src->hglrc, dst->hglrc, mask ); } +/* FUNCTION: Create a new GL Rendering Context for the given DC. + * ARGUMENTS: [IN] hdc Handle for DC for which to create context + * RETURNS: NULL on failure, new GLRC on success + */ +HGLRC WINAPI wglCreateContext( HDC hdc ) +{ + HKEY hKey; + WCHAR subKey[1024] = L"SOFTWARE\\Microsoft\\Windows NT\\" + "CurrentVersion\\OpenGLDrivers"; + LONG ret; + WCHAR driver[256]; + DWORD size; + DWORD dw; + FILETIME time; + + GLDRIVERDATA *icd; + GLRC *glrc; + HGLRC drvHglrc = NULL; + + if (GetObjectType( hdc ) != OBJ_DC) + { + DBGPRINT( "Error: hdc is not a DC handle!" ); + return NULL; + } + + /* open "OpenGLDrivers" key */ + ret = RegOpenKeyExW( HKEY_LOCAL_MACHINE, subKey, 0, KEY_READ, &hKey ); + if (ret != ERROR_SUCCESS) + { + DBGPRINT( "Error: Couldn't open registry key '%ws'", subKey ); + return NULL; + } + + /* allocate our GLRC */ + glrc = (GLRC*)HeapAlloc( GetProcessHeap(), + HEAP_ZERO_MEMORY | HEAP_GENERATE_EXCEPTIONS, sizeof (GLRC) ); + if (!glrc) + return NULL; + + /* try to find an ICD */ + for (dw = 0; ; dw++) + { + size = 256; + ret = RegEnumKeyExW( hKey, dw, driver, &size, NULL, NULL, NULL, &time ); + if (ret != ERROR_SUCCESS ) + break; + + icd = OPENGL32_LoadICD( driver ); + if (icd == NULL) /* try next ICD */ + continue; + + drvHglrc = icd->DrvCreateContext( hdc ); + if (drvHglrc == NULL) /* try next ICD */ + { + DBGPRINT( "Info: DrvCreateContext (driver = %ws) failed: %d", + icd->driver_name, GetLastError() ); + OPENGL32_UnloadICD( icd ); + continue; + } + + /* the ICD was loaded successfully and we got a HGLRC in drvHglrc */ + break; + } + RegCloseKey( hKey ); + + if (drvHglrc == NULL) /* no ICD was found */ + { + /* FIXME: fallback to mesa */ + DBGPRINT( "Error: No ICD found!" ); + HeapFree( GetProcessHeap(), 0, glrc ); + return NULL; + } + + /* we have our GLRC in glrc and the ICD's GLRC in drvHglrc */ + glrc->hglrc = drvHglrc; + glrc->iFormat = -1; /* what is this used for? */ + glrc->icd = icd; + memcpy( glrc->func_list, icd->func_list, sizeof (PVOID) * GLIDX_COUNT ); + + /* FIXME: fill NULL-pointers in glrc->func_list with mesa functions */ + + /* append glrc to context list */ + WGL_AppendContext( glrc ); + + return (HGLRC)glrc; + + /* FIXME: dunno if this is right, would be nice :) */ + /*return wglCreateLayerContext( hdc, 0 );*/ +} + + +/* FUNCTION: Create a new GL Rendering Context for the given plane on + * the given DC. + * ARGUMENTS: [IN] hdc Handle for DC for which to create context + * [IN] layer Layer number to bind (draw?) to + * RETURNS: NULL on failure, new GLRC on success + */ HGLRC WINAPI wglCreateLayerContext( HDC hdc, int layer ) { HKEY hKey; @@ -39,28 +221,30 @@ HGLRC WINAPI wglCreateLayerContext( HDC hdc, int layer ) FILETIME time; GLDRIVERDATA *icd; + GLRC *glrc; HGLRC drvHglrc = NULL; - GLRC *hglrc; if (GetObjectType( hdc ) != OBJ_DC) { - DBGPRINT( "Wrong object type" ); + DBGPRINT( "Error: hdc is not a DC handle!" ); return NULL; } - /* find out which icd to load */ + /* open "OpenGLDrivers" key */ ret = RegOpenKeyExW( HKEY_LOCAL_MACHINE, subKey, 0, KEY_READ, &hKey ); if (ret != ERROR_SUCCESS) { - DBGPRINT( "Error: Couldn't open registry key '%ws'\n", subKey ); - return FALSE; + DBGPRINT( "Error: Couldn't open registry key '%ws'", subKey ); + return NULL; } /* allocate our GLRC */ - hglrc = HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof (GLRC) ); - if (!hglrc) + glrc = (GLRC*)HeapAlloc( GetProcessHeap(), + HEAP_ZERO_MEMORY | HEAP_GENERATE_EXCEPTIONS, sizeof (GLRC) ); + if (!glrc) return NULL; + /* try to find an ICD */ for (dw = 0; ; dw++) { size = 256; @@ -69,84 +253,212 @@ HGLRC WINAPI wglCreateLayerContext( HDC hdc, int layer ) break; icd = OPENGL32_LoadICD( driver ); - if (!icd) + if (icd == NULL) /* try next ICD */ continue; drvHglrc = icd->DrvCreateLayerContext( hdc, layer ); - if (!drvHglrc) + if (drvHglrc == NULL) /* try next ICD */ { - DBGPRINT( "Info: DrvCreateLayerContext (driver = %ws) failed: %d\n", + DBGPRINT( "Info: DrvCreateLayerContext (driver = %ws) failed: %d", icd->driver_name, GetLastError() ); OPENGL32_UnloadICD( icd ); continue; } - /* the ICD was loaded successfully and we got a HGLRC -- success! */ + /* the ICD was loaded successfully and we got a HGLRC in drvHglrc */ break; } RegCloseKey( hKey ); - if (!drvHglrc) + if (drvHglrc == NULL) /* no ICD was found */ { /* FIXME: fallback to mesa */ - HeapFree( GetProcessHeap(), 0, hglrc ); + DBGPRINT( "Error: No ICD found!" ); + HeapFree( GetProcessHeap(), 0, glrc ); return NULL; } - /* we have our GLRC in hglrc and the ICDs in drvHglrc */ - hglrc->hglrc = drvHglrc; - hglrc->iFormat = -1; /* what is this used for? */ - hglrc->icd = icd; - hglrc->threadid = 0xFFFFFFFF; /* TODO: make sure this is the "invalid" value */ - memcpy( hglrc->func_list, icd->func_list, sizeof (PVOID) * GLIDX_COUNT ); + /* we have our GLRC in glrc and the ICD's GLRC in drvHglrc */ + glrc->hglrc = drvHglrc; + glrc->iFormat = -1; /* what is this used for? */ + glrc->icd = icd; + memcpy( glrc->func_list, icd->func_list, sizeof (PVOID) * GLIDX_COUNT ); - /* FIXME: fill NULL-pointers in hglrc->func_list with mesa functions */ + /* FIXME: fill NULL-pointers in glrc->func_list with mesa functions */ - /* FIXME: append hglrc to process-local list of contexts */ + /* append glrc to context list */ + WGL_AppendContext( glrc ); + + return (HGLRC)glrc; } +/* FUNCTION: Delete an OpenGL context + * ARGUMENTS: [IN] hglrc Handle to GLRC to delete; must not be a threads RC! + * RETURNS: TRUE on success, FALSE otherwise + */ BOOL WINAPI wglDeleteContext( HGLRC hglrc ) { - return FALSE; + GLRC *glrc = (GLRC *)hglrc; + + /* check if we know about this context */ + if (!WGL_ContainsContext( glrc )) + { + DBGPRINT( "Error: hglrc not found!" ); + return FALSE; /* FIXME: SetLastError() */ + } + + /* make sure GLRC is not current for some thread */ + if (glrc->is_current) + { + DBGPRINT( "Error: GLRC is current for DC 0x%08x", glrc->hdc ); + return FALSE; /* FIXME: SetLastError() */ + } + + /* release ICD's context */ + if (glrc->hglrc != NULL) + { + if (!glrc->icd->DrvDeleteContext( glrc->hglrc )) + { + DBGPRINT( "Warning: DrvDeleteContext() failed (%d)", GetLastError() ); + return FALSE; + } + } + + /* free resources */ + WGL_RemoveContext( glrc ); + HeapFree( GetProcessHeap(), 0, glrc ); + + return TRUE; } BOOL WINAPI wglDescribeLayerPlane( HDC hdc, int iPixelFormat, int iLayerPlane, UINT nBytes, LPLAYERPLANEDESCRIPTOR plpd ) { + + return FALSE; } +/* FUNCTION: Return the current GLRC + * RETURNS: Current GLRC (NULL if none was set current) + */ HGLRC WINAPI wglGetCurrentContext() { - return NULL; + return (HGLRC)(OPENGL32_threaddata->glrc); } +/* FUNCTION: Return the current DC + * RETURNS: NULL on failure, current DC otherwise + */ HDC WINAPI wglGetCurrentDC() { - return NULL; + /* FIXME: is it correct to return NULL when there is no current GLRC or + is there another way to find out the wanted HDC? */ + if (OPENGL32_threaddata->glrc == NULL) + return NULL; + return (HDC)(OPENGL32_threaddata->glrc->hdc); } int WINAPI wglGetLayerPaletteEntries( HDC hdc, int iLayerPlane, int iStart, - int cEntries, COLORREF *pcr ) + int cEntries, COLORREF *pcr ) { return 0; } +/* FUNCTION: Get the address for an OpenGL extension function from the current ICD. + * ARGUMENTS: [IN] proc: Name of the function to look for + * RETURNS: The address of the proc or NULL on failure. + */ PROC WINAPI wglGetProcAddress( LPCSTR proc ) { + if (OPENGL32_threaddata->glrc == NULL) + { + DBGPRINT( "Error: No current GLRC!" ); + return NULL; + } + + if (proc[0] == 'g' && proc[1] == 'l') /* glXXX */ + { + PROC glXXX = OPENGL32_threaddata->glrc->icd->DrvGetProcAddress( proc ); + if (glXXX) + { + DBGPRINT( "Info: Proc \"%s\" loaded from ICD.", proc ); + return glXXX; + } + + /* FIXME: go through own functions? */ + DBGPRINT( "Unsupported GL extension: %s", proc ); + } + else if (proc[0] == 'w' && proc[1] == 'g' && proc[2] == 'l') /* wglXXX */ + { + /* FIXME: support wgl extensions? (there are such IIRC) */ + DBGPRINT( "Unsupported WGL extension: %s", proc ); + } + else if (proc[0] == 'g' && proc[1] == 'l' && proc[2] == 'u') /* gluXXX */ + { + DBGPRINT( "GLU extension %s requested, returning NULL", proc ); + } + return NULL; } +/* FUNCTION: make the given GLRC the threads current GLRC for hdc + * ARGUMENTS: [IN] hdc Handle for a DC to be drawn on + * [IN] hglrc Handle for a GLRC to make current + * RETURNS: TRUE on success, FALSE otherwise + */ BOOL WINAPI wglMakeCurrent( HDC hdc, HGLRC hglrc ) { - return FALSE; + GLRC *glrc = (GLRC *)hglrc; + + /* check hdc */ + if (GetObjectType( hdc ) != OBJ_DC) + { + DBGPRINT( "Error: hdc is not a DC handle!" ); + return FALSE; + } + + /* check if we know about this glrc */ + if (!WGL_ContainsContext( glrc )) + { + DBGPRINT( "Error: hglrc not found!" ); + return FALSE; /* FIXME: SetLastError() */ + } + + /* check if it is available */ + if (glrc->is_current) /* used by another thread */ + { + DBGPRINT( "Error: hglrc is current for thread 0x%08x", glrc->thread_id ); + return FALSE; /* FIXME: SetLastError() */ + } + + /* call the ICD */ + if (glrc->hglrc != NULL) + { + /* FIXME: which function to call? DrvSetContext? + does it crash with NULL as SetContextCallBack? */ + if (!glrc->icd->DrvSetContext( hdc, glrc->hglrc, NULL )) + { + DBGPRINT( "Error: DrvSetContext failed (%d)\n", GetLastError() ); + return FALSE; + } + } + + /* make it current */ + if (OPENGL32_threaddata->glrc != NULL) + OPENGL32_threaddata->glrc->is_current = FALSE; + glrc->is_current = TRUE; + glrc->thread_id = GetCurrentThreadId(); + OPENGL32_threaddata->glrc = glrc; + + return TRUE; } @@ -157,14 +469,71 @@ BOOL WINAPI wglRealizeLayerPalette( HDC hdc, int iLayerPlane, BOOL bRealize ) int WINAPI wglSetLayerPaletteEntries( HDC hdc, int iLayerPlane, int iStart, - int cEntries, CONST COLORREF *pcr ) + int cEntries, CONST COLORREF *pcr ) { return 0; } - +/* FUNCTION: Enable display-list sharing between multiple GLRCs + * ARGUMENTS: [IN] hglrc1 GLRC number 1 + * [IN] hglrc2 GLRC number 2 + * RETURNS: TRUR on success, FALSE on failure + */ BOOL WINAPI wglShareLists( HGLRC hglrc1, HGLRC hglrc2 ) { + GLRC *glrc1 = (GLRC *)hglrc1; + GLRC *glrc2 = (GLRC *)hglrc2; + + /* check glrcs */ + if (!WGL_ContainsContext( glrc1 )) + { + DBGPRINT( "Error: hglrc1 not found!" ); + return FALSE; /* FIXME: SetLastError() */ + } + if (!WGL_ContainsContext( glrc2 )) + { + DBGPRINT( "Error: hglrc2 not found!" ); + return FALSE; /* FIXME: SetLastError() */ + } + + /* I think this is only possible within one ICD */ + if (glrc1->icd != glrc2->icd) + { + DBGPRINT( "Error: hglrc1 and hglrc2 use different ICDs!" ); + return FALSE; + } + + /* share lists (call ICD) */ + return glrc1->icd->DrvShareLists( glrc1->hglrc, glrc2->hglrc ); +} + +/* FUNCTION: Flushes GL and swaps front/back buffer if appropriate + * ARGUMENTS: [IN] hdc Handle to device context to swap buffers for + * RETURNS: TRUE on success, FALSE on failure + */ +BOOL WINAPI wglSwapBuffers( HDC hdc ) +{ + /* check if there is a current GLRC */ + if (OPENGL32_threaddata->glrc == NULL) + { + DBGPRINT( "Error: No current GL context!" ); + return FALSE; + } + + /* ask ICD to swap buffers */ + /* FIXME: also ask ICD when we didnt use it to create the context/it couldnt? */ + if (OPENGL32_threaddata->glrc->hglrc != NULL) + { + if (!OPENGL32_threaddata->glrc->icd->DrvSwapBuffers( hdc )) + { + DBGPRINT( "Error: DrvSwapBuffers failed (%d)", GetLastError() ); + return FALSE; + } + return TRUE; + } + + /* FIXME: implement own functionality */ + return FALSE; } @@ -188,17 +557,18 @@ BOOL WINAPI wglUseFontBitmapsW( HDC hdc, DWORD first, DWORD count, DWORD listBa BOOL WINAPI wglUseFontOutlinesA( HDC hdc, DWORD first, DWORD count, DWORD listBase, - FLOAT deviation, FLOAT extrusion, int format, - LPGLYPHMETRICSFLOAT lpgmf ) + FLOAT deviation, FLOAT extrusion, int format, + LPGLYPHMETRICSFLOAT lpgmf ) { return FALSE; } BOOL WINAPI wglUseFontOutlinesW( HDC hdc, DWORD first, DWORD count, DWORD listBase, - FLOAT deviation, FLOAT extrusion, int format, - LPGLYPHMETRICSFLOAT lpgmf ) + FLOAT deviation, FLOAT extrusion, int format, + LPGLYPHMETRICSFLOAT lpgmf ) { return FALSE; } +/* EOF */