/** * Query the current drawable size and notify the binding context. */ void xmesa_check_buffer_size(XMesaBuffer b) { if (b->type == PBUFFER) return; xmesa_get_window_size(b->xm_visual->display, b, &b->width, &b->height); xmesa_notify_invalid_buffer(b); }
/** * For GLX_EXT_texture_from_pixmap */ XMesaBuffer XMesaCreatePixmapTextureBuffer(XMesaVisual v, XMesaPixmap p, XMesaColormap cmap, int format, int target, int mipmap) { GET_CURRENT_CONTEXT(ctx); XMesaBuffer b; GLuint width, height; assert(v); b = create_xmesa_buffer((XMesaDrawable) p, PIXMAP, v, cmap); if (!b) return NULL; /* get pixmap size, update framebuffer/renderbuffer dims */ xmesa_get_window_size(v->display, b, &width, &height); _mesa_resize_framebuffer(NULL, &(b->mesa_buffer), width, height); if (target == 0) { /* examine dims */ if (ctx->Extensions.ARB_texture_non_power_of_two) { target = GLX_TEXTURE_2D_EXT; } else if ( _mesa_bitcount(width) == 1 && _mesa_bitcount(height) == 1) { /* power of two size */ if (height == 1) { target = GLX_TEXTURE_1D_EXT; } else { target = GLX_TEXTURE_2D_EXT; } } else if (ctx->Extensions.NV_texture_rectangle) { target = GLX_TEXTURE_RECTANGLE_EXT; } else { /* non power of two textures not supported */ XMesaDestroyBuffer(b); return 0; } } b->TextureTarget = target; b->TextureFormat = format; b->TextureMipmap = mipmap; if (!initialize_visual_and_buffer(v, b, (XMesaDrawable) p, cmap)) { xmesa_free_buffer(b); return NULL; } return b; }
/** * Query the current window size and update the corresponding struct gl_framebuffer * and all attached renderbuffers. * Called when: * 1. the first time a buffer is bound to a context. * 2. from glViewport to poll for window size changes * 3. from the XMesaResizeBuffers() API function. * Note: it's possible (and legal) for xmctx to be NULL. That can happen * when resizing a buffer when no rendering context is bound. */ void xmesa_check_and_update_buffer_size(XMesaContext xmctx, XMesaBuffer drawBuffer) { GLuint width, height; xmesa_get_window_size(drawBuffer->display, drawBuffer, &width, &height); if (drawBuffer->mesa_buffer.Width != width || drawBuffer->mesa_buffer.Height != height) { struct gl_context *ctx = xmctx ? &xmctx->mesa : NULL; _mesa_resize_framebuffer(ctx, &(drawBuffer->mesa_buffer), width, height); } drawBuffer->mesa_buffer.Initialized = GL_TRUE; /* XXX TEMPORARY? */ }
/** * Query the current drawable size and notify the binding context. */ void xmesa_check_buffer_size(XMesaBuffer b) { GLuint old_width, old_height; if (b->type == PBUFFER) return; old_width = b->width; old_height = b->height; xmesa_get_window_size(b->xm_visual->display, b, &b->width, &b->height); if (b->width != old_width || b->height != old_height) xmesa_notify_invalid_buffer(b); }