diff options
author | Brian Paul <[email protected]> | 2005-05-04 20:11:35 +0000 |
---|---|---|
committer | Brian Paul <[email protected]> | 2005-05-04 20:11:35 +0000 |
commit | e4b2356c07d31fbeeabb13b2fb47db703b473080 (patch) | |
tree | d8b7f1c7c9e7c84d84349485f942dd205dd4c16d /src/mesa/drivers/dri/mga/mgaspan.c | |
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/mga/mgaspan.c')
-rw-r--r-- | src/mesa/drivers/dri/mga/mgaspan.c | 59 |
1 files changed, 56 insertions, 3 deletions
diff --git a/src/mesa/drivers/dri/mga/mgaspan.c b/src/mesa/drivers/dri/mga/mgaspan.c index 4b2c5cd6829..4279dfd95bc 100644 --- a/src/mesa/drivers/dri/mga/mgaspan.c +++ b/src/mesa/drivers/dri/mga/mgaspan.c @@ -204,9 +204,9 @@ static void mgaDDSetBuffer(GLcontext *ctx, GLframebuffer *buffer, mgaContextPtr mmesa = MGA_CONTEXT(ctx); unsigned int offset; - assert((bufferBit == DD_FRONT_LEFT_BIT) || (bufferBit == DD_BACK_LEFT_BIT)); + assert((bufferBit == BUFFER_BIT_FRONT_LEFT) || (bufferBit == BUFFER_BIT_BACK_LEFT)); - offset = (bufferBit == DD_FRONT_LEFT_BIT) + offset = (bufferBit == BUFFER_BIT_FRONT_LEFT) ? mmesa->mgaScreen->frontOffset : mmesa->mgaScreen->backOffset; @@ -237,15 +237,17 @@ void mgaDDInitSpanFuncs( GLcontext *ctx ) switch (mmesa->mgaScreen->cpp) { case 2: +#if 0 mgaInitPointers_565( swdd ); - swdd->ReadDepthSpan = mgaReadDepthSpan_16; swdd->WriteDepthSpan = mgaWriteDepthSpan_16; swdd->ReadDepthPixels = mgaReadDepthPixels_16; swdd->WriteDepthPixels = mgaWriteDepthPixels_16; +#endif break; case 4: +#if 0 mgaInitPointers_8888( swdd ); if (!mmesa->hw_stencil) { @@ -264,6 +266,57 @@ void mgaDDInitSpanFuncs( GLcontext *ctx ) swdd->ReadStencilPixels = mgaReadStencilPixels_24_8; swdd->WriteStencilPixels = mgaWriteStencilPixels_24_8; } +#endif break; } } + + + +/** + * Plug in the Get/Put routines for the given driRenderbuffer. + */ +void +mgaSetSpanFunctions(driRenderbuffer *drb, const GLvisual *vis) +{ + if (drb->Base.InternalFormat == GL_RGBA) { + if (vis->redBits == 5 && vis->greenBits == 6 && vis->blueBits == 5) { + mgaInitPointers_565(&drb->Base); + } + else { + mgaInitPointers_8888(&drb->Base); + } + } + else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT16) { + drb->Base.GetRow = mgaReadDepthSpan_16; + drb->Base.GetValues = mgaReadDepthPixels_16; + drb->Base.PutRow = mgaWriteDepthSpan_16; + drb->Base.PutMonoRow = mgaWriteMonoDepthSpan_16; + drb->Base.PutValues = mgaWriteDepthPixels_16; + drb->Base.PutMonoValues = NULL; + } + else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT24) { + drb->Base.GetRow = mgaReadDepthSpan_24_8; + drb->Base.GetValues = mgaReadDepthPixels_24_8; + drb->Base.PutRow = mgaWriteDepthSpan_24_8; + drb->Base.PutMonoRow = mgaWriteMonoDepthSpan_24_8; + drb->Base.PutValues = mgaWriteDepthPixels_24_8; + drb->Base.PutMonoValues = NULL; + } + else if (drb->Base.InternalFormat == GL_DEPTH_COMPONENT32) { + drb->Base.GetRow = mgaReadDepthSpan_32; + drb->Base.GetValues = mgaReadDepthPixels_32; + drb->Base.PutRow = mgaWriteDepthSpan_32; + drb->Base.PutMonoRow = mgaWriteMonoDepthSpan_32; + drb->Base.PutValues = mgaWriteDepthPixels_32; + drb->Base.PutMonoValues = NULL; + } + else if (drb->Base.InternalFormat == GL_STENCIL_INDEX8_EXT) { + drb->Base.GetRow = mgaReadStencilSpan_24_8; + drb->Base.GetValues = mgaReadStencilPixels_24_8; + drb->Base.PutRow = mgaWriteStencilSpan_24_8; + drb->Base.PutMonoRow = mgaWriteMonoStencilSpan_24_8; + drb->Base.PutValues = mgaWriteStencilPixels_24_8; + drb->Base.PutMonoValues = NULL; + } +} |