diff options
author | Brian Paul <brian.paul@tungstengraphics.com> | 2005-05-04 20:11:35 +0000 |
---|---|---|
committer | Brian Paul <brian.paul@tungstengraphics.com> | 2005-05-04 20:11:35 +0000 |
commit | e4b2356c07d31fbeeabb13b2fb47db703b473080 (patch) | |
tree | d8b7f1c7c9e7c84d84349485f942dd205dd4c16d /src/mesa/drivers/dri/i810 | |
parent | ebef61f5c0950572f9c6a81b08f447957461675c (diff) |
Major check-in of changes for GL_EXT_framebuffer_object extension.
Main driver impacts:
- new code for creating the Mesa GLframebuffer
- new span/pixel read/write code
Some drivers not yet updated/tested.
Diffstat (limited to 'src/mesa/drivers/dri/i810')
-rw-r--r-- | src/mesa/drivers/dri/i810/i810context.c | 25 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i810/i810ioctl.c | 12 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i810/i810screen.c | 45 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i810/i810span.c | 53 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i810/i810span.h | 5 | ||||
-rw-r--r-- | src/mesa/drivers/dri/i810/i810state.c | 6 |
6 files changed, 124 insertions, 22 deletions
diff --git a/src/mesa/drivers/dri/i810/i810context.c b/src/mesa/drivers/dri/i810/i810context.c index bf1b2fc93c..aa4eb4be6e 100644 --- a/src/mesa/drivers/dri/i810/i810context.c +++ b/src/mesa/drivers/dri/i810/i810context.c @@ -38,6 +38,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "matrix.h" #include "simple_list.h" #include "extensions.h" +#include "framebuffer.h" #include "imports.h" #include "swrast/swrast.h" @@ -245,7 +246,7 @@ i810CreateContext( const __GLcontextModes *mesaVis, ctx->Const.PointSizeGranularity = 1.0; ctx->Driver.GetBufferSize = i810BufferSize; - ctx->Driver.ResizeBuffers = _swrast_alloc_buffers; + ctx->Driver.ResizeBuffers = _mesa_resize_framebuffer; ctx->Driver.GetString = i810GetString; /* Who owns who? @@ -384,11 +385,12 @@ void i810XMesaSetBackClipRects( i810ContextPtr imesa ) static void i810XMesaWindowMoved( i810ContextPtr imesa ) { - switch (imesa->glCtx->Color._DrawDestMask[0]) { - case DD_FRONT_LEFT_BIT: + /* Determine current color drawing buffer */ + switch (imesa->glCtx->DrawBuffer->_ColorDrawBufferMask[0]) { + case BUFFER_BIT_FRONT_LEFT: i810XMesaSetFrontClipRects( imesa ); break; - case DD_BACK_LEFT_BIT: + case BUFFER_BIT_BACK_LEFT: i810XMesaSetBackClipRects( imesa ); break; default: @@ -424,16 +426,16 @@ i810MakeCurrent(__DRIcontextPrivate *driContextPriv, */ imesa->driDrawable = driDrawPriv; - _mesa_make_current2(imesa->glCtx, - (GLframebuffer *) driDrawPriv->driverPrivate, - (GLframebuffer *) driReadPriv->driverPrivate); + _mesa_make_current(imesa->glCtx, + (GLframebuffer *) driDrawPriv->driverPrivate, + (GLframebuffer *) driReadPriv->driverPrivate); /* Are these necessary? */ i810XMesaWindowMoved( imesa ); } else { - _mesa_make_current(0,0); + _mesa_make_current(NULL, NULL, NULL); } return GL_TRUE; @@ -445,11 +447,12 @@ i810UpdatePageFlipping( i810ContextPtr imesa ) GLcontext *ctx = imesa->glCtx; int front = 0; - switch (ctx->Color._DrawDestMask[0]) { - case DD_FRONT_LEFT_BIT: + /* Determine current color drawing buffer */ + switch (ctx->DrawBuffer->_ColorDrawBufferMask[0]) { + case BUFFER_BIT_FRONT_LEFT: front = 1; break; - case DD_BACK_LEFT_BIT: + case BUFFER_BIT_BACK_LEFT: front = 0; break; default: diff --git a/src/mesa/drivers/dri/i810/i810ioctl.c b/src/mesa/drivers/dri/i810/i810ioctl.c index 50ddd0976f..ba651555a6 100644 --- a/src/mesa/drivers/dri/i810/i810ioctl.c +++ b/src/mesa/drivers/dri/i810/i810ioctl.c @@ -63,20 +63,20 @@ static void i810Clear( GLcontext *ctx, GLbitfield mask, GLboolean all, I810_FIREVERTICES( imesa ); - if ((mask & DD_FRONT_LEFT_BIT) && colorMask == ~0U) { + if ((mask & BUFFER_BIT_FRONT_LEFT) && colorMask == ~0U) { clear.flags |= I810_FRONT; - mask &= ~DD_FRONT_LEFT_BIT; + mask &= ~BUFFER_BIT_FRONT_LEFT; } - if ((mask & DD_BACK_LEFT_BIT) && colorMask == ~0U) { + if ((mask & BUFFER_BIT_BACK_LEFT) && colorMask == ~0U) { clear.flags |= I810_BACK; - mask &= ~DD_BACK_LEFT_BIT; + mask &= ~BUFFER_BIT_BACK_LEFT; } - if (mask & DD_DEPTH_BIT) { + if (mask & BUFFER_BIT_DEPTH) { if (ctx->Depth.Mask) clear.flags |= I810_DEPTH; - mask &= ~DD_DEPTH_BIT; + mask &= ~BUFFER_BIT_DEPTH; } if (clear.flags) { diff --git a/src/mesa/drivers/dri/i810/i810screen.c b/src/mesa/drivers/dri/i810/i810screen.c index 072bcd0318..f270df66b6 100644 --- a/src/mesa/drivers/dri/i810/i810screen.c +++ b/src/mesa/drivers/dri/i810/i810screen.c @@ -36,7 +36,10 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include "glheader.h" #include "imports.h" #include "context.h" +#include "framebuffer.h" +#include "fbobject.h" #include "matrix.h" +#include "renderbuffer.h" #include "simple_list.h" #include "utils.h" @@ -330,22 +333,64 @@ i810DestroyScreen(__DRIscreenPrivate *sPriv) } +/** + * Create a buffer which corresponds to the window. + */ static GLboolean i810CreateBuffer( __DRIscreenPrivate *driScrnPriv, __DRIdrawablePrivate *driDrawPriv, const __GLcontextModes *mesaVis, GLboolean isPixmap ) { + i810ScreenPrivate *screen = (i810ScreenPrivate *) driScrnPriv->private; + if (isPixmap) { return GL_FALSE; /* not implemented */ } else { +#if 0 driDrawPriv->driverPrivate = (void *) _mesa_create_framebuffer(mesaVis, GL_FALSE, /* software depth buffer? */ mesaVis->stencilBits > 0, mesaVis->accumRedBits > 0, GL_FALSE /* s/w alpha planes */); +#else + struct gl_framebuffer *fb = _mesa_create_framebuffer(mesaVis); + + { + driRenderbuffer *frontRb + = driNewRenderbuffer(GL_RGBA, screen->cpp, + /*screen->frontOffset*/0, screen->backPitch); + i810SetSpanFunctions(frontRb, mesaVis); + _mesa_add_renderbuffer(fb, BUFFER_FRONT_LEFT, &frontRb->Base); + } + + if (mesaVis->doubleBufferMode) { + driRenderbuffer *backRb + = driNewRenderbuffer(GL_RGBA, screen->cpp, + screen->backOffset, screen->backPitch); + i810SetSpanFunctions(backRb, mesaVis); + _mesa_add_renderbuffer(fb, BUFFER_BACK_LEFT, &backRb->Base); + } + + if (mesaVis->depthBits == 16) { + driRenderbuffer *depthRb + = driNewRenderbuffer(GL_DEPTH_COMPONENT16, screen->cpp, + screen->depthOffset, screen->backPitch); + i810SetSpanFunctions(depthRb, mesaVis); + _mesa_add_renderbuffer(fb, BUFFER_DEPTH, &depthRb->Base); + } + + _mesa_add_soft_renderbuffers(fb, + GL_FALSE, /* color */ + GL_FALSE, /* depth */ + mesaVis->stencilBits > 0, + mesaVis->accumRedBits > 0, + GL_FALSE, /* alpha */ + GL_FALSE /* aux */); + driDrawPriv->driverPrivate = (void *) fb; +#endif return (driDrawPriv->driverPrivate != NULL); } } diff --git a/src/mesa/drivers/dri/i810/i810span.c b/src/mesa/drivers/dri/i810/i810span.c index eb32cb7c70..78b8265b70 100644 --- a/src/mesa/drivers/dri/i810/i810span.c +++ b/src/mesa/drivers/dri/i810/i810span.c @@ -123,13 +123,13 @@ static void i810SetBuffer(GLcontext *ctx, GLframebuffer *buffer, (void) buffer; switch(bufferBit) { - case DD_FRONT_LEFT_BIT: + case BUFFER_BIT_FRONT_LEFT: if ( imesa->sarea->pf_current_page == 1) imesa->readMap = imesa->i810Screen->back.map; else imesa->readMap = (char*)imesa->driScreen->pFB; break; - case DD_BACK_LEFT_BIT: + case BUFFER_BIT_BACK_LEFT: if ( imesa->sarea->pf_current_page == 1) imesa->readMap = (char*)imesa->driScreen->pFB; else @@ -165,6 +165,7 @@ void i810InitSpanFuncs( GLcontext *ctx ) swdd->SetBuffer = i810SetBuffer; +#if 0 swdd->WriteRGBASpan = i810WriteRGBASpan_565; swdd->WriteRGBSpan = i810WriteRGBSpan_565; swdd->WriteMonoRGBASpan = i810WriteMonoRGBASpan_565; @@ -172,12 +173,60 @@ void i810InitSpanFuncs( GLcontext *ctx ) swdd->WriteMonoRGBAPixels = i810WriteMonoRGBAPixels_565; swdd->ReadRGBASpan = i810ReadRGBASpan_565; swdd->ReadRGBAPixels = i810ReadRGBAPixels_565; +#endif +#if 0 swdd->ReadDepthSpan = i810ReadDepthSpan_16; swdd->WriteDepthSpan = i810WriteDepthSpan_16; swdd->ReadDepthPixels = i810ReadDepthPixels_16; swdd->WriteDepthPixels = i810WriteDepthPixels_16; +#endif swdd->SpanRenderStart = i810SpanRenderStart; swdd->SpanRenderFinish = i810SpanRenderFinish; } + + + +/** + * Plug in the Get/Put routines for the given driRenderbuffer. + */ +void +i810SetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis) +{ + if (drb->Base.InternalFormat == GL_RGBA) { + /* always 565 RGB */ + drb->Base.GetRow = i810ReadRGBASpan_565; + drb->Base.GetValues = i810ReadRGBAPixels_565; + drb->Base.PutRow = i810WriteRGBASpan_565; + drb->Base.PutRowRGB = i810WriteRGBSpan_565; + drb->Base.PutMonoRow = i810WriteMonoRGBASpan_565; + drb->Base.PutValues = i810WriteRGBAPixels_565; + drb->Base.PutMonoValues = i810WriteMonoRGBAPixels_565; + } + else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) { + drb->Base.GetRow = i810ReadDepthSpan_16; + drb->Base.GetValues = i810ReadDepthPixels_16; + drb->Base.PutRow = i810WriteDepthSpan_16; + drb->Base.PutMonoRow = i810WriteMonoDepthSpan_16; + drb->Base.PutValues = i810WriteDepthPixels_16; + drb->Base.PutMonoValues = NULL; + } + else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) { + /* should never get here */ + drb->Base.GetRow = NULL; + drb->Base.GetValues = NULL; + drb->Base.PutRow = NULL; + drb->Base.PutMonoRow = NULL; + drb->Base.PutValues = NULL; + drb->Base.PutMonoValues = NULL; + } + else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) { + drb->Base.GetRow = NULL; + drb->Base.GetValues = NULL; + drb->Base.PutRow = NULL; + drb->Base.PutMonoRow = NULL; + drb->Base.PutValues = NULL; + drb->Base.PutMonoValues = NULL; + } +} diff --git a/src/mesa/drivers/dri/i810/i810span.h b/src/mesa/drivers/dri/i810/i810span.h index 545bce46a6..9aed253bd5 100644 --- a/src/mesa/drivers/dri/i810/i810span.h +++ b/src/mesa/drivers/dri/i810/i810span.h @@ -1,9 +1,14 @@ #ifndef _I810_SPAN_H #define _I810_SPAN_H +#include "drirenderbuffer.h" + extern void i810InitSpanFuncs( GLcontext *ctx ); extern void i810SpanRenderFinish( GLcontext *ctx ); extern void i810SpanRenderStart( GLcontext *ctx ); +extern void +i810SetSpanFunctions(driRenderbuffer *rb, const GLvisual *vis); + #endif diff --git a/src/mesa/drivers/dri/i810/i810state.c b/src/mesa/drivers/dri/i810/i810state.c index 42df2e8b9e..ec9f07ada3 100644 --- a/src/mesa/drivers/dri/i810/i810state.c +++ b/src/mesa/drivers/dri/i810/i810state.c @@ -285,11 +285,11 @@ void i810DrawBuffer(GLcontext *ctx, GLenum mode ) /* * _DrawDestMask is easier to cope with than <mode>. */ - switch ( ctx->Color._DrawDestMask[0] ) { - case DD_FRONT_LEFT_BIT: + switch ( ctx->DrawBuffer->_ColorDrawBufferMask[0]) { + case BUFFER_BIT_FRONT_LEFT: front = 1; break; - case DD_BACK_LEFT_BIT: + case BUFFER_BIT_BACK_LEFT: front = 0; break; default: |