Changeset 181571 in webkit
- Timestamp:
- Mar 16, 2015, 12:03:26 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 added
- 21 edited
-
CMakeLists.txt (modified) (2 diffs)
-
ChangeLog (modified) (1 diff)
-
WebCore.vcxproj/WebCore.vcxproj (modified) (3 diffs)
-
WebCore.vcxproj/WebCore.vcxproj.filters (modified) (3 diffs)
-
WebCore.xcodeproj/project.pbxproj (modified) (4 diffs)
-
bindings/js/JSWebGLRenderingContextBaseCustom.cpp (modified) (3 diffs)
-
html/canvas/OESVertexArrayObject.cpp (modified) (4 diffs)
-
html/canvas/WebGL2RenderingContext.cpp (modified) (5 diffs)
-
html/canvas/WebGL2RenderingContext.h (modified) (1 diff)
-
html/canvas/WebGLGetInfo.cpp (modified) (3 diffs)
-
html/canvas/WebGLGetInfo.h (modified) (5 diffs)
-
html/canvas/WebGLRenderingContext.cpp (modified) (3 diffs)
-
html/canvas/WebGLRenderingContext.h (modified) (1 diff)
-
html/canvas/WebGLRenderingContextBase.cpp (modified) (10 diffs)
-
html/canvas/WebGLRenderingContextBase.h (modified) (2 diffs)
-
html/canvas/WebGLVertexArrayObject.cpp (modified) (2 diffs)
-
html/canvas/WebGLVertexArrayObject.h (modified) (2 diffs)
-
html/canvas/WebGLVertexArrayObjectBase.cpp (added)
-
html/canvas/WebGLVertexArrayObjectBase.h (added)
-
html/canvas/WebGLVertexArrayObjectOES.cpp (modified) (3 diffs)
-
html/canvas/WebGLVertexArrayObjectOES.h (modified) (2 diffs)
-
platform/graphics/GraphicsContext3D.h (modified) (1 diff)
-
platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/CMakeLists.txt
r181468 r181571 1720 1720 html/canvas/WebGLUniformLocation.cpp 1721 1721 html/canvas/WebGLVertexArrayObject.cpp 1722 html/canvas/WebGLVertexArrayObjectBase.cpp 1722 1723 html/canvas/WebGLVertexArrayObjectOES.cpp 1723 1724 … … 2825 2826 html/canvas/WebGLUniformLocation.cpp 2826 2827 html/canvas/WebGLVertexArrayObject.cpp 2828 html/canvas/WebGLVertexArrayObjectBase.cpp 2827 2829 html/canvas/WebGLVertexArrayObjectOES.cpp 2828 2830 ) -
trunk/Source/WebCore/ChangeLog
r181568 r181571 1 2015-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 Dean Jackson. 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 1 91 2015-03-16 Brent Fulgham <bfulgham@apple.com> 2 92 -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj
r181468 r181571 1 <?xml version="1.0" encoding="utf-8"?>1 <?xml version="1.0" encoding="utf-8"?> 2 2 <Project DefaultTargets="Build" ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 3 3 <ItemGroup Label="ProjectConfigurations"> … … 6682 6682 <ClCompile Include="..\html\canvas\WebGLUniformLocation.cpp" /> 6683 6683 <ClCompile Include="..\html\canvas\WebGLVertexArrayObject.cpp" /> 6684 <ClCompile Include="..\html\canvas\WebGLVertexArrayObjectBase.cpp" /> 6684 6685 <ClCompile Include="..\html\canvas\WebGLVertexArrayObjectOES.cpp" /> 6685 6686 <ClCompile Include="..\html\track\AudioTrack.cpp" /> … … 19042 19043 <ClInclude Include="..\html\canvas\WebGLUniformLocation.h" /> 19043 19044 <ClInclude Include="..\html\canvas\WebGLVertexArrayObject.h" /> 19045 <ClInclude Include="..\html\canvas\WebGLVertexArrayObjectBase.h” /> 19044 19046 <ClInclude Include="..\html\canvas\WebGLVertexArrayObjectOES.h" /> 19045 19047 <ClInclude Include="..\html\track\AudioTrack.h" /> -
trunk/Source/WebCore/WebCore.vcxproj/WebCore.vcxproj.filters
r181468 r181571 1 <?xml version="1.0" encoding="utf-8"?>1 <?xml version="1.0" encoding="utf-8"?> 2 2 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> 3 3 <ItemGroup> … … 7202 7202 <Filter>html\canvas</Filter> 7203 7203 </ClCompile> 7204 <ClCompile Include="..\html\canvas\WebGLVertexArrayObjectBase.cpp"> 7205 <Filter>html\canvas</Filter> 7206 </ClCompile> 7204 7207 <ClCompile Include="..\html\canvas\WebGLVertexArrayObject.cpp"> 7205 7208 <Filter>html\canvas</Filter> … … 15166 15169 </ClInclude> 15167 15170 <ClInclude Include="..\html\canvas\WebGLVertexArrayObject.h"> 15171 <Filter>html\canvas</Filter> 15172 </ClInclude> 15173 <ClInclude Include="..\html\canvas\WebGLVertexArrayObjectBase.h”> 15168 15174 <Filter>html\canvas</Filter> 15169 15175 </ClInclude> -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r181468 r181571 2326 2326 6EE8A77210F803F3005A4A24 /* JSWebGLContextAttributes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6EE8A77010F803F3005A4A24 /* JSWebGLContextAttributes.cpp */; }; 2327 2327 6EE8A77310F803F3005A4A24 /* JSWebGLContextAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EE8A77110F803F3005A4A24 /* JSWebGLContextAttributes.h */; }; 2328 6F222B761AB52D8A0094651A /* WebGLVertexArrayObjectBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6F222B751AB52D8A0094651A /* WebGLVertexArrayObjectBase.cpp */; }; 2328 2329 6F995A151A70756200A735F4 /* WebGLSync.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6F995A131A70756200A735F4 /* WebGLSync.cpp */; }; 2329 2330 6F995A161A70756200A735F4 /* WebGLSync.h in Headers */ = {isa = PBXBuildFile; fileRef = 6F995A141A70756200A735F4 /* WebGLSync.h */; }; … … 9524 9525 6EE8A77010F803F3005A4A24 /* JSWebGLContextAttributes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLContextAttributes.cpp; sourceTree = "<group>"; }; 9525 9526 6EE8A77110F803F3005A4A24 /* JSWebGLContextAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLContextAttributes.h; sourceTree = "<group>"; }; 9527 6F222B741AB52D640094651A /* WebGLVertexArrayObjectBase.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WebGLVertexArrayObjectBase.h; path = canvas/WebGLVertexArrayObjectBase.h; sourceTree = "<group>"; }; 9528 6F222B751AB52D8A0094651A /* WebGLVertexArrayObjectBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLVertexArrayObjectBase.cpp; path = canvas/WebGLVertexArrayObjectBase.cpp; sourceTree = "<group>"; }; 9526 9529 6F995A091A7070E600A735F4 /* WebGLQuery.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = WebGLQuery.idl; path = canvas/WebGLQuery.idl; sourceTree = "<group>"; }; 9527 9530 6F995A0A1A7070E600A735F4 /* WebGLSampler.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = WebGLSampler.idl; path = canvas/WebGLSampler.idl; sourceTree = "<group>"; }; … … 16040 16043 6F995A1D1A7078B100A735F4 /* WebGLVertexArrayObject.cpp */, 16041 16044 6F995A1E1A7078B100A735F4 /* WebGLVertexArrayObject.h */, 16045 6F222B751AB52D8A0094651A /* WebGLVertexArrayObjectBase.cpp */, 16046 6F222B741AB52D640094651A /* WebGLVertexArrayObjectBase.h */, 16042 16047 6F995A0D1A7070E600A735F4 /* WebGLVertexArrayObject.idl */, 16043 16048 77A17A7412F28642004E02F6 /* WebGLVertexArrayObjectOES.cpp */, … … 27734 27739 93E227E00AF589AD00D48324 /* DocumentLoader.cpp in Sources */, 27735 27740 1C26497A0D7E248A00BD10F2 /* DocumentLoaderMac.cpp in Sources */, 27741 6F222B761AB52D8A0094651A /* WebGLVertexArrayObjectBase.cpp in Sources */, 27736 27742 861C2EA413FB4FDD00062ABB /* DocumentLoadTiming.cpp in Sources */, 27737 27743 A781C6A713828B5D0012A62A /* DocumentMarker.cpp in Sources */, -
trunk/Source/WebCore/bindings/js/JSWebGLRenderingContextBaseCustom.cpp
r178674 r181571 69 69 #include "JSWebGLTexture.h" 70 70 #include "JSWebGLUniformLocation.h" 71 #include "JSWebGLVertexArrayObject.h" 71 72 #include "JSWebGLVertexArrayObjectOES.h" 72 73 #include "JSWebKitCSSMatrix.h" … … 93 94 #include "WebGLProgram.h" 94 95 #include "WebGLRenderingContextBase.h" 96 #include "WebGLVertexArrayObject.h" 95 97 #include "WebGLVertexArrayObjectOES.h" 96 98 #include <runtime/Error.h> … … 151 153 case WebGLGetInfo::kTypeWebGLUnsignedIntArray: 152 154 return toJS(exec, globalObject, info.getWebGLUnsignedIntArray()); 155 case WebGLGetInfo::kTypeWebGLVertexArrayObject: 156 return toJS(exec, globalObject, info.getWebGLVertexArrayObject()); 153 157 case WebGLGetInfo::kTypeWebGLVertexArrayObjectOES: 154 158 return toJS(exec, globalObject, info.getWebGLVertexArrayObjectOES()); -
trunk/Source/WebCore/html/canvas/OESVertexArrayObject.cpp
r178674 r181571 31 31 32 32 #include "Extensions3D.h" 33 #include "WebGLRenderingContext.h" 33 34 34 35 namespace WebCore { … … 53 54 return 0; 54 55 55 RefPtr<WebGLVertexArrayObjectOES> o = WebGLVertexArrayObjectOES::create(m_context, WebGLVertexArrayObjectOES::V aoTypeUser);56 RefPtr<WebGLVertexArrayObjectOES> o = WebGLVertexArrayObjectOES::create(m_context, WebGLVertexArrayObjectOES::VAOTypeUser); 56 57 m_context->addContextObject(o.get()); 57 58 return o.release(); … … 63 64 return; 64 65 65 if (!arrayObject->isDefaultObject() && arrayObject == m_context->m_boundVertexArrayObject)66 m_context->setBoundVertexArrayObject(0);66 if (!arrayObject->isDefaultObject() && arrayObject == static_cast<WebGLRenderingContext*>(m_context)->m_boundVertexArrayObject) 67 static_cast<WebGLRenderingContext*>(m_context)->setBoundVertexArrayObject(0); 67 68 68 69 arrayObject->deleteObject(m_context->graphicsContext3D()); … … 97 98 98 99 arrayObject->setHasEverBeenBound(); 99 m_context->setBoundVertexArrayObject(arrayObject);100 static_cast<WebGLRenderingContext*>(m_context)->setBoundVertexArrayObject(arrayObject); 100 101 } else { 101 102 extensions->bindVertexArrayOES(0); 102 m_context->setBoundVertexArrayObject(0);103 static_cast<WebGLRenderingContext*>(m_context)->setBoundVertexArrayObject(0); 103 104 } 104 105 } -
trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp
r181468 r181571 61 61 : WebGLRenderingContextBase(passedCanvas, attributes) 62 62 { 63 initializeShaderExtensions();64 63 } 65 64 … … 68 67 { 69 68 initializeShaderExtensions(); 69 initializeVertexArrayObjects(); 70 } 71 72 void WebGL2RenderingContext::initializeVertexArrayObjects() 73 { 74 m_defaultVertexArrayObject = WebGLVertexArrayObject::create(this, WebGLVertexArrayObject::VAOTypeDefault); 75 addContextObject(m_defaultVertexArrayObject.get()); 76 m_boundVertexArrayObject = m_defaultVertexArrayObject; 77 if (!isGLES2Compliant()) 78 initVertexAttrib0(); 70 79 } 71 80 … … 769 778 PassRefPtr<WebGLVertexArrayObject> WebGL2RenderingContext::createVertexArray() 770 779 { 771 return nullptr; 772 } 773 774 void WebGL2RenderingContext::deleteVertexArray(WebGLVertexArrayObject* vertexArray) 775 { 776 UNUSED_PARAM(vertexArray); 777 } 778 779 GC3Dboolean WebGL2RenderingContext::isVertexArray(WebGLVertexArrayObject* vertexArray) 780 { 781 UNUSED_PARAM(vertexArray); 782 return false; 783 } 784 785 void WebGL2RenderingContext::bindVertexArray(WebGLVertexArrayObject* vertexArray) 786 { 787 UNUSED_PARAM(vertexArray); 780 if (isContextLost()) 781 return 0; 782 783 RefPtr<WebGLVertexArrayObject> o = WebGLVertexArrayObject::create(this, WebGLVertexArrayObject::VAOTypeUser); 784 addContextObject(o.get()); 785 return o.release(); 786 } 787 788 void WebGL2RenderingContext::deleteVertexArray(WebGLVertexArrayObject* arrayObject) 789 { 790 if (!arrayObject || isContextLost()) 791 return; 792 793 if (arrayObject->isDeleted()) 794 return; 795 796 if (!arrayObject->isDefaultObject() && arrayObject == m_boundVertexArrayObject) 797 setBoundVertexArrayObject(0); 798 799 arrayObject->deleteObject(graphicsContext3D()); 800 } 801 802 GC3Dboolean WebGL2RenderingContext::isVertexArray(WebGLVertexArrayObject* arrayObject) 803 { 804 if (!arrayObject || isContextLost()) 805 return 0; 806 807 if (!arrayObject->hasEverBeenBound() || !arrayObject->validate(0, this)) 808 return 0; 809 810 return m_context->isVertexArray(arrayObject->object()); 811 } 812 813 void WebGL2RenderingContext::bindVertexArray(WebGLVertexArrayObject* arrayObject) 814 { 815 if (isContextLost()) 816 return; 817 818 if (arrayObject && (arrayObject->isDeleted() || !arrayObject->validate(0, this) || !m_contextObjects.contains(arrayObject))) { 819 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 820 return; 821 } 822 if (arrayObject && !arrayObject->isDefaultObject() && arrayObject->object()) { 823 m_context->bindVertexArray(arrayObject->object()); 824 825 arrayObject->setHasEverBeenBound(); 826 setBoundVertexArrayObject(arrayObject); 827 } else { 828 m_context->bindVertexArray(m_defaultVertexArrayObject->object()); 829 setBoundVertexArrayObject(m_defaultVertexArrayObject); 830 } 788 831 } 789 832 … … 2155 2198 case GraphicsContext3D::UNIFORM_BUFFER_OFFSET_ALIGNMENT: 2156 2199 return getIntParameter(pname); 2200 case GraphicsContext3D::VERTEX_ARRAY_BINDING: { 2201 if (!m_boundVertexArrayObject->isDefaultObject()) 2202 return WebGLGetInfo(PassRefPtr<WebGLVertexArrayObject>(static_cast<WebGLVertexArrayObject*>(m_boundVertexArrayObject.get()))); 2203 return WebGLGetInfo(); 2204 } 2205 break; 2157 2206 case GraphicsContext3D::COPY_READ_BUFFER: 2158 2207 case GraphicsContext3D::COPY_WRITE_BUFFER: … … 2182 2231 case GraphicsContext3D::TRANSFORM_FEEDBACK_BUFFER_BINDING: 2183 2232 case GraphicsContext3D::UNIFORM_BUFFER_BINDING: 2184 case GraphicsContext3D::VERTEX_ARRAY_BINDING:2185 2233 synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "getParameter", "parameter name not yet supported"); 2186 2234 return WebGLGetInfo(); -
trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.h
r180285 r181571 190 190 191 191 protected: 192 virtual void initializeVertexArrayObjects() override; 192 193 virtual bool validateIndexArrayConservative(GC3Denum type, unsigned& numElementsRequired) override; 193 194 virtual bool validateDrawElements(const char* functionName, GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset, unsigned& numElements, GC3Dsizei primitiveCount) override; -
trunk/Source/WebCore/html/canvas/WebGLGetInfo.cpp
r179530 r181571 31 31 #include "WebGLGetInfo.h" 32 32 33 #include "WebGLBuffer.h"34 #include "WebGLFramebuffer.h"35 #include "WebGLProgram.h"36 #include "WebGLRenderbuffer.h"37 #include "WebGLTexture.h"38 #include "WebGLVertexArrayObjectOES.h"39 33 #include <runtime/Float32Array.h> 40 34 #include <runtime/Int32Array.h> … … 237 231 , m_unsignedInt(0) 238 232 , m_int64(0) 233 , m_webglVertexArrayObjectOES(value) 234 { 235 } 236 237 WebGLGetInfo::WebGLGetInfo(PassRefPtr<WebGLVertexArrayObject> value) 238 : m_type(kTypeWebGLVertexArrayObject) 239 , m_bool(false) 240 , m_float(0) 241 , m_int(0) 242 , m_unsignedInt(0) 243 , m_int64(0) 239 244 , m_webglVertexArrayObject(value) 240 245 { … … 349 354 { 350 355 ASSERT(getType() == kTypeWebGLVertexArrayObjectOES); 356 return m_webglVertexArrayObjectOES; 357 } 358 359 PassRefPtr<WebGLVertexArrayObject> WebGLGetInfo::getWebGLVertexArrayObject() const 360 { 361 ASSERT(getType() == kTypeWebGLVertexArrayObject); 351 362 return m_webglVertexArrayObject; 352 363 } -
trunk/Source/WebCore/html/canvas/WebGLGetInfo.h
r179530 r181571 33 33 #include "WebGLRenderbuffer.h" 34 34 #include "WebGLTexture.h" 35 #include "WebGLVertexArrayObject.h" 35 36 #include "WebGLVertexArrayObjectOES.h" 36 37 #include <runtime/Float32Array.h> … … 71 72 kTypeWebGLUnsignedIntArray, 72 73 kTypeWebGLVertexArrayObjectOES, 74 kTypeWebGLVertexArrayObject, 73 75 }; 74 76 … … 94 96 explicit WebGLGetInfo(PassRefPtr<Uint32Array> value); 95 97 explicit WebGLGetInfo(PassRefPtr<WebGLVertexArrayObjectOES> value); 98 explicit WebGLGetInfo(PassRefPtr<WebGLVertexArrayObject> value); 96 99 97 100 ~WebGLGetInfo(); … … 118 121 PassRefPtr<Uint32Array> getWebGLUnsignedIntArray() const; 119 122 PassRefPtr<WebGLVertexArrayObjectOES> getWebGLVertexArrayObjectOES() const; 123 PassRefPtr<WebGLVertexArrayObject> getWebGLVertexArrayObject() const; 120 124 121 125 private: … … 139 143 RefPtr<Uint8Array> m_webglUnsignedByteArray; 140 144 RefPtr<Uint32Array> m_webglUnsignedIntArray; 141 RefPtr<WebGLVertexArrayObjectOES> m_webglVertexArrayObject; 145 RefPtr<WebGLVertexArrayObjectOES> m_webglVertexArrayObjectOES; 146 RefPtr<WebGLVertexArrayObject> m_webglVertexArrayObject; 142 147 }; 143 148 -
trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
r181468 r181571 57 57 #include "WebGLDrawBuffers.h" 58 58 #include "WebGLLoseContext.h" 59 #include "WebGLVertexArrayObjectOES.h" 59 60 60 61 namespace WebCore { … … 68 69 GraphicsContext3D::Attributes attributes) : WebGLRenderingContextBase(passedCanvas, context, attributes) 69 70 { 70 } 71 71 initializeVertexArrayObjects(); 72 } 73 74 void WebGLRenderingContext::initializeVertexArrayObjects() 75 { 76 m_defaultVertexArrayObject = WebGLVertexArrayObjectOES::create(this, WebGLVertexArrayObjectOES::VAOTypeDefault); 77 addContextObject(m_defaultVertexArrayObject.get()); 78 m_boundVertexArrayObject = m_defaultVertexArrayObject; 79 if (!isGLES2Compliant()) 80 initVertexAttrib0(); 81 } 72 82 73 83 WebGLExtension* WebGLRenderingContext::getExtension(const String& name) … … 1068 1078 if (m_oesVertexArrayObject) { 1069 1079 if (!m_boundVertexArrayObject->isDefaultObject()) 1070 return WebGLGetInfo(PassRefPtr<WebGLVertexArrayObjectOES>( m_boundVertexArrayObject));1080 return WebGLGetInfo(PassRefPtr<WebGLVertexArrayObjectOES>(static_cast<WebGLVertexArrayObjectOES*>(m_boundVertexArrayObject.get()))); 1071 1081 return WebGLGetInfo(); 1072 1082 } -
trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h
r180285 r181571 62 62 63 63 protected: 64 virtual void initializeVertexArrayObjects() override; 64 65 virtual bool validateIndexArrayConservative(GC3Denum type, unsigned& numElementsRequired) override; 65 66 virtual bool validateDrawElements(const char* functionName, GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset, unsigned& numElements, GC3Dsizei primitiveCount) override; -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
r181468 r181571 530 530 m_drawBuffersWebGLRequirementsChecked = false; 531 531 m_drawBuffersSupported = false; 532 533 m_defaultVertexArrayObject = WebGLVertexArrayObjectOES::create(this, WebGLVertexArrayObjectOES::VaoTypeDefault);534 addContextObject(m_defaultVertexArrayObject.get());535 m_boundVertexArrayObject = m_defaultVertexArrayObject;536 532 537 533 m_vertexAttribValue.resize(m_maxVertexAttribs); … … 539 535 if (!isGLES2NPOTStrict()) 540 536 createFallbackBlackTextures1x1(); 541 if (!isGLES2Compliant())542 initVertexAttrib0();543 537 544 538 IntSize canvasSize = clampedCanvasSize(); … … 1601 1595 } 1602 1596 1603 WebGLVertexArrayObject OES::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(index);1597 WebGLVertexArrayObjectBase::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(index); 1604 1598 state.enabled = false; 1605 1599 … … 1723 1717 int loc = m_currentProgram->getActiveAttribLocation(i); 1724 1718 if (loc >= 0 && loc < static_cast<int>(m_maxVertexAttribs)) { 1725 const WebGLVertexArrayObject OES::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(loc);1719 const WebGLVertexArrayObjectBase::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(loc); 1726 1720 if (state.enabled) { 1727 1721 sawEnabledAttrib = true; … … 1892 1886 } 1893 1887 1894 WebGLVertexArrayObject OES::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(index);1888 WebGLVertexArrayObjectBase::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(index); 1895 1889 state.enabled = true; 1896 1890 … … 2520 2514 } 2521 2515 2522 const WebGLVertexArrayObject OES::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(index);2516 const WebGLVertexArrayObjectBase::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(index); 2523 2517 2524 2518 if (m_angleInstancedArrays && pname == GraphicsContext3D::VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE) … … 4601 4595 void WebGLRenderingContextBase::initVertexAttrib0() 4602 4596 { 4603 WebGLVertexArrayObject OES::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(0);4597 WebGLVertexArrayObjectBase::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(0); 4604 4598 4605 4599 m_vertexAttrib0Buffer = createBuffer(); … … 4621 4615 bool WebGLRenderingContextBase::simulateVertexAttrib0(GC3Dsizei numVertex) 4622 4616 { 4623 const WebGLVertexArrayObject OES::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(0);4617 const WebGLVertexArrayObjectBase::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(0); 4624 4618 const VertexAttribValue& attribValue = m_vertexAttribValue[0]; 4625 4619 if (!m_currentProgram) … … 4666 4660 void WebGLRenderingContextBase::restoreStatesAfterVertexAttrib0Simulation() 4667 4661 { 4668 const WebGLVertexArrayObject OES::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(0);4662 const WebGLVertexArrayObjectBase::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(0); 4669 4663 if (state.bufferBinding != m_vertexAttrib0Buffer) { 4670 4664 m_context->bindBuffer(GraphicsContext3D::ARRAY_BUFFER, objectOrZero(state.bufferBinding.get())); … … 4756 4750 setupFlags(); 4757 4751 initializeNewContext(); 4752 initializeVertexArrayObjects(); 4758 4753 canvas()->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextrestoredEvent, false, true, "")); 4759 4754 } -
trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h
r181468 r181571 374 374 friend class WebGLRenderingContextErrorMessageCallback; 375 375 friend class WebGLVertexArrayObjectOES; 376 friend class WebGLVertexArrayObject; 377 friend class WebGLVertexArrayObjectBase; 376 378 377 379 virtual void initializeNewContext(); 380 virtual void initializeVertexArrayObjects() = 0; 378 381 void setupFlags(); 379 382 … … 448 451 // List of bound VBO's. Used to maintain info about sizes for ARRAY_BUFFER and stored values for ELEMENT_ARRAY_BUFFER 449 452 RefPtr<WebGLBuffer> m_boundArrayBuffer; 450 451 RefPtr<WebGLVertexArrayObject OES> m_defaultVertexArrayObject;452 RefPtr<WebGLVertexArrayObject OES> m_boundVertexArrayObject;453 void setBoundVertexArrayObject(PassRefPtr<WebGLVertexArrayObject OES> arrayObject)453 454 RefPtr<WebGLVertexArrayObjectBase> m_defaultVertexArrayObject; 455 RefPtr<WebGLVertexArrayObjectBase> m_boundVertexArrayObject; 456 void setBoundVertexArrayObject(PassRefPtr<WebGLVertexArrayObjectBase> arrayObject) 454 457 { 455 458 if (arrayObject) -
trunk/Source/WebCore/html/canvas/WebGLVertexArrayObject.cpp
r178963 r181571 29 29 #include "WebGLVertexArrayObject.h" 30 30 31 #include "WebGL2RenderingContext.h" 31 32 #include "WebGLContextGroup.h" 32 #include "WebGLRenderingContextBase.h"33 33 34 34 namespace WebCore { 35 35 36 PassRefPtr<WebGLVertexArrayObject> WebGLVertexArrayObject::create(WebGLRenderingContextBase* ctx )36 PassRefPtr<WebGLVertexArrayObject> WebGLVertexArrayObject::create(WebGLRenderingContextBase* ctx, VAOType type) 37 37 { 38 return adoptRef(new WebGLVertexArrayObject(ctx ));38 return adoptRef(new WebGLVertexArrayObject(ctx, type)); 39 39 } 40 40 … … 44 44 } 45 45 46 WebGLVertexArrayObject::WebGLVertexArrayObject(WebGLRenderingContextBase* ctx )47 : WebGL SharedObject(ctx)46 WebGLVertexArrayObject::WebGLVertexArrayObject(WebGLRenderingContextBase* ctx, VAOType type) 47 : WebGLVertexArrayObjectBase(ctx, type) 48 48 { 49 // FIXME: Call createVertexArray from GraphicsContext3D. 49 switch (m_type) { 50 case VAOTypeDefault: 51 break; 52 default: 53 setObject(context()->graphicsContext3D()->createVertexArray()); 54 break; 55 } 50 56 } 51 57 52 58 void WebGLVertexArrayObject::deleteObjectImpl(GraphicsContext3D* context3d, Platform3DObject object) 53 59 { 54 UNUSED_PARAM(context3d); 55 UNUSED_PARAM(object); 56 // FIXME: Call deleteVertexArray from GraphicsContext3D. 60 switch (m_type) { 61 case VAOTypeDefault: 62 break; 63 default: 64 context3d->deleteVertexArray(object); 65 break; 66 } 67 68 if (m_boundElementArrayBuffer) 69 m_boundElementArrayBuffer->onDetached(context3d); 70 71 for (size_t i = 0; i < m_vertexAttribState.size(); ++i) { 72 VertexAttribState& state = m_vertexAttribState[i]; 73 if (state.bufferBinding) 74 state.bufferBinding->onDetached(context3d); 75 } 57 76 } 58 77 -
trunk/Source/WebCore/html/canvas/WebGLVertexArrayObject.h
r178963 r181571 27 27 #define WebGLVertexArrayObject_h 28 28 29 #include "WebGLSharedObject.h" 29 #include "WebGLBuffer.h" 30 #include "WebGLContextObject.h" 31 #include "WebGLVertexArrayObjectBase.h" 30 32 31 33 #include <wtf/PassRefPtr.h> … … 34 36 namespace WebCore { 35 37 36 class WebGLVertexArrayObject final : public WebGLSharedObject { 38 class WebGL2RenderingContext; 39 40 class WebGLVertexArrayObject final : public WebGLVertexArrayObjectBase { 37 41 public: 42 static PassRefPtr<WebGLVertexArrayObject> create(WebGLRenderingContextBase*, VAOType); 38 43 virtual ~WebGLVertexArrayObject(); 39 40 static PassRefPtr<WebGLVertexArrayObject> create(WebGLRenderingContextBase*); 41 42 protected: 43 WebGLVertexArrayObject(WebGLRenderingContextBase*); 44 44 private: 45 WebGLVertexArrayObject(WebGLRenderingContextBase*, VAOType); 46 bool isTransformFeedback() const { return true; } 45 47 virtual void deleteObjectImpl(GraphicsContext3D*, Platform3DObject) override; 46 47 private:48 virtual bool isTransformFeedback() const override { return true; }49 48 }; 50 49 -
trunk/Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.cpp
r178674 r181571 35 35 namespace WebCore { 36 36 37 PassRefPtr<WebGLVertexArrayObjectOES> WebGLVertexArrayObjectOES::create(WebGLRenderingContextBase* ctx, V aoType type)37 PassRefPtr<WebGLVertexArrayObjectOES> WebGLVertexArrayObjectOES::create(WebGLRenderingContextBase* ctx, VAOType type) 38 38 { 39 39 return adoptRef(new WebGLVertexArrayObjectOES(ctx, type)); 40 40 } 41 41 42 WebGLVertexArrayObjectOES::WebGLVertexArrayObjectOES(WebGLRenderingContextBase* ctx, VaoType type) 43 : WebGLContextObject(ctx) 44 , m_type(type) 45 , m_hasEverBeenBound(false) 46 , m_boundElementArrayBuffer(0) 42 WebGLVertexArrayObjectOES::WebGLVertexArrayObjectOES(WebGLRenderingContextBase* ctx, VAOType type) 43 : WebGLVertexArrayObjectBase(ctx, type) 47 44 { 48 m_vertexAttribState.resize(ctx->getMaxVertexAttribs());49 50 45 Extensions3D* extensions = context()->graphicsContext3D()->getExtensions(); 51 46 switch (m_type) { 52 case V aoTypeDefault:47 case VAOTypeDefault: 53 48 break; 54 49 default: … … 67 62 Extensions3D* extensions = context3d->getExtensions(); 68 63 switch (m_type) { 69 case V aoTypeDefault:64 case VAOTypeDefault: 70 65 break; 71 66 default: … … 83 78 } 84 79 } 85 86 void WebGLVertexArrayObjectOES::setElementArrayBuffer(PassRefPtr<WebGLBuffer> buffer)87 {88 if (buffer)89 buffer->onAttached();90 if (m_boundElementArrayBuffer)91 m_boundElementArrayBuffer->onDetached(context()->graphicsContext3D());92 m_boundElementArrayBuffer = buffer;93 94 }95 96 void WebGLVertexArrayObjectOES::setVertexAttribState(97 GC3Duint index, GC3Dsizei bytesPerElement, GC3Dint size, GC3Denum type, GC3Dboolean normalized, GC3Dsizei stride, GC3Dintptr offset, PassRefPtr<WebGLBuffer> buffer)98 {99 GC3Dsizei validatedStride = stride ? stride : bytesPerElement;100 101 VertexAttribState& state = m_vertexAttribState[index];102 103 if (buffer)104 buffer->onAttached();105 if (state.bufferBinding)106 state.bufferBinding->onDetached(context()->graphicsContext3D());107 108 state.bufferBinding = buffer;109 state.bytesPerElement = bytesPerElement;110 state.size = size;111 state.type = type;112 state.normalized = normalized;113 state.stride = validatedStride;114 state.originalStride = stride;115 state.offset = offset;116 }117 118 void WebGLVertexArrayObjectOES::unbindBuffer(PassRefPtr<WebGLBuffer> buffer)119 {120 if (m_boundElementArrayBuffer == buffer) {121 m_boundElementArrayBuffer->onDetached(context()->graphicsContext3D());122 m_boundElementArrayBuffer = 0;123 }124 125 for (size_t i = 0; i < m_vertexAttribState.size(); ++i) {126 VertexAttribState& state = m_vertexAttribState[i];127 if (state.bufferBinding == buffer) {128 buffer->onDetached(context()->graphicsContext3D());129 130 if (!i && !context()->isGLES2Compliant()) {131 state.bufferBinding = context()->m_vertexAttrib0Buffer;132 state.bufferBinding->onAttached();133 state.bytesPerElement = 0;134 state.size = 4;135 state.type = GraphicsContext3D::FLOAT;136 state.normalized = false;137 state.stride = 16;138 state.originalStride = 0;139 state.offset = 0;140 } else141 state.bufferBinding = 0;142 }143 }144 }145 146 void WebGLVertexArrayObjectOES::setVertexAttribDivisor(GC3Duint index, GC3Duint divisor)147 {148 VertexAttribState& state = m_vertexAttribState[index];149 state.divisor = divisor;150 }151 152 80 } 153 81 -
trunk/Source/WebCore/html/canvas/WebGLVertexArrayObjectOES.h
r178674 r181571 29 29 #include "WebGLBuffer.h" 30 30 #include "WebGLContextObject.h" 31 #include "WebGLVertexArrayObjectBase.h" 31 32 32 33 #include <wtf/PassRefPtr.h> … … 34 35 namespace WebCore { 35 36 36 class WebGLVertexArrayObjectOES final : public WebGL ContextObject{37 class WebGLVertexArrayObjectOES final : public WebGLVertexArrayObjectBase { 37 38 public: 38 enum VaoType { 39 VaoTypeDefault, 40 VaoTypeUser, 41 }; 42 39 static PassRefPtr<WebGLVertexArrayObjectOES> create(WebGLRenderingContextBase*, VAOType); 43 40 virtual ~WebGLVertexArrayObjectOES(); 44 45 static PassRefPtr<WebGLVertexArrayObjectOES> create(WebGLRenderingContextBase*, VaoType);46 47 // Cached values for vertex attrib range checks48 struct VertexAttribState {49 VertexAttribState()50 : enabled(false)51 , bytesPerElement(0)52 , size(4)53 , type(GraphicsContext3D::FLOAT)54 , normalized(false)55 , stride(16)56 , originalStride(0)57 , offset(0)58 , divisor(0)59 {60 }61 62 bool isBound() const { return bufferBinding && bufferBinding->object(); }63 bool validateBinding() const { return !enabled || isBound(); }64 65 bool enabled;66 RefPtr<WebGLBuffer> bufferBinding;67 GC3Dsizei bytesPerElement;68 GC3Dint size;69 GC3Denum type;70 bool normalized;71 GC3Dsizei stride;72 GC3Dsizei originalStride;73 GC3Dintptr offset;74 GC3Duint divisor;75 };76 77 bool isDefaultObject() const { return m_type == VaoTypeDefault; }78 79 bool hasEverBeenBound() const { return object() && m_hasEverBeenBound; }80 void setHasEverBeenBound() { m_hasEverBeenBound = true; }81 82 PassRefPtr<WebGLBuffer> getElementArrayBuffer() const { return m_boundElementArrayBuffer; }83 void setElementArrayBuffer(PassRefPtr<WebGLBuffer>);84 85 VertexAttribState& getVertexAttribState(int index) { return m_vertexAttribState[index]; }86 void setVertexAttribState(GC3Duint, GC3Dsizei, GC3Dint, GC3Denum, GC3Dboolean, GC3Dsizei, GC3Dintptr, PassRefPtr<WebGLBuffer>);87 void unbindBuffer(PassRefPtr<WebGLBuffer>);88 89 void setVertexAttribDivisor(GC3Duint index, GC3Duint divisor);90 91 41 private: 92 WebGLVertexArrayObjectOES(WebGLRenderingContextBase*, VaoType); 93 42 WebGLVertexArrayObjectOES(WebGLRenderingContextBase*, VAOType); 94 43 virtual void deleteObjectImpl(GraphicsContext3D*, Platform3DObject) override; 95 96 VaoType m_type;97 bool m_hasEverBeenBound;98 RefPtr<WebGLBuffer> m_boundElementArrayBuffer;99 Vector<VertexAttribState> m_vertexAttribState;100 44 }; 101 45 -
trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h
r181468 r181571 1119 1119 void vertexAttribDivisor(GC3Duint index, GC3Duint divisor); 1120 1120 1121 // VertexArrayOject calls 1122 Platform3DObject createVertexArray(); 1123 void deleteVertexArray(Platform3DObject); 1124 GC3Dboolean isVertexArray(Platform3DObject); 1125 void bindVertexArray(Platform3DObject); 1126 1121 1127 #if PLATFORM(GTK) || PLATFORM(EFL) || USE(CAIRO) 1122 1128 void paintToCanvas(const unsigned char* imagePixels, int imageWidth, int imageHeight, -
trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
r181468 r181571 1358 1358 } 1359 1359 1360 Platform3DObject GraphicsContext3D::createVertexArray() 1361 { 1362 makeContextCurrent(); 1363 GLuint array = 0; 1364 #if (PLATFORM(GTK) || PLATFORM(EFL) || PLATFORM(WIN) || PLATFORM(IOS)) 1365 glGenVertexArrays(1, &array); 1366 #elif defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object 1367 glGenVertexArraysAPPLE(1, &array); 1368 #endif 1369 return array; 1370 } 1371 1372 void GraphicsContext3D::deleteVertexArray(Platform3DObject array) 1373 { 1374 if (!array) 1375 return; 1376 1377 makeContextCurrent(); 1378 #if (PLATFORM(GTK) || PLATFORM(EFL) || PLATFORM(WIN) || PLATFORM(IOS)) 1379 glDeleteVertexArrays(1, &array); 1380 #elif defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object 1381 glDeleteVertexArraysAPPLE(1, &array); 1382 #endif 1383 } 1384 1385 GC3Dboolean GraphicsContext3D::isVertexArray(Platform3DObject array) 1386 { 1387 if (!array) 1388 return GL_FALSE; 1389 1390 makeContextCurrent(); 1391 #if (PLATFORM(GTK) || PLATFORM(EFL) || PLATFORM(WIN) || PLATFORM(IOS)) 1392 return glIsVertexArray(array); 1393 #elif defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object 1394 return glIsVertexArrayAPPLE(array); 1395 #endif 1396 return GL_FALSE; 1397 } 1398 1399 void GraphicsContext3D::bindVertexArray(Platform3DObject array) 1400 { 1401 makeContextCurrent(); 1402 #if (PLATFORM(GTK) || PLATFORM(EFL) || PLATFORM(WIN) || PLATFORM(IOS)) 1403 glBindVertexArray(array); 1404 #elif defined(GL_APPLE_vertex_array_object) && GL_APPLE_vertex_array_object 1405 glBindVertexArrayAPPLE(array); 1406 #else 1407 UNUSED_PARAM(array); 1408 #endif 1409 } 1410 1360 1411 void GraphicsContext3D::getBooleanv(GC3Denum pname, GC3Dboolean* value) 1361 1412 {
Note:
See TracChangeset
for help on using the changeset viewer.