Cygwin/X: AIGLX using native WGL
A rewrite of the XWin DDX AIGLX code to actually make it do something useful again Signed-off-by: Jon TURNEY <jon.turney@dronecode.org.uk> Reviewed-by: Colin Harrison <colin.harrison@virgin.net>
This commit is contained in:
parent
ffaae7c0c6
commit
81a081c1f0
|
@ -2220,6 +2220,7 @@ hw/dmx/Makefile
|
|||
hw/vfb/Makefile
|
||||
hw/xnest/Makefile
|
||||
hw/xwin/Makefile
|
||||
hw/xwin/glx/Makefile
|
||||
hw/xquartz/Makefile
|
||||
hw/xquartz/GL/Makefile
|
||||
hw/xquartz/bundle/Makefile
|
||||
|
|
|
@ -99,8 +99,8 @@ extern HMODULE g_hmodCommonControls;
|
|||
extern FARPROC g_fpTrackMouseEvent;
|
||||
extern Bool g_fNoHelpMessageBox;
|
||||
extern Bool g_fSilentDupError;
|
||||
|
||||
|
||||
extern Bool g_fNativeGl;
|
||||
|
||||
/*
|
||||
* Function prototypes
|
||||
*/
|
||||
|
@ -187,6 +187,17 @@ winClipboardShutdown (void)
|
|||
}
|
||||
#endif
|
||||
|
||||
void
|
||||
ddxPushProviders(void)
|
||||
{
|
||||
#ifdef XWIN_GLX_WINDOWS
|
||||
if (g_fNativeGl)
|
||||
{
|
||||
/* install the native GL provider */
|
||||
glxWinPushNativeProvider();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined(DDXBEFORERESET)
|
||||
/*
|
||||
|
@ -890,6 +901,11 @@ winUseMsg (void)
|
|||
ErrorF ("-[no]unixkill\n"
|
||||
"\tCtrl+Alt+Backspace exits the X Server.\n");
|
||||
|
||||
#ifdef XWIN_GLX_WINDOWS
|
||||
ErrorF ("-[no]wgl\n"
|
||||
"\tEnable the GLX extension to use the native Windows WGL interface for accelerated OpenGL\n");
|
||||
#endif
|
||||
|
||||
ErrorF ("-[no]winkill\n"
|
||||
"\tAlt+F4 exits the X Server.\n");
|
||||
|
||||
|
|
|
@ -13,9 +13,10 @@ DEFS_CLIPBOARD = -DXWIN_CLIPBOARD
|
|||
endif
|
||||
|
||||
if XWIN_GLX_WINDOWS
|
||||
SRCS_GLX_WINDOWS = \
|
||||
winpriv.c
|
||||
GLX_DIR = glx
|
||||
DEFS_GLX_WINDOWS = -DXWIN_GLX_WINDOWS
|
||||
XWIN_GLX_LIBS = $(top_builddir)/hw/xwin/glx/libXwinGLX.la
|
||||
XWIN_GLX_LINK_FLAGS = -lopengl32
|
||||
endif
|
||||
|
||||
if XWIN_MULTIWINDOW
|
||||
|
@ -125,7 +126,6 @@ SRCS = InitInput.c \
|
|||
$(top_srcdir)/mi/miinitext.c \
|
||||
$(top_srcdir)/fb/fbcmap_mi.c \
|
||||
$(SRCS_CLIPBOARD) \
|
||||
$(SRCS_GLX_WINDOWS) \
|
||||
$(SRCS_MULTIWINDOW) \
|
||||
$(SRCS_MULTIWINDOWEXTWM) \
|
||||
$(SRCS_NATIVEGDI) \
|
||||
|
@ -146,14 +146,13 @@ XWin_SOURCES = $(SRCS)
|
|||
|
||||
INCLUDES = -I$(top_srcdir)/miext/rootless
|
||||
|
||||
XWin_DEPENDENCIES = $(XWIN_LIBS)
|
||||
XWin_LDADD = $(MULTIWINDOWEXTWM_LIBS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) $(XWIN_SYS_LIBS)
|
||||
XWin_DEPENDENCIES = $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS)
|
||||
XWin_LDADD = $(MULTIWINDOWEXTWM_LIBS) $(XWIN_GLX_LIBS) $(XWIN_GLX_LINK_FLAGS) $(XWIN_LIBS) $(MAIN_LIB) $(XSERVER_LIBS) $(XSERVER_SYS_LIBS) $(XWIN_SYS_LIBS)
|
||||
XWin_LDFLAGS = -mwindows -static
|
||||
|
||||
.rc.o:
|
||||
$(AM_V_GEN)$(WINDRES) --use-temp-file -i $< --input-format=rc -o $@ -O coff -I $(top_builddir)/include
|
||||
|
||||
XWin_LDFLAGS = -mwindows -static
|
||||
|
||||
winprefsyacc.h: winprefsyacc.c
|
||||
winprefslex.c: winprefslex.l winprefsyacc.c winprefsyacc.h
|
||||
|
||||
|
@ -164,12 +163,8 @@ AM_YFLAGS = -d
|
|||
AM_LFLAGS = -i
|
||||
AM_CFLAGS = -DHAVE_XWIN_CONFIG_H $(DIX_CFLAGS) \
|
||||
$(XWINMODULES_CFLAGS) \
|
||||
-DXFree86Server
|
||||
|
||||
GLX_EXTRAS = \
|
||||
glx/glwindows.h \
|
||||
glx/glwrap.c \
|
||||
glx/indirect.c
|
||||
-DXFree86Server \
|
||||
-I$(top_srcdir)
|
||||
|
||||
MAN_SRCS = XWin.man.pre XWinrc.man.pre
|
||||
|
||||
|
@ -198,7 +193,6 @@ install-exec-hook:
|
|||
(cd $(DESTDIR)$(bindir) && rm -f X && $(LN_S) XWin$(EXEEXT) X)
|
||||
|
||||
EXTRA_DIST = \
|
||||
$(GLX_EXTRAS) \
|
||||
$(MAN_SRCS) \
|
||||
$(xwinconfig_DATA) \
|
||||
X.ico \
|
||||
|
@ -226,3 +220,6 @@ EXTRA_DIST = \
|
|||
|
||||
relink:
|
||||
$(AM_V_at)rm -f XWin$(EXEEXT) && $(MAKE) XWin$(EXEEXT)
|
||||
|
||||
SUBDIRS = $(GLX_DIR) .
|
||||
DIST_SUBDIRS = glx .
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
# ignore downloaded and generated files
|
||||
generated_gl_wrappers.c
|
||||
generated_wgl_wrappers.c
|
||||
gl.spec
|
||||
gl.tm
|
||||
wgl.tm
|
||||
wglext.spec
|
||||
wglext.h
|
|
@ -0,0 +1,59 @@
|
|||
noinst_LTLIBRARIES = libXwinGLX.la
|
||||
|
||||
libXwinGLX_la_SOURCES = \
|
||||
winpriv.c \
|
||||
glwindows.h \
|
||||
glwrap.c \
|
||||
indirect.c \
|
||||
wgl_ext_api.c
|
||||
|
||||
if XWIN_MULTIWINDOW
|
||||
DEFS_MULTIWINDOW = -DXWIN_MULTIWINDOW
|
||||
endif
|
||||
|
||||
if XWIN_MULTIWINDOWEXTWM
|
||||
DEFS_MULTIWINDOWEXTWM = -DXWIN_MULTIWINDOWEXTWM
|
||||
endif
|
||||
|
||||
DEFS = $(DEFS_MULTIWINDOW) $(DEFS_MULTIWINDOWEXTWM)
|
||||
|
||||
INCLUDES = -I$(top_srcdir)/miext/rootless
|
||||
|
||||
AM_CFLAGS = -DHAVE_XWIN_CONFIG_H $(DIX_CFLAGS) \
|
||||
$(XWINMODULES_CFLAGS) \
|
||||
-I$(top_srcdir) \
|
||||
-I$(top_srcdir)/hw/xwin/
|
||||
|
||||
glwrap.c: generated_gl_wrappers.c
|
||||
wgl_ext_api.c: generated_wgl_wrappers.c wglext.h
|
||||
wgl_ext_api.h: wglext.h
|
||||
indirect.c: wgl_ext_api.h
|
||||
|
||||
SPEC_FILES = gl.spec gl.tm wglext.spec wgl.tm
|
||||
|
||||
gl.spec:
|
||||
wget http://www.opengl.org/registry/api/gl.spec
|
||||
|
||||
gl.tm:
|
||||
wget http://www.opengl.org/registry/api/gl.tm
|
||||
|
||||
wglext.spec:
|
||||
wget http://www.opengl.org/registry/api/wglext.spec
|
||||
|
||||
wgl.tm:
|
||||
wget http://www.opengl.org/registry/api/wgl.tm
|
||||
|
||||
generated_gl_wrappers.c: gen_gl_wrappers.py gl.spec gl.tm
|
||||
./gen_gl_wrappers.py --spec=gl.spec --typemap=gl.tm --dispatch-header=$(top_srcdir)/glx/dispatch.h --staticwrappers >generated_gl_wrappers.c
|
||||
|
||||
generated_wgl_wrappers.c: gen_gl_wrappers.py wglext.spec wgl.tm
|
||||
./gen_gl_wrappers.py --spec=wglext.spec --typemap=wgl.tm --prefix=wgl --preresolve >generated_wgl_wrappers.c
|
||||
|
||||
wglext.h:
|
||||
wget http://www.opengl.org/registry/api/wglext.h
|
||||
|
||||
BUILT_SOURCES = generated_gl_wrappers.c generated_wgl_wrappers.c
|
||||
CLEANFILES = $(BUILT_SOURCES)
|
||||
DISTCLEANFILES = $(SPEC_FILES) wglext.h
|
||||
|
||||
EXTRA_DIST = gen_gl_wrappers.py $(SPEC_FILES) wglext.h
|
|
@ -0,0 +1,319 @@
|
|||
#!/usr/bin/python
|
||||
#
|
||||
# Comedy python script to generate cdecl to stdcall wrappers for GL functions
|
||||
#
|
||||
# This is designed to operate on OpenGL spec files from
|
||||
# http://www.opengl.org/registry/api/
|
||||
#
|
||||
#
|
||||
# Copyright (c) Jon TURNEY 2009
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a
|
||||
# copy of this software and associated documentation files (the "Software"),
|
||||
# to deal in the Software without restriction, including without limitation
|
||||
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
# and/or sell copies of the Software, and to permit persons to whom the
|
||||
# Software is furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in
|
||||
# all copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
# THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
# DEALINGS IN THE SOFTWARE.
|
||||
#
|
||||
# Except as contained in this notice, the name(s) of the above copyright
|
||||
# holders shall not be used in advertising or otherwise to promote the sale,
|
||||
# use or other dealings in this Software without prior written authorization.
|
||||
#
|
||||
|
||||
import sys
|
||||
import re
|
||||
import getopt
|
||||
|
||||
dispatchheader = ''
|
||||
prefix = 'gl'
|
||||
preresolve = False
|
||||
staticwrappers = False
|
||||
|
||||
opts, args = getopt.getopt(sys.argv[1:], "", ['spec=', 'typemap=', 'dispatch-header=', 'prefix=', 'preresolve', 'staticwrappers' ])
|
||||
|
||||
for o,a in opts:
|
||||
if o == '--typemap' :
|
||||
typemapfile = a
|
||||
elif o == '--dispatch-header' :
|
||||
dispatchheader = a
|
||||
elif o == '--spec' :
|
||||
specfile = a
|
||||
elif o == '--prefix' :
|
||||
prefix = a
|
||||
elif o == '--preresolve' :
|
||||
preresolve = True
|
||||
elif o == '--staticwrappers' :
|
||||
staticwrappers = True
|
||||
|
||||
#
|
||||
# look for all the SET_ macros in dispatch.h, this is the set of functions
|
||||
# we need to generate
|
||||
#
|
||||
|
||||
dispatch = {}
|
||||
|
||||
if dispatchheader :
|
||||
fh = open(dispatchheader)
|
||||
dispatchh = fh.readlines()
|
||||
|
||||
dispatch_regex = re.compile(r'#define\sSET_(\S*)\(')
|
||||
|
||||
for line in dispatchh :
|
||||
line = line.strip()
|
||||
m1 = dispatch_regex.search(line)
|
||||
|
||||
if m1 :
|
||||
dispatch[m1.group(1)] = 1
|
||||
|
||||
del dispatch['by_offset']
|
||||
|
||||
#
|
||||
# read the typemap .tm file
|
||||
#
|
||||
|
||||
typemap = {}
|
||||
|
||||
fh = open(typemapfile)
|
||||
tm = fh.readlines()
|
||||
|
||||
typemap_regex = re.compile(r'#define\sSET_(\S*)\(')
|
||||
|
||||
for line in tm :
|
||||
# ignore everything after a '#' as a comment
|
||||
hash = line.find('#')
|
||||
if hash != -1 :
|
||||
line = line[:hash-1]
|
||||
|
||||
# ignore blank lines
|
||||
if line.startswith('#') or len(line) == 0 :
|
||||
continue
|
||||
|
||||
l = line.split(',')
|
||||
typemap[l[0]] = l[3].strip()
|
||||
|
||||
# interestingly, * is not a C type
|
||||
if typemap['void'] == '*' :
|
||||
typemap['void'] = 'void'
|
||||
|
||||
#
|
||||
# crudely parse the .spec file
|
||||
#
|
||||
|
||||
r1 = re.compile(r'\t(\S*)\s+(\S*.*)')
|
||||
r2 = re.compile(r'(.*)\((.*)\)')
|
||||
r3 = re.compile(r'glWindowPos.*MESA')
|
||||
r4 = re.compile(r'gl.*Program(s|)NV')
|
||||
r5 = re.compile(r'glGetVertexAttribfvNV')
|
||||
|
||||
wrappers = {}
|
||||
|
||||
fh = open(specfile)
|
||||
glspec = fh.readlines()
|
||||
param_count = 0
|
||||
|
||||
for line in glspec :
|
||||
line = line.rstrip()
|
||||
|
||||
# ignore everything after a '#' as a comment
|
||||
hash = line.find('#')
|
||||
if hash != -1 :
|
||||
line = line[:hash-1]
|
||||
|
||||
# ignore blank lines
|
||||
if line.startswith('#') or len(line) == 0 :
|
||||
continue
|
||||
|
||||
# lines containing ':' aren't intersting to us
|
||||
if line.count(':') != 0 :
|
||||
continue
|
||||
|
||||
# attributes of each function follow the name, indented by a tab
|
||||
if not line.startswith('\t') :
|
||||
m1 = r2.search(line)
|
||||
if m1 :
|
||||
function = m1.group(1)
|
||||
arglist_use = m1.group(2)
|
||||
wrappers[function] = {}
|
||||
|
||||
# near and far might be reserved words or macros so can't be used as formal parameter names
|
||||
arglist_use = arglist_use.replace('near','zNear')
|
||||
arglist_use = arglist_use.replace('far','zFar')
|
||||
|
||||
wrappers[function]['arglist_use'] = arglist_use
|
||||
param_count = 0
|
||||
else :
|
||||
m1 = r1.search(line)
|
||||
if m1 :
|
||||
attribute = m1.group(1)
|
||||
value = m1.group(2)
|
||||
|
||||
# make param attributes unique and ordered
|
||||
if attribute == 'param' :
|
||||
attribute = 'param' + '%02d' % param_count
|
||||
param_count += 1
|
||||
|
||||
wrappers[function][attribute] = value
|
||||
|
||||
#
|
||||
# now emit code
|
||||
#
|
||||
|
||||
print '/* Automatically generated by ' + sys.argv[0] + ' DO NOT EDIT */'
|
||||
print '/* from ' + specfile + ' and typemap ' + typemapfile + ' */'
|
||||
print ''
|
||||
|
||||
#
|
||||
# if required, emit code for non-lazy function resolving
|
||||
#
|
||||
|
||||
if preresolve :
|
||||
for w in sorted(wrappers.keys()) :
|
||||
funcname = prefix + w
|
||||
print 'RESOLVE_DECL(PFN' + funcname.upper() + 'PROC);'
|
||||
|
||||
print ''
|
||||
print 'void ' + prefix + 'ResolveExtensionProcs(void)'
|
||||
print '{'
|
||||
|
||||
for w in sorted(wrappers.keys()) :
|
||||
funcname = prefix + w
|
||||
print ' PRERESOLVE(PFN' + funcname.upper() + 'PROC, "' + funcname + '");'
|
||||
|
||||
print '}\n'
|
||||
|
||||
#
|
||||
# now emit the wrappers
|
||||
# for GL 1.0 and 1.1 functions, generate stdcall wrappers which call the function directly
|
||||
# for GL 1.2+ functions, generate wrappers which use wglGetProcAddress()
|
||||
#
|
||||
|
||||
for w in sorted(wrappers.keys()) :
|
||||
|
||||
funcname = prefix + w
|
||||
returntype = wrappers[w]['return']
|
||||
if returntype != 'void' :
|
||||
returntype = typemap[returntype]
|
||||
|
||||
# Avoid generating wrappers which aren't referenced by the dispatch table
|
||||
if dispatchheader and not dispatch.has_key(w) :
|
||||
print '/* No wrapper for ' + funcname + ', not in dispatch table */'
|
||||
continue
|
||||
|
||||
# manufacture arglist
|
||||
# if no param attributes were found, it should be 'void'
|
||||
al = []
|
||||
for k in sorted(wrappers[w].keys()) :
|
||||
if k.startswith('param') :
|
||||
l = wrappers[w][k].split()
|
||||
|
||||
# near and far might be reserved words or macros so can't be used as formal parameter names
|
||||
l[0] = l[0].replace('near','zNear')
|
||||
l[0] = l[0].replace('far','zFar')
|
||||
|
||||
if l[2] == 'in' :
|
||||
if l[3] == 'array' :
|
||||
arg = 'const ' + typemap[l[1]] + ' *' + l[0]
|
||||
else :
|
||||
arg = typemap[l[1]] + ' ' + l[0]
|
||||
elif l[2] == 'out' :
|
||||
arg = typemap[l[1]] + ' *' + l[0]
|
||||
|
||||
al.append(arg)
|
||||
|
||||
if len(al) == 0 :
|
||||
arglist = 'void'
|
||||
else:
|
||||
arglist = ', '.join(al)
|
||||
|
||||
if wrappers[w]['category'].startswith('VERSION_1_0') or wrappers[w]['category'].startswith('VERSION_1_1') :
|
||||
if staticwrappers :
|
||||
print 'static',
|
||||
print returntype + ' ' + funcname + 'Wrapper(' + arglist + ')'
|
||||
print '{'
|
||||
print ' if (glxWinDebugSettings.enable' + prefix.upper() + 'callTrace) ErrorF("'+ funcname + '\\n");'
|
||||
print ' glWinDirectProcCalls++;'
|
||||
if returntype.lower() == 'void' :
|
||||
print ' ' + funcname + '(',
|
||||
else :
|
||||
print ' /* returntype was ' + returntype.lower() + '*/'
|
||||
print ' return ' + funcname + '(',
|
||||
|
||||
if arglist != 'void' :
|
||||
print wrappers[w]['arglist_use'],
|
||||
|
||||
print ');'
|
||||
print "}\n"
|
||||
else:
|
||||
if staticwrappers :
|
||||
print 'static',
|
||||
print returntype + ' ' + funcname + 'Wrapper(' + arglist + ')'
|
||||
print '{'
|
||||
|
||||
stringname = funcname
|
||||
|
||||
#
|
||||
# special case: Windows OpenGL implementations are far more likely to have GL_ARB_window_pos than GL_MESA_window_pos,
|
||||
# so arrange for the wrapper to use the ARB strings to find functions...
|
||||
#
|
||||
|
||||
m2 = r3.search(funcname)
|
||||
if m2 :
|
||||
stringname = stringname.replace('MESA','ARB')
|
||||
|
||||
#
|
||||
# special case: likewise, implementations are more likely to have GL_ARB_vertex_program than GL_NV_vertex_program,
|
||||
# especially if they are not NV implementations, so arrange for the wrapper to use ARB strings to find functions
|
||||
#
|
||||
|
||||
m3 = r4.search(funcname)
|
||||
if m3 :
|
||||
stringname = stringname.replace('NV','ARB')
|
||||
m4 = r5.search(funcname)
|
||||
if m4 :
|
||||
stringname = stringname.replace('NV','ARB')
|
||||
|
||||
pfntypename = 'PFN' + funcname.upper() + 'PROC'
|
||||
|
||||
if returntype.lower() == 'void' :
|
||||
print ' RESOLVE(' + pfntypename + ', "' + stringname + '");'
|
||||
print ' if (glxWinDebugSettings.enable' + prefix.upper() + 'callTrace) ErrorF("'+ funcname + '\\n");'
|
||||
print ' RESOLVED_PROC(' + pfntypename + ')(',
|
||||
else :
|
||||
print ' RESOLVE_RET(' + pfntypename + ', "' + stringname + '", FALSE);'
|
||||
print ' if (glxWinDebugSettings.enable' + prefix.upper() + 'callTrace) ErrorF("'+ funcname + '\\n");'
|
||||
print ' return RESOLVED_PROC(' + pfntypename + ')(',
|
||||
|
||||
if arglist != 'void' :
|
||||
print wrappers[w]['arglist_use'],
|
||||
|
||||
print ');'
|
||||
print "}\n"
|
||||
|
||||
|
||||
# generate function to setup the dispatch table, which sets each
|
||||
# dispatch table entry to point to it's wrapper function
|
||||
# (assuming we were able to make one)
|
||||
|
||||
if dispatchheader :
|
||||
print 'void glWinSetupDispatchTable(void)'
|
||||
print '{'
|
||||
print ' struct _glapi_table *disp = _glapi_get_dispatch();'
|
||||
|
||||
for d in sorted(dispatch.keys()) :
|
||||
if wrappers.has_key(d) :
|
||||
print ' SET_'+ d + '(disp, ' + prefix + d + 'Wrapper);'
|
||||
else :
|
||||
print '#warning No wrapper for ' + prefix + d + ' !'
|
||||
|
||||
print '}'
|
|
@ -1,64 +1,58 @@
|
|||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
#endif
|
||||
/*
|
||||
* File: glwindows.h
|
||||
* Purpose: Header for GLX implementation using native Windows OpenGL library
|
||||
*
|
||||
* Authors: Alexander Gottwald
|
||||
* Jon TURNEY
|
||||
*
|
||||
* Copyright (c) Jon TURNEY 2009
|
||||
* Copyright (c) Alexander Gottwald 2004
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
|
||||
#include <X11/Xwindows.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
|
||||
#include <glxserver.h>
|
||||
#include <glxext.h>
|
||||
|
||||
#include <windowstr.h>
|
||||
#include <resource.h>
|
||||
#include <GL/glxint.h>
|
||||
#include <GL/glxtokens.h>
|
||||
#include <scrnintstr.h>
|
||||
#include <glxserver.h>
|
||||
#include <glxscreens.h>
|
||||
#include <glxdrawable.h>
|
||||
#include <glxcontext.h>
|
||||
#include <glxext.h>
|
||||
#include <glxutil.h>
|
||||
#include <glxscreens.h>
|
||||
#include <GL/internal/glcore.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
|
||||
typedef struct {
|
||||
unsigned enableDebug : 1;
|
||||
unsigned enableTrace : 1;
|
||||
unsigned dumpPFD : 1;
|
||||
unsigned dumpHWND : 1;
|
||||
unsigned dumpDC : 1;
|
||||
} glWinDebugSettingsRec, *glWinDebugSettingsPtr;
|
||||
extern glWinDebugSettingsRec glWinDebugSettings;
|
||||
unsigned int enableDebug : 1;
|
||||
unsigned int enableTrace : 1;
|
||||
unsigned int dumpPFD : 1;
|
||||
unsigned int dumpHWND : 1;
|
||||
unsigned int dumpDC : 1;
|
||||
unsigned int enableGLcallTrace : 1;
|
||||
unsigned int enableWGLcallTrace :1;
|
||||
} glxWinDebugSettingsRec;
|
||||
|
||||
typedef struct {
|
||||
int num_vis;
|
||||
__GLcontextModes *modes;
|
||||
void **priv;
|
||||
extern glxWinDebugSettingsRec glxWinDebugSettings;
|
||||
|
||||
/* wrapped screen functions */
|
||||
RealizeWindowProcPtr RealizeWindow;
|
||||
UnrealizeWindowProcPtr UnrealizeWindow;
|
||||
CopyWindowProcPtr CopyWindow;
|
||||
} glWinScreenRec;
|
||||
|
||||
extern glWinScreenRec glWinScreens[MAXSCREENS];
|
||||
|
||||
#define glWinGetScreenPriv(pScreen) &glWinScreens[pScreen->myNum]
|
||||
#define glWinScreenPriv(pScreen) glWinScreenRec *pScreenPriv = glWinGetScreenPriv(pScreen);
|
||||
void glWinCallDelta(void);
|
||||
void glxWinPushNativeProvider(void);
|
||||
const GLubyte* glGetStringWrapperNonstatic(GLenum name);
|
||||
void glAddSwapHintRectWINWrapperNonstatic(GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
void glWinSetupDispatchTable(void);
|
||||
|
||||
#if 1
|
||||
#define GLWIN_TRACE() if (glWinDebugSettings.enableTrace) ErrorF("%s:%d: Trace\n", __FUNCTION__, __LINE__ )
|
||||
#define GLWIN_TRACE_MSG(msg, args...) if (glWinDebugSettings.enableTrace) ErrorF("%s:%d: " msg, __FUNCTION__, __LINE__, ##args )
|
||||
#define GLWIN_DEBUG_MSG(msg, args...) if (glWinDebugSettings.enableDebug) ErrorF("%s:%d: " msg, __FUNCTION__, __LINE__, ##args )
|
||||
#define GLWIN_DEBUG_MSG2(msg, args...) if (glWinDebugSettings.enableDebug) ErrorF(msg, ##args )
|
||||
#define GLWIN_TRACE_MSG(msg, args...) if (glxWinDebugSettings.enableTrace) ErrorF(msg " [%s:%d]\n" , ##args , __FUNCTION__, __LINE__ )
|
||||
#define GLWIN_DEBUG_MSG(msg, args...) if (glxWinDebugSettings.enableDebug) ErrorF(msg " [%s:%d]\n" , ##args , __FUNCTION__, __LINE__ )
|
||||
#else
|
||||
#define GLWIN_TRACE()
|
||||
#define GLWIN_TRACE_MSG(a, ...)
|
||||
#define GLWIN_DEBUG_MSG(a, ...)
|
||||
#define GLWIN_DEBUG_MSG2(a, ...)
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,583 +1,148 @@
|
|||
/*
|
||||
* GLX implementation that uses Win32's OpenGL
|
||||
* Wrapper functions for Win32's OpenGL
|
||||
* File: glwrap.c
|
||||
* Purpose: Wrapper functions for Win32 OpenGL functions
|
||||
*
|
||||
* Authors: Alexander Gottwald
|
||||
* Jon TURNEY
|
||||
*
|
||||
* Copyright (c) Jon TURNEY 2009
|
||||
* Copyright (c) Alexander Gottwald 2004
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_DIX_CONFIG_H
|
||||
#include <dix-config.h>
|
||||
// define USE_OPENGL32 makes gl.h declare gl*() function prototypes with stdcall linkage,
|
||||
// so our generated wrappers will correctly link with the functions in opengl32.dll
|
||||
#define USE_OPENGL32
|
||||
|
||||
#ifdef HAVE_XWIN_CONFIG_H
|
||||
#include <xwin-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/Xwindows.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
#include <glxserver.h>
|
||||
#include <glxext.h>
|
||||
#include <glx/glxserver.h>
|
||||
#include <glx/glxext.h>
|
||||
#include <glx/glapi.h>
|
||||
#include <glx/dispatch.h>
|
||||
#include <glwindows.h>
|
||||
|
||||
#define RESOLVE_RET(procname, symbol, retval) \
|
||||
static Bool init = TRUE; \
|
||||
static procname proc = NULL; \
|
||||
if (init) { \
|
||||
proc = (procname)wglGetProcAddress(symbol); \
|
||||
init = FALSE; \
|
||||
if (proc == NULL) { \
|
||||
ErrorF("glwrap: Can't resolve \"%s\"\n", symbol); \
|
||||
} else \
|
||||
ErrorF("glwrap: resolved \"%s\"\n", symbol); \
|
||||
} \
|
||||
if (proc == NULL) { \
|
||||
__glXErrorCallBack(NULL, 0); \
|
||||
return retval; \
|
||||
static unsigned int glWinIndirectProcCalls = 0;
|
||||
static unsigned int glWinDirectProcCalls = 0;
|
||||
|
||||
void
|
||||
glWinCallDelta(void)
|
||||
{
|
||||
static unsigned int glWinIndirectProcCallsLast = 0;
|
||||
static unsigned int glWinDirectProcCallsLast = 0;
|
||||
if ((glWinIndirectProcCalls != glWinIndirectProcCallsLast) ||
|
||||
(glWinDirectProcCalls != glWinDirectProcCallsLast))
|
||||
{
|
||||
if (glxWinDebugSettings.enableTrace)
|
||||
{
|
||||
ErrorF("after %d direct and %d indirect GL calls\n",
|
||||
glWinDirectProcCalls - glWinDirectProcCallsLast,
|
||||
glWinIndirectProcCalls - glWinIndirectProcCallsLast);
|
||||
}
|
||||
glWinDirectProcCallsLast = glWinDirectProcCalls;
|
||||
glWinIndirectProcCallsLast = glWinIndirectProcCalls;
|
||||
}
|
||||
#define RESOLVE(procname, symbol) RESOLVE_RET(procname, symbol,)
|
||||
|
||||
|
||||
}
|
||||
|
||||
static PROC
|
||||
glWinResolveHelper(PROC *cache, char *symbol)
|
||||
{
|
||||
PROC proc = NULL;
|
||||
|
||||
/* If not yet cached, call wglGetProcAddress */
|
||||
if ((*cache) == NULL)
|
||||
{
|
||||
proc = wglGetProcAddress(symbol);
|
||||
if (proc == NULL)
|
||||
{
|
||||
ErrorF("glwrap: Can't resolve \"%s\"\n", symbol);
|
||||
(*cache) = (PROC)-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
ErrorF("glwrap: Resolved \"%s\"\n", symbol);
|
||||
(*cache) = proc;
|
||||
}
|
||||
}
|
||||
/* Cached wglGetProcAddress failure */
|
||||
else if ((*cache) == (PROC)-1)
|
||||
{
|
||||
proc = 0;
|
||||
}
|
||||
/* Cached wglGetProcAddress result */
|
||||
else
|
||||
{
|
||||
proc = (*cache);
|
||||
}
|
||||
|
||||
return proc;
|
||||
}
|
||||
|
||||
#define RESOLVE_RET(proctype, symbol, retval) \
|
||||
static PROC cache = NULL; \
|
||||
__stdcall proctype proc = (proctype)glWinResolveHelper(&cache, symbol); \
|
||||
if (proc == NULL) { \
|
||||
__glXErrorCallBack(0); \
|
||||
return retval; \
|
||||
} \
|
||||
glWinIndirectProcCalls++;
|
||||
|
||||
#define RESOLVE(proctype, symbol) RESOLVE_RET(proctype, symbol,)
|
||||
|
||||
#define RESOLVED_PROC(proctype) proc
|
||||
|
||||
/*
|
||||
* GL_ARB_imaging
|
||||
*/
|
||||
Include generated cdecl wrappers for stdcall gl*() functions in opengl32.dll
|
||||
|
||||
OpenGL 1.2 and upward is treated as extensions, function address must
|
||||
found using wglGetProcAddress(), but also stdcall so still need wrappers...
|
||||
|
||||
GLAPI void GLAPIENTRY glColorTable( GLenum target, GLenum internalformat,
|
||||
GLsizei width, GLenum format,
|
||||
GLenum type, const GLvoid *table )
|
||||
Include generated dispatch table setup function
|
||||
*/
|
||||
|
||||
#include "generated_gl_wrappers.c"
|
||||
|
||||
/*
|
||||
Special non-static wrapper for glGetString for debug output
|
||||
*/
|
||||
|
||||
const GLubyte* glGetStringWrapperNonstatic(GLenum name)
|
||||
{
|
||||
RESOLVE(PFNGLCOLORTABLEPROC, "glColorTable");
|
||||
proc(target, internalformat, width, format, type, table);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glColorSubTable( GLenum target,
|
||||
GLsizei start, GLsizei count,
|
||||
GLenum format, GLenum type,
|
||||
const GLvoid *data )
|
||||
{
|
||||
RESOLVE(PFNGLCOLORSUBTABLEPROC, "glColorSubTable");
|
||||
proc(target, start, count, format, type, data);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glColorTableParameteriv(GLenum target, GLenum pname,
|
||||
const GLint *params)
|
||||
{
|
||||
RESOLVE(PFNGLCOLORTABLEPARAMETERIVPROC, "glColorTableParameteriv");
|
||||
proc(target, pname, params);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glColorTableParameterfv(GLenum target, GLenum pname,
|
||||
const GLfloat *params)
|
||||
{
|
||||
RESOLVE(PFNGLCOLORTABLEPARAMETERFVPROC, "glColorTableParameterfv");
|
||||
proc(target, pname, params);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glCopyColorSubTable( GLenum target, GLsizei start,
|
||||
GLint x, GLint y, GLsizei width )
|
||||
{
|
||||
RESOLVE(PFNGLCOPYCOLORSUBTABLEPROC, "glCopyColorSubTable");
|
||||
proc(target, start, x, y, width);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glCopyColorTable( GLenum target, GLenum internalformat,
|
||||
GLint x, GLint y, GLsizei width )
|
||||
{
|
||||
RESOLVE(PFNGLCOPYCOLORTABLEPROC, "glCopyColorTable");
|
||||
proc(target, internalformat, x, y, width);
|
||||
}
|
||||
|
||||
|
||||
GLAPI void GLAPIENTRY glGetColorTable( GLenum target, GLenum format,
|
||||
GLenum type, GLvoid *table )
|
||||
{
|
||||
RESOLVE(PFNGLGETCOLORTABLEPROC, "glGetColorTable");
|
||||
proc(target, format, type, table);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glGetColorTableParameterfv( GLenum target, GLenum pname,
|
||||
GLfloat *params )
|
||||
{
|
||||
RESOLVE(PFNGLGETCOLORTABLEPARAMETERFVPROC, "glGetColorTableParameterfv");
|
||||
proc(target, pname, params);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glGetColorTableParameteriv( GLenum target, GLenum pname,
|
||||
GLint *params )
|
||||
{
|
||||
RESOLVE(PFNGLGETCOLORTABLEPARAMETERIVPROC, "glGetColorTableParameteriv");
|
||||
proc(target, pname, params);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glBlendEquation( GLenum mode )
|
||||
{
|
||||
RESOLVE(PFNGLBLENDEQUATIONPROC, "glBlendEquation");
|
||||
proc(mode);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glBlendColor( GLclampf red, GLclampf green,
|
||||
GLclampf blue, GLclampf alpha )
|
||||
{
|
||||
RESOLVE(PFNGLBLENDCOLORPROC, "glBlendColor");
|
||||
proc(red, green, blue, alpha);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glHistogram( GLenum target, GLsizei width,
|
||||
GLenum internalformat, GLboolean sink )
|
||||
{
|
||||
RESOLVE(PFNGLHISTOGRAMPROC, "glHistogram");
|
||||
proc(target, width, internalformat, sink);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glResetHistogram( GLenum target )
|
||||
{
|
||||
RESOLVE(PFNGLRESETHISTOGRAMPROC, "glResetHistogram");
|
||||
proc(target);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glGetHistogram( GLenum target, GLboolean reset,
|
||||
GLenum format, GLenum type,
|
||||
GLvoid *values )
|
||||
{
|
||||
RESOLVE(PFNGLGETHISTOGRAMPROC, "glGetHistogram");
|
||||
proc(target, reset, format, type, values);
|
||||
};
|
||||
|
||||
GLAPI void GLAPIENTRY glGetHistogramParameterfv( GLenum target, GLenum pname,
|
||||
GLfloat *params )
|
||||
{
|
||||
RESOLVE(PFNGLGETHISTOGRAMPARAMETERFVPROC, "glGetHistogramParameterfv");
|
||||
proc(target, pname, params);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glGetHistogramParameteriv( GLenum target, GLenum pname,
|
||||
GLint *params )
|
||||
{
|
||||
RESOLVE(PFNGLGETHISTOGRAMPARAMETERIVPROC, "glGetHistogramParameteriv");
|
||||
proc(target, pname, params);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glMinmax( GLenum target, GLenum internalformat,
|
||||
GLboolean sink )
|
||||
{
|
||||
RESOLVE(PFNGLMINMAXPROC, "glMinmax");
|
||||
proc(target, internalformat, sink);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glResetMinmax( GLenum target )
|
||||
{
|
||||
RESOLVE(PFNGLRESETMINMAXPROC, "glResetMinmax");
|
||||
proc(target);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glGetMinmax( GLenum target, GLboolean reset,
|
||||
GLenum format, GLenum types,
|
||||
GLvoid *values )
|
||||
{
|
||||
RESOLVE(PFNGLGETMINMAXPROC, "glGetMinmax");
|
||||
proc(target, reset, format, types, values);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glGetMinmaxParameterfv( GLenum target, GLenum pname,
|
||||
GLfloat *params )
|
||||
{
|
||||
RESOLVE(PFNGLGETMINMAXPARAMETERFVPROC, "glGetMinmaxParameterfv");
|
||||
proc(target, pname, params);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glGetMinmaxParameteriv( GLenum target, GLenum pname,
|
||||
GLint *params )
|
||||
{
|
||||
RESOLVE(PFNGLGETMINMAXPARAMETERIVPROC, "glGetMinmaxParameteriv");
|
||||
proc(target, pname, params);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glConvolutionFilter1D( GLenum target,
|
||||
GLenum internalformat, GLsizei width, GLenum format, GLenum type,
|
||||
const GLvoid *image )
|
||||
{
|
||||
RESOLVE(PFNGLCONVOLUTIONFILTER1DPROC, "glConvolutionFilter1D");
|
||||
proc(target, internalformat, width, format, type, image);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glConvolutionFilter2D( GLenum target,
|
||||
GLenum internalformat, GLsizei width, GLsizei height, GLenum format,
|
||||
GLenum type, const GLvoid *image )
|
||||
{
|
||||
RESOLVE(PFNGLCONVOLUTIONFILTER2DPROC, "glConvolutionFilter2D");
|
||||
proc(target, internalformat, width, height, format, type, image);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glConvolutionParameterf( GLenum target, GLenum pname,
|
||||
GLfloat params )
|
||||
{
|
||||
RESOLVE(PFNGLCONVOLUTIONPARAMETERFPROC, "glConvolutionParameterf");
|
||||
proc(target, pname, params);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glConvolutionParameterfv( GLenum target, GLenum pname,
|
||||
const GLfloat *params )
|
||||
{
|
||||
RESOLVE(PFNGLCONVOLUTIONPARAMETERFVPROC, "glConvolutionParameterfv");
|
||||
proc(target, pname, params);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glConvolutionParameteri( GLenum target, GLenum pname,
|
||||
GLint params )
|
||||
{
|
||||
RESOLVE(PFNGLCONVOLUTIONPARAMETERIPROC, "glConvolutionParameteri");
|
||||
proc(target, pname, params);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glConvolutionParameteriv( GLenum target, GLenum pname,
|
||||
const GLint *params )
|
||||
{
|
||||
RESOLVE(PFNGLCONVOLUTIONPARAMETERIVPROC, "glConvolutionParameteriv");
|
||||
proc(target, pname, params);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glCopyConvolutionFilter1D( GLenum target,
|
||||
GLenum internalformat, GLint x, GLint y, GLsizei width )
|
||||
{
|
||||
RESOLVE(PFNGLCOPYCONVOLUTIONFILTER1DPROC, "glCopyConvolutionFilter1D");
|
||||
proc(target, internalformat, x, y, width);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glCopyConvolutionFilter2D( GLenum target,
|
||||
GLenum internalformat, GLint x, GLint y, GLsizei width,
|
||||
GLsizei height)
|
||||
{
|
||||
RESOLVE(PFNGLCOPYCONVOLUTIONFILTER2DPROC, "glCopyConvolutionFilter2D");
|
||||
proc(target, internalformat, x, y, width, height);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glGetConvolutionFilter( GLenum target, GLenum format,
|
||||
GLenum type, GLvoid *image )
|
||||
{
|
||||
RESOLVE(PFNGLGETCONVOLUTIONFILTERPROC, "glGetConvolutionFilter");
|
||||
proc(target, format, type, image);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glGetConvolutionParameterfv( GLenum target, GLenum pname,
|
||||
GLfloat *params )
|
||||
{
|
||||
RESOLVE(PFNGLGETCONVOLUTIONPARAMETERFVPROC, "glGetConvolutionParameterfv");
|
||||
proc(target, pname, params);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glGetConvolutionParameteriv( GLenum target, GLenum pname,
|
||||
GLint *params )
|
||||
{
|
||||
RESOLVE(PFNGLGETCONVOLUTIONPARAMETERIVPROC, "glGetConvolutionParameteriv");
|
||||
proc(target, pname, params);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glSeparableFilter2D( GLenum target,
|
||||
GLenum internalformat, GLsizei width, GLsizei height, GLenum format,
|
||||
GLenum type, const GLvoid *row, const GLvoid *column )
|
||||
{
|
||||
RESOLVE(PFNGLSEPARABLEFILTER2DPROC, "glSeparableFilter2D");
|
||||
proc(target, internalformat, width, height, format, type, row, column);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glGetSeparableFilter( GLenum target, GLenum format,
|
||||
GLenum type, GLvoid *row, GLvoid *column, GLvoid *span )
|
||||
{
|
||||
RESOLVE(PFNGLGETSEPARABLEFILTERPROC, "glGetSeparableFilter");
|
||||
proc(target, format, type, row, column, span);
|
||||
return glGetString(name);
|
||||
}
|
||||
|
||||
/*
|
||||
* OpenGL 1.2
|
||||
*/
|
||||
Special non-static wrapper for glAddSwapHintRectWIN for copySubBuffers
|
||||
*/
|
||||
|
||||
GLAPI void GLAPIENTRY glTexImage3D( GLenum target, GLint level,
|
||||
GLint internalFormat,
|
||||
GLsizei width, GLsizei height,
|
||||
GLsizei depth, GLint border,
|
||||
GLenum format, GLenum type,
|
||||
const GLvoid *pixels )
|
||||
typedef void (__stdcall *PFNGLADDSWAPHINTRECTWIN)(GLint x, GLint y, GLsizei width, GLsizei height);
|
||||
|
||||
void glAddSwapHintRectWINWrapperNonstatic(GLint x, GLint y, GLsizei width, GLsizei height)
|
||||
{
|
||||
RESOLVE(PFNGLTEXIMAGE3DPROC, "glTexImage3D");
|
||||
proc(target, level, internalFormat, width, height, depth, border, format, type, pixels);
|
||||
RESOLVE(PFNGLADDSWAPHINTRECTWIN, "glAddSwapHintRectWIN");
|
||||
proc(x, y, width, height);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glTexSubImage3D( GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset,
|
||||
GLint zoffset, GLsizei width,
|
||||
GLsizei height, GLsizei depth,
|
||||
GLenum format,
|
||||
GLenum type, const GLvoid *pixels)
|
||||
{
|
||||
RESOLVE(PFNGLTEXSUBIMAGE3DPROC, "glTexSubImage3D");
|
||||
proc(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glCopyTexSubImage3D( GLenum target, GLint level,
|
||||
GLint xoffset, GLint yoffset,
|
||||
GLint zoffset, GLint x,
|
||||
GLint y, GLsizei width,
|
||||
GLsizei height )
|
||||
{
|
||||
RESOLVE(PFNGLCOPYTEXSUBIMAGE3DPROC, "glCopyTexSubImage3D");
|
||||
proc(target, level, xoffset, yoffset, zoffset, x, y, width, height);
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 20. GL_EXT_texture_object
|
||||
*/
|
||||
GLAPI void GLAPIENTRY glGenTexturesEXT( GLsizei n, GLuint *textures )
|
||||
{
|
||||
glGenTextures(n, textures);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glDeleteTexturesEXT( GLsizei n, const GLuint *textures)
|
||||
{
|
||||
glDeleteTextures(n, textures);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glBindTextureEXT( GLenum target, GLuint texture )
|
||||
{
|
||||
glBindTexture(target, target);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glPrioritizeTexturesEXT( GLsizei n, const GLuint *textures, const GLclampf *priorities )
|
||||
{
|
||||
glPrioritizeTextures(n, textures, priorities);
|
||||
}
|
||||
|
||||
GLAPI GLboolean GLAPIENTRY glAreTexturesResidentEXT( GLsizei n, const GLuint *textures, GLboolean *residences )
|
||||
{
|
||||
return glAreTexturesResident(n, textures, residences);
|
||||
}
|
||||
|
||||
GLAPI GLboolean GLAPIENTRY glIsTextureEXT( GLuint texture )
|
||||
{
|
||||
return glIsTexture(texture);
|
||||
}
|
||||
|
||||
/*
|
||||
* GL_ARB_multitexture (ARB extension 1 and OpenGL 1.2.1)
|
||||
*/
|
||||
|
||||
GLAPI void GLAPIENTRY glActiveTextureARB(GLenum texture)
|
||||
{
|
||||
RESOLVE(PFNGLACTIVETEXTUREARBPROC, "glActiveTextureARB");
|
||||
proc(texture);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord1dvARB(GLenum target, const GLdouble *v)
|
||||
{
|
||||
RESOLVE(PFNGLMULTITEXCOORD1DVARBPROC, "glMultiTexCoord1dvARB");
|
||||
proc(target, v);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord1fvARB(GLenum target, const GLfloat *v)
|
||||
{
|
||||
RESOLVE(PFNGLMULTITEXCOORD1FVARBPROC, "glMultiTexCoord1fvARB");
|
||||
proc(target, v);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord1ivARB(GLenum target, const GLint *v)
|
||||
{
|
||||
RESOLVE(PFNGLMULTITEXCOORD1IVARBPROC, "glMultiTexCoord1ivARB");
|
||||
proc(target, v);
|
||||
}
|
||||
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord1svARB(GLenum target, const GLshort *v)
|
||||
{
|
||||
RESOLVE(PFNGLMULTITEXCOORD1SVARBPROC, "glMultiTexCoord1svARB");
|
||||
proc(target, v);
|
||||
}
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord2dvARB(GLenum target, const GLdouble *v)
|
||||
{
|
||||
RESOLVE(PFNGLMULTITEXCOORD2DVARBPROC, "glMultiTexCoord2dvARB");
|
||||
proc(target, v);
|
||||
}
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord2fvARB(GLenum target, const GLfloat *v)
|
||||
{
|
||||
RESOLVE(PFNGLMULTITEXCOORD2FVARBPROC, "glMultiTexCoord2fvARB");
|
||||
proc(target, v);
|
||||
}
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord2ivARB(GLenum target, const GLint *v)
|
||||
{
|
||||
RESOLVE(PFNGLMULTITEXCOORD2IVARBPROC, "glMultiTexCoord2ivARB");
|
||||
proc(target, v);
|
||||
}
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord2svARB(GLenum target, const GLshort *v)
|
||||
{
|
||||
RESOLVE(PFNGLMULTITEXCOORD1SVARBPROC, "glMultiTexCoord1svARB");
|
||||
proc(target, v);
|
||||
}
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord3dvARB(GLenum target, const GLdouble *v)
|
||||
{
|
||||
RESOLVE(PFNGLMULTITEXCOORD3DVARBPROC, "glMultiTexCoord3dvARB");
|
||||
proc(target, v);
|
||||
}
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord3fvARB(GLenum target, const GLfloat *v)
|
||||
{
|
||||
RESOLVE(PFNGLMULTITEXCOORD3FVARBPROC, "glMultiTexCoord3fvARB");
|
||||
proc(target, v);
|
||||
}
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord3ivARB(GLenum target, const GLint *v)
|
||||
{
|
||||
RESOLVE(PFNGLMULTITEXCOORD3IVARBPROC, "glMultiTexCoord3ivARB");
|
||||
proc(target, v);
|
||||
}
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord3svARB(GLenum target, const GLshort *v)
|
||||
{
|
||||
RESOLVE(PFNGLMULTITEXCOORD1SVARBPROC, "glMultiTexCoord1svARB");
|
||||
proc(target, v);
|
||||
}
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord4dvARB(GLenum target, const GLdouble *v)
|
||||
{
|
||||
RESOLVE(PFNGLMULTITEXCOORD4DVARBPROC, "glMultiTexCoord4dvARB");
|
||||
proc(target, v);
|
||||
}
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord4fvARB(GLenum target, const GLfloat *v)
|
||||
{
|
||||
RESOLVE(PFNGLMULTITEXCOORD4FVARBPROC, "glMultiTexCoord4fvARB");
|
||||
proc(target, v);
|
||||
}
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord4ivARB(GLenum target, const GLint *v)
|
||||
{
|
||||
RESOLVE(PFNGLMULTITEXCOORD4IVARBPROC, "glMultiTexCoord4ivARB");
|
||||
proc(target, v);
|
||||
}
|
||||
GLAPI void GLAPIENTRY glMultiTexCoord4svARB(GLenum target, const GLshort *v)
|
||||
{
|
||||
RESOLVE(PFNGLMULTITEXCOORD1SVARBPROC, "glMultiTexCoord1svARB");
|
||||
proc(target, v);
|
||||
}
|
||||
|
||||
|
||||
GLAPI void GLAPIENTRY glActiveStencilFaceEXT(GLenum face)
|
||||
{
|
||||
RESOLVE(PFNGLACTIVESTENCILFACEEXTPROC, "glActiveStencilFaceEXT");
|
||||
proc(face);
|
||||
}
|
||||
|
||||
GLAPI void APIENTRY glPointParameterfARB(GLenum pname, GLfloat param)
|
||||
{
|
||||
RESOLVE(PFNGLPOINTPARAMETERFARBPROC, "glPointParameterfARB");
|
||||
proc(pname, param);
|
||||
}
|
||||
|
||||
GLAPI void APIENTRY glPointParameterfvARB(GLenum pname, const GLfloat *params)
|
||||
{
|
||||
RESOLVE(PFNGLPOINTPARAMETERFVARBPROC, "glPointParameterfvARB");
|
||||
proc(pname, params);
|
||||
}
|
||||
|
||||
|
||||
GLAPI void APIENTRY glWindowPos3fARB(GLfloat x, GLfloat y, GLfloat z)
|
||||
{
|
||||
RESOLVE(PFNGLWINDOWPOS3FARBPROC, "glWindowPos3fARB");
|
||||
proc(x, y, z);
|
||||
}
|
||||
|
||||
GLAPI void APIENTRY glPointParameteri(GLenum pname, GLint param)
|
||||
{
|
||||
RESOLVE(PFNGLPOINTPARAMETERIPROC, "glPointParameteri");
|
||||
proc(pname, param);
|
||||
}
|
||||
|
||||
GLAPI void APIENTRY glPointParameteriv(GLenum pname, const GLint *params)
|
||||
{
|
||||
RESOLVE(PFNGLPOINTPARAMETERIVPROC, "glPointParameteriv");
|
||||
proc(pname, params);
|
||||
}
|
||||
|
||||
GLAPI void APIENTRY glPointParameteriNV(GLenum pname, GLint param)
|
||||
{
|
||||
RESOLVE(PFNGLPOINTPARAMETERINVPROC, "glPointParameteriNV");
|
||||
proc(pname, param);
|
||||
}
|
||||
|
||||
GLAPI void APIENTRY glPointParameterivNV(GLenum pname, const GLint *params)
|
||||
{
|
||||
RESOLVE(PFNGLPOINTPARAMETERIVNVPROC, "glPointParameterivNV");
|
||||
proc(pname, params);
|
||||
}
|
||||
|
||||
GLAPI void APIENTRY glSecondaryColor3bv(const GLbyte *v)
|
||||
{
|
||||
RESOLVE(PFNGLSECONDARYCOLOR3BVPROC, "glSecondaryColor3bv");
|
||||
proc(v);
|
||||
}
|
||||
GLAPI void APIENTRY glSecondaryColor3dv(const GLdouble *v)
|
||||
{
|
||||
RESOLVE(PFNGLSECONDARYCOLOR3DVPROC, "glSecondaryColor3dv");
|
||||
proc(v);
|
||||
}
|
||||
GLAPI void APIENTRY glSecondaryColor3fv(const GLfloat *v)
|
||||
{
|
||||
RESOLVE(PFNGLSECONDARYCOLOR3FVPROC, "glSecondaryColor3fv");
|
||||
proc(v);
|
||||
}
|
||||
GLAPI void APIENTRY glSecondaryColor3iv(const GLint *v)
|
||||
{
|
||||
RESOLVE(PFNGLSECONDARYCOLOR3IVPROC, "glSecondaryColor3iv");
|
||||
proc(v);
|
||||
}
|
||||
GLAPI void APIENTRY glSecondaryColor3sv(const GLshort *v)
|
||||
{
|
||||
RESOLVE(PFNGLSECONDARYCOLOR3SVPROC, "glSecondaryColor3sv");
|
||||
proc(v);
|
||||
}
|
||||
GLAPI void APIENTRY glSecondaryColor3ubv(const GLubyte *v)
|
||||
{
|
||||
RESOLVE(PFNGLSECONDARYCOLOR3UBVPROC, "glSecondaryColor3ubv");
|
||||
proc(v);
|
||||
}
|
||||
GLAPI void APIENTRY glSecondaryColor3uiv(const GLuint *v)
|
||||
{
|
||||
RESOLVE(PFNGLSECONDARYCOLOR3UIVPROC, "glSecondaryColor3uiv");
|
||||
proc(v);
|
||||
}
|
||||
GLAPI void APIENTRY glSecondaryColor3usv(const GLushort *v)
|
||||
{
|
||||
RESOLVE(PFNGLSECONDARYCOLOR3USVPROC, "glSecondaryColor3usv");
|
||||
proc(v);
|
||||
}
|
||||
GLAPI void APIENTRY glSecondaryColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer)
|
||||
{
|
||||
RESOLVE(PFNGLSECONDARYCOLORPOINTERPROC, "glSecondaryColorPointer");
|
||||
proc(size, type, stride, pointer);
|
||||
}
|
||||
|
||||
|
||||
GLAPI void APIENTRY glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha)
|
||||
{
|
||||
RESOLVE(PFNGLBLENDFUNCSEPARATEPROC, "glBlendFuncSeparate");
|
||||
proc(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha);
|
||||
}
|
||||
GLAPI void APIENTRY glFogCoordfv(const GLfloat *coord)
|
||||
{
|
||||
RESOLVE(PFNGLFOGCOORDFVPROC, "glFogCoordfv");
|
||||
proc(coord);
|
||||
}
|
||||
GLAPI void APIENTRY glFogCoorddv(const GLdouble *coord)
|
||||
{
|
||||
RESOLVE(PFNGLFOGCOORDDVPROC, "glFogCoorddv");
|
||||
proc(coord);
|
||||
}
|
||||
GLAPI void APIENTRY glFogCoordPointer(GLenum type, GLsizei stride, const GLvoid *pointer)
|
||||
{
|
||||
RESOLVE(PFNGLFOGCOORDPOINTERPROC, "glFogCoordPointer");
|
||||
proc(type, stride, pointer);
|
||||
}
|
||||
|
||||
|
||||
GLAPI void APIENTRY glSampleCoverageARB(GLclampf value, GLboolean invert)
|
||||
{
|
||||
RESOLVE(PFNGLSAMPLECOVERAGEARBPROC, "glSampleCoverageARB");
|
||||
proc(value, invert);
|
||||
}
|
||||
GLAPI void APIENTRY glSampleMaskSGIS(GLclampf value, GLboolean invert)
|
||||
{
|
||||
RESOLVE(PFNGLSAMPLEMASKSGISPROC, "glSampleMaskSGIS");
|
||||
proc(value, invert);
|
||||
}
|
||||
GLAPI void APIENTRY glSamplePatternSGIS(GLenum pattern)
|
||||
{
|
||||
RESOLVE(PFNGLSAMPLEPATTERNSGISPROC, "glSamplePatternSGIS");
|
||||
proc(pattern);
|
||||
}
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,75 @@
|
|||
/*
|
||||
* File: wgl_ext_api.c
|
||||
* Purpose: Wrapper functions for Win32 OpenGL wgl extension functions
|
||||
*
|
||||
* Authors: Jon TURNEY
|
||||
*
|
||||
* Copyright (c) Jon TURNEY 2009
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_XWIN_CONFIG_H
|
||||
#include <xwin-config.h>
|
||||
#endif
|
||||
|
||||
#include <X11/Xwindows.h>
|
||||
#include <GL/gl.h>
|
||||
#include <GL/glext.h>
|
||||
#include <glx/glxserver.h>
|
||||
#include <glx/glxext.h>
|
||||
#include "wglext.h"
|
||||
#include <wgl_ext_api.h>
|
||||
#include "glwindows.h"
|
||||
|
||||
#define RESOLVE_DECL(type) \
|
||||
static type type##proc = NULL;
|
||||
|
||||
#define PRERESOLVE(type, symbol) \
|
||||
type##proc = (type)wglGetProcAddress(symbol); \
|
||||
if (type##proc == NULL) \
|
||||
ErrorF("wglwrap: Can't resolve \"%s\"\n", symbol); \
|
||||
else \
|
||||
ErrorF("wglwrap: Resolved \"%s\"\n", symbol);
|
||||
|
||||
#define RESOLVE_RET(type, symbol, retval) \
|
||||
if (type##proc == NULL) { \
|
||||
__glXErrorCallBack(0); \
|
||||
return retval; \
|
||||
}
|
||||
|
||||
#define RESOLVE(procname, symbol) RESOLVE_RET(procname, symbol,)
|
||||
|
||||
#define RESOLVED_PROC(type) type##proc
|
||||
|
||||
/*
|
||||
* Include generated cdecl wrappers for stdcall WGL functions
|
||||
*
|
||||
* There are extensions to the wgl*() API as well; again we call
|
||||
* these functions by using wglGetProcAddress() to get a pointer
|
||||
* to the function, and wrapping it for cdecl/stdcall conversion
|
||||
*
|
||||
* We arrange to resolve the functions up front, as they need a
|
||||
* context to work, as we like to use them to be able to select
|
||||
* a context. Again, this assumption fails badly on multimontor
|
||||
* systems...
|
||||
*/
|
||||
|
||||
#include "generated_wgl_wrappers.c"
|
|
@ -0,0 +1,87 @@
|
|||
/*
|
||||
* File: wgl_ext_api.h
|
||||
* Purpose: Wrapper functions for Win32 OpenGL wgl extension functions
|
||||
*
|
||||
* Authors: Jon TURNEY
|
||||
*
|
||||
* Copyright (c) Jon TURNEY 2009
|
||||
*
|
||||
*
|
||||
* Permission is hereby granted, free of charge, to any person obtaining a
|
||||
* copy of this software and associated documentation files (the "Software"),
|
||||
* to deal in the Software without restriction, including without limitation
|
||||
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
* and/or sell copies of the Software, and to permit persons to whom the
|
||||
* Software is furnished to do so, subject to the following conditions:
|
||||
*
|
||||
* The above copyright notice and this permission notice shall be included in
|
||||
* all copies or substantial portions of the Software.
|
||||
*
|
||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
|
||||
* THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
|
||||
* OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
|
||||
* ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
* DEALINGS IN THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef wgl_ext_api_h
|
||||
#define wgl_ext_api_h
|
||||
|
||||
#include "wglext.h"
|
||||
|
||||
void wglResolveExtensionProcs(void);
|
||||
|
||||
/*
|
||||
Prototypes for wrapper functions we actually use
|
||||
XXX: should be automatically generated as well
|
||||
*/
|
||||
|
||||
const char *wglGetExtensionsStringARBWrapper(HDC hdc);
|
||||
BOOL wglMakeContextCurrentARBWrapper(HDC hDrawDC, HDC hReadDC, HGLRC hglrc);
|
||||
HDC wglGetCurrentReadDCARBWrapper(VOID);
|
||||
|
||||
BOOL wglGetPixelFormatAttribivARBWrapper(HDC hdc,
|
||||
int iPixelFormat,
|
||||
int iLayerPlane,
|
||||
UINT nAttributes,
|
||||
const int *piAttributes,
|
||||
int *piValues);
|
||||
|
||||
BOOL wglGetPixelFormatAttribfvARBWrapper(HDC hdc,
|
||||
int iPixelFormat,
|
||||
int iLayerPlane,
|
||||
UINT nAttributes,
|
||||
const int *piAttributes,
|
||||
FLOAT *pfValues);
|
||||
|
||||
BOOL wglChoosePixelFormatARBWrapper(HDC hdc,
|
||||
const int *piAttribIList,
|
||||
const FLOAT *pfAttribFList,
|
||||
UINT nMaxFormats,
|
||||
int *piFormats,
|
||||
UINT *nNumFormats);
|
||||
|
||||
HPBUFFERARB wglCreatePbufferARBWrapper(HDC hDC,
|
||||
int iPixelFormat,
|
||||
int iWidth,
|
||||
int iHeight,
|
||||
const int *piAttribList);
|
||||
|
||||
HDC wglGetPbufferDCARBWrapper(HPBUFFERARB hPbuffer);
|
||||
|
||||
int wglReleasePbufferDCARBWrapper(HPBUFFERARB hPbuffer,
|
||||
HDC hDC);
|
||||
|
||||
BOOL wglDestroyPbufferARBWrapper(HPBUFFERARB hPbuffer);
|
||||
|
||||
BOOL wglQueryPbufferARBWrapper(HPBUFFERARB hPbuffer,
|
||||
int iAttribute,
|
||||
int *piValue);
|
||||
|
||||
BOOL wglSwapIntervalEXTWrapper(int interval);
|
||||
|
||||
int wglGetSwapIntervalEXTWrapper(void);
|
||||
|
||||
#endif /* wgl_ext_api_h */
|
|
@ -16,43 +16,27 @@ winCreateWindowsWindow (WindowPtr pWin);
|
|||
/**
|
||||
* Return size and handles of a window.
|
||||
* If pWin is NULL, then the information for the root window is requested.
|
||||
*/
|
||||
extern void winGetWindowInfo(WindowPtr pWin, winWindowInfoPtr pWinInfo)
|
||||
*/
|
||||
HWND winGetWindowInfo(WindowPtr pWin)
|
||||
{
|
||||
/* Sanity check */
|
||||
if (pWinInfo == NULL)
|
||||
return;
|
||||
|
||||
winDebug("%s:%d pWin=%p\n", __FUNCTION__, __LINE__, pWin);
|
||||
winDebug("%s: pWin=%p\n", __FUNCTION__, pWin);
|
||||
|
||||
/* a real window was requested */
|
||||
if (pWin != NULL)
|
||||
if (pWin != NULL)
|
||||
{
|
||||
/* Initialize the size information */
|
||||
RECT rect = {
|
||||
pWin->drawable.x,
|
||||
pWin->drawable.y,
|
||||
pWin->drawable.x + pWin->drawable.width,
|
||||
pWin->drawable.y + pWin->drawable.height
|
||||
}, rect_extends;
|
||||
/* Get the window and screen privates */
|
||||
ScreenPtr pScreen = pWin->drawable.pScreen;
|
||||
winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
|
||||
winScreenInfoPtr pScreenInfo = NULL;
|
||||
HWND hwnd = NULL;
|
||||
|
||||
rect_extends = rect;
|
||||
OffsetRect(&rect_extends, -pWin->drawable.x, -pWin->drawable.y);
|
||||
|
||||
if (pWinScreen == NULL)
|
||||
if (pWinScreen == NULL)
|
||||
{
|
||||
ErrorF("winGetWindowInfo: screen has no privates\n");
|
||||
return;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pWinInfo->hwnd = pWinScreen->hwndScreen;
|
||||
pWinInfo->hrgn = NULL;
|
||||
pWinInfo->rect = rect;
|
||||
|
||||
|
||||
hwnd = pWinScreen->hwndScreen;
|
||||
|
||||
pScreenInfo = pWinScreen->pScreenInfo;
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
|
@ -64,28 +48,22 @@ extern void winGetWindowInfo(WindowPtr pWin, winWindowInfoPtr pWinInfo)
|
|||
if (pWinPriv == NULL)
|
||||
{
|
||||
ErrorF("winGetWindowInfo: window has no privates\n");
|
||||
return;
|
||||
return hwnd;
|
||||
}
|
||||
|
||||
if (pWinPriv->hWnd == NULL)
|
||||
{
|
||||
winCreateWindowsWindow(pWin);
|
||||
winCreateWindowsWindow(pWin);
|
||||
ErrorF("winGetWindowInfo: forcing window to exist...\n");
|
||||
}
|
||||
if (pWinPriv->hWnd != NULL) {
|
||||
|
||||
/* copy size and window handle */
|
||||
pWinInfo->rect = rect_extends;
|
||||
pWinInfo->hwnd = pWinPriv->hWnd;
|
||||
|
||||
/* Copy window region */
|
||||
if (pWinInfo->hrgn)
|
||||
DeleteObject(pWinInfo->hrgn);
|
||||
pWinInfo->hrgn = CreateRectRgn(0,0,0,0);
|
||||
CombineRgn(pWinInfo->hrgn, pWinPriv->hRgn, pWinPriv->hRgn,
|
||||
RGN_COPY);
|
||||
}
|
||||
|
||||
return;
|
||||
if (pWinPriv->hWnd != NULL)
|
||||
{
|
||||
/* copy window handle */
|
||||
hwnd = pWinPriv->hWnd;
|
||||
}
|
||||
|
||||
return hwnd;
|
||||
}
|
||||
#endif
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
|
@ -97,38 +75,52 @@ extern void winGetWindowInfo(WindowPtr pWin, winWindowInfoPtr pWinInfo)
|
|||
|
||||
if (pRLWinPriv == NULL) {
|
||||
ErrorF("winGetWindowInfo: window has no privates\n");
|
||||
return;
|
||||
return hwnd;
|
||||
}
|
||||
|
||||
|
||||
if (pRLWinPriv->hWnd != NULL)
|
||||
{
|
||||
/* copy size and window handle */
|
||||
pWinInfo->rect = rect_extends;
|
||||
pWinInfo->hwnd = pRLWinPriv->hWnd;
|
||||
/* copy window handle */
|
||||
hwnd = pRLWinPriv->hWnd;
|
||||
}
|
||||
return;
|
||||
return hwnd;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
else
|
||||
}
|
||||
else
|
||||
{
|
||||
RECT rect = {0, 0, 0, 0};
|
||||
ScreenPtr pScreen = g_ScreenInfo[0].pScreen;
|
||||
winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
|
||||
|
||||
pWinInfo->hwnd = NULL;
|
||||
pWinInfo->hrgn = NULL;
|
||||
pWinInfo->rect = rect;
|
||||
|
||||
if (pWinScreen == NULL)
|
||||
{
|
||||
ErrorF("winGetWindowInfo: screen has no privates\n");
|
||||
return;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ErrorF("winGetWindowInfo: returning root window\n");
|
||||
|
||||
pWinInfo->hwnd = pWinScreen->hwndScreen;
|
||||
return pWinScreen->hwndScreen;
|
||||
}
|
||||
return;
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
Bool
|
||||
winCheckScreenAiglxIsSupported(ScreenPtr pScreen)
|
||||
{
|
||||
winPrivScreenPtr pWinScreen = winGetScreenPriv(pScreen);
|
||||
winScreenInfoPtr pScreenInfo = pWinScreen->pScreenInfo;
|
||||
|
||||
#ifdef XWIN_MULTIWINDOW
|
||||
if (pScreenInfo->fMultiWindow)
|
||||
return TRUE;
|
||||
#endif
|
||||
|
||||
#ifdef XWIN_MULTIWINDOWEXTWM
|
||||
if (pScreenInfo->fMWExtWM)
|
||||
return TRUE;
|
||||
#endif
|
||||
|
||||
return FALSE;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
/*
|
||||
* Export window information for the Windows-OpenGL GLX implementation.
|
||||
*
|
||||
* Authors: Alexander Gottwald
|
||||
*/
|
||||
|
||||
#include <X11/Xwindows.h>
|
||||
#include <windowstr.h>
|
||||
|
||||
HWND winGetWindowInfo(WindowPtr pWin);
|
||||
Bool winCheckScreenAiglxIsSupported(ScreenPtr pScreen);
|
|
@ -85,7 +85,7 @@ HWND g_hwndKeyboardFocus = NULL;
|
|||
Bool g_fNoHelpMessageBox = FALSE;
|
||||
Bool g_fSoftwareCursor = FALSE;
|
||||
Bool g_fSilentDupError = FALSE;
|
||||
|
||||
Bool g_fNativeGl = FALSE;
|
||||
|
||||
/*
|
||||
* Global variables for dynamically loaded libraries and
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
extern HICON g_hIconX;
|
||||
extern HICON g_hSmallIconX;
|
||||
extern HWND g_hDlgDepthChange;
|
||||
extern Bool g_fNativeGl;
|
||||
|
||||
/*
|
||||
* Prototypes for local functions
|
||||
|
@ -74,7 +75,7 @@ void winInitMultiWindowClass(void)
|
|||
{
|
||||
/* Setup our window class */
|
||||
wcx.cbSize=sizeof(WNDCLASSEX);
|
||||
wcx.style = CS_HREDRAW | CS_VREDRAW;
|
||||
wcx.style = CS_HREDRAW | CS_VREDRAW | (g_fNativeGl ? CS_OWNDC : 0);
|
||||
wcx.lpfnWndProc = winTopLevelWindowProc;
|
||||
wcx.cbClsExtra = 0;
|
||||
wcx.cbWndExtra = 0;
|
||||
|
|
|
@ -1,15 +0,0 @@
|
|||
/*
|
||||
* Export window information for the Windows-OpenGL GLX implementation.
|
||||
*
|
||||
* Authors: Alexander Gottwald
|
||||
*/
|
||||
#include <windows.h>
|
||||
|
||||
typedef struct
|
||||
{
|
||||
HWND hwnd;
|
||||
HRGN hrgn;
|
||||
RECT rect;
|
||||
} winWindowInfoRec, *winWindowInfoPtr;
|
||||
|
||||
extern void winGetWindowInfo(WindowPtr pWin, winWindowInfoPtr pWinInfo);
|
|
@ -64,6 +64,7 @@ extern Bool g_fKeyboardHookLL;
|
|||
extern Bool g_fNoHelpMessageBox;
|
||||
extern Bool g_fSoftwareCursor;
|
||||
extern Bool g_fSilentDupError;
|
||||
extern Bool g_fNativeGl;
|
||||
|
||||
/* globals required by callback function for monitor information */
|
||||
struct GetMonitorInfoData {
|
||||
|
@ -1464,6 +1465,19 @@ ddxProcessArgument (int argc, char *argv[], int i)
|
|||
g_fSilentDupError = TRUE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (IS_OPTION("-wgl"))
|
||||
{
|
||||
g_fNativeGl = TRUE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (IS_OPTION("-nowgl"))
|
||||
{
|
||||
g_fNativeGl = FALSE;
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue