Skip to content

Commit

Permalink
swpipe: Manage viewport, resize on change.
Browse files Browse the repository at this point in the history
* Untested until rendering works
  • Loading branch information
kallisti5 committed Dec 2, 2012
1 parent c9bb940 commit 64e07c0
Showing 1 changed file with 22 additions and 19 deletions.
41 changes: 22 additions & 19 deletions src/add-ons/opengl/swpipe/GalliumContext.cpp
Expand Up @@ -48,27 +48,29 @@ extern "C" {
#define ERROR(x...) printf("GalliumContext: " x)


#if 0
static void
hgl_viewport(struct gl_context* glctx, GLint x, GLint y,
hgl_viewport(struct gl_context* glContext, GLint x, GLint y,
GLsizei width, GLsizei height)
{
TRACE("%s(glctx: %p, x: %d, y: %d, width: %d, height: %d\n",
__FUNCTION__, glctx, x, y, width, height);
struct hgl_context *context = (struct hgl_context*)glctx->DriverCtx;
TRACE("%s(glContext: %p, x: %d, y: %d, width: %d, height: %d\n", __func__,
glContext, x, y, width, height);
struct hgl_context *context = (struct hgl_context*)glContext->DriverCtx;

int32 w, h;
get_bitmap_size(context->bitmap, &w, &h);
int32 bitmapWidth;
int32 bitmapHeight;

#if 0
// TODO: mesa_resize_framebuffer? Need to investigate where this went
if (context->draw)
st_resize_framebuffer(context->draw->stfb, w, h);
if (context->read)
st_resize_framebuffer(context->read->stfb, w, h);
#endif
get_bitmap_size(context->bitmap, &bitmapWidth, &bitmapHeight);

if (width != bitmapWidth || height != bitmapHeight) {
struct gl_framebuffer *draw = glContext->WinSysDrawBuffer;
struct gl_framebuffer *read = glContext->WinSysReadBuffer;

if (draw)
_mesa_resize_framebuffer(glContext, draw, bitmapWidth, bitmapHeight);
if (read)
_mesa_resize_framebuffer(glContext, read, bitmapWidth, bitmapHeight);
}
}
#endif


static void
Expand Down Expand Up @@ -347,9 +349,11 @@ GalliumContext::CreateContext(Bitmap *bitmap)
assert(!context->st->st_manager_private);
context->st->st_manager_private = (void*)context;

// TODO!
//context->st->ctx->DriverCtx = context;
//context->st->ctx->Driver.Viewport = hgl_viewport;
struct st_context *stContext = (struct st_context*)context->st;

stContext->ctx->DriverCtx = context;
stContext->ctx->Driver.Viewport = hgl_viewport;


// TODO: Closely review this next context logic...
context_id contextNext = -1;
Expand Down Expand Up @@ -469,7 +473,6 @@ GalliumContext::SwapBuffers(context_id contextID)

context->st->flush(context->st, ST_FLUSH_FRONT, NULL);

// 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;
Expand Down

0 comments on commit 64e07c0

Please sign in to comment.