Patch by Anich Gregor:

fast proxy functions fixed, loads in win2k and succeeds creating the context
but then crashes. ExtEscape call fixed and simple version of
wglGetPixelFormat implemented.

svn path=/trunk/; revision=8109
This commit is contained in:
Vizzini 2004-02-09 08:00:15 +00:00
parent 8eb11ab73e
commit 66f9b32741
5 changed files with 38 additions and 23 deletions

View file

@ -1,4 +1,4 @@
/* $Id: opengl32.c,v 1.13 2004/02/06 20:25:33 royce Exp $
/* $Id: opengl32.c,v 1.14 2004/02/09 08:00:15 vizzini Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -17,7 +17,13 @@
#include <string.h>
#include "opengl32.h"
#define EXT_GET_DRIVERNAME 0x1001 /* ExtEscape code to get driver name */
#define EXT_GET_DRIVERINFO 0x1101 /* ExtEscape code to get driver info */
typedef struct tagEXTDRIVERINFO
{
DWORD version; /* driver interface version */
DWORD driver_version; /* driver version */
WCHAR driver_name[256]; /* driver name */
} EXTDRIVERINFO;
/* function prototypes */
/*static BOOL OPENGL32_LoadDrivers();*/
@ -379,13 +385,13 @@ OPENGL32_UnloadDriver( GLDRIVERDATA *icd )
*/
GLDRIVERDATA *OPENGL32_LoadICDForHDC( HDC hdc )
{
WCHAR name[256];
DWORD dwInput = 0;
LONG ret;
EXTDRIVERINFO info;
/* get driver name */
ret = ExtEscape( hdc, EXT_GET_DRIVERNAME, sizeof (dwInput), (LPCSTR)&dwInput,
sizeof (name), (LPSTR)name );
ret = ExtEscape( hdc, EXT_GET_DRIVERINFO, sizeof (dwInput), (LPCSTR)&dwInput,
sizeof (EXTDRIVERINFO), (LPSTR)&info );
if (ret < 0)
{
DBGPRINT( "Warning: ExtEscape to get the drivername failed!!! (%d)", GetLastError() );
@ -393,7 +399,7 @@ GLDRIVERDATA *OPENGL32_LoadICDForHDC( HDC hdc )
}
/* load driver (or get a reference) */
return OPENGL32_LoadICD( name );
return OPENGL32_LoadICD( info.driver_name );
}
@ -485,8 +491,8 @@ OPENGL32_RegEnumDrivers( DWORD idx, LPWSTR name, LPDWORD cName )
LPCWSTR subKey =
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\OpenGLDrivers\\";
LONG ret;
/*DWORD size;*/
/*WCHAR driver[256];*/
DWORD size;
WCHAR driver[256];
if (name == NULL)
return ERROR_SUCCESS; /* nothing to do */
@ -503,7 +509,7 @@ OPENGL32_RegEnumDrivers( DWORD idx, LPWSTR name, LPDWORD cName )
}
/* get subkey name */
/*size = sizeof (driver) / sizeof (driver[0]);*/
size = sizeof (driver) / sizeof (driver[0]);
ret = RegEnumKeyW( hKey, idx, name, *cName );
if (ret != ERROR_SUCCESS)
{

View file

@ -1,4 +1,4 @@
; $Id: opengl32.edf,v 1.4 2004/02/06 17:22:55 royce Exp $
; $Id: opengl32.edf,v 1.5 2004/02/09 08:00:15 vizzini Exp $
;
; opengl32.edf
;
@ -374,25 +374,25 @@ glVertex4sv=glVertex4sv@4
glVertexPointer=glVertexPointer@16
glViewport=glViewport@16
wglChoosePixelFormat=GDI32.ChoosePixelFormat
wglChoosePixelFormat=rosglChoosePixelFormat@8
wglCopyContext=rosglCopyContext@12
wglCreateContext=rosglCreateContext@4
wglCreateLayerContext=rosglCreateLayerContext@8
wglDeleteContext=rosglDeleteContext@4
wglDescribeLayerPlane=rosglDescribeLayerPlane@20
wglDescribePixelFormat=GDI32.DescribePixelFormat
wglDescribePixelFormat=rosglDescribePixelFormat@16
wglGetCurrentContext=rosglGetCurrentContext@0
wglGetCurrentDC=rosglGetCurrentDC@0
;wglGetDefaultProcAddress=rosglGetDefaultProcAddress@
wglGetLayerPaletteEntries=rosglGetLayerPaletteEntries@20
wglGetPixelFormat=GDI32.GetPixelFormat
wglGetPixelFormat=rosglGetPixelFormat@4
wglGetProcAddress=rosglGetProcAddress@4
wglMakeCurrent=rosglMakeCurrent@8
wglRealizeLayerPalette=rosglRealizeLayerPalette@12
wglSetLayerPaletteEntries=rosglSetLayerPaletteEntries@20
wglSetPixelFormat=GDI32.SetPixelFormat
wglSetPixelFormat=rosglSetPixelFormat@12
wglShareLists=rosglShareLists@8
wglSwapBuffers=GDI32.SwapBuffers
wglSwapBuffers=rosglSwapBuffers@4
wglSwapLayerBuffers=rosglSwapLayerBuffers@8
;wglSwapMultipleBuffers=rosglSwapMultipleBuffers@
wglUseFontBitmapsA=rosglUseFontBitmapsA@16

View file

@ -1,4 +1,4 @@
/* $Id: opengl32.h,v 1.11 2004/02/06 18:17:18 royce Exp $
/* $Id: opengl32.h,v 1.12 2004/02/09 08:00:15 vizzini Exp $
*
* COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS kernel
@ -148,7 +148,6 @@ typedef struct tagGLDRIVERDATA
typedef struct tagGLRC
{
GLDRIVERDATA *icd; /* driver used for this context */
INT iFormat; /* current pixel format index - ? */
HDC hdc; /* DC handle */
BOOL is_current; /* wether this context is current for some DC */
DWORD thread_id; /* thread holding this context */
@ -165,6 +164,8 @@ typedef struct tagGLPROCESSDATA
HANDLE driver_mutex; /* mutex to protect driver list */
GLRC *glrc_list; /* list of GL rendering contexts */
HANDLE glrc_mutex; /* mutex to protect glrc list */
HDC cachedHdc; /* cached HDC from last SetPixelFormat */
INT cachedFormat; /* cached format from last SetPixelFormat */
} GLPROCESSDATA;
/* TLS data */

View file

@ -4,7 +4,7 @@ section .text
global _%1@%4
_%1@%4:
mov eax, [fs:18h] ; obtain a pointer to the TEB
jmp [eax+%3+7C4h]
jmp [eax+4*%3+7C4h]
%endmacro
%include "teblist.mac"
@ -13,6 +13,6 @@ global _%1@%3
_%1@%3:
mov eax, [fs:18h] ; obtain a pointer to the TEB
mov eax, [eax+0BE8h] ; get glTable pointer
jmp [eax+4*%3]
jmp [eax+4*%2]
%endmacro
%include "slowlist.mac"

View file

@ -332,12 +332,12 @@ rosglCreateLayerContext( HDC hdc, int layer )
GLRC *glrc;
HGLRC drvHglrc = NULL;
if (GetObjectType( hdc ) != OBJ_DC)
/* if (GetObjectType( hdc ) != OBJ_DC)
{
DBGPRINT( "Error: hdc is not a DC handle!" );
return NULL;
}
*/
/* allocate our GLRC */
glrc = (GLRC*)HeapAlloc( GetProcessHeap(),
HEAP_ZERO_MEMORY | HEAP_GENERATE_EXCEPTIONS, sizeof (GLRC) );
@ -418,7 +418,6 @@ rosglCreateLayerContext( HDC hdc, int layer )
/* 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;
/* append glrc to context list */
@ -553,7 +552,12 @@ int
WINAPI
rosglGetPixelFormat( HDC hdc )
{
UNIMPLEMENTED;
if (OPENGL32_processdata.cachedHdc == hdc)
return OPENGL32_processdata.cachedFormat;
/* FIXME: create real implementation of this function */
DBGPRINT( "Warning: Pixel format not cached, returning 0" );
return 0;
}
@ -646,6 +650,7 @@ rosglMakeCurrent( HDC hdc, HGLRC hglrc )
DBGPRINT( "Error: DrvSetContext failed (%d)\n", GetLastError() );
return FALSE;
}
DBGPRINT( "Info: DrvSetContext succeeded!" );
}
/* make it current */
@ -695,6 +700,9 @@ rosglSetPixelFormat( HDC hdc, int iFormat, CONST PIXELFORMATDESCRIPTOR *pfd )
return FALSE;
}
OPENGL32_processdata.cachedHdc = hdc;
OPENGL32_processdata.cachedFormat = iFormat;
return TRUE;
}