Changeset 69804 in webkit


Ignore:
Timestamp:
Oct 14, 2010 2:11:52 PM (14 years ago)
Author:
zmo@google.com
Message:

2010-10-14 Zhenyao Mo <zmo@google.com>

Reviewed by Kenneth Russell.

Cache link status at linkProgram and use it in useProgram instead of querying GPU
https://bugs.webkit.org/show_bug.cgi?id=47685

  • html/canvas/WebGLProgram.cpp: Always cache link status at linkStatus and use it upon query. (WebCore::WebGLProgram::WebGLProgram):
  • html/canvas/WebGLProgram.h: Ditto. (WebCore::WebGLProgram::getLinkStatus): (WebCore::WebGLProgram::setLinkStatus):
  • html/canvas/WebGLRenderingContext.cpp: Ditto. (WebCore::WebGLRenderingContext::getProgramParameter): (WebCore::WebGLRenderingContext::linkProgram): (WebCore::WebGLRenderingContext::useProgram):
Location:
trunk/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebCore/ChangeLog

    r69801 r69804  
     12010-10-14  Zhenyao Mo  <zmo@google.com>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        Cache link status at linkProgram and use it in useProgram instead of querying GPU
     6        https://bugs.webkit.org/show_bug.cgi?id=47685
     7
     8        * html/canvas/WebGLProgram.cpp: Always cache link status at linkStatus and use it upon query.
     9        (WebCore::WebGLProgram::WebGLProgram):
     10        * html/canvas/WebGLProgram.h: Ditto.
     11        (WebCore::WebGLProgram::getLinkStatus):
     12        (WebCore::WebGLProgram::setLinkStatus):
     13        * html/canvas/WebGLRenderingContext.cpp: Ditto.
     14        (WebCore::WebGLRenderingContext::getProgramParameter):
     15        (WebCore::WebGLRenderingContext::linkProgram):
     16        (WebCore::WebGLRenderingContext::useProgram):
     17
    1182010-10-14  Justin Schuh  <jschuh@chromium.org>
    219
  • trunk/WebCore/html/canvas/WebGLProgram.cpp

    r68424 r69804  
    4141WebGLProgram::WebGLProgram(WebGLRenderingContext* ctx)
    4242    : WebGLObject(ctx)
    43     , m_linkFailure(false)
     43    , m_linkStatus(false)
    4444{
    4545    setObject(context()->graphicsContext3D()->createProgram());
  • trunk/WebCore/html/canvas/WebGLProgram.h

    r65330 r69804  
    5151    bool isUsingVertexAttrib0() const;
    5252
    53     // Return true means getProgramParameter(LINK_STATUS) should return
    54     // false; return false means we should actually call
    55     // getProgramParameter(LINK_STATUS) to find out.
    56     bool isLinkFailureFlagSet() const { return m_linkFailure; }
    57     void setLinkFailureFlag(bool failed) { m_linkFailure = failed; }
     53    bool getLinkStatus() const { return m_linkStatus; }
     54    void setLinkStatus(bool status) { m_linkStatus = status; }
    5855
    5956    WebGLShader* getAttachedShader(GraphicsContext3D::WebGLEnumType);
     
    7168    Vector<int> m_activeAttribLocations;
    7269
    73     bool m_linkFailure;
     70    bool m_linkStatus;
    7471
    7572    RefPtr<WebGLShader> m_vertexShader;
  • trunk/WebCore/html/canvas/WebGLRenderingContext.cpp

    r69619 r69804  
    14851485        return WebGLGetInfo(static_cast<bool>(value));
    14861486    case GraphicsContext3D::LINK_STATUS:
    1487         if (program->isLinkFailureFlagSet())
    1488             return WebGLGetInfo(false);
    1489         m_context->getProgramiv(objectOrZero(program), pname, &value);
    1490         return WebGLGetInfo(static_cast<bool>(value));
     1487        return WebGLGetInfo(program->getLinkStatus());
    14911488    case GraphicsContext3D::INFO_LOG_LENGTH:
    14921489    case GraphicsContext3D::ATTACHED_SHADERS:
     
    18981895    if (!isGLES2Compliant()) {
    18991896        if (!program->getAttachedShader(GraphicsContext3D::VERTEX_SHADER) || !program->getAttachedShader(GraphicsContext3D::FRAGMENT_SHADER)) {
    1900             program->setLinkFailureFlag(true);
     1897            program->setLinkStatus(false);
    19011898            return;
    19021899        }
    1903         program->setLinkFailureFlag(false);
    19041900    }
    19051901
    19061902    m_context->linkProgram(objectOrZero(program));
    19071903    program->cacheActiveAttribLocations();
     1904    // cache link status
     1905    int value = 0;
     1906    m_context->getProgramiv(objectOrZero(program), GraphicsContext3D::LINK_STATUS, &value);
     1907    program->setLinkStatus(static_cast<bool>(value));
    19081908    cleanupAfterGraphicsCall(false);
    19091909}
     
    27152715void WebGLRenderingContext::useProgram(WebGLProgram* program, ExceptionCode& ec)
    27162716{
     2717    UNUSED_PARAM(ec);
    27172718    if (program && program->context() != this) {
    27182719        m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
    27192720        return;
    27202721    }
    2721     if (program && program->object() && !getProgramParameter(program, GraphicsContext3D::LINK_STATUS, ec).getBool()) {
     2722    if (program && program->object() && !program->getLinkStatus()) {
    27222723        m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION);
    27232724        cleanupAfterGraphicsCall(false);
Note: See TracChangeset for help on using the changeset viewer.