Reuse visuals to avoid MAX_PIXELFORMATS limit.
Activated the code to support the stencil buffer.
This commit is contained in:
parent
6aadb22bfb
commit
069dd51eb7
|
@ -94,6 +94,7 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev,
|
||||||
int att_list[64];
|
int att_list[64];
|
||||||
int att_pos = 0;
|
int att_pos = 0;
|
||||||
XVisualInfo *vis;
|
XVisualInfo *vis;
|
||||||
|
int i;
|
||||||
|
|
||||||
if (TRACE_ON(opengl)) {
|
if (TRACE_ON(opengl)) {
|
||||||
TRACE("(%p,%p)\n", physDev, ppfd);
|
TRACE("(%p,%p)\n", physDev, ppfd);
|
||||||
|
@ -101,14 +102,6 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev,
|
||||||
dump_PIXELFORMATDESCRIPTOR((PIXELFORMATDESCRIPTOR *) ppfd);
|
dump_PIXELFORMATDESCRIPTOR((PIXELFORMATDESCRIPTOR *) ppfd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* For the moment, we are dumb : we always allocate a new XVisualInfo structure,
|
|
||||||
we do not try to find an already found that could match */
|
|
||||||
if (physDev->used_visuals == MAX_PIXELFORMATS) {
|
|
||||||
ERR("Maximum number of visuals reached !\n");
|
|
||||||
/* Should SetError here... */
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ppfd->dwFlags & PFD_DRAW_TO_BITMAP) {
|
if (ppfd->dwFlags & PFD_DRAW_TO_BITMAP) {
|
||||||
ERR("Flag not supported !\n");
|
ERR("Flag not supported !\n");
|
||||||
/* Should SetError here... */
|
/* Should SetError here... */
|
||||||
|
@ -125,9 +118,9 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev,
|
||||||
/* These flags are not supported yet...
|
/* These flags are not supported yet...
|
||||||
|
|
||||||
NULL_TEST_AND_ADD2(ppfd->cAlphaBits, GLX_ALPHA_SIZE, 8);
|
NULL_TEST_AND_ADD2(ppfd->cAlphaBits, GLX_ALPHA_SIZE, 8);
|
||||||
ADD2(GLX_ACCUM_SIZE, ppfd->cAccumBits);
|
ADD2(GLX_ACCUM_SIZE, ppfd->cAccumBits); */
|
||||||
ADD2(GLX_STENCIL_SIZE, ppfd->cStencilBits);
|
ADD2(GLX_STENCIL_SIZE, ppfd->cStencilBits); /* now suported */
|
||||||
ADD2(GLX_AUX_BUFFERS, ppfd->cAuxBuffers); */
|
/* ADD2(GLX_AUX_BUFFERS, ppfd->cAuxBuffers); */
|
||||||
att_list[att_pos] = None;
|
att_list[att_pos] = None;
|
||||||
|
|
||||||
ENTER_GL(); {
|
ENTER_GL(); {
|
||||||
|
@ -152,6 +145,19 @@ int X11DRV_ChoosePixelFormat(X11DRV_PDEVICE *physDev,
|
||||||
/* Should SetError here... */
|
/* Should SetError here... */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
/* try to find the visualid in the already created visuals */
|
||||||
|
for( i=0; i<physDev->used_visuals; i++ ) {
|
||||||
|
if ( vis->visualid == physDev->visuals[i]->visualid ) {
|
||||||
|
XFree(vis);
|
||||||
|
return i+1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* now give up, if the maximum is reached */
|
||||||
|
if (physDev->used_visuals == MAX_PIXELFORMATS) {
|
||||||
|
ERR("Maximum number of visuals reached !\n");
|
||||||
|
/* Should SetError here... */
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
physDev->visuals[physDev->used_visuals++] = vis;
|
physDev->visuals[physDev->used_visuals++] = vis;
|
||||||
|
|
||||||
return physDev->used_visuals;
|
return physDev->used_visuals;
|
||||||
|
@ -256,9 +262,14 @@ int X11DRV_DescribePixelFormat(X11DRV_PDEVICE *physDev,
|
||||||
/* Depth bits */
|
/* Depth bits */
|
||||||
glXGetConfig(gdi_display, vis, GLX_DEPTH_SIZE, &value);
|
glXGetConfig(gdi_display, vis, GLX_DEPTH_SIZE, &value);
|
||||||
ppfd->cDepthBits = value;
|
ppfd->cDepthBits = value;
|
||||||
|
|
||||||
|
/* stencil bits */
|
||||||
|
glXGetConfig( gdi_display, vis, GLX_STENCIL_SIZE, &value );
|
||||||
|
ppfd->cStencilBits = value;
|
||||||
|
|
||||||
LEAVE_GL();
|
LEAVE_GL();
|
||||||
|
|
||||||
/* Aux, stencil : to do ... */
|
/* Aux : to do ... */
|
||||||
|
|
||||||
ppfd->iLayerType = PFD_MAIN_PLANE;
|
ppfd->iLayerType = PFD_MAIN_PLANE;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue