break;
case GLX_PRESERVED_CONTENTS:
attrib++;
- preserveContents = *attrib; /* ignored */
+ preserveContents = *attrib;
break;
case GLX_LARGEST_PBUFFER:
attrib++;
- useLargest = *attrib; /* ignored */
+ useLargest = *attrib;
break;
default:
return 0;
}
}
- /* not used at this time */
- (void) useLargest;
- (void) preserveContents;
-
if (width == 0 || height == 0)
return 0;
+ if (width > MAX_WIDTH || height > MAX_HEIGHT) {
+ /* If allocation would have failed and GLX_LARGEST_PBUFFER is set,
+ * allocate the largest possible buffer.
+ */
+ if (useLargest) {
+ width = MAX_WIDTH;
+ height = MAX_HEIGHT;
+ }
+ }
+
xmbuf = XMesaCreatePBuffer( xmvis, 0, width, height);
/* A GLXPbuffer handle must be an X Drawable because that's what
* glXMakeCurrent takes.
*/
- if (xmbuf)
+ if (xmbuf) {
+ xmbuf->largestPbuffer = useLargest;
+ xmbuf->preservedContents = preserveContents;
return (GLXPbuffer) xmbuf->frontxrb->pixmap;
- else
+ }
+ else {
return 0;
+ }
}
if (!xmbuf)
return;
+ /* make sure buffer's dimensions are up to date */
+ xmesa_check_and_update_buffer_size(NULL, xmbuf);
+
switch (attribute) {
case GLX_WIDTH:
*value = xmbuf->mesa_buffer.Width;
*value = xmbuf->mesa_buffer.Height;
break;
case GLX_PRESERVED_CONTENTS:
- *value = True;
+ *value = xmbuf->preservedContents;
break;
case GLX_LARGEST_PBUFFER:
- *value = xmbuf->mesa_buffer.Width * xmbuf->mesa_buffer.Height;
+ *value = xmbuf->largestPbuffer;
break;
case GLX_FBCONFIG_ID:
*value = xmbuf->xm_visual->visinfo->visualid;
switch (attribute) {
case GLX_PRESERVED_CONTENTS_SGIX:
- *value = True;
+ *value = xmbuf->preservedContents;
break;
case GLX_LARGEST_PBUFFER_SGIX:
- *value = xmbuf->mesa_buffer.Width * xmbuf->mesa_buffer.Height;
+ *value = xmbuf->largestPbuffer;
break;
case GLX_WIDTH_SGIX:
*value = xmbuf->mesa_buffer.Width;
XMesaDisplay *display;
BufferType type; /* window, pixmap, pbuffer or glxwindow */
+ GLboolean largestPbuffer; /**< for pbuffers */
+ GLboolean preservedContents; /**< for pbuffers */
+
struct xmesa_renderbuffer *frontxrb; /* front color renderbuffer */
struct xmesa_renderbuffer *backxrb; /* back color renderbuffer */