st/dri: Add support for surfaceless current contexts.
authorChia-I Wu <olv@lunarg.com>
Tue, 9 Nov 2010 17:38:41 +0000 (01:38 +0800)
committerChia-I Wu <olv@lunarg.com>
Tue, 9 Nov 2010 18:01:04 +0000 (02:01 +0800)
Tested with Wayland.

src/gallium/state_trackers/dri/common/dri_context.c
src/gallium/state_trackers/dri/common/dri_drawable.h
src/gallium/state_trackers/dri/common/dri_screen.c

index 770b37037f539ce271ce73c1b7fd900d80599e80..3d5d24e692c39d51719067d2943606063e70e18b 100644 (file)
@@ -178,7 +178,8 @@ dri_make_current(__DRIcontext * cPriv,
       read->texture_stamp = driReadPriv->lastStamp - 1;
    }
 
-   ctx->stapi->make_current(ctx->stapi, ctx->st, &draw->base, &read->base);
+   ctx->stapi->make_current(ctx->stapi, ctx->st,
+         (draw) ? &draw->base : NULL, (read) ? &read->base : NULL);
 
    return GL_TRUE;
 }
index 837d3983748183158bd5352688f6b77d7926d781..2ff6b7132935cd5892db62cd36019ee5137521fa 100644 (file)
@@ -70,7 +70,8 @@ struct dri_drawable
 static INLINE struct dri_drawable *
 dri_drawable(__DRIdrawable * driDrawPriv)
 {
-   return (struct dri_drawable *)driDrawPriv->driverPrivate;
+   return (struct dri_drawable *) (driDrawPriv)
+      ? driDrawPriv->driverPrivate : NULL;
 }
 
 /***********************************************************************
index 252ad1768d80d89fc0b5140758711794764611fd..1302e9bc0134799dfc1b4174b799d5ff8904bdb5 100644 (file)
@@ -231,6 +231,9 @@ dri_fill_st_visual(struct st_visual *stvis, struct dri_screen *screen,
 {
    memset(stvis, 0, sizeof(*stvis));
 
+   if (!mode)
+      return;
+
    stvis->samples = mode->samples;
    stvis->render_buffer = ST_ATTACHMENT_INVALID;