예제 #1
0
void GLAPIENTRY
_mesa_BlendEquationSeparateEXT( GLenum modeRGB, GLenum modeA )
{
    GLuint buf, numBuffers;
    GLboolean changed;
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);

    if (MESA_VERBOSE & VERBOSE_API)
        _mesa_debug(ctx, "glBlendEquationSeparateEXT(%s %s)\n",
                    _mesa_lookup_enum_by_nr(modeRGB),
                    _mesa_lookup_enum_by_nr(modeA));

    if ( (modeRGB != modeA) && !ctx->Extensions.EXT_blend_equation_separate ) {
        _mesa_error(ctx, GL_INVALID_OPERATION,
                    "glBlendEquationSeparateEXT not supported by driver");
        return;
    }

    if (!legal_blend_equation(ctx, modeRGB)) {
        _mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationSeparateEXT(modeRGB)");
        return;
    }

    if (!legal_blend_equation(ctx, modeA)) {
        _mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationSeparateEXT(modeA)");
        return;
    }

    numBuffers = ctx->Extensions.ARB_draw_buffers_blend
                 ? ctx->Const.MaxDrawBuffers : 1;

    changed = GL_FALSE;
    for (buf = 0; buf < numBuffers; buf++) {
        if (ctx->Color.Blend[buf].EquationRGB != modeRGB ||
                ctx->Color.Blend[buf].EquationA != modeA) {
            changed = GL_TRUE;
            break;
        }
    }
    if (!changed)
        return;

    FLUSH_VERTICES(ctx, _NEW_COLOR);
    for (buf = 0; buf < numBuffers; buf++) {
        ctx->Color.Blend[buf].EquationRGB = modeRGB;
        ctx->Color.Blend[buf].EquationA = modeA;
    }
    ctx->Color._BlendEquationPerBuffer = GL_FALSE;

    if (ctx->Driver.BlendEquationSeparate)
        ctx->Driver.BlendEquationSeparate(ctx, modeRGB, modeA);
}
예제 #2
0
/**
 * Set blend equation for one color buffer/target.
 */
void GLAPIENTRY
_mesa_BlendEquationi(GLuint buf, GLenum mode)
{
    GET_CURRENT_CONTEXT(ctx);
    ASSERT_OUTSIDE_BEGIN_END(ctx);

    if (MESA_VERBOSE & VERBOSE_API)
        _mesa_debug(ctx, "glBlendEquationi(%u, %s)\n",
                    buf, _mesa_lookup_enum_by_nr(mode));

    if (buf >= ctx->Const.MaxDrawBuffers) {
        _mesa_error(ctx, GL_INVALID_VALUE, "glBlendFuncSeparatei(buffer=%u)",
                    buf);
        return;
    }

    if (!legal_blend_equation(ctx, mode)) {
        _mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationi");
        return;
    }

    if (ctx->Color.Blend[buf].EquationRGB == mode &&
            ctx->Color.Blend[buf].EquationA == mode)
        return;  /* no change */

    FLUSH_VERTICES(ctx, _NEW_COLOR);
    ctx->Color.Blend[buf].EquationRGB = mode;
    ctx->Color.Blend[buf].EquationA = mode;
    ctx->Color._BlendEquationPerBuffer = GL_TRUE;

    if (ctx->Driver.BlendEquationSeparatei)
        ctx->Driver.BlendEquationSeparatei(ctx, buf, mode, mode);
}
예제 #3
0
파일: blend.c 프로젝트: dumbbell/mesa
/**
 * Set separate blend equations for one color buffer/target.
 */
void GLAPIENTRY
_mesa_BlendEquationSeparateiARB(GLuint buf, GLenum modeRGB, GLenum modeA)
{
   GET_CURRENT_CONTEXT(ctx);

   if (MESA_VERBOSE & VERBOSE_API)
      _mesa_debug(ctx, "glBlendEquationSeparatei(%u, %s %s)\n", buf,
                  _mesa_enum_to_string(modeRGB),
                  _mesa_enum_to_string(modeA));

   if (buf >= ctx->Const.MaxDrawBuffers) {
      _mesa_error(ctx, GL_INVALID_VALUE, "glBlendEquationSeparatei(buffer=%u)",
                  buf);
      return;
   }

   if (!legal_blend_equation(ctx, modeRGB)) {
      _mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationSeparatei(modeRGB)");
      return;
   }

   if (!legal_blend_equation(ctx, modeA)) {
      _mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquationSeparatei(modeA)");
      return;
   }

   if (ctx->Color.Blend[buf].EquationRGB == modeRGB &&
       ctx->Color.Blend[buf].EquationA == modeA)
      return;  /* no change */

   FLUSH_VERTICES(ctx, _NEW_COLOR);
   ctx->Color.Blend[buf].EquationRGB = modeRGB;
   ctx->Color.Blend[buf].EquationA = modeA;
   ctx->Color._BlendEquationPerBuffer = GL_TRUE;

   if (ctx->Driver.BlendEquationSeparatei)
      ctx->Driver.BlendEquationSeparatei(ctx, buf, modeRGB, modeA);
}
예제 #4
0
파일: blend.c 프로젝트: dumbbell/mesa
/* This is really an extension function! */
void GLAPIENTRY
_mesa_BlendEquation( GLenum mode )
{
   GLuint buf, numBuffers;
   GLboolean changed;
   GET_CURRENT_CONTEXT(ctx);

   if (MESA_VERBOSE & VERBOSE_API)
      _mesa_debug(ctx, "glBlendEquation(%s)\n",
                  _mesa_enum_to_string(mode));

   if (!legal_blend_equation(ctx, mode)) {
      _mesa_error(ctx, GL_INVALID_ENUM, "glBlendEquation");
      return;
   }

   numBuffers = ctx->Extensions.ARB_draw_buffers_blend
      ? ctx->Const.MaxDrawBuffers : 1;

   changed = GL_FALSE;
   for (buf = 0; buf < numBuffers; buf++) {
      if (ctx->Color.Blend[buf].EquationRGB != mode ||
          ctx->Color.Blend[buf].EquationA != mode) {
         changed = GL_TRUE;
         break;
      }
   }
   if (!changed)
      return;

   FLUSH_VERTICES(ctx, _NEW_COLOR);
   for (buf = 0; buf < numBuffers; buf++) {
      ctx->Color.Blend[buf].EquationRGB = mode;
      ctx->Color.Blend[buf].EquationA = mode;
   }
   ctx->Color._BlendEquationPerBuffer = GL_FALSE;

   if (ctx->Driver.BlendEquationSeparate)
      (*ctx->Driver.BlendEquationSeparate)( ctx, mode, mode );
}