Changeset 76814 in webkit


Ignore:
Timestamp:
Jan 27, 2011 10:58:53 AM (13 years ago)
Author:
zmo@google.com
Message:

2011-01-26 Zhenyao Mo <zmo@google.com>

Reviewed by Kenneth Russell.

shaderSource needs to preserve original source
https://bugs.webkit.org/show_bug.cgi?id=52833

  • fast/canvas/webgl/gl-getshadersource-expected.txt: Added.
  • fast/canvas/webgl/gl-getshadersource.html: Added.

2011-01-26 Zhenyao Mo <zmo@google.com>

Reviewed by Kenneth Russell.

shaderSource needs to preserve original source
https://bugs.webkit.org/show_bug.cgi?id=52833

Test: fast/canvas/webgl/gl-getshadersource.html

  • html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::getShaderParameter): Intercept SHADER_SOURCE_LENGTH. (WebCore::WebGLRenderingContext::getShaderSource): Intercept the call. (WebCore::WebGLRenderingContext::shaderSource): Cache the source.
  • html/canvas/WebGLShader.cpp: Cache shader source. (WebCore::WebGLShader::WebGLShader):
  • html/canvas/WebGLShader.h: Ditto. (WebCore::WebGLShader::getSource): (WebCore::WebGLShader::setSource):
Location:
trunk
Files:
2 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r76812 r76814  
     12011-01-26  Zhenyao Mo  <zmo@google.com>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        shaderSource needs to preserve original source
     6        https://bugs.webkit.org/show_bug.cgi?id=52833
     7
     8        * fast/canvas/webgl/gl-getshadersource-expected.txt: Added.
     9        * fast/canvas/webgl/gl-getshadersource.html: Added.
     10
    1112011-01-27  Philippe Normand  <pnormand@igalia.com>
    212
  • trunk/Source/WebCore/ChangeLog

    r76802 r76814  
     12011-01-26  Zhenyao Mo  <zmo@google.com>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        shaderSource needs to preserve original source
     6        https://bugs.webkit.org/show_bug.cgi?id=52833
     7
     8        Test: fast/canvas/webgl/gl-getshadersource.html
     9
     10        * html/canvas/WebGLRenderingContext.cpp:
     11        (WebCore::WebGLRenderingContext::getShaderParameter): Intercept SHADER_SOURCE_LENGTH.
     12        (WebCore::WebGLRenderingContext::getShaderSource): Intercept the call.
     13        (WebCore::WebGLRenderingContext::shaderSource): Cache the source.
     14        * html/canvas/WebGLShader.cpp: Cache shader source.
     15        (WebCore::WebGLShader::WebGLShader):
     16        * html/canvas/WebGLShader.h: Ditto.
     17        (WebCore::WebGLShader::getSource):
     18        (WebCore::WebGLShader::setSource):
     19
    1202011-01-27  Patrick Gansterer  <paroga@webkit.org>
    221
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp

    r76603 r76814  
    21652165        return WebGLGetInfo(static_cast<unsigned int>(value));
    21662166    case GraphicsContext3D::INFO_LOG_LENGTH:
     2167        m_context->getShaderiv(objectOrZero(shader), pname, &value);
     2168        return WebGLGetInfo(value);
    21672169    case GraphicsContext3D::SHADER_SOURCE_LENGTH:
    2168         m_context->getShaderiv(objectOrZero(shader), pname, &value);
     2170        value = static_cast<GC3Dint>(shader->getSource().length());
     2171        if (value > 0)
     2172            value++; // Includes the null termination character.
    21692173        return WebGLGetInfo(value);
    21702174    default:
     
    21922196    if (!validateWebGLObject(shader))
    21932197        return "";
    2194     WebGLStateRestorer(this, false);
    2195     return m_context->getShaderSource(objectOrZero(shader));
     2198    return shader->getSource();
    21962199}
    21972200
     
    27732776    if (!validateString(stringWithoutComments))
    27742777        return;
     2778    shader->setSource(string);
    27752779    m_context->shaderSource(objectOrZero(shader), stringWithoutComments);
    27762780    cleanupAfterGraphicsCall(false);
  • trunk/Source/WebCore/html/canvas/WebGLShader.cpp

    r76603 r76814  
    4242    : WebGLObject(ctx)
    4343    , m_type(type)
     44    , m_source("")
    4445{
    4546    setObject(context()->graphicsContext3D()->createShader(type));
  • trunk/Source/WebCore/html/canvas/WebGLShader.h

    r75741 r76814  
    4141
    4242    GC3Denum getType() const { return m_type; }
     43    const String& getSource() const { return m_source; }
     44
     45    void setSource(const String& source) { m_source = source; }
    4346
    4447private:
     
    5053
    5154    GC3Denum m_type;
     55    String m_source;
    5256};
    5357
Note: See TracChangeset for help on using the changeset viewer.