12015-03-15 Roger Fong <roger_fong@apple.com>
2
3 [WebGL2] Vertex Array Objects.
4 https://bugs.webkit.org/show_bug.cgi?id=126944.
5 <rdar://problem/15002455>
6
7 Reviewed by NOBODY (OOPS!).
8
9 Tested by a modified version of the 1.0.3 conformance test:
10 conformance/extensions/oes-vertex-array-object.html
11 This test will be landed along with other modified extension conformance tests
12 once approval from Khronos is received.
13
14 * html/canvas/OESVertexArrayObject.cpp: Associate extension calls only with WebGLRenderingContext.
15 (WebCore::OESVertexArrayObject::deleteVertexArrayOES):
16 (WebCore::OESVertexArrayObject::bindVertexArrayOES):
17 * html/canvas/WebGLRenderingContext.cpp:
18 (WebCore::WebGLRenderingContext::initializeVertexArrayObjects):
19 (WebCore::WebGLRenderingContext::getParameter):
20 * html/canvas/WebGL2RenderingContext.cpp: Implement vertex array object calls as part WebGL2 context.
21 (WebCore::WebGL2RenderingContext::createVertexArray):
22 (WebCore::WebGL2RenderingContext::deleteVertexArray):
23 (WebCore::WebGL2RenderingContext::isVertexArray):
24 (WebCore::WebGL2RenderingContext::bindVertexArray):
25 (WebCore::WebGL2RenderingContext::initializeVertexArrayObjects):
26 (WebCore::WebGL2RenderingContext::getParameter):
27
28 Duplicate extension object vertex array object extension methods in GraphicsContext3D.
29 Implementation may change after we upgrade to newer GL headers and profile.
30 * platform/graphics/GraphicsContext3D.h:
31 * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
32 (WebCore::GraphicsContext3D::createVertexArray):
33 (WebCore::GraphicsContext3D::deleteVertexArray):
34 (WebCore::GraphicsContext3D::isVertexArray):
35 (WebCore::GraphicsContext3D::bindVertexArray):
36
37 Have WebGLVertexArrayObjectOES and WebGLVertexArrayObject inherit from WebGLRenderingContextBase.
38 * CMakeLists.txt:
39 * WebCore.xcodeproj/project.pbxproj:
40 * html/canvas/WebGLVertexArrayObject.cpp:
41 (WebCore::WebGLVertexArrayObject::create):
42 (WebCore::WebGLVertexArrayObject::WebGLVertexArrayObject): Use GraphicsContext3D implementation of createVertexArray.
43 (WebCore::WebGLVertexArrayObject::deleteObjectImpl):
44 * html/canvas/WebGLVertexArrayObject.h:
45 * html/canvas/WebGLVertexArrayObjectBase.cpp: Added.
46 (WebCore::WebGLVertexArrayObjectBase::WebGLVertexArrayObjectBase):
47 (WebCore::WebGLVertexArrayObjectBase::setElementArrayBuffer):
48 (WebCore::WebGLVertexArrayObjectBase::setVertexAttribState):
49 (WebCore::WebGLVertexArrayObjectBase::unbindBuffer):
50 (WebCore::WebGLVertexArrayObjectBase::setVertexAttribDivisor):
51 * html/canvas/WebGLVertexArrayObjectBase.h: Added.
52 (WebCore::WebGLVertexArrayObjectBase::~WebGLVertexArrayObjectBase):
53 (WebCore::WebGLVertexArrayObjectBase::VertexAttribState::VertexAttribState):
54 (WebCore::WebGLVertexArrayObjectBase::VertexAttribState::isBound):
55 (WebCore::WebGLVertexArrayObjectBase::VertexAttribState::validateBinding):
56 (WebCore::WebGLVertexArrayObjectBase::isDefaultObject):
57 (WebCore::WebGLVertexArrayObjectBase::hasEverBeenBound):
58 (WebCore::WebGLVertexArrayObjectBase::setHasEverBeenBound):
59 (WebCore::WebGLVertexArrayObjectBase::getElementArrayBuffer):
60 (WebCore::WebGLVertexArrayObjectBase::getVertexAttribState):
61 * html/canvas/WebGLVertexArrayObjectOES.cpp:
62 (WebCore::WebGLVertexArrayObjectOES::WebGLVertexArrayObjectOES):
63 (WebCore::WebGLVertexArrayObjectOES::deleteObjectImpl):
64 (WebCore::WebGLVertexArrayObjectOES::setElementArrayBuffer): Deleted.
65 (WebCore::WebGLVertexArrayObjectOES::setVertexAttribState): Deleted.
66 (WebCore::WebGLVertexArrayObjectOES::unbindBuffer): Deleted.
67 (WebCore::WebGLVertexArrayObjectOES::setVertexAttribDivisor): Deleted.
68 * html/canvas/WebGLVertexArrayObjectOES.h:
69
70 * html/canvas/WebGLRenderingContextBase.cpp: Use WebGLVertexArrayObjectBase class.
71 (WebCore::WebGLRenderingContextBase::initializeNewContext):
72 (WebCore::WebGLRenderingContextBase::disableVertexAttribArray):
73 (WebCore::WebGLRenderingContextBase::validateVertexAttributes):
74 (WebCore::WebGLRenderingContextBase::enableVertexAttribArray):
75 (WebCore::WebGLRenderingContextBase::getVertexAttrib):
76 (WebCore::WebGLRenderingContextBase::initVertexAttrib0):
77 (WebCore::WebGLRenderingContextBase::simulateVertexAttrib0):
78 (WebCore::WebGLRenderingContextBase::restoreStatesAfterVertexAttrib0Simulation):
79 * html/canvas/WebGLRenderingContextBase.h:
80 (WebCore::WebGLRenderingContextBase::setBoundVertexArrayObject):
81
82 Handle construction of WebGLGetInfo using WebGLVertexArrayObject.
83 * bindings/js/JSWebGLRenderingContextBaseCustom.cpp:
84 (WebCore::toJS):
85 * html/canvas/WebGLGetInfo.cpp:
86 (WebCore::WebGLGetInfo::WebGLGetInfo):
87 (WebCore::WebGLGetInfo::getWebGLVertexArrayObjectOES):
88 (WebCore::WebGLGetInfo::getWebGLVertexArrayObject):
89 * html/canvas/WebGLGetInfo.h:
90