Changeset 79011 in webkit
- Timestamp:
- Feb 18, 2011 10:42:59 AM (13 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 added
- 24 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r78914 r79011 295 295 html/canvas/OESStandardDerivatives.idl 296 296 html/canvas/OESTextureFloat.idl 297 html/canvas/OESVertexArrayObject.idl 297 298 html/canvas/Uint16Array.idl 298 299 html/canvas/Uint32Array.idl … … 308 309 html/canvas/WebGLTexture.idl 309 310 html/canvas/WebGLUniformLocation.idl 311 html/canvas/WebGLVertexArrayObjectOES.idl 310 312 html/canvas/WebKitLoseContext.idl 311 313 -
trunk/Source/WebCore/ChangeLog
r79009 r79011 1 2011-02-18 Ben Vanik <benvanik@google.com> 2 3 Reviewed by Kenneth Russell. 4 5 Bug 53940: Implement the OES_vertex_array_object WebGL extension 6 https://bugs.webkit.org/show_bug.cgi?id=53940 7 8 Initial implementation of the OES_vertex_array_object extension adding the OESVertexArrayObject 9 extension container and WebGLVertexArrayObjectOES VAO object. The extension is plumbed through 10 the Extensions3D interface and implemented in the Extensions3DOpenGL (WebKit/OSX) version when 11 it is available. 12 Two big changes touching code outside of the extension files: 13 * Moved the typedefs at the top of GraphicsContext3D.h to GraphicsTypes3D.h (modeled after 14 GraphicsTypes.h). They are not namespaced as they weren't before. 15 * To make the code cleaner/clearer all vertex attribute state has been moved to the 16 WebGLVertexArrayObjectOES type (struct VertexAttribState) except for values which are still 17 on the WebGLRenderingContext. A default VAO is now used to store the existing attribute 18 states for when no other VAO is used. Code in WebGLRenderingContext dealing with buffers and 19 vertex attributes now defers to or stores values in the bound array object. 20 21 Tested against the WebGL conformance suite and the new 22 oes-vertex-array-object test: 23 https://cvs.khronos.org/svn/repos/registry/trunk/public/webgl/sdk/tests/conformance/oes-vertex-array-object.html 24 25 * CMakeLists.txt: 26 * CodeGenerators.pri: 27 * DerivedSources.make: 28 * GNUmakefile.am: 29 * WebCore.gyp: Modified property svn:ignore. 30 * WebCore.gypi: 31 * WebCore.pro: 32 * WebCore.xcodeproj/project.pbxproj: 33 * bindings/js/JSWebGLRenderingContextCustom.cpp: 34 (WebCore::toJS): 35 * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp: 36 (WebCore::toV8Object): 37 * html/canvas/OESVertexArrayObject.cpp: Added. 38 (WebCore::OESVertexArrayObject::OESVertexArrayObject): 39 (WebCore::OESVertexArrayObject::~OESVertexArrayObject): 40 (WebCore::OESVertexArrayObject::getName): 41 (WebCore::OESVertexArrayObject::create): 42 (WebCore::OESVertexArrayObject::createVertexArrayOES): 43 (WebCore::OESVertexArrayObject::deleteVertexArrayOES): 44 (WebCore::OESVertexArrayObject::isVertexArrayOES): 45 (WebCore::OESVertexArrayObject::bindVertexArrayOES): 46 * html/canvas/OESVertexArrayObject.h: Added. 47 * html/canvas/OESVertexArrayObject.idl: Added. 48 * html/canvas/WebGLExtension.h: 49 * html/canvas/WebGLGetInfo.cpp: 50 (WebCore::WebGLGetInfo::WebGLGetInfo): 51 (WebCore::WebGLGetInfo::getWebGLVertexArrayObjectOES): 52 * html/canvas/WebGLGetInfo.h: 53 * html/canvas/WebGLRenderingContext.cpp: 54 (WebCore::WebGLRenderingContext::initializeNewContext): 55 (WebCore::WebGLRenderingContext::bindBuffer): 56 (WebCore::WebGLRenderingContext::deleteBuffer): 57 (WebCore::WebGLRenderingContext::disableVertexAttribArray): 58 (WebCore::WebGLRenderingContext::validateElementArraySize): 59 (WebCore::WebGLRenderingContext::validateIndexArrayConservative): 60 (WebCore::WebGLRenderingContext::validateIndexArrayPrecise): 61 (WebCore::WebGLRenderingContext::validateRenderingState): 62 (WebCore::WebGLRenderingContext::drawElements): 63 (WebCore::WebGLRenderingContext::enableVertexAttribArray): 64 (WebCore::WebGLRenderingContext::getExtension): 65 (WebCore::WebGLRenderingContext::getParameter): 66 (WebCore::WebGLRenderingContext::getSupportedExtensions): 67 (WebCore::WebGLRenderingContext::getVertexAttrib): 68 (WebCore::WebGLRenderingContext::vertexAttribPointer): 69 (WebCore::WebGLRenderingContext::validateBufferDataParameters): 70 (WebCore::WebGLRenderingContext::vertexAttribfImpl): 71 (WebCore::WebGLRenderingContext::vertexAttribfvImpl): 72 (WebCore::WebGLRenderingContext::initVertexAttrib0): 73 (WebCore::WebGLRenderingContext::simulateVertexAttrib0): 74 (WebCore::WebGLRenderingContext::restoreStatesAfterVertexAttrib0Simulation): 75 (WebCore::WebGLRenderingContext::getNumberOfExtensions): 76 (WebCore::WebGLRenderingContext::getExtensionNumber): 77 * html/canvas/WebGLRenderingContext.h: 78 (WebCore::WebGLRenderingContext::getMaxVertexAttribs): 79 (WebCore::WebGLRenderingContext::setBoundVertexArrayObject): 80 (WebCore::WebGLRenderingContext::VertexAttribValue::VertexAttribValue): 81 * html/canvas/WebGLVertexArrayObjectOES.cpp: Added. 82 (WebCore::WebGLVertexArrayObjectOES::create): 83 (WebCore::WebGLVertexArrayObjectOES::WebGLVertexArrayObjectOES): 84 (WebCore::WebGLVertexArrayObjectOES::deleteObjectImpl): 85 * html/canvas/WebGLVertexArrayObjectOES.h: Added. 86 (WebCore::WebGLVertexArrayObjectOES::~WebGLVertexArrayObjectOES): 87 (WebCore::WebGLVertexArrayObjectOES::VertexAttribState::VertexAttribState): 88 (WebCore::WebGLVertexArrayObjectOES::isDefaultObject): 89 (WebCore::WebGLVertexArrayObjectOES::hasEverBeenBound): 90 (WebCore::WebGLVertexArrayObjectOES::setHasEverBeenBound): 91 (WebCore::WebGLVertexArrayObjectOES::getElementArrayBuffer): 92 (WebCore::WebGLVertexArrayObjectOES::setElementArrayBuffer): 93 (WebCore::WebGLVertexArrayObjectOES::getVertexAttribState): 94 (WebCore::WebGLVertexArrayObjectOES::isVertexArray): 95 * html/canvas/WebGLVertexArrayObjectOES.idl: Added. 96 * platform/graphics/Extensions3D.h: 97 * platform/graphics/GraphicsContext3D.h: 98 * platform/graphics/GraphicsTypes3D.h: Added. 99 * platform/graphics/chromium/Extensions3DChromium.h: 100 * platform/graphics/opengl/Extensions3DOpenGL.cpp: 101 (WebCore::Extensions3DOpenGL::supports): 102 (WebCore::Extensions3DOpenGL::createVertexArrayOES): 103 (WebCore::Extensions3DOpenGL::deleteVertexArrayOES): 104 (WebCore::Extensions3DOpenGL::isVertexArrayOES): 105 (WebCore::Extensions3DOpenGL::bindVertexArrayOES): 106 * platform/graphics/opengl/Extensions3DOpenGL.h: 107 * platform/graphics/qt/Extensions3DQt.cpp: 108 (WebCore::Extensions3DQt::createVertexArrayOES): 109 (WebCore::Extensions3DQt::deleteVertexArrayOES): 110 (WebCore::Extensions3DQt::isVertexArrayOES): 111 (WebCore::Extensions3DQt::bindVertexArrayOES): 112 * platform/graphics/qt/Extensions3DQt.h: 113 1 114 2011-02-17 Alexander Pavlov <apavlov@chromium.org> 2 115 -
trunk/Source/WebCore/CodeGenerators.pri
r78803 r79011 199 199 html/canvas/OESStandardDerivatives.idl \ 200 200 html/canvas/OESTextureFloat.idl \ 201 html/canvas/OESVertexArrayObject.idl \ 201 202 html/canvas/WebGLActiveInfo.idl \ 202 203 html/canvas/WebGLBuffer.idl \ … … 210 211 html/canvas/WebGLTexture.idl \ 211 212 html/canvas/WebGLUniformLocation.idl \ 213 html/canvas/WebGLVertexArrayObjectOES.idl \ 212 214 html/canvas/WebKitLoseContext.idl \ 213 215 html/canvas/Uint8Array.idl \ -
trunk/Source/WebCore/DerivedSources.make
r78525 r79011 313 313 OESStandardDerivatives \ 314 314 OESTextureFloat \ 315 OESVertexArrayObject \ 316 WebGLVertexArrayObjectOES \ 315 317 OverflowEvent \ 316 318 PageTransitionEvent \ -
trunk/Source/WebCore/GNUmakefile.am
r78981 r79011 487 487 DerivedSources/WebCore/JSOESTextureFloat.cpp \ 488 488 DerivedSources/WebCore/JSOESTextureFloat.h \ 489 DerivedSources/WebCore/JSOESVertexArrayObject.cpp \ 490 DerivedSources/WebCore/JSOESVertexArrayObject.h \ 489 491 DerivedSources/WebCore/JSOverflowEvent.cpp \ 490 492 DerivedSources/WebCore/JSOverflowEvent.h \ … … 593 595 DerivedSources/WebCore/JSWebGLUniformLocation.cpp \ 594 596 DerivedSources/WebCore/JSWebGLUniformLocation.h \ 597 DerivedSources/WebCore/JSWebGLVertexArrayObjectOES.cpp \ 598 DerivedSources/WebCore/JSWebGLVertexArrayObjectOES.h \ 595 599 DerivedSources/WebCore/JSWebKitAnimationEvent.cpp \ 596 600 DerivedSources/WebCore/JSWebKitAnimationEvent.h \ … … 1588 1592 Source/WebCore/html/canvas/Int8Array.h \ 1589 1593 Source/WebCore/html/canvas/IntegralTypedArrayBase.h \ 1590 Source/WebCore/html/canvas/OESStandardDerivatives.cpp \1591 Source/WebCore/html/canvas/OESStandardDerivatives.h \1592 Source/WebCore/html/canvas/OESTextureFloat.cpp \1593 Source/WebCore/html/canvas/OESTextureFloat.h \1594 1594 Source/WebCore/html/canvas/TypedArrayBase.h \ 1595 Source/WebCore/html/canvas/WebKitLoseContext.cpp \1596 Source/WebCore/html/canvas/WebKitLoseContext.h \1597 1595 Source/WebCore/html/canvas/Uint16Array.cpp \ 1598 1596 Source/WebCore/html/canvas/Uint16Array.h \ … … 2440 2438 Source/WebCore/platform/graphics/GraphicsTypes.cpp \ 2441 2439 Source/WebCore/platform/graphics/GraphicsTypes.h \ 2440 Source/WebCore/platform/graphics/GraphicsTypes3D.h \ 2442 2441 Source/WebCore/platform/graphics/Icon.h \ 2443 2442 Source/WebCore/platform/graphics/ImageBuffer.cpp \ … … 4824 4823 Source/WebCore/html/canvas/WebGLTexture.h \ 4825 4824 Source/WebCore/html/canvas/WebGLUniformLocation.cpp \ 4826 Source/WebCore/html/canvas/WebGLUniformLocation.h 4825 Source/WebCore/html/canvas/WebGLUniformLocation.h \ 4826 Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.cpp \ 4827 Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.h \ 4828 Source/WebCore/html/canvas/OESStandardDerivatives.cpp \ 4829 Source/WebCore/html/canvas/OESStandardDerivatives.h \ 4830 Source/WebCore/html/canvas/OESTextureFloat.cpp \ 4831 Source/WebCore/html/canvas/OESTextureFloat.h \ 4832 Source/WebCore/html/canvas/OESVertexArrayObject.cpp \ 4833 Source/WebCore/html/canvas/OESVertexArrayObject.h \ 4834 Source/WebCore/html/canvas/OESVertexArray.cpp \ 4835 Source/WebCore/html/canvas/OESVertexArray.h \ 4836 Source/WebCore/html/canvas/WebKitLoseContext.cpp \ 4837 Source/WebCore/html/canvas/WebKitLoseContext.h 4827 4838 endif # END ENABLE_WEBGL 4828 4839 -
trunk/Source/WebCore/WebCore.gypi
r78923 r79011 219 219 'html/canvas/OESStandardDerivatives.idl', 220 220 'html/canvas/OESTextureFloat.idl', 221 'html/canvas/OESVertexArrayObject.idl', 221 222 'html/canvas/Uint16Array.idl', 222 223 'html/canvas/Uint32Array.idl', … … 233 234 'html/canvas/WebGLTexture.idl', 234 235 'html/canvas/WebGLUniformLocation.idl', 236 'html/canvas/WebGLVertexArrayObjectOES.idl', 235 237 'html/canvas/WebKitLoseContext.idl', 236 238 'inspector/InjectedScriptHost.idl', … … 1934 1936 'html/canvas/OESTextureFloat.cpp', 1935 1937 'html/canvas/OESTextureFloat.h', 1938 'html/canvas/OESVertexArrayObject.cpp', 1939 'html/canvas/OESVertexArrayObject.h', 1936 1940 'html/canvas/TypedArrayBase.h', 1937 1941 'html/canvas/Uint16Array.cpp', … … 1967 1971 'html/canvas/WebGLUniformLocation.cpp', 1968 1972 'html/canvas/WebGLUniformLocation.h', 1973 'html/canvas/WebGLVertexArrayObjectOES.cpp', 1974 'html/canvas/WebGLVertexArrayObjectOES.h', 1969 1975 'html/canvas/WebKitLoseContext.cpp', 1970 1976 'html/canvas/WebKitLoseContext.h', … … 2967 2973 'platform/graphics/GraphicsTypes.cpp', 2968 2974 'platform/graphics/GraphicsTypes.h', 2975 'platform/graphics/GraphicsTypes3D.h', 2969 2976 'platform/graphics/Icon.h', 2970 2977 'platform/graphics/Image.cpp', -
trunk/Source/WebCore/WebCore.pro
r78914 r79011 2034 2034 platform/graphics/GraphicsLayerClient.h \ 2035 2035 platform/graphics/GraphicsTypes.h \ 2036 platform/graphics/GraphicsTypes3D.h \ 2036 2037 platform/graphics/Image.h \ 2037 2038 platform/graphics/ImageSource.h \ … … 3691 3692 html/canvas/OESStandardDerivatives.h \ 3692 3693 html/canvas/OESTextureFloat.h \ 3694 html/canvas/OESVertexArrayObject.h \ 3695 html/canvas/OESVertexArray.h \ 3693 3696 html/canvas/WebGLTexture.h \ 3694 3697 html/canvas/WebGLUniformLocation.h \ … … 3718 3721 html/canvas/OESStandardDerivatives.cpp \ 3719 3722 html/canvas/OESTextureFloat.cpp \ 3723 html/canvas/OESVertexArrayObject.cpp \ 3724 html/canvas/OESVertexArray.cpp \ 3720 3725 html/canvas/WebGLTexture.cpp \ 3721 3726 html/canvas/WebGLUniformLocation.cpp \ -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r78914 r79011 1632 1632 76FC2B0C12370DA0006A991A /* DOMTokenList.h in Headers */ = {isa = PBXBuildFile; fileRef = 76FC2B0912370DA0006A991A /* DOMTokenList.h */; }; 1633 1633 76FF17E311235673001D61B5 /* PluginViewNone.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 76FF17E211235673001D61B5 /* PluginViewNone.cpp */; }; 1634 77A17A7112F28182004E02F6 /* OESVertexArrayObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 77A17A6E12F28182004E02F6 /* OESVertexArrayObject.cpp */; }; 1635 77A17A7212F28182004E02F6 /* OESVertexArrayObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 77A17A6F12F28182004E02F6 /* OESVertexArrayObject.h */; }; 1636 77A17A7712F28642004E02F6 /* WebGLVertexArrayObjectOES.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 77A17A7412F28642004E02F6 /* WebGLVertexArrayObjectOES.cpp */; }; 1637 77A17A7812F28642004E02F6 /* WebGLVertexArrayObjectOES.h in Headers */ = {isa = PBXBuildFile; fileRef = 77A17A7512F28642004E02F6 /* WebGLVertexArrayObjectOES.h */; }; 1638 77A17A7B12F2890B004E02F6 /* GraphicsTypes3D.h in Headers */ = {isa = PBXBuildFile; fileRef = 77A17A7A12F2890B004E02F6 /* GraphicsTypes3D.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1639 77A17AA612F28B2A004E02F6 /* JSOESVertexArrayObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 77A17AA212F28B2A004E02F6 /* JSOESVertexArrayObject.cpp */; }; 1640 77A17AA712F28B2A004E02F6 /* JSOESVertexArrayObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 77A17AA312F28B2A004E02F6 /* JSOESVertexArrayObject.h */; }; 1641 77EF62F312F9DB7400C77BD2 /* JSWebGLVertexArrayObjectOES.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 77EF62F112F9DB7400C77BD2 /* JSWebGLVertexArrayObjectOES.cpp */; }; 1642 77EF62F412F9DB7400C77BD2 /* JSWebGLVertexArrayObjectOES.h in Headers */ = {isa = PBXBuildFile; fileRef = 77EF62F212F9DB7400C77BD2 /* JSWebGLVertexArrayObjectOES.h */; }; 1634 1643 79AC9218109945C80021266E /* JSCompositionEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 79AC9216109945C80021266E /* JSCompositionEvent.cpp */; }; 1635 1644 79AC9219109945C80021266E /* JSCompositionEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 79AC9217109945C80021266E /* JSCompositionEvent.h */; }; … … 8069 8078 76FC2B0A12370DA0006A991A /* DOMTokenList.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMTokenList.idl; sourceTree = "<group>"; }; 8070 8079 76FF17E211235673001D61B5 /* PluginViewNone.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PluginViewNone.cpp; sourceTree = "<group>"; }; 8080 77A17A6E12F28182004E02F6 /* OESVertexArrayObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OESVertexArrayObject.cpp; path = canvas/OESVertexArrayObject.cpp; sourceTree = "<group>"; }; 8081 77A17A6F12F28182004E02F6 /* OESVertexArrayObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OESVertexArrayObject.h; path = canvas/OESVertexArrayObject.h; sourceTree = "<group>"; }; 8082 77A17A7012F28182004E02F6 /* OESVertexArrayObject.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = OESVertexArrayObject.idl; path = canvas/OESVertexArrayObject.idl; sourceTree = "<group>"; }; 8083 77A17A7412F28642004E02F6 /* WebGLVertexArrayObjectOES.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLVertexArrayObjectOES.cpp; path = canvas/WebGLVertexArrayObjectOES.cpp; sourceTree = "<group>"; }; 8084 77A17A7512F28642004E02F6 /* WebGLVertexArrayObjectOES.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLVertexArrayObjectOES.h; path = canvas/WebGLVertexArrayObjectOES.h; sourceTree = "<group>"; }; 8085 77A17A7612F28642004E02F6 /* WebGLVertexArrayObjectOES.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = WebGLVertexArrayObjectOES.idl; path = canvas/WebGLVertexArrayObjectOES.idl; sourceTree = "<group>"; }; 8086 77A17A7A12F2890B004E02F6 /* GraphicsTypes3D.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GraphicsTypes3D.h; sourceTree = "<group>"; }; 8087 77A17AA212F28B2A004E02F6 /* JSOESVertexArrayObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSOESVertexArrayObject.cpp; sourceTree = "<group>"; }; 8088 77A17AA312F28B2A004E02F6 /* JSOESVertexArrayObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSOESVertexArrayObject.h; sourceTree = "<group>"; }; 8089 77EF62F112F9DB7400C77BD2 /* JSWebGLVertexArrayObjectOES.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLVertexArrayObjectOES.cpp; sourceTree = "<group>"; }; 8090 77EF62F212F9DB7400C77BD2 /* JSWebGLVertexArrayObjectOES.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLVertexArrayObjectOES.h; sourceTree = "<group>"; }; 8071 8091 79AC9216109945C80021266E /* JSCompositionEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCompositionEvent.cpp; sourceTree = "<group>"; }; 8072 8092 79AC9217109945C80021266E /* JSCompositionEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCompositionEvent.h; sourceTree = "<group>"; }; … … 13292 13312 6EBF0E4612A8926100DB1709 /* OESTextureFloat.h */, 13293 13313 6EBF0E4712A8926100DB1709 /* OESTextureFloat.idl */, 13314 77A17A6E12F28182004E02F6 /* OESVertexArrayObject.cpp */, 13315 77A17A6F12F28182004E02F6 /* OESVertexArrayObject.h */, 13316 77A17A7012F28182004E02F6 /* OESVertexArrayObject.idl */, 13294 13317 6E96BB1B11986EE1007D94CD /* TypedArrayBase.h */, 13295 13318 49EECDDC10503C2300099FAB /* Uint16Array.cpp */, … … 13340 13363 0C3F1F5810C8871200D72CE1 /* WebGLUniformLocation.h */, 13341 13364 0C3F1F5910C8871200D72CE1 /* WebGLUniformLocation.idl */, 13365 77A17A7412F28642004E02F6 /* WebGLVertexArrayObjectOES.cpp */, 13366 77A17A7512F28642004E02F6 /* WebGLVertexArrayObjectOES.h */, 13367 77A17A7612F28642004E02F6 /* WebGLVertexArrayObjectOES.idl */, 13342 13368 93F1D5B712D532C400832BEC /* WebKitLoseContext.cpp */, 13343 13369 93F1D5B812D532C400832BEC /* WebKitLoseContext.h */, … … 16212 16238 6EBF0E7412A9868800DB1709 /* JSOESTextureFloat.cpp */, 16213 16239 6EBF0E7512A9868800DB1709 /* JSOESTextureFloat.h */, 16240 77A17AA212F28B2A004E02F6 /* JSOESVertexArrayObject.cpp */, 16241 77A17AA312F28B2A004E02F6 /* JSOESVertexArrayObject.h */, 16214 16242 BCEF45F30E687B5C001C1287 /* JSTextMetrics.cpp */, 16215 16243 BCEF45F40E687B5C001C1287 /* JSTextMetrics.h */, … … 16244 16272 0C45342510CDBBFA00869157 /* JSWebGLUniformLocation.cpp */, 16245 16273 0C45342610CDBBFA00869157 /* JSWebGLUniformLocation.h */, 16274 77EF62F112F9DB7400C77BD2 /* JSWebGLVertexArrayObjectOES.cpp */, 16275 77EF62F212F9DB7400C77BD2 /* JSWebGLVertexArrayObjectOES.h */, 16246 16276 93F1D5BE12D5335600832BEC /* JSWebKitLoseContext.cpp */, 16247 16277 93F1D5BF12D5335600832BEC /* JSWebKitLoseContext.h */, … … 17481 17511 B2A015940AF6CD53006BCE0E /* GraphicsTypes.cpp */, 17482 17512 B2A015950AF6CD53006BCE0E /* GraphicsTypes.h */, 17513 77A17A7A12F2890B004E02F6 /* GraphicsTypes3D.h */, 17483 17514 B27535400B053814002CE64F /* Icon.h */, 17484 17515 B27535410B053814002CE64F /* Image.cpp */, … … 22436 22467 9343CB8212F25E510033C5EE /* TextCodecUTF8.h in Headers */, 22437 22468 977E2E0F12F0FC9C00C13379 /* XSSFilter.h in Headers */, 22469 77A17A7212F28182004E02F6 /* OESVertexArrayObject.h in Headers */, 22470 77A17A7812F28642004E02F6 /* WebGLVertexArrayObjectOES.h in Headers */, 22471 77A17A7B12F2890B004E02F6 /* GraphicsTypes3D.h in Headers */, 22472 77A17AA712F28B2A004E02F6 /* JSOESVertexArrayObject.h in Headers */, 22473 77EF62F412F9DB7400C77BD2 /* JSWebGLVertexArrayObjectOES.h in Headers */, 22438 22474 975CA28B130365F800E99AD9 /* Crypto.h in Headers */, 22439 22475 975CA2A21303679D00E99AD9 /* JSCrypto.h in Headers */, … … 25118 25154 9343CB8112F25E510033C5EE /* TextCodecUTF8.cpp in Sources */, 25119 25155 977E2E0E12F0FC9C00C13379 /* XSSFilter.cpp in Sources */, 25156 77A17A7112F28182004E02F6 /* OESVertexArrayObject.cpp in Sources */, 25157 77A17A7712F28642004E02F6 /* WebGLVertexArrayObjectOES.cpp in Sources */, 25158 77A17AA612F28B2A004E02F6 /* JSOESVertexArrayObject.cpp in Sources */, 25159 77EF62F312F9DB7400C77BD2 /* JSWebGLVertexArrayObjectOES.cpp in Sources */, 25120 25160 0F29C16E1300C2E2002D794E /* AccessibilityAllInOne.cpp in Sources */, 25121 25161 975CA28A130365F800E99AD9 /* Crypto.cpp in Sources */, -
trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp
r76601 r79011 40 40 #include "JSOESStandardDerivatives.h" 41 41 #include "JSOESTextureFloat.h" 42 #include "JSOESVertexArrayObject.h" 43 #include "JSWebGLVertexArrayObjectOES.h" 42 44 #include "JSWebGLBuffer.h" 43 45 #include "JSFloat32Array.h" … … 54 56 #include "OESStandardDerivatives.h" 55 57 #include "OESTextureFloat.h" 58 #include "OESVertexArrayObject.h" 59 #include "WebGLVertexArrayObjectOES.h" 56 60 #include "WebGLBuffer.h" 57 61 #include "Float32Array.h" … … 116 120 case WebGLGetInfo::kTypeWebGLUnsignedByteArray: 117 121 return toJS(exec, globalObject, info.getWebGLUnsignedByteArray()); 122 case WebGLGetInfo::kTypeWebGLVertexArrayObjectOES: 123 return toJS(exec, globalObject, info.getWebGLVertexArrayObjectOES()); 118 124 default: 119 125 notImplemented(); … … 180 186 case WebGLExtension::OESTextureFloatName: 181 187 return toJS(exec, globalObject, static_cast<OESTextureFloat*>(extension)); 188 case WebGLExtension::OESVertexArrayObjectName: 189 return toJS(exec, globalObject, static_cast<OESVertexArrayObject*>(extension)); 182 190 } 183 191 ASSERT_NOT_REACHED(); -
trunk/Source/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
r76601 r79011 51 51 #include "V8OESStandardDerivatives.h" 52 52 #include "V8OESTextureFloat.h" 53 #include "V8OESVertexArrayObject.h" 53 54 #include "V8Proxy.h" 54 55 #include "V8Uint16Array.h" … … 62 63 #include "V8WebGLTexture.h" 63 64 #include "V8WebGLUniformLocation.h" 65 #include "V8WebGLVertexArrayObjectOES.h" 64 66 #include "WebGLRenderingContext.h" 65 67 #include <wtf/FastMalloc.h> … … 147 149 case WebGLGetInfo::kTypeWebGLUnsignedByteArray: 148 150 return toV8(info.getWebGLUnsignedByteArray()); 151 case WebGLGetInfo::kTypeWebGLVertexArrayObjectOES: 152 return toV8(info.getWebGLVertexArrayObjectOES()); 149 153 default: 150 154 notImplemented(); … … 167 171 case WebGLExtension::OESTextureFloatName: 168 172 extensionObject = toV8(static_cast<OESTextureFloat*>(extension)); 173 break; 174 case WebGLExtension::OESVertexArrayObjectName: 175 extensionObject = toV8(static_cast<OESVertexArrayObject*>(extension)); 169 176 break; 170 177 } -
trunk/Source/WebCore/html/canvas/WebGLExtension.h
r76324 r79011 38 38 OESTextureFloatName, 39 39 OESStandardDerivativesName, 40 OESVertexArrayObjectName, 40 41 }; 41 42 -
trunk/Source/WebCore/html/canvas/WebGLGetInfo.cpp
r76601 r79011 39 39 #include "WebGLRenderbuffer.h" 40 40 #include "WebGLTexture.h" 41 #include "WebGLVertexArrayObjectOES.h" 41 42 42 43 namespace WebCore { … … 135 136 } 136 137 138 WebGLGetInfo::WebGLGetInfo(PassRefPtr<WebGLVertexArrayObjectOES> value) 139 : m_type(kTypeWebGLVertexArrayObjectOES) 140 , m_webglVertexArrayObject(value) 141 { 142 } 143 137 144 WebGLGetInfo::~WebGLGetInfo() 138 145 { … … 228 235 } 229 236 237 PassRefPtr<WebGLVertexArrayObjectOES> WebGLGetInfo::getWebGLVertexArrayObjectOES() const 238 { 239 ASSERT(getType() == kTypeWebGLVertexArrayObjectOES); 240 return m_webglVertexArrayObject; 241 } 242 230 243 } // namespace WebCore 231 244 -
trunk/Source/WebCore/html/canvas/WebGLGetInfo.h
r76601 r79011 37 37 #include "WebGLRenderbuffer.h" 38 38 #include "WebGLTexture.h" 39 #include "WebGLVertexArrayObjectOES.h" 39 40 40 41 #include <wtf/PassRefPtr.h> … … 66 67 kTypeWebGLRenderbuffer, 67 68 kTypeWebGLTexture, 68 kTypeWebGLUnsignedByteArray 69 kTypeWebGLUnsignedByteArray, 70 kTypeWebGLVertexArrayObjectOES, 69 71 }; 70 72 … … 87 89 WebGLGetInfo(PassRefPtr<WebGLTexture> value); 88 90 WebGLGetInfo(PassRefPtr<Uint8Array> value); 91 WebGLGetInfo(PassRefPtr<WebGLVertexArrayObjectOES> value); 89 92 90 93 virtual ~WebGLGetInfo(); … … 108 111 PassRefPtr<WebGLTexture> getWebGLTexture() const; 109 112 PassRefPtr<Uint8Array> getWebGLUnsignedByteArray() const; 113 PassRefPtr<WebGLVertexArrayObjectOES> getWebGLVertexArrayObjectOES() const; 110 114 111 115 private: … … 127 131 RefPtr<WebGLTexture> m_webglTexture; 128 132 RefPtr<Uint8Array> m_webglUnsignedByteArray; 133 RefPtr<WebGLVertexArrayObjectOES> m_webglVertexArrayObject; 129 134 }; 130 135 -
trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
r78921 r79011 47 47 #include "OESStandardDerivatives.h" 48 48 #include "OESTextureFloat.h" 49 #include "OESVertexArrayObject.h" 49 50 #include "RenderBox.h" 50 51 #include "RenderLayer.h" … … 403 404 m_unpackColorspaceConversion = GraphicsContext3D::BROWSER_DEFAULT_WEBGL; 404 405 m_boundArrayBuffer = 0; 405 m_boundElementArrayBuffer = 0;406 406 m_currentProgram = 0; 407 407 m_framebufferBinding = 0; … … 413 413 m_stencilFuncMask = 0xFFFFFFFF; 414 414 m_stencilFuncMaskBack = 0xFFFFFFFF; 415 m_vertexAttribState.clear();416 415 417 416 GC3Dint numCombinedTextureImageUnits = 0; … … 423 422 m_context->getIntegerv(GraphicsContext3D::MAX_VERTEX_ATTRIBS, &numVertexAttribs); 424 423 m_maxVertexAttribs = numVertexAttribs; 425 424 426 425 m_maxTextureSize = 0; 427 426 m_context->getIntegerv(GraphicsContext3D::MAX_TEXTURE_SIZE, &m_maxTextureSize); … … 430 429 m_context->getIntegerv(GraphicsContext3D::MAX_CUBE_MAP_TEXTURE_SIZE, &m_maxCubeMapTextureSize); 431 430 m_maxCubeMapTextureLevel = WebGLTexture::computeLevelCount(m_maxCubeMapTextureSize, m_maxCubeMapTextureSize); 431 432 m_defaultVertexArrayObject = WebGLVertexArrayObjectOES::create(this, WebGLVertexArrayObjectOES::VaoTypeDefault); 433 addObject(m_defaultVertexArrayObject.get()); 434 m_boundVertexArrayObject = m_defaultVertexArrayObject; 435 436 m_vertexAttribValue.resize(m_maxVertexAttribs); 432 437 433 438 if (!isGLES2NPOTStrict()) … … 603 608 m_boundArrayBuffer = buffer; 604 609 else if (target == GraphicsContext3D::ELEMENT_ARRAY_BUFFER) 605 m_bound ElementArrayBuffer = buffer;610 m_boundVertexArrayObject->setElementArrayBuffer(buffer); 606 611 else { 607 612 m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); … … 1119 1124 if (m_boundArrayBuffer == buffer) 1120 1125 m_boundArrayBuffer = 0; 1121 if (m_boundElementArrayBuffer == buffer) 1122 m_boundElementArrayBuffer = 0; 1126 RefPtr<WebGLBuffer> elementArrayBuffer = m_boundVertexArrayObject->getElementArrayBuffer(); 1127 if (elementArrayBuffer == buffer) 1128 m_boundVertexArrayObject->setElementArrayBuffer(0); 1123 1129 if (!isGLES2Compliant()) { 1124 VertexAttribState& state = m_vertexAttribState[0];1130 WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(0); 1125 1131 if (buffer == state.bufferBinding) { 1126 1132 state.bufferBinding = m_vertexAttrib0Buffer; … … 1243 1249 } 1244 1250 1245 if (index < m_vertexAttribState.size())1246 m_vertexAttribState[index].enabled = false;1251 WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(index); 1252 state.enabled = false; 1247 1253 1248 1254 if (index > 0 || isGLES2Compliant()) { … … 1254 1260 bool WebGLRenderingContext::validateElementArraySize(GC3Dsizei count, GC3Denum type, GC3Dintptr offset) 1255 1261 { 1256 if (!m_boundElementArrayBuffer) 1262 RefPtr<WebGLBuffer> elementArrayBuffer = m_boundVertexArrayObject->getElementArrayBuffer(); 1263 1264 if (!elementArrayBuffer) 1257 1265 return false; 1258 1266 … … 1268 1276 offset /= 2; 1269 1277 1270 GC3Dsizeiptr n = m_boundElementArrayBuffer->byteLength() / 2;1278 GC3Dsizeiptr n = elementArrayBuffer->byteLength() / 2; 1271 1279 if (offset > n || count > n - offset) 1272 1280 return false; 1273 1281 } else if (type == GraphicsContext3D::UNSIGNED_BYTE) { 1274 GC3Dsizeiptr n = m_boundElementArrayBuffer->byteLength();1282 GC3Dsizeiptr n = elementArrayBuffer->byteLength(); 1275 1283 if (offset > n || count > n - offset) 1276 1284 return false; … … 1286 1294 // index, skips the expensive per-draw-call iteration in 1287 1295 // validateIndexArrayPrecise. 1288 1289 if (!m_boundElementArrayBuffer) 1296 1297 RefPtr<WebGLBuffer> elementArrayBuffer = m_boundVertexArrayObject->getElementArrayBuffer(); 1298 1299 if (!elementArrayBuffer) 1290 1300 return false; 1291 1301 1292 GC3Dsizeiptr numElements = m_boundElementArrayBuffer->byteLength();1302 GC3Dsizeiptr numElements = elementArrayBuffer->byteLength(); 1293 1303 // The case count==0 is already dealt with in drawElements before validateIndexArrayConservative. 1294 1304 if (!numElements) 1295 1305 return false; 1296 const ArrayBuffer* buffer = m_boundElementArrayBuffer->elementArrayBuffer();1306 const ArrayBuffer* buffer = elementArrayBuffer->elementArrayBuffer(); 1297 1307 ASSERT(buffer); 1298 1308 1299 int maxIndex = m_boundElementArrayBuffer->getCachedMaxIndex(type);1309 int maxIndex = elementArrayBuffer->getCachedMaxIndex(type); 1300 1310 if (maxIndex < 0) { 1301 1311 // Compute the maximum index in the entire buffer for the given type of index. … … 1317 1327 return false; 1318 1328 } 1319 m_boundElementArrayBuffer->setCachedMaxIndex(type, maxIndex);1329 elementArrayBuffer->setCachedMaxIndex(type, maxIndex); 1320 1330 } 1321 1331 … … 1334 1344 ASSERT(count >= 0 && offset >= 0); 1335 1345 int lastIndex = -1; 1336 1337 if (!m_boundElementArrayBuffer) 1346 1347 RefPtr<WebGLBuffer> elementArrayBuffer = m_boundVertexArrayObject->getElementArrayBuffer(); 1348 1349 if (!elementArrayBuffer) 1338 1350 return false; 1339 1351 … … 1343 1355 } 1344 1356 1345 if (! m_boundElementArrayBuffer->elementArrayBuffer())1357 if (!elementArrayBuffer->elementArrayBuffer()) 1346 1358 return false; 1347 1359 … … 1352 1364 // Make uoffset an element offset. 1353 1365 uoffset /= sizeof(GC3Dushort); 1354 const GC3Dushort* p = static_cast<const GC3Dushort*>( m_boundElementArrayBuffer->elementArrayBuffer()->data()) + uoffset;1366 const GC3Dushort* p = static_cast<const GC3Dushort*>(elementArrayBuffer->elementArrayBuffer()->data()) + uoffset; 1355 1367 while (n-- > 0) { 1356 1368 if (*p > lastIndex) … … 1359 1371 } 1360 1372 } else if (type == GraphicsContext3D::UNSIGNED_BYTE) { 1361 const GC3Dubyte* p = static_cast<const GC3Dubyte*>( m_boundElementArrayBuffer->elementArrayBuffer()->data()) + uoffset;1373 const GC3Dubyte* p = static_cast<const GC3Dubyte*>(elementArrayBuffer->elementArrayBuffer()->data()) + uoffset; 1362 1374 while (n-- > 0) { 1363 1375 if (*p > lastIndex) … … 1377 1389 return false; 1378 1390 1379 int numAttribStates = static_cast<int>(m_vertexAttribState.size());1380 1381 1391 // Look in each enabled vertex attrib and check if they've been bound to a buffer. 1382 for (int i = 0; i < numAttribStates; ++i) { 1383 if (m_vertexAttribState[i].enabled 1384 && (!m_vertexAttribState[i].bufferBinding || !m_vertexAttribState[i].bufferBinding->object())) 1392 for (unsigned i = 0; i < m_maxVertexAttribs; ++i) { 1393 const WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(i); 1394 if (state.enabled 1395 && (!state.bufferBinding || !state.bufferBinding->object())) 1385 1396 return false; 1386 1397 } … … 1394 1405 for (int i = 0; i < numActiveAttribLocations; ++i) { 1395 1406 int loc = m_currentProgram->getActiveAttribLocation(i); 1396 if (loc >= 0 && loc < numAttribStates) {1397 const VertexAttribState& state = m_vertexAttribState[loc];1407 if (loc >= 0 && loc < static_cast<int>(m_maxVertexAttribs)) { 1408 const WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(loc); 1398 1409 if (state.enabled) { 1399 1410 // Avoid off-by-one errors in numElements computation. … … 1509 1520 return; 1510 1521 1511 if (!m_bound ElementArrayBuffer) {1522 if (!m_boundVertexArrayObject->getElementArrayBuffer()) { 1512 1523 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 1513 1524 return; … … 1575 1586 } 1576 1587 1577 if (index >= m_vertexAttribState.size()) 1578 m_vertexAttribState.resize(index + 1); 1579 1580 m_vertexAttribState[index].enabled = true; 1588 WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(index); 1589 state.enabled = true; 1581 1590 1582 1591 m_context->enableVertexAttribArray(index); … … 1851 1860 } 1852 1861 return m_oesTextureFloat.get(); 1862 } 1863 if (equalIgnoringCase(name, "OES_vertex_array_object") 1864 && m_context->getExtensions()->supports("GL_OES_vertex_array_object")) { 1865 if (!m_oesVertexArrayObject) { 1866 m_context->getExtensions()->ensureEnabled("GL_OES_vertex_array_object"); 1867 m_oesVertexArrayObject = OESVertexArrayObject::create(this); 1868 } 1869 return m_oesVertexArrayObject.get(); 1853 1870 } 1854 1871 if (equalIgnoringCase(name, "WEBKIT_lose_context")) { … … 1972 1989 return getBooleanParameter(pname); 1973 1990 case GraphicsContext3D::ELEMENT_ARRAY_BUFFER_BINDING: 1974 return WebGLGetInfo(PassRefPtr<WebGLBuffer>(m_bound ElementArrayBuffer));1991 return WebGLGetInfo(PassRefPtr<WebGLBuffer>(m_boundVertexArrayObject->getElementArrayBuffer())); 1975 1992 case GraphicsContext3D::FRAMEBUFFER_BINDING: 1976 1993 return WebGLGetInfo(PassRefPtr<WebGLFramebuffer>(m_framebufferBinding)); … … 2098 2115 m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); 2099 2116 return WebGLGetInfo(); 2117 case Extensions3D::VERTEX_ARRAY_BINDING_OES: // OES_vertex_array_object 2118 if (m_oesVertexArrayObject) { 2119 if (!m_boundVertexArrayObject->isDefaultObject()) 2120 return WebGLGetInfo(PassRefPtr<WebGLVertexArrayObjectOES>(m_boundVertexArrayObject)); 2121 return WebGLGetInfo(); 2122 } 2123 m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); 2124 return WebGLGetInfo(); 2100 2125 default: 2101 2126 m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); … … 2259 2284 if (m_context->getExtensions()->supports("GL_OES_standard_derivatives")) 2260 2285 result.append("OES_standard_derivatives"); 2286 if (m_context->getExtensions()->supports("GL_OES_vertex_array_object")) 2287 result.append("OES_vertex_array_object"); 2261 2288 result.append("WEBKIT_lose_context"); 2262 2289 return result; … … 2454 2481 return WebGLGetInfo(); 2455 2482 } 2483 const WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(index); 2456 2484 switch (pname) { 2457 2485 case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: 2458 if ((!isGLES2Compliant() && !index && m_vertexAttribState[0].bufferBinding == m_vertexAttrib0Buffer) 2459 || index >= m_vertexAttribState.size() 2460 || !m_vertexAttribState[index].bufferBinding 2461 || !m_vertexAttribState[index].bufferBinding->object()) 2486 if ((!isGLES2Compliant() && !index && m_boundVertexArrayObject->getVertexAttribState(0).bufferBinding == m_vertexAttrib0Buffer) 2487 || !state.bufferBinding 2488 || !state.bufferBinding->object()) 2462 2489 return WebGLGetInfo(); 2463 return WebGLGetInfo(PassRefPtr<WebGLBuffer>( m_vertexAttribState[index].bufferBinding));2490 return WebGLGetInfo(PassRefPtr<WebGLBuffer>(state.bufferBinding)); 2464 2491 case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_ENABLED: 2465 if (index >= m_vertexAttribState.size()) 2466 return WebGLGetInfo(false); 2467 return WebGLGetInfo(m_vertexAttribState[index].enabled); 2492 return WebGLGetInfo(state.enabled); 2468 2493 case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_NORMALIZED: 2469 if (index >= m_vertexAttribState.size()) 2470 return WebGLGetInfo(false); 2471 return WebGLGetInfo(m_vertexAttribState[index].normalized); 2494 return WebGLGetInfo(state.normalized); 2472 2495 case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_SIZE: 2473 if (index >= m_vertexAttribState.size()) 2474 return WebGLGetInfo(static_cast<int>(4)); 2475 return WebGLGetInfo(m_vertexAttribState[index].size); 2496 return WebGLGetInfo(state.size); 2476 2497 case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_STRIDE: 2477 if (index >= m_vertexAttribState.size()) 2478 return WebGLGetInfo(static_cast<int>(0)); 2479 return WebGLGetInfo(m_vertexAttribState[index].originalStride); 2498 return WebGLGetInfo(state.originalStride); 2480 2499 case GraphicsContext3D::VERTEX_ATTRIB_ARRAY_TYPE: 2481 if (index >= m_vertexAttribState.size()) 2482 return WebGLGetInfo(static_cast<unsigned int>(GraphicsContext3D::FLOAT)); 2483 return WebGLGetInfo(m_vertexAttribState[index].type); 2500 return WebGLGetInfo(state.type); 2484 2501 case GraphicsContext3D::CURRENT_VERTEX_ATTRIB: 2485 if (index >= m_vertexAttribState.size()) { 2486 float value[4] = { 0.0f, 0.0f, 0.0f, 1.0f }; 2487 return WebGLGetInfo(Float32Array::create(value, 4)); 2488 } 2489 return WebGLGetInfo(Float32Array::create(m_vertexAttribState[index].value, 4)); 2502 return WebGLGetInfo(Float32Array::create(m_vertexAttribValue[index].value, 4)); 2490 2503 default: 2491 2504 m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); … … 3725 3738 GC3Dsizei bytesPerElement = size * typeSize; 3726 3739 3727 if (index >= m_vertexAttribState.size())3728 m_vertexAttribState.resize(index + 1);3729 3730 3740 GC3Dsizei validatedStride = stride ? stride : bytesPerElement; 3731 3741 3732 m_vertexAttribState[index].bufferBinding = m_boundArrayBuffer; 3733 m_vertexAttribState[index].bytesPerElement = bytesPerElement; 3734 m_vertexAttribState[index].size = size; 3735 m_vertexAttribState[index].type = type; 3736 m_vertexAttribState[index].normalized = normalized; 3737 m_vertexAttribState[index].stride = validatedStride; 3738 m_vertexAttribState[index].originalStride = stride; 3739 m_vertexAttribState[index].offset = offset; 3742 WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(index); 3743 state.bufferBinding = m_boundArrayBuffer; 3744 state.bytesPerElement = bytesPerElement; 3745 state.size = size; 3746 state.type = type; 3747 state.normalized = normalized; 3748 state.stride = validatedStride; 3749 state.originalStride = stride; 3750 state.offset = offset; 3740 3751 m_context->vertexAttribPointer(index, size, type, normalized, stride, offset); 3741 3752 cleanupAfterGraphicsCall(false); … … 4474 4485 switch (target) { 4475 4486 case GraphicsContext3D::ELEMENT_ARRAY_BUFFER: 4476 buffer = m_bound ElementArrayBuffer.get();4487 buffer = m_boundVertexArrayObject->getElementArrayBuffer().get(); 4477 4488 break; 4478 4489 case GraphicsContext3D::ARRAY_BUFFER: … … 4523 4534 cleanupAfterGraphicsCall(false); 4524 4535 } 4525 if (index >= m_vertexAttribState.size()) 4526 m_vertexAttribState.resize(index + 1); 4527 m_vertexAttribState[index].value[0] = v0; 4528 m_vertexAttribState[index].value[1] = v1; 4529 m_vertexAttribState[index].value[2] = v2; 4530 m_vertexAttribState[index].value[3] = v3; 4536 VertexAttribValue& attribValue = m_vertexAttribValue[index]; 4537 attribValue.value[0] = v0; 4538 attribValue.value[1] = v1; 4539 attribValue.value[2] = v2; 4540 attribValue.value[3] = v3; 4531 4541 } 4532 4542 … … 4576 4586 cleanupAfterGraphicsCall(false); 4577 4587 } 4578 if (index >= m_vertexAttribState.size()) 4579 m_vertexAttribState.resize(index + 1); 4580 m_vertexAttribState[index].initValue(); 4588 VertexAttribValue& attribValue = m_vertexAttribValue[index]; 4589 attribValue.initValue(); 4581 4590 for (int ii = 0; ii < expectedSize; ++ii) 4582 m_vertexAttribState[index].value[ii] = v[ii];4591 attribValue.value[ii] = v[ii]; 4583 4592 } 4584 4593 4585 4594 void WebGLRenderingContext::initVertexAttrib0() 4586 4595 { 4587 m_vertexAttribState.resize(1); 4596 WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(0); 4597 4588 4598 m_vertexAttrib0Buffer = createBuffer(); 4589 4599 m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, m_vertexAttrib0Buffer->object()); 4590 4600 m_context->bufferData(GraphicsContext3D::ARRAY_BUFFER, 0, GraphicsContext3D::DYNAMIC_DRAW); 4591 4601 m_context->vertexAttribPointer(0, 4, GraphicsContext3D::FLOAT, false, 0, 0); 4592 m_vertexAttribState[0].bufferBinding = m_vertexAttrib0Buffer;4602 state.bufferBinding = m_vertexAttrib0Buffer; 4593 4603 m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, 0); 4594 4604 m_context->enableVertexAttribArray(0); … … 4604 4614 bool WebGLRenderingContext::simulateVertexAttrib0(GC3Dsizei numVertex) 4605 4615 { 4606 const VertexAttribState& state = m_vertexAttribState[0]; 4616 const WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(0); 4617 const VertexAttribValue& attribValue = m_vertexAttribValue[0]; 4607 4618 if (!m_currentProgram) 4608 4619 return false; … … 4624 4635 if (usingVertexAttrib0 4625 4636 && (m_forceAttrib0BufferRefill 4626 || state.value[0] != m_vertexAttrib0BufferValue[0]4627 || state.value[1] != m_vertexAttrib0BufferValue[1]4628 || state.value[2] != m_vertexAttrib0BufferValue[2]4629 || state.value[3] != m_vertexAttrib0BufferValue[3])) {4637 || attribValue.value[0] != m_vertexAttrib0BufferValue[0] 4638 || attribValue.value[1] != m_vertexAttrib0BufferValue[1] 4639 || attribValue.value[2] != m_vertexAttrib0BufferValue[2] 4640 || attribValue.value[3] != m_vertexAttrib0BufferValue[3])) { 4630 4641 OwnArrayPtr<GC3Dfloat> bufferData = adoptArrayPtr(new GC3Dfloat[(numVertex + 1) * 4]); 4631 4642 for (GC3Dsizei ii = 0; ii < numVertex + 1; ++ii) { 4632 bufferData[ii * 4] = state.value[0];4633 bufferData[ii * 4 + 1] = state.value[1];4634 bufferData[ii * 4 + 2] = state.value[2];4635 bufferData[ii * 4 + 3] = state.value[3];4636 } 4637 m_vertexAttrib0BufferValue[0] = state.value[0];4638 m_vertexAttrib0BufferValue[1] = state.value[1];4639 m_vertexAttrib0BufferValue[2] = state.value[2];4640 m_vertexAttrib0BufferValue[3] = state.value[3];4643 bufferData[ii * 4] = attribValue.value[0]; 4644 bufferData[ii * 4 + 1] = attribValue.value[1]; 4645 bufferData[ii * 4 + 2] = attribValue.value[2]; 4646 bufferData[ii * 4 + 3] = attribValue.value[3]; 4647 } 4648 m_vertexAttrib0BufferValue[0] = attribValue.value[0]; 4649 m_vertexAttrib0BufferValue[1] = attribValue.value[1]; 4650 m_vertexAttrib0BufferValue[2] = attribValue.value[2]; 4651 m_vertexAttrib0BufferValue[3] = attribValue.value[3]; 4641 4652 m_forceAttrib0BufferRefill = false; 4642 4653 m_context->bufferSubData(GraphicsContext3D::ARRAY_BUFFER, 0, bufferDataSize, bufferData.get()); … … 4648 4659 void WebGLRenderingContext::restoreStatesAfterVertexAttrib0Simulation() 4649 4660 { 4650 const VertexAttribState& state = m_vertexAttribState[0];4661 const WebGLVertexArrayObjectOES::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(0); 4651 4662 if (state.bufferBinding != m_vertexAttrib0Buffer) { 4652 4663 m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, objectOrZero(state.bufferBinding.get())); … … 4658 4669 int WebGLRenderingContext::getNumberOfExtensions() 4659 4670 { 4660 return (m_oes StandardDerivatives ? 1 : 0) + (m_webkitLoseContext ? 1 : 0) + (m_oesTextureFloat ? 1 : 0);4671 return (m_oesVertexArrayObject ? 1 : 0) + (m_oesStandardDerivatives ? 1 : 0) + (m_webkitLoseContext ? 1 : 0) + (m_oesTextureFloat ? 1 : 0); 4661 4672 } 4662 4673 4663 4674 WebGLExtension* WebGLRenderingContext::getExtensionNumber(int i) 4664 4675 { 4676 if (m_oesVertexArrayObject) { 4677 if (!i) 4678 return m_oesVertexArrayObject.get(); 4679 --i; 4680 } 4665 4681 if (m_oesStandardDerivatives) { 4666 4682 if (!i) -
trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h
r78355 r79011 60 60 class OESStandardDerivatives; 61 61 class OESTextureFloat; 62 class OESVertexArrayObject; 63 class WebGLVertexArrayObjectOES; 62 64 63 65 class WebGLRenderingContext : public CanvasRenderingContext { … … 287 289 288 290 void removeObject(WebGLObject*); 291 292 unsigned getMaxVertexAttribs() const { return m_maxVertexAttribs; } 289 293 290 294 // Helpers for JSC bindings. … … 294 298 private: 295 299 friend class WebGLObject; 300 friend class OESVertexArrayObject; 296 301 297 302 WebGLRenderingContext(HTMLCanvasElement*, PassRefPtr<GraphicsContext3D>, GraphicsContext3D::Attributes); … … 363 368 // List of bound VBO's. Used to maintain info about sizes for ARRAY_BUFFER and stored values for ELEMENT_ARRAY_BUFFER 364 369 RefPtr<WebGLBuffer> m_boundArrayBuffer; 365 RefPtr<WebGLBuffer> m_boundElementArrayBuffer; 366 367 // Cached values for vertex attrib range checks 368 class VertexAttribState { 370 371 RefPtr<WebGLVertexArrayObjectOES> m_defaultVertexArrayObject; 372 RefPtr<WebGLVertexArrayObjectOES> m_boundVertexArrayObject; 373 void setBoundVertexArrayObject(PassRefPtr<WebGLVertexArrayObjectOES> arrayObject) 374 { 375 if (arrayObject) 376 m_boundVertexArrayObject = arrayObject; 377 else 378 m_boundVertexArrayObject = m_defaultVertexArrayObject; 379 } 380 381 class VertexAttribValue { 369 382 public: 370 VertexAttribState() 371 : enabled(false) 372 , bytesPerElement(0) 373 , size(4) 374 , type(GraphicsContext3D::FLOAT) 375 , normalized(false) 376 , stride(16) 377 , originalStride(0) 378 , offset(0) 383 VertexAttribValue() 379 384 { 380 385 initValue(); 381 386 } 382 387 383 388 void initValue() 384 389 { … … 388 393 value[3] = 1.0f; 389 394 } 390 391 bool enabled; 392 RefPtr<WebGLBuffer> bufferBinding; 393 GC3Dsizei bytesPerElement; 394 GC3Dint size; 395 GC3Denum type; 396 bool normalized; 397 GC3Dsizei stride; 398 GC3Dsizei originalStride; 399 GC3Dintptr offset; 395 400 396 GC3Dfloat value[4]; 401 397 }; 402 403 Vector<VertexAttribState> m_vertexAttribState; 398 Vector<VertexAttribValue> m_vertexAttribValue; 404 399 unsigned m_maxVertexAttribs; 405 400 RefPtr<WebGLBuffer> m_vertexAttrib0Buffer; … … 463 458 RefPtr<OESTextureFloat> m_oesTextureFloat; 464 459 RefPtr<OESStandardDerivatives> m_oesStandardDerivatives; 460 RefPtr<OESVertexArrayObject> m_oesVertexArrayObject; 465 461 RefPtr<WebKitLoseContext> m_webkitLoseContext; 466 462 -
trunk/Source/WebCore/platform/graphics/Extensions3D.h
r76717 r79011 27 27 #define Extensions3D_h 28 28 29 #include "GraphicsTypes3D.h" 30 29 31 #include <wtf/text/WTFString.h> 30 32 … … 54 56 // GL_OES_standard_derivatives 55 57 // GL_OES_rgb8_rgba8 58 // GL_OES_vertex_array_object 56 59 57 60 // Takes full name of extension; for example, … … 93 96 RGB8_OES = 0x8051, 94 97 RGBA8_OES = 0x8058, 98 99 // GL_OES_vertex_array_object names 100 VERTEX_ARRAY_BINDING_OES = 0x85B5, 95 101 }; 96 102 … … 102 108 103 109 // GL_ANGLE_framebuffer_multisample 104 virtual void renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height) = 0; 110 virtual void renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height) = 0; 111 112 // GL_OES_vertex_array_object 113 virtual Platform3DObject createVertexArrayOES() = 0; 114 virtual void deleteVertexArrayOES(Platform3DObject) = 0; 115 virtual GC3Dboolean isVertexArrayOES(Platform3DObject) = 0; 116 virtual void bindVertexArrayOES(Platform3DObject) = 0; 105 117 }; 106 118 -
trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h
r77999 r79011 29 29 #include "IntSize.h" 30 30 #include "GraphicsLayer.h" 31 #include "GraphicsTypes3D.h" 31 32 #include "PlatformString.h" 32 33 … … 42 43 #undef VERSION 43 44 #endif 44 45 // GC3D types match the corresponding GL types as defined in OpenGL ES 2.046 // header file gl2.h from khronos.org.47 typedef unsigned int GC3Denum;48 typedef unsigned char GC3Dboolean;49 typedef unsigned int GC3Dbitfield;50 typedef signed char GC3Dbyte;51 typedef unsigned char GC3Dubyte;52 typedef short GC3Dshort;53 typedef unsigned short GC3Dushort;54 typedef int GC3Dint;55 typedef int GC3Dsizei;56 typedef unsigned int GC3Duint;57 typedef float GC3Dfloat;58 typedef float GC3Dclampf;59 typedef signed long int GC3Dintptr;60 typedef signed long int GC3Dsizeiptr;61 62 typedef GC3Duint Platform3DObject;63 45 64 46 #if PLATFORM(MAC) -
trunk/Source/WebCore/platform/graphics/chromium/Extensions3DChromium.h
r76717 r79011 47 47 virtual void blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter); 48 48 virtual void renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height); 49 virtual Platform3DObject createVertexArrayOES(); 50 virtual void deleteVertexArrayOES(Platform3DObject); 51 virtual GC3Dboolean isVertexArrayOES(Platform3DObject); 52 virtual void bindVertexArrayOES(Platform3DObject); 49 53 50 54 enum { -
trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp
r76717 r79011 88 88 if (name == "GL_OES_texture_float" || name == "GL_OES_texture_half_float") 89 89 return m_availableExtensions.contains("GL_ARB_texture_float"); 90 91 // GL_OES_vertex_array_object 92 if (name == "GL_OES_vertex_array_object") 93 return m_availableExtensions.contains("GL_APPLE_vertex_array_object"); 90 94 91 95 // Desktop GL always supports the standard derivative functions … … 128 132 } 129 133 134 Platform3DObject Extensions3DOpenGL::createVertexArrayOES() 135 { 136 m_context->makeContextCurrent(); 137 #if GL_APPLE_vertex_array_object 138 GLuint array = 0; 139 glGenVertexArraysAPPLE(1, &array); 140 return array; 141 #else 142 return 0; 143 #endif 144 } 145 146 void Extensions3DOpenGL::deleteVertexArrayOES(Platform3DObject array) 147 { 148 if (!array) 149 return; 150 151 m_context->makeContextCurrent(); 152 #if GL_APPLE_vertex_array_object 153 glDeleteVertexArraysAPPLE(1, &array); 154 #else 155 #endif 156 } 157 158 GC3Dboolean Extensions3DOpenGL::isVertexArrayOES(Platform3DObject array) 159 { 160 if (!array) 161 return GL_FALSE; 162 163 m_context->makeContextCurrent(); 164 #if GL_APPLE_vertex_array_object 165 return glIsVertexArrayAPPLE(array); 166 #else 167 return GL_FALSE; 168 #endif 169 } 170 171 void Extensions3DOpenGL::bindVertexArrayOES(Platform3DObject array) 172 { 173 m_context->makeContextCurrent(); 174 #if GL_APPLE_vertex_array_object 175 glBindVertexArrayAPPLE(array); 176 #else 177 ASSERT_UNUSED(array, supports(array)); 178 #endif 179 } 180 130 181 } // namespace WebCore 131 182 -
trunk/Source/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h
r76324 r79011 44 44 virtual int getGraphicsResetStatusARB(); 45 45 virtual void blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter); 46 virtual void renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height); 46 virtual void renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height); 47 48 virtual Platform3DObject createVertexArrayOES(); 49 virtual void deleteVertexArrayOES(Platform3DObject); 50 virtual GC3Dboolean isVertexArrayOES(Platform3DObject); 51 virtual void bindVertexArrayOES(Platform3DObject); 47 52 48 53 private: -
trunk/Source/WebCore/platform/graphics/qt/Extensions3DQt.cpp
r78495 r79011 65 65 } 66 66 67 Platform3DObject Extensions3DQt::createVertexArrayOES() 68 { 69 return 0; 70 } 71 72 void Extensions3DQt::deleteVertexArrayOES(Platform3DObject) 73 { 74 } 75 76 GC3Dboolean Extensions3DQt::isVertexArrayOES(Platform3DObject) 77 { 78 return GL_FALSE; 79 } 80 81 void Extensions3DQt::bindVertexArrayOES(Platform3DObject) 82 { 83 } 84 67 85 } // namespace WebCore 68 86 -
trunk/Source/WebCore/platform/graphics/qt/Extensions3DQt.h
r78495 r79011 40 40 virtual int getGraphicsResetStatusARB(); 41 41 virtual void blitFramebuffer(long srcX0, long srcY0, long srcX1, long srcY1, long dstX0, long dstY0, long dstX1, long dstY1, unsigned long mask, unsigned long filter); 42 virtual void renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height); 42 virtual void renderbufferStorageMultisample(unsigned long target, unsigned long samples, unsigned long internalformat, unsigned long width, unsigned long height); 43 virtual Platform3DObject createVertexArrayOES(); 44 virtual void deleteVertexArrayOES(Platform3DObject); 45 virtual GC3Dboolean isVertexArrayOES(Platform3DObject); 46 virtual void bindVertexArrayOES(Platform3DObject); 43 47 44 48 private: -
trunk/Source/WebKit/chromium/ChangeLog
r78967 r79011 1 2011-02-18 Ben Vanik <benvanik@google.com> 2 3 Reviewed by Kenneth Russell. 4 5 Bug 53940: Implement the OES_vertex_array_object WebGL extension 6 https://bugs.webkit.org/show_bug.cgi?id=53940 7 8 Stubbed out methods for the new OES_vertex_array_object methods. 9 10 * src/Extensions3DChromium.cpp: 11 (WebCore::Extensions3DChromium::createVertexArrayOES): 12 (WebCore::Extensions3DChromium::deleteVertexArrayOES): 13 (WebCore::Extensions3DChromium::isVertexArrayOES): 14 (WebCore::Extensions3DChromium::bindVertexArrayOES): 15 1 16 2011-02-17 Yuzo Fujishima <yuzo@google.com> 2 17 -
trunk/Source/WebKit/chromium/src/Extensions3DChromium.cpp
r76717 r79011 98 98 } 99 99 100 Platform3DObject Extensions3DChromium::createVertexArrayOES() 101 { 102 return 0; 103 } 104 105 void Extensions3DChromium::deleteVertexArrayOES(Platform3DObject) 106 { 107 } 108 109 GC3Dboolean Extensions3DChromium::isVertexArrayOES(Platform3DObject) 110 { 111 return 0; 112 } 113 114 void Extensions3DChromium::bindVertexArrayOES(Platform3DObject) 115 { 116 } 117 100 118 } // namespace WebCore 101 119
Note: See TracChangeset
for help on using the changeset viewer.