• dino@apple.com's avatar
    Source/WebCore: [WebGL] Implement ANGLE_instanced_arrays · 81d4ed94
    dino@apple.com authored
    Reviewed by Brent Fulgham.
    Implement the instanced drawing WebGL extension,
    ANGLE_instanced_arrays. This is currently Mac-only,
    but should be portable to other platforms if their
    OpenGL exposes the functions. It's also done in a way
    that will make exposing it to WebGL2 simple.
    Test: fast/canvas/webgl/angle-instanced-arrays.html
    * CMakeLists.txt:
    * DerivedSources.cpp:
    * DerivedSources.make:
    * GNUmakefile.list.am:
    * WebCore.vcxproj/WebCore.vcxproj:
    * WebCore.vcxproj/WebCore.vcxproj.filters:
    * WebCore.xcodeproj/project.pbxproj:
    Add the new files to all the build systems.
    * bindings/js/JSWebGLRenderingContextCustom.cpp:
    (WebCore::toJS): Link JS side to C++ side.
    * html/canvas/ANGLEInstancedArrays.cpp: Added.
    * html/canvas/ANGLEInstancedArrays.h: Added.
    * html/canvas/ANGLEInstancedArrays.idl: Added.
    New boilerplate files that expose the extension methods.
    * html/canvas/WebGLExtension.h: New extension enum.
    * html/canvas/WebGLRenderingContext.cpp:
    (WebCore::WebGLRenderingContext::validateVertexAttributes): Add an optional
    parameter representing the number of instance primitives we are asked
    to draw. Use that for the draw count if looking at an instanced attribute.
    Also make sure we see at least one non-instanced attribute.
    (WebCore::WebGLRenderingContext::validateDrawArrays): Update this so it could
    be used from either drawArrays or drawArraysInstanced.
    (WebCore::WebGLRenderingContext::validateDrawElements): Same here, now can be
    used by the instanced and non-instanced versions.
    (WebCore::WebGLRenderingContext::getExtension): Create and return the new extension.
    (WebCore::WebGLRenderingContext::getSupportedExtensions): Add new extension to the list.
    (WebCore::WebGLRenderingContext::getVertexAttrib): Intercept a query to the divisor
    attribute and return the value we kept in the state.
    (WebCore::WebGLRenderingContext::drawArraysInstanced): Call the GC3D method.
    (WebCore::WebGLRenderingContext::drawElementsInstanced): Ditto.
    (WebCore::WebGLRenderingContext::vertexAttribDivisor): Ditto.
    * html/canvas/WebGLRenderingContext.h: Define the new methods and parameters.
    * html/canvas/WebGLVertexArrayObjectOES.cpp:
    (WebCore::WebGLVertexArrayObjectOES::setVertexAttribDivisor): Keep a record of the
    divisor if we set it.
    * html/canvas/WebGLVertexArrayObjectOES.h:
    * platform/graphics/GraphicsContext3D.h: New enum.
    * platform/graphics/mac/GraphicsContext3DMac.mm:
    (WebCore::GraphicsContext3D::drawArraysInstanced): The actual calls into OpenGL.
    (WebCore::GraphicsContext3D::drawElementsInstanced): Ditto.
    (WebCore::GraphicsContext3D::vertexAttribDivisor): Ditto.
    * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: Empty implementations
    for non-mac platforms.
    * platform/graphics/ios/GraphicsContext3DIOS.h: Define the iOS names for the
    LayoutTests: Implement ANGLE_instanced_arrays
    Reviewed by Brent Fulgham.
    Copied a slightly modified version of the Khronos instanced
    arrays test (mostly modified due to the fact this comes from
    an in-progress update to the test suite).
    * fast/canvas/webgl/angle-instanced-arrays-expected.txt: Added.
    * fast/canvas/webgl/angle-instanced-arrays.html: Added.
    * fast/canvas/webgl/resources/webgl-test-utils.js:
    (WebGLTestUtils): Added some new functions that were missing, and
    some output to a checkColor test.
    * platform/efl/TestExpectations: Skip this for EFL.
    * platform/mac-mountainlion/fast/canvas/webgl/angle-instanced-arrays-expected.txt: Not
    supported on Mountain Lion.
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162565 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Last commit
Last update
Examples Loading commit data...
LayoutTests Loading commit data...
ManualTests Loading commit data...
PerformanceTests Loading commit data...
Source Loading commit data...
Tools Loading commit data...
WebKit.xcworkspace Loading commit data...
WebKitLibraries Loading commit data...
Websites Loading commit data...
.dir-locals.el Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
CMakeLists.txt Loading commit data...
ChangeLog Loading commit data...
ChangeLog-2012-05-22 Loading commit data...
GNUmakefile.am Loading commit data...
Makefile Loading commit data...
Makefile.shared Loading commit data...
autogen.sh Loading commit data...
configure.ac Loading commit data...