Compilation fixes.

svn path=/trunk/; revision=7997
This commit is contained in:
Filip Navara 2004-02-02 17:59:23 +00:00
parent 7e215a0498
commit 9caad5c470
4 changed files with 82 additions and 61 deletions

View file

@ -12,9 +12,7 @@ TARGET_CFLAGS = -D__USE_W32API
# require os code to explicitly request A/W version of structs/functions
TARGET_CFLAGS += -D_DISABLE_TIDENTS -Wall -Werror
TARGET_LFLAGS =
TARGET_SDKLIBS = opengl32.a
TARGET_SDKLIBS = ntdll.a gdi32.a
TARGET_OBJECTS = \
opengl32.o \

View file

@ -1,4 +1,4 @@
/* $Id: opengl32.c,v 1.5 2004/02/02 06:01:35 royce Exp $
/* $Id: opengl32.c,v 1.6 2004/02/02 17:59:23 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -20,12 +20,6 @@
#define EXPORT __declspec(dllexport)
#define NAKED __attribute__((naked))
#ifdef DEBUG_OPENGL32
# define DBGPRINT( fmt, args... ) DbgPrint( "OpenGL32.DLL: "fmt, args )
#else
# define DBGPRINT( ... ) do {} while (0)
#endif
/* function prototypes */
static BOOL OPENGL32_LoadDrivers();
static void OPENGL32_AppendICD( GLDRIVERDATA *icd );
@ -44,12 +38,14 @@ const char* OPENGL32_funcnames[GLIDX_COUNT]
};
GLPROCESSDATA OPENGL32_processdata;
DWORD OPENGL32_tls;
static void OPENGL32_ThreadDetach()
{
GLTHREADDATA *lpvData;
/* FIXME - do we need to release some HDC or something? */
lpvData = (OPENGL32_ThreadData*)TlsGetValue ( OPENGL32_tls );
lpvData = (GLTHREADDATA *)TlsGetValue ( OPENGL32_tls );
if ( lpvData != NULL )
LocalFree((HLOCAL) lpvData );
}
@ -84,9 +80,11 @@ BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved)
memset ( lpData, 0, sizeof(GLTHREADDATA) );
(void)TlsSetValue ( OPENGL32_tls, lpData );
}
#if 0
lpData->hdc = NULL;
/* FIXME - defaulting to mesa3d, but shouldn't */
lpData->list = OPENGL32_processdata.list[0];
#endif
break;
/* The thread of the attached process terminates. */
@ -155,16 +153,17 @@ static BOOL OPENGL32_LoadDrivers()
"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.
/* FIXME - special-case load of MESA3D as generic implementation ICD. */
if ( ERROR_SUCCESS != RegOpenKey ( HKEY_LOCAL_MACHINE, OpenGLDrivers, &hkey ) )
if ( ERROR_SUCCESS != RegOpenKeyW( HKEY_LOCAL_MACHINE, OpenGLDrivers, &hkey ) )
return FALSE;
for ( int i = 0; RegEnumKeyW(hkey,i,name,sizeof(name)/sizeof(name[0])) == ERROR_SUCCESS; i++ )
for ( 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 );
/* ignoring return value, because OPENGL32_LoadICD() is doing *all* the work... */
/* GLDRIVERDATA* gldd =*/ OPENGL32_LoadICD ( name );
}
RegCloseKey ( hkey );
if ( i > 0 )
@ -183,7 +182,7 @@ static GLDRIVERDATA *OPENGL32_LoadDriver ( LPCWSTR driver )
{
HKEY hKey;
WCHAR subKey[1024] = L"SOFTWARE\\Microsoft\\Windows NT\\"
"CurrentVersion\\OpenGLDrivers\\");
"CurrentVersion\\OpenGLDrivers\\";
LONG ret;
DWORD type, size;
@ -204,7 +203,7 @@ static GLDRIVERDATA *OPENGL32_LoadDriver ( LPCWSTR driver )
/* query values */
size = sizeof (dll);
ret = RegQueryValueExW( hKey, L"Dll", 0, &type, dll, &size );
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" );
@ -213,7 +212,7 @@ static GLDRIVERDATA *OPENGL32_LoadDriver ( LPCWSTR driver )
}
size = sizeof (DWORD);
ret = RegQueryValueExW( hKey, L"Version", 0, &type, &version, &size );
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" );
@ -222,7 +221,7 @@ static GLDRIVERDATA *OPENGL32_LoadDriver ( LPCWSTR driver )
size = sizeof (DWORD);
ret = RegQueryValueExW( hKey, L"DriverVersion", 0, &type,
&driverVersion, &size );
(LPBYTE)&driverVersion, &size );
if (ret != ERROR_SUCCESS || type != REG_DWORD)
{
DBGPRINT( "Warning: Couldn't query DriverVersion value or not a DWORD\n" );
@ -230,7 +229,7 @@ static GLDRIVERDATA *OPENGL32_LoadDriver ( LPCWSTR driver )
}
size = sizeof (DWORD);
ret = RegQueryValueExW( hKey, L"Flags", 0, &type, &flags, &size );
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" );
@ -294,7 +293,7 @@ static DWORD OPENGL32_InitializeDriver( GLDRIVERDATA *icd )
UINT i;
/* load dll */
icd->handle = LoadLibraryW( dll );
icd->handle = LoadLibraryW( icd->dll );
if (!icd->handle)
{
DBGPRINT( "Error: Couldn't load DLL! (%d)\n", GetLastError() );

View file

@ -1,4 +1,4 @@
/* $Id: opengl32.h,v 1.5 2004/02/02 06:01:35 royce Exp $
/* $Id: opengl32.h,v 1.6 2004/02/02 17:59:23 navaraf Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -17,6 +17,13 @@
#define DEBUG_OPENGL32_ICD_EXPORTS /* dumps the list of supported glXXX
functions when an ICD is loaded. */
#ifdef DEBUG_OPENGL32
ULONG DbgPrint(PCH Format,...);
# define DBGPRINT DbgPrint( "OpenGL32.DLL: " ), DbgPrint
#else
# define DBGPRINT( ... ) do {} while (0)
#endif
/* gl function list */
#define GLFUNCS_MACRO \
X(glAccum) \
@ -392,16 +399,16 @@ typedef struct tagGLDRIVERDATA
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 * )
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 (*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 );
void (*DrvValidateVersion)();
PVOID func_list[GLIDX_COUNT]; /* glXXX functions supported by ICD */

View file

@ -15,22 +15,23 @@
#include "opengl32.h"
BOOL wglCopyContext( HGLRC src, HGLRC dst, UINT mask )
BOOL WINAPI wglCopyContext( HGLRC src, HGLRC dst, UINT mask )
{
return FALSE;
}
HGLRC wglCreateContext( HDC hdc )
HGLRC WINAPI wglCreateContext( HDC hdc )
{
return wglCreateLayerContext( hdc, 0 );
}
HGLRC wglCreateLayerContext( HDC hdc, int layer )
HGLRC WINAPI wglCreateLayerContext( HDC hdc, int layer )
{
HKEY hKey;
WCHAR subKey[1024] = L"SOFTWARE\\Microsoft\\Windows NT\\"
"CurrentVersion\\OpenGLDrivers");
"CurrentVersion\\OpenGLDrivers";
LONG ret;
WCHAR driver[256];
DWORD size;
@ -38,7 +39,8 @@ HGLRC wglCreateLayerContext( HDC hdc, int layer )
FILETIME time;
GLDRIVERDATA *icd;
GLRC *hglrc, *drvHglrc = NULL;
HGLRC drvHglrc = NULL;
GLRC *hglrc;
if (GetObjectType( hdc ) != OBJ_DC)
{
@ -66,7 +68,7 @@ HGLRC wglCreateLayerContext( HDC hdc, int layer )
if (ret != ERROR_SUCCESS )
break;
icd = OPENGL32_LoadICDW( driver );
icd = OPENGL32_LoadICD( driver );
if (!icd)
continue;
@ -92,7 +94,7 @@ HGLRC wglCreateLayerContext( HDC hdc, int layer )
}
/* we have our GLRC in hglrc and the ICDs in drvHglrc */
hglrc->hglrc = drcHglrc;
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 */
@ -104,84 +106,99 @@ HGLRC wglCreateLayerContext( HDC hdc, int layer )
}
BOOL wglDeleteContext( HGLRC hglrc )
BOOL WINAPI wglDeleteContext( HGLRC hglrc )
{
return FALSE;
}
BOOL wglDescribeLayerPlane( HDC hdc, int iPixelFormat, int iLayerPlane,
UINT nBytes, LPLAYERPLANEDESCRIPTOR plpd )
BOOL WINAPI wglDescribeLayerPlane( HDC hdc, int iPixelFormat, int iLayerPlane,
UINT nBytes, LPLAYERPLANEDESCRIPTOR plpd )
{
return FALSE;
}
HGLRC wglGetCurrentContext()
HGLRC WINAPI wglGetCurrentContext()
{
return NULL;
}
HDC wglGetCurrentDC()
HDC WINAPI wglGetCurrentDC()
{
return NULL;
}
int wglGetLayerPaletteEntries( HDC hdc, int iLayerPlane, int iStart,
int cEntries, CONST COLORREF *pcr )
int WINAPI wglGetLayerPaletteEntries( HDC hdc, int iLayerPlane, int iStart,
int cEntries, COLORREF *pcr )
{
return 0;
}
PROC wglGetProcAddress( LPCSTR proc )
PROC WINAPI wglGetProcAddress( LPCSTR proc )
{
return NULL;
}
BOOL wglMakeCurrent( HDC hdc, HGLRC hglrc )
BOOL WINAPI wglMakeCurrent( HDC hdc, HGLRC hglrc )
{
return FALSE;
}
BOOL wglRealizeLayerPalette( HDC hdc, int iLayerPlane, BOOL bRealize )
BOOL WINAPI wglRealizeLayerPalette( HDC hdc, int iLayerPlane, BOOL bRealize )
{
return FALSE;
}
int wglSetLayerPaletteEntries( HDC hdc, int iLayerPlane, int iStart,
int cEntries, CONST COLORREF *pcr )
int WINAPI wglSetLayerPaletteEntries( HDC hdc, int iLayerPlane, int iStart,
int cEntries, CONST COLORREF *pcr )
{
return 0;
}
BOOL wglShareLists( HGLRC hglrc1, HGLRC hglrc2 )
BOOL WINAPI wglShareLists( HGLRC hglrc1, HGLRC hglrc2 )
{
return FALSE;
}
BOOL wglSwapLayerBuffers( HDC hdc, UINT fuPlanes )
BOOL WINAPI wglSwapLayerBuffers( HDC hdc, UINT fuPlanes )
{
return FALSE;
}
BOOL wglUseFontBitmapsA( HDC hdc, DWORD first, DWORD count, DWORD listBase )
BOOL WINAPI wglUseFontBitmapsA( HDC hdc, DWORD first, DWORD count, DWORD listBase )
{
return FALSE;
}
BOOL wglUseFontBitmapsW( HDC hdc, DWORD first, DWORD count, DWORD listBase )
BOOL WINAPI wglUseFontBitmapsW( HDC hdc, DWORD first, DWORD count, DWORD listBase )
{
return FALSE;
}
BOOL wglUseFontOutlinesA( HDC hdc, DWORD first, DWORD count, DWORD listBase,
FLOAT deviation, FLOAT extrusion, int format,
LPGLYPHMETRICSFLOAT lpgmf )
BOOL WINAPI wglUseFontOutlinesA( HDC hdc, DWORD first, DWORD count, DWORD listBase,
FLOAT deviation, FLOAT extrusion, int format,
LPGLYPHMETRICSFLOAT lpgmf )
{
return FALSE;
}
BOOL wglUseFontOutlinesW( HDC hdc, DWORD first, DWORD count, DWORD listBase,
FLOAT deviation, FLOAT extrusion, int format,
LPGLYPHMETRICSFLOAT lpgmf )
BOOL WINAPI wglUseFontOutlinesW( HDC hdc, DWORD first, DWORD count, DWORD listBase,
FLOAT deviation, FLOAT extrusion, int format,
LPGLYPHMETRICSFLOAT lpgmf )
{
return FALSE;
}