summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri/mga/mgaspan.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/drivers/dri/mga/mgaspan.c')
-rw-r--r--src/mesa/drivers/dri/mga/mgaspan.c31
1 files changed, 29 insertions, 2 deletions
diff --git a/src/mesa/drivers/dri/mga/mgaspan.c b/src/mesa/drivers/dri/mga/mgaspan.c
index 8dc971cfc57..684239865f7 100644
--- a/src/mesa/drivers/dri/mga/mgaspan.c
+++ b/src/mesa/drivers/dri/mga/mgaspan.c
@@ -116,7 +116,7 @@
#undef INIT_MONO_PIXEL
#define INIT_MONO_PIXEL(p, color) \
- p = MGAPACKCOLOR565( color[0], color[1], color[2] )
+ p = PACK_COLOR_565( color[0], color[1], color[2] )
#define WRITE_RGBA( _x, _y, r, g, b, a ) \
@@ -148,7 +148,7 @@ do { \
#undef INIT_MONO_PIXEL
#define INIT_MONO_PIXEL(p, color) \
- p = MGAPACKCOLOR8888( color[0], color[1], color[2], color[3] )
+ p = PACK_COLOR_8888( color[3], color[0], color[1], color[2] )
#define WRITE_RGBA(_x, _y, r, g, b, a) \
@@ -233,11 +233,38 @@ do { \
+/*
+ * This function is called to specify which buffer to read and write
+ * for software rasterization (swrast) fallbacks. This doesn't necessarily
+ * correspond to glDrawBuffer() or glReadBuffer() calls.
+ */
+static void mgaDDSetBuffer(GLcontext *ctx, GLframebuffer *buffer,
+ GLuint bufferBit)
+{
+ mgaContextPtr mmesa = MGA_CONTEXT(ctx);
+
+ if (bufferBit == FRONT_LEFT_BIT)
+ {
+ mmesa->drawOffset = mmesa->mgaScreen->frontOffset;
+ mmesa->readOffset = mmesa->mgaScreen->frontOffset;
+ }
+ else if (bufferBit == BACK_LEFT_BIT)
+ {
+ mmesa->drawOffset = mmesa->mgaScreen->backOffset;
+ mmesa->readOffset = mmesa->mgaScreen->backOffset;
+ }
+ else {
+ assert(0);
+ }
+}
+
void mgaDDInitSpanFuncs( GLcontext *ctx )
{
mgaContextPtr mmesa = MGA_CONTEXT(ctx);
struct swrast_device_driver *swdd = _swrast_GetDeviceDriverReference(ctx);
+ swdd->SetBuffer = mgaDDSetBuffer;
+
switch (mmesa->mgaScreen->cpp) {
case 2:
swdd->WriteRGBASpan = mgaWriteRGBASpan_565;