Commit 4f57ad7f authored by Jeff Gilbert's avatar Jeff Gilbert
Browse files

Bug 1372157 - Fix IsFoo results in WebGL. r=kvark

Passes deqp/functional/gles3/lifetime.html.

Differential Revision: https://phabricator.services.mozilla.com/D8956
parent a60f34a0
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -43,7 +43,10 @@ WebGL2Context::IsSampler(const WebGLSampler* const obj)
    if (!ValidateIsObject(obj))
        return false;

    return gl->fIsSampler(obj->mGLName);
    if (obj->IsDeleteRequested())
        return false;

    return true;
}

void
+5 −1
Original line number Diff line number Diff line
@@ -54,7 +54,10 @@ WebGL2Context::IsTransformFeedback(const WebGLTransformFeedback* const obj)
    if (!ValidateIsObject(obj))
        return false;

    return gl->fIsTransformFeedback(obj->mGLName);
    if (obj->IsDeleteRequested())
        return false;

    return obj->mHasBeenBound;
}

void
@@ -90,6 +93,7 @@ WebGL2Context::BindTransformFeedback(GLenum target, WebGLTransformFeedback* tf)

    if (mBoundTransformFeedback) {
        mBoundTransformFeedback->AddBufferBindCounts(+1);
        mBoundTransformFeedback->mHasBeenBound = true;
    }
}

+4 −1
Original line number Diff line number Diff line
@@ -2493,7 +2493,10 @@ WebGLContext::ValidateIsObject(const WebGLDeletableObject* const object) const
    if (!object->IsCompatibleWithContext(this))
        return false;

    return !object->IsDeleted();
    if (object->IsDeleted())
        return false;

    return true;
}

bool
+23 −15
Original line number Diff line number Diff line
@@ -147,9 +147,7 @@ WebGLContext::BindFramebuffer(GLenum target, WebGLFramebuffer* wfb)
    } else {
        GLuint framebuffername = wfb->mGLName;
        gl->fBindFramebuffer(target, framebuffername);
#ifdef ANDROID
        wfb->mIsFB = true;
#endif
        wfb->mHasBeenBound = true;
    }

    switch (target) {
@@ -1065,7 +1063,10 @@ WebGLContext::IsBuffer(const WebGLBuffer* const obj)
    if (!ValidateIsObject(obj))
        return false;

    return gl->fIsBuffer(obj->mGLName);
    if (obj->IsDeleteRequested())
        return false;

    return obj->Content() != WebGLBuffer::Kind::Undefined;
}

bool
@@ -1075,15 +1076,10 @@ WebGLContext::IsFramebuffer(const WebGLFramebuffer* const obj)
    if (!ValidateIsObject(obj))
        return false;

#ifdef ANDROID
    if (gl->WorkAroundDriverBugs() &&
        gl->Renderer() == GLRenderer::AndroidEmulator)
    {
        return obj->mIsFB;
    }
#endif
    if (obj->IsDeleteRequested())
        return false;

    return gl->fIsFramebuffer(obj->mGLName);
    return obj->mHasBeenBound;
}

bool
@@ -1100,7 +1096,10 @@ WebGLContext::IsQuery(const WebGLQuery* const obj)
    if (!ValidateIsObject(obj))
        return false;

    return obj->IsQuery();
    if (obj->IsDeleteRequested())
        return false;

    return bool(obj->Target());
}

bool
@@ -1110,6 +1109,9 @@ WebGLContext::IsRenderbuffer(const WebGLRenderbuffer* const obj)
    if (!ValidateIsObject(obj))
        return false;

    if (obj->IsDeleteRequested())
        return false;

    return obj->mHasBeenBound;
}

@@ -1127,7 +1129,10 @@ WebGLContext::IsTexture(const WebGLTexture* const obj)
    if (!ValidateIsObject(obj))
        return false;

    return obj->IsTexture();
    if (obj->IsDeleteRequested())
        return false;

    return bool(obj->Target());
}

bool
@@ -1137,7 +1142,10 @@ WebGLContext::IsVertexArray(const WebGLVertexArray* const obj)
    if (!ValidateIsObject(obj))
        return false;

    return obj->IsVertexArray();
    if (obj->IsDeleteRequested())
        return false;

    return obj->mHasBeenBound;
}

// -
+2 −2
Original line number Diff line number Diff line
@@ -702,8 +702,8 @@ WebGLContext::AssertCachedBindings() const
    GetAndFlushUnderlyingGLErrors();

    if (IsWebGL2() || IsExtensionEnabled(WebGLExtensionID::OES_vertex_array_object)) {
        GLuint bound = mBoundVertexArray ? mBoundVertexArray->GLName() : 0;
        AssertUintParamCorrect(gl, LOCAL_GL_VERTEX_ARRAY_BINDING, bound);
        AssertUintParamCorrect(gl, LOCAL_GL_VERTEX_ARRAY_BINDING,
                               mBoundVertexArray->mGLName);
    }

    GLint stencilBits = 0;
Loading