void
WebGL2Context::ClearBufferfv(GLenum buffer, GLint drawBuffer, const Float32Arr& src,
                             GLuint srcElemOffset)
{
    const char funcName[] = "clearBufferfv";
    if (IsContextLost())
        return;

    if (buffer != LOCAL_GL_COLOR &&
        buffer != LOCAL_GL_DEPTH)
    {
        ErrorInvalidEnum("%s: buffer must be COLOR or DEPTH.", funcName);
        return;
    }

    if (!ValidateClearBuffer(funcName, buffer, drawBuffer, src.elemCount, srcElemOffset,
                             LOCAL_GL_FLOAT))
    {
        return;
    }

    ScopedDrawCallWrapper wrapper(*this);
    const auto ptr = src.elemBytes + srcElemOffset;
    gl->fClearBufferfv(buffer, drawBuffer, ptr);
}
void
WebGL2Context::ClearBufferfv(GLenum buffer, GLint drawbuffer, const dom::Sequence<GLfloat>& value)
{
    if (IsContextLost()) {
        return;
    }

    if (!ValidateClearBuffer("clearBufferfv", buffer, drawbuffer, value.Length())) {
        return;
    }

    ClearBufferfv_base(buffer, drawbuffer, value.Elements());
}
void
WebGL2Context::ClearBufferiv(GLenum buffer, GLint drawbuffer, const dom::Int32Array& value)
{
    if (IsContextLost()) {
        return;
    }

    value.ComputeLengthAndData();
    if (!ValidateClearBuffer("clearBufferiv", buffer, drawbuffer, value.Length())) {
        return;
    }

    ClearBufferiv_base(buffer, drawbuffer, value.Data());
}
void
WebGL2Context::ClearBufferfi(GLenum buffer, GLint drawBuffer, GLfloat depth,
                             GLint stencil)
{
    const char funcName[] = "clearBufferfi";
    if (IsContextLost())
        return;

    if (buffer != LOCAL_GL_DEPTH_STENCIL)
        return ErrorInvalidEnum("%s: buffer must be DEPTH_STENCIL.", funcName);

    if (!ValidateClearBuffer(funcName, buffer, drawBuffer, 2, 0, 0))
        return;

    ScopedDrawCallWrapper wrapper(*this);
    gl->fClearBufferfi(buffer, drawBuffer, depth, stencil);
}