TARGET_NAME = opengl32
# -fno-builtin
-TARGET_CFLAGS = -D__USE_W32API -DUNICODE -D_M_IX86 -Os
+TARGET_CFLAGS = -D__USE_W32API -DUNICODE -D_M_IX86 -Os -g3
# require os code to explicitly request A/W version of structs/functions
TARGET_CFLAGS += -D_DISABLE_TIDENTS -Wall -Werror
gl.o \
opengl32.o \
wgl.o \
- tebimports.o
+ #tebimports.o
DEP_OBJECTS = $(TARGET_OBJECTS)
long l11, long l12, long l13, long l14 )
{ return 0; }
-#if !defined(_M_IX86)
+#if 1//!defined(_M_IX86)
# define X(func, ret, typeargs, args, icdidx, tebidx, stack) \
ret STDCALL func typeargs \
{ \
{
DWORD num_funcs; /* Normally 336 (0x150) */
PROC dispatch_table[812];
-} ICDTable;
+} ICDTable, *PICDTable;
#endif /* OPENGL32_PRIVATE_ICDTABLE_H */
-/* $Id: opengl32.h,v 1.12 2004/02/09 08:00:15 vizzini Exp $
+/* $Id: opengl32.h,v 1.13 2004/02/11 17:39:24 vizzini Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
/* gl function list */
#include "glfuncs.h"
-/* table indices for funcnames and function pointers */
-#if 0
-enum glfunc_indices
-{
- GLIDX_INVALID = -1,
-#define X(func, ret, typeargs, args) GLIDX_##func,
- GLFUNCS_MACRO
-#undef X
- GLIDX_COUNT
-};
-
-/* function name table */
-extern const char* OPENGL32_funcnames[GLIDX_COUNT];
-#endif//0
-
/* GL data types - x86 typedefs */
typedef unsigned int GLenum;
typedef unsigned char GLboolean;
typedef void GLvoid;
/* Called by the driver to set the dispatch table */
-typedef DWORD (CALLBACK * SetContextCallBack)( const ICDTable * );
+typedef DWORD APIENTRY (*SetContextCallBack)( const ICDTable * );
/* OpenGL ICD data */
typedef struct tagGLDRIVERDATA
DWORD driver_version; /* DriverVersion value from registry */
DWORD flags; /* Flags value from registry */
- BOOL (*DrvCopyContext)( HGLRC, HGLRC, UINT );
- HGLRC (*DrvCreateContext)( HDC );
- HGLRC (*DrvCreateLayerContext)( HDC, int );
- BOOL (*DrvDeleteContext)( HGLRC );
- BOOL (*DrvDescribeLayerPlane)( HDC, int, int, UINT, LPLAYERPLANEDESCRIPTOR );
- int (*DrvDescribePixelFormat)( IN HDC, IN int, IN UINT, OUT LPPIXELFORMATDESCRIPTOR );
- int (*DrvGetLayerPaletteEntries)( HDC, int, int, int, COLORREF * );
- FARPROC (*DrvGetProcAddress)( LPCSTR lpProcName );
- void (*DrvReleaseContext)();
- BOOL (*DrvRealizeLayerPalette)( HDC, int, BOOL );
- int (*DrvSetContext)( HDC hdc, HGLRC hglrc, SetContextCallBack callback );
- int (*DrvSetLayerPaletteEntries)( HDC, int, int, int, CONST COLORREF * );
- BOOL (*DrvSetPixelFormat)( IN HDC, IN int, IN CONST PIXELFORMATDESCRIPTOR * );
- BOOL (*DrvShareLists)( HGLRC, HGLRC );
- BOOL (*DrvSwapBuffers)( HDC );
- BOOL (*DrvSwapLayerBuffers)( HDC, UINT );
- BOOL (*DrvValidateVersion)( DWORD );
+ BOOL APIENTRY (*DrvCopyContext)( HGLRC, HGLRC, UINT );
+ HGLRC APIENTRY (*DrvCreateContext)( HDC );
+ HGLRC APIENTRY (*DrvCreateLayerContext)( HDC, int );
+ BOOL APIENTRY (*DrvDeleteContext)( HGLRC );
+ BOOL APIENTRY (*DrvDescribeLayerPlane)( HDC, int, int, UINT, LPLAYERPLANEDESCRIPTOR );
+ int APIENTRY (*DrvDescribePixelFormat)( IN HDC, IN int, IN UINT, OUT LPPIXELFORMATDESCRIPTOR );
+ int APIENTRY (*DrvGetLayerPaletteEntries)( HDC, int, int, int, COLORREF * );
+ FARPROC APIENTRY (*DrvGetProcAddress)( LPCSTR lpProcName );
+ void APIENTRY (*DrvReleaseContext)();
+ BOOL APIENTRY (*DrvRealizeLayerPalette)( HDC, int, BOOL );
+ PICDTable APIENTRY (*DrvSetContext)( HDC hdc, HGLRC hglrc, SetContextCallBack callback );
+ int APIENTRY (*DrvSetLayerPaletteEntries)( HDC, int, int, int, CONST COLORREF * );
+ BOOL APIENTRY (*DrvSetPixelFormat)( IN HDC, IN int, IN CONST PIXELFORMATDESCRIPTOR * );
+ BOOL APIENTRY (*DrvShareLists)( HGLRC, HGLRC );
+ BOOL APIENTRY (*DrvSwapBuffers)( HDC );
+ BOOL APIENTRY (*DrvSwapLayerBuffers)( HDC, UINT );
+ BOOL APIENTRY (*DrvValidateVersion)( DWORD );
struct tagGLDRIVERDATA *next; /* next ICD -- linked list */
} GLDRIVERDATA;
memcpy( tebTable, table->dispatch_table,
sizeof (PROC) * table->num_funcs );
memset( tebTable + sizeof (PROC) * table->num_funcs, 0,
- (sizeof (table->dispatch_table) / sizeof (PROC)) -
- (sizeof (PROC) * table->num_funcs) );
+ sizeof (table->dispatch_table) - (sizeof (PROC) * table->num_funcs) );
/* FIXME: pull in software fallbacks -- need mesa */
#if 0 /* unused atm */
GLDRIVERDATA *icd;
PIXELFORMATDESCRIPTOR icdPfd;
int i;
- int best = -1;
+ int best = 0;
int score, bestScore = 0x7fff; /* used to choose a pfd if no exact match */
int icdNumFormats;
const DWORD compareFlags = PFD_DRAW_TO_WINDOW | PFD_DRAW_TO_BITMAP |
}
/* get number of formats -- FIXME: use 1 or 0 as index? */
- icdNumFormats = icd->DrvDescribePixelFormat( hdc, 1,
+ icdNumFormats = icd->DrvDescribePixelFormat( hdc, 0,
sizeof (PIXELFORMATDESCRIPTOR), NULL );
if (icdNumFormats == 0)
{
- DBGPRINT( "DrvDescribePixelFormat failed (%d)", GetLastError() );
+ DBGPRINT( "Error: DrvDescribePixelFormat failed (%d)", GetLastError() );
return 0;
}
+ DBGPRINT( "Info: Enumerating %d pixelformats", icdNumFormats );
/* try to find best format */
for (i = 0; i < icdNumFormats; i++)
}
}
- if (best == -1)
- {
+ if (best == 0)
SetLastError( 0 ); /* FIXME: set appropriate error */
- return 0;
- }
+ DBGPRINT( "Info: Suggesting pixelformat %d", best );
return best;
}
{
ret = icd->DrvDescribePixelFormat( hdc, iFormat, nBytes, pfd );
if (ret == 0)
- DBGPRINT( "Error: DrvDescribePixelFormat failed (%d)", GetLastError() );
+ DBGPRINT( "Error: DrvDescribePixelFormat(format=%d) failed (%d)", iFormat, GetLastError() );
}
/* FIXME: implement own functionality? */
rosglMakeCurrent( HDC hdc, HGLRC hglrc )
{
GLRC *glrc = (GLRC *)hglrc;
+ ICDTable *icdTable = NULL;
/* flush current context */
if (OPENGL32_threaddata->glrc != NULL)
/* call the ICD */
if (glrc->hglrc != NULL)
{
- if (!glrc->icd->DrvSetContext( hdc, glrc->hglrc,
- WGL_SetContextCallBack ))
+ icdTable = glrc->icd->DrvSetContext( hdc, glrc->hglrc,
+ WGL_SetContextCallBack );
+ if (icdTable == NULL)
{
DBGPRINT( "Error: DrvSetContext failed (%d)\n", GetLastError() );
return FALSE;
glrc->hdc = hdc;
OPENGL32_threaddata->glrc = glrc;
+ if (icdTable != NULL)
+ if (WGL_SetContextCallBack( icdTable ) != ERROR_SUCCESS)
+ {
+ DBGPRINT( "Warning: WGL_SetContextCallBack failed!" );
+ }
+
return TRUE;
}
if (!icd->DrvSetPixelFormat( hdc, iFormat, pfd ))
{
- DBGPRINT( "Warning: DrvSetPixelFormat failed (%d)", GetLastError() );
+ DBGPRINT( "Warning: DrvSetPixelFormat(format=%d) failed (%d)",
+ iFormat, GetLastError() );
return FALSE;
}
APIENTRY
rosglSwapBuffers( HDC hdc )
{
-#if 0
- /* 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;
- }
-#endif
-
GLDRIVERDATA *icd = OPENGL32_LoadICDForHDC( hdc );
if (icd != NULL)
{