Exemplo n.º 1
0
void ANGLEInstancedArrays::vertexAttribDivisorANGLE(GLuint index, GLuint divisor)
{
    if (isLost())
        return;

    m_context->vertexAttribDivisorANGLE(index, divisor);
}
Exemplo n.º 2
0
void ANGLEInstancedArrays::drawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount)
{
    if (isLost())
        return;

    m_context->drawArraysInstancedANGLE(mode, first, count, primcount);
}
Exemplo n.º 3
0
void ANGLEInstancedArrays::drawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei primcount)
{
    if (isLost())
        return;

    m_context->drawElementsInstancedANGLE(mode, count, type, offset, primcount);
}
Exemplo n.º 4
0
void WebGLDrawBuffers::drawBuffersWEBGL(const Vector<GC3Denum>& buffers)
{
    if (isLost())
        return;
    GC3Dsizei n = buffers.size();
    const GC3Denum* bufs = buffers.data();
    if (!m_context->m_framebufferBinding) {
        if (n != 1) {
            m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "drawBuffersWEBGL", "more than one buffer");
            return;
        }
        if (bufs[0] != GraphicsContext3D::BACK && bufs[0] != GraphicsContext3D::NONE) {
            m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "drawBuffersWEBGL", "BACK or NONE");
            return;
        }
        // Because the backbuffer is simulated on all current WebKit ports, we need to change BACK to COLOR_ATTACHMENT0.
        GC3Denum value = (bufs[0] == GraphicsContext3D::BACK) ? GraphicsContext3D::COLOR_ATTACHMENT0 : GraphicsContext3D::NONE;
        m_context->graphicsContext3D()->extensions()->drawBuffersEXT(1, &value);
        m_context->setBackDrawBuffer(bufs[0]);
    } else {
        if (n > m_context->maxDrawBuffers()) {
            m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "drawBuffersWEBGL", "more than max draw buffers");
            return;
        }
        for (GC3Dsizei i = 0; i < n; ++i) {
            if (bufs[i] != GraphicsContext3D::NONE && bufs[i] != static_cast<GC3Denum>(Extensions3D::COLOR_ATTACHMENT0_EXT + i)) {
                m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "drawBuffersWEBGL", "COLOR_ATTACHMENTi_EXT or NONE");
                return;
            }
        }
        m_context->m_framebufferBinding->drawBuffers(buffers);
    }
}
Exemplo n.º 5
0
String WebGLDebugShaders::getTranslatedShaderSource(WebGLShader* shader)
{
    if (isLost())
        return String();
    if (!m_context->validateWebGLObject("getTranslatedShaderSource", shader))
        return "";
    return m_context->ensureNotNull(m_context->webContext()->getTranslatedShaderSourceANGLE(shader->object()));
}
PassRefPtr<WebGLVertexArrayObjectOES> OESVertexArrayObject::createVertexArrayOES()
{
    if (isLost())
        return 0;

    RefPtr<WebGLVertexArrayObjectOES> o = WebGLVertexArrayObjectOES::create(m_context, WebGLVertexArrayObjectOES::VaoTypeUser);
    m_context->addContextObject(o.get());
    return o.release();
}
GLboolean OESVertexArrayObject::isVertexArrayOES(WebGLVertexArrayObjectOES* arrayObject)
{
    if (!arrayObject || isLost())
        return 0;

    if (!arrayObject->hasEverBeenBound())
        return 0;

    return m_context->webGraphicsContext3D()->isVertexArrayOES(arrayObject->object());
}
void OESVertexArrayObject::deleteVertexArrayOES(WebGLVertexArrayObjectOES* arrayObject)
{
    if (!arrayObject || isLost())
        return;

    if (!arrayObject->isDefaultObject() && arrayObject == m_context->m_boundVertexArrayObject)
        m_context->setBoundVertexArrayObject(0);

    arrayObject->deleteObject(m_context->webGraphicsContext3D());
}
GC3Dboolean OESVertexArrayObject::isVertexArrayOES(WebGLVertexArrayObjectOES* arrayObject)
{
    if (!arrayObject || isLost())
        return 0;

    if (!arrayObject->hasEverBeenBound())
        return 0;

    Extensions3D* extensions = m_context->graphicsContext3D()->extensions();
    return extensions->isVertexArrayOES(arrayObject->object());
}
void OESVertexArrayObject::bindVertexArrayOES(WebGLVertexArrayObjectOES* arrayObject)
{
    if (isLost())
        return;

    if (arrayObject && (arrayObject->isDeleted() || !arrayObject->validate(0, context()))) {
        m_context->webGraphicsContext3D()->synthesizeGLError(GL_INVALID_OPERATION);
        return;
    }

    if (arrayObject && !arrayObject->isDefaultObject() && arrayObject->object()) {
        m_context->webGraphicsContext3D()->bindVertexArrayOES(arrayObject->object());

        arrayObject->setHasEverBeenBound();
        m_context->setBoundVertexArrayObject(arrayObject);
    } else {
        m_context->webGraphicsContext3D()->bindVertexArrayOES(0);
        m_context->setBoundVertexArrayObject(0);
    }
}