swpipe: Flush color buffers (and z buffer?)

* Take bitmap passed via private pointer and copy data
  into context BBitmap
* Not 100% sure if z buffer needs flushed as well.
This commit is contained in:
Alexander von Gluck IV
2012-12-01 11:45:18 -06:00
parent 1e11702f96
commit 32aab0863c
2 changed files with 35 additions and 16 deletions
+24 -11
View File
@@ -464,23 +464,36 @@ GalliumContext::SwapBuffers(context_id contextID)
return B_ERROR;
}
//pipe_mutex_lock(context->draw->mutex);
// TODO: Where did st_notify_swapbuffers go?
//st_notify_swapbuffers(context->draw->stfb);
// TODO: Where did st_get_framebuffer_surface go?
//struct pipe_surface *surface;
//st_get_framebuffer_surface(context->draw->stfb, ST_SURFACE_BACK_LEFT,
// &surface);
context->st->flush(context->st, ST_FLUSH_FRONT, NULL);
// TODO: Flush the frontbuffer!
//hsp_dev->hsp_winsys->flush_frontbuffer(hsp_dev->screen, surface,
// context->bitmap);
// I'm not 100% sold on this... but Gallium does it quite often.
struct st_context *stContext = (struct st_context*)context->st;
//pipe_mutex_unlock(context->draw->mutex);
unsigned nColorBuffers = stContext->state.framebuffer.nr_cbufs;
for (unsigned i = 0; i < nColorBuffers; i++) {
pipe_surface* surface = stContext->state.framebuffer.cbufs[i];
if (!surface) {
ERROR("%s: color buffer %d invalid!\n", __func__, i);
continue;
}
TRACE("%s: Flushing color buffer #%d\n", __func__, i);
// We pass our destination bitmap to flush_fronbuffer which passes it
// to the private winsys display call.
fScreen->flush_frontbuffer(fScreen, surface->texture, 0, 0,
context->bitmap);
}
#if 0
// TODO... should we flush the z stencil buffer?
pipe_surface* zSurface = stContext->state.framebuffer.zsbuf;
fScreen->flush_frontbuffer(fScreen, surface->texture, 0, 0,
context->bitmap);
#endif
return true;
}
+11 -5
View File
@@ -169,12 +169,18 @@ hook_winsys_displaytarget_display(struct sw_winsys* winsys,
{
CALLED();
//struct haiku_displaytarget* haikuDisplayTarget
// = cast_haiku_displaytarget(displayTarget);
if (!contextPrivate) {
ERROR("%s: Passed invalid private pointer!\n", __func__);
return;
}
// GDI copies data from haikuDisplayTarget->data into
// a Bitmap casted from contextPrivate.. need to investigate
// this.
Bitmap* bitmap = (Bitmap*)contextPrivate;
struct haiku_displaytarget* haikuDisplayTarget
= cast_haiku_displaytarget(displayTarget);
copy_bitmap_bits(bitmap, haikuDisplayTarget->data,
haikuDisplayTarget->size);
return;
}