mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 23:45:42 +00:00
Git conversion: Make reactos the root directory, move rosapps, rostests, wallpapers into modules, and delete rossubsys.
This commit is contained in:
parent
b94e2d8ca0
commit
c2c66aff7d
24198 changed files with 0 additions and 37285 deletions
59
dll/opengl/opengl32/CMakeLists.txt
Normal file
59
dll/opengl/opengl32/CMakeLists.txt
Normal file
|
@ -0,0 +1,59 @@
|
|||
|
||||
spec2def(opengl32.dll opengl32.spec ADD_IMPORTLIB)
|
||||
|
||||
include_directories(../mesa)
|
||||
|
||||
add_definitions(
|
||||
-D_GDI32_ # prevent gl* being declared __declspec(dllimport) in MS headers
|
||||
-DBUILD_GL32 # declare gl* as __declspec(dllexport) in Mesa headers
|
||||
-D_GLAPI_NO_EXPORTS # prevent _glapi_* from being declared __declspec(dllimport)
|
||||
)
|
||||
|
||||
if(OPENGL32_USE_TLS)
|
||||
add_definitions(-DOPENGL32_USE_TLS)
|
||||
endif()
|
||||
|
||||
list(APPEND SOURCE
|
||||
apistubs.c
|
||||
dllmain.c
|
||||
icdload.c
|
||||
swimpl.c
|
||||
wgl.c
|
||||
wgl_font.c
|
||||
opengl32.h
|
||||
${CMAKE_CURRENT_BINARY_DIR}/opengl32_stubs.c)
|
||||
|
||||
set_source_files_properties(gcrt0.o libgmon.a PROPERTIES EXTERNAL_OBJECT TRUE)
|
||||
|
||||
if(ARCH STREQUAL "i386")
|
||||
# Optimisation: use asm trampolines to ICD provided functions
|
||||
add_asm_files(opengl32_asm
|
||||
glapi_x86.s
|
||||
)
|
||||
endif()
|
||||
|
||||
add_library(opengl32 SHARED
|
||||
${SOURCE}
|
||||
${opengl32_asm}
|
||||
${CMAKE_CURRENT_BINARY_DIR}/opengl32.def)
|
||||
|
||||
target_link_libraries(opengl32
|
||||
wine
|
||||
${PSEH_LIB}
|
||||
mesa_drv_common
|
||||
mesa_swrast
|
||||
mesa_swrast_setup
|
||||
mesa_tnl
|
||||
mesa_main
|
||||
mesa_vbo
|
||||
mesa_math
|
||||
)
|
||||
|
||||
if((ARCH STREQUAL "i386") AND (NOT MSVC))
|
||||
target_link_libraries(opengl32 mesa_x86)
|
||||
endif()
|
||||
|
||||
set_module_type(opengl32 win32dll)
|
||||
add_importlibs(opengl32 gdi32 user32 advapi32 msvcrt kernel32 ntdll)
|
||||
add_pch(opengl32 opengl32.h SOURCE)
|
||||
add_cd_file(TARGET opengl32 DESTINATION reactos/system32 FOR all)
|
3716
dll/opengl/opengl32/apistubs.c
Normal file
3716
dll/opengl/opengl32/apistubs.c
Normal file
File diff suppressed because it is too large
Load diff
79
dll/opengl/opengl32/dllmain.c
Normal file
79
dll/opengl/opengl32/dllmain.c
Normal file
|
@ -0,0 +1,79 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS
|
||||
* FILE: dll/opengl/opengl32/dllmain.c
|
||||
* PURPOSE: OpenGL32 DLL
|
||||
*/
|
||||
|
||||
#include "opengl32.h"
|
||||
|
||||
#ifdef OPENGL32_USE_TLS
|
||||
DWORD OglTlsIndex = 0xFFFFFFFF;
|
||||
#endif
|
||||
|
||||
BOOL WINAPI
|
||||
DllMain(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved)
|
||||
{
|
||||
#ifdef OPENGL32_USE_TLS
|
||||
struct Opengl32_ThreadData* ThreadData;
|
||||
#endif
|
||||
switch ( Reason )
|
||||
{
|
||||
case DLL_PROCESS_ATTACH:
|
||||
#ifdef OPENGL32_USE_TLS
|
||||
OglTlsIndex = TlsAlloc();
|
||||
if(OglTlsIndex == TLS_OUT_OF_INDEXES)
|
||||
return FALSE;
|
||||
#endif
|
||||
/* Initialize Context list */
|
||||
InitializeListHead(&ContextListHead);
|
||||
/* no break */
|
||||
case DLL_THREAD_ATTACH:
|
||||
#ifdef OPENGL32_USE_TLS
|
||||
ThreadData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*ThreadData));
|
||||
if(!ThreadData)
|
||||
return FALSE;
|
||||
TlsSetValue(OglTlsIndex, ThreadData);
|
||||
ThreadData->glDispatchTable = &StubTable.glDispatchTable;
|
||||
ThreadData->hglrc = NULL;
|
||||
ThreadData->hdc = NULL;
|
||||
ThreadData->dc_data = NULL;
|
||||
#else
|
||||
NtCurrentTeb()->glTable = &StubTable.glDispatchTable;
|
||||
#endif // defined(OPENGL32_USE_TLS)
|
||||
break;
|
||||
|
||||
case DLL_THREAD_DETACH:
|
||||
/* Set NULL context for this thread */
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
/* Clean up */
|
||||
#ifdef OPENGL32_USE_TLS
|
||||
ThreadData = TlsGetValue(OglTlsIndex);
|
||||
if(ThreadData)
|
||||
HeapFree(GetProcessHeap(), 0, ThreadData);
|
||||
#else
|
||||
NtCurrentTeb()->glTable = NULL;
|
||||
#endif // defined(OPENGL32_USE_TLS)
|
||||
break;
|
||||
case DLL_PROCESS_DETACH:
|
||||
/* Clean up */
|
||||
if (!Reserved)
|
||||
{
|
||||
/* The process is not shutting down: release everything */
|
||||
wglMakeCurrent(NULL, NULL);
|
||||
IntDeleteAllContexts();
|
||||
IntDeleteAllICDs();
|
||||
#ifdef OPENGL32_USE_TLS
|
||||
ThreadData = TlsGetValue(OglTlsIndex);
|
||||
if(ThreadData)
|
||||
HeapFree(GetProcessHeap(), 0, ThreadData);
|
||||
#endif
|
||||
}
|
||||
#ifdef OPENGL32_USE_TLS
|
||||
TlsFree(OglTlsIndex);
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
565
dll/opengl/opengl32/font.c
Normal file
565
dll/opengl/opengl32/font.c
Normal file
|
@ -0,0 +1,565 @@
|
|||
/* Window-specific OpenGL functions implementation.
|
||||
*
|
||||
* Copyright (c) 1999 Lionel Ulmer
|
||||
* Copyright (c) 2005 Raphael Junqueira
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include <stdarg.h>
|
||||
#include <math.h>
|
||||
#include <GL/gl.h>
|
||||
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <wingdi.h>
|
||||
|
||||
#include "wine/debug.h"
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(wgl);
|
||||
|
||||
/***********************************************************************
|
||||
* wglUseFontBitmaps_common
|
||||
*/
|
||||
static BOOL wglUseFontBitmaps_common( HDC hdc, DWORD first, DWORD count, DWORD listBase, BOOL unicode )
|
||||
{
|
||||
GLYPHMETRICS gm;
|
||||
unsigned int glyph, size = 0;
|
||||
void *bitmap = NULL, *gl_bitmap = NULL;
|
||||
int org_alignment;
|
||||
BOOL ret = TRUE;
|
||||
|
||||
glGetIntegerv(GL_UNPACK_ALIGNMENT, &org_alignment);
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
||||
|
||||
for (glyph = first; glyph < first + count; glyph++) {
|
||||
static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} };
|
||||
unsigned int needed_size, height, width, width_int;
|
||||
|
||||
if (unicode)
|
||||
needed_size = GetGlyphOutlineW(hdc, glyph, GGO_BITMAP, &gm, 0, NULL, &identity);
|
||||
else
|
||||
needed_size = GetGlyphOutlineA(hdc, glyph, GGO_BITMAP, &gm, 0, NULL, &identity);
|
||||
|
||||
TRACE("Glyph: %3d / List: %d size %d\n", glyph, listBase, needed_size);
|
||||
if (needed_size == GDI_ERROR) {
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (needed_size > size) {
|
||||
size = needed_size;
|
||||
HeapFree(GetProcessHeap(), 0, bitmap);
|
||||
HeapFree(GetProcessHeap(), 0, gl_bitmap);
|
||||
bitmap = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
|
||||
gl_bitmap = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
|
||||
}
|
||||
if (unicode)
|
||||
ret = (GetGlyphOutlineW(hdc, glyph, GGO_BITMAP, &gm, size, bitmap, &identity) != GDI_ERROR);
|
||||
else
|
||||
ret = (GetGlyphOutlineA(hdc, glyph, GGO_BITMAP, &gm, size, bitmap, &identity) != GDI_ERROR);
|
||||
if (!ret) break;
|
||||
|
||||
if (TRACE_ON(wgl)) {
|
||||
unsigned int bitmask;
|
||||
unsigned char *bitmap_ = bitmap;
|
||||
|
||||
TRACE(" - bbox: %d x %d\n", gm.gmBlackBoxX, gm.gmBlackBoxY);
|
||||
TRACE(" - origin: (%d, %d)\n", gm.gmptGlyphOrigin.x, gm.gmptGlyphOrigin.y);
|
||||
TRACE(" - increment: %d - %d\n", gm.gmCellIncX, gm.gmCellIncY);
|
||||
if (needed_size != 0) {
|
||||
TRACE(" - bitmap:\n");
|
||||
for (height = 0; height < gm.gmBlackBoxY; height++) {
|
||||
TRACE(" ");
|
||||
for (width = 0, bitmask = 0x80; width < gm.gmBlackBoxX; width++, bitmask >>= 1) {
|
||||
if (bitmask == 0) {
|
||||
bitmap_ += 1;
|
||||
bitmask = 0x80;
|
||||
}
|
||||
if (*bitmap_ & bitmask)
|
||||
TRACE("*");
|
||||
else
|
||||
TRACE(" ");
|
||||
}
|
||||
bitmap_ += (4 - ((UINT_PTR)bitmap_ & 0x03));
|
||||
TRACE("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* In OpenGL, the bitmap is drawn from the bottom to the top... So we need to invert the
|
||||
* glyph for it to be drawn properly.
|
||||
*/
|
||||
if (needed_size != 0) {
|
||||
width_int = (gm.gmBlackBoxX + 31) / 32;
|
||||
for (height = 0; height < gm.gmBlackBoxY; height++) {
|
||||
for (width = 0; width < width_int; width++) {
|
||||
((int *) gl_bitmap)[(gm.gmBlackBoxY - height - 1) * width_int + width] =
|
||||
((int *) bitmap)[height * width_int + width];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
glNewList(listBase++, GL_COMPILE);
|
||||
if (needed_size != 0) {
|
||||
glBitmap(gm.gmBlackBoxX, gm.gmBlackBoxY,
|
||||
0 - gm.gmptGlyphOrigin.x, (int) gm.gmBlackBoxY - gm.gmptGlyphOrigin.y,
|
||||
gm.gmCellIncX, gm.gmCellIncY,
|
||||
gl_bitmap);
|
||||
} else {
|
||||
/* This is the case of 'empty' glyphs like the space character */
|
||||
glBitmap(0, 0, 0, 0, gm.gmCellIncX, gm.gmCellIncY, NULL);
|
||||
}
|
||||
glEndList();
|
||||
}
|
||||
|
||||
glPixelStorei(GL_UNPACK_ALIGNMENT, org_alignment);
|
||||
HeapFree(GetProcessHeap(), 0, bitmap);
|
||||
HeapFree(GetProcessHeap(), 0, gl_bitmap);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* wglUseFontBitmapsA (OPENGL32.@)
|
||||
*/
|
||||
BOOL WINAPI wglUseFontBitmapsA(HDC hdc, DWORD first, DWORD count, DWORD listBase)
|
||||
{
|
||||
return wglUseFontBitmaps_common( hdc, first, count, listBase, FALSE );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* wglUseFontBitmapsW (OPENGL32.@)
|
||||
*/
|
||||
BOOL WINAPI wglUseFontBitmapsW(HDC hdc, DWORD first, DWORD count, DWORD listBase)
|
||||
{
|
||||
return wglUseFontBitmaps_common( hdc, first, count, listBase, TRUE );
|
||||
}
|
||||
|
||||
/* FIXME: should probably have a glu.h header */
|
||||
|
||||
typedef struct GLUtesselator GLUtesselator;
|
||||
typedef void (WINAPI *_GLUfuncptr)(void);
|
||||
|
||||
#define GLU_TESS_BEGIN 100100
|
||||
#define GLU_TESS_VERTEX 100101
|
||||
#define GLU_TESS_END 100102
|
||||
|
||||
static GLUtesselator * (WINAPI *pgluNewTess)(void);
|
||||
static void (WINAPI *pgluDeleteTess)(GLUtesselator *tess);
|
||||
static void (WINAPI *pgluTessNormal)(GLUtesselator *tess, GLdouble x, GLdouble y, GLdouble z);
|
||||
static void (WINAPI *pgluTessBeginPolygon)(GLUtesselator *tess, void *polygon_data);
|
||||
static void (WINAPI *pgluTessEndPolygon)(GLUtesselator *tess);
|
||||
static void (WINAPI *pgluTessCallback)(GLUtesselator *tess, GLenum which, _GLUfuncptr fn);
|
||||
static void (WINAPI *pgluTessBeginContour)(GLUtesselator *tess);
|
||||
static void (WINAPI *pgluTessEndContour)(GLUtesselator *tess);
|
||||
static void (WINAPI *pgluTessVertex)(GLUtesselator *tess, GLdouble *location, GLvoid* data);
|
||||
|
||||
static HMODULE load_libglu(void)
|
||||
{
|
||||
static const WCHAR glu32W[] = {'g','l','u','3','2','.','d','l','l',0};
|
||||
static int already_loaded;
|
||||
static HMODULE module;
|
||||
|
||||
if (already_loaded) return module;
|
||||
already_loaded = 1;
|
||||
|
||||
TRACE("Trying to load GLU library\n");
|
||||
module = LoadLibraryW( glu32W );
|
||||
if (!module)
|
||||
{
|
||||
WARN("Failed to load glu32\n");
|
||||
return NULL;
|
||||
}
|
||||
#define LOAD_FUNCPTR(f) p##f = (void *)GetProcAddress( module, #f )
|
||||
LOAD_FUNCPTR(gluNewTess);
|
||||
LOAD_FUNCPTR(gluDeleteTess);
|
||||
LOAD_FUNCPTR(gluTessBeginContour);
|
||||
LOAD_FUNCPTR(gluTessNormal);
|
||||
LOAD_FUNCPTR(gluTessBeginPolygon);
|
||||
LOAD_FUNCPTR(gluTessCallback);
|
||||
LOAD_FUNCPTR(gluTessEndContour);
|
||||
LOAD_FUNCPTR(gluTessEndPolygon);
|
||||
LOAD_FUNCPTR(gluTessVertex);
|
||||
#undef LOAD_FUNCPTR
|
||||
return module;
|
||||
}
|
||||
|
||||
static void fixed_to_double(POINTFX fixed, UINT em_size, GLdouble vertex[3])
|
||||
{
|
||||
vertex[0] = (fixed.x.value + (GLdouble)fixed.x.fract / (1 << 16)) / em_size;
|
||||
vertex[1] = (fixed.y.value + (GLdouble)fixed.y.fract / (1 << 16)) / em_size;
|
||||
vertex[2] = 0.0;
|
||||
}
|
||||
|
||||
static void WINAPI tess_callback_vertex(GLvoid *vertex)
|
||||
{
|
||||
GLdouble *dbl = vertex;
|
||||
TRACE("%f, %f, %f\n", dbl[0], dbl[1], dbl[2]);
|
||||
glVertex3dv(vertex);
|
||||
}
|
||||
|
||||
static void WINAPI tess_callback_begin(GLenum which)
|
||||
{
|
||||
TRACE("%d\n", which);
|
||||
glBegin(which);
|
||||
}
|
||||
|
||||
static void WINAPI tess_callback_end(void)
|
||||
{
|
||||
TRACE("\n");
|
||||
glEnd();
|
||||
}
|
||||
|
||||
typedef struct _bezier_vector {
|
||||
GLdouble x;
|
||||
GLdouble y;
|
||||
} bezier_vector;
|
||||
|
||||
static double bezier_deviation_squared(const bezier_vector *p)
|
||||
{
|
||||
bezier_vector deviation;
|
||||
bezier_vector vertex;
|
||||
bezier_vector base;
|
||||
double base_length;
|
||||
double dot;
|
||||
|
||||
vertex.x = (p[0].x + p[1].x*2 + p[2].x)/4 - p[0].x;
|
||||
vertex.y = (p[0].y + p[1].y*2 + p[2].y)/4 - p[0].y;
|
||||
|
||||
base.x = p[2].x - p[0].x;
|
||||
base.y = p[2].y - p[0].y;
|
||||
|
||||
base_length = sqrt(base.x*base.x + base.y*base.y);
|
||||
base.x /= base_length;
|
||||
base.y /= base_length;
|
||||
|
||||
dot = base.x*vertex.x + base.y*vertex.y;
|
||||
dot = min(max(dot, 0.0), base_length);
|
||||
base.x *= dot;
|
||||
base.y *= dot;
|
||||
|
||||
deviation.x = vertex.x-base.x;
|
||||
deviation.y = vertex.y-base.y;
|
||||
|
||||
return deviation.x*deviation.x + deviation.y*deviation.y;
|
||||
}
|
||||
|
||||
static int bezier_approximate(const bezier_vector *p, bezier_vector *points, FLOAT deviation)
|
||||
{
|
||||
bezier_vector first_curve[3];
|
||||
bezier_vector second_curve[3];
|
||||
bezier_vector vertex;
|
||||
int total_vertices;
|
||||
|
||||
if(bezier_deviation_squared(p) <= deviation*deviation)
|
||||
{
|
||||
if(points)
|
||||
*points = p[2];
|
||||
return 1;
|
||||
}
|
||||
|
||||
vertex.x = (p[0].x + p[1].x*2 + p[2].x)/4;
|
||||
vertex.y = (p[0].y + p[1].y*2 + p[2].y)/4;
|
||||
|
||||
first_curve[0] = p[0];
|
||||
first_curve[1].x = (p[0].x + p[1].x)/2;
|
||||
first_curve[1].y = (p[0].y + p[1].y)/2;
|
||||
first_curve[2] = vertex;
|
||||
|
||||
second_curve[0] = vertex;
|
||||
second_curve[1].x = (p[2].x + p[1].x)/2;
|
||||
second_curve[1].y = (p[2].y + p[1].y)/2;
|
||||
second_curve[2] = p[2];
|
||||
|
||||
total_vertices = bezier_approximate(first_curve, points, deviation);
|
||||
if(points)
|
||||
points += total_vertices;
|
||||
total_vertices += bezier_approximate(second_curve, points, deviation);
|
||||
return total_vertices;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* wglUseFontOutlines_common
|
||||
*/
|
||||
static BOOL wglUseFontOutlines_common(HDC hdc,
|
||||
DWORD first,
|
||||
DWORD count,
|
||||
DWORD listBase,
|
||||
FLOAT deviation,
|
||||
FLOAT extrusion,
|
||||
int format,
|
||||
LPGLYPHMETRICSFLOAT lpgmf,
|
||||
BOOL unicode)
|
||||
{
|
||||
UINT glyph;
|
||||
const MAT2 identity = {{0,1},{0,0},{0,0},{0,1}};
|
||||
GLUtesselator *tess = NULL;
|
||||
LOGFONTW lf;
|
||||
HFONT old_font, unscaled_font;
|
||||
UINT em_size = 1024;
|
||||
RECT rc;
|
||||
|
||||
TRACE("(%p, %d, %d, %d, %f, %f, %d, %p, %s)\n", hdc, first, count,
|
||||
listBase, deviation, extrusion, format, lpgmf, unicode ? "W" : "A");
|
||||
|
||||
if(deviation <= 0.0)
|
||||
deviation = 1.0/em_size;
|
||||
|
||||
if(format == WGL_FONT_POLYGONS)
|
||||
{
|
||||
if (!load_libglu())
|
||||
{
|
||||
ERR("glu32 is required for this function but isn't available\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
tess = pgluNewTess();
|
||||
if(!tess) return FALSE;
|
||||
pgluTessCallback(tess, GLU_TESS_VERTEX, (_GLUfuncptr)tess_callback_vertex);
|
||||
pgluTessCallback(tess, GLU_TESS_BEGIN, (_GLUfuncptr)tess_callback_begin);
|
||||
pgluTessCallback(tess, GLU_TESS_END, tess_callback_end);
|
||||
}
|
||||
|
||||
GetObjectW(GetCurrentObject(hdc, OBJ_FONT), sizeof(lf), &lf);
|
||||
rc.left = rc.right = rc.bottom = 0;
|
||||
rc.top = em_size;
|
||||
DPtoLP(hdc, (POINT*)&rc, 2);
|
||||
lf.lfHeight = -abs(rc.top - rc.bottom);
|
||||
lf.lfOrientation = lf.lfEscapement = 0;
|
||||
unscaled_font = CreateFontIndirectW(&lf);
|
||||
old_font = SelectObject(hdc, unscaled_font);
|
||||
|
||||
for (glyph = first; glyph < first + count; glyph++)
|
||||
{
|
||||
DWORD needed;
|
||||
GLYPHMETRICS gm;
|
||||
BYTE *buf;
|
||||
TTPOLYGONHEADER *pph;
|
||||
TTPOLYCURVE *ppc;
|
||||
GLdouble *vertices = NULL;
|
||||
int vertex_total = -1;
|
||||
|
||||
if(unicode)
|
||||
needed = GetGlyphOutlineW(hdc, glyph, GGO_NATIVE, &gm, 0, NULL, &identity);
|
||||
else
|
||||
needed = GetGlyphOutlineA(hdc, glyph, GGO_NATIVE, &gm, 0, NULL, &identity);
|
||||
|
||||
if(needed == GDI_ERROR)
|
||||
goto error;
|
||||
|
||||
buf = HeapAlloc(GetProcessHeap(), 0, needed);
|
||||
|
||||
if(unicode)
|
||||
GetGlyphOutlineW(hdc, glyph, GGO_NATIVE, &gm, needed, buf, &identity);
|
||||
else
|
||||
GetGlyphOutlineA(hdc, glyph, GGO_NATIVE, &gm, needed, buf, &identity);
|
||||
|
||||
TRACE("glyph %d\n", glyph);
|
||||
|
||||
if(lpgmf)
|
||||
{
|
||||
lpgmf->gmfBlackBoxX = (float)gm.gmBlackBoxX / em_size;
|
||||
lpgmf->gmfBlackBoxY = (float)gm.gmBlackBoxY / em_size;
|
||||
lpgmf->gmfptGlyphOrigin.x = (float)gm.gmptGlyphOrigin.x / em_size;
|
||||
lpgmf->gmfptGlyphOrigin.y = (float)gm.gmptGlyphOrigin.y / em_size;
|
||||
lpgmf->gmfCellIncX = (float)gm.gmCellIncX / em_size;
|
||||
lpgmf->gmfCellIncY = (float)gm.gmCellIncY / em_size;
|
||||
|
||||
TRACE("%fx%f at %f,%f inc %f,%f\n", lpgmf->gmfBlackBoxX, lpgmf->gmfBlackBoxY,
|
||||
lpgmf->gmfptGlyphOrigin.x, lpgmf->gmfptGlyphOrigin.y, lpgmf->gmfCellIncX, lpgmf->gmfCellIncY);
|
||||
lpgmf++;
|
||||
}
|
||||
|
||||
glNewList(listBase++, GL_COMPILE);
|
||||
glFrontFace(GL_CCW);
|
||||
if(format == WGL_FONT_POLYGONS)
|
||||
{
|
||||
glNormal3d(0.0, 0.0, 1.0);
|
||||
pgluTessNormal(tess, 0, 0, 1);
|
||||
pgluTessBeginPolygon(tess, NULL);
|
||||
}
|
||||
|
||||
while(!vertices)
|
||||
{
|
||||
if(vertex_total != -1)
|
||||
vertices = HeapAlloc(GetProcessHeap(), 0, vertex_total * 3 * sizeof(GLdouble));
|
||||
vertex_total = 0;
|
||||
|
||||
pph = (TTPOLYGONHEADER*)buf;
|
||||
while((BYTE*)pph < buf + needed)
|
||||
{
|
||||
GLdouble previous[3];
|
||||
fixed_to_double(pph->pfxStart, em_size, previous);
|
||||
|
||||
if(vertices)
|
||||
TRACE("\tstart %d, %d\n", pph->pfxStart.x.value, pph->pfxStart.y.value);
|
||||
|
||||
if(format == WGL_FONT_POLYGONS)
|
||||
pgluTessBeginContour(tess);
|
||||
else
|
||||
glBegin(GL_LINE_LOOP);
|
||||
|
||||
if(vertices)
|
||||
{
|
||||
fixed_to_double(pph->pfxStart, em_size, vertices);
|
||||
if(format == WGL_FONT_POLYGONS)
|
||||
pgluTessVertex(tess, vertices, vertices);
|
||||
else
|
||||
glVertex3d(vertices[0], vertices[1], vertices[2]);
|
||||
vertices += 3;
|
||||
}
|
||||
vertex_total++;
|
||||
|
||||
ppc = (TTPOLYCURVE*)((char*)pph + sizeof(*pph));
|
||||
while((char*)ppc < (char*)pph + pph->cb)
|
||||
{
|
||||
int i, j;
|
||||
int num;
|
||||
|
||||
switch(ppc->wType) {
|
||||
case TT_PRIM_LINE:
|
||||
for(i = 0; i < ppc->cpfx; i++)
|
||||
{
|
||||
if(vertices)
|
||||
{
|
||||
TRACE("\t\tline to %d, %d\n",
|
||||
ppc->apfx[i].x.value, ppc->apfx[i].y.value);
|
||||
fixed_to_double(ppc->apfx[i], em_size, vertices);
|
||||
if(format == WGL_FONT_POLYGONS)
|
||||
pgluTessVertex(tess, vertices, vertices);
|
||||
else
|
||||
glVertex3d(vertices[0], vertices[1], vertices[2]);
|
||||
vertices += 3;
|
||||
}
|
||||
fixed_to_double(ppc->apfx[i], em_size, previous);
|
||||
vertex_total++;
|
||||
}
|
||||
break;
|
||||
|
||||
case TT_PRIM_QSPLINE:
|
||||
for(i = 0; i < ppc->cpfx-1; i++)
|
||||
{
|
||||
bezier_vector curve[3];
|
||||
bezier_vector *points;
|
||||
GLdouble curve_vertex[3];
|
||||
|
||||
if(vertices)
|
||||
TRACE("\t\tcurve %d,%d %d,%d\n",
|
||||
ppc->apfx[i].x.value, ppc->apfx[i].y.value,
|
||||
ppc->apfx[i + 1].x.value, ppc->apfx[i + 1].y.value);
|
||||
|
||||
curve[0].x = previous[0];
|
||||
curve[0].y = previous[1];
|
||||
fixed_to_double(ppc->apfx[i], em_size, curve_vertex);
|
||||
curve[1].x = curve_vertex[0];
|
||||
curve[1].y = curve_vertex[1];
|
||||
fixed_to_double(ppc->apfx[i + 1], em_size, curve_vertex);
|
||||
curve[2].x = curve_vertex[0];
|
||||
curve[2].y = curve_vertex[1];
|
||||
if(i < ppc->cpfx-2)
|
||||
{
|
||||
curve[2].x = (curve[1].x + curve[2].x)/2;
|
||||
curve[2].y = (curve[1].y + curve[2].y)/2;
|
||||
}
|
||||
num = bezier_approximate(curve, NULL, deviation);
|
||||
points = HeapAlloc(GetProcessHeap(), 0, num*sizeof(bezier_vector));
|
||||
num = bezier_approximate(curve, points, deviation);
|
||||
vertex_total += num;
|
||||
if(vertices)
|
||||
{
|
||||
for(j=0; j<num; j++)
|
||||
{
|
||||
TRACE("\t\t\tvertex at %f,%f\n", points[j].x, points[j].y);
|
||||
vertices[0] = points[j].x;
|
||||
vertices[1] = points[j].y;
|
||||
vertices[2] = 0.0;
|
||||
if(format == WGL_FONT_POLYGONS)
|
||||
pgluTessVertex(tess, vertices, vertices);
|
||||
else
|
||||
glVertex3d(vertices[0], vertices[1], vertices[2]);
|
||||
vertices += 3;
|
||||
}
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, points);
|
||||
previous[0] = curve[2].x;
|
||||
previous[1] = curve[2].y;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ERR("\t\tcurve type = %d\n", ppc->wType);
|
||||
if(format == WGL_FONT_POLYGONS)
|
||||
pgluTessEndContour(tess);
|
||||
else
|
||||
glEnd();
|
||||
goto error_in_list;
|
||||
}
|
||||
|
||||
ppc = (TTPOLYCURVE*)((char*)ppc + sizeof(*ppc) +
|
||||
(ppc->cpfx - 1) * sizeof(POINTFX));
|
||||
}
|
||||
if(format == WGL_FONT_POLYGONS)
|
||||
pgluTessEndContour(tess);
|
||||
else
|
||||
glEnd();
|
||||
pph = (TTPOLYGONHEADER*)((char*)pph + pph->cb);
|
||||
}
|
||||
}
|
||||
|
||||
error_in_list:
|
||||
if(format == WGL_FONT_POLYGONS)
|
||||
pgluTessEndPolygon(tess);
|
||||
glTranslated((GLdouble)gm.gmCellIncX / em_size, (GLdouble)gm.gmCellIncY / em_size, 0.0);
|
||||
glEndList();
|
||||
HeapFree(GetProcessHeap(), 0, buf);
|
||||
HeapFree(GetProcessHeap(), 0, vertices);
|
||||
}
|
||||
|
||||
error:
|
||||
DeleteObject(SelectObject(hdc, old_font));
|
||||
if(format == WGL_FONT_POLYGONS)
|
||||
pgluDeleteTess(tess);
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* wglUseFontOutlinesA (OPENGL32.@)
|
||||
*/
|
||||
BOOL WINAPI wglUseFontOutlinesA(HDC hdc,
|
||||
DWORD first,
|
||||
DWORD count,
|
||||
DWORD listBase,
|
||||
FLOAT deviation,
|
||||
FLOAT extrusion,
|
||||
int format,
|
||||
LPGLYPHMETRICSFLOAT lpgmf)
|
||||
{
|
||||
return wglUseFontOutlines_common(hdc, first, count, listBase, deviation, extrusion, format, lpgmf, FALSE);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* wglUseFontOutlinesW (OPENGL32.@)
|
||||
*/
|
||||
BOOL WINAPI wglUseFontOutlinesW(HDC hdc,
|
||||
DWORD first,
|
||||
DWORD count,
|
||||
DWORD listBase,
|
||||
FLOAT deviation,
|
||||
FLOAT extrusion,
|
||||
int format,
|
||||
LPGLYPHMETRICSFLOAT lpgmf)
|
||||
{
|
||||
return wglUseFontOutlines_common(hdc, first, count, listBase, deviation, extrusion, format, lpgmf, TRUE);
|
||||
}
|
134
dll/opengl/opengl32/gl.c
Normal file
134
dll/opengl/opengl32/gl.c
Normal file
|
@ -0,0 +1,134 @@
|
|||
/*
|
||||
* 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
|
||||
*/
|
||||
|
||||
/* 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()->glDispatchTable
|
||||
* for gl functions in teblist.h and for others it gets the pointer from
|
||||
* NtCurrentTeb()->glTable and jmps to the address, leaving the stack alone and
|
||||
* letting the "real" function return for us.
|
||||
* Royce has implemented this in NASM =D
|
||||
*
|
||||
* On other machines we use C to forward the calls (slow...)
|
||||
*/
|
||||
|
||||
#include "opengl32.h"
|
||||
|
||||
#if defined(_M_IX86)
|
||||
C_ASSERT(FIELD_OFFSET(TEB, glTable) == 0xbe8);
|
||||
#endif
|
||||
|
||||
int WINAPI glEmptyFunc0( void ) { return 0; }
|
||||
int WINAPI glEmptyFunc4( long l1 ) { return 0; }
|
||||
int WINAPI glEmptyFunc8( long l1, long l2 ) { return 0; }
|
||||
int WINAPI glEmptyFunc12( long l1, long l2, long l3 ) { return 0; }
|
||||
int WINAPI glEmptyFunc16( long l1, long l2, long l3, long l4 ) { return 0; }
|
||||
int WINAPI glEmptyFunc20( long l1, long l2, long l3, long l4, long l5 )
|
||||
{ return 0; }
|
||||
int WINAPI glEmptyFunc24( long l1, long l2, long l3, long l4, long l5,
|
||||
long l6 ) { return 0; }
|
||||
int WINAPI glEmptyFunc28( long l1, long l2, long l3, long l4, long l5,
|
||||
long l6, long l7 ) { return 0; }
|
||||
int WINAPI glEmptyFunc32( long l1, long l2, long l3, long l4, long l5,
|
||||
long l6, long l7, long l8 ) { return 0; }
|
||||
int WINAPI glEmptyFunc36( long l1, long l2, long l3, long l4, long l5,
|
||||
long l6, long l7, long l8, long l9 ) { return 0; }
|
||||
int WINAPI glEmptyFunc40( long l1, long l2, long l3, long l4, long l5,
|
||||
long l6, long l7, long l8, long l9, long l10 )
|
||||
{ return 0; }
|
||||
int WINAPI glEmptyFunc44( long l1, long l2, long l3, long l4, long l5,
|
||||
long l6, long l7, long l8, long l9, long l10,
|
||||
long l11 ) { return 0; }
|
||||
int WINAPI glEmptyFunc48( long l1, long l2, long l3, long l4, long l5,
|
||||
long l6, long l7, long l8, long l9, long l10,
|
||||
long l11, long l12 ) { return 0; }
|
||||
int WINAPI glEmptyFunc52( long l1, long l2, long l3, long l4, long l5,
|
||||
long l6, long l7, long l8, long l9, long l10,
|
||||
long l11, long l12, long l13 ) { return 0; }
|
||||
int WINAPI glEmptyFunc56( long l1, long l2, long l3, long l4, long l5,
|
||||
long l6, long l7, long l8, long l9, long l10,
|
||||
long l11, long l12, long l13, long l14 )
|
||||
{ return 0; }
|
||||
|
||||
#if defined(_M_IX86)
|
||||
# define FOO(x) #x
|
||||
|
||||
#ifdef __GNUC__
|
||||
# define X(func, ret, typeargs, args, icdidx, tebidx, stack) \
|
||||
__asm__(".align 4" "\n\t" \
|
||||
".globl _"#func"@"#stack "\n\t" \
|
||||
"_"#func"@"#stack":" "\n\t" \
|
||||
" movl %fs:0x18, %eax" "\n\t" \
|
||||
" movl 0xbe8(%eax), %eax" "\n\t" \
|
||||
" jmp *"FOO((icdidx*4))"(%eax)" "\n\t");
|
||||
#elif defined(_MSC_VER)
|
||||
# define X(func, ret, typeargs, args, icdidx, tebidx, stack) \
|
||||
__declspec(naked) ret WINAPI func typeargs \
|
||||
{ \
|
||||
__asm { mov eax, dword ptr fs:[18h] }; \
|
||||
__asm { mov eax, dword ptr [eax+0be8h] }; \
|
||||
__asm { jmp dword ptr [eax+icdidx*4] }; \
|
||||
}
|
||||
#else
|
||||
# define X(func, ret, typeargs, args, icdidx, tebidx, stack) \
|
||||
ret WINAPI func typeargs \
|
||||
{ \
|
||||
PROC *table; \
|
||||
PROC fn; \
|
||||
if (tebidx >= 0 && 0) \
|
||||
{ \
|
||||
table = (PROC *)NtCurrentTeb()->glDispatchTable; \
|
||||
fn = table[tebidx]; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
table = (PROC *)NtCurrentTeb()->glTable; \
|
||||
fn = table[icdidx]; \
|
||||
} \
|
||||
return (ret)((ret(*)typeargs)fn)args; \
|
||||
}
|
||||
#endif
|
||||
|
||||
GLFUNCS_MACRO
|
||||
# undef FOO
|
||||
# undef X
|
||||
#else /* defined(_M_IX86) */
|
||||
# define X(func, ret, typeargs, args, icdidx, tebidx, stack) \
|
||||
ret WINAPI func typeargs \
|
||||
{ \
|
||||
PROC *table; \
|
||||
PROC fn; \
|
||||
if (tebidx >= 0 && 0) \
|
||||
{ \
|
||||
table = (PROC *)NtCurrentTeb()->glDispatchTable; \
|
||||
fn = table[tebidx]; \
|
||||
} \
|
||||
else \
|
||||
{ \
|
||||
table = (PROC *)NtCurrentTeb()->glTable; \
|
||||
fn = table[icdidx]; \
|
||||
} \
|
||||
return (ret)((ret(*)typeargs)fn)args; \
|
||||
}
|
||||
|
||||
GLFUNCS_MACRO
|
||||
|
||||
# undef X
|
||||
#endif /* !defined(_M_IX86) */
|
||||
|
||||
/* Unknown debugging function */
|
||||
GLint WINAPI glDebugEntry( GLint unknown1, GLint unknown2 )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
/* EOF */
|
363
dll/opengl/opengl32/glapi_x86.s
Normal file
363
dll/opengl/opengl32/glapi_x86.s
Normal file
|
@ -0,0 +1,363 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS
|
||||
* FILE: dll/opengl/opengl32/glapi_x86.s
|
||||
* PURPOSE: OpenGL32 DLL
|
||||
*/
|
||||
|
||||
/* X86 opengl API entry points, fast forward to the current thread's dispatch table */
|
||||
#include <asm.inc>
|
||||
|
||||
.code
|
||||
|
||||
EXTERN _OglTlsIndex:DWORD
|
||||
EXTERN _TlsGetValue@4:PROC
|
||||
|
||||
MACRO(USE_GL_FUNC, name, offset, stack)
|
||||
PUBLIC _gl&name&@&stack
|
||||
.PROC _gl&name&@&stack
|
||||
push _OglTlsIndex
|
||||
call _TlsGetValue@4
|
||||
mov eax, [eax]
|
||||
jmp dword ptr [eax+4*VAL(offset)]
|
||||
.ENDP
|
||||
ENDM
|
||||
|
||||
USE_GL_FUNC Accum, 213, 8
|
||||
USE_GL_FUNC AlphaFunc, 240, 8
|
||||
USE_GL_FUNC AreTexturesResident, 322, 12
|
||||
USE_GL_FUNC ArrayElement, 306, 4
|
||||
USE_GL_FUNC Begin, 7, 4
|
||||
USE_GL_FUNC BindTexture, 307, 8
|
||||
USE_GL_FUNC Bitmap, 8, 28
|
||||
USE_GL_FUNC BlendFunc, 241, 8
|
||||
USE_GL_FUNC CallList, 2, 4
|
||||
USE_GL_FUNC CallLists, 3, 12
|
||||
USE_GL_FUNC Clear, 203, 4
|
||||
USE_GL_FUNC ClearAccum, 204, 16
|
||||
USE_GL_FUNC ClearColor, 206, 16
|
||||
USE_GL_FUNC ClearDepth, 208, 8
|
||||
USE_GL_FUNC ClearIndex, 205, 4
|
||||
USE_GL_FUNC ClearStencil, 207, 4
|
||||
USE_GL_FUNC ClipPlane, 150, 8
|
||||
USE_GL_FUNC Color3b, 9, 12
|
||||
USE_GL_FUNC Color3bv, 10, 4
|
||||
USE_GL_FUNC Color3d, 11, 24
|
||||
USE_GL_FUNC Color3dv, 12, 4
|
||||
USE_GL_FUNC Color3f, 13, 12
|
||||
USE_GL_FUNC Color3fv, 14, 4
|
||||
USE_GL_FUNC Color3i, 15, 12
|
||||
USE_GL_FUNC Color3iv, 16, 4
|
||||
USE_GL_FUNC Color3s, 17, 12
|
||||
USE_GL_FUNC Color3sv, 18, 4
|
||||
USE_GL_FUNC Color3ub, 19, 12
|
||||
USE_GL_FUNC Color3ubv, 20, 4
|
||||
USE_GL_FUNC Color3ui, 21, 12
|
||||
USE_GL_FUNC Color3uiv, 22, 4
|
||||
USE_GL_FUNC Color3us, 23, 12
|
||||
USE_GL_FUNC Color3usv, 24, 4
|
||||
USE_GL_FUNC Color4b, 25, 16
|
||||
USE_GL_FUNC Color4bv, 26, 4
|
||||
USE_GL_FUNC Color4d, 27, 32
|
||||
USE_GL_FUNC Color4dv, 28, 4
|
||||
USE_GL_FUNC Color4f, 29, 16
|
||||
USE_GL_FUNC Color4fv, 30, 4
|
||||
USE_GL_FUNC Color4i, 31, 16
|
||||
USE_GL_FUNC Color4iv, 32, 4
|
||||
USE_GL_FUNC Color4s, 33, 16
|
||||
USE_GL_FUNC Color4sv, 34, 4
|
||||
USE_GL_FUNC Color4ub, 35, 16
|
||||
USE_GL_FUNC Color4ubv, 36, 4
|
||||
USE_GL_FUNC Color4ui, 37, 16
|
||||
USE_GL_FUNC Color4uiv, 38, 4
|
||||
USE_GL_FUNC Color4us, 39, 16
|
||||
USE_GL_FUNC Color4usv, 40, 4
|
||||
USE_GL_FUNC ColorMask, 210, 16
|
||||
USE_GL_FUNC ColorMaterial, 151, 8
|
||||
USE_GL_FUNC ColorPointer, 308, 16
|
||||
USE_GL_FUNC CopyPixels, 255, 20
|
||||
USE_GL_FUNC CopyTexImage1D, 323, 28
|
||||
USE_GL_FUNC CopyTexImage2D, 324, 32
|
||||
USE_GL_FUNC CopyTexSubImage1D, 325, 24
|
||||
USE_GL_FUNC CopyTexSubImage2D, 326, 32
|
||||
USE_GL_FUNC CullFace, 152, 4
|
||||
USE_GL_FUNC DeleteLists, 4, 8
|
||||
USE_GL_FUNC DeleteTextures, 327, 8
|
||||
USE_GL_FUNC DepthFunc, 245, 4
|
||||
USE_GL_FUNC DepthMask, 211, 4
|
||||
USE_GL_FUNC DepthRange, 288, 16
|
||||
USE_GL_FUNC Disable, 214, 4
|
||||
USE_GL_FUNC DisableClientState, 309, 4
|
||||
USE_GL_FUNC DrawArrays, 310, 12
|
||||
USE_GL_FUNC DrawBuffer, 202, 4
|
||||
USE_GL_FUNC DrawElements, 311, 16
|
||||
USE_GL_FUNC DrawPixels, 257, 20
|
||||
USE_GL_FUNC EdgeFlag, 41, 4
|
||||
USE_GL_FUNC EdgeFlagPointer, 312, 8
|
||||
USE_GL_FUNC EdgeFlagv, 42, 4
|
||||
USE_GL_FUNC Enable, 215, 4
|
||||
USE_GL_FUNC EnableClientState, 313, 4
|
||||
USE_GL_FUNC End, 43, 0
|
||||
USE_GL_FUNC EndList, 1, 0
|
||||
USE_GL_FUNC EvalCoord1d, 228, 8
|
||||
USE_GL_FUNC EvalCoord1dv, 229, 4
|
||||
USE_GL_FUNC EvalCoord1f, 230, 4
|
||||
USE_GL_FUNC EvalCoord1fv, 231, 4
|
||||
USE_GL_FUNC EvalCoord2d, 232, 16
|
||||
USE_GL_FUNC EvalCoord2dv, 233, 4
|
||||
USE_GL_FUNC EvalCoord2f, 234, 8
|
||||
USE_GL_FUNC EvalCoord2fv, 235, 4
|
||||
USE_GL_FUNC EvalMesh1, 236, 12
|
||||
USE_GL_FUNC EvalMesh2, 238, 20
|
||||
USE_GL_FUNC EvalPoint1, 237, 4
|
||||
USE_GL_FUNC EvalPoint2, 239, 8
|
||||
USE_GL_FUNC FeedbackBuffer, 194, 12
|
||||
USE_GL_FUNC Finish, 216, 0
|
||||
USE_GL_FUNC Flush, 217, 0
|
||||
USE_GL_FUNC Fogf, 153, 8
|
||||
USE_GL_FUNC Fogfv, 154, 8
|
||||
USE_GL_FUNC Fogi, 155, 8
|
||||
USE_GL_FUNC Fogiv, 156, 8
|
||||
USE_GL_FUNC FrontFace, 157, 4
|
||||
USE_GL_FUNC Frustum, 289, 48
|
||||
USE_GL_FUNC GenLists, 5, 4
|
||||
USE_GL_FUNC GenTextures, 328, 8
|
||||
USE_GL_FUNC GetBooleanv, 258, 8
|
||||
USE_GL_FUNC GetClipPlane, 259, 8
|
||||
USE_GL_FUNC GetDoublev, 260, 8
|
||||
USE_GL_FUNC GetError, 261, 0
|
||||
USE_GL_FUNC GetFloatv, 262, 8
|
||||
USE_GL_FUNC GetIntegerv, 263, 8
|
||||
USE_GL_FUNC GetLightfv, 264, 12
|
||||
USE_GL_FUNC GetLightiv, 265, 12
|
||||
USE_GL_FUNC GetMapdv, 266, 12
|
||||
USE_GL_FUNC GetMapfv, 267, 12
|
||||
USE_GL_FUNC GetMapiv, 268, 12
|
||||
USE_GL_FUNC GetMaterialfv, 269, 12
|
||||
USE_GL_FUNC GetMaterialiv, 270, 12
|
||||
USE_GL_FUNC GetPixelMapfv, 271, 8
|
||||
USE_GL_FUNC GetPixelMapuiv, 272, 8
|
||||
USE_GL_FUNC GetPixelMapusv, 273, 8
|
||||
USE_GL_FUNC GetPointerv, 329, 8
|
||||
USE_GL_FUNC GetPolygonStipple, 274, 4
|
||||
USE_GL_FUNC GetString, 275, 4
|
||||
USE_GL_FUNC GetTexEnvfv, 276, 12
|
||||
USE_GL_FUNC GetTexEnviv, 277, 12
|
||||
USE_GL_FUNC GetTexGendv, 278, 12
|
||||
USE_GL_FUNC GetTexGenfv, 279, 12
|
||||
USE_GL_FUNC GetTexGeniv, 280, 12
|
||||
USE_GL_FUNC GetTexImage, 281, 20
|
||||
USE_GL_FUNC GetTexLevelParameterfv, 284, 16
|
||||
USE_GL_FUNC GetTexLevelParameteriv, 285, 16
|
||||
USE_GL_FUNC GetTexParameterfv, 282, 12
|
||||
USE_GL_FUNC GetTexParameteriv, 283, 12
|
||||
USE_GL_FUNC Hint, 158, 8
|
||||
USE_GL_FUNC IndexMask, 212, 4
|
||||
USE_GL_FUNC IndexPointer, 314, 12
|
||||
USE_GL_FUNC Indexd, 44, 8
|
||||
USE_GL_FUNC Indexdv, 45, 4
|
||||
USE_GL_FUNC Indexf, 46, 4
|
||||
USE_GL_FUNC Indexfv, 47, 4
|
||||
USE_GL_FUNC Indexi, 48, 4
|
||||
USE_GL_FUNC Indexiv, 49, 4
|
||||
USE_GL_FUNC Indexs, 50, 4
|
||||
USE_GL_FUNC Indexsv, 51, 4
|
||||
USE_GL_FUNC Indexub, 315, 4
|
||||
USE_GL_FUNC Indexubv, 316, 4
|
||||
USE_GL_FUNC InitNames, 197, 0
|
||||
USE_GL_FUNC InterleavedArrays, 317, 12
|
||||
USE_GL_FUNC IsEnabled, 286, 4
|
||||
USE_GL_FUNC IsList, 287, 4
|
||||
USE_GL_FUNC IsTexture, 330, 4
|
||||
USE_GL_FUNC LightModelf, 163, 8
|
||||
USE_GL_FUNC LightModelfv, 164, 8
|
||||
USE_GL_FUNC LightModeli, 165, 8
|
||||
USE_GL_FUNC LightModeliv, 166, 8
|
||||
USE_GL_FUNC Lightf, 159, 12
|
||||
USE_GL_FUNC Lightfv, 160, 12
|
||||
USE_GL_FUNC Lighti, 161, 12
|
||||
USE_GL_FUNC Lightiv, 162, 12
|
||||
USE_GL_FUNC LineStipple, 167, 8
|
||||
USE_GL_FUNC LineWidth, 168, 4
|
||||
USE_GL_FUNC ListBase, 6, 4
|
||||
USE_GL_FUNC LoadIdentity, 290, 0
|
||||
USE_GL_FUNC LoadMatrixd, 292, 4
|
||||
USE_GL_FUNC LoadMatrixf, 291, 4
|
||||
USE_GL_FUNC LoadName, 198, 4
|
||||
USE_GL_FUNC LogicOp, 242, 4
|
||||
USE_GL_FUNC Map1d, 220, 32
|
||||
USE_GL_FUNC Map1f, 221, 24
|
||||
USE_GL_FUNC Map2d, 222, 56
|
||||
USE_GL_FUNC Map2f, 223, 40
|
||||
USE_GL_FUNC MapGrid1d, 224, 20
|
||||
USE_GL_FUNC MapGrid1f, 225, 12
|
||||
USE_GL_FUNC MapGrid2d, 226, 40
|
||||
USE_GL_FUNC MapGrid2f, 227, 24
|
||||
USE_GL_FUNC Materialf, 169, 12
|
||||
USE_GL_FUNC Materialfv, 170, 12
|
||||
USE_GL_FUNC Materiali, 171, 12
|
||||
USE_GL_FUNC Materialiv, 172, 12
|
||||
USE_GL_FUNC MatrixMode, 293, 4
|
||||
USE_GL_FUNC MultMatrixd, 295, 4
|
||||
USE_GL_FUNC MultMatrixf, 294, 4
|
||||
USE_GL_FUNC NewList, 0, 8
|
||||
USE_GL_FUNC Normal3b, 52, 12
|
||||
USE_GL_FUNC Normal3bv, 53, 4
|
||||
USE_GL_FUNC Normal3d, 54, 24
|
||||
USE_GL_FUNC Normal3dv, 55, 4
|
||||
USE_GL_FUNC Normal3f, 56, 12
|
||||
USE_GL_FUNC Normal3fv, 57, 4
|
||||
USE_GL_FUNC Normal3i, 58, 12
|
||||
USE_GL_FUNC Normal3iv, 59, 4
|
||||
USE_GL_FUNC Normal3s, 60, 12
|
||||
USE_GL_FUNC Normal3sv, 61, 4
|
||||
USE_GL_FUNC NormalPointer, 318, 12
|
||||
USE_GL_FUNC Ortho, 296, 48
|
||||
USE_GL_FUNC PassThrough, 199, 4
|
||||
USE_GL_FUNC PixelMapfv, 251, 12
|
||||
USE_GL_FUNC PixelMapuiv, 252, 12
|
||||
USE_GL_FUNC PixelMapusv, 253, 12
|
||||
USE_GL_FUNC PixelStoref, 249, 8
|
||||
USE_GL_FUNC PixelStorei, 250, 8
|
||||
USE_GL_FUNC PixelTransferf, 247, 8
|
||||
USE_GL_FUNC PixelTransferi, 248, 8
|
||||
USE_GL_FUNC PixelZoom, 246, 8
|
||||
USE_GL_FUNC PointSize, 173, 4
|
||||
USE_GL_FUNC PolygonMode, 174, 8
|
||||
USE_GL_FUNC PolygonOffset, 319, 8
|
||||
USE_GL_FUNC PolygonStipple, 175, 4
|
||||
USE_GL_FUNC PopAttrib, 218, 0
|
||||
USE_GL_FUNC PopClientAttrib, 334, 0
|
||||
USE_GL_FUNC PopMatrix, 297, 0
|
||||
USE_GL_FUNC PopName, 200, 0
|
||||
USE_GL_FUNC PrioritizeTextures, 331, 12
|
||||
USE_GL_FUNC PushAttrib, 219, 4
|
||||
USE_GL_FUNC PushClientAttrib, 335, 4
|
||||
USE_GL_FUNC PushMatrix, 298, 0
|
||||
USE_GL_FUNC PushName, 201, 4
|
||||
USE_GL_FUNC RasterPos2d, 62, 16
|
||||
USE_GL_FUNC RasterPos2dv, 63, 4
|
||||
USE_GL_FUNC RasterPos2f, 64, 8
|
||||
USE_GL_FUNC RasterPos2fv, 65, 4
|
||||
USE_GL_FUNC RasterPos2i, 66, 8
|
||||
USE_GL_FUNC RasterPos2iv, 67, 4
|
||||
USE_GL_FUNC RasterPos2s, 68, 8
|
||||
USE_GL_FUNC RasterPos2sv, 69, 4
|
||||
USE_GL_FUNC RasterPos3d, 70, 24
|
||||
USE_GL_FUNC RasterPos3dv, 71, 4
|
||||
USE_GL_FUNC RasterPos3f, 72, 12
|
||||
USE_GL_FUNC RasterPos3fv, 73, 4
|
||||
USE_GL_FUNC RasterPos3i, 74, 12
|
||||
USE_GL_FUNC RasterPos3iv, 75, 4
|
||||
USE_GL_FUNC RasterPos3s, 76, 12
|
||||
USE_GL_FUNC RasterPos3sv, 77, 4
|
||||
USE_GL_FUNC RasterPos4d, 78, 32
|
||||
USE_GL_FUNC RasterPos4dv, 79, 4
|
||||
USE_GL_FUNC RasterPos4f, 80, 16
|
||||
USE_GL_FUNC RasterPos4fv, 81, 4
|
||||
USE_GL_FUNC RasterPos4i, 82, 16
|
||||
USE_GL_FUNC RasterPos4iv, 83, 4
|
||||
USE_GL_FUNC RasterPos4s, 84, 16
|
||||
USE_GL_FUNC RasterPos4sv, 85, 4
|
||||
USE_GL_FUNC ReadBuffer, 254, 4
|
||||
USE_GL_FUNC ReadPixels, 256, 28
|
||||
USE_GL_FUNC Rectd, 86, 32
|
||||
USE_GL_FUNC Rectdv, 87, 8
|
||||
USE_GL_FUNC Rectf, 88, 16
|
||||
USE_GL_FUNC Rectfv, 89, 8
|
||||
USE_GL_FUNC Recti, 90, 16
|
||||
USE_GL_FUNC Rectiv, 91, 8
|
||||
USE_GL_FUNC Rects, 92, 16
|
||||
USE_GL_FUNC Rectsv, 93, 8
|
||||
USE_GL_FUNC RenderMode, 196, 4
|
||||
USE_GL_FUNC Rotated, 299, 32
|
||||
USE_GL_FUNC Rotatef, 300, 16
|
||||
USE_GL_FUNC Scaled, 301, 24
|
||||
USE_GL_FUNC Scalef, 302, 12
|
||||
USE_GL_FUNC Scissor, 176, 16
|
||||
USE_GL_FUNC SelectBuffer, 195, 8
|
||||
USE_GL_FUNC ShadeModel, 177, 4
|
||||
USE_GL_FUNC StencilFunc, 243, 12
|
||||
USE_GL_FUNC StencilMask, 209, 4
|
||||
USE_GL_FUNC StencilOp, 244, 12
|
||||
USE_GL_FUNC TexCoord1d, 94, 8
|
||||
USE_GL_FUNC TexCoord1dv, 95, 4
|
||||
USE_GL_FUNC TexCoord1f, 96, 4
|
||||
USE_GL_FUNC TexCoord1fv, 97, 4
|
||||
USE_GL_FUNC TexCoord1i, 98, 4
|
||||
USE_GL_FUNC TexCoord1iv, 99, 4
|
||||
USE_GL_FUNC TexCoord1s, 100, 4
|
||||
USE_GL_FUNC TexCoord1sv, 101, 4
|
||||
USE_GL_FUNC TexCoord2d, 102, 16
|
||||
USE_GL_FUNC TexCoord2dv, 103, 4
|
||||
USE_GL_FUNC TexCoord2f, 104, 8
|
||||
USE_GL_FUNC TexCoord2fv, 105, 4
|
||||
USE_GL_FUNC TexCoord2i, 106, 8
|
||||
USE_GL_FUNC TexCoord2iv, 107, 4
|
||||
USE_GL_FUNC TexCoord2s, 108, 8
|
||||
USE_GL_FUNC TexCoord2sv, 109, 4
|
||||
USE_GL_FUNC TexCoord3d, 110, 24
|
||||
USE_GL_FUNC TexCoord3dv, 111, 4
|
||||
USE_GL_FUNC TexCoord3f, 112, 12
|
||||
USE_GL_FUNC TexCoord3fv, 113, 4
|
||||
USE_GL_FUNC TexCoord3i, 114, 12
|
||||
USE_GL_FUNC TexCoord3iv, 115, 4
|
||||
USE_GL_FUNC TexCoord3s, 116, 12
|
||||
USE_GL_FUNC TexCoord3sv, 117, 4
|
||||
USE_GL_FUNC TexCoord4d, 118, 32
|
||||
USE_GL_FUNC TexCoord4dv, 119, 4
|
||||
USE_GL_FUNC TexCoord4f, 120, 16
|
||||
USE_GL_FUNC TexCoord4fv, 121, 4
|
||||
USE_GL_FUNC TexCoord4i, 122, 16
|
||||
USE_GL_FUNC TexCoord4iv, 123, 4
|
||||
USE_GL_FUNC TexCoord4s, 124, 16
|
||||
USE_GL_FUNC TexCoord4sv, 125, 4
|
||||
USE_GL_FUNC TexCoordPointer, 320, 16
|
||||
USE_GL_FUNC TexEnvf, 184, 12
|
||||
USE_GL_FUNC TexEnvfv, 185, 12
|
||||
USE_GL_FUNC TexEnvi, 186, 12
|
||||
USE_GL_FUNC TexEnviv, 187, 12
|
||||
USE_GL_FUNC TexGend, 188, 16
|
||||
USE_GL_FUNC TexGendv, 189, 12
|
||||
USE_GL_FUNC TexGenf, 190, 12
|
||||
USE_GL_FUNC TexGenfv, 191, 12
|
||||
USE_GL_FUNC TexGeni, 192, 12
|
||||
USE_GL_FUNC TexGeniv, 193, 12
|
||||
USE_GL_FUNC TexImage1D, 182, 32
|
||||
USE_GL_FUNC TexImage2D, 183, 36
|
||||
USE_GL_FUNC TexParameterf, 178, 12
|
||||
USE_GL_FUNC TexParameterfv, 179, 12
|
||||
USE_GL_FUNC TexParameteri, 180, 12
|
||||
USE_GL_FUNC TexParameteriv, 181, 12
|
||||
USE_GL_FUNC TexSubImage1D, 332, 28
|
||||
USE_GL_FUNC TexSubImage2D, 333, 36
|
||||
USE_GL_FUNC Translated, 303, 24
|
||||
USE_GL_FUNC Translatef, 304, 12
|
||||
USE_GL_FUNC Vertex2d, 126, 16
|
||||
USE_GL_FUNC Vertex2dv, 127, 4
|
||||
USE_GL_FUNC Vertex2f, 128, 8
|
||||
USE_GL_FUNC Vertex2fv, 129, 4
|
||||
USE_GL_FUNC Vertex2i, 130, 8
|
||||
USE_GL_FUNC Vertex2iv, 131, 4
|
||||
USE_GL_FUNC Vertex2s, 132, 8
|
||||
USE_GL_FUNC Vertex2sv, 133, 4
|
||||
USE_GL_FUNC Vertex3d, 134, 24
|
||||
USE_GL_FUNC Vertex3dv, 135, 4
|
||||
USE_GL_FUNC Vertex3f, 136, 12
|
||||
USE_GL_FUNC Vertex3fv, 137, 4
|
||||
USE_GL_FUNC Vertex3i, 138, 12
|
||||
USE_GL_FUNC Vertex3iv, 139, 4
|
||||
USE_GL_FUNC Vertex3s, 140, 12
|
||||
USE_GL_FUNC Vertex3sv, 141, 4
|
||||
USE_GL_FUNC Vertex4d, 142, 32
|
||||
USE_GL_FUNC Vertex4dv, 143, 4
|
||||
USE_GL_FUNC Vertex4f, 144, 16
|
||||
USE_GL_FUNC Vertex4fv, 145, 4
|
||||
USE_GL_FUNC Vertex4i, 146, 16
|
||||
USE_GL_FUNC Vertex4iv, 147, 4
|
||||
USE_GL_FUNC Vertex4s, 148, 16
|
||||
USE_GL_FUNC Vertex4sv, 149, 4
|
||||
USE_GL_FUNC VertexPointer, 321, 16
|
||||
USE_GL_FUNC Viewport, 305, 16
|
||||
|
||||
END
|
349
dll/opengl/opengl32/glfuncs.h
Normal file
349
dll/opengl/opengl32/glfuncs.h
Normal file
|
@ -0,0 +1,349 @@
|
|||
/*
|
||||
* List of all GL functions exported by opengl32.dll.
|
||||
* Usage: USE_GL_FUNC(name, return type, prototype arguments, call arguments, icd offset, x86 stack size)
|
||||
*/
|
||||
|
||||
#ifndef USE_GL_FUNC_RET
|
||||
#define USE_GL_FUNC_RET(name, ret_type, proto_args, call_args, offset, stack) \
|
||||
USE_GL_FUNC(name, proto_args, call_args, offset, stack)
|
||||
#endif
|
||||
|
||||
USE_GL_FUNC(Accum, (GLenum op, GLfloat value), (op,value), 213, 8)
|
||||
USE_GL_FUNC(AlphaFunc, (GLenum func, GLclampf ref), (func,ref), 240, 8)
|
||||
USE_GL_FUNC_RET(AreTexturesResident, GLboolean, (GLsizei n, const GLuint *textures, GLboolean *residences), (n,textures,residences), 322, 12)
|
||||
USE_GL_FUNC(ArrayElement, (GLint i), (i), 306, 4)
|
||||
USE_GL_FUNC(Begin, (GLenum mode), (mode), 7, 4)
|
||||
USE_GL_FUNC(BindTexture, (GLenum target, GLuint texture), (target,texture), 307, 8)
|
||||
USE_GL_FUNC(Bitmap, (GLsizei width, GLsizei height, GLfloat xorig, GLfloat yorig, GLfloat xmove, GLfloat ymove, const GLubyte *bitmap), (width,height,xorig,yorig,xmove,ymove,bitmap), 8, 28)
|
||||
USE_GL_FUNC(BlendFunc, (GLenum sfactor, GLenum dfactor), (sfactor,dfactor), 241, 8)
|
||||
USE_GL_FUNC(CallList, (GLuint list), (list), 2, 4)
|
||||
USE_GL_FUNC(CallLists, (GLsizei n, GLenum type, const GLvoid *lists), (n,type,lists), 3, 12)
|
||||
USE_GL_FUNC(Clear, (GLbitfield mask), (mask), 203, 4)
|
||||
USE_GL_FUNC(ClearAccum, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha), (red,green,blue,alpha), 204, 16)
|
||||
USE_GL_FUNC(ClearColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha), (red,green,blue,alpha), 206, 16)
|
||||
USE_GL_FUNC(ClearDepth, (GLclampd depth), (depth), 208, 8)
|
||||
USE_GL_FUNC(ClearIndex, (GLfloat c), (c), 205, 4)
|
||||
USE_GL_FUNC(ClearStencil, (GLint s), (s), 207, 4)
|
||||
USE_GL_FUNC(ClipPlane, (GLenum plane, const GLdouble *equation), (plane,equation), 150, 8)
|
||||
USE_GL_FUNC(Color3b, (GLbyte red, GLbyte green, GLbyte blue), (red,green,blue), 9, 12)
|
||||
USE_GL_FUNC(Color3bv, (const GLbyte *v), (v), 10, 4)
|
||||
USE_GL_FUNC(Color3d, (GLdouble red, GLdouble green, GLdouble blue), (red,green,blue), 11, 24)
|
||||
USE_GL_FUNC(Color3dv, (const GLdouble *v), (v), 12, 4)
|
||||
USE_GL_FUNC(Color3f, (GLfloat red, GLfloat green, GLfloat blue), (red,green,blue), 13, 12)
|
||||
USE_GL_FUNC(Color3fv, (const GLfloat *v), (v), 14, 4)
|
||||
USE_GL_FUNC(Color3i, (GLint red, GLint green, GLint blue), (red,green,blue), 15, 12)
|
||||
USE_GL_FUNC(Color3iv, (const GLint *v), (v), 16, 4)
|
||||
USE_GL_FUNC(Color3s, (GLshort red, GLshort green, GLshort blue), (red,green,blue), 17, 12)
|
||||
USE_GL_FUNC(Color3sv, (const GLshort *v), (v), 18, 4)
|
||||
USE_GL_FUNC(Color3ub, (GLubyte red, GLubyte green, GLubyte blue), (red,green,blue), 19, 12)
|
||||
USE_GL_FUNC(Color3ubv, (const GLubyte *v), (v), 20, 4)
|
||||
USE_GL_FUNC(Color3ui, (GLuint red, GLuint green, GLuint blue), (red,green,blue), 21, 12)
|
||||
USE_GL_FUNC(Color3uiv, (const GLuint *v), (v), 22, 4)
|
||||
USE_GL_FUNC(Color3us, (GLushort red, GLushort green, GLushort blue), (red,green,blue), 23, 12)
|
||||
USE_GL_FUNC(Color3usv, (const GLushort *v), (v), 24, 4)
|
||||
USE_GL_FUNC(Color4b, (GLbyte red, GLbyte green, GLbyte blue, GLbyte alpha), (red,green,blue,alpha), 25, 16)
|
||||
USE_GL_FUNC(Color4bv, (const GLbyte *v), (v), 26, 4)
|
||||
USE_GL_FUNC(Color4d, (GLdouble red, GLdouble green, GLdouble blue, GLdouble alpha), (red,green,blue,alpha), 27, 32)
|
||||
USE_GL_FUNC(Color4dv, (const GLdouble *v), (v), 28, 4)
|
||||
USE_GL_FUNC(Color4f, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha), (red,green,blue,alpha), 29, 16)
|
||||
USE_GL_FUNC(Color4fv, (const GLfloat *v), (v), 30, 4)
|
||||
USE_GL_FUNC(Color4i, (GLint red, GLint green, GLint blue, GLint alpha), (red,green,blue,alpha), 31, 16)
|
||||
USE_GL_FUNC(Color4iv, (const GLint *v), (v), 32, 4)
|
||||
USE_GL_FUNC(Color4s, (GLshort red, GLshort green, GLshort blue, GLshort alpha), (red,green,blue,alpha), 33, 16)
|
||||
USE_GL_FUNC(Color4sv, (const GLshort *v), (v), 34, 4)
|
||||
USE_GL_FUNC(Color4ub, (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha), (red,green,blue,alpha), 35, 16)
|
||||
USE_GL_FUNC(Color4ubv, (const GLubyte *v), (v), 36, 4)
|
||||
USE_GL_FUNC(Color4ui, (GLuint red, GLuint green, GLuint blue, GLuint alpha), (red,green,blue,alpha), 37, 16)
|
||||
USE_GL_FUNC(Color4uiv, (const GLuint *v), (v), 38, 4)
|
||||
USE_GL_FUNC(Color4us, (GLushort red, GLushort green, GLushort blue, GLushort alpha), (red,green,blue,alpha), 39, 16)
|
||||
USE_GL_FUNC(Color4usv, (const GLushort *v), (v), 40, 4)
|
||||
USE_GL_FUNC(ColorMask, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha), (red,green,blue,alpha), 210, 16)
|
||||
USE_GL_FUNC(ColorMaterial, (GLenum face, GLenum mode), (face,mode), 151, 8)
|
||||
USE_GL_FUNC(ColorPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer), (size,type,stride,pointer), 308, 16)
|
||||
USE_GL_FUNC(CopyPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum type), (x,y,width,height,type), 255, 20)
|
||||
USE_GL_FUNC(CopyTexImage1D, (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLint border), (target,level,internalformat,x,y,width,border), 323, 28)
|
||||
USE_GL_FUNC(CopyTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border), (target,level,internalformat,x,y,width,height,border), 324, 32)
|
||||
USE_GL_FUNC(CopyTexSubImage1D, (GLenum target, GLint level, GLint xoffset, GLint x, GLint y, GLsizei width), (target,level,xoffset,x,y,width), 325, 24)
|
||||
USE_GL_FUNC(CopyTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height), (target,level,xoffset,yoffset,x,y,width,height), 326, 32)
|
||||
USE_GL_FUNC(CullFace, (GLenum mode), (mode), 152, 4)
|
||||
USE_GL_FUNC(DeleteLists, (GLuint list, GLsizei range), (list,range), 4, 8)
|
||||
USE_GL_FUNC(DeleteTextures, (GLsizei n, const GLuint *textures), (n,textures), 327, 8)
|
||||
USE_GL_FUNC(DepthFunc, (GLenum func), (func), 245, 4)
|
||||
USE_GL_FUNC(DepthMask, (GLboolean flag), (flag), 211, 4)
|
||||
USE_GL_FUNC(DepthRange, (GLclampd zNear, GLclampd zFar), (zNear,zFar), 288, 16)
|
||||
USE_GL_FUNC(Disable, (GLenum cap), (cap), 214, 4)
|
||||
USE_GL_FUNC(DisableClientState, (GLenum array), (array), 309, 4)
|
||||
USE_GL_FUNC(DrawArrays, (GLenum mode, GLint first, GLsizei count), (mode,first,count), 310, 12)
|
||||
USE_GL_FUNC(DrawBuffer, (GLenum mode), (mode), 202, 4)
|
||||
USE_GL_FUNC(DrawElements, (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices), (mode,count,type,indices), 311, 16)
|
||||
USE_GL_FUNC(DrawPixels, (GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels), (width,height,format,type,pixels), 257, 20)
|
||||
USE_GL_FUNC(EdgeFlag, (GLboolean flag), (flag), 41, 4)
|
||||
USE_GL_FUNC(EdgeFlagPointer, (GLsizei stride, const GLvoid *pointer), (stride,pointer), 312, 8)
|
||||
USE_GL_FUNC(EdgeFlagv, (const GLboolean *flag), (flag), 42, 4)
|
||||
USE_GL_FUNC(Enable, (GLenum cap), (cap), 215, 4)
|
||||
USE_GL_FUNC(EnableClientState, (GLenum array), (array), 313, 4)
|
||||
USE_GL_FUNC(End, (void), (), 43, 0)
|
||||
USE_GL_FUNC(EndList, (void), (), 1, 0)
|
||||
USE_GL_FUNC(EvalCoord1d, (GLdouble u), (u), 228, 8)
|
||||
USE_GL_FUNC(EvalCoord1dv, (const GLdouble *u), (u), 229, 4)
|
||||
USE_GL_FUNC(EvalCoord1f, (GLfloat u), (u), 230, 4)
|
||||
USE_GL_FUNC(EvalCoord1fv, (const GLfloat *u), (u), 231, 4)
|
||||
USE_GL_FUNC(EvalCoord2d, (GLdouble u, GLdouble v), (u,v), 232, 16)
|
||||
USE_GL_FUNC(EvalCoord2dv, (const GLdouble *u), (u), 233, 4)
|
||||
USE_GL_FUNC(EvalCoord2f, (GLfloat u, GLfloat v), (u,v), 234, 8)
|
||||
USE_GL_FUNC(EvalCoord2fv, (const GLfloat *u), (u), 235, 4)
|
||||
USE_GL_FUNC(EvalMesh1, (GLenum mode, GLint i1, GLint i2), (mode,i1,i2), 236, 12)
|
||||
USE_GL_FUNC(EvalMesh2, (GLenum mode, GLint i1, GLint i2, GLint j1, GLint j2), (mode,i1,i2,j1,j2), 238, 20)
|
||||
USE_GL_FUNC(EvalPoint1, (GLint i), (i), 237, 4)
|
||||
USE_GL_FUNC(EvalPoint2, (GLint i, GLint j), (i,j), 239, 8)
|
||||
USE_GL_FUNC(FeedbackBuffer, (GLsizei size, GLenum type, GLfloat *buffer), (size,type,buffer), 194, 12)
|
||||
USE_GL_FUNC(Finish, (void), (), 216, 0)
|
||||
USE_GL_FUNC(Flush, (void), (), 217, 0)
|
||||
USE_GL_FUNC(Fogf, (GLenum pname, GLfloat param), (pname,param), 153, 8)
|
||||
USE_GL_FUNC(Fogfv, (GLenum pname, const GLfloat *params), (pname,params), 154, 8)
|
||||
USE_GL_FUNC(Fogi, (GLenum pname, GLint param), (pname,param), 155, 8)
|
||||
USE_GL_FUNC(Fogiv, (GLenum pname, const GLint *params), (pname,params), 156, 8)
|
||||
USE_GL_FUNC(FrontFace, (GLenum mode), (mode), 157, 4)
|
||||
USE_GL_FUNC(Frustum, (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar), (left,right,bottom,top,zNear,zFar), 289, 48)
|
||||
USE_GL_FUNC_RET(GenLists, GLuint, (GLsizei range), (range), 5, 4)
|
||||
USE_GL_FUNC(GenTextures, (GLsizei n, GLuint *textures), (n,textures), 328, 8)
|
||||
USE_GL_FUNC(GetBooleanv, (GLenum pname, GLboolean *params), (pname,params), 258, 8)
|
||||
USE_GL_FUNC(GetClipPlane, (GLenum plane, GLdouble *equation), (plane,equation), 259, 8)
|
||||
USE_GL_FUNC(GetDoublev, (GLenum pname, GLdouble *params), (pname,params), 260, 8)
|
||||
USE_GL_FUNC_RET(GetError, GLenum, (void), (), 261, 0)
|
||||
USE_GL_FUNC(GetFloatv, (GLenum pname, GLfloat *params), (pname,params), 262, 8)
|
||||
USE_GL_FUNC(GetIntegerv, (GLenum pname, GLint *params), (pname,params), 263, 8)
|
||||
USE_GL_FUNC(GetLightfv, (GLenum light, GLenum pname, GLfloat *params), (light,pname,params), 264, 12)
|
||||
USE_GL_FUNC(GetLightiv, (GLenum light, GLenum pname, GLint *params), (light,pname,params), 265, 12)
|
||||
USE_GL_FUNC(GetMapdv, (GLenum target, GLenum query, GLdouble *v), (target,query,v), 266, 12)
|
||||
USE_GL_FUNC(GetMapfv, (GLenum target, GLenum query, GLfloat *v), (target,query,v), 267, 12)
|
||||
USE_GL_FUNC(GetMapiv, (GLenum target, GLenum query, GLint *v), (target,query,v), 268, 12)
|
||||
USE_GL_FUNC(GetMaterialfv, (GLenum face, GLenum pname, GLfloat *params), (face,pname,params), 269, 12)
|
||||
USE_GL_FUNC(GetMaterialiv, (GLenum face, GLenum pname, GLint *params), (face,pname,params), 270, 12)
|
||||
USE_GL_FUNC(GetPixelMapfv, (GLenum map, GLfloat *values), (map,values), 271, 8)
|
||||
USE_GL_FUNC(GetPixelMapuiv, (GLenum map, GLuint *values), (map,values), 272, 8)
|
||||
USE_GL_FUNC(GetPixelMapusv, (GLenum map, GLushort *values), (map,values), 273, 8)
|
||||
USE_GL_FUNC(GetPointerv, (GLenum pname, GLvoid* *params), (pname,params), 329, 8)
|
||||
USE_GL_FUNC(GetPolygonStipple, (GLubyte *mask), (mask), 274, 4)
|
||||
USE_GL_FUNC_RET(GetString, const GLubyte *, (GLenum name), (name), 275, 4)
|
||||
USE_GL_FUNC(GetTexEnvfv, (GLenum target, GLenum pname, GLfloat *params), (target,pname,params), 276, 12)
|
||||
USE_GL_FUNC(GetTexEnviv, (GLenum target, GLenum pname, GLint *params), (target,pname,params), 277, 12)
|
||||
USE_GL_FUNC(GetTexGendv, (GLenum coord, GLenum pname, GLdouble *params), (coord,pname,params), 278, 12)
|
||||
USE_GL_FUNC(GetTexGenfv, (GLenum coord, GLenum pname, GLfloat *params), (coord,pname,params), 279, 12)
|
||||
USE_GL_FUNC(GetTexGeniv, (GLenum coord, GLenum pname, GLint *params), (coord,pname,params), 280, 12)
|
||||
USE_GL_FUNC(GetTexImage, (GLenum target, GLint level, GLenum format, GLenum type, GLvoid *pixels), (target,level,format,type,pixels), 281, 20)
|
||||
USE_GL_FUNC(GetTexLevelParameterfv, (GLenum target, GLint level, GLenum pname, GLfloat *params), (target,level,pname,params), 284, 16)
|
||||
USE_GL_FUNC(GetTexLevelParameteriv, (GLenum target, GLint level, GLenum pname, GLint *params), (target,level,pname,params), 285, 16)
|
||||
USE_GL_FUNC(GetTexParameterfv, (GLenum target, GLenum pname, GLfloat *params), (target,pname,params), 282, 12)
|
||||
USE_GL_FUNC(GetTexParameteriv, (GLenum target, GLenum pname, GLint *params), (target,pname,params), 283, 12)
|
||||
USE_GL_FUNC(Hint, (GLenum target, GLenum mode), (target,mode), 158, 8)
|
||||
USE_GL_FUNC(IndexMask, (GLuint mask), (mask), 212, 4)
|
||||
USE_GL_FUNC(IndexPointer, (GLenum type, GLsizei stride, const GLvoid *pointer), (type,stride,pointer), 314, 12)
|
||||
USE_GL_FUNC(Indexd, (GLdouble c), (c), 44, 8)
|
||||
USE_GL_FUNC(Indexdv, (const GLdouble *c), (c), 45, 4)
|
||||
USE_GL_FUNC(Indexf, (GLfloat c), (c), 46, 4)
|
||||
USE_GL_FUNC(Indexfv, (const GLfloat *c), (c), 47, 4)
|
||||
USE_GL_FUNC(Indexi, (GLint c), (c), 48, 4)
|
||||
USE_GL_FUNC(Indexiv, (const GLint *c), (c), 49, 4)
|
||||
USE_GL_FUNC(Indexs, (GLshort c), (c), 50, 4)
|
||||
USE_GL_FUNC(Indexsv, (const GLshort *c), (c), 51, 4)
|
||||
USE_GL_FUNC(Indexub, (GLubyte c), (c), 315, 4)
|
||||
USE_GL_FUNC(Indexubv, (const GLubyte *c), (c), 316, 4)
|
||||
USE_GL_FUNC(InitNames, (void), (), 197, 0)
|
||||
USE_GL_FUNC(InterleavedArrays, (GLenum format, GLsizei stride, const GLvoid *pointer), (format,stride,pointer), 317, 12)
|
||||
USE_GL_FUNC_RET(IsEnabled, GLboolean, (GLenum cap), (cap), 286, 4)
|
||||
USE_GL_FUNC_RET(IsList, GLboolean, (GLuint list), (list), 287, 4)
|
||||
USE_GL_FUNC_RET(IsTexture, GLboolean, (GLuint texture), (texture), 330, 4)
|
||||
USE_GL_FUNC(LightModelf, (GLenum pname, GLfloat param), (pname,param), 163, 8)
|
||||
USE_GL_FUNC(LightModelfv, (GLenum pname, const GLfloat *params), (pname,params), 164, 8)
|
||||
USE_GL_FUNC(LightModeli, (GLenum pname, GLint param), (pname,param), 165, 8)
|
||||
USE_GL_FUNC(LightModeliv, (GLenum pname, const GLint *params), (pname,params), 166, 8)
|
||||
USE_GL_FUNC(Lightf, (GLenum light, GLenum pname, GLfloat param), (light,pname,param), 159, 12)
|
||||
USE_GL_FUNC(Lightfv, (GLenum light, GLenum pname, const GLfloat *params), (light,pname,params), 160, 12)
|
||||
USE_GL_FUNC(Lighti, (GLenum light, GLenum pname, GLint param), (light,pname,param), 161, 12)
|
||||
USE_GL_FUNC(Lightiv, (GLenum light, GLenum pname, const GLint *params), (light,pname,params), 162, 12)
|
||||
USE_GL_FUNC(LineStipple, (GLint factor, GLushort pattern), (factor,pattern), 167, 8)
|
||||
USE_GL_FUNC(LineWidth, (GLfloat width), (width), 168, 4)
|
||||
USE_GL_FUNC(ListBase, (GLuint base), (base), 6, 4)
|
||||
USE_GL_FUNC(LoadIdentity, (void), (), 290, 0)
|
||||
USE_GL_FUNC(LoadMatrixd, (const GLdouble *m), (m), 292, 4)
|
||||
USE_GL_FUNC(LoadMatrixf, (const GLfloat *m), (m), 291, 4)
|
||||
USE_GL_FUNC(LoadName, (GLuint name), (name), 198, 4)
|
||||
USE_GL_FUNC(LogicOp, (GLenum opcode), (opcode), 242, 4)
|
||||
USE_GL_FUNC(Map1d, (GLenum target, GLdouble u1, GLdouble u2, GLint stride, GLint order, const GLdouble *points), (target,u1,u2,stride,order,points), 220, 32)
|
||||
USE_GL_FUNC(Map1f, (GLenum target, GLfloat u1, GLfloat u2, GLint stride, GLint order, const GLfloat *points), (target,u1,u2,stride,order,points), 221, 24)
|
||||
USE_GL_FUNC(Map2d, (GLenum target, GLdouble u1, GLdouble u2, GLint ustride, GLint uorder, GLdouble v1, GLdouble v2, GLint vstride, GLint vorder, const GLdouble *points), (target,u1,u2,ustride,uorder,v1,v2,vstride,vorder,points), 222, 56)
|
||||
USE_GL_FUNC(Map2f, (GLenum target, GLfloat u1, GLfloat u2, GLint ustride, GLint uorder, GLfloat v1, GLfloat v2, GLint vstride, GLint vorder, const GLfloat *points), (target,u1,u2,ustride,uorder,v1,v2,vstride,vorder,points), 223, 40)
|
||||
USE_GL_FUNC(MapGrid1d, (GLint un, GLdouble u1, GLdouble u2), (un,u1,u2), 224, 20)
|
||||
USE_GL_FUNC(MapGrid1f, (GLint un, GLfloat u1, GLfloat u2), (un,u1,u2), 225, 12)
|
||||
USE_GL_FUNC(MapGrid2d, (GLint un, GLdouble u1, GLdouble u2, GLint vn, GLdouble v1, GLdouble v2), (un,u1,u2,vn,v1,v2), 226, 40)
|
||||
USE_GL_FUNC(MapGrid2f, (GLint un, GLfloat u1, GLfloat u2, GLint vn, GLfloat v1, GLfloat v2), (un,u1,u2,vn,v1,v2), 227, 24)
|
||||
USE_GL_FUNC(Materialf, (GLenum face, GLenum pname, GLfloat param), (face,pname,param), 169, 12)
|
||||
USE_GL_FUNC(Materialfv, (GLenum face, GLenum pname, const GLfloat *params), (face,pname,params), 170, 12)
|
||||
USE_GL_FUNC(Materiali, (GLenum face, GLenum pname, GLint param), (face,pname,param), 171, 12)
|
||||
USE_GL_FUNC(Materialiv, (GLenum face, GLenum pname, const GLint *params), (face,pname,params), 172, 12)
|
||||
USE_GL_FUNC(MatrixMode, (GLenum mode), (mode), 293, 4)
|
||||
USE_GL_FUNC(MultMatrixd, (const GLdouble *m), (m), 295, 4)
|
||||
USE_GL_FUNC(MultMatrixf, (const GLfloat *m), (m), 294, 4)
|
||||
USE_GL_FUNC(NewList, (GLuint list, GLenum mode), (list,mode), 0, 8)
|
||||
USE_GL_FUNC(Normal3b, (GLbyte nx, GLbyte ny, GLbyte nz), (nx,ny,nz), 52, 12)
|
||||
USE_GL_FUNC(Normal3bv, (const GLbyte *v), (v), 53, 4)
|
||||
USE_GL_FUNC(Normal3d, (GLdouble nx, GLdouble ny, GLdouble nz), (nx,ny,nz), 54, 24)
|
||||
USE_GL_FUNC(Normal3dv, (const GLdouble *v), (v), 55, 4)
|
||||
USE_GL_FUNC(Normal3f, (GLfloat nx, GLfloat ny, GLfloat nz), (nx,ny,nz), 56, 12)
|
||||
USE_GL_FUNC(Normal3fv, (const GLfloat *v), (v), 57, 4)
|
||||
USE_GL_FUNC(Normal3i, (GLint nx, GLint ny, GLint nz), (nx,ny,nz), 58, 12)
|
||||
USE_GL_FUNC(Normal3iv, (const GLint *v), (v), 59, 4)
|
||||
USE_GL_FUNC(Normal3s, (GLshort nx, GLshort ny, GLshort nz), (nx,ny,nz), 60, 12)
|
||||
USE_GL_FUNC(Normal3sv, (const GLshort *v), (v), 61, 4)
|
||||
USE_GL_FUNC(NormalPointer, (GLenum type, GLsizei stride, const GLvoid *pointer), (type,stride,pointer), 318, 12)
|
||||
USE_GL_FUNC(Ortho, (GLdouble left, GLdouble right, GLdouble bottom, GLdouble top, GLdouble zNear, GLdouble zFar), (left,right,bottom,top,zNear,zFar), 296, 48)
|
||||
USE_GL_FUNC(PassThrough, (GLfloat token), (token), 199, 4)
|
||||
USE_GL_FUNC(PixelMapfv, (GLenum map, GLint mapsize, const GLfloat *values), (map,mapsize,values), 251, 12)
|
||||
USE_GL_FUNC(PixelMapuiv, (GLenum map, GLint mapsize, const GLuint *values), (map,mapsize,values), 252, 12)
|
||||
USE_GL_FUNC(PixelMapusv, (GLenum map, GLint mapsize, const GLushort *values), (map,mapsize,values), 253, 12)
|
||||
USE_GL_FUNC(PixelStoref, (GLenum pname, GLfloat param), (pname,param), 249, 8)
|
||||
USE_GL_FUNC(PixelStorei, (GLenum pname, GLint param), (pname,param), 250, 8)
|
||||
USE_GL_FUNC(PixelTransferf, (GLenum pname, GLfloat param), (pname,param), 247, 8)
|
||||
USE_GL_FUNC(PixelTransferi, (GLenum pname, GLint param), (pname,param), 248, 8)
|
||||
USE_GL_FUNC(PixelZoom, (GLfloat xfactor, GLfloat yfactor), (xfactor,yfactor), 246, 8)
|
||||
USE_GL_FUNC(PointSize, (GLfloat size), (size), 173, 4)
|
||||
USE_GL_FUNC(PolygonMode, (GLenum face, GLenum mode), (face,mode), 174, 8)
|
||||
USE_GL_FUNC(PolygonOffset, (GLfloat factor, GLfloat units), (factor,units), 319, 8)
|
||||
USE_GL_FUNC(PolygonStipple, (const GLubyte *mask), (mask), 175, 4)
|
||||
USE_GL_FUNC(PopAttrib, (void), (), 218, 0)
|
||||
USE_GL_FUNC(PopClientAttrib, (void), (), 334, 0)
|
||||
USE_GL_FUNC(PopMatrix, (void), (), 297, 0)
|
||||
USE_GL_FUNC(PopName, (void), (), 200, 0)
|
||||
USE_GL_FUNC(PrioritizeTextures, (GLsizei n, const GLuint *textures, const GLclampf *priorities), (n,textures,priorities), 331, 12)
|
||||
USE_GL_FUNC(PushAttrib, (GLbitfield mask), (mask), 219, 4)
|
||||
USE_GL_FUNC(PushClientAttrib, (GLbitfield mask), (mask), 335, 4)
|
||||
USE_GL_FUNC(PushMatrix, (void), (), 298, 0)
|
||||
USE_GL_FUNC(PushName, (GLuint name), (name), 201, 4)
|
||||
USE_GL_FUNC(RasterPos2d, (GLdouble x, GLdouble y), (x,y), 62, 16)
|
||||
USE_GL_FUNC(RasterPos2dv, (const GLdouble *v), (v), 63, 4)
|
||||
USE_GL_FUNC(RasterPos2f, (GLfloat x, GLfloat y), (x,y), 64, 8)
|
||||
USE_GL_FUNC(RasterPos2fv, (const GLfloat *v), (v), 65, 4)
|
||||
USE_GL_FUNC(RasterPos2i, (GLint x, GLint y), (x,y), 66, 8)
|
||||
USE_GL_FUNC(RasterPos2iv, (const GLint *v), (v), 67, 4)
|
||||
USE_GL_FUNC(RasterPos2s, (GLshort x, GLshort y), (x,y), 68, 8)
|
||||
USE_GL_FUNC(RasterPos2sv, (const GLshort *v), (v), 69, 4)
|
||||
USE_GL_FUNC(RasterPos3d, (GLdouble x, GLdouble y, GLdouble z), (x,y,z), 70, 24)
|
||||
USE_GL_FUNC(RasterPos3dv, (const GLdouble *v), (v), 71, 4)
|
||||
USE_GL_FUNC(RasterPos3f, (GLfloat x, GLfloat y, GLfloat z), (x,y,z), 72, 12)
|
||||
USE_GL_FUNC(RasterPos3fv, (const GLfloat *v), (v), 73, 4)
|
||||
USE_GL_FUNC(RasterPos3i, (GLint x, GLint y, GLint z), (x,y,z), 74, 12)
|
||||
USE_GL_FUNC(RasterPos3iv, (const GLint *v), (v), 75, 4)
|
||||
USE_GL_FUNC(RasterPos3s, (GLshort x, GLshort y, GLshort z), (x,y,z), 76, 12)
|
||||
USE_GL_FUNC(RasterPos3sv, (const GLshort *v), (v), 77, 4)
|
||||
USE_GL_FUNC(RasterPos4d, (GLdouble x, GLdouble y, GLdouble z, GLdouble w), (x,y,z,w), 78, 32)
|
||||
USE_GL_FUNC(RasterPos4dv, (const GLdouble *v), (v), 79, 4)
|
||||
USE_GL_FUNC(RasterPos4f, (GLfloat x, GLfloat y, GLfloat z, GLfloat w), (x,y,z,w), 80, 16)
|
||||
USE_GL_FUNC(RasterPos4fv, (const GLfloat *v), (v), 81, 4)
|
||||
USE_GL_FUNC(RasterPos4i, (GLint x, GLint y, GLint z, GLint w), (x,y,z,w), 82, 16)
|
||||
USE_GL_FUNC(RasterPos4iv, (const GLint *v), (v), 83, 4)
|
||||
USE_GL_FUNC(RasterPos4s, (GLshort x, GLshort y, GLshort z, GLshort w), (x,y,z,w), 84, 16)
|
||||
USE_GL_FUNC(RasterPos4sv, (const GLshort *v), (v), 85, 4)
|
||||
USE_GL_FUNC(ReadBuffer, (GLenum mode), (mode), 254, 4)
|
||||
USE_GL_FUNC(ReadPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels), (x,y,width,height,format,type,pixels), 256, 28)
|
||||
USE_GL_FUNC(Rectd, (GLdouble x1, GLdouble y1, GLdouble x2, GLdouble y2), (x1,y1,x2,y2), 86, 32)
|
||||
USE_GL_FUNC(Rectdv, (const GLdouble *v1, const GLdouble *v2), (v1,v2), 87, 8)
|
||||
USE_GL_FUNC(Rectf, (GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2), (x1,y1,x2,y2), 88, 16)
|
||||
USE_GL_FUNC(Rectfv, (const GLfloat *v1, const GLfloat *v2), (v1,v2), 89, 8)
|
||||
USE_GL_FUNC(Recti, (GLint x1, GLint y1, GLint x2, GLint y2), (x1,y1,x2,y2), 90, 16)
|
||||
USE_GL_FUNC(Rectiv, (const GLint *v1, const GLint *v2), (v1,v2), 91, 8)
|
||||
USE_GL_FUNC(Rects, (GLshort x1, GLshort y1, GLshort x2, GLshort y2), (x1,y1,x2,y2), 92, 16)
|
||||
USE_GL_FUNC(Rectsv, (const GLshort *v1, const GLshort *v2), (v1,v2), 93, 8)
|
||||
USE_GL_FUNC_RET(RenderMode, GLint, (GLenum mode), (mode), 196, 4)
|
||||
USE_GL_FUNC(Rotated, (GLdouble angle, GLdouble x, GLdouble y, GLdouble z), (angle,x,y,z), 299, 32)
|
||||
USE_GL_FUNC(Rotatef, (GLfloat angle, GLfloat x, GLfloat y, GLfloat z), (angle,x,y,z), 300, 16)
|
||||
USE_GL_FUNC(Scaled, (GLdouble x, GLdouble y, GLdouble z), (x,y,z), 301, 24)
|
||||
USE_GL_FUNC(Scalef, (GLfloat x, GLfloat y, GLfloat z), (x,y,z), 302, 12)
|
||||
USE_GL_FUNC(Scissor, (GLint x, GLint y, GLsizei width, GLsizei height), (x,y,width,height), 176, 16)
|
||||
USE_GL_FUNC(SelectBuffer, (GLsizei size, GLuint *buffer), (size,buffer), 195, 8)
|
||||
USE_GL_FUNC(ShadeModel, (GLenum mode), (mode), 177, 4)
|
||||
USE_GL_FUNC(StencilFunc, (GLenum func, GLint ref, GLuint mask), (func,ref,mask), 243, 12)
|
||||
USE_GL_FUNC(StencilMask, (GLuint mask), (mask), 209, 4)
|
||||
USE_GL_FUNC(StencilOp, (GLenum fail, GLenum zfail, GLenum zpass), (fail,zfail,zpass), 244, 12)
|
||||
USE_GL_FUNC(TexCoord1d, (GLdouble s), (s), 94, 8)
|
||||
USE_GL_FUNC(TexCoord1dv, (const GLdouble *v), (v), 95, 4)
|
||||
USE_GL_FUNC(TexCoord1f, (GLfloat s), (s), 96, 4)
|
||||
USE_GL_FUNC(TexCoord1fv, (const GLfloat *v), (v), 97, 4)
|
||||
USE_GL_FUNC(TexCoord1i, (GLint s), (s), 98, 4)
|
||||
USE_GL_FUNC(TexCoord1iv, (const GLint *v), (v), 99, 4)
|
||||
USE_GL_FUNC(TexCoord1s, (GLshort s), (s), 100, 4)
|
||||
USE_GL_FUNC(TexCoord1sv, (const GLshort *v), (v), 101, 4)
|
||||
USE_GL_FUNC(TexCoord2d, (GLdouble s, GLdouble t), (s,t), 102, 16)
|
||||
USE_GL_FUNC(TexCoord2dv, (const GLdouble *v), (v), 103, 4)
|
||||
USE_GL_FUNC(TexCoord2f, (GLfloat s, GLfloat t), (s,t), 104, 8)
|
||||
USE_GL_FUNC(TexCoord2fv, (const GLfloat *v), (v), 105, 4)
|
||||
USE_GL_FUNC(TexCoord2i, (GLint s, GLint t), (s,t), 106, 8)
|
||||
USE_GL_FUNC(TexCoord2iv, (const GLint *v), (v), 107, 4)
|
||||
USE_GL_FUNC(TexCoord2s, (GLshort s, GLshort t), (s,t), 108, 8)
|
||||
USE_GL_FUNC(TexCoord2sv, (const GLshort *v), (v), 109, 4)
|
||||
USE_GL_FUNC(TexCoord3d, (GLdouble s, GLdouble t, GLdouble r), (s,t,r), 110, 24)
|
||||
USE_GL_FUNC(TexCoord3dv, (const GLdouble *v), (v), 111, 4)
|
||||
USE_GL_FUNC(TexCoord3f, (GLfloat s, GLfloat t, GLfloat r), (s,t,r), 112, 12)
|
||||
USE_GL_FUNC(TexCoord3fv, (const GLfloat *v), (v), 113, 4)
|
||||
USE_GL_FUNC(TexCoord3i, (GLint s, GLint t, GLint r), (s,t,r), 114, 12)
|
||||
USE_GL_FUNC(TexCoord3iv, (const GLint *v), (v), 115, 4)
|
||||
USE_GL_FUNC(TexCoord3s, (GLshort s, GLshort t, GLshort r), (s,t,r), 116, 12)
|
||||
USE_GL_FUNC(TexCoord3sv, (const GLshort *v), (v), 117, 4)
|
||||
USE_GL_FUNC(TexCoord4d, (GLdouble s, GLdouble t, GLdouble r, GLdouble q), (s,t,r,q), 118, 32)
|
||||
USE_GL_FUNC(TexCoord4dv, (const GLdouble *v), (v), 119, 4)
|
||||
USE_GL_FUNC(TexCoord4f, (GLfloat s, GLfloat t, GLfloat r, GLfloat q), (s,t,r,q), 120, 16)
|
||||
USE_GL_FUNC(TexCoord4fv, (const GLfloat *v), (v), 121, 4)
|
||||
USE_GL_FUNC(TexCoord4i, (GLint s, GLint t, GLint r, GLint q), (s,t,r,q), 122, 16)
|
||||
USE_GL_FUNC(TexCoord4iv, (const GLint *v), (v), 123, 4)
|
||||
USE_GL_FUNC(TexCoord4s, (GLshort s, GLshort t, GLshort r, GLshort q), (s,t,r,q), 124, 16)
|
||||
USE_GL_FUNC(TexCoord4sv, (const GLshort *v), (v), 125, 4)
|
||||
USE_GL_FUNC(TexCoordPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer), (size,type,stride,pointer), 320, 16)
|
||||
USE_GL_FUNC(TexEnvf, (GLenum target, GLenum pname, GLfloat param), (target,pname,param), 184, 12)
|
||||
USE_GL_FUNC(TexEnvfv, (GLenum target, GLenum pname, const GLfloat *params), (target,pname,params), 185, 12)
|
||||
USE_GL_FUNC(TexEnvi, (GLenum target, GLenum pname, GLint param), (target,pname,param), 186, 12)
|
||||
USE_GL_FUNC(TexEnviv, (GLenum target, GLenum pname, const GLint *params), (target,pname,params), 187, 12)
|
||||
USE_GL_FUNC(TexGend, (GLenum coord, GLenum pname, GLdouble param), (coord,pname,param), 188, 16)
|
||||
USE_GL_FUNC(TexGendv, (GLenum coord, GLenum pname, const GLdouble *params), (coord,pname,params), 189, 12)
|
||||
USE_GL_FUNC(TexGenf, (GLenum coord, GLenum pname, GLfloat param), (coord,pname,param), 190, 12)
|
||||
USE_GL_FUNC(TexGenfv, (GLenum coord, GLenum pname, const GLfloat *params), (coord,pname,params), 191, 12)
|
||||
USE_GL_FUNC(TexGeni, (GLenum coord, GLenum pname, GLint param), (coord,pname,param), 192, 12)
|
||||
USE_GL_FUNC(TexGeniv, (GLenum coord, GLenum pname, const GLint *params), (coord,pname,params), 193, 12)
|
||||
USE_GL_FUNC(TexImage1D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLint border, GLenum format, GLenum type, const GLvoid *pixels), (target,level,internalformat,width,border,format,type,pixels), 182, 32)
|
||||
USE_GL_FUNC(TexImage2D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels), (target,level,internalformat,width,height,border,format,type,pixels), 183, 36)
|
||||
USE_GL_FUNC(TexParameterf, (GLenum target, GLenum pname, GLfloat param), (target,pname,param), 178, 12)
|
||||
USE_GL_FUNC(TexParameterfv, (GLenum target, GLenum pname, const GLfloat *params), (target,pname,params), 179, 12)
|
||||
USE_GL_FUNC(TexParameteri, (GLenum target, GLenum pname, GLint param), (target,pname,param), 180, 12)
|
||||
USE_GL_FUNC(TexParameteriv, (GLenum target, GLenum pname, const GLint *params), (target,pname,params), 181, 12)
|
||||
USE_GL_FUNC(TexSubImage1D, (GLenum target, GLint level, GLint xoffset, GLsizei width, GLenum format, GLenum type, const GLvoid *pixels), (target,level,xoffset,width,format,type,pixels), 332, 28)
|
||||
USE_GL_FUNC(TexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels), (target,level,xoffset,yoffset,width,height,format,type,pixels), 333, 36)
|
||||
USE_GL_FUNC(Translated, (GLdouble x, GLdouble y, GLdouble z), (x,y,z), 303, 24)
|
||||
USE_GL_FUNC(Translatef, (GLfloat x, GLfloat y, GLfloat z), (x,y,z), 304, 12)
|
||||
USE_GL_FUNC(Vertex2d, (GLdouble x, GLdouble y), (x,y), 126, 16)
|
||||
USE_GL_FUNC(Vertex2dv, (const GLdouble *v), (v), 127, 4)
|
||||
USE_GL_FUNC(Vertex2f, (GLfloat x, GLfloat y), (x,y), 128, 8)
|
||||
USE_GL_FUNC(Vertex2fv, (const GLfloat *v), (v), 129, 4)
|
||||
USE_GL_FUNC(Vertex2i, (GLint x, GLint y), (x,y), 130, 8)
|
||||
USE_GL_FUNC(Vertex2iv, (const GLint *v), (v), 131, 4)
|
||||
USE_GL_FUNC(Vertex2s, (GLshort x, GLshort y), (x,y), 132, 8)
|
||||
USE_GL_FUNC(Vertex2sv, (const GLshort *v), (v), 133, 4)
|
||||
USE_GL_FUNC(Vertex3d, (GLdouble x, GLdouble y, GLdouble z), (x,y,z), 134, 24)
|
||||
USE_GL_FUNC(Vertex3dv, (const GLdouble *v), (v), 135, 4)
|
||||
USE_GL_FUNC(Vertex3f, (GLfloat x, GLfloat y, GLfloat z), (x,y,z), 136, 12)
|
||||
USE_GL_FUNC(Vertex3fv, (const GLfloat *v), (v), 137, 4)
|
||||
USE_GL_FUNC(Vertex3i, (GLint x, GLint y, GLint z), (x,y,z), 138, 12)
|
||||
USE_GL_FUNC(Vertex3iv, (const GLint *v), (v), 139, 4)
|
||||
USE_GL_FUNC(Vertex3s, (GLshort x, GLshort y, GLshort z), (x,y,z), 140, 12)
|
||||
USE_GL_FUNC(Vertex3sv, (const GLshort *v), (v), 141, 4)
|
||||
USE_GL_FUNC(Vertex4d, (GLdouble x, GLdouble y, GLdouble z, GLdouble w), (x,y,z,w), 142, 32)
|
||||
USE_GL_FUNC(Vertex4dv, (const GLdouble *v), (v), 143, 4)
|
||||
USE_GL_FUNC(Vertex4f, (GLfloat x, GLfloat y, GLfloat z, GLfloat w), (x,y,z,w), 144, 16)
|
||||
USE_GL_FUNC(Vertex4fv, (const GLfloat *v), (v), 145, 4)
|
||||
USE_GL_FUNC(Vertex4i, (GLint x, GLint y, GLint z, GLint w), (x,y,z,w), 146, 16)
|
||||
USE_GL_FUNC(Vertex4iv, (const GLint *v), (v), 147, 4)
|
||||
USE_GL_FUNC(Vertex4s, (GLshort x, GLshort y, GLshort z, GLshort w), (x,y,z,w), 148, 16)
|
||||
USE_GL_FUNC(Vertex4sv, (const GLshort *v), (v), 149, 4)
|
||||
USE_GL_FUNC(VertexPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer), (size,type,stride,pointer), 321, 16)
|
||||
USE_GL_FUNC(Viewport, (GLint x, GLint y, GLsizei width, GLsizei height), (x,y,width,height), 305, 16)
|
||||
|
||||
#undef USE_GL_FUNC
|
||||
#undef USE_GL_FUNC_RET
|
398
dll/opengl/opengl32/icd.h
Normal file
398
dll/opengl/opengl32/icd.h
Normal file
|
@ -0,0 +1,398 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: lib/opengl32/icd.h
|
||||
* PURPOSE: OpenGL32 lib, ICD specific definitions
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#define OPENGL_VERSION_110_ENTRIES 336
|
||||
|
||||
struct __GLdispatchTableRec
|
||||
{
|
||||
void (GLAPIENTRY * NewList)(GLuint, GLenum);
|
||||
void (GLAPIENTRY * EndList)(void);
|
||||
void (GLAPIENTRY * CallList)(GLuint);
|
||||
void (GLAPIENTRY * CallLists)(GLsizei, GLenum, const GLvoid *);
|
||||
void (GLAPIENTRY * DeleteLists)(GLuint, GLsizei);
|
||||
GLuint (GLAPIENTRY * GenLists)(GLsizei);
|
||||
void (GLAPIENTRY * ListBase)(GLuint);
|
||||
void (GLAPIENTRY * Begin)(GLenum);
|
||||
void (GLAPIENTRY * Bitmap)(GLsizei, GLsizei, GLfloat, GLfloat, GLfloat, GLfloat, const GLubyte *);
|
||||
void (GLAPIENTRY * Color3b)(GLbyte, GLbyte, GLbyte);
|
||||
void (GLAPIENTRY * Color3bv)(const GLbyte *);
|
||||
void (GLAPIENTRY * Color3d)(GLdouble, GLdouble, GLdouble);
|
||||
void (GLAPIENTRY * Color3dv)(const GLdouble *);
|
||||
void (GLAPIENTRY * Color3f)(GLfloat, GLfloat, GLfloat);
|
||||
void (GLAPIENTRY * Color3fv)(const GLfloat *);
|
||||
void (GLAPIENTRY * Color3i)(GLint, GLint, GLint);
|
||||
void (GLAPIENTRY * Color3iv)(const GLint *);
|
||||
void (GLAPIENTRY * Color3s)(GLshort, GLshort, GLshort);
|
||||
void (GLAPIENTRY * Color3sv)(const GLshort *);
|
||||
void (GLAPIENTRY * Color3ub)(GLubyte, GLubyte, GLubyte);
|
||||
void (GLAPIENTRY * Color3ubv)(const GLubyte *);
|
||||
void (GLAPIENTRY * Color3ui)(GLuint, GLuint, GLuint);
|
||||
void (GLAPIENTRY * Color3uiv)(const GLuint *);
|
||||
void (GLAPIENTRY * Color3us)(GLushort, GLushort, GLushort);
|
||||
void (GLAPIENTRY * Color3usv)(const GLushort *);
|
||||
void (GLAPIENTRY * Color4b)(GLbyte, GLbyte, GLbyte, GLbyte);
|
||||
void (GLAPIENTRY * Color4bv)(const GLbyte *);
|
||||
void (GLAPIENTRY * Color4d)(GLdouble, GLdouble, GLdouble, GLdouble);
|
||||
void (GLAPIENTRY * Color4dv)(const GLdouble *);
|
||||
void (GLAPIENTRY * Color4f)(GLfloat, GLfloat, GLfloat, GLfloat);
|
||||
void (GLAPIENTRY * Color4fv)(const GLfloat *);
|
||||
void (GLAPIENTRY * Color4i)(GLint, GLint, GLint, GLint);
|
||||
void (GLAPIENTRY * Color4iv)(const GLint *);
|
||||
void (GLAPIENTRY * Color4s)(GLshort, GLshort, GLshort, GLshort);
|
||||
void (GLAPIENTRY * Color4sv)(const GLshort *);
|
||||
void (GLAPIENTRY * Color4ub)(GLubyte, GLubyte, GLubyte, GLubyte);
|
||||
void (GLAPIENTRY * Color4ubv)(const GLubyte *);
|
||||
void (GLAPIENTRY * Color4ui)(GLuint, GLuint, GLuint, GLuint);
|
||||
void (GLAPIENTRY * Color4uiv)(const GLuint *);
|
||||
void (GLAPIENTRY * Color4us)(GLushort, GLushort, GLushort, GLushort);
|
||||
void (GLAPIENTRY * Color4usv)(const GLushort *);
|
||||
void (GLAPIENTRY * EdgeFlag)(GLboolean);
|
||||
void (GLAPIENTRY * EdgeFlagv)(const GLboolean *);
|
||||
void (GLAPIENTRY * End)(void);
|
||||
void (GLAPIENTRY * Indexd)(GLdouble);
|
||||
void (GLAPIENTRY * Indexdv)(const GLdouble *);
|
||||
void (GLAPIENTRY * Indexf)(GLfloat);
|
||||
void (GLAPIENTRY * Indexfv)(const GLfloat *);
|
||||
void (GLAPIENTRY * Indexi)(GLint);
|
||||
void (GLAPIENTRY * Indexiv)(const GLint *);
|
||||
void (GLAPIENTRY * Indexs)(GLshort);
|
||||
void (GLAPIENTRY * Indexsv)(const GLshort *);
|
||||
void (GLAPIENTRY * Normal3b)(GLbyte, GLbyte, GLbyte);
|
||||
void (GLAPIENTRY * Normal3bv)(const GLbyte *);
|
||||
void (GLAPIENTRY * Normal3d)(GLdouble, GLdouble, GLdouble);
|
||||
void (GLAPIENTRY * Normal3dv)(const GLdouble *);
|
||||
void (GLAPIENTRY * Normal3f)(GLfloat, GLfloat, GLfloat);
|
||||
void (GLAPIENTRY * Normal3fv)(const GLfloat *);
|
||||
void (GLAPIENTRY * Normal3i)(GLint, GLint, GLint);
|
||||
void (GLAPIENTRY * Normal3iv)(const GLint *);
|
||||
void (GLAPIENTRY * Normal3s)(GLshort, GLshort, GLshort);
|
||||
void (GLAPIENTRY * Normal3sv)(const GLshort *);
|
||||
void (GLAPIENTRY * RasterPos2d)(GLdouble, GLdouble);
|
||||
void (GLAPIENTRY * RasterPos2dv)(const GLdouble *);
|
||||
void (GLAPIENTRY * RasterPos2f)(GLfloat, GLfloat);
|
||||
void (GLAPIENTRY * RasterPos2fv)(const GLfloat *);
|
||||
void (GLAPIENTRY * RasterPos2i)(GLint, GLint);
|
||||
void (GLAPIENTRY * RasterPos2iv)(const GLint *);
|
||||
void (GLAPIENTRY * RasterPos2s)(GLshort, GLshort);
|
||||
void (GLAPIENTRY * RasterPos2sv)(const GLshort *);
|
||||
void (GLAPIENTRY * RasterPos3d)(GLdouble, GLdouble, GLdouble);
|
||||
void (GLAPIENTRY * RasterPos3dv)(const GLdouble *);
|
||||
void (GLAPIENTRY * RasterPos3f)(GLfloat, GLfloat, GLfloat);
|
||||
void (GLAPIENTRY * RasterPos3fv)(const GLfloat *);
|
||||
void (GLAPIENTRY * RasterPos3i)(GLint, GLint, GLint);
|
||||
void (GLAPIENTRY * RasterPos3iv)(const GLint *);
|
||||
void (GLAPIENTRY * RasterPos3s)(GLshort, GLshort, GLshort);
|
||||
void (GLAPIENTRY * RasterPos3sv)(const GLshort *);
|
||||
void (GLAPIENTRY * RasterPos4d)(GLdouble, GLdouble, GLdouble, GLdouble);
|
||||
void (GLAPIENTRY * RasterPos4dv)(const GLdouble *);
|
||||
void (GLAPIENTRY * RasterPos4f)(GLfloat, GLfloat, GLfloat, GLfloat);
|
||||
void (GLAPIENTRY * RasterPos4fv)(const GLfloat *);
|
||||
void (GLAPIENTRY * RasterPos4i)(GLint, GLint, GLint, GLint);
|
||||
void (GLAPIENTRY * RasterPos4iv)(const GLint *);
|
||||
void (GLAPIENTRY * RasterPos4s)(GLshort, GLshort, GLshort, GLshort);
|
||||
void (GLAPIENTRY * RasterPos4sv)(const GLshort *);
|
||||
void (GLAPIENTRY * Rectd)(GLdouble, GLdouble, GLdouble, GLdouble);
|
||||
void (GLAPIENTRY * Rectdv)(const GLdouble *, const GLdouble *);
|
||||
void (GLAPIENTRY * Rectf)(GLfloat, GLfloat, GLfloat, GLfloat);
|
||||
void (GLAPIENTRY * Rectfv)(const GLfloat *, const GLfloat *);
|
||||
void (GLAPIENTRY * Recti)(GLint, GLint, GLint, GLint);
|
||||
void (GLAPIENTRY * Rectiv)(const GLint *, const GLint *);
|
||||
void (GLAPIENTRY * Rects)(GLshort, GLshort, GLshort, GLshort);
|
||||
void (GLAPIENTRY * Rectsv)(const GLshort *, const GLshort *);
|
||||
void (GLAPIENTRY * TexCoord1d)(GLdouble);
|
||||
void (GLAPIENTRY * TexCoord1dv)(const GLdouble *);
|
||||
void (GLAPIENTRY * TexCoord1f)(GLfloat);
|
||||
void (GLAPIENTRY * TexCoord1fv)(const GLfloat *);
|
||||
void (GLAPIENTRY * TexCoord1i)(GLint);
|
||||
void (GLAPIENTRY * TexCoord1iv)(const GLint *);
|
||||
void (GLAPIENTRY * TexCoord1s)(GLshort);
|
||||
void (GLAPIENTRY * TexCoord1sv)(const GLshort *);
|
||||
void (GLAPIENTRY * TexCoord2d)(GLdouble, GLdouble);
|
||||
void (GLAPIENTRY * TexCoord2dv)(const GLdouble *);
|
||||
void (GLAPIENTRY * TexCoord2f)(GLfloat, GLfloat);
|
||||
void (GLAPIENTRY * TexCoord2fv)(const GLfloat *);
|
||||
void (GLAPIENTRY * TexCoord2i)(GLint, GLint);
|
||||
void (GLAPIENTRY * TexCoord2iv)(const GLint *);
|
||||
void (GLAPIENTRY * TexCoord2s)(GLshort, GLshort);
|
||||
void (GLAPIENTRY * TexCoord2sv)(const GLshort *);
|
||||
void (GLAPIENTRY * TexCoord3d)(GLdouble, GLdouble, GLdouble);
|
||||
void (GLAPIENTRY * TexCoord3dv)(const GLdouble *);
|
||||
void (GLAPIENTRY * TexCoord3f)(GLfloat, GLfloat, GLfloat);
|
||||
void (GLAPIENTRY * TexCoord3fv)(const GLfloat *);
|
||||
void (GLAPIENTRY * TexCoord3i)(GLint, GLint, GLint);
|
||||
void (GLAPIENTRY * TexCoord3iv)(const GLint *);
|
||||
void (GLAPIENTRY * TexCoord3s)(GLshort, GLshort, GLshort);
|
||||
void (GLAPIENTRY * TexCoord3sv)(const GLshort *);
|
||||
void (GLAPIENTRY * TexCoord4d)(GLdouble, GLdouble, GLdouble, GLdouble);
|
||||
void (GLAPIENTRY * TexCoord4dv)(const GLdouble *);
|
||||
void (GLAPIENTRY * TexCoord4f)(GLfloat, GLfloat, GLfloat, GLfloat);
|
||||
void (GLAPIENTRY * TexCoord4fv)(const GLfloat *);
|
||||
void (GLAPIENTRY * TexCoord4i)(GLint, GLint, GLint, GLint);
|
||||
void (GLAPIENTRY * TexCoord4iv)(const GLint *);
|
||||
void (GLAPIENTRY * TexCoord4s)(GLshort, GLshort, GLshort, GLshort);
|
||||
void (GLAPIENTRY * TexCoord4sv)(const GLshort *);
|
||||
void (GLAPIENTRY * Vertex2d)(GLdouble, GLdouble);
|
||||
void (GLAPIENTRY * Vertex2dv)(const GLdouble *);
|
||||
void (GLAPIENTRY * Vertex2f)(GLfloat, GLfloat);
|
||||
void (GLAPIENTRY * Vertex2fv)(const GLfloat *);
|
||||
void (GLAPIENTRY * Vertex2i)(GLint, GLint);
|
||||
void (GLAPIENTRY * Vertex2iv)(const GLint *);
|
||||
void (GLAPIENTRY * Vertex2s)(GLshort, GLshort);
|
||||
void (GLAPIENTRY * Vertex2sv)(const GLshort *);
|
||||
void (GLAPIENTRY * Vertex3d)(GLdouble, GLdouble, GLdouble);
|
||||
void (GLAPIENTRY * Vertex3dv)(const GLdouble *);
|
||||
void (GLAPIENTRY * Vertex3f)(GLfloat, GLfloat, GLfloat);
|
||||
void (GLAPIENTRY * Vertex3fv)(const GLfloat *);
|
||||
void (GLAPIENTRY * Vertex3i)(GLint, GLint, GLint);
|
||||
void (GLAPIENTRY * Vertex3iv)(const GLint *);
|
||||
void (GLAPIENTRY * Vertex3s)(GLshort, GLshort, GLshort);
|
||||
void (GLAPIENTRY * Vertex3sv)(const GLshort *);
|
||||
void (GLAPIENTRY * Vertex4d)(GLdouble, GLdouble, GLdouble, GLdouble);
|
||||
void (GLAPIENTRY * Vertex4dv)(const GLdouble *);
|
||||
void (GLAPIENTRY * Vertex4f)(GLfloat, GLfloat, GLfloat, GLfloat);
|
||||
void (GLAPIENTRY * Vertex4fv)(const GLfloat *);
|
||||
void (GLAPIENTRY * Vertex4i)(GLint, GLint, GLint, GLint);
|
||||
void (GLAPIENTRY * Vertex4iv)(const GLint *);
|
||||
void (GLAPIENTRY * Vertex4s)(GLshort, GLshort, GLshort, GLshort);
|
||||
void (GLAPIENTRY * Vertex4sv)(const GLshort *);
|
||||
void (GLAPIENTRY * ClipPlane)(GLenum, const GLdouble *);
|
||||
void (GLAPIENTRY * ColorMaterial)(GLenum, GLenum);
|
||||
void (GLAPIENTRY * CullFace)(GLenum);
|
||||
void (GLAPIENTRY * Fogf)(GLenum, GLfloat);
|
||||
void (GLAPIENTRY * Fogfv)(GLenum, const GLfloat *);
|
||||
void (GLAPIENTRY * Fogi)(GLenum, GLint);
|
||||
void (GLAPIENTRY * Fogiv)(GLenum, const GLint *);
|
||||
void (GLAPIENTRY * FrontFace)(GLenum);
|
||||
void (GLAPIENTRY * Hint)(GLenum, GLenum);
|
||||
void (GLAPIENTRY * Lightf)(GLenum, GLenum, GLfloat);
|
||||
void (GLAPIENTRY * Lightfv)(GLenum, GLenum, const GLfloat *);
|
||||
void (GLAPIENTRY * Lighti)(GLenum, GLenum, GLint);
|
||||
void (GLAPIENTRY * Lightiv)(GLenum, GLenum, const GLint *);
|
||||
void (GLAPIENTRY * LightModelf)(GLenum, GLfloat);
|
||||
void (GLAPIENTRY * LightModelfv)(GLenum, const GLfloat *);
|
||||
void (GLAPIENTRY * LightModeli)(GLenum, GLint);
|
||||
void (GLAPIENTRY * LightModeliv)(GLenum, const GLint *);
|
||||
void (GLAPIENTRY * LineStipple)(GLint, GLushort);
|
||||
void (GLAPIENTRY * LineWidth)(GLfloat);
|
||||
void (GLAPIENTRY * Materialf)(GLenum, GLenum, GLfloat);
|
||||
void (GLAPIENTRY * Materialfv)(GLenum, GLenum, const GLfloat *);
|
||||
void (GLAPIENTRY * Materiali)(GLenum, GLenum, GLint);
|
||||
void (GLAPIENTRY * Materialiv)(GLenum, GLenum, const GLint *);
|
||||
void (GLAPIENTRY * PointSize)(GLfloat);
|
||||
void (GLAPIENTRY * PolygonMode)(GLenum, GLenum);
|
||||
void (GLAPIENTRY * PolygonStipple)(const GLubyte *);
|
||||
void (GLAPIENTRY * Scissor)(GLint, GLint, GLsizei, GLsizei);
|
||||
void (GLAPIENTRY * ShadeModel)(GLenum);
|
||||
void (GLAPIENTRY * TexParameterf)(GLenum, GLenum, GLfloat);
|
||||
void (GLAPIENTRY * TexParameterfv)(GLenum, GLenum, const GLfloat *);
|
||||
void (GLAPIENTRY * TexParameteri)(GLenum, GLenum, GLint);
|
||||
void (GLAPIENTRY * TexParameteriv)(GLenum, GLenum, const GLint *);
|
||||
void (GLAPIENTRY * TexImage1D)(GLenum, GLint, GLint, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
|
||||
void (GLAPIENTRY * TexImage2D)(GLenum, GLint, GLint, GLsizei, GLsizei, GLint, GLenum, GLenum, const GLvoid *);
|
||||
void (GLAPIENTRY * TexEnvf)(GLenum, GLenum, GLfloat);
|
||||
void (GLAPIENTRY * TexEnvfv)(GLenum, GLenum, const GLfloat *);
|
||||
void (GLAPIENTRY * TexEnvi)(GLenum, GLenum, GLint);
|
||||
void (GLAPIENTRY * TexEnviv)(GLenum, GLenum, const GLint *);
|
||||
void (GLAPIENTRY * TexGend)(GLenum, GLenum, GLdouble);
|
||||
void (GLAPIENTRY * TexGendv)(GLenum, GLenum, const GLdouble *);
|
||||
void (GLAPIENTRY * TexGenf)(GLenum, GLenum, GLfloat);
|
||||
void (GLAPIENTRY * TexGenfv)(GLenum, GLenum, const GLfloat *);
|
||||
void (GLAPIENTRY * TexGeni)(GLenum, GLenum, GLint);
|
||||
void (GLAPIENTRY * TexGeniv)(GLenum, GLenum, const GLint *);
|
||||
void (GLAPIENTRY * FeedbackBuffer)(GLsizei, GLenum, GLfloat *);
|
||||
void (GLAPIENTRY * SelectBuffer)(GLsizei, GLuint *);
|
||||
GLint (GLAPIENTRY * RenderMode)(GLenum);
|
||||
void (GLAPIENTRY * InitNames)(void);
|
||||
void (GLAPIENTRY * LoadName)(GLuint);
|
||||
void (GLAPIENTRY * PassThrough)(GLfloat);
|
||||
void (GLAPIENTRY * PopName)(void);
|
||||
void (GLAPIENTRY * PushName)(GLuint);
|
||||
void (GLAPIENTRY * DrawBuffer)(GLenum);
|
||||
void (GLAPIENTRY * Clear)(GLbitfield);
|
||||
void (GLAPIENTRY * ClearAccum)(GLfloat, GLfloat, GLfloat, GLfloat);
|
||||
void (GLAPIENTRY * ClearIndex)(GLfloat);
|
||||
void (GLAPIENTRY * ClearColor)(GLclampf, GLclampf, GLclampf, GLclampf);
|
||||
void (GLAPIENTRY * ClearStencil)(GLint);
|
||||
void (GLAPIENTRY * ClearDepth)(GLclampd);
|
||||
void (GLAPIENTRY * StencilMask)(GLuint);
|
||||
void (GLAPIENTRY * ColorMask)(GLboolean, GLboolean, GLboolean, GLboolean);
|
||||
void (GLAPIENTRY * DepthMask)(GLboolean);
|
||||
void (GLAPIENTRY * IndexMask)(GLuint);
|
||||
void (GLAPIENTRY * Accum)(GLenum, GLfloat);
|
||||
void (GLAPIENTRY * Disable)(GLenum);
|
||||
void (GLAPIENTRY * Enable)(GLenum);
|
||||
void (GLAPIENTRY * Finish)(void);
|
||||
void (GLAPIENTRY * Flush)(void);
|
||||
void (GLAPIENTRY * PopAttrib)(void);
|
||||
void (GLAPIENTRY * PushAttrib)(GLbitfield);
|
||||
void (GLAPIENTRY * Map1d)(GLenum, GLdouble, GLdouble, GLint, GLint, const GLdouble *);
|
||||
void (GLAPIENTRY * Map1f)(GLenum, GLfloat, GLfloat, GLint, GLint, const GLfloat *);
|
||||
void (GLAPIENTRY * Map2d)(GLenum, GLdouble, GLdouble, GLint, GLint, GLdouble, GLdouble, GLint, GLint, const GLdouble *);
|
||||
void (GLAPIENTRY * Map2f)(GLenum, GLfloat, GLfloat, GLint, GLint, GLfloat, GLfloat, GLint, GLint, const GLfloat *);
|
||||
void (GLAPIENTRY * MapGrid1d)(GLint, GLdouble, GLdouble);
|
||||
void (GLAPIENTRY * MapGrid1f)(GLint, GLfloat, GLfloat);
|
||||
void (GLAPIENTRY * MapGrid2d)(GLint, GLdouble, GLdouble, GLint, GLdouble, GLdouble);
|
||||
void (GLAPIENTRY * MapGrid2f)(GLint, GLfloat, GLfloat, GLint, GLfloat, GLfloat);
|
||||
void (GLAPIENTRY * EvalCoord1d)(GLdouble);
|
||||
void (GLAPIENTRY * EvalCoord1dv)(const GLdouble *);
|
||||
void (GLAPIENTRY * EvalCoord1f)(GLfloat);
|
||||
void (GLAPIENTRY * EvalCoord1fv)(const GLfloat *);
|
||||
void (GLAPIENTRY * EvalCoord2d)(GLdouble, GLdouble);
|
||||
void (GLAPIENTRY * EvalCoord2dv)(const GLdouble *);
|
||||
void (GLAPIENTRY * EvalCoord2f)(GLfloat, GLfloat);
|
||||
void (GLAPIENTRY * EvalCoord2fv)(const GLfloat *);
|
||||
void (GLAPIENTRY * EvalMesh1)(GLenum, GLint, GLint);
|
||||
void (GLAPIENTRY * EvalPoint1)(GLint);
|
||||
void (GLAPIENTRY * EvalMesh2)(GLenum, GLint, GLint, GLint, GLint);
|
||||
void (GLAPIENTRY * EvalPoint2)(GLint, GLint);
|
||||
void (GLAPIENTRY * AlphaFunc)(GLenum, GLclampf);
|
||||
void (GLAPIENTRY * BlendFunc)(GLenum, GLenum);
|
||||
void (GLAPIENTRY * LogicOp)(GLenum);
|
||||
void (GLAPIENTRY * StencilFunc)(GLenum, GLint, GLuint);
|
||||
void (GLAPIENTRY * StencilOp)(GLenum, GLenum, GLenum);
|
||||
void (GLAPIENTRY * DepthFunc)(GLenum);
|
||||
void (GLAPIENTRY * PixelZoom)(GLfloat, GLfloat);
|
||||
void (GLAPIENTRY * PixelTransferf)(GLenum, GLfloat);
|
||||
void (GLAPIENTRY * PixelTransferi)(GLenum, GLint);
|
||||
void (GLAPIENTRY * PixelStoref)(GLenum, GLfloat);
|
||||
void (GLAPIENTRY * PixelStorei)(GLenum, GLint);
|
||||
void (GLAPIENTRY * PixelMapfv)(GLenum, GLint, const GLfloat *);
|
||||
void (GLAPIENTRY * PixelMapuiv)(GLenum, GLint, const GLuint *);
|
||||
void (GLAPIENTRY * PixelMapusv)(GLenum, GLint, const GLushort *);
|
||||
void (GLAPIENTRY * ReadBuffer)(GLenum);
|
||||
void (GLAPIENTRY * CopyPixels)(GLint, GLint, GLsizei, GLsizei, GLenum);
|
||||
void (GLAPIENTRY * ReadPixels)(GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, GLvoid *);
|
||||
void (GLAPIENTRY * DrawPixels)(GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
|
||||
void (GLAPIENTRY * GetBooleanv)(GLenum, GLboolean *);
|
||||
void (GLAPIENTRY * GetClipPlane)(GLenum, GLdouble *);
|
||||
void (GLAPIENTRY * GetDoublev)(GLenum, GLdouble *);
|
||||
GLenum (GLAPIENTRY * GetError)(void);
|
||||
void (GLAPIENTRY * GetFloatv)(GLenum, GLfloat *);
|
||||
void (GLAPIENTRY * GetIntegerv)(GLenum, GLint *);
|
||||
void (GLAPIENTRY * GetLightfv)(GLenum, GLenum, GLfloat *);
|
||||
void (GLAPIENTRY * GetLightiv)(GLenum, GLenum, GLint *);
|
||||
void (GLAPIENTRY * GetMapdv)(GLenum, GLenum, GLdouble *);
|
||||
void (GLAPIENTRY * GetMapfv)(GLenum, GLenum, GLfloat *);
|
||||
void (GLAPIENTRY * GetMapiv)(GLenum, GLenum, GLint *);
|
||||
void (GLAPIENTRY * GetMaterialfv)(GLenum, GLenum, GLfloat *);
|
||||
void (GLAPIENTRY * GetMaterialiv)(GLenum, GLenum, GLint *);
|
||||
void (GLAPIENTRY * GetPixelMapfv)(GLenum, GLfloat *);
|
||||
void (GLAPIENTRY * GetPixelMapuiv)(GLenum, GLuint *);
|
||||
void (GLAPIENTRY * GetPixelMapusv)(GLenum, GLushort *);
|
||||
void (GLAPIENTRY * GetPolygonStipple)(GLubyte *);
|
||||
const GLubyte * (GLAPIENTRY * GetString)(GLenum);
|
||||
void (GLAPIENTRY * GetTexEnvfv)(GLenum, GLenum, GLfloat *);
|
||||
void (GLAPIENTRY * GetTexEnviv)(GLenum, GLenum, GLint *);
|
||||
void (GLAPIENTRY * GetTexGendv)(GLenum, GLenum, GLdouble *);
|
||||
void (GLAPIENTRY * GetTexGenfv)(GLenum, GLenum, GLfloat *);
|
||||
void (GLAPIENTRY * GetTexGeniv)(GLenum, GLenum, GLint *);
|
||||
void (GLAPIENTRY * GetTexImage)(GLenum, GLint, GLenum, GLenum, GLvoid *);
|
||||
void (GLAPIENTRY * GetTexParameterfv)(GLenum, GLenum, GLfloat *);
|
||||
void (GLAPIENTRY * GetTexParameteriv)(GLenum, GLenum, GLint *);
|
||||
void (GLAPIENTRY * GetTexLevelParameterfv)(GLenum, GLint, GLenum, GLfloat *);
|
||||
void (GLAPIENTRY * GetTexLevelParameteriv)(GLenum, GLint, GLenum, GLint *);
|
||||
GLboolean (GLAPIENTRY * IsEnabled)(GLenum);
|
||||
GLboolean (GLAPIENTRY * IsList)(GLuint);
|
||||
void (GLAPIENTRY * DepthRange)(GLclampd, GLclampd);
|
||||
void (GLAPIENTRY * Frustum)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble);
|
||||
void (GLAPIENTRY * LoadIdentity)(void);
|
||||
void (GLAPIENTRY * LoadMatrixf)(const GLfloat *);
|
||||
void (GLAPIENTRY * LoadMatrixd)(const GLdouble *);
|
||||
void (GLAPIENTRY * MatrixMode)(GLenum);
|
||||
void (GLAPIENTRY * MultMatrixf)(const GLfloat *);
|
||||
void (GLAPIENTRY * MultMatrixd)(const GLdouble *);
|
||||
void (GLAPIENTRY * Ortho)(GLdouble, GLdouble, GLdouble, GLdouble, GLdouble, GLdouble);
|
||||
void (GLAPIENTRY * PopMatrix)(void);
|
||||
void (GLAPIENTRY * PushMatrix)(void);
|
||||
void (GLAPIENTRY * Rotated)(GLdouble, GLdouble, GLdouble, GLdouble);
|
||||
void (GLAPIENTRY * Rotatef)(GLfloat, GLfloat, GLfloat, GLfloat);
|
||||
void (GLAPIENTRY * Scaled)(GLdouble, GLdouble, GLdouble);
|
||||
void (GLAPIENTRY * Scalef)(GLfloat, GLfloat, GLfloat);
|
||||
void (GLAPIENTRY * Translated)(GLdouble, GLdouble, GLdouble);
|
||||
void (GLAPIENTRY * Translatef)(GLfloat, GLfloat, GLfloat);
|
||||
void (GLAPIENTRY * Viewport)(GLint, GLint, GLsizei, GLsizei);
|
||||
void (GLAPIENTRY * ArrayElement)(GLint);
|
||||
void (GLAPIENTRY * BindTexture)(GLenum, GLuint);
|
||||
void (GLAPIENTRY * ColorPointer)(GLint, GLenum, GLsizei, const GLvoid *);
|
||||
void (GLAPIENTRY * DisableClientState)(GLenum);
|
||||
void (GLAPIENTRY * DrawArrays)(GLenum, GLint, GLsizei);
|
||||
void (GLAPIENTRY * DrawElements)(GLenum, GLsizei, GLenum, const GLvoid *);
|
||||
void (GLAPIENTRY * EdgeFlagPointer)(GLsizei, const GLvoid *);
|
||||
void (GLAPIENTRY * EnableClientState)(GLenum);
|
||||
void (GLAPIENTRY * IndexPointer)(GLenum, GLsizei, const GLvoid *);
|
||||
void (GLAPIENTRY * Indexub)(GLubyte);
|
||||
void (GLAPIENTRY * Indexubv)(const GLubyte *);
|
||||
void (GLAPIENTRY * InterleavedArrays)(GLenum, GLsizei, const GLvoid *);
|
||||
void (GLAPIENTRY * NormalPointer)(GLenum, GLsizei, const GLvoid *);
|
||||
void (GLAPIENTRY * PolygonOffset)(GLfloat, GLfloat);
|
||||
void (GLAPIENTRY * TexCoordPointer)(GLint, GLenum, GLsizei, const GLvoid *);
|
||||
void (GLAPIENTRY * VertexPointer)(GLint, GLenum, GLsizei, const GLvoid *);
|
||||
GLboolean (GLAPIENTRY * AreTexturesResident)(GLsizei, const GLuint *, GLboolean *);
|
||||
void (GLAPIENTRY * CopyTexImage1D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLint);
|
||||
void (GLAPIENTRY * CopyTexImage2D)(GLenum, GLint, GLenum, GLint, GLint, GLsizei, GLsizei, GLint);
|
||||
void (GLAPIENTRY * CopyTexSubImage1D)(GLenum, GLint, GLint, GLint, GLint, GLsizei);
|
||||
void (GLAPIENTRY * CopyTexSubImage2D)(GLenum, GLint, GLint, GLint, GLint, GLint, GLsizei, GLsizei);
|
||||
void (GLAPIENTRY * DeleteTextures)(GLsizei, const GLuint *);
|
||||
void (GLAPIENTRY * GenTextures)(GLsizei, GLuint *);
|
||||
void (GLAPIENTRY * GetPointerv)(GLenum, GLvoid **);
|
||||
GLboolean (GLAPIENTRY * IsTexture)(GLuint);
|
||||
void (GLAPIENTRY * PrioritizeTextures)(GLsizei, const GLuint *, const GLclampf *);
|
||||
void (GLAPIENTRY * TexSubImage1D)(GLenum, GLint, GLint, GLsizei, GLenum, GLenum, const GLvoid *);
|
||||
void (GLAPIENTRY * TexSubImage2D)(GLenum, GLint, GLint, GLint, GLsizei, GLsizei, GLenum, GLenum, const GLvoid *);
|
||||
void (GLAPIENTRY * PopClientAttrib)(void);
|
||||
void (GLAPIENTRY * PushClientAttrib)(GLbitfield);
|
||||
};
|
||||
|
||||
typedef struct __GLdispatchTableRec GLDISPATCHTABLE;
|
||||
|
||||
typedef struct _GLCLTPROCTABLE
|
||||
{
|
||||
int cEntries;
|
||||
GLDISPATCHTABLE glDispatchTable;
|
||||
} GLCLTPROCTABLE, * PGLCLTPROCTABLE;
|
||||
|
||||
typedef VOID (APIENTRY * PFN_SETPROCTABLE)(const GLCLTPROCTABLE*);
|
||||
|
||||
/* Those functions are there in case GL calls are made without a context */
|
||||
extern const GLCLTPROCTABLE StubTable;
|
||||
|
||||
/* This doesn't seem to be anywhere in ddk or psdk */
|
||||
DECLARE_HANDLE(DHGLRC);
|
||||
|
||||
struct ICD_Data
|
||||
{
|
||||
/* The Name returned with OPENGL_GETINFO escape code */
|
||||
WCHAR DriverName[256];
|
||||
/* The DLL handle */
|
||||
HMODULE hModule;
|
||||
|
||||
/* The ICD DLL exports */
|
||||
BOOL (WINAPI *DrvCopyContext)( DHGLRC, DHGLRC, UINT );
|
||||
DHGLRC (WINAPI *DrvCreateContext)( HDC );
|
||||
DHGLRC (WINAPI *DrvCreateLayerContext)( HDC, int );
|
||||
BOOL (WINAPI *DrvDeleteContext)( DHGLRC );
|
||||
BOOL (WINAPI *DrvDescribeLayerPlane)( HDC, int, int, UINT, LPLAYERPLANEDESCRIPTOR );
|
||||
int (WINAPI *DrvDescribePixelFormat)( IN HDC, IN int, IN UINT, OUT LPPIXELFORMATDESCRIPTOR );
|
||||
int (WINAPI *DrvGetLayerPaletteEntries)( HDC, int, int, int, COLORREF * );
|
||||
PROC (WINAPI *DrvGetProcAddress)( LPCSTR lpProcName );
|
||||
void (WINAPI *DrvReleaseContext)( DHGLRC hglrc ); /* maybe returns BOOL? */
|
||||
BOOL (WINAPI *DrvRealizeLayerPalette)( HDC, int, BOOL );
|
||||
const GLCLTPROCTABLE* (WINAPI *DrvSetContext)( HDC hdc, DHGLRC hglrc, PFN_SETPROCTABLE callback );
|
||||
int (WINAPI *DrvSetLayerPaletteEntries)( HDC, int, int, int, CONST COLORREF * );
|
||||
BOOL (WINAPI *DrvSetPixelFormat)( IN HDC, IN int);
|
||||
BOOL (WINAPI *DrvShareLists)( DHGLRC, DHGLRC );
|
||||
BOOL (WINAPI *DrvSwapBuffers)( HDC );
|
||||
BOOL (WINAPI *DrvSwapLayerBuffers)( HDC, UINT );
|
||||
|
||||
/* Make this a linked list */
|
||||
struct ICD_Data* next;
|
||||
};
|
||||
|
||||
struct ICD_Data* IntGetIcdData(HDC hdc);
|
||||
|
336
dll/opengl/opengl32/icdlist.h
Normal file
336
dll/opengl/opengl32/icdlist.h
Normal file
|
@ -0,0 +1,336 @@
|
|||
ICD_ENTRY(glNewList) //0
|
||||
ICD_ENTRY(glEndList) //1
|
||||
ICD_ENTRY(glCallList) //2
|
||||
ICD_ENTRY(glCallLists) //3
|
||||
ICD_ENTRY(glDeleteLists) //4
|
||||
ICD_ENTRY(glGenLists) //5
|
||||
ICD_ENTRY(glListBase) //6
|
||||
ICD_ENTRY(glBegin) //7
|
||||
ICD_ENTRY(glBitmap) //8
|
||||
ICD_ENTRY(glColor3b) //9
|
||||
ICD_ENTRY(glColor3bv) //10
|
||||
ICD_ENTRY(glColor3d) //11
|
||||
ICD_ENTRY(glColor3dv) //12
|
||||
ICD_ENTRY(glColor3f) //13
|
||||
ICD_ENTRY(glColor3fv) //14
|
||||
ICD_ENTRY(glColor3i) //15
|
||||
ICD_ENTRY(glColor3iv) //16
|
||||
ICD_ENTRY(glColor3s) //17
|
||||
ICD_ENTRY(glColor3sv) //18
|
||||
ICD_ENTRY(glColor3ub) //19
|
||||
ICD_ENTRY(glColor3ubv) //20
|
||||
ICD_ENTRY(glColor3ui) //21
|
||||
ICD_ENTRY(glColor3uiv) //22
|
||||
ICD_ENTRY(glColor3us) //23
|
||||
ICD_ENTRY(glColor3usv) //24
|
||||
ICD_ENTRY(glColor4b) //25
|
||||
ICD_ENTRY(glColor4bv) //26
|
||||
ICD_ENTRY(glColor4d) //27
|
||||
ICD_ENTRY(glColor4dv) //28
|
||||
ICD_ENTRY(glColor4f) //29
|
||||
ICD_ENTRY(glColor4fv) //30
|
||||
ICD_ENTRY(glColor4i) //31
|
||||
ICD_ENTRY(glColor4iv) //32
|
||||
ICD_ENTRY(glColor4s) //33
|
||||
ICD_ENTRY(glColor4sv) //34
|
||||
ICD_ENTRY(glColor4ub) //35
|
||||
ICD_ENTRY(glColor4ubv) //36
|
||||
ICD_ENTRY(glColor4ui) //37
|
||||
ICD_ENTRY(glColor4uiv) //38
|
||||
ICD_ENTRY(glColor4us) //39
|
||||
ICD_ENTRY(glColor4usv) //40
|
||||
ICD_ENTRY(glEdgeFlag) //41
|
||||
ICD_ENTRY(glEdgeFlagv) //42
|
||||
ICD_ENTRY(glEnd) //43
|
||||
ICD_ENTRY(glIndexd) //44
|
||||
ICD_ENTRY(glIndexdv) //45
|
||||
ICD_ENTRY(glIndexf) //46
|
||||
ICD_ENTRY(glIndexfv) //47
|
||||
ICD_ENTRY(glIndexi) //48
|
||||
ICD_ENTRY(glIndexiv) //49
|
||||
ICD_ENTRY(glIndexs) //50
|
||||
ICD_ENTRY(glIndexsv) //51
|
||||
ICD_ENTRY(glNormal3b) //52
|
||||
ICD_ENTRY(glNormal3bv) //53
|
||||
ICD_ENTRY(glNormal3d) //54
|
||||
ICD_ENTRY(glNormal3dv) //55
|
||||
ICD_ENTRY(glNormal3f) //56
|
||||
ICD_ENTRY(glNormal3fv) //57
|
||||
ICD_ENTRY(glNormal3i) //58
|
||||
ICD_ENTRY(glNormal3iv) //59
|
||||
ICD_ENTRY(glNormal3s) //60
|
||||
ICD_ENTRY(glNormal3sv) //61
|
||||
ICD_ENTRY(glRasterPos2d) //62
|
||||
ICD_ENTRY(glRasterPos2dv) //63
|
||||
ICD_ENTRY(glRasterPos2f) //64
|
||||
ICD_ENTRY(glRasterPos2fv) //65
|
||||
ICD_ENTRY(glRasterPos2i) //66
|
||||
ICD_ENTRY(glRasterPos2iv) //67
|
||||
ICD_ENTRY(glRasterPos2s) //68
|
||||
ICD_ENTRY(glRasterPos2sv) //69
|
||||
ICD_ENTRY(glRasterPos3d) //70
|
||||
ICD_ENTRY(glRasterPos3dv) //71
|
||||
ICD_ENTRY(glRasterPos3f) //72
|
||||
ICD_ENTRY(glRasterPos3fv) //73
|
||||
ICD_ENTRY(glRasterPos3i) //74
|
||||
ICD_ENTRY(glRasterPos3iv) //75
|
||||
ICD_ENTRY(glRasterPos3s) //76
|
||||
ICD_ENTRY(glRasterPos3sv) //77
|
||||
ICD_ENTRY(glRasterPos4d) //78
|
||||
ICD_ENTRY(glRasterPos4dv) //79
|
||||
ICD_ENTRY(glRasterPos4f) //80
|
||||
ICD_ENTRY(glRasterPos4fv) //81
|
||||
ICD_ENTRY(glRasterPos4i) //82
|
||||
ICD_ENTRY(glRasterPos4iv) //83
|
||||
ICD_ENTRY(glRasterPos4s) //84
|
||||
ICD_ENTRY(glRasterPos4sv) //85
|
||||
ICD_ENTRY(glRectd) //86
|
||||
ICD_ENTRY(glRectdv) //87
|
||||
ICD_ENTRY(glRectf) //88
|
||||
ICD_ENTRY(glRectfv) //89
|
||||
ICD_ENTRY(glRecti) //90
|
||||
ICD_ENTRY(glRectiv) //91
|
||||
ICD_ENTRY(glRects) //92
|
||||
ICD_ENTRY(glRectsv) //93
|
||||
ICD_ENTRY(glTexCoord1d) //94
|
||||
ICD_ENTRY(glTexCoord1dv) //95
|
||||
ICD_ENTRY(glTexCoord1f) //96
|
||||
ICD_ENTRY(glTexCoord1fv) //97
|
||||
ICD_ENTRY(glTexCoord1i) //98
|
||||
ICD_ENTRY(glTexCoord1iv) //99
|
||||
ICD_ENTRY(glTexCoord1s) //100
|
||||
ICD_ENTRY(glTexCoord1sv) //101
|
||||
ICD_ENTRY(glTexCoord2d) //102
|
||||
ICD_ENTRY(glTexCoord2dv) //103
|
||||
ICD_ENTRY(glTexCoord2f) //104
|
||||
ICD_ENTRY(glTexCoord2fv) //105
|
||||
ICD_ENTRY(glTexCoord2i) //106
|
||||
ICD_ENTRY(glTexCoord2iv) //107
|
||||
ICD_ENTRY(glTexCoord2s) //108
|
||||
ICD_ENTRY(glTexCoord2sv) //109
|
||||
ICD_ENTRY(glTexCoord3d) //110
|
||||
ICD_ENTRY(glTexCoord3dv) //111
|
||||
ICD_ENTRY(glTexCoord3f) //112
|
||||
ICD_ENTRY(glTexCoord3fv) //113
|
||||
ICD_ENTRY(glTexCoord3i) //114
|
||||
ICD_ENTRY(glTexCoord3iv) //115
|
||||
ICD_ENTRY(glTexCoord3s) //116
|
||||
ICD_ENTRY(glTexCoord3sv) //117
|
||||
ICD_ENTRY(glTexCoord4d) //118
|
||||
ICD_ENTRY(glTexCoord4dv) //119
|
||||
ICD_ENTRY(glTexCoord4f) //120
|
||||
ICD_ENTRY(glTexCoord4fv) //121
|
||||
ICD_ENTRY(glTexCoord4i) //122
|
||||
ICD_ENTRY(glTexCoord4iv) //123
|
||||
ICD_ENTRY(glTexCoord4s) //124
|
||||
ICD_ENTRY(glTexCoord4sv) //125
|
||||
ICD_ENTRY(glVertex2d) //126
|
||||
ICD_ENTRY(glVertex2dv) //127
|
||||
ICD_ENTRY(glVertex2f) //128
|
||||
ICD_ENTRY(glVertex2fv) //129
|
||||
ICD_ENTRY(glVertex2i) //130
|
||||
ICD_ENTRY(glVertex2iv) //131
|
||||
ICD_ENTRY(glVertex2s) //132
|
||||
ICD_ENTRY(glVertex2sv) //133
|
||||
ICD_ENTRY(glVertex3d) //134
|
||||
ICD_ENTRY(glVertex3dv) //135
|
||||
ICD_ENTRY(glVertex3f) //136
|
||||
ICD_ENTRY(glVertex3fv) //137
|
||||
ICD_ENTRY(glVertex3i) //138
|
||||
ICD_ENTRY(glVertex3iv) //139
|
||||
ICD_ENTRY(glVertex3s) //140
|
||||
ICD_ENTRY(glVertex3sv) //141
|
||||
ICD_ENTRY(glVertex4d) //142
|
||||
ICD_ENTRY(glVertex4dv) //143
|
||||
ICD_ENTRY(glVertex4f) //144
|
||||
ICD_ENTRY(glVertex4fv) //145
|
||||
ICD_ENTRY(glVertex4i) //146
|
||||
ICD_ENTRY(glVertex4iv) //147
|
||||
ICD_ENTRY(glVertex4s) //148
|
||||
ICD_ENTRY(glVertex4sv) //149
|
||||
ICD_ENTRY(glClipPlane) //150
|
||||
ICD_ENTRY(glColorMaterial) //151
|
||||
ICD_ENTRY(glCullFace) //152
|
||||
ICD_ENTRY(glFogf) //153
|
||||
ICD_ENTRY(glFogfv) //154
|
||||
ICD_ENTRY(glFogi) //155
|
||||
ICD_ENTRY(glFogiv) //156
|
||||
ICD_ENTRY(glFrontFace) //157
|
||||
ICD_ENTRY(glHint) //158
|
||||
ICD_ENTRY(glLightf) //159
|
||||
ICD_ENTRY(glLightfv) //160
|
||||
ICD_ENTRY(glLighti) //161
|
||||
ICD_ENTRY(glLightiv) //162
|
||||
ICD_ENTRY(glLightModelf) //163
|
||||
ICD_ENTRY(glLightModelfv) //164
|
||||
ICD_ENTRY(glLightModeli) //165
|
||||
ICD_ENTRY(glLightModeliv) //166
|
||||
ICD_ENTRY(glLineStipple) //167
|
||||
ICD_ENTRY(glLineWidth) //168
|
||||
ICD_ENTRY(glMaterialf) //169
|
||||
ICD_ENTRY(glMaterialfv) //170
|
||||
ICD_ENTRY(glMateriali) //171
|
||||
ICD_ENTRY(glMaterialiv) //172
|
||||
ICD_ENTRY(glPointSize) //173
|
||||
ICD_ENTRY(glPolygonMode) //174
|
||||
ICD_ENTRY(glPolygonStipple) //175
|
||||
ICD_ENTRY(glScissor) //176
|
||||
ICD_ENTRY(glShadeModel) //177
|
||||
ICD_ENTRY(glTexParameterf) //178
|
||||
ICD_ENTRY(glTexParameterfv) //179
|
||||
ICD_ENTRY(glTexParameteri) //180
|
||||
ICD_ENTRY(glTexParameteriv) //181
|
||||
ICD_ENTRY(glTexImage1D) //182
|
||||
ICD_ENTRY(glTexImage2D) //183
|
||||
ICD_ENTRY(glTexEnvf) //184
|
||||
ICD_ENTRY(glTexEnvfv) //185
|
||||
ICD_ENTRY(glTexEnvi) //186
|
||||
ICD_ENTRY(glTexEnviv) //187
|
||||
ICD_ENTRY(glTexGend) //188
|
||||
ICD_ENTRY(glTexGendv) //189
|
||||
ICD_ENTRY(glTexGenf) //190
|
||||
ICD_ENTRY(glTexGenfv) //191
|
||||
ICD_ENTRY(glTexGeni) //192
|
||||
ICD_ENTRY(glTexGeniv) //193
|
||||
ICD_ENTRY(glFeedbackBuffer) //194
|
||||
ICD_ENTRY(glSelectBuffer) //195
|
||||
ICD_ENTRY(glRenderMode) //196
|
||||
ICD_ENTRY(glInitNames) //197
|
||||
ICD_ENTRY(glLoadName) //198
|
||||
ICD_ENTRY(glPassThrough) //199
|
||||
ICD_ENTRY(glPopName) //200
|
||||
ICD_ENTRY(glPushName) //201
|
||||
ICD_ENTRY(glDrawBuffer) //202
|
||||
ICD_ENTRY(glClear) //203
|
||||
ICD_ENTRY(glClearAccum) //204
|
||||
ICD_ENTRY(glClearIndex) //205
|
||||
ICD_ENTRY(glClearColor) //206
|
||||
ICD_ENTRY(glClearStencil) //207
|
||||
ICD_ENTRY(glClearDepth) //208
|
||||
ICD_ENTRY(glStencilMask) //209
|
||||
ICD_ENTRY(glColorMask) //210
|
||||
ICD_ENTRY(glDepthMask) //211
|
||||
ICD_ENTRY(glIndexMask) //212
|
||||
ICD_ENTRY(glAccum) //213
|
||||
ICD_ENTRY(glDisable) //214
|
||||
ICD_ENTRY(glEnable) //215
|
||||
ICD_ENTRY(glFinish) //216
|
||||
ICD_ENTRY(glFlush) //217
|
||||
ICD_ENTRY(glPopAttrib) //218
|
||||
ICD_ENTRY(glPushAttrib) //219
|
||||
ICD_ENTRY(glMap1d) //220
|
||||
ICD_ENTRY(glMap1f) //221
|
||||
ICD_ENTRY(glMap2d) //222
|
||||
ICD_ENTRY(glMap2f) //223
|
||||
ICD_ENTRY(glMapGrid1d) //224
|
||||
ICD_ENTRY(glMapGrid1f) //225
|
||||
ICD_ENTRY(glMapGrid2d) //226
|
||||
ICD_ENTRY(glMapGrid2f) //227
|
||||
ICD_ENTRY(glEvalCoord1d) //228
|
||||
ICD_ENTRY(glEvalCoord1dv) //229
|
||||
ICD_ENTRY(glEvalCoord1f) //230
|
||||
ICD_ENTRY(glEvalCoord1fv) //231
|
||||
ICD_ENTRY(glEvalCoord2d) //232
|
||||
ICD_ENTRY(glEvalCoord2dv) //233
|
||||
ICD_ENTRY(glEvalCoord2f) //234
|
||||
ICD_ENTRY(glEvalCoord2fv) //235
|
||||
ICD_ENTRY(glEvalMesh1) //236
|
||||
ICD_ENTRY(glEvalPoint1) //237
|
||||
ICD_ENTRY(glEvalMesh2) //238
|
||||
ICD_ENTRY(glEvalPoint2) //239
|
||||
ICD_ENTRY(glAlphaFunc) //240
|
||||
ICD_ENTRY(glBlendFunc) //241
|
||||
ICD_ENTRY(glLogicOp) //242
|
||||
ICD_ENTRY(glStencilFunc) //243
|
||||
ICD_ENTRY(glStencilOp) //244
|
||||
ICD_ENTRY(glDepthFunc) //245
|
||||
ICD_ENTRY(glPixelZoom) //246
|
||||
ICD_ENTRY(glPixelTransferf) //247
|
||||
ICD_ENTRY(glPixelTransferi) //248
|
||||
ICD_ENTRY(glPixelStoref) //249
|
||||
ICD_ENTRY(glPixelStorei) //250
|
||||
ICD_ENTRY(glPixelMapfv) //251
|
||||
ICD_ENTRY(glPixelMapuiv) //252
|
||||
ICD_ENTRY(glPixelMapusv) //253
|
||||
ICD_ENTRY(glReadBuffer) //254
|
||||
ICD_ENTRY(glCopyPixels) //255
|
||||
ICD_ENTRY(glReadPixels) //256
|
||||
ICD_ENTRY(glDrawPixels) //257
|
||||
ICD_ENTRY(glGetBooleanv) //258
|
||||
ICD_ENTRY(glGetClipPlane) //259
|
||||
ICD_ENTRY(glGetDoublev) //260
|
||||
ICD_ENTRY(glGetError) //261
|
||||
ICD_ENTRY(glGetFloatv) //262
|
||||
ICD_ENTRY(glGetIntegerv) //263
|
||||
ICD_ENTRY(glGetLightfv) //264
|
||||
ICD_ENTRY(glGetLightiv) //265
|
||||
ICD_ENTRY(glGetMapdv) //266
|
||||
ICD_ENTRY(glGetMapfv) //267
|
||||
ICD_ENTRY(glGetMapiv) //268
|
||||
ICD_ENTRY(glGetMaterialfv) //269
|
||||
ICD_ENTRY(glGetMaterialiv) //270
|
||||
ICD_ENTRY(glGetPixelMapfv) //271
|
||||
ICD_ENTRY(glGetPixelMapuiv) //272
|
||||
ICD_ENTRY(glGetPixelMapusv) //273
|
||||
ICD_ENTRY(glGetPolygonStipple) //274
|
||||
ICD_ENTRY(glGetString) //275
|
||||
ICD_ENTRY(glGetTexEnvfv) //276
|
||||
ICD_ENTRY(glGetTexEnviv) //277
|
||||
ICD_ENTRY(glGetTexGendv) //278
|
||||
ICD_ENTRY(glGetTexGenfv) //279
|
||||
ICD_ENTRY(glGetTexGeniv) //280
|
||||
ICD_ENTRY(glGetTexImage) //281
|
||||
ICD_ENTRY(glGetTexParameterfv) //282
|
||||
ICD_ENTRY(glGetTexParameteriv) //283
|
||||
ICD_ENTRY(glGetTexLevelParameterfv) //284
|
||||
ICD_ENTRY(glGetTexLevelParameteriv) //285
|
||||
ICD_ENTRY(glIsEnabled) //286
|
||||
ICD_ENTRY(glIsList) //287
|
||||
ICD_ENTRY(glDepthRange) //288
|
||||
ICD_ENTRY(glFrustum) //289
|
||||
ICD_ENTRY(glLoadIdentity) //290
|
||||
ICD_ENTRY(glLoadMatrixf) //291
|
||||
ICD_ENTRY(glLoadMatrixd) //292
|
||||
ICD_ENTRY(glMatrixMode) //293
|
||||
ICD_ENTRY(glMultMatrixf) //294
|
||||
ICD_ENTRY(glMultMatrixd) //295
|
||||
ICD_ENTRY(glOrtho) //296
|
||||
ICD_ENTRY(glPopMatrix) //297
|
||||
ICD_ENTRY(glPushMatrix) //298
|
||||
ICD_ENTRY(glRotated) //299
|
||||
ICD_ENTRY(glRotatef) //300
|
||||
ICD_ENTRY(glScaled) //301
|
||||
ICD_ENTRY(glScalef) //302
|
||||
ICD_ENTRY(glTranslated) //303
|
||||
ICD_ENTRY(glTranslatef) //304
|
||||
ICD_ENTRY(glViewport) //305
|
||||
ICD_ENTRY(glArrayElement) //306
|
||||
ICD_ENTRY(glBindTexture) //307
|
||||
ICD_ENTRY(glColorPointer) //308
|
||||
ICD_ENTRY(glDisableClientState) //309
|
||||
ICD_ENTRY(glDrawArrays) //310
|
||||
ICD_ENTRY(glDrawElements) //311
|
||||
ICD_ENTRY(glEdgeFlagPointer) //312
|
||||
ICD_ENTRY(glEnableClientState) //313
|
||||
ICD_ENTRY(glIndexPointer) //314
|
||||
ICD_ENTRY(glIndexub) //315
|
||||
ICD_ENTRY(glIndexubv) //316
|
||||
ICD_ENTRY(glInterleavedArrays) //317
|
||||
ICD_ENTRY(glNormalPointer) //318
|
||||
ICD_ENTRY(glPolygonOffset) //319
|
||||
ICD_ENTRY(glTexCoordPointer) //320
|
||||
ICD_ENTRY(glVertexPointer) //321
|
||||
ICD_ENTRY(glAreTexturesResident) //322
|
||||
ICD_ENTRY(glCopyTexImage1D) //323
|
||||
ICD_ENTRY(glCopyTexImage2D) //324
|
||||
ICD_ENTRY(glCopyTexSubImage1D) //325
|
||||
ICD_ENTRY(glCopyTexSubImage2D) //326
|
||||
ICD_ENTRY(glDeleteTextures) //327
|
||||
ICD_ENTRY(glGenTextures) //328
|
||||
ICD_ENTRY(glGetPointerv) //329
|
||||
ICD_ENTRY(glIsTexture) //330
|
||||
ICD_ENTRY(glPrioritizeTextures) //331
|
||||
ICD_ENTRY(glTexSubImage1D) //332
|
||||
ICD_ENTRY(glTexSubImage2D) //333
|
||||
ICD_ENTRY(glPopClientAttrib) //334
|
||||
ICD_ENTRY(glPushClientAttrib) //335
|
370
dll/opengl/opengl32/icdload.c
Normal file
370
dll/opengl/opengl32/icdload.c
Normal file
|
@ -0,0 +1,370 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: lib/opengl32/icdload.c
|
||||
* PURPOSE: OpenGL32 lib, ICD dll loader
|
||||
*/
|
||||
|
||||
#include "opengl32.h"
|
||||
|
||||
#include <winreg.h>
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(opengl32);
|
||||
|
||||
typedef struct
|
||||
{
|
||||
DWORD Version; /*!< Driver interface version */
|
||||
DWORD DriverVersion; /*!< Driver version */
|
||||
WCHAR DriverName[256]; /*!< Driver name */
|
||||
} Drv_Opengl_Info, *pDrv_Opengl_Info;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
OGL_CD_NOT_QUERIED,
|
||||
OGL_CD_NONE,
|
||||
OGL_CD_ROSSWI,
|
||||
OGL_CD_CUSTOM_ICD
|
||||
} CUSTOM_DRIVER_STATE;
|
||||
|
||||
static CRITICAL_SECTION icdload_cs = {NULL, -1, 0, 0, 0, 0};
|
||||
static struct ICD_Data* ICD_Data_List = NULL;
|
||||
static const WCHAR OpenGLDrivers_Key[] = L"SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\OpenGLDrivers";
|
||||
static const WCHAR CustomDrivers_Key[] = L"SOFTWARE\\ReactOS\\OpenGL";
|
||||
static Drv_Opengl_Info CustomDrvInfo;
|
||||
static CUSTOM_DRIVER_STATE CustomDriverState = OGL_CD_NOT_QUERIED;
|
||||
|
||||
static void APIENTRY wglSetCurrentValue(PVOID value)
|
||||
{
|
||||
IntSetCurrentICDPrivate(value);
|
||||
}
|
||||
|
||||
static PVOID APIENTRY wglGetCurrentValue()
|
||||
{
|
||||
return IntGetCurrentICDPrivate();
|
||||
}
|
||||
|
||||
static DHGLRC wglGetDHGLRC(struct wgl_context* context)
|
||||
{
|
||||
return context->dhglrc;
|
||||
}
|
||||
|
||||
/* GDI entry points (win32k) */
|
||||
extern INT APIENTRY GdiDescribePixelFormat(HDC hdc, INT ipfd, UINT cjpfd, PPIXELFORMATDESCRIPTOR ppfd);
|
||||
extern BOOL APIENTRY GdiSetPixelFormat(HDC hdc, INT ipfd);
|
||||
extern BOOL APIENTRY GdiSwapBuffers(HDC hdc);
|
||||
|
||||
/* Retrieves the ICD data (driver version + relevant DLL entry points) for a device context */
|
||||
struct ICD_Data* IntGetIcdData(HDC hdc)
|
||||
{
|
||||
int ret;
|
||||
DWORD dwInput, dwValueType, Version, DriverVersion, Flags;
|
||||
Drv_Opengl_Info DrvInfo;
|
||||
pDrv_Opengl_Info pDrvInfo;
|
||||
struct ICD_Data* data;
|
||||
HKEY OglKey = NULL;
|
||||
HKEY DrvKey, CustomKey;
|
||||
WCHAR DllName[MAX_PATH];
|
||||
BOOL (WINAPI *DrvValidateVersion)(DWORD);
|
||||
void (WINAPI *DrvSetCallbackProcs)(int nProcs, PROC* pProcs);
|
||||
|
||||
/* The following code is ReactOS specific and allows us to easily load an arbitrary ICD:
|
||||
* It checks HKCU\Software\ReactOS\OpenGL for a custom ICD and will always load it
|
||||
* no matter what driver the DC is associated with. It can also force using the
|
||||
* built-in Software Implementation*/
|
||||
if(CustomDriverState == OGL_CD_NOT_QUERIED)
|
||||
{
|
||||
/* Only do this once so there's not any significant performance penalty */
|
||||
CustomDriverState = OGL_CD_NONE;
|
||||
memset(&CustomDrvInfo, 0, sizeof(Drv_Opengl_Info));
|
||||
|
||||
ret = RegOpenKeyExW(HKEY_CURRENT_USER, CustomDrivers_Key, 0, KEY_READ, &CustomKey);
|
||||
if(ret != ERROR_SUCCESS)
|
||||
goto custom_end;
|
||||
|
||||
dwInput = sizeof(CustomDrvInfo.DriverName);
|
||||
ret = RegQueryValueExW(CustomKey, L"", 0, &dwValueType, (LPBYTE)CustomDrvInfo.DriverName, &dwInput);
|
||||
RegCloseKey(CustomKey);
|
||||
|
||||
if((ret != ERROR_SUCCESS) || (dwValueType != REG_SZ) || !wcslen(CustomDrvInfo.DriverName))
|
||||
goto custom_end;
|
||||
|
||||
if(!_wcsicmp(CustomDrvInfo.DriverName, L"ReactOS Software Implementation"))
|
||||
{
|
||||
/* Always announce the fact that we're forcing ROSSWI */
|
||||
ERR("Forcing ReactOS Software Implementation\n");
|
||||
CustomDriverState = OGL_CD_ROSSWI;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE, OpenGLDrivers_Key, 0, KEY_READ, &OglKey);
|
||||
if(ret != ERROR_SUCCESS)
|
||||
goto custom_end;
|
||||
|
||||
ret = RegOpenKeyExW(OglKey, CustomDrvInfo.DriverName, 0, KEY_READ, &OglKey);
|
||||
if(ret != ERROR_SUCCESS)
|
||||
goto custom_end;
|
||||
|
||||
dwInput = sizeof(CustomDrvInfo.Version);
|
||||
ret = RegQueryValueExW(OglKey, L"Version", 0, &dwValueType, (LPBYTE)&CustomDrvInfo.Version, &dwInput);
|
||||
if((ret != ERROR_SUCCESS) || (dwValueType != REG_DWORD))
|
||||
goto custom_end;
|
||||
|
||||
dwInput = sizeof(DriverVersion);
|
||||
ret = RegQueryValueExW(OglKey, L"DriverVersion", 0, &dwValueType, (LPBYTE)&CustomDrvInfo.DriverVersion, &dwInput);
|
||||
CustomDriverState = OGL_CD_CUSTOM_ICD;
|
||||
|
||||
/* Always announce the fact that we're overriding the default driver */
|
||||
ERR("Overriding the default OGL ICD with %S\n", CustomDrvInfo.DriverName);
|
||||
|
||||
custom_end:
|
||||
if(OglKey)
|
||||
RegCloseKey(OglKey);
|
||||
RegCloseKey(CustomKey);
|
||||
}
|
||||
|
||||
/* If there's a custom ICD or ROSSWI was requested use it, otherwise proceed as usual */
|
||||
if(CustomDriverState == OGL_CD_CUSTOM_ICD)
|
||||
{
|
||||
pDrvInfo = &CustomDrvInfo;
|
||||
}
|
||||
else if(CustomDriverState == OGL_CD_ROSSWI)
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* First, see if the driver supports this */
|
||||
dwInput = OPENGL_GETINFO;
|
||||
ret = ExtEscape(hdc, QUERYESCSUPPORT, sizeof(DWORD), (LPCSTR)&dwInput, 0, NULL);
|
||||
|
||||
/* Driver doesn't support opengl */
|
||||
if(ret <= 0)
|
||||
return NULL;
|
||||
|
||||
/* Query for the ICD DLL name and version */
|
||||
dwInput = 0;
|
||||
ret = ExtEscape(hdc, OPENGL_GETINFO, sizeof(DWORD), (LPCSTR)&dwInput, sizeof(DrvInfo), (LPSTR)&DrvInfo);
|
||||
|
||||
if(ret <= 0)
|
||||
{
|
||||
ERR("Driver claims to support OPENGL_GETINFO escape code, but doesn't.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pDrvInfo = &DrvInfo;
|
||||
}
|
||||
|
||||
/* Protect the list while we are loading*/
|
||||
EnterCriticalSection(&icdload_cs);
|
||||
|
||||
/* Search for it in the list of already loaded modules */
|
||||
data = ICD_Data_List;
|
||||
while(data)
|
||||
{
|
||||
if(!_wcsicmp(data->DriverName, pDrvInfo->DriverName))
|
||||
{
|
||||
/* Found it */
|
||||
TRACE("Found already loaded %p.\n", data);
|
||||
LeaveCriticalSection(&icdload_cs);
|
||||
return data;
|
||||
}
|
||||
data = data->next;
|
||||
}
|
||||
|
||||
/* It was still not loaded, look for it in the registry */
|
||||
ret = RegOpenKeyExW(HKEY_LOCAL_MACHINE, OpenGLDrivers_Key, 0, KEY_READ, &OglKey);
|
||||
if(ret != ERROR_SUCCESS)
|
||||
{
|
||||
ERR("Failed to open the OpenGLDrivers key.\n");
|
||||
goto end;
|
||||
}
|
||||
ret = RegOpenKeyExW(OglKey, pDrvInfo->DriverName, 0, KEY_READ, &DrvKey);
|
||||
if(ret != ERROR_SUCCESS)
|
||||
{
|
||||
/* Some driver installer just provide the DLL name, like the Matrox G400 */
|
||||
TRACE("No driver subkey for %S, trying to get DLL name directly.\n", pDrvInfo->DriverName);
|
||||
dwInput = sizeof(DllName);
|
||||
ret = RegQueryValueExW(OglKey, pDrvInfo->DriverName, 0, &dwValueType, (LPBYTE)DllName, &dwInput);
|
||||
if((ret != ERROR_SUCCESS) || (dwValueType != REG_SZ))
|
||||
{
|
||||
ERR("Unable to get ICD DLL name!\n");
|
||||
RegCloseKey(OglKey);
|
||||
goto end;
|
||||
}
|
||||
Version = DriverVersion = Flags = 0;
|
||||
TRACE("DLL name is %S.\n", DllName);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* The driver have a subkey for the ICD */
|
||||
TRACE("Querying details from registry for %S.\n", pDrvInfo->DriverName);
|
||||
dwInput = sizeof(DllName);
|
||||
ret = RegQueryValueExW(DrvKey, L"Dll", 0, &dwValueType, (LPBYTE)DllName, &dwInput);
|
||||
if((ret != ERROR_SUCCESS) || (dwValueType != REG_SZ))
|
||||
{
|
||||
ERR("Unable to get ICD DLL name!.\n");
|
||||
RegCloseKey(DrvKey);
|
||||
RegCloseKey(OglKey);
|
||||
goto end;
|
||||
}
|
||||
|
||||
dwInput = sizeof(Version);
|
||||
ret = RegQueryValueExW(DrvKey, L"Version", 0, &dwValueType, (LPBYTE)&Version, &dwInput);
|
||||
if((ret != ERROR_SUCCESS) || (dwValueType != REG_DWORD))
|
||||
{
|
||||
WARN("No version in driver subkey\n");
|
||||
}
|
||||
else if(Version != pDrvInfo->Version)
|
||||
{
|
||||
ERR("Version mismatch between registry (%lu) and display driver (%lu).\n", Version, pDrvInfo->Version);
|
||||
RegCloseKey(DrvKey);
|
||||
RegCloseKey(OglKey);
|
||||
goto end;
|
||||
}
|
||||
|
||||
dwInput = sizeof(DriverVersion);
|
||||
ret = RegQueryValueExW(DrvKey, L"DriverVersion", 0, &dwValueType, (LPBYTE)&DriverVersion, &dwInput);
|
||||
if((ret != ERROR_SUCCESS) || (dwValueType != REG_DWORD))
|
||||
{
|
||||
WARN("No driver version in driver subkey\n");
|
||||
}
|
||||
else if(DriverVersion != pDrvInfo->DriverVersion)
|
||||
{
|
||||
ERR("Driver version mismatch between registry (%lu) and display driver (%lu).\n", DriverVersion, pDrvInfo->DriverVersion);
|
||||
RegCloseKey(DrvKey);
|
||||
RegCloseKey(OglKey);
|
||||
goto end;
|
||||
}
|
||||
|
||||
dwInput = sizeof(Flags);
|
||||
ret = RegQueryValueExW(DrvKey, L"Flags", 0, &dwValueType, (LPBYTE)&Flags, &dwInput);
|
||||
if((ret != ERROR_SUCCESS) || (dwValueType != REG_DWORD))
|
||||
{
|
||||
WARN("No driver version in driver subkey\n");
|
||||
Flags = 0;
|
||||
}
|
||||
|
||||
/* We're done */
|
||||
RegCloseKey(DrvKey);
|
||||
TRACE("DLL name is %S, Version %lx, DriverVersion %lx, Flags %lx.\n", DllName, Version, DriverVersion, Flags);
|
||||
}
|
||||
/* No need for this anymore */
|
||||
RegCloseKey(OglKey);
|
||||
|
||||
/* So far so good, allocate data */
|
||||
data = HeapAlloc(GetProcessHeap(), 0, sizeof(*data));
|
||||
if(!data)
|
||||
{
|
||||
ERR("Unable to allocate ICD data!\n");
|
||||
goto end;
|
||||
}
|
||||
|
||||
/* Load the library */
|
||||
data->hModule = LoadLibraryW(DllName);
|
||||
if(!data->hModule)
|
||||
{
|
||||
ERR("Could not load the ICD DLL: %S.\n", DllName);
|
||||
HeapFree(GetProcessHeap(), 0, data);
|
||||
data = NULL;
|
||||
goto end;
|
||||
}
|
||||
|
||||
/*
|
||||
* Validate version, if needed.
|
||||
* Some drivers (at least VBOX), initialize stuff upon this call.
|
||||
*/
|
||||
DrvValidateVersion = (void*)GetProcAddress(data->hModule, "DrvValidateVersion");
|
||||
if(DrvValidateVersion)
|
||||
{
|
||||
if(!DrvValidateVersion(pDrvInfo->DriverVersion))
|
||||
{
|
||||
ERR("DrvValidateVersion failed!.\n");
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
/* Pass the callbacks */
|
||||
DrvSetCallbackProcs = (void*)GetProcAddress(data->hModule, "DrvSetCallbackProcs");
|
||||
if(DrvSetCallbackProcs)
|
||||
{
|
||||
PROC callbacks[] = {(PROC)wglGetCurrentValue,
|
||||
(PROC)wglSetCurrentValue,
|
||||
(PROC)wglGetDHGLRC};
|
||||
DrvSetCallbackProcs(3, callbacks);
|
||||
}
|
||||
|
||||
/* Get the DLL exports */
|
||||
#define DRV_LOAD(x) do \
|
||||
{ \
|
||||
data->x = (void*)GetProcAddress(data->hModule, #x); \
|
||||
if(!data->x) { \
|
||||
ERR("%S lacks " #x "!\n", DllName); \
|
||||
goto fail; \
|
||||
} \
|
||||
} while(0)
|
||||
DRV_LOAD(DrvCopyContext);
|
||||
DRV_LOAD(DrvCreateContext);
|
||||
DRV_LOAD(DrvCreateLayerContext);
|
||||
DRV_LOAD(DrvDeleteContext);
|
||||
DRV_LOAD(DrvDescribeLayerPlane);
|
||||
DRV_LOAD(DrvDescribePixelFormat);
|
||||
DRV_LOAD(DrvGetLayerPaletteEntries);
|
||||
DRV_LOAD(DrvGetProcAddress);
|
||||
DRV_LOAD(DrvReleaseContext);
|
||||
DRV_LOAD(DrvRealizeLayerPalette);
|
||||
DRV_LOAD(DrvSetContext);
|
||||
DRV_LOAD(DrvSetLayerPaletteEntries);
|
||||
DRV_LOAD(DrvSetPixelFormat);
|
||||
DRV_LOAD(DrvShareLists);
|
||||
DRV_LOAD(DrvSwapBuffers);
|
||||
DRV_LOAD(DrvSwapLayerBuffers);
|
||||
#undef DRV_LOAD
|
||||
|
||||
/* Let's see if GDI should handle this instead of the ICD DLL */
|
||||
// FIXME: maybe there is a better way
|
||||
if (GdiDescribePixelFormat(hdc, 0, 0, NULL) != 0)
|
||||
{
|
||||
/* GDI knows what to do with that. Override */
|
||||
TRACE("Forwarding WGL calls to win32k!\n");
|
||||
data->DrvDescribePixelFormat = GdiDescribePixelFormat;
|
||||
data->DrvSetPixelFormat = GdiSetPixelFormat;
|
||||
data->DrvSwapBuffers = GdiSwapBuffers;
|
||||
}
|
||||
|
||||
/* Copy the DriverName */
|
||||
wcscpy(data->DriverName, pDrvInfo->DriverName);
|
||||
|
||||
/* Push the list */
|
||||
data->next = ICD_Data_List;
|
||||
ICD_Data_List = data;
|
||||
|
||||
TRACE("Returning %p.\n", data);
|
||||
TRACE("ICD driver %S (%S) successfully loaded.\n", pDrvInfo->DriverName, DllName);
|
||||
|
||||
end:
|
||||
/* Unlock and return */
|
||||
LeaveCriticalSection(&icdload_cs);
|
||||
return data;
|
||||
|
||||
fail:
|
||||
LeaveCriticalSection(&icdload_cs);
|
||||
FreeLibrary(data->hModule);
|
||||
HeapFree(GetProcessHeap(), 0, data);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void IntDeleteAllICDs(void)
|
||||
{
|
||||
struct ICD_Data* data;
|
||||
|
||||
EnterCriticalSection(&icdload_cs);
|
||||
|
||||
while (ICD_Data_List != NULL)
|
||||
{
|
||||
data = ICD_Data_List;
|
||||
ICD_Data_List = data->next;
|
||||
|
||||
FreeLibrary(data->hModule);
|
||||
HeapFree(GetProcessHeap(), 0, data);
|
||||
}
|
||||
}
|
25
dll/opengl/opengl32/icdtable.h
Normal file
25
dll/opengl/opengl32/icdtable.h
Normal file
|
@ -0,0 +1,25 @@
|
|||
/* icdtable.h */
|
||||
|
||||
#ifndef OPENGL32_PRIVATE_ICDTABLE_H
|
||||
#define OPENGL32_PRIVATE_ICDTABLE_H
|
||||
|
||||
enum icdoffsets_e
|
||||
{
|
||||
ICDIDX_INVALID = -1,
|
||||
#define ICD_ENTRY(x) ICDIDX_##x,
|
||||
#include "icdlist.h"
|
||||
#undef ICD_ENTRY
|
||||
ICDIDX_COUNT
|
||||
};
|
||||
|
||||
typedef struct tagICDTable
|
||||
{
|
||||
DWORD num_funcs; /*!< Normally 336 (0x150) -- the number of functions in OpenGL 1.1 */
|
||||
PROC dispatch_table[812]; /*!< Table containing \a num_funcs pointers to OpenGL functions */
|
||||
} ICDTable, *PICDTable;
|
||||
|
||||
#define DISPATCH_TABLE_SIZE 812*sizeof(PROC)
|
||||
|
||||
#endif /* OPENGL32_PRIVATE_ICDTABLE_H */
|
||||
|
||||
/* EOF */
|
625
dll/opengl/opengl32/opengl32.c
Normal file
625
dll/opengl/opengl32/opengl32.c
Normal file
|
@ -0,0 +1,625 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: lib/opengl32/opengl32.c
|
||||
* PURPOSE: OpenGL32 lib
|
||||
* PROGRAMMER: Anich Gregor (blight), Royce Mitchell III
|
||||
* UPDATE HISTORY:
|
||||
* Feb 1, 2004: Created
|
||||
*/
|
||||
|
||||
#include "opengl32.h"
|
||||
|
||||
/* function prototypes */
|
||||
static void OPENGL32_AppendICD( GLDRIVERDATA *icd );
|
||||
static void OPENGL32_RemoveICD( GLDRIVERDATA *icd );
|
||||
static GLDRIVERDATA *OPENGL32_LoadDriver( LPCWSTR regKey );
|
||||
static DWORD OPENGL32_InitializeDriver( GLDRIVERDATA *icd );
|
||||
static BOOL OPENGL32_UnloadDriver( GLDRIVERDATA *icd );
|
||||
static DWORD OPENGL32_RegGetDriverInfo( LPCWSTR driver, GLDRIVERDATA *icd );
|
||||
|
||||
|
||||
/* global vars */
|
||||
GLPROCESSDATA OPENGL32_processdata;
|
||||
|
||||
|
||||
static BOOL
|
||||
OPENGL32_ThreadAttach( void )
|
||||
{
|
||||
PROC *dispatchTable = NULL;
|
||||
TEB *teb = NULL;
|
||||
|
||||
dispatchTable = (PROC*)HeapAlloc( GetProcessHeap(),
|
||||
HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY,
|
||||
DISPATCH_TABLE_SIZE );
|
||||
if (dispatchTable == NULL)
|
||||
{
|
||||
DBGPRINT( "Error: Couldn't allocate GL dispatch table" );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
teb = NtCurrentTeb();
|
||||
|
||||
/* initialize dispatch table with empty functions */
|
||||
#define X(func, ret, typeargs, args, icdidx, tebidx, stack) \
|
||||
dispatchTable[icdidx] = (PROC)glEmptyFunc##stack; \
|
||||
if (tebidx >= 0) \
|
||||
teb->glDispatchTable[tebidx] = (PVOID)glEmptyFunc##stack;
|
||||
GLFUNCS_MACRO
|
||||
#undef X
|
||||
|
||||
teb->glTable = dispatchTable;
|
||||
/* At first we have no context */
|
||||
teb->glCurrentRC = NULL;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
OPENGL32_ThreadDetach( void )
|
||||
{
|
||||
TEB* teb = NtCurrentTeb();
|
||||
|
||||
rosglMakeCurrent( NULL, NULL );
|
||||
|
||||
if (teb->glTable != NULL)
|
||||
{
|
||||
if (!HeapFree( GetProcessHeap(), 0, teb->glTable ))
|
||||
{
|
||||
DBGPRINT( "Warning: HeapFree() on dispatch table failed (%d)",
|
||||
GetLastError() );
|
||||
}
|
||||
/* NULL-ify it. Even if something went wrong, it's not a good idea to keep it non NULL */
|
||||
teb->glTable = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static BOOL
|
||||
OPENGL32_ProcessAttach( void )
|
||||
{
|
||||
SECURITY_ATTRIBUTES attrib = { sizeof (SECURITY_ATTRIBUTES), /* nLength */
|
||||
NULL, /* lpSecurityDescriptor */
|
||||
TRUE /* bInheritHandle */ };
|
||||
|
||||
memset( &OPENGL32_processdata, 0, sizeof (OPENGL32_processdata) );
|
||||
|
||||
/* create driver, glrc & dcdata list mutex */
|
||||
OPENGL32_processdata.driver_mutex = CreateMutex( &attrib, FALSE, NULL );
|
||||
if (OPENGL32_processdata.driver_mutex == NULL)
|
||||
{
|
||||
DBGPRINT( "Error: Couldn't create driver_list mutex (%d)",
|
||||
GetLastError() );
|
||||
return FALSE;
|
||||
}
|
||||
OPENGL32_processdata.glrc_mutex = CreateMutex( &attrib, FALSE, NULL );
|
||||
if (OPENGL32_processdata.glrc_mutex == NULL)
|
||||
{
|
||||
DBGPRINT( "Error: Couldn't create glrc_list mutex (%d)",
|
||||
GetLastError() );
|
||||
return FALSE;
|
||||
}
|
||||
OPENGL32_processdata.dcdata_mutex = CreateMutex( &attrib, FALSE, NULL );
|
||||
if (OPENGL32_processdata.dcdata_mutex == NULL)
|
||||
{
|
||||
DBGPRINT( "Error: Couldn't create dcdata_list mutex (%d)",
|
||||
GetLastError() );
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
static void
|
||||
OPENGL32_ProcessDetach( void )
|
||||
{
|
||||
GLDRIVERDATA *icd, *icd2;
|
||||
GLDCDATA *dcdata, *dcdata2;
|
||||
GLRC *glrc, *glrc2;
|
||||
|
||||
/* free lists */
|
||||
for (dcdata = OPENGL32_processdata.dcdata_list; dcdata != NULL;)
|
||||
{
|
||||
dcdata2 = dcdata;
|
||||
dcdata = dcdata->next;
|
||||
if (!HeapFree( GetProcessHeap(), 0, dcdata2 ))
|
||||
DBGPRINT( "Warning: HeapFree() on DCDATA 0x%08x failed (%d)",
|
||||
dcdata2, GetLastError() );
|
||||
}
|
||||
|
||||
for (glrc = OPENGL32_processdata.glrc_list; glrc != NULL;)
|
||||
{
|
||||
glrc2 = glrc;
|
||||
glrc = glrc->next;
|
||||
if (!HeapFree( GetProcessHeap(), 0, glrc2 ))
|
||||
DBGPRINT( "Warning: HeapFree() on GLRC 0x%08x failed (%d)",
|
||||
glrc2, GetLastError() );
|
||||
}
|
||||
|
||||
for (icd = OPENGL32_processdata.driver_list; icd != NULL;)
|
||||
{
|
||||
icd2 = icd;
|
||||
icd = icd->next;
|
||||
if (!HeapFree( GetProcessHeap(), 0, icd2 ))
|
||||
DBGPRINT( "Warning: HeapFree() on DRIVERDATA 0x%08x failed (%d)",
|
||||
icd2, GetLastError() );
|
||||
}
|
||||
|
||||
/* free mutexes */
|
||||
if (OPENGL32_processdata.driver_mutex != NULL)
|
||||
CloseHandle( OPENGL32_processdata.driver_mutex );
|
||||
if (OPENGL32_processdata.glrc_mutex != NULL)
|
||||
CloseHandle( OPENGL32_processdata.glrc_mutex );
|
||||
if (OPENGL32_processdata.dcdata_mutex != NULL)
|
||||
CloseHandle( OPENGL32_processdata.dcdata_mutex );
|
||||
}
|
||||
|
||||
|
||||
BOOL WINAPI
|
||||
DllMain(HINSTANCE hInstance, DWORD Reason, LPVOID Reserved)
|
||||
{
|
||||
DBGPRINT( "Info: Called!" );
|
||||
switch ( Reason )
|
||||
{
|
||||
/* The DLL is loading due to process
|
||||
* initialization or a call to LoadLibrary.
|
||||
*/
|
||||
case DLL_PROCESS_ATTACH:
|
||||
DBGTRACE( "Process attach" );
|
||||
if (!OPENGL32_ProcessAttach())
|
||||
return FALSE;
|
||||
/* No break: Initialize the index for first thread. */
|
||||
|
||||
/* The attached process creates a new thread. */
|
||||
case DLL_THREAD_ATTACH:
|
||||
DBGTRACE( "Thread attach" );
|
||||
if (!OPENGL32_ThreadAttach())
|
||||
return FALSE;
|
||||
break;
|
||||
|
||||
/* The thread of the attached process terminates. */
|
||||
case DLL_THREAD_DETACH:
|
||||
DBGTRACE( "Thread detach" );
|
||||
/* Release the allocated memory for this thread.*/
|
||||
OPENGL32_ThreadDetach();
|
||||
break;
|
||||
|
||||
/* DLL unload due to process termination or FreeLibrary. */
|
||||
case DLL_PROCESS_DETACH:
|
||||
DBGTRACE( "Process detach" );
|
||||
OPENGL32_ThreadDetach();
|
||||
OPENGL32_ProcessDetach();
|
||||
break;
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Append ICD to linked list.
|
||||
*
|
||||
* \param icd GLDRIVERDATA to append to list
|
||||
*
|
||||
* \note Only call this when you hold the driver_mutex.
|
||||
*/
|
||||
static void
|
||||
OPENGL32_AppendICD( GLDRIVERDATA *icd )
|
||||
{
|
||||
if (OPENGL32_processdata.driver_list == NULL)
|
||||
OPENGL32_processdata.driver_list = icd;
|
||||
else
|
||||
{
|
||||
GLDRIVERDATA *p = OPENGL32_processdata.driver_list;
|
||||
while (p->next != NULL)
|
||||
p = p->next;
|
||||
p->next = icd;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Remove ICD from linked list.
|
||||
*
|
||||
* \param icd GLDRIVERDATA to remove from list
|
||||
*
|
||||
* \note Only call this when you hold the driver_mutex.
|
||||
*/
|
||||
static void
|
||||
OPENGL32_RemoveICD( GLDRIVERDATA *icd )
|
||||
{
|
||||
if (icd == OPENGL32_processdata.driver_list)
|
||||
OPENGL32_processdata.driver_list = icd->next;
|
||||
else
|
||||
{
|
||||
GLDRIVERDATA *p = OPENGL32_processdata.driver_list;
|
||||
while (p != NULL)
|
||||
{
|
||||
if (p->next == icd)
|
||||
{
|
||||
p->next = icd->next;
|
||||
return;
|
||||
}
|
||||
p = p->next;
|
||||
}
|
||||
DBGPRINT( "Error: ICD 0x%08x not found in list!", icd );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Load an ICD.
|
||||
*
|
||||
* \param driver Name of installable client driver.
|
||||
*
|
||||
* \return Pointer to an allocated GLDRIVERDATA struct.
|
||||
* \retval NULL Failure.
|
||||
*
|
||||
* \todo Call SetLastError() where appropriate.
|
||||
*/
|
||||
static GLDRIVERDATA *
|
||||
OPENGL32_LoadDriver( LPCWSTR driver )
|
||||
{
|
||||
LONG ret;
|
||||
GLDRIVERDATA *icd;
|
||||
|
||||
DBGPRINT( "Info: Loading driver %ws...", driver );
|
||||
|
||||
/* allocate driver data */
|
||||
icd = (GLDRIVERDATA*)HeapAlloc( GetProcessHeap(),
|
||||
HEAP_GENERATE_EXCEPTIONS | HEAP_ZERO_MEMORY,
|
||||
sizeof (GLDRIVERDATA) );
|
||||
if (icd == NULL)
|
||||
{
|
||||
DBGPRINT( "Error: Couldn't allocate GLDRIVERDATA! (%d)", GetLastError() );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ret = OPENGL32_RegGetDriverInfo( driver, icd );
|
||||
if (ret != ERROR_SUCCESS)
|
||||
{
|
||||
DBGPRINT( "Error: Couldn't query driver information (%d)", ret );
|
||||
if (!HeapFree( GetProcessHeap(), 0, icd ))
|
||||
DBGPRINT( "Error: HeapFree() returned false, error code = %d",
|
||||
GetLastError() );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
DBGPRINT( "Info: Dll = %ws", icd->dll );
|
||||
DBGPRINT( "Info: Version = 0x%08x", icd->version );
|
||||
DBGPRINT( "Info: DriverVersion = 0x%08x", icd->driver_version );
|
||||
DBGPRINT( "Info: Flags = 0x%08x", icd->flags );
|
||||
|
||||
/* load/initialize ICD */
|
||||
ret = OPENGL32_InitializeDriver( icd );
|
||||
if (ret != ERROR_SUCCESS)
|
||||
{
|
||||
DBGPRINT( "Error: Couldnt initialize ICD!" );
|
||||
if (!HeapFree( GetProcessHeap(), 0, icd ))
|
||||
DBGPRINT( "Error: HeapFree() returned false, error code = %d",
|
||||
GetLastError() );
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* append ICD to list */
|
||||
OPENGL32_AppendICD( icd );
|
||||
DBGPRINT( "Info: ICD loaded." );
|
||||
|
||||
return icd;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Initialize a driver (Load DLL and DrvXxx procs)
|
||||
*
|
||||
* \param icd ICD to initialize with the dll, version, driverVersion
|
||||
* and flags already filled.
|
||||
* \return Error code.
|
||||
* \retval ERROR_SUCCESS Success
|
||||
*/
|
||||
#define LOAD_DRV_PROC( icd, proc, required ) \
|
||||
*(char**)&icd->proc = (char*)GetProcAddress( icd->handle, #proc ); \
|
||||
if (required && icd->proc == NULL) { \
|
||||
DBGPRINT( "Error: GetProcAddress(\"%s\") failed!", #proc ); \
|
||||
FreeLibrary( icd->handle ); \
|
||||
return GetLastError(); \
|
||||
}
|
||||
|
||||
static DWORD
|
||||
OPENGL32_InitializeDriver( GLDRIVERDATA *icd )
|
||||
{
|
||||
/* check version */
|
||||
if (icd->version > 2)
|
||||
DBGPRINT( "Warning: ICD version > 2 (%d)", icd->version );
|
||||
|
||||
/* load dll */
|
||||
icd->handle = LoadLibraryW( icd->dll );
|
||||
if (icd->handle == NULL)
|
||||
{
|
||||
DWORD err = GetLastError();
|
||||
DBGPRINT( "Error: Couldn't load DLL! (%d)", err );
|
||||
return err;
|
||||
}
|
||||
|
||||
/* validate version */
|
||||
if (icd->driver_version > 1)
|
||||
{
|
||||
LOAD_DRV_PROC(icd, DrvValidateVersion, FALSE);
|
||||
if (icd->DrvValidateVersion != NULL)
|
||||
{
|
||||
if (!icd->DrvValidateVersion( icd->driver_version ))
|
||||
{
|
||||
DBGPRINT( "Error: DrvValidateVersion failed!" );
|
||||
DBGBREAK();
|
||||
FreeLibrary( icd->handle );
|
||||
return ERROR_INVALID_FUNCTION; /* FIXME: use better error code */
|
||||
}
|
||||
}
|
||||
else
|
||||
DBGPRINT( "Info: DrvValidateVersion not exported by ICD" );
|
||||
}
|
||||
|
||||
/* load DrvXXX procs */
|
||||
LOAD_DRV_PROC(icd, DrvCopyContext, TRUE);
|
||||
LOAD_DRV_PROC(icd, DrvCreateContext, FALSE);
|
||||
LOAD_DRV_PROC(icd, DrvCreateLayerContext, FALSE);
|
||||
LOAD_DRV_PROC(icd, DrvDeleteContext, TRUE);
|
||||
LOAD_DRV_PROC(icd, DrvDescribeLayerPlane, TRUE);
|
||||
LOAD_DRV_PROC(icd, DrvDescribePixelFormat, TRUE);
|
||||
LOAD_DRV_PROC(icd, DrvGetLayerPaletteEntries, TRUE);
|
||||
LOAD_DRV_PROC(icd, DrvGetProcAddress, TRUE);
|
||||
LOAD_DRV_PROC(icd, DrvReleaseContext, TRUE);
|
||||
LOAD_DRV_PROC(icd, DrvRealizeLayerPalette, TRUE);
|
||||
LOAD_DRV_PROC(icd, DrvSetContext, TRUE);
|
||||
LOAD_DRV_PROC(icd, DrvSetLayerPaletteEntries, TRUE);
|
||||
LOAD_DRV_PROC(icd, DrvSetPixelFormat, TRUE);
|
||||
LOAD_DRV_PROC(icd, DrvShareLists, TRUE);
|
||||
LOAD_DRV_PROC(icd, DrvSwapBuffers, TRUE);
|
||||
LOAD_DRV_PROC(icd, DrvSwapLayerBuffers, TRUE);
|
||||
|
||||
/* we require at least one of DrvCreateContext and DrvCreateLayerContext */
|
||||
if (icd->DrvCreateContext == NULL && icd->DrvCreateLayerContext == NULL)
|
||||
{
|
||||
DBGPRINT( "Error: One of DrvCreateContext/DrvCreateLayerContext is required!" );
|
||||
FreeLibrary( icd->handle );
|
||||
return ERROR_INVALID_FUNCTION; /* FIXME: use better error code... */
|
||||
}
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Unload ICD.
|
||||
*
|
||||
* \retval TRUE Success.
|
||||
* \retval FALSE Failure.
|
||||
*/
|
||||
static BOOL
|
||||
OPENGL32_UnloadDriver( GLDRIVERDATA *icd )
|
||||
{
|
||||
BOOL allOk = TRUE;
|
||||
|
||||
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! (%d)", icd->dll,
|
||||
GetLastError() );
|
||||
}
|
||||
|
||||
/* free resources */
|
||||
OPENGL32_RemoveICD( icd );
|
||||
if (!HeapFree( GetProcessHeap(), 0, icd ))
|
||||
{
|
||||
allOk = FALSE;
|
||||
DBGPRINT( "Warning: HeapFree() returned FALSE, error code = %d",
|
||||
GetLastError() );
|
||||
}
|
||||
|
||||
return allOk;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Load ICD (shared ICD data)
|
||||
*
|
||||
* \return Pointer to an allocated GLDRIVERDATA on success.
|
||||
* \retval NULL Failure.
|
||||
*/
|
||||
GLDRIVERDATA *
|
||||
OPENGL32_LoadICD( LPCWSTR driver )
|
||||
{
|
||||
GLDRIVERDATA *icd;
|
||||
|
||||
/* synchronize */
|
||||
if (WaitForSingleObject( OPENGL32_processdata.driver_mutex, INFINITE ) ==
|
||||
WAIT_FAILED)
|
||||
{
|
||||
DBGPRINT( "Error: WaitForSingleObject() failed (%d)", GetLastError() );
|
||||
return NULL; /* FIXME: do we have to expect such an error and handle it? */
|
||||
}
|
||||
|
||||
/* look if ICD is already loaded */
|
||||
for (icd = OPENGL32_processdata.driver_list; icd; icd = icd->next)
|
||||
{
|
||||
if (!_wcsicmp( driver, icd->driver_name )) /* found */
|
||||
{
|
||||
/* release mutex */
|
||||
if (!ReleaseMutex( OPENGL32_processdata.driver_mutex ))
|
||||
DBGPRINT( "Error: ReleaseMutex() failed (%d)", GetLastError() );
|
||||
|
||||
return icd;
|
||||
}
|
||||
}
|
||||
|
||||
/* not found - try to load */
|
||||
icd = OPENGL32_LoadDriver( driver );
|
||||
|
||||
/* release mutex */
|
||||
if (!ReleaseMutex( OPENGL32_processdata.driver_mutex ))
|
||||
DBGPRINT( "Error: ReleaseMutex() failed (%d)", GetLastError() );
|
||||
|
||||
return icd;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Unload ICD (shared ICD data)
|
||||
*
|
||||
* \retval TRUE Success.
|
||||
* \retval FALSE Failure.
|
||||
*/
|
||||
BOOL
|
||||
OPENGL32_UnloadICD( GLDRIVERDATA *icd )
|
||||
{
|
||||
BOOL ret = TRUE;
|
||||
|
||||
/* synchronize */
|
||||
if (WaitForSingleObject( OPENGL32_processdata.driver_mutex, INFINITE ) ==
|
||||
WAIT_FAILED)
|
||||
{
|
||||
DBGPRINT( "Error: WaitForSingleObject() failed (%d)", GetLastError() );
|
||||
return FALSE; /* FIXME: do we have to expect such an error and handle it? */
|
||||
}
|
||||
|
||||
if (icd->refcount == 0)
|
||||
ret = OPENGL32_UnloadDriver( icd );
|
||||
|
||||
/* release mutex */
|
||||
if (!ReleaseMutex( OPENGL32_processdata.driver_mutex ))
|
||||
DBGPRINT( "Error: ReleaseMutex() failed (%d)", GetLastError() );
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/*! \brief Enumerate OpenGLDrivers (from registry)
|
||||
*
|
||||
* \param idx Index of the driver to get information about.
|
||||
* \param name Pointer to an array of WCHARs (can be NULL)
|
||||
* \param cName Pointer to a DWORD. Input is len of name array.
|
||||
* Output is length of the drivername.
|
||||
* Can be NULL if name is NULL.
|
||||
*
|
||||
* \return Error code
|
||||
* \retval ERROR_NO_MORE_ITEMS End of driver list.
|
||||
* \retval ERROR_SUCCESS Success.
|
||||
*/
|
||||
#if 0 /* unused */
|
||||
DWORD
|
||||
OPENGL32_RegEnumDrivers( DWORD idx, LPWSTR name, LPDWORD cName )
|
||||
{
|
||||
HKEY hKey;
|
||||
LPCWSTR subKey = OPENGL_DRIVERS_SUBKEY;
|
||||
LONG ret;
|
||||
DWORD size;
|
||||
WCHAR driver[256];
|
||||
|
||||
if (name == NULL)
|
||||
return ERROR_SUCCESS; /* nothing to do */
|
||||
|
||||
if (cName == NULL)
|
||||
return ERROR_INVALID_FUNCTION; /* we need cName when name is given */
|
||||
|
||||
/* open OpenGLDrivers registry 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 ret;
|
||||
}
|
||||
|
||||
/* get subkey name */
|
||||
size = sizeof (driver) / sizeof (driver[0]);
|
||||
ret = RegEnumKeyW( hKey, idx, name, *cName );
|
||||
if (ret != ERROR_SUCCESS)
|
||||
{
|
||||
DBGPRINT( "Error: Couldn't get OpenGLDrivers subkey name (%d)", ret );
|
||||
RegCloseKey( hKey );
|
||||
return ret;
|
||||
}
|
||||
*cName = wcslen( name );
|
||||
|
||||
/* close key */
|
||||
RegCloseKey( hKey );
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
#endif /* 0 -- unused */
|
||||
|
||||
|
||||
/*! \brief Get registry values for a driver given a name.
|
||||
*
|
||||
* \param driver Name of the driver to get information about.
|
||||
* \param icd Pointer to GLDRIVERDATA.
|
||||
*
|
||||
* \return Error code.
|
||||
* \retval ERROR_SUCCESS Success.
|
||||
*
|
||||
* \note On success the following fields of \a icd are filled: \a driver_name,
|
||||
* \a dll, \a version, \a driver_version and \a flags.
|
||||
*/
|
||||
static DWORD
|
||||
OPENGL32_RegGetDriverInfo( LPCWSTR driver, GLDRIVERDATA *icd )
|
||||
{
|
||||
HKEY hKey;
|
||||
WCHAR subKey[1024] = OPENGL_DRIVERS_SUBKEY2;
|
||||
LONG ret;
|
||||
DWORD type, size;
|
||||
|
||||
/* drivers registry values */
|
||||
DWORD version = 1, driverVersion = 0, flags = 0;
|
||||
WCHAR dll[256];
|
||||
|
||||
/* open driver 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'", subKey );
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* query values */
|
||||
size = sizeof (dll);
|
||||
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" );
|
||||
RegCloseKey( hKey );
|
||||
return ret;
|
||||
}
|
||||
|
||||
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" );
|
||||
|
||||
size = sizeof (DWORD);
|
||||
ret = RegQueryValueExW( hKey, L"DriverVersion", 0, &type,
|
||||
(LPBYTE)&driverVersion, &size );
|
||||
if (ret != ERROR_SUCCESS || type != REG_DWORD)
|
||||
DBGPRINT( "Warning: Couldn't query DriverVersion value or not a DWORD" );
|
||||
|
||||
size = sizeof (DWORD);
|
||||
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" );
|
||||
|
||||
/* close key */
|
||||
RegCloseKey( hKey );
|
||||
|
||||
/* output data */
|
||||
/* FIXME: NUL-terminate strings? */
|
||||
wcsncpy( icd->driver_name, driver,
|
||||
sizeof (icd->driver_name) / sizeof (icd->driver_name[0]) - 1 );
|
||||
wcsncpy( icd->dll, dll,
|
||||
sizeof (icd->dll) / sizeof (icd->dll[0]) );
|
||||
icd->version = version;
|
||||
icd->driver_version = driverVersion;
|
||||
icd->flags = flags;
|
||||
|
||||
return ERROR_SUCCESS;
|
||||
}
|
||||
|
||||
/* EOF */
|
||||
|
181
dll/opengl/opengl32/opengl32.dsp
Normal file
181
dll/opengl/opengl32/opengl32.dsp
Normal file
|
@ -0,0 +1,181 @@
|
|||
# Microsoft Developer Studio Project File - Name="opengl32" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
|
||||
|
||||
CFG=opengl32 - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "opengl32.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "opengl32.mak" CFG="opengl32 - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "opengl32 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE "opengl32 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "opengl32 - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OPENGL32_EXPORTS" /YX /FD /c
|
||||
# ADD CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OPENGL32_EXPORTS" /YX /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "NDEBUG"
|
||||
# ADD RSC /l 0x409 /d "NDEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "opengl32 - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 0
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 0
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Ignore_Export_Lib 0
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OPENGL32_EXPORTS" /YX /FD /GZ /c
|
||||
# ADD CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "OPENGL32_EXPORTS" /YX /FD /TP /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x409 /d "_DEBUG"
|
||||
# ADD RSC /l 0x409 /d "_DEBUG"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 gdi32.lib advapi32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "opengl32 - Win32 Release"
|
||||
# Name "opengl32 - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\gl.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\opengl32.c
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\tebimports.asm
|
||||
|
||||
!IF "$(CFG)" == "opengl32 - Win32 Release"
|
||||
|
||||
# Begin Custom Build - Compiling $(InputPath)
|
||||
IntDir=.\Release
|
||||
InputPath=.\tebimports.asm
|
||||
InputName=tebimports
|
||||
|
||||
"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
nasmw.exe -f win32 $(InputPath) -o "$(IntDir)/$(InputName).obj"
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ELSEIF "$(CFG)" == "opengl32 - Win32 Debug"
|
||||
|
||||
# Begin Custom Build - Compiling $(InputPath)
|
||||
IntDir=.\Debug
|
||||
InputPath=.\tebimports.asm
|
||||
InputName=tebimports
|
||||
|
||||
"$(IntDir)/$(InputName).obj" : $(SOURCE) "$(INTDIR)" "$(OUTDIR)"
|
||||
nasmw.exe -f win32 -d win32 $(InputPath) -o "$(IntDir)/$(InputName).obj"
|
||||
|
||||
# End Custom Build
|
||||
|
||||
!ENDIF
|
||||
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\wgl.c
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\glfuncs.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\icdlist.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\icdtable.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\opengl32.def
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\opengl32.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\slowlist.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\teb.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\teblist.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\teblist.mac
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# End Group
|
||||
# End Target
|
||||
# End Project
|
29
dll/opengl/opengl32/opengl32.dsw
Normal file
29
dll/opengl/opengl32/opengl32.dsw
Normal file
|
@ -0,0 +1,29 @@
|
|||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "opengl32"=.\opengl32.dsp - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
222
dll/opengl/opengl32/opengl32.h
Normal file
222
dll/opengl/opengl32/opengl32.h
Normal file
|
@ -0,0 +1,222 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS kernel
|
||||
* FILE: lib/opengl32/opengl.h
|
||||
* PURPOSE: OpenGL32 lib, general header
|
||||
*/
|
||||
|
||||
#ifndef _OPENGL32_PCH_
|
||||
#define _OPENGL32_PCH_
|
||||
|
||||
#define WIN32_NO_STATUS
|
||||
#include <stdarg.h>
|
||||
#include <windef.h>
|
||||
#include <winbase.h>
|
||||
#include <winuser.h>
|
||||
#include <wingdi.h>
|
||||
#include <winddi.h>
|
||||
#include <GL/gl.h>
|
||||
|
||||
#include <wine/debug.h>
|
||||
|
||||
#include "icd.h"
|
||||
|
||||
/* *$%$£^§! headers inclusion */
|
||||
static __inline
|
||||
BOOLEAN
|
||||
RemoveEntryList(
|
||||
_In_ PLIST_ENTRY Entry)
|
||||
{
|
||||
PLIST_ENTRY OldFlink;
|
||||
PLIST_ENTRY OldBlink;
|
||||
|
||||
OldFlink = Entry->Flink;
|
||||
OldBlink = Entry->Blink;
|
||||
OldFlink->Blink = OldBlink;
|
||||
OldBlink->Flink = OldFlink;
|
||||
return (OldFlink == OldBlink);
|
||||
}
|
||||
|
||||
static __inline
|
||||
VOID
|
||||
InsertTailList(
|
||||
_In_ PLIST_ENTRY ListHead,
|
||||
_In_ PLIST_ENTRY Entry
|
||||
)
|
||||
{
|
||||
PLIST_ENTRY OldBlink;
|
||||
OldBlink = ListHead->Blink;
|
||||
Entry->Flink = ListHead;
|
||||
Entry->Blink = OldBlink;
|
||||
OldBlink->Flink = Entry;
|
||||
ListHead->Blink = Entry;
|
||||
}
|
||||
|
||||
|
||||
static __inline
|
||||
VOID
|
||||
InitializeListHead(
|
||||
_Inout_ PLIST_ENTRY ListHead
|
||||
)
|
||||
{
|
||||
ListHead->Flink = ListHead->Blink = ListHead;
|
||||
}
|
||||
|
||||
extern LIST_ENTRY ContextListHead;
|
||||
|
||||
struct wgl_context
|
||||
{
|
||||
DWORD magic;
|
||||
volatile LONG lock;
|
||||
|
||||
LIST_ENTRY ListEntry;
|
||||
|
||||
DHGLRC dhglrc;
|
||||
struct ICD_Data* icd_data;
|
||||
INT pixelformat;
|
||||
volatile LONG thread_id;
|
||||
};
|
||||
|
||||
#define WGL_DC_OBJ_DC 0x1
|
||||
struct wgl_dc_data
|
||||
{
|
||||
/* Header */
|
||||
union
|
||||
{
|
||||
HWND hwnd;
|
||||
HDC hdc;
|
||||
HANDLE u;
|
||||
} owner;
|
||||
ULONG flags;
|
||||
|
||||
/* Pixel format */
|
||||
INT pixelformat;
|
||||
|
||||
/* ICD */
|
||||
struct ICD_Data* icd_data;
|
||||
INT nb_icd_formats;
|
||||
|
||||
/* Software implementation */
|
||||
INT nb_sw_formats;
|
||||
void* sw_data;
|
||||
|
||||
/* Linked list */
|
||||
struct wgl_dc_data* next;
|
||||
};
|
||||
|
||||
/* Clean up functions */
|
||||
void IntDeleteAllContexts(void);
|
||||
void IntDeleteAllICDs(void);
|
||||
|
||||
#ifdef OPENGL32_USE_TLS
|
||||
extern DWORD OglTlsIndex;
|
||||
|
||||
struct Opengl32_ThreadData
|
||||
{
|
||||
const GLDISPATCHTABLE* glDispatchTable;
|
||||
HGLRC hglrc;
|
||||
HDC hdc;
|
||||
struct wgl_dc_data* dc_data;
|
||||
PVOID* icdData;
|
||||
};
|
||||
C_ASSERT(FIELD_OFFSET(struct Opengl32_ThreadData, glDispatchTable) == 0);
|
||||
|
||||
static inline
|
||||
void
|
||||
IntMakeCurrent(HGLRC hglrc, HDC hdc, struct wgl_dc_data* dc_data)
|
||||
{
|
||||
struct Opengl32_ThreadData* thread_data = TlsGetValue(OglTlsIndex);
|
||||
|
||||
thread_data->hglrc = hglrc;
|
||||
thread_data->hdc = hdc;
|
||||
thread_data->dc_data = dc_data;
|
||||
}
|
||||
|
||||
static inline
|
||||
HGLRC
|
||||
IntGetCurrentRC(void)
|
||||
{
|
||||
struct Opengl32_ThreadData* data = TlsGetValue(OglTlsIndex);
|
||||
return data ? data->hglrc : NULL;
|
||||
}
|
||||
|
||||
static inline
|
||||
DHGLRC
|
||||
IntGetCurrentDHGLRC(void)
|
||||
{
|
||||
struct wgl_context* ctx = (struct wgl_context*)IntGetCurrentRC();
|
||||
if(!ctx) return NULL;
|
||||
return ctx->dhglrc;
|
||||
}
|
||||
|
||||
static inline
|
||||
HDC
|
||||
IntGetCurrentDC(void)
|
||||
{
|
||||
struct Opengl32_ThreadData* data = TlsGetValue(OglTlsIndex);
|
||||
return data->hdc;
|
||||
}
|
||||
|
||||
static inline
|
||||
struct wgl_dc_data*
|
||||
IntGetCurrentDcData(void)
|
||||
{
|
||||
struct Opengl32_ThreadData* data = TlsGetValue(OglTlsIndex);
|
||||
return data->dc_data;
|
||||
}
|
||||
|
||||
static inline
|
||||
const GLDISPATCHTABLE *
|
||||
IntGetCurrentDispatchTable(void)
|
||||
{
|
||||
struct Opengl32_ThreadData* data = TlsGetValue(OglTlsIndex);
|
||||
return data->glDispatchTable;
|
||||
}
|
||||
|
||||
static inline
|
||||
void
|
||||
IntSetCurrentDispatchTable(const GLDISPATCHTABLE* table)
|
||||
{
|
||||
struct Opengl32_ThreadData* data = TlsGetValue(OglTlsIndex);
|
||||
data->glDispatchTable = table;
|
||||
}
|
||||
|
||||
static inline
|
||||
void
|
||||
IntSetCurrentICDPrivate(void* value)
|
||||
{
|
||||
struct Opengl32_ThreadData* data = TlsGetValue(OglTlsIndex);
|
||||
data->icdData = value;
|
||||
}
|
||||
|
||||
static inline
|
||||
void*
|
||||
IntGetCurrentICDPrivate(void)
|
||||
{
|
||||
struct Opengl32_ThreadData* data = TlsGetValue(OglTlsIndex);
|
||||
return data->icdData;
|
||||
}
|
||||
|
||||
|
||||
#else
|
||||
static inline
|
||||
const GLDISPATCHTABLE*
|
||||
IntGetCurrentDispatchTable(void)
|
||||
{
|
||||
return (GLDISPATCHTABLE*)NtCurrentTeb()->glTable;
|
||||
}
|
||||
#endif // defined(OPENGL32_USE_TLS)
|
||||
|
||||
/* Software implementation functions */
|
||||
INT sw_DescribePixelFormat(HDC hdc, INT format, UINT size, PIXELFORMATDESCRIPTOR* descr);
|
||||
BOOL sw_SetPixelFormat(HDC hdc, struct wgl_dc_data*, INT format);
|
||||
DHGLRC sw_CreateContext(struct wgl_dc_data*);
|
||||
BOOL sw_DeleteContext(DHGLRC dhglrc);
|
||||
BOOL sw_SetContext(struct wgl_dc_data* dc_data, DHGLRC dhglrc);
|
||||
void sw_ReleaseContext(DHGLRC hglrc);
|
||||
PROC sw_GetProcAddress(LPCSTR name);
|
||||
BOOL sw_CopyContext(DHGLRC dhglrcSrc, DHGLRC dhglrcDst, UINT mask);
|
||||
BOOL sw_ShareLists(DHGLRC dhglrcSrc, DHGLRC dhglrcDst);
|
||||
BOOL sw_SwapBuffers(HDC hdc, struct wgl_dc_data* dc_data);
|
||||
|
||||
#endif /* _OPENGL32_PCH_ */
|
369
dll/opengl/opengl32/opengl32.spec
Normal file
369
dll/opengl/opengl32/opengl32.spec
Normal file
|
@ -0,0 +1,369 @@
|
|||
@ stub GlmfBeginGlsBlock
|
||||
@ stub GlmfCloseMetaFile
|
||||
@ stub GlmfEndGlsBlock
|
||||
@ stub GlmfEndPlayback
|
||||
@ stub GlmfInitPlayback
|
||||
@ stub GlmfPlayGlsRecord
|
||||
@ stdcall glAccum( long long )
|
||||
@ stdcall glAlphaFunc( long long )
|
||||
@ stdcall glAreTexturesResident( long ptr ptr )
|
||||
@ stdcall glArrayElement( long )
|
||||
@ stdcall glBegin( long )
|
||||
@ stdcall glBindTexture( long long )
|
||||
@ stdcall glBitmap( long long long long long long ptr )
|
||||
@ stdcall glBlendFunc( long long )
|
||||
@ stdcall glCallList( long )
|
||||
@ stdcall glCallLists( long long ptr )
|
||||
@ stdcall glClear( long )
|
||||
@ stdcall glClearAccum( long long long long )
|
||||
@ stdcall glClearColor( long long long long )
|
||||
@ stdcall glClearDepth( double )
|
||||
@ stdcall glClearIndex( long )
|
||||
@ stdcall glClearStencil( long )
|
||||
@ stdcall glClipPlane( long ptr )
|
||||
@ stdcall glColor3b( long long long )
|
||||
@ stdcall glColor3bv( ptr )
|
||||
@ stdcall glColor3d( double double double )
|
||||
@ stdcall glColor3dv( ptr )
|
||||
@ stdcall glColor3f( long long long )
|
||||
@ stdcall glColor3fv( ptr )
|
||||
@ stdcall glColor3i( long long long )
|
||||
@ stdcall glColor3iv( ptr )
|
||||
@ stdcall glColor3s( long long long )
|
||||
@ stdcall glColor3sv( ptr )
|
||||
@ stdcall glColor3ub( long long long )
|
||||
@ stdcall glColor3ubv( ptr )
|
||||
@ stdcall glColor3ui( long long long )
|
||||
@ stdcall glColor3uiv( ptr )
|
||||
@ stdcall glColor3us( long long long )
|
||||
@ stdcall glColor3usv( ptr )
|
||||
@ stdcall glColor4b( long long long long )
|
||||
@ stdcall glColor4bv( ptr )
|
||||
@ stdcall glColor4d( double double double double )
|
||||
@ stdcall glColor4dv( ptr )
|
||||
@ stdcall glColor4f( long long long long )
|
||||
@ stdcall glColor4fv( ptr )
|
||||
@ stdcall glColor4i( long long long long )
|
||||
@ stdcall glColor4iv( ptr )
|
||||
@ stdcall glColor4s( long long long long )
|
||||
@ stdcall glColor4sv( ptr )
|
||||
@ stdcall glColor4ub( long long long long )
|
||||
@ stdcall glColor4ubv( ptr )
|
||||
@ stdcall glColor4ui( long long long long )
|
||||
@ stdcall glColor4uiv( ptr )
|
||||
@ stdcall glColor4us( long long long long )
|
||||
@ stdcall glColor4usv( ptr )
|
||||
@ stdcall glColorMask( long long long long )
|
||||
@ stdcall glColorMaterial( long long )
|
||||
@ stdcall glColorPointer( long long long ptr )
|
||||
@ stdcall glCopyPixels( long long long long long )
|
||||
@ stdcall glCopyTexImage1D( long long long long long long long )
|
||||
@ stdcall glCopyTexImage2D( long long long long long long long long )
|
||||
@ stdcall glCopyTexSubImage1D( long long long long long long )
|
||||
@ stdcall glCopyTexSubImage2D( long long long long long long long long )
|
||||
@ stdcall glCullFace( long )
|
||||
@ stdcall glDebugEntry(long long)
|
||||
@ stdcall glDeleteLists( long long )
|
||||
@ stdcall glDeleteTextures( long ptr )
|
||||
@ stdcall glDepthFunc( long )
|
||||
@ stdcall glDepthMask( long )
|
||||
@ stdcall glDepthRange( double double )
|
||||
@ stdcall glDisable( long )
|
||||
@ stdcall glDisableClientState( long )
|
||||
@ stdcall glDrawArrays( long long long )
|
||||
@ stdcall glDrawBuffer( long )
|
||||
@ stdcall glDrawElements( long long long ptr )
|
||||
@ stdcall glDrawPixels( long long long long ptr )
|
||||
@ stdcall glEdgeFlag( long )
|
||||
@ stdcall glEdgeFlagPointer( long ptr )
|
||||
@ stdcall glEdgeFlagv( ptr )
|
||||
@ stdcall glEnable( long )
|
||||
@ stdcall glEnableClientState( long )
|
||||
@ stdcall glEnd( )
|
||||
@ stdcall glEndList( )
|
||||
@ stdcall glEvalCoord1d( double )
|
||||
@ stdcall glEvalCoord1dv( ptr )
|
||||
@ stdcall glEvalCoord1f( long )
|
||||
@ stdcall glEvalCoord1fv( ptr )
|
||||
@ stdcall glEvalCoord2d( double double )
|
||||
@ stdcall glEvalCoord2dv( ptr )
|
||||
@ stdcall glEvalCoord2f( long long )
|
||||
@ stdcall glEvalCoord2fv( ptr )
|
||||
@ stdcall glEvalMesh1( long long long )
|
||||
@ stdcall glEvalMesh2( long long long long long )
|
||||
@ stdcall glEvalPoint1( long )
|
||||
@ stdcall glEvalPoint2( long long )
|
||||
@ stdcall glFeedbackBuffer( long long ptr )
|
||||
@ stdcall glFinish( )
|
||||
@ stdcall glFlush( )
|
||||
@ stdcall glFogf( long long )
|
||||
@ stdcall glFogfv( long ptr )
|
||||
@ stdcall glFogi( long long )
|
||||
@ stdcall glFogiv( long ptr )
|
||||
@ stdcall glFrontFace( long )
|
||||
@ stdcall glFrustum( double double double double double double )
|
||||
@ stdcall glGenLists( long )
|
||||
@ stdcall glGenTextures( long ptr )
|
||||
@ stdcall glGetBooleanv( long ptr )
|
||||
@ stdcall glGetClipPlane( long ptr )
|
||||
@ stdcall glGetDoublev( long ptr )
|
||||
@ stdcall glGetError( )
|
||||
@ stdcall glGetFloatv( long ptr )
|
||||
@ stdcall glGetIntegerv( long ptr )
|
||||
@ stdcall glGetLightfv( long long ptr )
|
||||
@ stdcall glGetLightiv( long long ptr )
|
||||
@ stdcall glGetMapdv( long long ptr )
|
||||
@ stdcall glGetMapfv( long long ptr )
|
||||
@ stdcall glGetMapiv( long long ptr )
|
||||
@ stdcall glGetMaterialfv( long long ptr )
|
||||
@ stdcall glGetMaterialiv( long long ptr )
|
||||
@ stdcall glGetPixelMapfv( long ptr )
|
||||
@ stdcall glGetPixelMapuiv( long ptr )
|
||||
@ stdcall glGetPixelMapusv( long ptr )
|
||||
@ stdcall glGetPointerv( long ptr )
|
||||
@ stdcall glGetPolygonStipple( ptr )
|
||||
@ stdcall glGetString( long )
|
||||
@ stdcall glGetTexEnvfv( long long ptr )
|
||||
@ stdcall glGetTexEnviv( long long ptr )
|
||||
@ stdcall glGetTexGendv( long long ptr )
|
||||
@ stdcall glGetTexGenfv( long long ptr )
|
||||
@ stdcall glGetTexGeniv( long long ptr )
|
||||
@ stdcall glGetTexImage( long long long long ptr )
|
||||
@ stdcall glGetTexLevelParameterfv( long long long ptr )
|
||||
@ stdcall glGetTexLevelParameteriv( long long long ptr )
|
||||
@ stdcall glGetTexParameterfv( long long ptr )
|
||||
@ stdcall glGetTexParameteriv( long long ptr )
|
||||
@ stdcall glHint( long long )
|
||||
@ stdcall glIndexMask( long )
|
||||
@ stdcall glIndexPointer( long long ptr )
|
||||
@ stdcall glIndexd( double )
|
||||
@ stdcall glIndexdv( ptr )
|
||||
@ stdcall glIndexf( long )
|
||||
@ stdcall glIndexfv( ptr )
|
||||
@ stdcall glIndexi( long )
|
||||
@ stdcall glIndexiv( ptr )
|
||||
@ stdcall glIndexs( long )
|
||||
@ stdcall glIndexsv( ptr )
|
||||
@ stdcall glIndexub( long )
|
||||
@ stdcall glIndexubv( ptr )
|
||||
@ stdcall glInitNames( )
|
||||
@ stdcall glInterleavedArrays( long long ptr )
|
||||
@ stdcall glIsEnabled( long )
|
||||
@ stdcall glIsList( long )
|
||||
@ stdcall glIsTexture( long )
|
||||
@ stdcall glLightModelf( long long )
|
||||
@ stdcall glLightModelfv( long ptr )
|
||||
@ stdcall glLightModeli( long long )
|
||||
@ stdcall glLightModeliv( long ptr )
|
||||
@ stdcall glLightf( long long long )
|
||||
@ stdcall glLightfv( long long ptr )
|
||||
@ stdcall glLighti( long long long )
|
||||
@ stdcall glLightiv( long long ptr )
|
||||
@ stdcall glLineStipple( long long )
|
||||
@ stdcall glLineWidth( long )
|
||||
@ stdcall glListBase( long )
|
||||
@ stdcall glLoadIdentity( )
|
||||
@ stdcall glLoadMatrixd( ptr )
|
||||
@ stdcall glLoadMatrixf( ptr )
|
||||
@ stdcall glLoadName( long )
|
||||
@ stdcall glLogicOp( long )
|
||||
@ stdcall glMap1d( long double double long long ptr )
|
||||
@ stdcall glMap1f( long long long long long ptr )
|
||||
@ stdcall glMap2d( long double double long long double double long long ptr )
|
||||
@ stdcall glMap2f( long long long long long long long long long ptr )
|
||||
@ stdcall glMapGrid1d( long double double )
|
||||
@ stdcall glMapGrid1f( long long long )
|
||||
@ stdcall glMapGrid2d( long double double long double double )
|
||||
@ stdcall glMapGrid2f( long long long long long long )
|
||||
@ stdcall glMaterialf( long long long )
|
||||
@ stdcall glMaterialfv( long long ptr )
|
||||
@ stdcall glMateriali( long long long )
|
||||
@ stdcall glMaterialiv( long long ptr )
|
||||
@ stdcall glMatrixMode( long )
|
||||
@ stdcall glMultMatrixd( ptr )
|
||||
@ stdcall glMultMatrixf( ptr )
|
||||
@ stdcall glNewList( long long )
|
||||
@ stdcall glNormal3b( long long long )
|
||||
@ stdcall glNormal3bv( ptr )
|
||||
@ stdcall glNormal3d( double double double )
|
||||
@ stdcall glNormal3dv( ptr )
|
||||
@ stdcall glNormal3f( long long long )
|
||||
@ stdcall glNormal3fv( ptr )
|
||||
@ stdcall glNormal3i( long long long )
|
||||
@ stdcall glNormal3iv( ptr )
|
||||
@ stdcall glNormal3s( long long long )
|
||||
@ stdcall glNormal3sv( ptr )
|
||||
@ stdcall glNormalPointer( long long ptr )
|
||||
@ stdcall glOrtho( double double double double double double )
|
||||
@ stdcall glPassThrough( long )
|
||||
@ stdcall glPixelMapfv( long long ptr )
|
||||
@ stdcall glPixelMapuiv( long long ptr )
|
||||
@ stdcall glPixelMapusv( long long ptr )
|
||||
@ stdcall glPixelStoref( long long )
|
||||
@ stdcall glPixelStorei( long long )
|
||||
@ stdcall glPixelTransferf( long long )
|
||||
@ stdcall glPixelTransferi( long long )
|
||||
@ stdcall glPixelZoom( long long )
|
||||
@ stdcall glPointSize( long )
|
||||
@ stdcall glPolygonMode( long long )
|
||||
@ stdcall glPolygonOffset( long long )
|
||||
@ stdcall glPolygonStipple( ptr )
|
||||
@ stdcall glPopAttrib( )
|
||||
@ stdcall glPopClientAttrib( )
|
||||
@ stdcall glPopMatrix( )
|
||||
@ stdcall glPopName( )
|
||||
@ stdcall glPrioritizeTextures( long ptr ptr )
|
||||
@ stdcall glPushAttrib( long )
|
||||
@ stdcall glPushClientAttrib( long )
|
||||
@ stdcall glPushMatrix( )
|
||||
@ stdcall glPushName( long )
|
||||
@ stdcall glRasterPos2d( double double )
|
||||
@ stdcall glRasterPos2dv( ptr )
|
||||
@ stdcall glRasterPos2f( long long )
|
||||
@ stdcall glRasterPos2fv( ptr )
|
||||
@ stdcall glRasterPos2i( long long )
|
||||
@ stdcall glRasterPos2iv( ptr )
|
||||
@ stdcall glRasterPos2s( long long )
|
||||
@ stdcall glRasterPos2sv( ptr )
|
||||
@ stdcall glRasterPos3d( double double double )
|
||||
@ stdcall glRasterPos3dv( ptr )
|
||||
@ stdcall glRasterPos3f( long long long )
|
||||
@ stdcall glRasterPos3fv( ptr )
|
||||
@ stdcall glRasterPos3i( long long long )
|
||||
@ stdcall glRasterPos3iv( ptr )
|
||||
@ stdcall glRasterPos3s( long long long )
|
||||
@ stdcall glRasterPos3sv( ptr )
|
||||
@ stdcall glRasterPos4d( double double double double )
|
||||
@ stdcall glRasterPos4dv( ptr )
|
||||
@ stdcall glRasterPos4f( long long long long )
|
||||
@ stdcall glRasterPos4fv( ptr )
|
||||
@ stdcall glRasterPos4i( long long long long )
|
||||
@ stdcall glRasterPos4iv( ptr )
|
||||
@ stdcall glRasterPos4s( long long long long )
|
||||
@ stdcall glRasterPos4sv( ptr )
|
||||
@ stdcall glReadBuffer( long )
|
||||
@ stdcall glReadPixels( long long long long long long ptr )
|
||||
@ stdcall glRectd( double double double double )
|
||||
@ stdcall glRectdv( ptr ptr )
|
||||
@ stdcall glRectf( long long long long )
|
||||
@ stdcall glRectfv( ptr ptr )
|
||||
@ stdcall glRecti( long long long long )
|
||||
@ stdcall glRectiv( ptr ptr )
|
||||
@ stdcall glRects( long long long long )
|
||||
@ stdcall glRectsv( ptr ptr )
|
||||
@ stdcall glRenderMode( long )
|
||||
@ stdcall glRotated( double double double double )
|
||||
@ stdcall glRotatef( long long long long )
|
||||
@ stdcall glScaled( double double double )
|
||||
@ stdcall glScalef( long long long )
|
||||
@ stdcall glScissor( long long long long )
|
||||
@ stdcall glSelectBuffer( long ptr )
|
||||
@ stdcall glShadeModel( long )
|
||||
@ stdcall glStencilFunc( long long long )
|
||||
@ stdcall glStencilMask( long )
|
||||
@ stdcall glStencilOp( long long long )
|
||||
@ stdcall glTexCoord1d( double )
|
||||
@ stdcall glTexCoord1dv( ptr )
|
||||
@ stdcall glTexCoord1f( long )
|
||||
@ stdcall glTexCoord1fv( ptr )
|
||||
@ stdcall glTexCoord1i( long )
|
||||
@ stdcall glTexCoord1iv( ptr )
|
||||
@ stdcall glTexCoord1s( long )
|
||||
@ stdcall glTexCoord1sv( ptr )
|
||||
@ stdcall glTexCoord2d( double double )
|
||||
@ stdcall glTexCoord2dv( ptr )
|
||||
@ stdcall glTexCoord2f( long long )
|
||||
@ stdcall glTexCoord2fv( ptr )
|
||||
@ stdcall glTexCoord2i( long long )
|
||||
@ stdcall glTexCoord2iv( ptr )
|
||||
@ stdcall glTexCoord2s( long long )
|
||||
@ stdcall glTexCoord2sv( ptr )
|
||||
@ stdcall glTexCoord3d( double double double )
|
||||
@ stdcall glTexCoord3dv( ptr )
|
||||
@ stdcall glTexCoord3f( long long long )
|
||||
@ stdcall glTexCoord3fv( ptr )
|
||||
@ stdcall glTexCoord3i( long long long )
|
||||
@ stdcall glTexCoord3iv( ptr )
|
||||
@ stdcall glTexCoord3s( long long long )
|
||||
@ stdcall glTexCoord3sv( ptr )
|
||||
@ stdcall glTexCoord4d( double double double double )
|
||||
@ stdcall glTexCoord4dv( ptr )
|
||||
@ stdcall glTexCoord4f( long long long long )
|
||||
@ stdcall glTexCoord4fv( ptr )
|
||||
@ stdcall glTexCoord4i( long long long long )
|
||||
@ stdcall glTexCoord4iv( ptr )
|
||||
@ stdcall glTexCoord4s( long long long long )
|
||||
@ stdcall glTexCoord4sv( ptr )
|
||||
@ stdcall glTexCoordPointer( long long long ptr )
|
||||
@ stdcall glTexEnvf( long long long )
|
||||
@ stdcall glTexEnvfv( long long ptr )
|
||||
@ stdcall glTexEnvi( long long long )
|
||||
@ stdcall glTexEnviv( long long ptr )
|
||||
@ stdcall glTexGend( long long double )
|
||||
@ stdcall glTexGendv( long long ptr )
|
||||
@ stdcall glTexGenf( long long long )
|
||||
@ stdcall glTexGenfv( long long ptr )
|
||||
@ stdcall glTexGeni( long long long )
|
||||
@ stdcall glTexGeniv( long long ptr )
|
||||
@ stdcall glTexImage1D( long long long long long long long ptr )
|
||||
@ stdcall glTexImage2D( long long long long long long long long ptr )
|
||||
@ stdcall glTexParameterf( long long long )
|
||||
@ stdcall glTexParameterfv( long long ptr )
|
||||
@ stdcall glTexParameteri( long long long )
|
||||
@ stdcall glTexParameteriv( long long ptr )
|
||||
@ stdcall glTexSubImage1D( long long long long long long ptr )
|
||||
@ stdcall glTexSubImage2D( long long long long long long long long ptr )
|
||||
@ stdcall glTranslated( double double double )
|
||||
@ stdcall glTranslatef( long long long )
|
||||
@ stdcall glVertex2d( double double )
|
||||
@ stdcall glVertex2dv( ptr )
|
||||
@ stdcall glVertex2f( long long )
|
||||
@ stdcall glVertex2fv( ptr )
|
||||
@ stdcall glVertex2i( long long )
|
||||
@ stdcall glVertex2iv( ptr )
|
||||
@ stdcall glVertex2s( long long )
|
||||
@ stdcall glVertex2sv( ptr )
|
||||
@ stdcall glVertex3d( double double double )
|
||||
@ stdcall glVertex3dv( ptr )
|
||||
@ stdcall glVertex3f( long long long )
|
||||
@ stdcall glVertex3fv( ptr )
|
||||
@ stdcall glVertex3i( long long long )
|
||||
@ stdcall glVertex3iv( ptr )
|
||||
@ stdcall glVertex3s( long long long )
|
||||
@ stdcall glVertex3sv( ptr )
|
||||
@ stdcall glVertex4d( double double double double )
|
||||
@ stdcall glVertex4dv( ptr )
|
||||
@ stdcall glVertex4f( long long long long )
|
||||
@ stdcall glVertex4fv( ptr )
|
||||
@ stdcall glVertex4i( long long long long )
|
||||
@ stdcall glVertex4iv( ptr )
|
||||
@ stdcall glVertex4s( long long long long )
|
||||
@ stdcall glVertex4sv( ptr )
|
||||
@ stdcall glVertexPointer( long long long ptr )
|
||||
@ stdcall glViewport( long long long long )
|
||||
|
||||
@ stdcall wglChoosePixelFormat(long ptr)
|
||||
@ stdcall wglCopyContext(long long long)
|
||||
@ stdcall wglCreateContext(long)
|
||||
@ stdcall wglCreateLayerContext(long long)
|
||||
@ stdcall wglDeleteContext(long)
|
||||
@ stdcall wglDescribeLayerPlane(long long long long ptr)
|
||||
@ stdcall wglDescribePixelFormat(long long long ptr)
|
||||
@ stdcall wglGetCurrentContext()
|
||||
@ stdcall wglGetCurrentDC()
|
||||
@ stdcall wglGetDefaultProcAddress(str)
|
||||
@ stdcall wglGetLayerPaletteEntries(long long long long ptr)
|
||||
@ stdcall wglGetPixelFormat(long)
|
||||
@ stdcall wglGetProcAddress(str)
|
||||
@ stdcall wglMakeCurrent(long long)
|
||||
@ stdcall wglRealizeLayerPalette(long long long)
|
||||
@ stdcall wglSetLayerPaletteEntries(long long long long ptr)
|
||||
@ stdcall wglSetPixelFormat(long long ptr)
|
||||
@ stdcall wglShareLists(long long)
|
||||
@ stdcall wglSwapBuffers(long)
|
||||
@ stdcall wglSwapLayerBuffers(long long)
|
||||
@ stdcall wglSwapMultipleBuffers(long ptr)
|
||||
@ stdcall wglUseFontBitmapsA(long long long long)
|
||||
@ stdcall wglUseFontBitmapsW(long long long long)
|
||||
@ stdcall wglUseFontOutlinesA(long long long long long long long ptr)
|
||||
@ stdcall wglUseFontOutlinesW(long long long long long long long ptr)
|
820
dll/opengl/opengl32/swimpl.c
Normal file
820
dll/opengl/opengl32/swimpl.c
Normal file
|
@ -0,0 +1,820 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS
|
||||
* FILE: dll/opengl/opengl32/swimpl.c
|
||||
* PURPOSE: OpenGL32 DLL, opengl software implementation
|
||||
*/
|
||||
|
||||
#include "opengl32.h"
|
||||
|
||||
/* MESA includes */
|
||||
#include <main/context.h>
|
||||
#include <main/framebuffer.h>
|
||||
#include <main/renderbuffer.h>
|
||||
#include <main/shared.h>
|
||||
#include <main/viewport.h>
|
||||
#include <swrast/s_context.h>
|
||||
#include <swrast/s_renderbuffer.h>
|
||||
#include <swrast_setup/swrast_setup.h>
|
||||
#include <tnl/t_pipeline.h>
|
||||
#include <tnl/tnl.h>
|
||||
#include <drivers/common/driverfuncs.h>
|
||||
#include <drivers/common/meta.h>
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(opengl32);
|
||||
|
||||
#define WIDTH_BYTES_ALIGN32(cx, bpp) ((((cx) * (bpp) + 31) & ~31) >> 3)
|
||||
|
||||
static const struct
|
||||
{
|
||||
gl_format mesa;
|
||||
BYTE color_bits;
|
||||
BYTE red_bits, red_shift; DWORD red_mask;
|
||||
BYTE green_bits, green_shift; DWORD green_mask;
|
||||
BYTE blue_bits, blue_shift; DWORD blue_mask;
|
||||
BYTE alpha_bits, alpha_shift; DWORD alpha_mask;
|
||||
BYTE accum_bits;
|
||||
BYTE depth_bits;
|
||||
BYTE stencil_bits;
|
||||
DWORD bmp_compression;
|
||||
} pixel_formats[] =
|
||||
{
|
||||
{ MESA_FORMAT_ARGB8888, 32, 8, 8, 0x00FF0000, 8, 16, 0x0000FF00, 8, 24, 0x000000FF, 8, 0, 0xFF000000, 16, 32, 8, BI_BITFIELDS },
|
||||
{ MESA_FORMAT_ARGB8888, 32, 8, 8, 0x00FF0000, 8, 16, 0x0000FF00, 8, 24, 0x000000FF, 8, 0, 0xFF000000, 16, 16, 8, BI_BITFIELDS },
|
||||
{ MESA_FORMAT_RGBA8888_REV, 32, 8, 8, 0x000000FF, 8, 16, 0x0000FF00, 8, 24, 0x00FF0000, 8, 0, 0xFF000000, 16, 32, 8, BI_BITFIELDS },
|
||||
{ MESA_FORMAT_RGBA8888_REV, 32, 8, 8, 0x000000FF, 8, 16, 0x0000FF00, 8, 24, 0x00FF0000, 8, 0, 0xFF000000, 16, 16, 8, BI_BITFIELDS },
|
||||
{ MESA_FORMAT_RGBA8888, 32, 8, 0, 0xFF000000, 8, 8, 0x00FF0000, 8, 16, 0x0000FF00, 8, 24, 0x000000FF, 16, 32, 8, BI_BITFIELDS },
|
||||
{ MESA_FORMAT_RGBA8888, 32, 8, 0, 0xFF000000, 8, 8, 0x00FF0000, 8, 16, 0x0000FF00, 8, 24, 0x000000FF, 16, 16, 8, BI_BITFIELDS },
|
||||
{ MESA_FORMAT_ARGB8888_REV, 32, 8, 16, 0x0000FF00, 8, 8, 0x00FF0000, 8, 0, 0xFF000000, 8, 24, 0x000000FF, 16, 32, 8, BI_BITFIELDS },
|
||||
{ MESA_FORMAT_ARGB8888_REV, 32, 8, 16, 0x0000FF00, 8, 8, 0x00FF0000, 8, 0, 0xFF000000, 8, 24, 0x000000FF, 16, 16, 8, BI_BITFIELDS },
|
||||
{ MESA_FORMAT_RGB888, 24, 8, 0, 0x00000000, 8, 8, 0x00000000, 8, 16, 0x00000000, 0, 0, 0x00000000, 16, 32, 8, BI_RGB },
|
||||
{ MESA_FORMAT_RGB888, 24, 8, 0, 0x00000000, 8, 8, 0x00000000, 8, 16, 0x00000000, 0, 0, 0x00000000, 16, 16, 8, BI_RGB },
|
||||
// { MESA_FORMAT_BGR888, 24, 8, 16, 8, 8, 8, 0, 0, 0, 16, 32, 8 },
|
||||
// { MESA_FORMAT_BGR888, 24, 8, 16, 8, 8, 8, 0, 0, 0, 16, 16, 8 },
|
||||
{ MESA_FORMAT_RGB565, 16, 5, 0, 0x0000F800, 6, 5, 0x000007E0, 5, 11, 0x0000001F, 0, 0, 0x00000000, 16, 32, 8, BI_BITFIELDS },
|
||||
{ MESA_FORMAT_RGB565, 16, 5, 0, 0x0000F800, 6, 5, 0x000007E0, 5, 11, 0x0000001F, 0, 0, 0x00000000, 16, 16, 8, BI_BITFIELDS },
|
||||
};
|
||||
|
||||
#define SW_BACK_RENDERBUFFER_CLASS 0x8911
|
||||
#define SW_FRONT_RENDERBUFFER_CLASS 0x8910
|
||||
struct sw_front_renderbuffer
|
||||
{
|
||||
struct swrast_renderbuffer swrast;
|
||||
|
||||
HDC hdcmem;
|
||||
GLuint x, y, w, h;
|
||||
HBITMAP hbmp;
|
||||
BOOL write;
|
||||
};
|
||||
|
||||
#define SW_FB_DOUBLEBUFFERED 0x1
|
||||
#define SW_FB_DIRTY_SIZE 0x2
|
||||
struct sw_framebuffer
|
||||
{
|
||||
HDC hdc;
|
||||
INT sw_format;
|
||||
UINT format_index;
|
||||
DWORD flags;
|
||||
/* The mesa objects */
|
||||
struct gl_config *gl_visual; /* Describes the buffers */
|
||||
struct gl_framebuffer *gl_buffer; /* The mesa representation of frame buffer */
|
||||
struct sw_front_renderbuffer frontbuffer;
|
||||
struct swrast_renderbuffer backbuffer;
|
||||
/* The bitmapi info we will use for rendering to display */
|
||||
BITMAPINFO bmi;
|
||||
};
|
||||
|
||||
struct sw_context
|
||||
{
|
||||
struct gl_context mesa; /* Base class - this must be first */
|
||||
/* This is to keep track of the size of the front buffer */
|
||||
HHOOK hook;
|
||||
/* Framebuffer currently owning the context */
|
||||
struct sw_framebuffer framebuffer;
|
||||
};
|
||||
|
||||
/* mesa opengl32 "driver" specific */
|
||||
static const GLubyte *
|
||||
sw_get_string( struct gl_context *ctx, GLenum name )
|
||||
{
|
||||
(void) ctx;
|
||||
if(name == GL_RENDERER)
|
||||
{
|
||||
static const GLubyte renderer[] = { 'R','e','a','c','t','O','S',' ',
|
||||
'S','o','f','t','w','a','r','e',' ',
|
||||
'I','m','p','l','e','m','e','n','t','a','t','i','o','n',0 };
|
||||
return renderer;
|
||||
}
|
||||
/* Don't claim to support the fancy extensions that mesa supports, they will be slow anyway */
|
||||
if(name == GL_EXTENSIONS)
|
||||
{
|
||||
static const GLubyte extensions[] = { 0 };
|
||||
return extensions;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
sw_update_state( struct gl_context *ctx, GLuint new_state )
|
||||
{
|
||||
/* easy - just propagate */
|
||||
_swrast_InvalidateState( ctx, new_state );
|
||||
_swsetup_InvalidateState( ctx, new_state );
|
||||
_tnl_InvalidateState( ctx, new_state );
|
||||
_vbo_InvalidateState( ctx, new_state );
|
||||
}
|
||||
|
||||
/* Renderbuffer routines */
|
||||
static GLboolean
|
||||
sw_bb_renderbuffer_storage(struct gl_context* ctx, struct gl_renderbuffer *rb,
|
||||
GLenum internalFormat,
|
||||
GLuint width, GLuint height)
|
||||
{
|
||||
struct swrast_renderbuffer *srb = swrast_renderbuffer(rb);
|
||||
struct sw_framebuffer* fb = CONTAINING_RECORD(srb, struct sw_framebuffer, backbuffer);
|
||||
UINT widthBytes = WIDTH_BYTES_ALIGN32(width, pixel_formats[fb->format_index].color_bits);
|
||||
srb->Base.Format = pixel_formats[fb->format_index].mesa;
|
||||
|
||||
if(srb->Buffer)
|
||||
srb->Buffer = HeapReAlloc(GetProcessHeap(), 0, srb->Buffer, widthBytes*height);
|
||||
else
|
||||
srb->Buffer = HeapAlloc(GetProcessHeap(), 0, widthBytes*height);
|
||||
if(!srb->Buffer)
|
||||
{
|
||||
srb->Base.Format = MESA_FORMAT_NONE;
|
||||
return GL_FALSE;
|
||||
}
|
||||
srb->Base.Width = width;
|
||||
srb->Base.Height = height;
|
||||
srb->RowStride = widthBytes;
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
static void
|
||||
sw_bb_renderbuffer_delete(struct gl_renderbuffer *rb)
|
||||
{
|
||||
struct swrast_renderbuffer *srb = swrast_renderbuffer(rb);
|
||||
|
||||
if (srb->Buffer)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, srb->Buffer);
|
||||
srb->Buffer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
sw_fb_renderbuffer_delete(struct gl_renderbuffer *rb)
|
||||
{
|
||||
struct sw_front_renderbuffer* srb = (struct sw_front_renderbuffer*)rb;
|
||||
|
||||
if (srb->hbmp)
|
||||
{
|
||||
srb->hbmp = SelectObject(srb->hdcmem, srb->hbmp);
|
||||
DeleteDC(srb->hdcmem);
|
||||
DeleteObject(srb->hbmp);
|
||||
srb->hdcmem = NULL;
|
||||
srb->hbmp = NULL;
|
||||
srb->swrast.Buffer = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
static GLboolean
|
||||
sw_fb_renderbuffer_storage(struct gl_context *ctx, struct gl_renderbuffer *rb,
|
||||
GLenum internalFormat,
|
||||
GLuint width, GLuint height)
|
||||
{
|
||||
struct sw_front_renderbuffer* srb = (struct sw_front_renderbuffer*)rb;
|
||||
struct sw_framebuffer* fb = CONTAINING_RECORD(srb, struct sw_framebuffer, frontbuffer);
|
||||
HDC hdc = IntGetCurrentDC();
|
||||
|
||||
/* Don't bother if the size doesn't change */
|
||||
if(rb->Width == width && rb->Height == height)
|
||||
return GL_TRUE;
|
||||
|
||||
/* Delete every objects which could have been used before */
|
||||
sw_fb_renderbuffer_delete(&srb->swrast.Base);
|
||||
|
||||
/* So the app wants to use the frontbuffer, allocate a DIB for it */
|
||||
srb->hbmp = CreateDIBSection(
|
||||
hdc,
|
||||
&fb->bmi,
|
||||
DIB_RGB_COLORS,
|
||||
(void**)&srb->swrast.Buffer,
|
||||
NULL, 0);
|
||||
if(!srb->hbmp)
|
||||
{
|
||||
ERR("Failed to create the DIB section for the front buffer, %lu.\n", GetLastError());
|
||||
return GL_FALSE;
|
||||
}
|
||||
/* Create the DC and attach the DIB section to it */
|
||||
srb->hdcmem = CreateCompatibleDC(hdc);
|
||||
assert(srb->hdcmem != NULL);
|
||||
srb->hbmp = SelectObject(srb->hdcmem, srb->hbmp);
|
||||
assert(srb->hbmp != NULL);
|
||||
/* Set formats, width and height */
|
||||
srb->swrast.Base.Format = pixel_formats[fb->format_index].mesa;
|
||||
srb->swrast.Base.Width = width;
|
||||
srb->swrast.Base.Height = height;
|
||||
return GL_TRUE;
|
||||
}
|
||||
|
||||
static
|
||||
void
|
||||
sw_init_renderbuffers(struct sw_framebuffer *fb)
|
||||
{
|
||||
_mesa_init_renderbuffer(&fb->frontbuffer.swrast.Base, 0);
|
||||
fb->frontbuffer.swrast.Base.ClassID = SW_FRONT_RENDERBUFFER_CLASS;
|
||||
fb->frontbuffer.swrast.Base.AllocStorage = sw_fb_renderbuffer_storage;
|
||||
fb->frontbuffer.swrast.Base.Delete = sw_fb_renderbuffer_delete;
|
||||
fb->frontbuffer.swrast.Base.InternalFormat = GL_RGBA;
|
||||
fb->frontbuffer.swrast.Base._BaseFormat = GL_RGBA;
|
||||
_mesa_remove_renderbuffer(fb->gl_buffer, BUFFER_FRONT_LEFT);
|
||||
_mesa_add_renderbuffer(fb->gl_buffer, BUFFER_FRONT_LEFT, &fb->frontbuffer.swrast.Base);
|
||||
|
||||
if(fb->flags & SW_FB_DOUBLEBUFFERED)
|
||||
{
|
||||
_mesa_init_renderbuffer(&fb->backbuffer.Base, 0);
|
||||
fb->backbuffer.Base.ClassID = SW_BACK_RENDERBUFFER_CLASS;
|
||||
fb->backbuffer.Base.AllocStorage = sw_bb_renderbuffer_storage;
|
||||
fb->backbuffer.Base.Delete = sw_bb_renderbuffer_delete;
|
||||
fb->backbuffer.Base.InternalFormat = GL_RGBA;
|
||||
fb->backbuffer.Base._BaseFormat = GL_RGBA;
|
||||
_mesa_remove_renderbuffer(fb->gl_buffer, BUFFER_BACK_LEFT);
|
||||
_mesa_add_renderbuffer(fb->gl_buffer, BUFFER_BACK_LEFT, &fb->backbuffer.Base);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
sw_MapRenderbuffer(struct gl_context *ctx,
|
||||
struct gl_renderbuffer *rb,
|
||||
GLuint x, GLuint y, GLuint w, GLuint h,
|
||||
GLbitfield mode,
|
||||
GLubyte **mapOut, GLint *rowStrideOut)
|
||||
{
|
||||
if(rb->ClassID == SW_FRONT_RENDERBUFFER_CLASS)
|
||||
{
|
||||
/* This is our front buffer */
|
||||
struct sw_front_renderbuffer* srb = (struct sw_front_renderbuffer*)rb;
|
||||
struct sw_framebuffer* fb = CONTAINING_RECORD(srb, struct sw_framebuffer, frontbuffer);
|
||||
/* Set the stride */
|
||||
*rowStrideOut = WIDTH_BYTES_ALIGN32(rb->Width, pixel_formats[fb->format_index].color_bits);
|
||||
/* Remember where we "mapped" */
|
||||
srb->x = x; srb->y = y; srb->w = w; srb->h = h;
|
||||
/* Remember if we should write it later */
|
||||
srb->write = !!(mode & GL_MAP_WRITE_BIT);
|
||||
/* Get the bits, if needed */
|
||||
if(mode & GL_MAP_READ_BIT)
|
||||
{
|
||||
BitBlt(srb->hdcmem, srb->x, srb->y, srb->w, srb->h,
|
||||
IntGetCurrentDC(), srb->x, srb->y, SRCCOPY);
|
||||
}
|
||||
/* And return it */
|
||||
*mapOut = (BYTE*)srb->swrast.Buffer + *rowStrideOut*y + x*pixel_formats[fb->format_index].color_bits/8;
|
||||
return;
|
||||
}
|
||||
|
||||
if(rb->ClassID == SW_BACK_RENDERBUFFER_CLASS)
|
||||
{
|
||||
/* This is our front buffer */
|
||||
struct swrast_renderbuffer* srb = (struct swrast_renderbuffer*)rb;
|
||||
const GLuint bpp = _mesa_get_format_bytes(rb->Format);
|
||||
/* Set the stride */
|
||||
*rowStrideOut = srb->RowStride;
|
||||
*mapOut = (BYTE*)srb->Buffer + srb->RowStride*y + x*bpp;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Let mesa rasterizer take care of this */
|
||||
_swrast_map_soft_renderbuffer(ctx, rb, x, y, w, h, mode,
|
||||
mapOut, rowStrideOut);
|
||||
}
|
||||
|
||||
static void
|
||||
sw_UnmapRenderbuffer(struct gl_context *ctx, struct gl_renderbuffer *rb)
|
||||
{
|
||||
if (rb->ClassID== SW_FRONT_RENDERBUFFER_CLASS)
|
||||
{
|
||||
/* This is our front buffer */
|
||||
struct sw_front_renderbuffer* srb = (struct sw_front_renderbuffer*)rb;
|
||||
if(srb->write)
|
||||
{
|
||||
/* Copy the bits to our display */
|
||||
BitBlt(IntGetCurrentDC(),
|
||||
srb->x, srb->y, srb->w, srb->h,
|
||||
srb->hdcmem, srb->x, srb->y, SRCCOPY);
|
||||
srb->write = FALSE;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if(rb->ClassID == SW_BACK_RENDERBUFFER_CLASS)
|
||||
return; /* nothing to do */
|
||||
|
||||
/* Let mesa rasterizer take care of this */
|
||||
_swrast_unmap_soft_renderbuffer(ctx, rb);
|
||||
}
|
||||
|
||||
/* WGL <-> mesa glue */
|
||||
static UINT index_from_format(struct wgl_dc_data* dc_data, INT format, BOOL* doubleBuffered)
|
||||
{
|
||||
UINT index;
|
||||
INT nb_win_compat = 0, start_win_compat = 0;
|
||||
HDC hdc;
|
||||
INT bpp;
|
||||
|
||||
*doubleBuffered = FALSE;
|
||||
|
||||
if(!(dc_data->flags & WGL_DC_OBJ_DC))
|
||||
return format - 1; /* OBJ_MEMDC, not double buffered */
|
||||
|
||||
hdc = GetDC(dc_data->owner.hwnd);
|
||||
|
||||
/* Find the window compatible formats */
|
||||
bpp = GetDeviceCaps(hdc, BITSPIXEL);
|
||||
for(index = 0; index<sizeof(pixel_formats)/sizeof(pixel_formats[0]); index++)
|
||||
{
|
||||
if(pixel_formats[index].color_bits == bpp)
|
||||
{
|
||||
if(!start_win_compat)
|
||||
start_win_compat = index+1;
|
||||
nb_win_compat++;
|
||||
}
|
||||
}
|
||||
ReleaseDC(dc_data->owner.hwnd, hdc);
|
||||
|
||||
/* Double buffered format */
|
||||
if(format < (start_win_compat + nb_win_compat))
|
||||
{
|
||||
if(format >= start_win_compat)
|
||||
*doubleBuffered = TRUE;
|
||||
return format-1;
|
||||
}
|
||||
/* Shift */
|
||||
return format - nb_win_compat - 1;
|
||||
}
|
||||
|
||||
INT sw_DescribePixelFormat(HDC hdc, INT format, UINT size, PIXELFORMATDESCRIPTOR* descr)
|
||||
{
|
||||
UINT index;
|
||||
INT nb_win_compat = 0, start_win_compat = 0;
|
||||
INT ret = sizeof(pixel_formats)/sizeof(pixel_formats[0]);
|
||||
|
||||
if (GetObjectType(hdc) == OBJ_DC)
|
||||
{
|
||||
/* Find the window compatible formats */
|
||||
INT bpp = GetDeviceCaps(hdc, BITSPIXEL);
|
||||
for (index = 0; index < sizeof(pixel_formats)/sizeof(pixel_formats[0]); index++)
|
||||
{
|
||||
if (pixel_formats[index].color_bits == bpp)
|
||||
{
|
||||
if (!start_win_compat)
|
||||
start_win_compat = index+1;
|
||||
nb_win_compat++;
|
||||
}
|
||||
}
|
||||
/* Add the double buffered formats */
|
||||
ret += nb_win_compat;
|
||||
}
|
||||
|
||||
index = (UINT)format - 1;
|
||||
if(!descr)
|
||||
return ret;
|
||||
if((format > ret) || (size != sizeof(*descr)))
|
||||
return 0;
|
||||
|
||||
/* Set flags */
|
||||
descr->dwFlags = PFD_SUPPORT_GDI | PFD_SUPPORT_OPENGL | PFD_DRAW_TO_BITMAP | PFD_GENERIC_FORMAT;
|
||||
/* See if this is a format compatible with the window */
|
||||
if(format >= start_win_compat && format < (start_win_compat + nb_win_compat*2) )
|
||||
{
|
||||
/* It is */
|
||||
descr->dwFlags |= PFD_DRAW_TO_WINDOW;
|
||||
/* See if this should be double buffered */
|
||||
if(format < (start_win_compat + nb_win_compat))
|
||||
{
|
||||
/* No GDI, no bitmap */
|
||||
descr->dwFlags &= ~(PFD_SUPPORT_GDI | PFD_DRAW_TO_BITMAP);
|
||||
descr->dwFlags |= PFD_DOUBLEBUFFER;
|
||||
}
|
||||
}
|
||||
/* Normalize the index */
|
||||
if(format >= start_win_compat + nb_win_compat)
|
||||
index -= nb_win_compat;
|
||||
|
||||
/* Fill the rest of the structure */
|
||||
descr->nSize = sizeof(*descr);
|
||||
descr->nVersion = 1;
|
||||
descr->iPixelType = PFD_TYPE_RGBA;
|
||||
descr->cColorBits = pixel_formats[index].color_bits;
|
||||
descr->cRedBits = pixel_formats[index].red_bits;
|
||||
descr->cRedShift = pixel_formats[index].red_shift;
|
||||
descr->cGreenBits = pixel_formats[index].green_bits;
|
||||
descr->cGreenShift = pixel_formats[index].green_shift;
|
||||
descr->cBlueBits = pixel_formats[index].blue_bits;
|
||||
descr->cBlueShift = pixel_formats[index].blue_shift;
|
||||
descr->cAlphaBits = pixel_formats[index].alpha_bits;
|
||||
descr->cAlphaShift = pixel_formats[index].alpha_shift;
|
||||
descr->cAccumBits = pixel_formats[index].accum_bits;
|
||||
descr->cAccumRedBits = pixel_formats[index].accum_bits / 4;
|
||||
descr->cAccumGreenBits = pixel_formats[index].accum_bits / 4;
|
||||
descr->cAccumBlueBits = pixel_formats[index].accum_bits / 4;
|
||||
descr->cAccumAlphaBits = pixel_formats[index].accum_bits / 4;
|
||||
descr->cDepthBits = pixel_formats[index].depth_bits;
|
||||
descr->cStencilBits = pixel_formats[index].stencil_bits;
|
||||
descr->cAuxBuffers = 0;
|
||||
descr->iLayerType = PFD_MAIN_PLANE;
|
||||
return ret;
|
||||
}
|
||||
|
||||
BOOL sw_SetPixelFormat(HDC hdc, struct wgl_dc_data* dc_data, INT format)
|
||||
{
|
||||
struct sw_framebuffer* fb;
|
||||
BOOL doubleBuffered;
|
||||
|
||||
assert(dc_data->sw_data == NULL);
|
||||
|
||||
/* So, someone is crazy enough to ask for sw implementation. Announce it. */
|
||||
TRACE("OpenGL software implementation START!\n");
|
||||
|
||||
/* allocate our structure */
|
||||
fb = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, FIELD_OFFSET(struct sw_framebuffer, bmi.bmiColors[3]));
|
||||
if(!fb)
|
||||
{
|
||||
ERR("HeapAlloc FAILED!\n");
|
||||
return FALSE;
|
||||
}
|
||||
/* Get the format index */
|
||||
fb->format_index = index_from_format(dc_data, format, &doubleBuffered);
|
||||
TRACE("Using format %u - double buffered: %x.\n", fb->format_index, doubleBuffered);
|
||||
fb->flags = doubleBuffered ? SW_FB_DOUBLEBUFFERED : 0;
|
||||
/* Set the bitmap info describing the framebuffer */
|
||||
fb->bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
|
||||
fb->bmi.bmiHeader.biPlanes = 1;
|
||||
fb->bmi.bmiHeader.biBitCount = pixel_formats[fb->format_index].color_bits;
|
||||
fb->bmi.bmiHeader.biCompression = pixel_formats[fb->format_index].bmp_compression;
|
||||
fb->bmi.bmiHeader.biSizeImage = 0;
|
||||
fb->bmi.bmiHeader.biXPelsPerMeter = 0;
|
||||
fb->bmi.bmiHeader.biYPelsPerMeter = 0;
|
||||
fb->bmi.bmiHeader.biClrUsed = 0;
|
||||
fb->bmi.bmiHeader.biClrImportant = 0;
|
||||
*((DWORD*)&fb->bmi.bmiColors[0]) = pixel_formats[fb->format_index].red_mask;
|
||||
*((DWORD*)&fb->bmi.bmiColors[1]) = pixel_formats[fb->format_index].green_mask;
|
||||
*((DWORD*)&fb->bmi.bmiColors[2]) = pixel_formats[fb->format_index].blue_mask;
|
||||
/* Save the HDC */
|
||||
fb->hdc = hdc;
|
||||
|
||||
/* Allocate the visual structure describing the format */
|
||||
fb->gl_visual = _mesa_create_visual(
|
||||
!!(fb->flags & SW_FB_DOUBLEBUFFERED),
|
||||
GL_FALSE, /* No stereoscopic support */
|
||||
pixel_formats[fb->format_index].red_bits,
|
||||
pixel_formats[fb->format_index].green_bits,
|
||||
pixel_formats[fb->format_index].blue_bits,
|
||||
pixel_formats[fb->format_index].alpha_bits,
|
||||
pixel_formats[fb->format_index].depth_bits,
|
||||
pixel_formats[fb->format_index].stencil_bits,
|
||||
pixel_formats[fb->format_index].accum_bits,
|
||||
pixel_formats[fb->format_index].accum_bits,
|
||||
pixel_formats[fb->format_index].accum_bits,
|
||||
pixel_formats[fb->format_index].alpha_bits ?
|
||||
pixel_formats[fb->format_index].accum_bits : 0);
|
||||
|
||||
if(!fb->gl_visual)
|
||||
{
|
||||
ERR("Failed to allocate a GL visual.\n");
|
||||
HeapFree(GetProcessHeap(), 0, fb);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Allocate the framebuffer structure */
|
||||
fb->gl_buffer = _mesa_create_framebuffer(fb->gl_visual);
|
||||
if (!fb->gl_buffer) {
|
||||
ERR("Failed to allocate the mesa framebuffer structure.\n");
|
||||
_mesa_destroy_visual( fb->gl_visual );
|
||||
HeapFree(GetProcessHeap(), 0, fb);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Add the depth/stencil/accum buffers */
|
||||
_swrast_add_soft_renderbuffers(fb->gl_buffer,
|
||||
GL_FALSE, /* color */
|
||||
fb->gl_visual->haveDepthBuffer,
|
||||
fb->gl_visual->haveStencilBuffer,
|
||||
fb->gl_visual->haveAccumBuffer,
|
||||
GL_FALSE, /* alpha */
|
||||
GL_FALSE /* aux */ );
|
||||
|
||||
/* Initialize our render buffers */
|
||||
sw_init_renderbuffers(fb);
|
||||
|
||||
/* Everything went fine */
|
||||
dc_data->sw_data = fb;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
DHGLRC sw_CreateContext(struct wgl_dc_data* dc_data)
|
||||
{
|
||||
struct sw_context* sw_ctx;
|
||||
struct sw_framebuffer* fb = dc_data->sw_data;
|
||||
struct dd_function_table mesa_drv_functions;
|
||||
TNLcontext *tnl;
|
||||
|
||||
/* We use the mesa memory routines for this function */
|
||||
sw_ctx = CALLOC_STRUCT(sw_context);
|
||||
if(!sw_ctx)
|
||||
return NULL;
|
||||
|
||||
/* Set mesa default functions */
|
||||
_mesa_init_driver_functions(&mesa_drv_functions);
|
||||
/* Override */
|
||||
mesa_drv_functions.GetString = sw_get_string;
|
||||
mesa_drv_functions.UpdateState = sw_update_state;
|
||||
mesa_drv_functions.GetBufferSize = NULL;
|
||||
|
||||
/* Initialize the context */
|
||||
if(!_mesa_initialize_context(&sw_ctx->mesa,
|
||||
fb->gl_visual,
|
||||
NULL,
|
||||
&mesa_drv_functions,
|
||||
(void *) sw_ctx))
|
||||
{
|
||||
ERR("Failed to initialize the mesa context.\n");
|
||||
free(sw_ctx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Initialize the "meta driver" */
|
||||
_mesa_meta_init(&sw_ctx->mesa);
|
||||
|
||||
/* Initialize helpers */
|
||||
if(!_swrast_CreateContext(&sw_ctx->mesa) ||
|
||||
!_vbo_CreateContext(&sw_ctx->mesa) ||
|
||||
!_tnl_CreateContext(&sw_ctx->mesa) ||
|
||||
!_swsetup_CreateContext(&sw_ctx->mesa))
|
||||
{
|
||||
ERR("Failed initializing helpers.\n");
|
||||
_mesa_free_context_data(&sw_ctx->mesa);
|
||||
free(sw_ctx);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Wake up! */
|
||||
_swsetup_Wakeup(&sw_ctx->mesa);
|
||||
|
||||
/* Use TnL defaults */
|
||||
tnl = TNL_CONTEXT(&sw_ctx->mesa);
|
||||
tnl->Driver.RunPipeline = _tnl_run_pipeline;
|
||||
|
||||
/* To map the display into user memory */
|
||||
sw_ctx->mesa.Driver.MapRenderbuffer = sw_MapRenderbuffer;
|
||||
sw_ctx->mesa.Driver.UnmapRenderbuffer = sw_UnmapRenderbuffer;
|
||||
|
||||
return (DHGLRC)sw_ctx;
|
||||
}
|
||||
|
||||
BOOL sw_DeleteContext(DHGLRC dhglrc)
|
||||
{
|
||||
struct sw_context* sw_ctx = (struct sw_context*)dhglrc;
|
||||
/* Those get clobbered by _mesa_free_context_data via _glapi_set{context,dispath_table} */
|
||||
void* icd_save = IntGetCurrentICDPrivate();
|
||||
const GLDISPATCHTABLE* table_save = IntGetCurrentDispatchTable();
|
||||
|
||||
/* Destroy everything */
|
||||
_mesa_meta_free( &sw_ctx->mesa );
|
||||
|
||||
_swsetup_DestroyContext( &sw_ctx->mesa );
|
||||
_tnl_DestroyContext( &sw_ctx->mesa );
|
||||
_vbo_DestroyContext( &sw_ctx->mesa );
|
||||
_swrast_DestroyContext( &sw_ctx->mesa );
|
||||
|
||||
_mesa_free_context_data( &sw_ctx->mesa );
|
||||
free( sw_ctx );
|
||||
|
||||
/* Restore this */
|
||||
IntSetCurrentDispatchTable(table_save);
|
||||
IntSetCurrentICDPrivate(icd_save);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
PROC sw_GetProcAddress(LPCSTR name)
|
||||
{
|
||||
/* We don't support any extensions */
|
||||
WARN("Asking for proc address %s, returning NULL.\n", name);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
BOOL sw_CopyContext(DHGLRC dhglrcSrc, DHGLRC dhglrcDst, UINT mask)
|
||||
{
|
||||
FIXME("Software wglCopyContext is UNIMPLEMENTED, mask %lx.\n", mask);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL sw_ShareLists(DHGLRC dhglrcSrc, DHGLRC dhglrcDst)
|
||||
{
|
||||
struct sw_context* sw_ctx_src = (struct sw_context*)dhglrcSrc;
|
||||
struct sw_context* sw_ctx_dst = (struct sw_context*)dhglrcDst;
|
||||
|
||||
/* See if it was already shared */
|
||||
if(sw_ctx_dst->mesa.Shared->RefCount > 1)
|
||||
return FALSE;
|
||||
|
||||
/* Unreference the old, share the new */
|
||||
_mesa_reference_shared_state(&sw_ctx_dst->mesa,
|
||||
&sw_ctx_dst->mesa.Shared,
|
||||
sw_ctx_src->mesa.Shared);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static
|
||||
LRESULT CALLBACK
|
||||
sw_call_window_proc(
|
||||
int nCode,
|
||||
WPARAM wParam,
|
||||
LPARAM lParam )
|
||||
{
|
||||
struct wgl_dc_data* dc_data = IntGetCurrentDcData();
|
||||
struct sw_context* ctx = (struct sw_context*)IntGetCurrentDHGLRC();
|
||||
struct sw_framebuffer* fb;
|
||||
PCWPSTRUCT pParams = (PCWPSTRUCT)lParam;
|
||||
|
||||
if((!dc_data) || (!ctx))
|
||||
return 0;
|
||||
|
||||
if(!(dc_data->flags & WGL_DC_OBJ_DC))
|
||||
return 0;
|
||||
|
||||
if((nCode < 0) || (dc_data->owner.hwnd != pParams->hwnd) || (dc_data->sw_data == NULL))
|
||||
return CallNextHookEx(ctx->hook, nCode, wParam, lParam);
|
||||
|
||||
fb = dc_data->sw_data;
|
||||
|
||||
if (pParams->message == WM_WINDOWPOSCHANGED)
|
||||
{
|
||||
/* We handle WM_WINDOWPOSCHANGED instead of WM_SIZE because according to
|
||||
* http://blogs.msdn.com/oldnewthing/archive/2008/01/15/7113860.aspx
|
||||
* WM_SIZE is generated from WM_WINDOWPOSCHANGED by DefWindowProc so it
|
||||
* can be masked out by the application. */
|
||||
LPWINDOWPOS lpWindowPos = (LPWINDOWPOS)pParams->lParam;
|
||||
if((lpWindowPos->flags & SWP_SHOWWINDOW) ||
|
||||
!(lpWindowPos->flags & SWP_NOMOVE) ||
|
||||
!(lpWindowPos->flags & SWP_NOSIZE))
|
||||
{
|
||||
/* Size in WINDOWPOS includes the window frame, so get the size
|
||||
* of the client area via GetClientRect. */
|
||||
RECT client_rect;
|
||||
UINT width, height;
|
||||
|
||||
TRACE("Got WM_WINDOWPOSCHANGED\n");
|
||||
|
||||
GetClientRect(pParams->hwnd, &client_rect);
|
||||
width = client_rect.right - client_rect.left;
|
||||
height = client_rect.bottom - client_rect.top;
|
||||
/* Do not reallocate for minimized windows */
|
||||
if(width <= 0 || height <= 0)
|
||||
goto end;
|
||||
/* Update framebuffer size */
|
||||
fb->bmi.bmiHeader.biWidth = width;
|
||||
fb->bmi.bmiHeader.biHeight = height;
|
||||
/* Propagate to mesa */
|
||||
_mesa_resize_framebuffer(&ctx->mesa, fb->gl_buffer, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
return CallNextHookEx(ctx->hook, nCode, wParam, lParam);
|
||||
}
|
||||
|
||||
BOOL sw_SetContext(struct wgl_dc_data* dc_data, DHGLRC dhglrc)
|
||||
{
|
||||
struct sw_context* sw_ctx = (struct sw_context*)dhglrc;
|
||||
struct sw_framebuffer* fb = dc_data->sw_data;
|
||||
UINT width, height;
|
||||
|
||||
/* Update state */
|
||||
sw_update_state(&sw_ctx->mesa, 0);
|
||||
|
||||
/* Get framebuffer size */
|
||||
if(dc_data->flags & WGL_DC_OBJ_DC)
|
||||
{
|
||||
HWND hwnd = dc_data->owner.hwnd;
|
||||
RECT client_rect;
|
||||
if(!hwnd)
|
||||
{
|
||||
ERR("Physical DC without a window!\n");
|
||||
return FALSE;
|
||||
}
|
||||
if(!GetClientRect(hwnd, &client_rect))
|
||||
{
|
||||
ERR("GetClientRect failed!\n");
|
||||
return FALSE;
|
||||
}
|
||||
/* This is a physical DC. Setup the hook */
|
||||
sw_ctx->hook = SetWindowsHookEx(WH_CALLWNDPROC,
|
||||
sw_call_window_proc,
|
||||
NULL,
|
||||
GetCurrentThreadId());
|
||||
/* Calculate width & height */
|
||||
width = client_rect.right - client_rect.left;
|
||||
height = client_rect.bottom - client_rect.top;
|
||||
}
|
||||
else /* OBJ_MEMDC */
|
||||
{
|
||||
BITMAP bm;
|
||||
HBITMAP hbmp;
|
||||
HDC hdc = dc_data->owner.hdc;
|
||||
|
||||
if(fb->flags & SW_FB_DOUBLEBUFFERED)
|
||||
{
|
||||
ERR("Memory DC called with a double buffered format.\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
hbmp = GetCurrentObject( hdc, OBJ_BITMAP );
|
||||
if(!hbmp)
|
||||
{
|
||||
ERR("No Bitmap!\n");
|
||||
return FALSE;
|
||||
}
|
||||
if(GetObject(hbmp, sizeof(bm), &bm) == 0)
|
||||
{
|
||||
ERR("GetObject failed!\n");
|
||||
return FALSE;
|
||||
}
|
||||
width = bm.bmWidth;
|
||||
height = bm.bmHeight;
|
||||
}
|
||||
|
||||
if(!width) width = 1;
|
||||
if(!height) height = 1;
|
||||
|
||||
fb->bmi.bmiHeader.biWidth = width;
|
||||
fb->bmi.bmiHeader.biHeight = height;
|
||||
|
||||
/* Also make the mesa context current to mesa */
|
||||
if(!_mesa_make_current(&sw_ctx->mesa, fb->gl_buffer, fb->gl_buffer))
|
||||
{
|
||||
ERR("_mesa_make_current filaed!\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Set the viewport if this is the first time we initialize this context */
|
||||
if(sw_ctx->mesa.Viewport.X == 0 &&
|
||||
sw_ctx->mesa.Viewport.Y == 0 &&
|
||||
sw_ctx->mesa.Viewport.Width == 0 &&
|
||||
sw_ctx->mesa.Viewport.Height == 0)
|
||||
{
|
||||
_mesa_set_viewport(&sw_ctx->mesa, 0, 0, width, height);
|
||||
}
|
||||
|
||||
/* update the framebuffer size */
|
||||
_mesa_resize_framebuffer(&sw_ctx->mesa, fb->gl_buffer, width, height);
|
||||
|
||||
/* We're good */
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void sw_ReleaseContext(DHGLRC dhglrc)
|
||||
{
|
||||
struct sw_context* sw_ctx = (struct sw_context*)dhglrc;
|
||||
|
||||
/* Forward to mesa */
|
||||
_mesa_make_current(NULL, NULL, NULL);
|
||||
|
||||
/* Unhook */
|
||||
if(sw_ctx->hook)
|
||||
{
|
||||
UnhookWindowsHookEx(sw_ctx->hook);
|
||||
sw_ctx->hook = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
BOOL sw_SwapBuffers(HDC hdc, struct wgl_dc_data* dc_data)
|
||||
{
|
||||
struct sw_framebuffer* fb = dc_data->sw_data;
|
||||
struct sw_context* sw_ctx = (struct sw_context*)IntGetCurrentDHGLRC();
|
||||
|
||||
/* Notify mesa */
|
||||
if(sw_ctx)
|
||||
_mesa_notifySwapBuffers(&sw_ctx->mesa);
|
||||
|
||||
if(!(fb->flags & SW_FB_DOUBLEBUFFERED))
|
||||
return TRUE;
|
||||
|
||||
/* Upload to the display */
|
||||
return (SetDIBitsToDevice(hdc,
|
||||
0,
|
||||
0,
|
||||
fb->bmi.bmiHeader.biWidth,
|
||||
fb->bmi.bmiHeader.biHeight,
|
||||
0,
|
||||
0,
|
||||
0,
|
||||
fb->bmi.bmiHeader.biHeight,
|
||||
fb->backbuffer.Buffer,
|
||||
&fb->bmi,
|
||||
DIB_RGB_COLORS) != 0);
|
||||
}
|
932
dll/opengl/opengl32/wgl.c
Normal file
932
dll/opengl/opengl32/wgl.c
Normal file
|
@ -0,0 +1,932 @@
|
|||
/*
|
||||
* COPYRIGHT: See COPYING in the top level directory
|
||||
* PROJECT: ReactOS
|
||||
* FILE: dll/opengl/opengl32/wgl.c
|
||||
* PURPOSE: OpenGL32 DLL, WGL functions
|
||||
*/
|
||||
|
||||
#include "opengl32.h"
|
||||
|
||||
#include <pseh/pseh2.h>
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(wgl);
|
||||
|
||||
static CRITICAL_SECTION dc_data_cs = {NULL, -1, 0, 0, 0, 0};
|
||||
static struct wgl_dc_data* dc_data_list = NULL;
|
||||
|
||||
LIST_ENTRY ContextListHead;
|
||||
|
||||
/* FIXME: suboptimal */
|
||||
static
|
||||
struct wgl_dc_data*
|
||||
get_dc_data(HDC hdc)
|
||||
{
|
||||
HWND hwnd = NULL;
|
||||
struct wgl_dc_data* data;
|
||||
DWORD objType = GetObjectType(hdc);
|
||||
ULONG flags = 0;
|
||||
union
|
||||
{
|
||||
HWND hwnd;
|
||||
HDC hdc;
|
||||
HANDLE u;
|
||||
} id;
|
||||
|
||||
/* Look for the right data identifier */
|
||||
if(objType == OBJ_DC)
|
||||
{
|
||||
hwnd = WindowFromDC(hdc);
|
||||
if(!hwnd)
|
||||
return NULL;
|
||||
id.hwnd = hwnd;
|
||||
flags = WGL_DC_OBJ_DC;
|
||||
}
|
||||
else if(objType == OBJ_MEMDC)
|
||||
{
|
||||
id.hdc = hdc;
|
||||
}
|
||||
else
|
||||
{
|
||||
return NULL;
|
||||
}
|
||||
|
||||
EnterCriticalSection(&dc_data_cs);
|
||||
data = dc_data_list;
|
||||
while(data)
|
||||
{
|
||||
if(data->owner.u == id.u)
|
||||
{
|
||||
LeaveCriticalSection(&dc_data_cs);
|
||||
return data;
|
||||
}
|
||||
data = data->next;
|
||||
}
|
||||
data= HeapAlloc(GetProcessHeap(), 0, sizeof(*data));
|
||||
if(!data)
|
||||
{
|
||||
LeaveCriticalSection(&dc_data_cs);
|
||||
return NULL;
|
||||
}
|
||||
/* initialize the structure */
|
||||
data->owner.u = id.u;
|
||||
data->flags = flags;
|
||||
data->pixelformat = 0;
|
||||
data->sw_data = NULL;
|
||||
/* Load the driver */
|
||||
data->icd_data = IntGetIcdData(hdc);
|
||||
/* Get the number of available formats for this DC once and for all */
|
||||
if(data->icd_data)
|
||||
data->nb_icd_formats = data->icd_data->DrvDescribePixelFormat(hdc, 0, 0, NULL);
|
||||
else
|
||||
data->nb_icd_formats = 0;
|
||||
TRACE("ICD %S has %u formats for HDC %x.\n", data->icd_data ? data->icd_data->DriverName : NULL, data->nb_icd_formats, hdc);
|
||||
data->nb_sw_formats = sw_DescribePixelFormat(hdc, 0, 0, NULL);
|
||||
data->next = dc_data_list;
|
||||
dc_data_list = data;
|
||||
LeaveCriticalSection(&dc_data_cs);
|
||||
return data;
|
||||
}
|
||||
|
||||
void release_dc_data(struct wgl_dc_data* dc_data)
|
||||
{
|
||||
(void)dc_data;
|
||||
}
|
||||
|
||||
struct wgl_context* get_context(HGLRC hglrc)
|
||||
{
|
||||
struct wgl_context* context = (struct wgl_context*)hglrc;
|
||||
|
||||
if(!hglrc)
|
||||
return NULL;
|
||||
|
||||
_SEH2_TRY
|
||||
{
|
||||
if(context->magic != 'GLRC')
|
||||
context = NULL;
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
context = NULL;
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
INT WINAPI wglDescribePixelFormat(HDC hdc, INT format, UINT size, PIXELFORMATDESCRIPTOR *descr )
|
||||
{
|
||||
struct wgl_dc_data* dc_data = get_dc_data(hdc);
|
||||
INT ret;
|
||||
|
||||
if(!dc_data)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = dc_data->nb_icd_formats + dc_data->nb_sw_formats;
|
||||
|
||||
if(!descr)
|
||||
{
|
||||
release_dc_data(dc_data);
|
||||
return ret;
|
||||
}
|
||||
if((format == 0) || (format > ret) || (size != sizeof(*descr)))
|
||||
{
|
||||
release_dc_data(dc_data);
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Query ICD if needed */
|
||||
if(format <= dc_data->nb_icd_formats)
|
||||
{
|
||||
struct ICD_Data* icd_data = dc_data->icd_data;
|
||||
/* SetPixelFormat may have NULLified this */
|
||||
if (!icd_data)
|
||||
icd_data = IntGetIcdData(hdc);
|
||||
if(!icd_data->DrvDescribePixelFormat(hdc, format, size, descr))
|
||||
{
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This is a software format */
|
||||
format -= dc_data->nb_icd_formats;
|
||||
if(!sw_DescribePixelFormat(hdc, format, size, descr))
|
||||
{
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
|
||||
release_dc_data(dc_data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
INT WINAPI wglChoosePixelFormat(HDC hdc, const PIXELFORMATDESCRIPTOR* ppfd)
|
||||
{
|
||||
PIXELFORMATDESCRIPTOR format, best;
|
||||
int i, count, best_format;
|
||||
int bestDBuffer = -1, bestStereo = -1;
|
||||
|
||||
TRACE_(wgl)( "%p %p: size %u version %u flags %u type %u color %u %u,%u,%u,%u "
|
||||
"accum %u depth %u stencil %u aux %u\n",
|
||||
hdc, ppfd, ppfd->nSize, ppfd->nVersion, ppfd->dwFlags, ppfd->iPixelType,
|
||||
ppfd->cColorBits, ppfd->cRedBits, ppfd->cGreenBits, ppfd->cBlueBits, ppfd->cAlphaBits,
|
||||
ppfd->cAccumBits, ppfd->cDepthBits, ppfd->cStencilBits, ppfd->cAuxBuffers );
|
||||
|
||||
count = wglDescribePixelFormat( hdc, 0, 0, NULL );
|
||||
if (!count) return 0;
|
||||
|
||||
best_format = 0;
|
||||
best.dwFlags = PFD_GENERIC_FORMAT;
|
||||
best.cAlphaBits = -1;
|
||||
best.cColorBits = -1;
|
||||
best.cDepthBits = -1;
|
||||
best.cStencilBits = -1;
|
||||
best.cAuxBuffers = -1;
|
||||
|
||||
for (i = 1; i <= count; i++)
|
||||
{
|
||||
if (!wglDescribePixelFormat( hdc, i, sizeof(format), &format )) continue;
|
||||
|
||||
if (ppfd->iPixelType != format.iPixelType)
|
||||
{
|
||||
TRACE( "pixel type mismatch for iPixelFormat=%d\n", i );
|
||||
continue;
|
||||
}
|
||||
|
||||
/* only use bitmap capable formats for bitmap rendering */
|
||||
if ((ppfd->dwFlags & PFD_DRAW_TO_BITMAP) != (format.dwFlags & PFD_DRAW_TO_BITMAP))
|
||||
{
|
||||
TRACE( "PFD_DRAW_TO_BITMAP mismatch for iPixelFormat=%d\n", i );
|
||||
continue;
|
||||
}
|
||||
|
||||
/* only use window capable formats for window rendering */
|
||||
if ((ppfd->dwFlags & PFD_DRAW_TO_WINDOW) != (format.dwFlags & PFD_DRAW_TO_WINDOW))
|
||||
{
|
||||
TRACE( "PFD_DRAW_TO_WINDOW mismatch for iPixelFormat=%d\n", i );
|
||||
continue;
|
||||
}
|
||||
|
||||
/* only use opengl capable formats for opengl rendering */
|
||||
if ((ppfd->dwFlags & PFD_SUPPORT_OPENGL) != (format.dwFlags & PFD_SUPPORT_OPENGL))
|
||||
{
|
||||
TRACE( "PFD_SUPPORT_OPENGL mismatch for iPixelFormat=%d\n", i );
|
||||
continue;
|
||||
}
|
||||
|
||||
/* only use GDI capable formats for GDI rendering */
|
||||
if ((ppfd->dwFlags & PFD_SUPPORT_GDI) != (format.dwFlags & PFD_SUPPORT_GDI))
|
||||
{
|
||||
TRACE( "PFD_SUPPORT_GDI mismatch for iPixelFormat=%d\n", i );
|
||||
continue;
|
||||
}
|
||||
|
||||
/* The behavior of PDF_STEREO/PFD_STEREO_DONTCARE and PFD_DOUBLEBUFFER / PFD_DOUBLEBUFFER_DONTCARE
|
||||
* is not very clear on MSDN. They specify that ChoosePixelFormat tries to match pixel formats
|
||||
* with the flag (PFD_STEREO / PFD_DOUBLEBUFFERING) set. Otherwise it says that it tries to match
|
||||
* formats without the given flag set.
|
||||
* A test on Windows using a Radeon 9500pro on WinXP (the driver doesn't support Stereo)
|
||||
* has indicated that a format without stereo is returned when stereo is unavailable.
|
||||
* So in case PFD_STEREO is set, formats that support it should have priority above formats
|
||||
* without. In case PFD_STEREO_DONTCARE is set, stereo is ignored.
|
||||
*
|
||||
* To summarize the following is most likely the correct behavior:
|
||||
* stereo not set -> prefer non-stereo formats, but also accept stereo formats
|
||||
* stereo set -> prefer stereo formats, but also accept non-stereo formats
|
||||
* stereo don't care -> it doesn't matter whether we get stereo or not
|
||||
*
|
||||
* In Wine we will treat non-stereo the same way as don't care because it makes
|
||||
* format selection even more complicated and second drivers with Stereo advertise
|
||||
* each format twice anyway.
|
||||
*/
|
||||
|
||||
/* Doublebuffer, see the comments above */
|
||||
if (!(ppfd->dwFlags & PFD_DOUBLEBUFFER_DONTCARE))
|
||||
{
|
||||
if (((ppfd->dwFlags & PFD_DOUBLEBUFFER) != bestDBuffer) &&
|
||||
((format.dwFlags & PFD_DOUBLEBUFFER) == (ppfd->dwFlags & PFD_DOUBLEBUFFER)))
|
||||
goto found;
|
||||
|
||||
if (bestDBuffer != -1 && (format.dwFlags & PFD_DOUBLEBUFFER) != bestDBuffer) continue;
|
||||
}
|
||||
|
||||
/* Stereo, see the comments above. */
|
||||
if (!(ppfd->dwFlags & PFD_STEREO_DONTCARE))
|
||||
{
|
||||
if (((ppfd->dwFlags & PFD_STEREO) != bestStereo) &&
|
||||
((format.dwFlags & PFD_STEREO) == (ppfd->dwFlags & PFD_STEREO)))
|
||||
goto found;
|
||||
|
||||
if (bestStereo != -1 && (format.dwFlags & PFD_STEREO) != bestStereo) continue;
|
||||
}
|
||||
|
||||
/* Below we will do a number of checks to select the 'best' pixelformat.
|
||||
* We assume the precedence cColorBits > cAlphaBits > cDepthBits > cStencilBits -> cAuxBuffers.
|
||||
* The code works by trying to match the most important options as close as possible.
|
||||
* When a reasonable format is found, we will try to match more options.
|
||||
* It appears (see the opengl32 test) that Windows opengl drivers ignore options
|
||||
* like cColorBits, cAlphaBits and friends if they are set to 0, so they are considered
|
||||
* as DONTCARE. At least Serious Sam TSE relies on this behavior. */
|
||||
|
||||
if (ppfd->cColorBits)
|
||||
{
|
||||
if (((ppfd->cColorBits > best.cColorBits) && (format.cColorBits > best.cColorBits)) ||
|
||||
((format.cColorBits >= ppfd->cColorBits) && (format.cColorBits < best.cColorBits)))
|
||||
goto found;
|
||||
|
||||
if (best.cColorBits != format.cColorBits) /* Do further checks if the format is compatible */
|
||||
{
|
||||
TRACE( "color mismatch for iPixelFormat=%d\n", i );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (ppfd->cAlphaBits)
|
||||
{
|
||||
if (((ppfd->cAlphaBits > best.cAlphaBits) && (format.cAlphaBits > best.cAlphaBits)) ||
|
||||
((format.cAlphaBits >= ppfd->cAlphaBits) && (format.cAlphaBits < best.cAlphaBits)))
|
||||
goto found;
|
||||
|
||||
if (best.cAlphaBits != format.cAlphaBits)
|
||||
{
|
||||
TRACE( "alpha mismatch for iPixelFormat=%d\n", i );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (ppfd->cDepthBits)
|
||||
{
|
||||
if (((ppfd->cDepthBits > best.cDepthBits) && (format.cDepthBits > best.cDepthBits)) ||
|
||||
((format.cDepthBits >= ppfd->cDepthBits) && (format.cDepthBits < best.cDepthBits)))
|
||||
goto found;
|
||||
|
||||
if (best.cDepthBits != format.cDepthBits)
|
||||
{
|
||||
TRACE( "depth mismatch for iPixelFormat=%d\n", i );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (ppfd->cStencilBits)
|
||||
{
|
||||
if (((ppfd->cStencilBits > best.cStencilBits) && (format.cStencilBits > best.cStencilBits)) ||
|
||||
((format.cStencilBits >= ppfd->cStencilBits) && (format.cStencilBits < best.cStencilBits)))
|
||||
goto found;
|
||||
|
||||
if (best.cStencilBits != format.cStencilBits)
|
||||
{
|
||||
TRACE( "stencil mismatch for iPixelFormat=%d\n", i );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (ppfd->cAuxBuffers)
|
||||
{
|
||||
if (((ppfd->cAuxBuffers > best.cAuxBuffers) && (format.cAuxBuffers > best.cAuxBuffers)) ||
|
||||
((format.cAuxBuffers >= ppfd->cAuxBuffers) && (format.cAuxBuffers < best.cAuxBuffers)))
|
||||
goto found;
|
||||
|
||||
if (best.cAuxBuffers != format.cAuxBuffers)
|
||||
{
|
||||
TRACE( "aux mismatch for iPixelFormat=%d\n", i );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
continue;
|
||||
|
||||
found:
|
||||
/* Prefer HW accelerated formats */
|
||||
if ((format.dwFlags & PFD_GENERIC_FORMAT) && !(best.dwFlags & PFD_GENERIC_FORMAT))
|
||||
continue;
|
||||
best_format = i;
|
||||
best = format;
|
||||
bestDBuffer = format.dwFlags & PFD_DOUBLEBUFFER;
|
||||
bestStereo = format.dwFlags & PFD_STEREO;
|
||||
}
|
||||
|
||||
TRACE( "returning %u\n", best_format );
|
||||
return best_format;
|
||||
}
|
||||
|
||||
BOOL WINAPI wglCopyContext(HGLRC hglrcSrc, HGLRC hglrcDst, UINT mask)
|
||||
{
|
||||
struct wgl_context* ctx_src = get_context(hglrcSrc);
|
||||
struct wgl_context* ctx_dst = get_context(hglrcDst);
|
||||
|
||||
if(!ctx_src || !ctx_dst)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Check this is the same pixel format */
|
||||
if((ctx_dst->icd_data != ctx_src->icd_data) ||
|
||||
(ctx_dst->pixelformat != ctx_src->pixelformat))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PIXEL_FORMAT);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(ctx_src->icd_data)
|
||||
return ctx_src->icd_data->DrvCopyContext(ctx_src->dhglrc, ctx_dst->dhglrc, mask);
|
||||
|
||||
return sw_CopyContext(ctx_src->dhglrc, ctx_dst->dhglrc, mask);
|
||||
}
|
||||
|
||||
HGLRC WINAPI wglCreateContext(HDC hdc)
|
||||
{
|
||||
struct wgl_dc_data* dc_data = get_dc_data(hdc);
|
||||
struct wgl_context* context;
|
||||
DHGLRC dhglrc;
|
||||
|
||||
TRACE("Creating context for %p, format %i\n", hdc);
|
||||
|
||||
if(!dc_data)
|
||||
{
|
||||
WARN("Not a DC handle!\n");
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(!dc_data->pixelformat)
|
||||
{
|
||||
WARN("Pixel format not set!\n");
|
||||
SetLastError(ERROR_INVALID_PIXEL_FORMAT);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(!dc_data->icd_data)
|
||||
{
|
||||
TRACE("Calling SW implementation.\n");
|
||||
dhglrc = sw_CreateContext(dc_data);
|
||||
TRACE("done\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
TRACE("Calling ICD.\n");
|
||||
dhglrc = dc_data->icd_data->DrvCreateContext(hdc);
|
||||
}
|
||||
|
||||
if(!dhglrc)
|
||||
{
|
||||
WARN("Failed!\n");
|
||||
SetLastError(ERROR_INVALID_PIXEL_FORMAT);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
context = HeapAlloc(GetProcessHeap(), 0, sizeof(*context));
|
||||
if(!context)
|
||||
{
|
||||
WARN("Failed to allocate a context!\n");
|
||||
if(!dc_data->icd_data)
|
||||
sw_DeleteContext(dhglrc);
|
||||
else
|
||||
dc_data->icd_data->DrvDeleteContext(dhglrc);
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return NULL;
|
||||
}
|
||||
/* Copy info from the DC data */
|
||||
context->dhglrc = dhglrc;
|
||||
context->icd_data = dc_data->icd_data;
|
||||
context->pixelformat = dc_data->pixelformat;
|
||||
context->thread_id = 0;
|
||||
|
||||
/* Insert into the list */
|
||||
InsertTailList(&ContextListHead, &context->ListEntry);
|
||||
|
||||
context->magic = 'GLRC';
|
||||
TRACE("Success!\n");
|
||||
return (HGLRC)context;
|
||||
}
|
||||
|
||||
HGLRC WINAPI wglCreateLayerContext(HDC hdc, int iLayerPlane)
|
||||
{
|
||||
struct wgl_dc_data* dc_data = get_dc_data(hdc);
|
||||
struct wgl_context* context;
|
||||
DHGLRC dhglrc;
|
||||
|
||||
if(!dc_data)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(!dc_data->pixelformat)
|
||||
{
|
||||
release_dc_data(dc_data);
|
||||
SetLastError(ERROR_INVALID_PIXEL_FORMAT);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(!dc_data->icd_data)
|
||||
{
|
||||
if(iLayerPlane != 0)
|
||||
{
|
||||
/* Not supported in SW implementation */
|
||||
release_dc_data(dc_data);
|
||||
SetLastError(ERROR_INVALID_PIXEL_FORMAT);
|
||||
return NULL;
|
||||
}
|
||||
dhglrc = sw_CreateContext(dc_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
dhglrc = dc_data->icd_data->DrvCreateLayerContext(hdc, iLayerPlane);
|
||||
}
|
||||
|
||||
if(!dhglrc)
|
||||
{
|
||||
release_dc_data(dc_data);
|
||||
SetLastError(ERROR_INVALID_PIXEL_FORMAT);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
context = HeapAlloc(GetProcessHeap(), 0, sizeof(*context));
|
||||
if(!context)
|
||||
{
|
||||
if(!dc_data->icd_data)
|
||||
sw_DeleteContext(dhglrc);
|
||||
else
|
||||
dc_data->icd_data->DrvDeleteContext(dhglrc);
|
||||
release_dc_data(dc_data);
|
||||
SetLastError(ERROR_NOT_ENOUGH_MEMORY);
|
||||
return NULL;
|
||||
}
|
||||
/* Copy info from the DC data */
|
||||
context->dhglrc = dhglrc;
|
||||
context->icd_data = dc_data->icd_data;
|
||||
context->pixelformat = dc_data->pixelformat;
|
||||
context->thread_id = 0;
|
||||
|
||||
context->magic = 'GLRC';
|
||||
|
||||
release_dc_data(dc_data);
|
||||
return (HGLRC)context;
|
||||
}
|
||||
|
||||
BOOL WINAPI wglDeleteContext(HGLRC hglrc)
|
||||
{
|
||||
struct wgl_context* context = get_context(hglrc);
|
||||
LONG thread_id = GetCurrentThreadId();
|
||||
|
||||
if(!context)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Own this context before touching it */
|
||||
if(InterlockedCompareExchange(&context->thread_id, thread_id, 0) != 0)
|
||||
{
|
||||
/* We can't delete a context current to another thread */
|
||||
if(context->thread_id != thread_id)
|
||||
{
|
||||
SetLastError(ERROR_BUSY);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* This is in our thread. Release and try again */
|
||||
if(!wglMakeCurrent(NULL, NULL))
|
||||
return FALSE;
|
||||
return wglDeleteContext(hglrc);
|
||||
}
|
||||
|
||||
if(context->icd_data)
|
||||
context->icd_data->DrvDeleteContext(context->dhglrc);
|
||||
else
|
||||
sw_DeleteContext(context->dhglrc);
|
||||
|
||||
context->magic = 0;
|
||||
RemoveEntryList(&context->ListEntry);
|
||||
HeapFree(GetProcessHeap(), 0, context);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL WINAPI wglDescribeLayerPlane(HDC hdc,
|
||||
int iPixelFormat,
|
||||
int iLayerPlane,
|
||||
UINT nBytes,
|
||||
LPLAYERPLANEDESCRIPTOR plpd)
|
||||
{
|
||||
struct wgl_dc_data* dc_data = get_dc_data(hdc);
|
||||
|
||||
if(!dc_data)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(iPixelFormat <= dc_data->nb_icd_formats)
|
||||
return dc_data->icd_data->DrvDescribeLayerPlane(hdc, iPixelFormat, iLayerPlane, nBytes, plpd);
|
||||
|
||||
/* SW implementation doesn't support this */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
HGLRC WINAPI wglGetCurrentContext(void)
|
||||
{
|
||||
return IntGetCurrentRC();
|
||||
}
|
||||
|
||||
HDC WINAPI wglGetCurrentDC(void)
|
||||
{
|
||||
return IntGetCurrentDC();
|
||||
}
|
||||
|
||||
PROC WINAPI wglGetDefaultProcAddress(LPCSTR lpszProc)
|
||||
{
|
||||
/* undocumented... */
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int WINAPI wglGetLayerPaletteEntries(HDC hdc, int iLayerPlane, int iStart, int cEntries, COLORREF* pcr )
|
||||
{
|
||||
struct wgl_dc_data* dc_data = get_dc_data(hdc);
|
||||
|
||||
if(!dc_data)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!dc_data->pixelformat)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PIXEL_FORMAT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(dc_data->icd_data)
|
||||
return dc_data->icd_data->DrvGetLayerPaletteEntries(hdc, iLayerPlane, iStart, cEntries, pcr);
|
||||
|
||||
/* SW implementation doesn't support this */
|
||||
return 0;
|
||||
}
|
||||
|
||||
INT WINAPI wglGetPixelFormat(HDC hdc)
|
||||
{
|
||||
INT ret;
|
||||
struct wgl_dc_data* dc_data = get_dc_data(hdc);
|
||||
|
||||
if(!dc_data)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
ret = dc_data->pixelformat;
|
||||
release_dc_data(dc_data);
|
||||
return ret;
|
||||
}
|
||||
|
||||
PROC WINAPI wglGetProcAddress(LPCSTR name)
|
||||
{
|
||||
struct wgl_context* context = get_context(IntGetCurrentRC());
|
||||
if(!context)
|
||||
return NULL;
|
||||
|
||||
/* This shall fail for opengl 1.1 functions */
|
||||
#define USE_GL_FUNC(func, w, x, y, z) if(!strcmp(name, "gl" #func)) return NULL;
|
||||
#include "glfuncs.h"
|
||||
|
||||
/* Forward */
|
||||
if(context->icd_data)
|
||||
return context->icd_data->DrvGetProcAddress(name);
|
||||
return sw_GetProcAddress(name);
|
||||
}
|
||||
|
||||
void APIENTRY set_api_table(const GLCLTPROCTABLE* table)
|
||||
{
|
||||
IntSetCurrentDispatchTable(&table->glDispatchTable);
|
||||
}
|
||||
|
||||
BOOL WINAPI wglMakeCurrent(HDC hdc, HGLRC hglrc)
|
||||
{
|
||||
struct wgl_context* ctx = get_context(hglrc);
|
||||
struct wgl_context* old_ctx = get_context(IntGetCurrentRC());
|
||||
const GLCLTPROCTABLE* apiTable;
|
||||
LONG thread_id = (LONG)GetCurrentThreadId();
|
||||
|
||||
if(ctx)
|
||||
{
|
||||
struct wgl_dc_data* dc_data = get_dc_data(hdc);
|
||||
if(!dc_data)
|
||||
{
|
||||
ERR("wglMakeCurrent was passed an invalid DC handle.\n");
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Check compatibility */
|
||||
if((ctx->icd_data != dc_data->icd_data) || (ctx->pixelformat != dc_data->pixelformat))
|
||||
{
|
||||
/* That's bad, man */
|
||||
ERR("HGLRC %p and HDC %p are not compatible.\n", hglrc, hdc);
|
||||
release_dc_data(dc_data);
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Set the thread ID */
|
||||
if(InterlockedCompareExchange(&ctx->thread_id, thread_id, 0) != 0)
|
||||
{
|
||||
/* Already current for a thread. Maybe it's us ? */
|
||||
release_dc_data(dc_data);
|
||||
if(ctx->thread_id != thread_id)
|
||||
SetLastError(ERROR_BUSY);
|
||||
return (ctx->thread_id == thread_id);
|
||||
}
|
||||
|
||||
if(old_ctx)
|
||||
{
|
||||
/* Unset it */
|
||||
if(old_ctx->icd_data)
|
||||
old_ctx->icd_data->DrvReleaseContext(old_ctx->dhglrc);
|
||||
else
|
||||
sw_ReleaseContext(old_ctx->dhglrc);
|
||||
InterlockedExchange(&old_ctx->thread_id, 0);
|
||||
}
|
||||
|
||||
/* Call the ICD or SW implementation */
|
||||
if(ctx->icd_data)
|
||||
{
|
||||
apiTable = ctx->icd_data->DrvSetContext(hdc, ctx->dhglrc, set_api_table);
|
||||
if(!apiTable)
|
||||
{
|
||||
ERR("DrvSetContext failed!\n");
|
||||
/* revert */
|
||||
InterlockedExchange(&ctx->thread_id, 0);
|
||||
IntSetCurrentDispatchTable(&StubTable.glDispatchTable);
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
set_api_table(apiTable);
|
||||
/* Make it current */
|
||||
IntMakeCurrent(hglrc, hdc, dc_data);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* We must set current before, SW implementation relies on it */
|
||||
IntMakeCurrent(hglrc, hdc, dc_data);
|
||||
if(!sw_SetContext(dc_data, ctx->dhglrc))
|
||||
{
|
||||
ERR("sw_SetContext failed!\n");
|
||||
/* revert */
|
||||
IntMakeCurrent(NULL, NULL, NULL);
|
||||
InterlockedExchange(&ctx->thread_id, 0);
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(old_ctx)
|
||||
{
|
||||
if(old_ctx->icd_data)
|
||||
old_ctx->icd_data->DrvReleaseContext(old_ctx->dhglrc);
|
||||
else
|
||||
sw_ReleaseContext(old_ctx->dhglrc);
|
||||
InterlockedExchange(&old_ctx->thread_id, 0);
|
||||
/* Unset it */
|
||||
IntMakeCurrent(NULL, NULL, NULL);
|
||||
/* Reset the no-op table */
|
||||
set_api_table(&StubTable);
|
||||
/* Test conformance (extreme cases) */
|
||||
return hglrc == NULL;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Winetest conformance */
|
||||
if (GetObjectType( hdc ) != OBJ_DC && GetObjectType( hdc ) != OBJ_MEMDC)
|
||||
{
|
||||
ERR( "Error: hdc is not a DC handle!\n");
|
||||
SetLastError( ERROR_INVALID_HANDLE );
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL WINAPI wglRealizeLayerPalette(HDC hdc,
|
||||
int iLayerPlane,
|
||||
BOOL bRealize)
|
||||
{
|
||||
struct wgl_dc_data* dc_data = get_dc_data(hdc);
|
||||
|
||||
if(!dc_data)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(!dc_data->pixelformat)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PIXEL_FORMAT);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(dc_data->icd_data)
|
||||
return dc_data->icd_data->DrvRealizeLayerPalette(hdc, iLayerPlane, bRealize);
|
||||
|
||||
/* SW implementation doesn't support this */
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int WINAPI wglSetLayerPaletteEntries(HDC hdc,
|
||||
int iLayerPlane,
|
||||
int iStart,
|
||||
int cEntries,
|
||||
const COLORREF *pcr)
|
||||
{
|
||||
struct wgl_dc_data* dc_data = get_dc_data(hdc);
|
||||
|
||||
if(!dc_data)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!dc_data->pixelformat)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PIXEL_FORMAT);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(dc_data->icd_data)
|
||||
return dc_data->icd_data->DrvSetLayerPaletteEntries(hdc, iLayerPlane, iStart, cEntries, pcr);
|
||||
|
||||
/* SW implementation doesn't support this */
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL WINAPI wglSetPixelFormat(HDC hdc, INT format, const PIXELFORMATDESCRIPTOR *descr)
|
||||
{
|
||||
struct wgl_dc_data* dc_data = get_dc_data(hdc);
|
||||
INT sw_format;
|
||||
BOOL ret;
|
||||
|
||||
TRACE("HDC %p, format %i.\n", hdc, format);
|
||||
|
||||
if(!dc_data)
|
||||
{
|
||||
WARN("Not a valid DC!.\n");
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(!format)
|
||||
{
|
||||
WARN("format == 0!\n");
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(dc_data->pixelformat)
|
||||
{
|
||||
TRACE("DC format already set, %i.\n", dc_data->pixelformat);
|
||||
return (format == dc_data->pixelformat);
|
||||
}
|
||||
|
||||
if(format <= dc_data->nb_icd_formats)
|
||||
{
|
||||
TRACE("Calling ICD.\n");
|
||||
ret = dc_data->icd_data->DrvSetPixelFormat(hdc, format);
|
||||
if(ret)
|
||||
{
|
||||
TRACE("Success!\n");
|
||||
dc_data->pixelformat = format;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
sw_format = format - dc_data->nb_icd_formats;
|
||||
if(sw_format <= dc_data->nb_sw_formats)
|
||||
{
|
||||
TRACE("Calling SW implementation.\n");
|
||||
ret = sw_SetPixelFormat(hdc, dc_data, sw_format);
|
||||
if(ret)
|
||||
{
|
||||
TRACE("Success!\n");
|
||||
/* This is now officially a software-only HDC */
|
||||
dc_data->icd_data = NULL;
|
||||
dc_data->pixelformat = format;
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
TRACE("Invalid pixel format!\n");
|
||||
SetLastError(ERROR_INVALID_PARAMETER);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL WINAPI wglShareLists(HGLRC hglrcSrc, HGLRC hglrcDst)
|
||||
{
|
||||
struct wgl_context* ctx_src = get_context(hglrcSrc);
|
||||
struct wgl_context* ctx_dst = get_context(hglrcDst);
|
||||
|
||||
if(!ctx_src || !ctx_dst)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Check this is the same pixel format */
|
||||
if((ctx_dst->icd_data != ctx_src->icd_data) ||
|
||||
(ctx_dst->pixelformat != ctx_src->pixelformat))
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PIXEL_FORMAT);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(ctx_src->icd_data)
|
||||
return ctx_src->icd_data->DrvShareLists(ctx_src->dhglrc, ctx_dst->dhglrc);
|
||||
|
||||
return sw_ShareLists(ctx_src->dhglrc, ctx_dst->dhglrc);
|
||||
}
|
||||
|
||||
BOOL WINAPI DECLSPEC_HOTPATCH wglSwapBuffers(HDC hdc)
|
||||
{
|
||||
struct wgl_dc_data* dc_data = get_dc_data(hdc);
|
||||
|
||||
if(!dc_data)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(!dc_data->pixelformat)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_PIXEL_FORMAT);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(dc_data->icd_data)
|
||||
return dc_data->icd_data->DrvSwapBuffers(hdc);
|
||||
|
||||
return sw_SwapBuffers(hdc, dc_data);
|
||||
}
|
||||
|
||||
BOOL WINAPI wglSwapLayerBuffers(HDC hdc, UINT fuPlanes)
|
||||
{
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
DWORD WINAPI wglSwapMultipleBuffers(UINT count, CONST WGLSWAP * toSwap)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Clean up on DLL unload */
|
||||
void
|
||||
IntDeleteAllContexts(void)
|
||||
{
|
||||
struct wgl_context* context;
|
||||
LIST_ENTRY* Entry = ContextListHead.Flink;
|
||||
|
||||
while (Entry != &ContextListHead)
|
||||
{
|
||||
context = CONTAINING_RECORD(Entry, struct wgl_context, ListEntry);
|
||||
wglDeleteContext((HGLRC)context);
|
||||
Entry = Entry->Flink;
|
||||
}
|
||||
}
|
570
dll/opengl/opengl32/wgl_font.c
Normal file
570
dll/opengl/opengl32/wgl_font.c
Normal file
|
@ -0,0 +1,570 @@
|
|||
/* Window-specific OpenGL functions implementation.
|
||||
*
|
||||
* Copyright (c) 1999 Lionel Ulmer
|
||||
* Copyright (c) 2005 Raphael Junqueira
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
#include "opengl32.h"
|
||||
|
||||
#include <math.h>
|
||||
|
||||
WINE_DEFAULT_DEBUG_CHANNEL(wgl);
|
||||
|
||||
/***********************************************************************
|
||||
* wglUseFontBitmaps_common
|
||||
*/
|
||||
static BOOL wglUseFontBitmaps_common( HDC hdc, DWORD first, DWORD count, DWORD listBase, BOOL unicode )
|
||||
{
|
||||
const GLDISPATCHTABLE * funcs = IntGetCurrentDispatchTable();
|
||||
GLYPHMETRICS gm;
|
||||
unsigned int glyph, size = 0;
|
||||
void *bitmap = NULL, *gl_bitmap = NULL;
|
||||
int org_alignment;
|
||||
BOOL ret = TRUE;
|
||||
|
||||
funcs->GetIntegerv(GL_UNPACK_ALIGNMENT, &org_alignment);
|
||||
funcs->PixelStorei(GL_UNPACK_ALIGNMENT, 4);
|
||||
|
||||
for (glyph = first; glyph < first + count; glyph++) {
|
||||
static const MAT2 identity = { {0,1},{0,0},{0,0},{0,1} };
|
||||
unsigned int needed_size, height, width, width_int;
|
||||
|
||||
if (unicode)
|
||||
needed_size = GetGlyphOutlineW(hdc, glyph, GGO_BITMAP, &gm, 0, NULL, &identity);
|
||||
else
|
||||
needed_size = GetGlyphOutlineA(hdc, glyph, GGO_BITMAP, &gm, 0, NULL, &identity);
|
||||
|
||||
TRACE("Glyph: %3d / List: %d size %d\n", glyph, listBase, needed_size);
|
||||
if (needed_size == GDI_ERROR) {
|
||||
ret = FALSE;
|
||||
break;
|
||||
}
|
||||
|
||||
if (needed_size > size) {
|
||||
size = needed_size;
|
||||
HeapFree(GetProcessHeap(), 0, bitmap);
|
||||
HeapFree(GetProcessHeap(), 0, gl_bitmap);
|
||||
bitmap = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
|
||||
gl_bitmap = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
|
||||
}
|
||||
if (unicode)
|
||||
ret = (GetGlyphOutlineW(hdc, glyph, GGO_BITMAP, &gm, size, bitmap, &identity) != GDI_ERROR);
|
||||
else
|
||||
ret = (GetGlyphOutlineA(hdc, glyph, GGO_BITMAP, &gm, size, bitmap, &identity) != GDI_ERROR);
|
||||
if (!ret) break;
|
||||
|
||||
if (TRACE_ON(wgl)) {
|
||||
unsigned int bitmask;
|
||||
unsigned char *bitmap_ = bitmap;
|
||||
|
||||
TRACE(" - bbox: %d x %d\n", gm.gmBlackBoxX, gm.gmBlackBoxY);
|
||||
TRACE(" - origin: (%d, %d)\n", gm.gmptGlyphOrigin.x, gm.gmptGlyphOrigin.y);
|
||||
TRACE(" - increment: %d - %d\n", gm.gmCellIncX, gm.gmCellIncY);
|
||||
if (needed_size != 0) {
|
||||
TRACE(" - bitmap:\n");
|
||||
for (height = 0; height < gm.gmBlackBoxY; height++) {
|
||||
TRACE(" ");
|
||||
for (width = 0, bitmask = 0x80; width < gm.gmBlackBoxX; width++, bitmask >>= 1) {
|
||||
if (bitmask == 0) {
|
||||
bitmap_ += 1;
|
||||
bitmask = 0x80;
|
||||
}
|
||||
if (*bitmap_ & bitmask)
|
||||
TRACE("*");
|
||||
else
|
||||
TRACE(" ");
|
||||
}
|
||||
bitmap_ += (4 - ((UINT_PTR)bitmap_ & 0x03));
|
||||
TRACE("\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* In OpenGL, the bitmap is drawn from the bottom to the top... So we need to invert the
|
||||
* glyph for it to be drawn properly.
|
||||
*/
|
||||
if (needed_size != 0) {
|
||||
width_int = (gm.gmBlackBoxX + 31) / 32;
|
||||
for (height = 0; height < gm.gmBlackBoxY; height++) {
|
||||
for (width = 0; width < width_int; width++) {
|
||||
((int *) gl_bitmap)[(gm.gmBlackBoxY - height - 1) * width_int + width] =
|
||||
((int *) bitmap)[height * width_int + width];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
funcs->NewList(listBase++, GL_COMPILE);
|
||||
if (needed_size != 0) {
|
||||
funcs->Bitmap(gm.gmBlackBoxX, gm.gmBlackBoxY,
|
||||
0 - gm.gmptGlyphOrigin.x, (int) gm.gmBlackBoxY - gm.gmptGlyphOrigin.y,
|
||||
gm.gmCellIncX, gm.gmCellIncY,
|
||||
gl_bitmap);
|
||||
} else {
|
||||
/* This is the case of 'empty' glyphs like the space character */
|
||||
funcs->Bitmap(0, 0, 0, 0, gm.gmCellIncX, gm.gmCellIncY, NULL);
|
||||
}
|
||||
funcs->EndList();
|
||||
}
|
||||
|
||||
funcs->PixelStorei(GL_UNPACK_ALIGNMENT, org_alignment);
|
||||
HeapFree(GetProcessHeap(), 0, bitmap);
|
||||
HeapFree(GetProcessHeap(), 0, gl_bitmap);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* wglUseFontBitmapsA (OPENGL32.@)
|
||||
*/
|
||||
BOOL WINAPI wglUseFontBitmapsA(HDC hdc, DWORD first, DWORD count, DWORD listBase)
|
||||
{
|
||||
return wglUseFontBitmaps_common( hdc, first, count, listBase, FALSE );
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* wglUseFontBitmapsW (OPENGL32.@)
|
||||
*/
|
||||
BOOL WINAPI wglUseFontBitmapsW(HDC hdc, DWORD first, DWORD count, DWORD listBase)
|
||||
{
|
||||
return wglUseFontBitmaps_common( hdc, first, count, listBase, TRUE );
|
||||
}
|
||||
|
||||
/* FIXME: should probably have a glu.h header */
|
||||
|
||||
typedef struct GLUtesselator GLUtesselator;
|
||||
typedef void (WINAPI *_GLUfuncptr)(void);
|
||||
|
||||
#define GLU_TESS_BEGIN 100100
|
||||
#define GLU_TESS_VERTEX 100101
|
||||
#define GLU_TESS_END 100102
|
||||
|
||||
static GLUtesselator * (WINAPI *pgluNewTess)(void);
|
||||
static void (WINAPI *pgluDeleteTess)(GLUtesselator *tess);
|
||||
static void (WINAPI *pgluTessNormal)(GLUtesselator *tess, GLdouble x, GLdouble y, GLdouble z);
|
||||
static void (WINAPI *pgluTessBeginPolygon)(GLUtesselator *tess, void *polygon_data);
|
||||
static void (WINAPI *pgluTessEndPolygon)(GLUtesselator *tess);
|
||||
static void (WINAPI *pgluTessCallback)(GLUtesselator *tess, GLenum which, _GLUfuncptr fn);
|
||||
static void (WINAPI *pgluTessBeginContour)(GLUtesselator *tess);
|
||||
static void (WINAPI *pgluTessEndContour)(GLUtesselator *tess);
|
||||
static void (WINAPI *pgluTessVertex)(GLUtesselator *tess, GLdouble *location, GLvoid* data);
|
||||
|
||||
static HMODULE load_libglu(void)
|
||||
{
|
||||
static const WCHAR glu32W[] = {'g','l','u','3','2','.','d','l','l',0};
|
||||
static int already_loaded;
|
||||
static HMODULE module;
|
||||
|
||||
if (already_loaded) return module;
|
||||
already_loaded = 1;
|
||||
|
||||
TRACE("Trying to load GLU library\n");
|
||||
module = LoadLibraryW( glu32W );
|
||||
if (!module)
|
||||
{
|
||||
WARN("Failed to load glu32\n");
|
||||
return NULL;
|
||||
}
|
||||
#define LOAD_FUNCPTR(f) p##f = (void *)GetProcAddress( module, #f )
|
||||
LOAD_FUNCPTR(gluNewTess);
|
||||
LOAD_FUNCPTR(gluDeleteTess);
|
||||
LOAD_FUNCPTR(gluTessBeginContour);
|
||||
LOAD_FUNCPTR(gluTessNormal);
|
||||
LOAD_FUNCPTR(gluTessBeginPolygon);
|
||||
LOAD_FUNCPTR(gluTessCallback);
|
||||
LOAD_FUNCPTR(gluTessEndContour);
|
||||
LOAD_FUNCPTR(gluTessEndPolygon);
|
||||
LOAD_FUNCPTR(gluTessVertex);
|
||||
#undef LOAD_FUNCPTR
|
||||
return module;
|
||||
}
|
||||
|
||||
static void fixed_to_double(POINTFX fixed, UINT em_size, GLdouble vertex[3])
|
||||
{
|
||||
vertex[0] = (fixed.x.value + (GLdouble)fixed.x.fract / (1 << 16)) / em_size;
|
||||
vertex[1] = (fixed.y.value + (GLdouble)fixed.y.fract / (1 << 16)) / em_size;
|
||||
vertex[2] = 0.0;
|
||||
}
|
||||
|
||||
static void WINAPI tess_callback_vertex(GLvoid *vertex)
|
||||
{
|
||||
const GLDISPATCHTABLE * funcs = IntGetCurrentDispatchTable();
|
||||
GLdouble *dbl = vertex;
|
||||
TRACE("%f, %f, %f\n", dbl[0], dbl[1], dbl[2]);
|
||||
funcs->Vertex3dv(vertex);
|
||||
}
|
||||
|
||||
static void WINAPI tess_callback_begin(GLenum which)
|
||||
{
|
||||
const GLDISPATCHTABLE * funcs = IntGetCurrentDispatchTable();
|
||||
TRACE("%d\n", which);
|
||||
funcs->Begin(which);
|
||||
}
|
||||
|
||||
static void WINAPI tess_callback_end(void)
|
||||
{
|
||||
const GLDISPATCHTABLE * funcs = IntGetCurrentDispatchTable();
|
||||
TRACE("\n");
|
||||
funcs->End();
|
||||
}
|
||||
|
||||
typedef struct _bezier_vector {
|
||||
GLdouble x;
|
||||
GLdouble y;
|
||||
} bezier_vector;
|
||||
|
||||
static double bezier_deviation_squared(const bezier_vector *p)
|
||||
{
|
||||
bezier_vector deviation;
|
||||
bezier_vector vertex;
|
||||
bezier_vector base;
|
||||
double base_length;
|
||||
double dot;
|
||||
|
||||
vertex.x = (p[0].x + p[1].x*2 + p[2].x)/4 - p[0].x;
|
||||
vertex.y = (p[0].y + p[1].y*2 + p[2].y)/4 - p[0].y;
|
||||
|
||||
base.x = p[2].x - p[0].x;
|
||||
base.y = p[2].y - p[0].y;
|
||||
|
||||
base_length = sqrt(base.x*base.x + base.y*base.y);
|
||||
base.x /= base_length;
|
||||
base.y /= base_length;
|
||||
|
||||
dot = base.x*vertex.x + base.y*vertex.y;
|
||||
dot = min(max(dot, 0.0), base_length);
|
||||
base.x *= dot;
|
||||
base.y *= dot;
|
||||
|
||||
deviation.x = vertex.x-base.x;
|
||||
deviation.y = vertex.y-base.y;
|
||||
|
||||
return deviation.x*deviation.x + deviation.y*deviation.y;
|
||||
}
|
||||
|
||||
static int bezier_approximate(const bezier_vector *p, bezier_vector *points, FLOAT deviation)
|
||||
{
|
||||
bezier_vector first_curve[3];
|
||||
bezier_vector second_curve[3];
|
||||
bezier_vector vertex;
|
||||
int total_vertices;
|
||||
|
||||
if(bezier_deviation_squared(p) <= deviation*deviation)
|
||||
{
|
||||
if(points)
|
||||
*points = p[2];
|
||||
return 1;
|
||||
}
|
||||
|
||||
vertex.x = (p[0].x + p[1].x*2 + p[2].x)/4;
|
||||
vertex.y = (p[0].y + p[1].y*2 + p[2].y)/4;
|
||||
|
||||
first_curve[0] = p[0];
|
||||
first_curve[1].x = (p[0].x + p[1].x)/2;
|
||||
first_curve[1].y = (p[0].y + p[1].y)/2;
|
||||
first_curve[2] = vertex;
|
||||
|
||||
second_curve[0] = vertex;
|
||||
second_curve[1].x = (p[2].x + p[1].x)/2;
|
||||
second_curve[1].y = (p[2].y + p[1].y)/2;
|
||||
second_curve[2] = p[2];
|
||||
|
||||
total_vertices = bezier_approximate(first_curve, points, deviation);
|
||||
if(points)
|
||||
points += total_vertices;
|
||||
total_vertices += bezier_approximate(second_curve, points, deviation);
|
||||
return total_vertices;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* wglUseFontOutlines_common
|
||||
*/
|
||||
static BOOL wglUseFontOutlines_common(HDC hdc,
|
||||
DWORD first,
|
||||
DWORD count,
|
||||
DWORD listBase,
|
||||
FLOAT deviation,
|
||||
FLOAT extrusion,
|
||||
int format,
|
||||
LPGLYPHMETRICSFLOAT lpgmf,
|
||||
BOOL unicode)
|
||||
{
|
||||
const GLDISPATCHTABLE * funcs = IntGetCurrentDispatchTable();
|
||||
UINT glyph;
|
||||
const MAT2 identity = {{0,1},{0,0},{0,0},{0,1}};
|
||||
GLUtesselator *tess = NULL;
|
||||
LOGFONTW lf;
|
||||
HFONT old_font, unscaled_font;
|
||||
UINT em_size = 1024;
|
||||
RECT rc;
|
||||
|
||||
TRACE("(%p, %d, %d, %d, %f, %f, %d, %p, %s)\n", hdc, first, count,
|
||||
listBase, deviation, extrusion, format, lpgmf, unicode ? "W" : "A");
|
||||
|
||||
if(deviation <= 0.0)
|
||||
deviation = 1.0/em_size;
|
||||
|
||||
if(format == WGL_FONT_POLYGONS)
|
||||
{
|
||||
if (!load_libglu())
|
||||
{
|
||||
ERR("glu32 is required for this function but isn't available\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
tess = pgluNewTess();
|
||||
if(!tess) return FALSE;
|
||||
pgluTessCallback(tess, GLU_TESS_VERTEX, (_GLUfuncptr)tess_callback_vertex);
|
||||
pgluTessCallback(tess, GLU_TESS_BEGIN, (_GLUfuncptr)tess_callback_begin);
|
||||
pgluTessCallback(tess, GLU_TESS_END, tess_callback_end);
|
||||
}
|
||||
|
||||
GetObjectW(GetCurrentObject(hdc, OBJ_FONT), sizeof(lf), &lf);
|
||||
rc.left = rc.right = rc.bottom = 0;
|
||||
rc.top = em_size;
|
||||
DPtoLP(hdc, (POINT*)&rc, 2);
|
||||
lf.lfHeight = -abs(rc.top - rc.bottom);
|
||||
lf.lfOrientation = lf.lfEscapement = 0;
|
||||
unscaled_font = CreateFontIndirectW(&lf);
|
||||
old_font = SelectObject(hdc, unscaled_font);
|
||||
|
||||
for (glyph = first; glyph < first + count; glyph++)
|
||||
{
|
||||
DWORD needed;
|
||||
GLYPHMETRICS gm;
|
||||
BYTE *buf;
|
||||
TTPOLYGONHEADER *pph;
|
||||
TTPOLYCURVE *ppc;
|
||||
GLdouble *vertices = NULL, *vertices_temp = NULL;
|
||||
int vertex_total = -1;
|
||||
|
||||
if(unicode)
|
||||
needed = GetGlyphOutlineW(hdc, glyph, GGO_NATIVE, &gm, 0, NULL, &identity);
|
||||
else
|
||||
needed = GetGlyphOutlineA(hdc, glyph, GGO_NATIVE, &gm, 0, NULL, &identity);
|
||||
|
||||
if(needed == GDI_ERROR)
|
||||
goto error;
|
||||
|
||||
buf = HeapAlloc(GetProcessHeap(), 0, needed);
|
||||
|
||||
if(!buf)
|
||||
goto error;
|
||||
|
||||
if(unicode)
|
||||
GetGlyphOutlineW(hdc, glyph, GGO_NATIVE, &gm, needed, buf, &identity);
|
||||
else
|
||||
GetGlyphOutlineA(hdc, glyph, GGO_NATIVE, &gm, needed, buf, &identity);
|
||||
|
||||
TRACE("glyph %d\n", glyph);
|
||||
|
||||
if(lpgmf)
|
||||
{
|
||||
lpgmf->gmfBlackBoxX = (float)gm.gmBlackBoxX / em_size;
|
||||
lpgmf->gmfBlackBoxY = (float)gm.gmBlackBoxY / em_size;
|
||||
lpgmf->gmfptGlyphOrigin.x = (float)gm.gmptGlyphOrigin.x / em_size;
|
||||
lpgmf->gmfptGlyphOrigin.y = (float)gm.gmptGlyphOrigin.y / em_size;
|
||||
lpgmf->gmfCellIncX = (float)gm.gmCellIncX / em_size;
|
||||
lpgmf->gmfCellIncY = (float)gm.gmCellIncY / em_size;
|
||||
|
||||
TRACE("%fx%f at %f,%f inc %f,%f\n", lpgmf->gmfBlackBoxX, lpgmf->gmfBlackBoxY,
|
||||
lpgmf->gmfptGlyphOrigin.x, lpgmf->gmfptGlyphOrigin.y, lpgmf->gmfCellIncX, lpgmf->gmfCellIncY);
|
||||
lpgmf++;
|
||||
}
|
||||
|
||||
funcs->NewList(listBase++, GL_COMPILE);
|
||||
funcs->FrontFace(GL_CCW);
|
||||
if(format == WGL_FONT_POLYGONS)
|
||||
{
|
||||
funcs->Normal3d(0.0, 0.0, 1.0);
|
||||
pgluTessNormal(tess, 0, 0, 1);
|
||||
pgluTessBeginPolygon(tess, NULL);
|
||||
}
|
||||
|
||||
while(!vertices)
|
||||
{
|
||||
if(vertex_total != -1)
|
||||
vertices_temp = vertices = HeapAlloc(GetProcessHeap(), 0, vertex_total * 3 * sizeof(GLdouble));
|
||||
vertex_total = 0;
|
||||
|
||||
pph = (TTPOLYGONHEADER*)buf;
|
||||
while((BYTE*)pph < buf + needed)
|
||||
{
|
||||
GLdouble previous[3];
|
||||
fixed_to_double(pph->pfxStart, em_size, previous);
|
||||
|
||||
if(vertices)
|
||||
TRACE("\tstart %d, %d\n", pph->pfxStart.x.value, pph->pfxStart.y.value);
|
||||
|
||||
if(format == WGL_FONT_POLYGONS)
|
||||
pgluTessBeginContour(tess);
|
||||
else
|
||||
funcs->Begin(GL_LINE_LOOP);
|
||||
|
||||
if(vertices)
|
||||
{
|
||||
fixed_to_double(pph->pfxStart, em_size, vertices);
|
||||
if(format == WGL_FONT_POLYGONS)
|
||||
pgluTessVertex(tess, vertices, vertices);
|
||||
else
|
||||
funcs->Vertex3d(vertices[0], vertices[1], vertices[2]);
|
||||
vertices += 3;
|
||||
}
|
||||
vertex_total++;
|
||||
|
||||
ppc = (TTPOLYCURVE*)((char*)pph + sizeof(*pph));
|
||||
while((char*)ppc < (char*)pph + pph->cb)
|
||||
{
|
||||
int i, j;
|
||||
int num;
|
||||
|
||||
switch(ppc->wType) {
|
||||
case TT_PRIM_LINE:
|
||||
for(i = 0; i < ppc->cpfx; i++)
|
||||
{
|
||||
if(vertices)
|
||||
{
|
||||
TRACE("\t\tline to %d, %d\n",
|
||||
ppc->apfx[i].x.value, ppc->apfx[i].y.value);
|
||||
fixed_to_double(ppc->apfx[i], em_size, vertices);
|
||||
if(format == WGL_FONT_POLYGONS)
|
||||
pgluTessVertex(tess, vertices, vertices);
|
||||
else
|
||||
funcs->Vertex3d(vertices[0], vertices[1], vertices[2]);
|
||||
vertices += 3;
|
||||
}
|
||||
fixed_to_double(ppc->apfx[i], em_size, previous);
|
||||
vertex_total++;
|
||||
}
|
||||
break;
|
||||
|
||||
case TT_PRIM_QSPLINE:
|
||||
for(i = 0; i < ppc->cpfx-1; i++)
|
||||
{
|
||||
bezier_vector curve[3];
|
||||
bezier_vector *points;
|
||||
GLdouble curve_vertex[3];
|
||||
|
||||
if(vertices)
|
||||
TRACE("\t\tcurve %d,%d %d,%d\n",
|
||||
ppc->apfx[i].x.value, ppc->apfx[i].y.value,
|
||||
ppc->apfx[i + 1].x.value, ppc->apfx[i + 1].y.value);
|
||||
|
||||
curve[0].x = previous[0];
|
||||
curve[0].y = previous[1];
|
||||
fixed_to_double(ppc->apfx[i], em_size, curve_vertex);
|
||||
curve[1].x = curve_vertex[0];
|
||||
curve[1].y = curve_vertex[1];
|
||||
fixed_to_double(ppc->apfx[i + 1], em_size, curve_vertex);
|
||||
curve[2].x = curve_vertex[0];
|
||||
curve[2].y = curve_vertex[1];
|
||||
if(i < ppc->cpfx-2)
|
||||
{
|
||||
curve[2].x = (curve[1].x + curve[2].x)/2;
|
||||
curve[2].y = (curve[1].y + curve[2].y)/2;
|
||||
}
|
||||
num = bezier_approximate(curve, NULL, deviation);
|
||||
points = HeapAlloc(GetProcessHeap(), 0, num*sizeof(bezier_vector));
|
||||
num = bezier_approximate(curve, points, deviation);
|
||||
vertex_total += num;
|
||||
if(vertices)
|
||||
{
|
||||
for(j=0; j<num; j++)
|
||||
{
|
||||
TRACE("\t\t\tvertex at %f,%f\n", points[j].x, points[j].y);
|
||||
vertices[0] = points[j].x;
|
||||
vertices[1] = points[j].y;
|
||||
vertices[2] = 0.0;
|
||||
if(format == WGL_FONT_POLYGONS)
|
||||
pgluTessVertex(tess, vertices, vertices);
|
||||
else
|
||||
funcs->Vertex3d(vertices[0], vertices[1], vertices[2]);
|
||||
vertices += 3;
|
||||
}
|
||||
}
|
||||
HeapFree(GetProcessHeap(), 0, points);
|
||||
previous[0] = curve[2].x;
|
||||
previous[1] = curve[2].y;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
ERR("\t\tcurve type = %d\n", ppc->wType);
|
||||
if(format == WGL_FONT_POLYGONS)
|
||||
pgluTessEndContour(tess);
|
||||
else
|
||||
funcs->End();
|
||||
goto error_in_list;
|
||||
}
|
||||
|
||||
ppc = (TTPOLYCURVE*)((char*)ppc + sizeof(*ppc) +
|
||||
(ppc->cpfx - 1) * sizeof(POINTFX));
|
||||
}
|
||||
if(format == WGL_FONT_POLYGONS)
|
||||
pgluTessEndContour(tess);
|
||||
else
|
||||
funcs->End();
|
||||
pph = (TTPOLYGONHEADER*)((char*)pph + pph->cb);
|
||||
}
|
||||
}
|
||||
|
||||
error_in_list:
|
||||
if(format == WGL_FONT_POLYGONS)
|
||||
pgluTessEndPolygon(tess);
|
||||
funcs->Translated((GLdouble)gm.gmCellIncX / em_size, (GLdouble)gm.gmCellIncY / em_size, 0.0);
|
||||
funcs->EndList();
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, buf);
|
||||
|
||||
if(vertices_temp)
|
||||
HeapFree(GetProcessHeap(), 0, vertices_temp);
|
||||
}
|
||||
|
||||
error:
|
||||
DeleteObject(SelectObject(hdc, old_font));
|
||||
if(format == WGL_FONT_POLYGONS)
|
||||
pgluDeleteTess(tess);
|
||||
return TRUE;
|
||||
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* wglUseFontOutlinesA (OPENGL32.@)
|
||||
*/
|
||||
BOOL WINAPI wglUseFontOutlinesA(HDC hdc,
|
||||
DWORD first,
|
||||
DWORD count,
|
||||
DWORD listBase,
|
||||
FLOAT deviation,
|
||||
FLOAT extrusion,
|
||||
int format,
|
||||
LPGLYPHMETRICSFLOAT lpgmf)
|
||||
{
|
||||
return wglUseFontOutlines_common(hdc, first, count, listBase, deviation, extrusion, format, lpgmf, FALSE);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* wglUseFontOutlinesW (OPENGL32.@)
|
||||
*/
|
||||
BOOL WINAPI wglUseFontOutlinesW(HDC hdc,
|
||||
DWORD first,
|
||||
DWORD count,
|
||||
DWORD listBase,
|
||||
FLOAT deviation,
|
||||
FLOAT extrusion,
|
||||
int format,
|
||||
LPGLYPHMETRICSFLOAT lpgmf)
|
||||
{
|
||||
return wglUseFontOutlines_common(hdc, first, count, listBase, deviation, extrusion, format, lpgmf, TRUE);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue