Skip to content

Commit

Permalink
swpipe: Flush color buffers (and z buffer?)
Browse files Browse the repository at this point in the history
* Take bitmap passed via private pointer and copy data
  into context BBitmap
* Not 100% sure if z buffer needs flushed as well.
  • Loading branch information
kallisti5 committed Dec 1, 2012
1 parent 1e11702 commit 32aab08
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 16 deletions.
35 changes: 24 additions & 11 deletions src/add-ons/opengl/swpipe/GalliumContext.cpp
Expand Up @@ -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;

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);

//pipe_mutex_unlock(context->draw->mutex);
// 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;
}
16 changes: 11 additions & 5 deletions src/add-ons/opengl/swpipe/SoftwareWinsys.cpp
Expand Up @@ -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;
}

Bitmap* bitmap = (Bitmap*)contextPrivate;

struct haiku_displaytarget* haikuDisplayTarget
= cast_haiku_displaytarget(displayTarget);

// GDI copies data from haikuDisplayTarget->data into
// a Bitmap casted from contextPrivate.. need to investigate
// this.
copy_bitmap_bits(bitmap, haikuDisplayTarget->data,
haikuDisplayTarget->size);

return;
}
Expand Down

0 comments on commit 32aab08

Please sign in to comment.