If a context is already attached copy it instead of reattaching to keep

displaylists and share displaylists Enable tracing of often called
    functions with GLWIN_ENABLE_TRACE ForceCurrent is a no-op now
This commit is contained in:
Alexander Gottwald 2005-03-01 18:58:17 +00:00
parent d323c4f59a
commit 6c6151b233
3 changed files with 416 additions and 276 deletions

View File

@ -1,6 +1,15 @@
2005-03-01 Alexander Gottwald <ago at freedesktop dot org>
* indirect.c:
* glwindows.h:
If a context is already attached copy it instead of reattaching to keep
displaylists and share displaylists
Enable tracing of often called functions with GLWIN_ENABLE_TRACE
ForceCurrent is a no-op now
2005-02-02 Alexander Gottwald <ago at freedesktop dot org> 2005-02-02 Alexander Gottwald <ago at freedesktop dot org>
* xc/programs/Xserver/GL/windows/Imakefile: * Imakefile:
Bugzilla #1866 (https://bugs.freedesktop.org/show_bug.cgi?id=1866) Bugzilla #1866 (https://bugs.freedesktop.org/show_bug.cgi?id=1866)
attachment #1819 (https://bugs.freedesktop.org/attachment.cgi?id=1819): attachment #1819 (https://bugs.freedesktop.org/attachment.cgi?id=1819):
Define APIENTRY on windows to prevent <GL/gl.h> from loading <windows.h> Define APIENTRY on windows to prevent <GL/gl.h> from loading <windows.h>

View File

@ -23,6 +23,7 @@
typedef struct { typedef struct {
unsigned enableDebug : 1; unsigned enableDebug : 1;
unsigned enableTrace : 1;
unsigned dumpPFD : 1; unsigned dumpPFD : 1;
unsigned dumpHWND : 1; unsigned dumpHWND : 1;
unsigned dumpDC : 1; unsigned dumpDC : 1;
@ -46,9 +47,13 @@ extern glWinScreenRec glWinScreens[MAXSCREENS];
#define glWinScreenPriv(pScreen) glWinScreenRec *pScreenPriv = glWinGetScreenPriv(pScreen); #define glWinScreenPriv(pScreen) glWinScreenRec *pScreenPriv = glWinGetScreenPriv(pScreen);
#if 1 #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_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_DEBUG_MSG2(msg, args...) if (glWinDebugSettings.enableDebug) ErrorF(msg, ##args )
#else #else
#define GLWIN_TRACE()
#define GLWIN_TRACE_MSG(a, ...)
#define GLWIN_DEBUG_MSG(a, ...) #define GLWIN_DEBUG_MSG(a, ...)
#define GLWIN_DEBUG_MSG2(a, ...) #define GLWIN_DEBUG_MSG2(a, ...)
#endif #endif

View File

@ -59,7 +59,7 @@
/* ggs: needed to call back to glx with visual configs */ /* ggs: needed to call back to glx with visual configs */
extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, void **configprivs); extern void GlxSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, void **configprivs);
glWinDebugSettingsRec glWinDebugSettings = { 1, 0, 0, 0}; glWinDebugSettingsRec glWinDebugSettings = { 1, 0, 0, 0, 0};
static void glWinInitDebugSettings(void) static void glWinInitDebugSettings(void)
{ {
@ -69,6 +69,10 @@ static void glWinInitDebugSettings(void)
if (envptr != NULL) if (envptr != NULL)
glWinDebugSettings.enableDebug = (atoi(envptr) == 1); glWinDebugSettings.enableDebug = (atoi(envptr) == 1);
envptr = getenv("GLWIN_ENABLE_TRACE");
if (envptr != NULL)
glWinDebugSettings.enableTrace = (atoi(envptr) == 1);
envptr = getenv("GLWIN_DUMP_PFD"); envptr = getenv("GLWIN_DUMP_PFD");
if (envptr != NULL) if (envptr != NULL)
glWinDebugSettings.dumpPFD = (atoi(envptr) == 1); glWinDebugSettings.dumpPFD = (atoi(envptr) == 1);
@ -144,8 +148,8 @@ GLuint __glFloorLog2(GLuint val)
int c = 0; int c = 0;
while (val > 1) { while (val > 1) {
c++; c++;
val >>= 1; val >>= 1;
} }
return c; return c;
} }
@ -153,14 +157,14 @@ GLuint __glFloorLog2(GLuint val)
/* some prototypes */ /* some prototypes */
static Bool glWinScreenProbe(int screen); static Bool glWinScreenProbe(int screen);
static Bool glWinInitVisuals(VisualPtr *visualp, DepthPtr *depthp, static Bool glWinInitVisuals(VisualPtr *visualp, DepthPtr *depthp,
int *nvisualp, int *ndepthp, int *nvisualp, int *ndepthp,
int *rootDepthp, VisualID *defaultVisp, int *rootDepthp, VisualID *defaultVisp,
unsigned long sizes, int bitsPerRGB); unsigned long sizes, int bitsPerRGB);
static void glWinSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, static void glWinSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
void **privates); void **privates);
static __GLinterface *glWinCreateContext(__GLimports *imports, static __GLinterface *glWinCreateContext(__GLimports *imports,
__GLcontextModes *mode, __GLcontextModes *mode,
__GLinterface *shareGC); __GLinterface *shareGC);
static void glWinCreateBuffer(__GLXdrawablePrivate *glxPriv); static void glWinCreateBuffer(__GLXdrawablePrivate *glxPriv);
static void glWinResetExtension(void); static void glWinResetExtension(void);
@ -209,7 +213,7 @@ static GLboolean glWinLoseCurrent(__GLcontext *gc);
static GLboolean glWinMakeCurrent(__GLcontext *gc); static GLboolean glWinMakeCurrent(__GLcontext *gc);
static GLboolean glWinShareContext(__GLcontext *gc, __GLcontext *gcShare); static GLboolean glWinShareContext(__GLcontext *gc, __GLcontext *gcShare);
static GLboolean glWinCopyContext(__GLcontext *dst, const __GLcontext *src, static GLboolean glWinCopyContext(__GLcontext *dst, const __GLcontext *src,
GLuint mask); GLuint mask);
static GLboolean glWinForceCurrent(__GLcontext *gc); static GLboolean glWinForceCurrent(__GLcontext *gc);
/* Drawing surface notification callbacks */ /* Drawing surface notification callbacks */
@ -267,6 +271,7 @@ struct __GLcontextRec {
static HDC glWinMakeDC(__GLcontext *gc) static HDC glWinMakeDC(__GLcontext *gc)
{ {
HDC dc; HDC dc;
/*if (gc->winInfo.hrgn == NULL) /*if (gc->winInfo.hrgn == NULL)
{ {
GLWIN_DEBUG_MSG("Creating region from RECT(%ld,%ld,%ld,%ld):", GLWIN_DEBUG_MSG("Creating region from RECT(%ld,%ld,%ld,%ld):",
@ -278,6 +283,9 @@ static HDC glWinMakeDC(__GLcontext *gc)
GLWIN_DEBUG_MSG2("%p\n", gc->winInfo.hrgn); GLWIN_DEBUG_MSG2("%p\n", gc->winInfo.hrgn);
}*/ }*/
if (glWinDebugSettings.enableTrace)
GLWIN_DEBUG_HWND(gc->winInfo.hwnd);
dc = GetDC(gc->winInfo.hwnd); dc = GetDC(gc->winInfo.hwnd);
/*dc = GetDCEx(gc->winInfo.hwnd, gc->winInfo.hrgn, /*dc = GetDCEx(gc->winInfo.hwnd, gc->winInfo.hrgn,
DCX_WINDOW | DCX_NORESETATTRS ); */ DCX_WINDOW | DCX_NORESETATTRS ); */
@ -316,11 +324,103 @@ static void unattach(__GLcontext *gc)
gc->isAttached = 0; gc->isAttached = 0;
} }
static BOOL glWinAdjustHWND(__GLcontext *gc, WindowPtr pWin)
{
HDC dc;
BOOL ret;
HGLRC newctx;
HWND oldhwnd;
GLWIN_DEBUG_MSG("glWinAdjustHWND (ctx %p, pWin %p)\n", gc->ctx, pWin);
if (pWin == NULL)
{
GLWIN_DEBUG_MSG("Deferring until window is created\n");
return FALSE;
}
oldhwnd = gc->winInfo.hwnd;
winGetWindowInfo(pWin, &gc->winInfo);
GLWIN_DEBUG_HWND(gc->winInfo.hwnd);
if (gc->winInfo.hwnd == NULL)
{
GLWIN_DEBUG_MSG("Deferring until window is created\n");
return FALSE;
}
dc = glWinMakeDC(gc);
if (glWinDebugSettings.dumpDC)
GLWIN_DEBUG_MSG("Got HDC %p\n", dc);
gc->pixelFormat = ChoosePixelFormat(dc, &gc->pfd);
if (gc->pixelFormat == 0)
{
ErrorF("ChoosePixelFormat error: %s\n", glWinErrorMessage());
ReleaseDC(gc->winInfo.hwnd, dc);
return FALSE;
}
ret = SetPixelFormat(dc, gc->pixelFormat, &gc->pfd);
if (!ret) {
ErrorF("SetPixelFormat error: %s\n", glWinErrorMessage());
ReleaseDC(gc->winInfo.hwnd, dc);
return FALSE;
}
newctx = wglCreateContext(dc);
if (newctx == NULL) {
ErrorF("wglCreateContext error: %s\n", glWinErrorMessage());
ReleaseDC(gc->winInfo.hwnd, dc);
return FALSE;
}
GLWIN_DEBUG_MSG("wglCreateContext (ctx %p)\n", newctx);
if (!wglShareLists(gc->ctx, newctx))
{
ErrorF("wglShareLists error: %s\n", glWinErrorMessage());
ReleaseDC(gc->winInfo.hwnd, dc);
return FALSE;
}
if (oldhwnd != gc->winInfo.hwnd)
{
GLWIN_DEBUG_MSG("Trying wglCopyContext\n");
if (!wglCopyContext(gc->ctx, newctx, GL_ALL_ATTRIB_BITS))
{
ErrorF("wglCopyContext error: %s\n", glWinErrorMessage());
ReleaseDC(gc->winInfo.hwnd, dc);
return FALSE;
}
}
if (!wglDeleteContext(gc->ctx))
{
ErrorF("wglDeleteContext error: %s\n", glWinErrorMessage());
}
gc->ctx = newctx;
if (!wglMakeCurrent(dc, gc->ctx)) {
ErrorF("glMakeCurrent error: %s\n", glWinErrorMessage());
ReleaseDC(gc->winInfo.hwnd, dc);
return FALSE;
}
ReleaseDC(gc->winInfo.hwnd, dc);
return TRUE;
}
static BOOL glWinCreateContextReal(__GLcontext *gc, WindowPtr pWin) static BOOL glWinCreateContextReal(__GLcontext *gc, WindowPtr pWin)
{ {
HDC dc; HDC dc;
BOOL ret; BOOL ret;
GLWIN_DEBUG_MSG("glWinCreateContextReal (pWin %p)\n", pWin);
if (pWin == NULL) if (pWin == NULL)
{ {
GLWIN_DEBUG_MSG("Deferring until window is created\n"); GLWIN_DEBUG_MSG("Deferring until window is created\n");
@ -363,6 +463,15 @@ static BOOL glWinCreateContextReal(__GLcontext *gc, WindowPtr pWin)
ReleaseDC(gc->winInfo.hwnd, dc); ReleaseDC(gc->winInfo.hwnd, dc);
return FALSE; return FALSE;
} }
GLWIN_DEBUG_MSG("glWinCreateContextReal (ctx %p)\n", gc->ctx);
if (!wglMakeCurrent(dc, gc->ctx)) {
ErrorF("glMakeCurrent error: %s\n", glWinErrorMessage());
ReleaseDC(gc->winInfo.hwnd, dc);
return FALSE;
}
ReleaseDC(gc->winInfo.hwnd, dc); ReleaseDC(gc->winInfo.hwnd, dc);
return TRUE; return TRUE;
@ -399,7 +508,7 @@ static void attach(__GLcontext *gc, __GLdrawablePrivate *glPriv)
static GLboolean glWinLoseCurrent(__GLcontext *gc) static GLboolean glWinLoseCurrent(__GLcontext *gc)
{ {
/*GLWIN_DEBUG_MSG("glWinLoseCurrent (ctx %p)\n", gc->ctx);*/ GLWIN_TRACE_MSG("glWinLoseCurrent (ctx %p)\n", gc->ctx);
__glXLastContext = NULL; /* Mesa does this; why? */ __glXLastContext = NULL; /* Mesa does this; why? */
@ -429,6 +538,8 @@ static GLboolean glWinMakeCurrent(__GLcontext *gc)
BOOL ret; BOOL ret;
HDC dc; HDC dc;
GLWIN_TRACE_MSG(" (ctx %p)\n", gc->ctx);
if (!gc->isAttached) if (!gc->isAttached)
attach(gc, glPriv); attach(gc, glPriv);
@ -460,8 +571,6 @@ static GLboolean glWinCopyContext(__GLcontext *dst, const __GLcontext *src,
GLWIN_DEBUG_MSG("glWinCopyContext\n"); GLWIN_DEBUG_MSG("glWinCopyContext\n");
ret = wglCopyContext(src->ctx, dst->ctx, mask); ret = wglCopyContext(src->ctx, dst->ctx, mask);
if (!ret) if (!ret)
{ {
@ -474,16 +583,9 @@ static GLboolean glWinCopyContext(__GLcontext *dst, const __GLcontext *src,
static GLboolean glWinForceCurrent(__GLcontext *gc) static GLboolean glWinForceCurrent(__GLcontext *gc)
{ {
BOOL ret; GLWIN_TRACE_MSG(" (ctx %p)\n", gc->ctx);
HDC dc;
dc = glWinMakeDC(gc); return GL_TRUE;
ret = wglMakeCurrent(dc, gc->ctx);
if (!ret)
ErrorF("wglSetCurrent error: %s\n", glWinErrorMessage());
ReleaseDC(gc->winInfo.hwnd, dc);
return ret?GL_TRUE:GL_FALSE;
} }
/* Drawing surface notification callbacks */ /* Drawing surface notification callbacks */
@ -534,28 +636,28 @@ static void pfdOut(const PIXELFORMATDESCRIPTOR *pfd)
ErrorF("nSize = %u\n", pfd->nSize); ErrorF("nSize = %u\n", pfd->nSize);
ErrorF("nVersion = %u\n", pfd->nVersion); ErrorF("nVersion = %u\n", pfd->nVersion);
ErrorF("dwFlags = %lu = {", pfd->dwFlags); ErrorF("dwFlags = %lu = {", pfd->dwFlags);
DUMP_PFD_FLAG(PFD_MAIN_PLANE); DUMP_PFD_FLAG(PFD_MAIN_PLANE);
DUMP_PFD_FLAG(PFD_OVERLAY_PLANE); DUMP_PFD_FLAG(PFD_OVERLAY_PLANE);
DUMP_PFD_FLAG(PFD_UNDERLAY_PLANE); DUMP_PFD_FLAG(PFD_UNDERLAY_PLANE);
DUMP_PFD_FLAG(PFD_DOUBLEBUFFER); DUMP_PFD_FLAG(PFD_DOUBLEBUFFER);
DUMP_PFD_FLAG(PFD_STEREO); DUMP_PFD_FLAG(PFD_STEREO);
DUMP_PFD_FLAG(PFD_DRAW_TO_WINDOW); DUMP_PFD_FLAG(PFD_DRAW_TO_WINDOW);
DUMP_PFD_FLAG(PFD_DRAW_TO_BITMAP); DUMP_PFD_FLAG(PFD_DRAW_TO_BITMAP);
DUMP_PFD_FLAG(PFD_SUPPORT_GDI); DUMP_PFD_FLAG(PFD_SUPPORT_GDI);
DUMP_PFD_FLAG(PFD_SUPPORT_OPENGL); DUMP_PFD_FLAG(PFD_SUPPORT_OPENGL);
DUMP_PFD_FLAG(PFD_GENERIC_FORMAT); DUMP_PFD_FLAG(PFD_GENERIC_FORMAT);
DUMP_PFD_FLAG(PFD_NEED_PALETTE); DUMP_PFD_FLAG(PFD_NEED_PALETTE);
DUMP_PFD_FLAG(PFD_NEED_SYSTEM_PALETTE); DUMP_PFD_FLAG(PFD_NEED_SYSTEM_PALETTE);
DUMP_PFD_FLAG(PFD_SWAP_EXCHANGE); DUMP_PFD_FLAG(PFD_SWAP_EXCHANGE);
DUMP_PFD_FLAG(PFD_SWAP_COPY); DUMP_PFD_FLAG(PFD_SWAP_COPY);
DUMP_PFD_FLAG(PFD_SWAP_LAYER_BUFFERS); DUMP_PFD_FLAG(PFD_SWAP_LAYER_BUFFERS);
DUMP_PFD_FLAG(PFD_GENERIC_ACCELERATED); DUMP_PFD_FLAG(PFD_GENERIC_ACCELERATED);
DUMP_PFD_FLAG(PFD_DEPTH_DONTCARE); DUMP_PFD_FLAG(PFD_DEPTH_DONTCARE);
DUMP_PFD_FLAG(PFD_DOUBLEBUFFER_DONTCARE); DUMP_PFD_FLAG(PFD_DOUBLEBUFFER_DONTCARE);
DUMP_PFD_FLAG(PFD_STEREO_DONTCARE); DUMP_PFD_FLAG(PFD_STEREO_DONTCARE);
ErrorF("}\n"); ErrorF("}\n");
ErrorF("iPixelType = %hhu = %s\n", pfd->iPixelType, ErrorF("iPixelType = %hu = %s\n", pfd->iPixelType,
(pfd->iPixelType == PFD_TYPE_RGBA ? "PFD_TYPE_RGBA" : "PFD_TYPE_COLORINDEX")); (pfd->iPixelType == PFD_TYPE_RGBA ? "PFD_TYPE_RGBA" : "PFD_TYPE_COLORINDEX"));
ErrorF("cColorBits = %hhu\n", pfd->cColorBits); ErrorF("cColorBits = %hhu\n", pfd->cColorBits);
ErrorF("cRedBits = %hhu\n", pfd->cRedBits); ErrorF("cRedBits = %hhu\n", pfd->cRedBits);
@ -670,8 +772,8 @@ static int makeFormat(__GLcontextModes *mode, PIXELFORMATDESCRIPTOR *pfdret)
} }
static __GLinterface *glWinCreateContext(__GLimports *imports, static __GLinterface *glWinCreateContext(__GLimports *imports,
__GLcontextModes *mode, __GLcontextModes *mode,
__GLinterface *shareGC) __GLinterface *shareGC)
{ {
__GLcontext *result; __GLcontext *result;
@ -702,6 +804,7 @@ Bool
glWinRealizeWindow(WindowPtr pWin) glWinRealizeWindow(WindowPtr pWin)
{ {
/* If this window has GL contexts, tell them to reattach */ /* If this window has GL contexts, tell them to reattach */
/* reattaching is bad: display lists and parameters get lost */
Bool result; Bool result;
ScreenPtr pScreen = pWin->drawable.pScreen; ScreenPtr pScreen = pWin->drawable.pScreen;
glWinScreenRec *screenPriv = &glWinScreens[pScreen->myNum]; glWinScreenRec *screenPriv = &glWinScreens[pScreen->myNum];
@ -726,7 +829,15 @@ glWinRealizeWindow(WindowPtr pWin)
for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->next) { for (gx = glxPriv->drawGlxc; gx != NULL; gx = gx->next) {
gc = (__GLcontext *)gx->gc; gc = (__GLcontext *)gx->gc;
if (gc->isAttached) if (gc->isAttached)
#if 1
{
GLWIN_DEBUG_MSG("context is already bound! Adjusting HWND.\n");
glWinAdjustHWND(gc, pWin);
continue;
}
#else
unattach(gc); unattach(gc);
#endif
attach(gc, glPriv); attach(gc, glPriv);
} }
@ -734,7 +845,15 @@ glWinRealizeWindow(WindowPtr pWin)
for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->next) { for (gx = glxPriv->readGlxc; gx != NULL; gx = gx->next) {
gc = (__GLcontext *)gx->gc; gc = (__GLcontext *)gx->gc;
if (gc->isAttached) if (gc->isAttached)
#if 1
{
GLWIN_DEBUG_MSG("context is already bound! Adjusting HWND.\n");
glWinAdjustHWND(gc, pWin);
continue;
}
#else
unattach(gc); unattach(gc);
#endif
attach(gc, glPriv); attach(gc, glPriv);
} }
} }
@ -750,6 +869,8 @@ glWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
glWinScreenRec *screenPriv = &glWinScreens[pScreen->myNum]; glWinScreenRec *screenPriv = &glWinScreens[pScreen->myNum];
__GLXdrawablePrivate *glxPriv; __GLXdrawablePrivate *glxPriv;
GLWIN_TRACE_MSG(" (pWindow %p)\n", pWindow);
/* Check if the window is attached and discard any drawing request */ /* Check if the window is attached and discard any drawing request */
glxPriv = __glXFindDrawablePrivate(pWindow->drawable.id); glxPriv = __glXFindDrawablePrivate(pWindow->drawable.id);
if (glxPriv) { if (glxPriv) {
@ -760,7 +881,8 @@ glWinCopyWindow(WindowPtr pWindow, DDXPointRec ptOldOrg, RegionPtr prgnSrc)
/* /*
GLWIN_DEBUG_MSG("glWinCopyWindow - calling glDrawBuffer\n"); GLWIN_DEBUG_MSG("glWinCopyWindow - calling glDrawBuffer\n");
glDrawBuffer(GL_FRONT); glDrawBuffer(GL_FRONT);
*/ */
return; return;
} }
@ -885,9 +1007,9 @@ static inline int count_bits(uint32_t x)
/* Mostly copied from Mesa's xf86glx.c */ /* Mostly copied from Mesa's xf86glx.c */
static Bool init_visuals(int *nvisualp, VisualPtr *visualp, static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
VisualID *defaultVisp, VisualID *defaultVisp,
int ndepth, DepthPtr pdepth, int ndepth, DepthPtr pdepth,
int rootDepth) int rootDepth)
{ {
int numRGBconfigs; int numRGBconfigs;
int numCIconfigs; int numCIconfigs;
@ -915,14 +1037,14 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
pNewVisualConfigs = (__GLXvisualConfig *) pNewVisualConfigs = (__GLXvisualConfig *)
__glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig)); __glXMalloc(numNewConfigs * sizeof(__GLXvisualConfig));
if (!pNewVisualConfigs) { if (!pNewVisualConfigs) {
return FALSE; return FALSE;
} }
/* Alloc space for the list of new GLX visual privates */ /* Alloc space for the list of new GLX visual privates */
pNewVisualPriv = (void **) __glXMalloc(numNewConfigs * sizeof(void *)); pNewVisualPriv = (void **) __glXMalloc(numNewConfigs * sizeof(void *));
if (!pNewVisualPriv) { if (!pNewVisualPriv) {
__glXFree(pNewVisualConfigs); __glXFree(pNewVisualConfigs);
return FALSE; return FALSE;
} }
/* /*
@ -930,9 +1052,9 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
** visual configs. ** visual configs.
*/ */
if (numConfigs == 0) { if (numConfigs == 0) {
memcpy(pNewVisualConfigs, FallbackConfigs, memcpy(pNewVisualConfigs, FallbackConfigs,
NUM_FALLBACK_CONFIGS * sizeof(__GLXvisualConfig)); NUM_FALLBACK_CONFIGS * sizeof(__GLXvisualConfig));
memset(pNewVisualPriv, 0, NUM_FALLBACK_CONFIGS * sizeof(void *)); memset(pNewVisualPriv, 0, NUM_FALLBACK_CONFIGS * sizeof(void *));
} }
else { else {
/* copy driver's visual config info */ /* copy driver's visual config info */
@ -946,22 +1068,22 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
numRGBconfigs = 0; numRGBconfigs = 0;
numCIconfigs = 0; numCIconfigs = 0;
for (i = 0; i < numNewConfigs; i++) { for (i = 0; i < numNewConfigs; i++) {
if (pNewVisualConfigs[i].rgba) if (pNewVisualConfigs[i].rgba)
numRGBconfigs++; numRGBconfigs++;
else else
numCIconfigs++; numCIconfigs++;
} }
/* Count the total number of visuals to compute */ /* Count the total number of visuals to compute */
numNewVisuals = 0; numNewVisuals = 0;
for (i = 0; i < numVisuals; i++) { for (i = 0; i < numVisuals; i++) {
int count; int count;
count = ((pVisual[i].class == TrueColor count = ((pVisual[i].class == TrueColor
|| pVisual[i].class == DirectColor) || pVisual[i].class == DirectColor)
? numRGBconfigs : numCIconfigs); ? numRGBconfigs : numCIconfigs);
if (count == 0) if (count == 0)
count = 1; /* preserve the existing visual */ count = 1; /* preserve the existing visual */
numNewVisuals += count; numNewVisuals += count;
} }
@ -973,39 +1095,39 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
/* Alloc temp space for the list of orig VisualIDs for each new visual */ /* Alloc temp space for the list of orig VisualIDs for each new visual */
orig_vid = (VisualID *)__glXMalloc(numNewVisuals * sizeof(VisualID)); orig_vid = (VisualID *)__glXMalloc(numNewVisuals * sizeof(VisualID));
if (!orig_vid) { if (!orig_vid) {
__glXFree(pNewVisualPriv); __glXFree(pNewVisualPriv);
__glXFree(pNewVisualConfigs); __glXFree(pNewVisualConfigs);
return FALSE; return FALSE;
} }
/* Alloc space for the list of glXVisuals */ /* Alloc space for the list of glXVisuals */
modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes)); modes = _gl_context_modes_create(numNewVisuals, sizeof(__GLcontextModes));
if (modes == NULL) { if (modes == NULL) {
__glXFree(orig_vid); __glXFree(orig_vid);
__glXFree(pNewVisualPriv); __glXFree(pNewVisualPriv);
__glXFree(pNewVisualConfigs); __glXFree(pNewVisualConfigs);
return FALSE; return FALSE;
} }
/* Alloc space for the list of glXVisualPrivates */ /* Alloc space for the list of glXVisualPrivates */
glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *)); glXVisualPriv = (void **)__glXMalloc(numNewVisuals * sizeof(void *));
if (!glXVisualPriv) { if (!glXVisualPriv) {
_gl_context_modes_destroy( modes ); _gl_context_modes_destroy( modes );
__glXFree(orig_vid); __glXFree(orig_vid);
__glXFree(pNewVisualPriv); __glXFree(pNewVisualPriv);
__glXFree(pNewVisualConfigs); __glXFree(pNewVisualConfigs);
return FALSE; return FALSE;
} }
/* Alloc space for the new list of the X server's visuals */ /* Alloc space for the new list of the X server's visuals */
pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec)); pVisualNew = (VisualPtr)__glXMalloc(numNewVisuals * sizeof(VisualRec));
if (!pVisualNew) { if (!pVisualNew) {
__glXFree(glXVisualPriv); __glXFree(glXVisualPriv);
_gl_context_modes_destroy( modes ); _gl_context_modes_destroy( modes );
__glXFree(orig_vid); __glXFree(orig_vid);
__glXFree(pNewVisualPriv); __glXFree(pNewVisualPriv);
__glXFree(pNewVisualConfigs); __glXFree(pNewVisualConfigs);
return FALSE; return FALSE;
} }
/* Initialize the new visuals */ /* Initialize the new visuals */
@ -1013,88 +1135,88 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
glWinScreens[screenInfo.numScreens-1].modes = modes; glWinScreens[screenInfo.numScreens-1].modes = modes;
for (i = j = 0; i < numVisuals; i++) { for (i = j = 0; i < numVisuals; i++) {
int is_rgb = (pVisual[i].class == TrueColor || int is_rgb = (pVisual[i].class == TrueColor ||
pVisual[i].class == DirectColor); pVisual[i].class == DirectColor);
#if 0 #if 0
if (!is_rgb) if (!is_rgb)
{ {
/* We don't support non-rgb visuals for GL. But we don't /* We don't support non-rgb visuals for GL. But we don't
want to remove them either, so just pass them through want to remove them either, so just pass them through
with null glX configs */ with null glX configs */
pVisualNew[j] = pVisual[i]; pVisualNew[j] = pVisual[i];
pVisualNew[j].vid = FakeClientID(0); pVisualNew[j].vid = FakeClientID(0);
/* Check for the default visual */ /* Check for the default visual */
if (!found_default && pVisual[i].vid == *defaultVisp) { if (!found_default && pVisual[i].vid == *defaultVisp) {
*defaultVisp = pVisualNew[j].vid; *defaultVisp = pVisualNew[j].vid;
found_default = TRUE; found_default = TRUE;
} }
/* Save the old VisualID */ /* Save the old VisualID */
orig_vid[j] = pVisual[i].vid; orig_vid[j] = pVisual[i].vid;
/* Initialize the glXVisual */ /* Initialize the glXVisual */
glXVisualPtr[j] = NullConfig; glXVisualPtr[j] = NullConfig;
glXVisualPriv[j] = NULL; glXVisualPriv[j] = NULL;
j++; j++;
continue; continue;
} }
#endif #endif
for (k = 0; k < numNewConfigs; k++) { for (k = 0; k < numNewConfigs; k++) {
if (pNewVisualConfigs[k].rgba != is_rgb) if (pNewVisualConfigs[k].rgba != is_rgb)
continue; continue;
assert( modes != NULL ); assert( modes != NULL );
/* Initialize the new visual */ /* Initialize the new visual */
pVisualNew[j] = pVisual[i]; pVisualNew[j] = pVisual[i];
pVisualNew[j].vid = FakeClientID(0); pVisualNew[j].vid = FakeClientID(0);
/* Check for the default visual */ /* Check for the default visual */
if (!found_default && pVisual[i].vid == *defaultVisp) { if (!found_default && pVisual[i].vid == *defaultVisp) {
*defaultVisp = pVisualNew[j].vid; *defaultVisp = pVisualNew[j].vid;
found_default = TRUE; found_default = TRUE;
} }
/* Save the old VisualID */ /* Save the old VisualID */
orig_vid[j] = pVisual[i].vid; orig_vid[j] = pVisual[i].vid;
/* Initialize the glXVisual */ /* Initialize the glXVisual */
_gl_copy_visual_to_context_mode( modes, & pNewVisualConfigs[k] ); _gl_copy_visual_to_context_mode( modes, & pNewVisualConfigs[k] );
modes->visualID = pVisualNew[j].vid; modes->visualID = pVisualNew[j].vid;
/* /*
* If the class is -1, then assume the X visual information * If the class is -1, then assume the X visual information
* is identical to what GLX needs, and take them from the X * is identical to what GLX needs, and take them from the X
* visual. NOTE: if class != -1, then all other fields MUST * visual. NOTE: if class != -1, then all other fields MUST
* be initialized. * be initialized.
*/ */
if (modes->visualType == GLX_NONE) { if (modes->visualType == GLX_NONE) {
modes->visualType = _gl_convert_from_x_visual_type( pVisual[i].class ); modes->visualType = _gl_convert_from_x_visual_type( pVisual[i].class );
modes->redBits = count_bits(pVisual[i].redMask); modes->redBits = count_bits(pVisual[i].redMask);
modes->greenBits = count_bits(pVisual[i].greenMask); modes->greenBits = count_bits(pVisual[i].greenMask);
modes->blueBits = count_bits(pVisual[i].blueMask); modes->blueBits = count_bits(pVisual[i].blueMask);
modes->alphaBits = modes->alphaBits; modes->alphaBits = modes->alphaBits;
modes->redMask = pVisual[i].redMask; modes->redMask = pVisual[i].redMask;
modes->greenMask = pVisual[i].greenMask; modes->greenMask = pVisual[i].greenMask;
modes->blueMask = pVisual[i].blueMask; modes->blueMask = pVisual[i].blueMask;
modes->alphaMask = modes->alphaMask; modes->alphaMask = modes->alphaMask;
modes->rgbBits = (is_rgb) modes->rgbBits = (is_rgb)
? (modes->redBits + modes->greenBits + ? (modes->redBits + modes->greenBits +
modes->blueBits + modes->alphaBits) modes->blueBits + modes->alphaBits)
: rootDepth; : rootDepth;
} }
/* Save the device-dependent private for this visual */ /* Save the device-dependent private for this visual */
glXVisualPriv[j] = pNewVisualPriv[k]; glXVisualPriv[j] = pNewVisualPriv[k];
j++; j++;
modes = modes->next; modes = modes->next;
} }
} }
assert(j <= numNewVisuals); assert(j <= numNewVisuals);
@ -1105,29 +1227,29 @@ static Bool init_visuals(int *nvisualp, VisualPtr *visualp,
/* Set up depth's VisualIDs */ /* Set up depth's VisualIDs */
for (i = 0; i < ndepth; i++) { for (i = 0; i < ndepth; i++) {
int numVids = 0; int numVids = 0;
VisualID *pVids = NULL; VisualID *pVids = NULL;
int k, n = 0; int k, n = 0;
/* Count the new number of VisualIDs at this depth */ /* Count the new number of VisualIDs at this depth */
for (j = 0; j < pdepth[i].numVids; j++) for (j = 0; j < pdepth[i].numVids; j++)
for (k = 0; k < numNewVisuals; k++) for (k = 0; k < numNewVisuals; k++)
if (pdepth[i].vids[j] == orig_vid[k]) if (pdepth[i].vids[j] == orig_vid[k])
numVids++; numVids++;
/* Allocate a new list of VisualIDs for this depth */ /* Allocate a new list of VisualIDs for this depth */
pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID)); pVids = (VisualID *)__glXMalloc(numVids * sizeof(VisualID));
/* Initialize the new list of VisualIDs for this depth */ /* Initialize the new list of VisualIDs for this depth */
for (j = 0; j < pdepth[i].numVids; j++) for (j = 0; j < pdepth[i].numVids; j++)
for (k = 0; k < numNewVisuals; k++) for (k = 0; k < numNewVisuals; k++)
if (pdepth[i].vids[j] == orig_vid[k]) if (pdepth[i].vids[j] == orig_vid[k])
pVids[n++] = pVisualNew[k].vid; pVids[n++] = pVisualNew[k].vid;
/* Update this depth's list of VisualIDs */ /* Update this depth's list of VisualIDs */
__glXFree(pdepth[i].vids); __glXFree(pdepth[i].vids);
pdepth[i].vids = pVids; pdepth[i].vids = pVids;
pdepth[i].numVids = numVids; pdepth[i].numVids = numVids;
} }
/* Update the X server's visuals */ /* Update the X server's visuals */
@ -1161,26 +1283,26 @@ static void fixup_visuals(int screen)
GLWIN_DEBUG_MSG("fixup_visuals\n"); GLWIN_DEBUG_MSG("fixup_visuals\n");
for (modes = pScr->modes; modes != NULL; modes = modes->next ) { for (modes = pScr->modes; modes != NULL; modes = modes->next ) {
const int vis_class = _gl_convert_to_x_visual_type( modes->visualType ); const int vis_class = _gl_convert_to_x_visual_type( modes->visualType );
const int nplanes = (modes->rgbBits - modes->alphaBits); const int nplanes = (modes->rgbBits - modes->alphaBits);
VisualPtr pVis = pScreen->visuals; VisualPtr pVis = pScreen->visuals;
/* Find a visual that matches the GLX visual's class and size */ /* Find a visual that matches the GLX visual's class and size */
for (j = 0; j < pScreen->numVisuals; j++) { for (j = 0; j < pScreen->numVisuals; j++) {
if (pVis[j].class == vis_class && if (pVis[j].class == vis_class &&
pVis[j].nplanes == nplanes) { pVis[j].nplanes == nplanes) {
/* Fixup the masks */ /* Fixup the masks */
modes->redMask = pVis[j].redMask; modes->redMask = pVis[j].redMask;
modes->greenMask = pVis[j].greenMask; modes->greenMask = pVis[j].greenMask;
modes->blueMask = pVis[j].blueMask; modes->blueMask = pVis[j].blueMask;
/* Recalc the sizes */ /* Recalc the sizes */
modes->redBits = count_bits(modes->redMask); modes->redBits = count_bits(modes->redMask);
modes->greenBits = count_bits(modes->greenMask); modes->greenBits = count_bits(modes->greenMask);
modes->blueBits = count_bits(modes->blueMask); modes->blueBits = count_bits(modes->blueMask);
} }
} }
} }
} }
@ -1204,38 +1326,38 @@ static void init_screen_visuals(int screen)
const int nplanes = (modes->rgbBits - modes->alphaBits); const int nplanes = (modes->rgbBits - modes->alphaBits);
const VisualPtr pVis = pScreen->visuals; const VisualPtr pVis = pScreen->visuals;
for (j = 0; j < pScreen->numVisuals; j++) { for (j = 0; j < pScreen->numVisuals; j++) {
if (pVis[j].class == vis_class && if (pVis[j].class == vis_class &&
pVis[j].nplanes == nplanes && pVis[j].nplanes == nplanes &&
pVis[j].redMask == modes->redMask && pVis[j].redMask == modes->redMask &&
pVis[j].greenMask == modes->greenMask && pVis[j].greenMask == modes->greenMask &&
pVis[j].blueMask == modes->blueMask && pVis[j].blueMask == modes->blueMask &&
!used[j]) { !used[j]) {
#if 0 #if 0
/* Create the XMesa visual */ /* Create the XMesa visual */
pXMesaVisual[i] = pXMesaVisual[i] =
XMesaCreateVisual(pScreen, XMesaCreateVisual(pScreen,
pVis, pVis,
modes->rgbMode, modes->rgbMode,
(modes->alphaBits > 0), (modes->alphaBits > 0),
modes->doubleBufferMode, modes->doubleBufferMode,
modes->stereoMode, modes->stereoMode,
GL_TRUE, /* ximage_flag */ GL_TRUE, /* ximage_flag */
modes->depthBits, modes->depthBits,
modes->stencilBits, modes->stencilBits,
modes->accumRedBits, modes->accumRedBits,
modes->accumGreenBits, modes->accumGreenBits,
modes->accumBlueBits, modes->accumBlueBits,
modes->accumAlphaBits, modes->accumAlphaBits,
modes->samples, modes->samples,
modes->level, modes->level,
modes->visualRating); modes->visualRating);
#endif #endif
/* Set the VisualID */ /* Set the VisualID */
modes->visualID = pVis[j].vid; modes->visualID = pVis[j].vid;
/* Mark this visual used */ /* Mark this visual used */
used[j] = 1; used[j] = 1;
@ -1247,14 +1369,14 @@ static void init_screen_visuals(int screen)
ErrorF("No matching visual for __GLcontextMode with " ErrorF("No matching visual for __GLcontextMode with "
"visual class = %d (%d), nplanes = %u\n", "visual class = %d (%d), nplanes = %u\n",
vis_class, vis_class,
modes->visualType, modes->visualType,
(modes->rgbBits - modes->alphaBits) ); (modes->rgbBits - modes->alphaBits) );
} }
else if ( modes->visualID == -1 ) { else if ( modes->visualID == -1 ) {
FatalError( "Matching visual found, but visualID still -1!\n" ); FatalError( "Matching visual found, but visualID still -1!\n" );
} }
i++; i++;
} }
@ -1276,7 +1398,7 @@ static Bool glWinScreenProbe(int screen)
__glDDXScreenInfo.modes = glWinScreens[screen].modes; __glDDXScreenInfo.modes = glWinScreens[screen].modes;
__glDDXScreenInfo.pVisualPriv = glWinScreens[screen].priv; __glDDXScreenInfo.pVisualPriv = glWinScreens[screen].priv;
__glDDXScreenInfo.numVisuals = __glDDXScreenInfo.numVisuals =
__glDDXScreenInfo.numUsableVisuals = glWinScreens[screen].num_vis; __glDDXScreenInfo.numUsableVisuals = glWinScreens[screen].num_vis;
/* /*
* Set the current screen's createContext routine. This could be * Set the current screen's createContext routine. This could be
@ -1318,9 +1440,13 @@ static GLboolean glWinSwapBuffers(__GLXdrawablePrivate *glxPriv)
HDC dc; HDC dc;
BOOL ret; BOOL ret;
GLWIN_TRACE_MSG("glWinSwapBuffers (ctx %p)\n", (gc!=NULL?gc->ctx:NULL));
if (gc != NULL && gc->ctx != NULL) if (gc != NULL && gc->ctx != NULL)
{ {
dc = glWinMakeDC(gc); dc = glWinMakeDC(gc);
if (dc == NULL)
return GL_FALSE;
ret = SwapBuffers(dc); ret = SwapBuffers(dc);
if (!ret) if (!ret)
@ -1382,14 +1508,14 @@ glWinInitVisualConfigs(void)
int i = 0; int i = 0;
GLWIN_DEBUG_MSG("glWinInitVisualConfigs "); GLWIN_DEBUG_MSG("glWinInitVisualConfigs ");
/* count num configs: /* count num configs:
2 Z buffer (0, 24 bit) 2 Z buffer (0, 24 bit)
2 AUX buffer (0, 2) 2 AUX buffer (0, 2)
2 buffers (single, double) 2 buffers (single, double)
2 stencil (0, 8 bit) 2 stencil (0, 8 bit)
2 accum (0, 64 bit) 2 accum (0, 64 bit)
= 32 configs */ = 32 configs */
lclNumConfigs = 2 * 2 * 2 * 2 * 2; /* 32 */ lclNumConfigs = 2 * 2 * 2 * 2 * 2; /* 32 */
@ -1399,65 +1525,65 @@ glWinInitVisualConfigs(void)
/* fill in configs */ /* fill in configs */
if (NULL != lclVisualConfigs) { if (NULL != lclVisualConfigs) {
i = 0; /* current buffer */ i = 0; /* current buffer */
for (depth = 0; depth < 2; depth++) { for (depth = 0; depth < 2; depth++) {
for (aux = 0; aux < 2; aux++) { for (aux = 0; aux < 2; aux++) {
for (buffers = 0; buffers < 2; buffers++) { for (buffers = 0; buffers < 2; buffers++) {
for (stencil = 0; stencil < 2; stencil++) { for (stencil = 0; stencil < 2; stencil++) {
for (accum = 0; accum < 2; accum++) { for (accum = 0; accum < 2; accum++) {
lclVisualConfigs[i].vid = -1; lclVisualConfigs[i].vid = -1;
lclVisualConfigs[i].class = -1; lclVisualConfigs[i].class = -1;
lclVisualConfigs[i].rgba = TRUE; lclVisualConfigs[i].rgba = TRUE;
lclVisualConfigs[i].redSize = -1; lclVisualConfigs[i].redSize = -1;
lclVisualConfigs[i].greenSize = -1; lclVisualConfigs[i].greenSize = -1;
lclVisualConfigs[i].blueSize = -1; lclVisualConfigs[i].blueSize = -1;
lclVisualConfigs[i].redMask = -1; lclVisualConfigs[i].redMask = -1;
lclVisualConfigs[i].greenMask = -1; lclVisualConfigs[i].greenMask = -1;
lclVisualConfigs[i].blueMask = -1; lclVisualConfigs[i].blueMask = -1;
lclVisualConfigs[i].alphaMask = 0; lclVisualConfigs[i].alphaMask = 0;
if (accum) { if (accum) {
lclVisualConfigs[i].accumRedSize = 16; lclVisualConfigs[i].accumRedSize = 16;
lclVisualConfigs[i].accumGreenSize = 16; lclVisualConfigs[i].accumGreenSize = 16;
lclVisualConfigs[i].accumBlueSize = 16; lclVisualConfigs[i].accumBlueSize = 16;
lclVisualConfigs[i].accumAlphaSize = 16; lclVisualConfigs[i].accumAlphaSize = 16;
} }
else { else {
lclVisualConfigs[i].accumRedSize = 0; lclVisualConfigs[i].accumRedSize = 0;
lclVisualConfigs[i].accumGreenSize = 0; lclVisualConfigs[i].accumGreenSize = 0;
lclVisualConfigs[i].accumBlueSize = 0; lclVisualConfigs[i].accumBlueSize = 0;
lclVisualConfigs[i].accumAlphaSize = 0; lclVisualConfigs[i].accumAlphaSize = 0;
} }
lclVisualConfigs[i].doubleBuffer = buffers ? TRUE : FALSE; lclVisualConfigs[i].doubleBuffer = buffers ? TRUE : FALSE;
lclVisualConfigs[i].stereo = FALSE; lclVisualConfigs[i].stereo = FALSE;
lclVisualConfigs[i].bufferSize = -1; lclVisualConfigs[i].bufferSize = -1;
lclVisualConfigs[i].depthSize = depth? 24 : 0; lclVisualConfigs[i].depthSize = depth? 24 : 0;
lclVisualConfigs[i].stencilSize = stencil ? 8 : 0; lclVisualConfigs[i].stencilSize = stencil ? 8 : 0;
lclVisualConfigs[i].auxBuffers = aux ? 2 : 0; lclVisualConfigs[i].auxBuffers = aux ? 2 : 0;
lclVisualConfigs[i].level = 0; lclVisualConfigs[i].level = 0;
lclVisualConfigs[i].visualRating = GLX_NONE_EXT; lclVisualConfigs[i].visualRating = GLX_NONE_EXT;
lclVisualConfigs[i].transparentPixel = 0; lclVisualConfigs[i].transparentPixel = 0;
lclVisualConfigs[i].transparentRed = 0; lclVisualConfigs[i].transparentRed = 0;
lclVisualConfigs[i].transparentGreen = 0; lclVisualConfigs[i].transparentGreen = 0;
lclVisualConfigs[i].transparentBlue = 0; lclVisualConfigs[i].transparentBlue = 0;
lclVisualConfigs[i].transparentAlpha = 0; lclVisualConfigs[i].transparentAlpha = 0;
lclVisualConfigs[i].transparentIndex = 0; lclVisualConfigs[i].transparentIndex = 0;
i++; i++;
} }
} }
} }
} }
} }
} }
if (i != lclNumConfigs) if (i != lclNumConfigs)
GLWIN_DEBUG_MSG("glWinInitVisualConfigs failed to alloc visual configs"); GLWIN_DEBUG_MSG("glWinInitVisualConfigs failed to alloc visual configs");
GlxSetVisualConfigs(lclNumConfigs, lclVisualConfigs, lclVisualPrivates); GlxSetVisualConfigs(lclNumConfigs, lclVisualConfigs, lclVisualPrivates);
} }
/* Copied from Mesa */ /* Copied from Mesa */
static void glWinSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs, static void glWinSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
void **privates) void **privates)
{ {
GLWIN_DEBUG_MSG("glWinSetVisualConfigs\n"); GLWIN_DEBUG_MSG("glWinSetVisualConfigs\n");
@ -1468,20 +1594,20 @@ static void glWinSetVisualConfigs(int nconfigs, __GLXvisualConfig *configs,
/* Copied from Mesa */ /* Copied from Mesa */
static Bool glWinInitVisuals(VisualPtr *visualp, DepthPtr *depthp, static Bool glWinInitVisuals(VisualPtr *visualp, DepthPtr *depthp,
int *nvisualp, int *ndepthp, int *nvisualp, int *ndepthp,
int *rootDepthp, VisualID *defaultVisp, int *rootDepthp, VisualID *defaultVisp,
unsigned long sizes, int bitsPerRGB) unsigned long sizes, int bitsPerRGB)
{ {
glWinInitDebugSettings(); glWinInitDebugSettings();
GLWIN_DEBUG_MSG("glWinInitVisuals\n"); GLWIN_DEBUG_MSG("glWinInitVisuals\n");
if (0 == numConfigs) /* if no configs */ if (0 == numConfigs) /* if no configs */
glWinInitVisualConfigs(); /* ensure the visula configs are setup */ glWinInitVisualConfigs(); /* ensure the visula configs are setup */
/* /*
* Setup the visuals supported by this particular screen. * Setup the visuals supported by this particular screen.
*/ */
return init_visuals(nvisualp, visualp, defaultVisp, return init_visuals(nvisualp, visualp, defaultVisp,
*ndepthp, *depthp, *rootDepthp); *ndepthp, *depthp, *rootDepthp);
} }