- switch (mode) {
- case GL_AUX0:
- case GL_AUX1:
- case GL_AUX2:
- case GL_AUX3:
- /* AUX buffers not implemented in Mesa at this time */
- gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
- return;
- case GL_RIGHT:
- if (!ctx->Visual.StereoFlag) {
- gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
- return;}
- if (ctx->Visual.DBflag)
- ctx->Color.DrawDestMask = FRONT_RIGHT_BIT | BACK_RIGHT_BIT;
- else
- ctx->Color.DrawDestMask = FRONT_RIGHT_BIT;
- break;
- case GL_FRONT_RIGHT:
- if (!ctx->Visual.StereoFlag) {
- gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
- return;
- }
- ctx->Color.DrawDestMask = FRONT_RIGHT_BIT;
- break;
- case GL_BACK_RIGHT:
- if (!ctx->Visual.StereoFlag) {
- gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
- return;
- }
- if (!ctx->Visual.DBflag) {
- gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
- return;
- }
- ctx->Color.DrawDestMask = BACK_RIGHT_BIT;
- break;
- case GL_BACK_LEFT:
- if (!ctx->Visual.DBflag) {
- gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
- return;
- }
- ctx->Color.DrawDestMask = BACK_LEFT_BIT;
- break;
- case GL_FRONT_AND_BACK:
- if (!ctx->Visual.DBflag) {
- gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
- return;
- }
- if (ctx->Visual.StereoFlag)
- ctx->Color.DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT
- | FRONT_RIGHT_BIT | BACK_RIGHT_BIT;
- else
- ctx->Color.DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT;
- break;
- case GL_BACK:
- if (!ctx->Visual.DBflag) {
- gl_error( ctx, GL_INVALID_OPERATION, "glDrawBuffer" );
- return;
- }
- if (ctx->Visual.StereoFlag)
- ctx->Color.DrawDestMask = BACK_LEFT_BIT | BACK_RIGHT_BIT;
- else
- ctx->Color.DrawDestMask = BACK_LEFT_BIT;
- break;
- case GL_LEFT:
- /* never an error */
- if (ctx->Visual.DBflag)
- ctx->Color.DrawDestMask = FRONT_LEFT_BIT | BACK_LEFT_BIT;
- else
- ctx->Color.DrawDestMask = FRONT_LEFT_BIT;
- break;
- case GL_FRONT_LEFT:
- /* never an error */
- ctx->Color.DrawDestMask = FRONT_LEFT_BIT;
- break;
- case GL_FRONT:
- /* never an error */
- if (ctx->Visual.StereoFlag)
- ctx->Color.DrawDestMask = FRONT_LEFT_BIT | FRONT_RIGHT_BIT;
- else
- ctx->Color.DrawDestMask = FRONT_LEFT_BIT;
- break;
- case GL_NONE:
- /* never an error */
- ctx->Color.DrawDestMask = 0;
- break;
- default:
- gl_error( ctx, GL_INVALID_ENUM, "glDrawBuffer" );
- return;
- }