diff options
author | Keith Whitwell <[email protected]> | 2007-05-24 10:44:53 +0100 |
---|---|---|
committer | Keith Whitwell <[email protected]> | 2007-05-24 10:44:53 +0100 |
commit | b939adfa155f2b3ca5c5226e86da85629654d79b (patch) | |
tree | 43c11a5302d4981bb82d68b503af9ea40fc2b837 /src/mesa/drivers/x11/xm_tri.c | |
parent | 8e4a95a93d15a6707a29454cd47e10b08314cda2 (diff) |
Use the x11 driver as a test harness for the softpipe/state_tracker code.
This has some limitations as we currently require a mapped framebuffer,
so it only really works with double-buffered ximage rgba8888 windows.
Diffstat (limited to 'src/mesa/drivers/x11/xm_tri.c')
-rw-r--r-- | src/mesa/drivers/x11/xm_tri.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/mesa/drivers/x11/xm_tri.c b/src/mesa/drivers/x11/xm_tri.c index 95c6d7c1d20..6158ef30f91 100644 --- a/src/mesa/drivers/x11/xm_tri.c +++ b/src/mesa/drivers/x11/xm_tri.c @@ -1443,6 +1443,46 @@ do { \ #endif + +GLboolean xmesa_get_cbuf_details( GLcontext *ctx, + void **ptr, + GLuint *cpp, + GLint *stride, + GLuint *format ) +{ + XMesaContext xmesa = XMESA_CONTEXT(ctx); + struct gl_framebuffer *fb = ctx->DrawBuffer; + struct gl_renderbuffer *crb = fb->_ColorDrawBuffers[0][0]; + struct xmesa_renderbuffer *xrb = xmesa_renderbuffer(crb->Wrapped); + + *ptr = crb->GetPointer(ctx, crb, 0, 0); + *stride = ((GLubyte *)crb->GetPointer(ctx, crb, 0, 1) - + (GLubyte *)crb->GetPointer(ctx, crb, 0, 0)); + + if (!ptr) + goto bad; + + switch (xmesa->pixelformat) { + case PF_8A8B8G8R: + case PF_8A8R8G8B: + *format = 1; /* whatever */ + *cpp = 4; + break; + default: + goto bad; + } + + return GL_TRUE; + + bad: + *ptr = NULL; + *stride = 0; + *format = 0; + return GL_FALSE; +} + + + /** * Return pointer to line drawing function, or NULL if we should use a * swrast fallback. |