const __DRIcoreExtension *core;
const __DRIswrastExtension *swrast;
const __DRItexBufferExtension *texBuffer;
+ const __DRIcopySubBufferExtension *copySubBuffer;
const __DRIconfig **driver_configs;
}
static void
-swrastPutImage(__DRIdrawable * draw, int op,
- int x, int y, int w, int h,
- char *data, void *loaderPrivate)
+swrastPutImage2(__DRIdrawable * draw, int op,
+ int x, int y, int w, int h, int stride,
+ char *data, void *loaderPrivate)
{
struct drisw_drawable *pdp = loaderPrivate;
__GLXDRIdrawable *pdraw = &(pdp->base);
ximage->data = data;
ximage->width = w;
ximage->height = h;
- ximage->bytes_per_line = bytes_per_line(w * ximage->bits_per_pixel, 32);
+ ximage->bytes_per_line = stride ? stride : bytes_per_line(w * ximage->bits_per_pixel, 32);
XPutImage(dpy, drawable, gc, ximage, 0, 0, x, y, w, h);
ximage->data = NULL;
}
+static void
+swrastPutImage(__DRIdrawable * draw, int op,
+ int x, int y, int w, int h,
+ char *data, void *loaderPrivate)
+{
+ swrastPutImage2(draw, op, x, y, w, h, 0, data, loaderPrivate);
+}
+
static void
swrastGetImage(__DRIdrawable * read,
int x, int y, int w, int h,
{__DRI_SWRAST_LOADER, __DRI_SWRAST_LOADER_VERSION},
swrastGetDrawableInfo,
swrastPutImage,
- swrastGetImage
+ swrastGetImage,
+ swrastPutImage2,
};
static const __DRIextension *loader_extensions[] = {
return 0;
}
+static void
+driswCopySubBuffer(__GLXDRIdrawable * pdraw,
+ int x, int y, int width, int height, Bool flush)
+{
+ struct drisw_drawable *pdp = (struct drisw_drawable *) pdraw;
+ struct drisw_screen *psc = (struct drisw_screen *) pdp->base.psc;
+
+ if (flush) {
+ glFlush();
+ }
+
+ (*psc->copySubBuffer->copySubBuffer) (pdp->driDrawable,
+ x, y, width, height);
+}
+
static void
driswDestroyScreen(struct glx_screen *base)
{
"GLX_EXT_create_context_es2_profile");
}
+ if (psc->copySubBuffer)
+ __glXEnableDirectExtension(&psc->base, "GLX_MESA_copy_sub_buffer");
+
/* FIXME: Figure out what other extensions can be ported here from dri2. */
for (i = 0; extensions[i]; i++) {
if ((strcmp(extensions[i]->name, __DRI_TEX_BUFFER) == 0)) {
psc->core = (__DRIcoreExtension *) extensions[i];
if (strcmp(extensions[i]->name, __DRI_SWRAST) == 0)
psc->swrast = (__DRIswrastExtension *) extensions[i];
+ if (strcmp(extensions[i]->name, __DRI_COPY_SUB_BUFFER) == 0)
+ psc->copySubBuffer = (__DRIcopySubBufferExtension *) extensions[i];
}
if (psc->core == NULL || psc->swrast == NULL) {
psp->createDrawable = driswCreateDrawable;
psp->swapBuffers = driswSwapBuffers;
+ if (psc->copySubBuffer)
+ psp->copySubBuffer = driswCopySubBuffer;
+
return &psc->base;
handle_error: