mirror of
https://github.com/reactos/reactos.git
synced 2024-07-12 23:55:07 +00:00
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:
parent
8eb11ab73e
commit
66f9b32741
|
@ -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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -17,7 +17,13 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include "opengl32.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 */
|
/* function prototypes */
|
||||||
/*static BOOL OPENGL32_LoadDrivers();*/
|
/*static BOOL OPENGL32_LoadDrivers();*/
|
||||||
|
@ -379,13 +385,13 @@ OPENGL32_UnloadDriver( GLDRIVERDATA *icd )
|
||||||
*/
|
*/
|
||||||
GLDRIVERDATA *OPENGL32_LoadICDForHDC( HDC hdc )
|
GLDRIVERDATA *OPENGL32_LoadICDForHDC( HDC hdc )
|
||||||
{
|
{
|
||||||
WCHAR name[256];
|
|
||||||
DWORD dwInput = 0;
|
DWORD dwInput = 0;
|
||||||
LONG ret;
|
LONG ret;
|
||||||
|
EXTDRIVERINFO info;
|
||||||
|
|
||||||
/* get driver name */
|
/* get driver name */
|
||||||
ret = ExtEscape( hdc, EXT_GET_DRIVERNAME, sizeof (dwInput), (LPCSTR)&dwInput,
|
ret = ExtEscape( hdc, EXT_GET_DRIVERINFO, sizeof (dwInput), (LPCSTR)&dwInput,
|
||||||
sizeof (name), (LPSTR)name );
|
sizeof (EXTDRIVERINFO), (LPSTR)&info );
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
DBGPRINT( "Warning: ExtEscape to get the drivername failed!!! (%d)", GetLastError() );
|
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) */
|
/* 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 =
|
LPCWSTR subKey =
|
||||||
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\OpenGLDrivers\\";
|
L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\OpenGLDrivers\\";
|
||||||
LONG ret;
|
LONG ret;
|
||||||
/*DWORD size;*/
|
DWORD size;
|
||||||
/*WCHAR driver[256];*/
|
WCHAR driver[256];
|
||||||
|
|
||||||
if (name == NULL)
|
if (name == NULL)
|
||||||
return ERROR_SUCCESS; /* nothing to do */
|
return ERROR_SUCCESS; /* nothing to do */
|
||||||
|
@ -503,7 +509,7 @@ OPENGL32_RegEnumDrivers( DWORD idx, LPWSTR name, LPDWORD cName )
|
||||||
}
|
}
|
||||||
|
|
||||||
/* get subkey name */
|
/* get subkey name */
|
||||||
/*size = sizeof (driver) / sizeof (driver[0]);*/
|
size = sizeof (driver) / sizeof (driver[0]);
|
||||||
ret = RegEnumKeyW( hKey, idx, name, *cName );
|
ret = RegEnumKeyW( hKey, idx, name, *cName );
|
||||||
if (ret != ERROR_SUCCESS)
|
if (ret != ERROR_SUCCESS)
|
||||||
{
|
{
|
||||||
|
|
|
@ -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
|
; opengl32.edf
|
||||||
;
|
;
|
||||||
|
@ -374,25 +374,25 @@ glVertex4sv=glVertex4sv@4
|
||||||
glVertexPointer=glVertexPointer@16
|
glVertexPointer=glVertexPointer@16
|
||||||
glViewport=glViewport@16
|
glViewport=glViewport@16
|
||||||
|
|
||||||
wglChoosePixelFormat=GDI32.ChoosePixelFormat
|
wglChoosePixelFormat=rosglChoosePixelFormat@8
|
||||||
wglCopyContext=rosglCopyContext@12
|
wglCopyContext=rosglCopyContext@12
|
||||||
wglCreateContext=rosglCreateContext@4
|
wglCreateContext=rosglCreateContext@4
|
||||||
wglCreateLayerContext=rosglCreateLayerContext@8
|
wglCreateLayerContext=rosglCreateLayerContext@8
|
||||||
wglDeleteContext=rosglDeleteContext@4
|
wglDeleteContext=rosglDeleteContext@4
|
||||||
wglDescribeLayerPlane=rosglDescribeLayerPlane@20
|
wglDescribeLayerPlane=rosglDescribeLayerPlane@20
|
||||||
wglDescribePixelFormat=GDI32.DescribePixelFormat
|
wglDescribePixelFormat=rosglDescribePixelFormat@16
|
||||||
wglGetCurrentContext=rosglGetCurrentContext@0
|
wglGetCurrentContext=rosglGetCurrentContext@0
|
||||||
wglGetCurrentDC=rosglGetCurrentDC@0
|
wglGetCurrentDC=rosglGetCurrentDC@0
|
||||||
;wglGetDefaultProcAddress=rosglGetDefaultProcAddress@
|
;wglGetDefaultProcAddress=rosglGetDefaultProcAddress@
|
||||||
wglGetLayerPaletteEntries=rosglGetLayerPaletteEntries@20
|
wglGetLayerPaletteEntries=rosglGetLayerPaletteEntries@20
|
||||||
wglGetPixelFormat=GDI32.GetPixelFormat
|
wglGetPixelFormat=rosglGetPixelFormat@4
|
||||||
wglGetProcAddress=rosglGetProcAddress@4
|
wglGetProcAddress=rosglGetProcAddress@4
|
||||||
wglMakeCurrent=rosglMakeCurrent@8
|
wglMakeCurrent=rosglMakeCurrent@8
|
||||||
wglRealizeLayerPalette=rosglRealizeLayerPalette@12
|
wglRealizeLayerPalette=rosglRealizeLayerPalette@12
|
||||||
wglSetLayerPaletteEntries=rosglSetLayerPaletteEntries@20
|
wglSetLayerPaletteEntries=rosglSetLayerPaletteEntries@20
|
||||||
wglSetPixelFormat=GDI32.SetPixelFormat
|
wglSetPixelFormat=rosglSetPixelFormat@12
|
||||||
wglShareLists=rosglShareLists@8
|
wglShareLists=rosglShareLists@8
|
||||||
wglSwapBuffers=GDI32.SwapBuffers
|
wglSwapBuffers=rosglSwapBuffers@4
|
||||||
wglSwapLayerBuffers=rosglSwapLayerBuffers@8
|
wglSwapLayerBuffers=rosglSwapLayerBuffers@8
|
||||||
;wglSwapMultipleBuffers=rosglSwapMultipleBuffers@
|
;wglSwapMultipleBuffers=rosglSwapMultipleBuffers@
|
||||||
wglUseFontBitmapsA=rosglUseFontBitmapsA@16
|
wglUseFontBitmapsA=rosglUseFontBitmapsA@16
|
||||||
|
|
|
@ -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
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -148,7 +148,6 @@ typedef struct tagGLDRIVERDATA
|
||||||
typedef struct tagGLRC
|
typedef struct tagGLRC
|
||||||
{
|
{
|
||||||
GLDRIVERDATA *icd; /* driver used for this context */
|
GLDRIVERDATA *icd; /* driver used for this context */
|
||||||
INT iFormat; /* current pixel format index - ? */
|
|
||||||
HDC hdc; /* DC handle */
|
HDC hdc; /* DC handle */
|
||||||
BOOL is_current; /* wether this context is current for some DC */
|
BOOL is_current; /* wether this context is current for some DC */
|
||||||
DWORD thread_id; /* thread holding this context */
|
DWORD thread_id; /* thread holding this context */
|
||||||
|
@ -165,6 +164,8 @@ typedef struct tagGLPROCESSDATA
|
||||||
HANDLE driver_mutex; /* mutex to protect driver list */
|
HANDLE driver_mutex; /* mutex to protect driver list */
|
||||||
GLRC *glrc_list; /* list of GL rendering contexts */
|
GLRC *glrc_list; /* list of GL rendering contexts */
|
||||||
HANDLE glrc_mutex; /* mutex to protect glrc list */
|
HANDLE glrc_mutex; /* mutex to protect glrc list */
|
||||||
|
HDC cachedHdc; /* cached HDC from last SetPixelFormat */
|
||||||
|
INT cachedFormat; /* cached format from last SetPixelFormat */
|
||||||
} GLPROCESSDATA;
|
} GLPROCESSDATA;
|
||||||
|
|
||||||
/* TLS data */
|
/* TLS data */
|
||||||
|
|
|
@ -4,7 +4,7 @@ section .text
|
||||||
global _%1@%4
|
global _%1@%4
|
||||||
_%1@%4:
|
_%1@%4:
|
||||||
mov eax, [fs:18h] ; obtain a pointer to the TEB
|
mov eax, [fs:18h] ; obtain a pointer to the TEB
|
||||||
jmp [eax+%3+7C4h]
|
jmp [eax+4*%3+7C4h]
|
||||||
%endmacro
|
%endmacro
|
||||||
%include "teblist.mac"
|
%include "teblist.mac"
|
||||||
|
|
||||||
|
@ -13,6 +13,6 @@ global _%1@%3
|
||||||
_%1@%3:
|
_%1@%3:
|
||||||
mov eax, [fs:18h] ; obtain a pointer to the TEB
|
mov eax, [fs:18h] ; obtain a pointer to the TEB
|
||||||
mov eax, [eax+0BE8h] ; get glTable pointer
|
mov eax, [eax+0BE8h] ; get glTable pointer
|
||||||
jmp [eax+4*%3]
|
jmp [eax+4*%2]
|
||||||
%endmacro
|
%endmacro
|
||||||
%include "slowlist.mac"
|
%include "slowlist.mac"
|
||||||
|
|
|
@ -332,12 +332,12 @@ rosglCreateLayerContext( HDC hdc, int layer )
|
||||||
GLRC *glrc;
|
GLRC *glrc;
|
||||||
HGLRC drvHglrc = NULL;
|
HGLRC drvHglrc = NULL;
|
||||||
|
|
||||||
if (GetObjectType( hdc ) != OBJ_DC)
|
/* if (GetObjectType( hdc ) != OBJ_DC)
|
||||||
{
|
{
|
||||||
DBGPRINT( "Error: hdc is not a DC handle!" );
|
DBGPRINT( "Error: hdc is not a DC handle!" );
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
/* allocate our GLRC */
|
/* allocate our GLRC */
|
||||||
glrc = (GLRC*)HeapAlloc( GetProcessHeap(),
|
glrc = (GLRC*)HeapAlloc( GetProcessHeap(),
|
||||||
HEAP_ZERO_MEMORY | HEAP_GENERATE_EXCEPTIONS, sizeof (GLRC) );
|
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 */
|
/* we have our GLRC in glrc and the ICD's GLRC in drvHglrc */
|
||||||
glrc->hglrc = drvHglrc;
|
glrc->hglrc = drvHglrc;
|
||||||
glrc->iFormat = -1; /* what is this used for? */
|
|
||||||
glrc->icd = icd;
|
glrc->icd = icd;
|
||||||
|
|
||||||
/* append glrc to context list */
|
/* append glrc to context list */
|
||||||
|
@ -553,7 +552,12 @@ int
|
||||||
WINAPI
|
WINAPI
|
||||||
rosglGetPixelFormat( HDC hdc )
|
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;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -646,6 +650,7 @@ rosglMakeCurrent( HDC hdc, HGLRC hglrc )
|
||||||
DBGPRINT( "Error: DrvSetContext failed (%d)\n", GetLastError() );
|
DBGPRINT( "Error: DrvSetContext failed (%d)\n", GetLastError() );
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
DBGPRINT( "Info: DrvSetContext succeeded!" );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* make it current */
|
/* make it current */
|
||||||
|
@ -695,6 +700,9 @@ rosglSetPixelFormat( HDC hdc, int iFormat, CONST PIXELFORMATDESCRIPTOR *pfd )
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
OPENGL32_processdata.cachedHdc = hdc;
|
||||||
|
OPENGL32_processdata.cachedFormat = iFormat;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue