Changeset 89393 in webkit


Ignore:
Timestamp:
Jun 21, 2011, 4:46:49 PM (14 years ago)
Author:
zmo@google.com
Message:

2011-06-21 Zhenyao Mo <zmo@google.com>

Reviewed by Kenneth Russell.

Implement drawingBufferWidth/drawingBufferHeight in WebGL
https://bugs.webkit.org/show_bug.cgi?id=58497

  • fast/canvas/webgl/webgl-specific-expected.txt:
  • fast/canvas/webgl/webgl-specific.html: Test drawingBufferWidth/Height attributes.
  • fast/canvas/webgl/canvas-zero-size-expected.txt:
  • fast/canvas/webgl/canvas-zero-size.html: Added.
  • fast/canvas/webgl/drawingbuffer-test-expected.txt:
  • fast/canvas/webgl/drawingbuffer-test.html: Added.

2011-06-21 Zhenyao Mo <zmo@google.com>

Reviewed by Kenneth Russell.

Implement drawingBufferWidth/drawingBufferHeight in WebGL
https://bugs.webkit.org/show_bug.cgi?id=58497

  • src/GraphicsContext3DChromium.cpp: Make getInternalFramebufferSize method const. (WebCore::GraphicsContext3DInternal::getInternalFramebufferSize): (WebCore::GraphicsContext3D::getInternalFramebufferSize):
  • src/GraphicsContext3DInternal.h:

2011-06-21 Zhenyao Mo <zmo@google.com>

Reviewed by Kenneth Russell.

Implement drawingBufferWidth/drawingBufferHeight in WebGL
https://bugs.webkit.org/show_bug.cgi?id=58497

  • html/canvas/WebGLRenderingContext.cpp: Add drawingBufferWidth/Height method and call getInternalFramebufferSize(). (WebCore::WebGLRenderingContext::drawingBufferWidth): (WebCore::WebGLRenderingContext::drawingBufferHeight):
  • html/canvas/WebGLRenderingContext.h:
  • html/canvas/WebGLRenderingContext.idl: Add readonly attributes drawingBufferWidth/Height.
  • platform/graphics/GraphicsContext3D.h:
  • platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: Make getInternalFramebufferSize const. (WebCore::GraphicsContext3D::getInternalFramebufferSize):
  • platform/graphics/qt/GraphicsContext3DQt.cpp: Ditto. (WebCore::GraphicsContext3D::getInternalFramebufferSize):
Location:
trunk
Files:
4 added
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r89391 r89393  
     12011-06-21  Zhenyao Mo  <zmo@google.com>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        Implement drawingBufferWidth/drawingBufferHeight in WebGL
     6        https://bugs.webkit.org/show_bug.cgi?id=58497
     7
     8        * fast/canvas/webgl/webgl-specific-expected.txt:
     9        * fast/canvas/webgl/webgl-specific.html: Test drawingBufferWidth/Height attributes.
     10        * fast/canvas/webgl/canvas-zero-size-expected.txt:
     11        * fast/canvas/webgl/canvas-zero-size.html: Added.
     12        * fast/canvas/webgl/drawingbuffer-test-expected.txt:
     13        * fast/canvas/webgl/drawingbuffer-test.html: Added.
     14
    1152011-06-21  Dmitry Titov  <dimich@chromium.org>
    216
  • trunk/LayoutTests/fast/canvas/webgl/webgl-specific-expected.txt

    r74820 r89393  
    4848PASS undefined is undefined.
    4949
     50Verify that *LENGTH are undefined
     51PASS undefined is undefined.
     52PASS undefined is undefined.
     53PASS undefined is undefined.
     54PASS undefined is undefined.
     55
    5056Verify that UNPACK_COLORSPACE_CONVERSION_WEBGL is supported
    5157PASS gl.getParameter(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL) is gl.BROWSER_DEFAULT_WEBGL
    5258PASS gl.getParameter(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL) is gl.NONE
    5359PASS getError was expected value: NO_ERROR : set/get UNPACK_COLORSPACE_CONVERSION_WEBGL should generate no error
     60
     61Verify that drawingBufferWidth and drawingBufferHeights are implemented
     62PASS gl.drawingBufferWidth >= 0 && gl.drawingBufferHeight >= 0 is true
    5463PASS successfullyParsed is true
    5564
  • trunk/LayoutTests/fast/canvas/webgl/webgl-specific.html

    r74820 r89393  
    1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    2   "http://www.w3.org/TR/html4/loose.dtd">
     1<!DOCTYPE html>
    32<html>
    43<head>
     4<meta charset="utf-8">
    55<title>WebGL GLES2 difference test.</title>
    66<link rel="stylesheet" href="../../js/resources/js-test-style.css"/>
     
    7575
    7676debug("");
     77debug("Verify that *LENGTH are undefined");
     78shouldBeUndefined(gl.INFO_LOG_LENGTH);
     79shouldBeUndefined(gl.SHADER_SOURCE_LENGTH);
     80shouldBeUndefined(gl.ACTIVE_UNIFORM_MAX_LENGTH);
     81shouldBeUndefined(gl.ACTIVE_ATTRIB_MAX_LENGTH);
     82
     83debug("");
    7784debug("Verify that UNPACK_COLORSPACE_CONVERSION_WEBGL is supported");
    7885shouldBe("gl.getParameter(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL)", "gl.BROWSER_DEFAULT_WEBGL");
     
    8087shouldBe("gl.getParameter(gl.UNPACK_COLORSPACE_CONVERSION_WEBGL)", "gl.NONE");
    8188glErrorShouldBe(gl, gl.NO_ERROR, "set/get UNPACK_COLORSPACE_CONVERSION_WEBGL should generate no error");
     89
     90debug("");
     91debug("Verify that drawingBufferWidth and drawingBufferHeights are implemented");
     92shouldBeTrue("gl.drawingBufferWidth >= 0 && gl.drawingBufferHeight >= 0");
    8293
    8394successfullyParsed = true;
  • trunk/Source/WebCore/ChangeLog

    r89390 r89393  
     12011-06-21  Zhenyao Mo  <zmo@google.com>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        Implement drawingBufferWidth/drawingBufferHeight in WebGL
     6        https://bugs.webkit.org/show_bug.cgi?id=58497
     7
     8        * html/canvas/WebGLRenderingContext.cpp: Add drawingBufferWidth/Height method and call getInternalFramebufferSize().
     9        (WebCore::WebGLRenderingContext::drawingBufferWidth):
     10        (WebCore::WebGLRenderingContext::drawingBufferHeight):
     11        * html/canvas/WebGLRenderingContext.h:
     12        * html/canvas/WebGLRenderingContext.idl: Add readonly attributes drawingBufferWidth/Height.
     13        * platform/graphics/GraphicsContext3D.h:
     14        * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: Make getInternalFramebufferSize const.
     15        (WebCore::GraphicsContext3D::getInternalFramebufferSize):
     16        * platform/graphics/qt/GraphicsContext3DQt.cpp: Ditto.
     17        (WebCore::GraphicsContext3D::getInternalFramebufferSize):
     18
    1192011-06-21  Dmitry Lomov  <dslomov@google.com>
    220
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp

    r88489 r89393  
    110110    }
    111111
     112    GC3Dint clamp(GC3Dint value, GC3Dint min, GC3Dint max)
     113    {
     114        if (value < min)
     115            value = min;
     116        if (value > max)
     117            value = max;
     118        return value;
     119    }
     120
    112121    // Return true if a character belongs to the ASCII subset as defined in
    113122    // GLSL ES 1.0 spec section 3.1.
     
    440449    m_context->getIntegerv(GraphicsContext3D::MAX_CUBE_MAP_TEXTURE_SIZE, &m_maxCubeMapTextureSize);
    441450    m_maxCubeMapTextureLevel = WebGLTexture::computeLevelCount(m_maxCubeMapTextureSize, m_maxCubeMapTextureSize);
    442    
     451    m_maxRenderbufferSize = 0;
     452    m_context->getIntegerv(GraphicsContext3D::MAX_RENDERBUFFER_SIZE, &m_maxRenderbufferSize);
     453    m_maxViewportDims[0] = m_maxViewportDims[1] = 0;
     454    m_context->getIntegerv(GraphicsContext3D::MAX_VIEWPORT_DIMS, m_maxViewportDims);
     455
    443456    m_defaultVertexArrayObject = WebGLVertexArrayObjectOES::create(this, WebGLVertexArrayObjectOES::VaoTypeDefault);
    444457    addObject(m_defaultVertexArrayObject.get());
     
    594607void WebGLRenderingContext::reshape(int width, int height)
    595608{
     609    // This is an approximation because at WebGLRenderingContext level we don't
     610    // know if the underlying FBO uses textures or renderbuffers.
     611    GC3Dint maxSize = std::min(m_maxTextureSize, m_maxRenderbufferSize);
     612    GC3Dint maxWidth = std::min(maxSize, m_maxViewportDims[0]);
     613    GC3Dint maxHeight = std::min(maxSize, m_maxViewportDims[1]);
     614    width = clamp(width, 1, maxWidth);
     615    height = clamp(height, 1, maxHeight);
     616
    596617    if (m_needsUpdate) {
    597618#if USE(ACCELERATED_COMPOSITING)
     
    606627    // clear (and this matches what reshape will do).
    607628    m_context->reshape(width, height);
     629}
     630
     631int WebGLRenderingContext::drawingBufferWidth() const
     632{
     633    return m_context->getInternalFramebufferSize().width();
     634}
     635
     636int WebGLRenderingContext::drawingBufferHeight() const
     637{
     638    return m_context->getInternalFramebufferSize().height();
    608639}
    609640
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h

    r88489 r89393  
    7171    virtual bool isAccelerated() const { return true; }
    7272    virtual bool paintsIntoCanvasBuffer() const;
     73
     74    int drawingBufferWidth() const;
     75    int drawingBufferHeight() const;
    7376
    7477    void activeTexture(GC3Denum texture, ExceptionCode&);
     
    431434    GC3Dint m_maxTextureSize;
    432435    GC3Dint m_maxCubeMapTextureSize;
     436    GC3Dint m_maxRenderbufferSize;
     437    GC3Dint m_maxViewportDims[2];
    433438    GC3Dint m_maxTextureLevel;
    434439    GC3Dint m_maxCubeMapTextureLevel;
  • trunk/Source/WebCore/html/canvas/WebGLRenderingContext.idl

    r89148 r89393  
    452452        const unsigned int BROWSER_DEFAULT_WEBGL              = 0x9244;
    453453
     454        readonly attribute long drawingBufferWidth;
     455        readonly attribute long drawingBufferHeight;
     456
    454457        [StrictTypeChecking] void         activeTexture(in unsigned long texture) raises(DOMException);
    455458        [StrictTypeChecking] void         attachShader(in WebGLProgram program, in WebGLShader shader) raises(DOMException);
  • trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h

    r87353 r89393  
    821821    Extensions3D* getExtensions();
    822822
    823     IntSize getInternalFramebufferSize();
     823    IntSize getInternalFramebufferSize() const;
    824824
    825825  private:
  • trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp

    r82878 r89393  
    318318}
    319319
    320 IntSize GraphicsContext3D::getInternalFramebufferSize()
     320IntSize GraphicsContext3D::getInternalFramebufferSize() const
    321321{
    322322    return IntSize(m_currentWidth, m_currentHeight);
  • trunk/Source/WebCore/platform/graphics/qt/GraphicsContext3DQt.cpp

    r88335 r89393  
    751751}
    752752
    753 IntSize GraphicsContext3D::getInternalFramebufferSize()
     753IntSize GraphicsContext3D::getInternalFramebufferSize() const
    754754{
    755755    return IntSize(m_currentWidth, m_currentHeight);
  • trunk/Source/WebKit/chromium/ChangeLog

    r89390 r89393  
     12011-06-21  Zhenyao Mo  <zmo@google.com>
     2
     3        Reviewed by Kenneth Russell.
     4
     5        Implement drawingBufferWidth/drawingBufferHeight in WebGL
     6        https://bugs.webkit.org/show_bug.cgi?id=58497
     7
     8        * src/GraphicsContext3DChromium.cpp: Make getInternalFramebufferSize method const.
     9        (WebCore::GraphicsContext3DInternal::getInternalFramebufferSize):
     10        (WebCore::GraphicsContext3D::getInternalFramebufferSize):
     11        * src/GraphicsContext3DInternal.h:
     12
    1132011-06-21  Dmitry Lomov  <dslomov@google.com>
    214
  • trunk/Source/WebKit/chromium/src/GraphicsContext3DChromium.cpp

    r88429 r89393  
    288288}
    289289
    290 IntSize GraphicsContext3DInternal::getInternalFramebufferSize()
     290IntSize GraphicsContext3DInternal::getInternalFramebufferSize() const
    291291{
    292292    return IntSize(m_impl->width(), m_impl->height());
     
    968968}
    969969
     970IntSize GraphicsContext3D::getInternalFramebufferSize() const
     971{
     972    return m_internal->getInternalFramebufferSize();
     973}
     974
    970975#if USE(ACCELERATED_COMPOSITING)
    971976PlatformLayer* GraphicsContext3D::platformLayer() const
     
    979984DELEGATE_TO_INTERNAL(makeContextCurrent)
    980985DELEGATE_TO_INTERNAL_2(reshape, int, int)
    981 DELEGATE_TO_INTERNAL_R(getInternalFramebufferSize, IntSize)
    982986
    983987DELEGATE_TO_INTERNAL_1(activeTexture, GC3Denum)
  • trunk/Source/WebKit/chromium/src/GraphicsContext3DInternal.h

    r86278 r89393  
    6767
    6868    void reshape(int width, int height);
    69     IntSize getInternalFramebufferSize();
     69    IntSize getInternalFramebufferSize() const;
    7070
    7171    void markContextChanged();
Note: See TracChangeset for help on using the changeset viewer.