Changeset 73806 in webkit
- Timestamp:
- Dec 10, 2010 2:50:02 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 added
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/CMakeLists.txt
r73756 r73806 288 288 html/canvas/Int32Array.idl 289 289 html/canvas/Int8Array.idl 290 html/canvas/OESTextureFloat.idl 290 291 html/canvas/Uint16Array.idl 291 292 html/canvas/Uint32Array.idl -
trunk/WebCore/ChangeLog
r73805 r73806 1 2010-12-10 Kenneth Russell <kbr@google.com> 2 3 Reviewed by James Robinson. 4 5 Implement extension entry points and remove EXTENSIONS enum 6 https://bugs.webkit.org/show_bug.cgi?id=40316 7 8 Implemented WebGLRenderingContext's getSupportedExtensions and 9 getExtensions entry points, and, to verify them, added support for 10 the first specified WebGL extension, OES_texture_float. This 11 extension is now advertised in the Chromium and WebKit ports when 12 the underlying hardware supports it. 13 14 The new OES_texture_float test in the WebGL conformance suite 15 verifies the allocation and population of floating point textures, 16 and their use as render targets. However, because this extension 17 is optional, it is not easily testable with a layout test; there 18 is only one set of expectations for a given test, and two would be 19 needed, one when the extension is available and one when it is not. 20 21 Tested with the oes-texture-float.html WebGL conformance test in 22 Chromium and WebKit on Mac OS X on hardware that supports the 23 extension. Also verified with a configuration that does not 24 advertise the extension that this same test passes. 25 26 * CMakeLists.txt: 27 * DerivedSources.make: 28 * GNUmakefile.am: 29 * WebCore.gypi: 30 * WebCore.pri: 31 * WebCore.pro: 32 * WebCore.xcodeproj/project.pbxproj: 33 * bindings/js/JSWebGLRenderingContextCustom.cpp: 34 (WebCore::toJS): 35 (WebCore::JSWebGLRenderingContext::markChildren): 36 (WebCore::JSWebGLRenderingContext::getExtension): 37 (WebCore::JSWebGLRenderingContext::getSupportedExtensions): 38 * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp: 39 (WebCore::toV8Object): 40 (WebCore::V8WebGLRenderingContext::getExtensionCallback): 41 (WebCore::V8WebGLRenderingContext::getSupportedExtensionsCallback): 42 * html/canvas/OESTextureFloat.cpp: Added. 43 (WebCore::OESTextureFloat::OESTextureFloat): 44 (WebCore::OESTextureFloat::~OESTextureFloat): 45 (WebCore::OESTextureFloat::getName): 46 (WebCore::OESTextureFloat::create): 47 * html/canvas/OESTextureFloat.h: Added. 48 * html/canvas/OESTextureFloat.idl: Added. 49 * html/canvas/WebGLExtension.cpp: Added. 50 (WebCore::WebGLExtension::WebGLExtension): 51 (WebCore::WebGLExtension::~WebGLExtension): 52 * html/canvas/WebGLExtension.h: Added. 53 * html/canvas/WebGLRenderingContext.cpp: 54 (WebCore::WebGLRenderingContext::getExtension): 55 (WebCore::WebGLRenderingContext::getSupportedExtensions): 56 (WebCore::WebGLRenderingContext::validateTexFuncFormatAndType): 57 (WebCore::WebGLRenderingContext::validateTexFuncData): 58 (WebCore::WebGLRenderingContext::getNumberOfExtensions): 59 (WebCore::WebGLRenderingContext::getExtensionNumber): 60 * html/canvas/WebGLRenderingContext.h: 61 * html/canvas/WebGLRenderingContext.idl: 62 * platform/graphics/Extensions3D.h: 63 * platform/graphics/GraphicsContext3D.cpp: 64 (WebCore::GraphicsContext3D::computeFormatAndTypeParameters): 65 (WebCore::GraphicsContext3D::extractTextureData): 66 (WebCore::doUnpackingAndPacking): 67 (WebCore::doPacking): 68 (WebCore::doFloatingPointPacking): 69 (WebCore::GraphicsContext3D::packPixels): 70 * platform/graphics/GraphicsContext3D.h: 71 * platform/graphics/chromium/Extensions3DChromium.h: 72 * platform/graphics/opengl/Extensions3DOpenGL.cpp: 73 (WebCore::Extensions3DOpenGL::supports): 74 (WebCore::Extensions3DOpenGL::ensureEnabled): 75 * platform/graphics/opengl/Extensions3DOpenGL.h: 76 * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp: 77 (WebCore::GraphicsContext3D::texImage2D): 78 * platform/graphics/qt/Extensions3DQt.cpp: 79 (WebCore::Extensions3DQt::ensureEnabled): 80 * platform/graphics/qt/Extensions3DQt.h: 81 1 82 2010-12-10 Darin Adler <darin@apple.com> 2 83 -
trunk/WebCore/DerivedSources.make
r73346 r73806 311 311 Notification \ 312 312 NotificationCenter \ 313 OESTextureFloat \ 313 314 OverflowEvent \ 314 315 PageTransitionEvent \ -
trunk/WebCore/GNUmakefile.am
r73756 r73806 474 474 DerivedSources/WebCore/JSNotification.cpp \ 475 475 DerivedSources/WebCore/JSNotification.h \ 476 DerivedSources/WebCore/JSOESTextureFloat.cpp \ 477 DerivedSources/WebCore/JSOESTextureFloat.h \ 476 478 DerivedSources/WebCore/JSOverflowEvent.cpp \ 477 479 DerivedSources/WebCore/JSOverflowEvent.h \ … … 1566 1568 WebCore/html/canvas/Int8Array.cpp \ 1567 1569 WebCore/html/canvas/Int8Array.h \ 1570 WebCore/html/canvas/OESTextureFloat.cpp \ 1571 WebCore/html/canvas/OESTextureFloat.h \ 1568 1572 WebCore/html/canvas/Uint16Array.cpp \ 1569 1573 WebCore/html/canvas/Uint16Array.h \ -
trunk/WebCore/WebCore.gypi
r73756 r73806 214 214 'html/canvas/Int32Array.idl', 215 215 'html/canvas/Int8Array.idl', 216 'html/canvas/OESTextureFloat.idl', 216 217 'html/canvas/Uint16Array.idl', 217 218 'html/canvas/Uint32Array.idl', … … 1914 1915 'html/canvas/Int8Array.h', 1915 1916 'html/canvas/IntegralTypedArrayBase.h', 1917 'html/canvas/OESTextureFloat.cpp', 1918 'html/canvas/OESTextureFloat.h', 1916 1919 'html/canvas/TypedArrayBase.h', 1917 1920 'html/canvas/Uint16Array.cpp', … … 1927 1930 'html/canvas/WebGLContextEvent.cpp', 1928 1931 'html/canvas/WebGLContextEvent.h', 1932 'html/canvas/WebGLExtension.cpp', 1933 'html/canvas/WebGLExtension.h', 1929 1934 'html/canvas/WebGLFramebuffer.cpp', 1930 1935 'html/canvas/WebGLFramebuffer.h', -
trunk/WebCore/WebCore.pri
r73358 r73806 192 192 html/canvas/CanvasRenderingContext.idl \ 193 193 html/canvas/CanvasRenderingContext2D.idl \ 194 html/canvas/OESTextureFloat.idl \ 194 195 html/canvas/WebGLActiveInfo.idl \ 195 196 html/canvas/WebGLBuffer.idl \ -
trunk/WebCore/WebCore.pro
r73756 r73806 3729 3729 html/canvas/WebGLContextAttributes.h \ 3730 3730 html/canvas/Float32Array.h \ 3731 html/canvas/WebGLExtension.h \ 3731 3732 html/canvas/WebGLFramebuffer.h \ 3732 3733 html/canvas/WebGLGetInfo.h \ … … 3737 3738 html/canvas/WebGLShader.h \ 3738 3739 html/canvas/Int16Array.h \ 3740 html/canvas/OESTextureFloat.h \ 3739 3741 html/canvas/WebGLTexture.h \ 3740 3742 html/canvas/WebGLUniformLocation.h \ … … 3769 3771 html/canvas/WebGLContextAttributes.cpp \ 3770 3772 html/canvas/Float32Array.cpp \ 3773 html/canvas/WebGLExtension.cpp \ 3771 3774 html/canvas/WebGLFramebuffer.cpp \ 3772 3775 html/canvas/WebGLGetInfo.cpp \ … … 3777 3780 html/canvas/WebGLShader.cpp \ 3778 3781 html/canvas/Int16Array.cpp \ 3782 html/canvas/OESTextureFloat.cpp \ 3779 3783 html/canvas/WebGLTexture.cpp \ 3780 3784 html/canvas/WebGLUniformLocation.cpp \ -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r73756 r73806 1524 1524 6E96BB1C11986EE2007D94CD /* IntegralTypedArrayBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E96BB1A11986EE1007D94CD /* IntegralTypedArrayBase.h */; }; 1525 1525 6E96BB1D11986EE2007D94CD /* TypedArrayBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E96BB1B11986EE1007D94CD /* TypedArrayBase.h */; }; 1526 6EBF0E4812A8926100DB1709 /* OESTextureFloat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6EBF0E4512A8926100DB1709 /* OESTextureFloat.cpp */; }; 1527 6EBF0E4912A8926100DB1709 /* OESTextureFloat.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EBF0E4612A8926100DB1709 /* OESTextureFloat.h */; }; 1528 6EBF0E5412A8929800DB1709 /* WebGLExtension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6EBF0E5212A8929800DB1709 /* WebGLExtension.cpp */; }; 1529 6EBF0E5512A8929800DB1709 /* WebGLExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EBF0E5312A8929800DB1709 /* WebGLExtension.h */; }; 1530 6EBF0E7612A9868800DB1709 /* JSOESTextureFloat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6EBF0E7412A9868800DB1709 /* JSOESTextureFloat.cpp */; }; 1531 6EBF0E7712A9868800DB1709 /* JSOESTextureFloat.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EBF0E7512A9868800DB1709 /* JSOESTextureFloat.h */; }; 1526 1532 6EE8A77210F803F3005A4A24 /* JSWebGLContextAttributes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6EE8A77010F803F3005A4A24 /* JSWebGLContextAttributes.cpp */; }; 1527 1533 6EE8A77310F803F3005A4A24 /* JSWebGLContextAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EE8A77110F803F3005A4A24 /* JSWebGLContextAttributes.h */; }; … … 7887 7893 6E96BB1A11986EE1007D94CD /* IntegralTypedArrayBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IntegralTypedArrayBase.h; path = canvas/IntegralTypedArrayBase.h; sourceTree = "<group>"; }; 7888 7894 6E96BB1B11986EE1007D94CD /* TypedArrayBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TypedArrayBase.h; path = canvas/TypedArrayBase.h; sourceTree = "<group>"; }; 7895 6EBF0E4512A8926100DB1709 /* OESTextureFloat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OESTextureFloat.cpp; path = canvas/OESTextureFloat.cpp; sourceTree = "<group>"; }; 7896 6EBF0E4612A8926100DB1709 /* OESTextureFloat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OESTextureFloat.h; path = canvas/OESTextureFloat.h; sourceTree = "<group>"; }; 7897 6EBF0E4712A8926100DB1709 /* OESTextureFloat.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = OESTextureFloat.idl; path = canvas/OESTextureFloat.idl; sourceTree = "<group>"; }; 7898 6EBF0E5212A8929800DB1709 /* WebGLExtension.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLExtension.cpp; path = canvas/WebGLExtension.cpp; sourceTree = "<group>"; }; 7899 6EBF0E5312A8929800DB1709 /* WebGLExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLExtension.h; path = canvas/WebGLExtension.h; sourceTree = "<group>"; }; 7900 6EBF0E7412A9868800DB1709 /* JSOESTextureFloat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSOESTextureFloat.cpp; sourceTree = "<group>"; }; 7901 6EBF0E7512A9868800DB1709 /* JSOESTextureFloat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSOESTextureFloat.h; sourceTree = "<group>"; }; 7889 7902 6EE8A77010F803F3005A4A24 /* JSWebGLContextAttributes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLContextAttributes.cpp; sourceTree = "<group>"; }; 7890 7903 6EE8A77110F803F3005A4A24 /* JSWebGLContextAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLContextAttributes.h; sourceTree = "<group>"; }; … … 13060 13073 49C7B9AD1042D32E0009D447 /* Int8Array.idl */, 13061 13074 6E96BB1A11986EE1007D94CD /* IntegralTypedArrayBase.h */, 13075 6EBF0E4512A8926100DB1709 /* OESTextureFloat.cpp */, 13076 6EBF0E4612A8926100DB1709 /* OESTextureFloat.h */, 13077 6EBF0E4712A8926100DB1709 /* OESTextureFloat.idl */, 13062 13078 6E96BB1B11986EE1007D94CD /* TypedArrayBase.h */, 13063 13079 49EECDDC10503C2300099FAB /* Uint16Array.cpp */, … … 13081 13097 93F6F1EB127F70B10055CB06 /* WebGLContextEvent.h */, 13082 13098 93F6F1EC127F70B10055CB06 /* WebGLContextEvent.idl */, 13099 6EBF0E5212A8929800DB1709 /* WebGLExtension.cpp */, 13100 6EBF0E5312A8929800DB1709 /* WebGLExtension.h */, 13083 13101 49C7B9AE1042D32E0009D447 /* WebGLFramebuffer.cpp */, 13084 13102 49C7B9AF1042D32E0009D447 /* WebGLFramebuffer.h */, … … 15939 15957 E44614100CD6826900FADA75 /* JSMediaError.cpp */, 15940 15958 E44614110CD6826900FADA75 /* JSMediaError.h */, 15959 6EBF0E7412A9868800DB1709 /* JSOESTextureFloat.cpp */, 15960 6EBF0E7512A9868800DB1709 /* JSOESTextureFloat.h */, 15941 15961 BCEF45F30E687B5C001C1287 /* JSTextMetrics.cpp */, 15942 15962 BCEF45F40E687B5C001C1287 /* JSTextMetrics.h */, … … 22168 22188 FDA15ECE12B03F61003A583A /* JSJavaScriptAudioNode.h in Headers */, 22169 22189 FDA15ED212B03F94003A583A /* JSDelayNode.h in Headers */, 22190 6EBF0E4912A8926100DB1709 /* OESTextureFloat.h in Headers */, 22191 6EBF0E5512A8929800DB1709 /* WebGLExtension.h in Headers */, 22192 6EBF0E7712A9868800DB1709 /* JSOESTextureFloat.h in Headers */, 22170 22193 ); 22171 22194 runOnlyForDeploymentPostprocessing = 0; … … 24835 24858 494BC40D12AEDD9E00743BD2 /* TransformationMatrixCA.cpp in Sources */, 24836 24859 BC51156E12B1749C00C96754 /* ScrollAnimatorMac.mm in Sources */, 24860 6EBF0E4812A8926100DB1709 /* OESTextureFloat.cpp in Sources */, 24861 6EBF0E5412A8929800DB1709 /* WebGLExtension.cpp in Sources */, 24862 6EBF0E7612A9868800DB1709 /* JSOESTextureFloat.cpp in Sources */, 24837 24863 ); 24838 24864 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebCore/bindings/js/JSWebGLRenderingContextCustom.cpp
r71274 r73806 36 36 #include "JSHTMLImageElement.h" 37 37 #include "JSImageData.h" 38 #include "JSOESTextureFloat.h" 38 39 #include "JSWebGLBuffer.h" 39 40 #include "JSFloat32Array.h" … … 48 49 #include "JSWebKitCSSMatrix.h" 49 50 #include "NotImplemented.h" 51 #include "OESTextureFloat.h" 50 52 #include "WebGLBuffer.h" 51 53 #include "Float32Array.h" 54 #include "WebGLExtension.h" 52 55 #include "WebGLFramebuffer.h" 53 56 #include "WebGLGetInfo.h" … … 162 165 }; 163 166 167 static JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, WebGLExtension* extension) 168 { 169 if (!extension) 170 return jsNull(); 171 switch (extension->getName()) { 172 case WebGLExtension::OESTextureFloatName: 173 return toJS(exec, globalObject, static_cast<OESTextureFloat*>(extension)); 174 } 175 ASSERT_NOT_REACHED(); 176 return jsNull(); 177 } 178 179 void JSWebGLRenderingContext::markChildren(MarkStack& markStack) 180 { 181 Base::markChildren(markStack); 182 183 WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl()); 184 for (int i = 0; i < context->getNumberOfExtensions(); ++i) 185 markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), context->getExtensionNumber(i)); 186 } 187 164 188 JSValue JSWebGLRenderingContext::getAttachedShaders(ExecState* exec) 165 189 { … … 187 211 } 188 212 213 JSValue JSWebGLRenderingContext::getExtension(ExecState* exec) 214 { 215 if (exec->argumentCount() < 1) 216 return throwSyntaxError(exec); 217 218 WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl()); 219 const String& name = ustringToString(exec->argument(0).toString(exec)); 220 if (exec->hadException()) 221 return jsUndefined(); 222 WebGLExtension* extension = context->getExtension(name); 223 return toJS(exec, globalObject(), extension); 224 } 225 189 226 JSValue JSWebGLRenderingContext::getBufferParameter(ExecState* exec) 190 227 { … … 279 316 } 280 317 return toJS(exec, globalObject(), info); 318 } 319 320 JSValue JSWebGLRenderingContext::getSupportedExtensions(ExecState* exec) 321 { 322 WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl()); 323 Vector<String> value = context->getSupportedExtensions(); 324 MarkedArgumentBuffer list; 325 for (size_t ii = 0; ii < value.size(); ++ii) 326 list.append(jsString(exec, value[ii])); 327 return constructArray(exec, list); 281 328 } 282 329 -
trunk/WebCore/bindings/v8/custom/V8WebGLRenderingContextCustom.cpp
r72123 r73806 42 42 43 43 #include "V8Binding.h" 44 #include "V8BindingMacros.h" 44 45 #include "V8ArrayBufferView.h" 45 46 #include "V8WebGLBuffer.h" … … 61 62 #include "V8HTMLVideoElement.h" 62 63 #include "V8ImageData.h" 64 #include "V8OESTextureFloat.h" 63 65 #include "V8Proxy.h" 64 66 #include "WebGLRenderingContext.h" … … 152 154 } 153 155 156 static v8::Handle<v8::Value> toV8Object(WebGLExtension* extension, v8::Handle<v8::Object> contextObject) 157 { 158 if (!extension) 159 return v8::Null(); 160 v8::Handle<v8::Value> extensionObject; 161 switch (extension->getName()) { 162 case WebGLExtension::OESTextureFloatName: 163 extensionObject = toV8(static_cast<OESTextureFloat*>(extension)); 164 break; 165 } 166 ASSERT(!extensionObject.IsEmpty()); 167 V8DOMWrapper::setHiddenReference(contextObject, extensionObject); 168 return extensionObject; 169 } 170 154 171 enum ObjectType { 155 172 kBuffer, kRenderbuffer, kTexture, kVertexAttrib … … 244 261 } 245 262 263 v8::Handle<v8::Value> V8WebGLRenderingContext::getExtensionCallback(const v8::Arguments& args) 264 { 265 INC_STATS("DOM.WebGLRenderingContext.getExtensionCallback()"); 266 WebGLRenderingContext* imp = V8WebGLRenderingContext::toNative(args.Holder()); 267 if (args.Length() < 1) { 268 V8Proxy::setDOMException(SYNTAX_ERR); 269 return notHandledByInterceptor(); 270 } 271 STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, name, args[0]); 272 WebGLExtension* extension = imp->getExtension(name); 273 return toV8Object(extension, args.Holder()); 274 } 275 246 276 v8::Handle<v8::Value> V8WebGLRenderingContext::getFramebufferAttachmentParameterCallback(const v8::Arguments& args) 247 277 { … … 340 370 } 341 371 return toV8Object(info); 372 } 373 374 v8::Handle<v8::Value> V8WebGLRenderingContext::getSupportedExtensionsCallback(const v8::Arguments& args) 375 { 376 INC_STATS("DOM.WebGLRenderingContext.getSupportedExtensionsCallback()"); 377 WebGLRenderingContext* imp = V8WebGLRenderingContext::toNative(args.Holder()); 378 Vector<String> value = imp->getSupportedExtensions(); 379 v8::Local<v8::Array> array = v8::Array::New(value.size()); 380 for (size_t ii = 0; ii < value.size(); ++ii) 381 array->Set(v8::Integer::New(ii), v8::String::New(fromWebCoreString(value[ii]), value[ii].length())); 382 return array; 342 383 } 343 384 -
trunk/WebCore/html/canvas/WebGLRenderingContext.cpp
r73573 r73806 44 44 #include "IntSize.h" 45 45 #include "NotImplemented.h" 46 #include "OESTextureFloat.h" 46 47 #include "RenderBox.h" 47 48 #include "RenderLayer.h" … … 1461 1462 { 1462 1463 return m_context->getError(); 1464 } 1465 1466 WebGLExtension* WebGLRenderingContext::getExtension(const String& name) 1467 { 1468 if (equalIgnoringCase(name, "OES_texture_float") 1469 && m_context->getExtensions()->supports("GL_OES_texture_float")) { 1470 if (!m_oesTextureFloat) { 1471 m_context->getExtensions()->ensureEnabled("GL_OES_texture_float"); 1472 m_oesTextureFloat = OESTextureFloat::create(); 1473 } 1474 return m_oesTextureFloat.get(); 1475 } 1476 1477 return 0; 1463 1478 } 1464 1479 … … 1858 1873 } 1859 1874 1875 Vector<String> WebGLRenderingContext::getSupportedExtensions() 1876 { 1877 Vector<String> result; 1878 if (m_context->getExtensions()->supports("GL_OES_texture_float")) 1879 result.append("OES_texture_float"); 1880 return result; 1881 } 1882 1860 1883 WebGLGetInfo WebGLRenderingContext::getTexParameter(unsigned long target, unsigned long pname, ExceptionCode& ec) 1861 1884 { … … 3597 3620 case GraphicsContext3D::UNSIGNED_SHORT_5_5_5_1: 3598 3621 break; 3622 case GraphicsContext3D::FLOAT: 3623 if (m_oesTextureFloat) 3624 break; 3625 m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); 3626 return false; 3599 3627 default: 3600 3628 m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM); … … 3607 3635 case GraphicsContext3D::LUMINANCE: 3608 3636 case GraphicsContext3D::LUMINANCE_ALPHA: 3609 if (type != GraphicsContext3D::UNSIGNED_BYTE) { 3637 if (type != GraphicsContext3D::UNSIGNED_BYTE 3638 && type != GraphicsContext3D::FLOAT) { 3610 3639 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 3611 3640 return false; … … 3614 3643 case GraphicsContext3D::RGB: 3615 3644 if (type != GraphicsContext3D::UNSIGNED_BYTE 3616 && type != GraphicsContext3D::UNSIGNED_SHORT_5_6_5) { 3645 && type != GraphicsContext3D::UNSIGNED_SHORT_5_6_5 3646 && type != GraphicsContext3D::FLOAT) { 3617 3647 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 3618 3648 return false; … … 3622 3652 if (type != GraphicsContext3D::UNSIGNED_BYTE 3623 3653 && type != GraphicsContext3D::UNSIGNED_SHORT_4_4_4_4 3624 && type != GraphicsContext3D::UNSIGNED_SHORT_5_5_5_1) { 3654 && type != GraphicsContext3D::UNSIGNED_SHORT_5_5_5_1 3655 && type != GraphicsContext3D::FLOAT) { 3625 3656 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 3626 3657 return false; … … 3707 3738 case GraphicsContext3D::UNSIGNED_SHORT_5_5_5_1: 3708 3739 if (!pixels->isUnsignedShortArray()) { 3740 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 3741 return false; 3742 } 3743 break; 3744 case GraphicsContext3D::FLOAT: // OES_texture_float 3745 if (!pixels->isFloatArray()) { 3709 3746 m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION); 3710 3747 return false; … … 4080 4117 } 4081 4118 4119 int WebGLRenderingContext::getNumberOfExtensions() 4120 { 4121 return (m_oesTextureFloat ? 1 : 0); 4122 } 4123 4124 WebGLExtension* WebGLRenderingContext::getExtensionNumber(int i) 4125 { 4126 if (m_oesTextureFloat) { 4127 if (!i) 4128 return m_oesTextureFloat.get(); 4129 --i; 4130 } 4131 // Similar tests for other extensions would go here. 4132 return 0; 4133 } 4134 4082 4135 WebGLRenderingContext::LRUImageBufferCache::LRUImageBufferCache(int capacity) 4083 4136 : m_buffers(new OwnPtr<ImageBuffer>[capacity]) -
trunk/WebCore/html/canvas/WebGLRenderingContext.h
r73424 r73806 44 44 class WebGLBuffer; 45 45 class WebGLContextAttributes; 46 class WebGLExtension; 46 47 class WebGLFramebuffer; 47 48 class WebGLObject; … … 56 57 class ImageData; 57 58 class IntSize; 59 class OESTextureFloat; 58 60 59 61 class WebGLRenderingContext : public CanvasRenderingContext { … … 146 148 unsigned long getError(); 147 149 150 WebGLExtension* getExtension(const String& name); 151 148 152 WebGLGetInfo getFramebufferAttachmentParameter(unsigned long target, unsigned long attachment, unsigned long pname, ExceptionCode&); 149 153 … … 164 168 165 169 String getShaderSource(WebGLShader*, ExceptionCode&); 170 171 Vector<String> getSupportedExtensions(); 166 172 167 173 WebGLGetInfo getTexParameter(unsigned long target, unsigned long pname, ExceptionCode&); … … 293 299 void removeObject(WebGLObject*); 294 300 301 // Helpers for JSC bindings. 302 int getNumberOfExtensions(); 303 WebGLExtension* getExtensionNumber(int i); 304 295 305 private: 296 306 friend class WebGLObject; … … 457 467 bool m_isDepthStencilSupported; 458 468 469 // Enabled extension objects. 470 RefPtr<OESTextureFloat> m_oesTextureFloat; 471 459 472 // Helpers for getParameter and others 460 473 WebGLGetInfo getBooleanParameter(unsigned long pname); -
trunk/WebCore/html/canvas/WebGLRenderingContext.idl
r71855 r73806 30 30 InterfaceUUID=98fb48ae-7216-489c-862b-8e1217fc4443, 31 31 ImplementationUUID=ab4f0781-152f-450e-9546-5b3987491a54, 32 CustomMarkFunction, 32 33 DontCheckEnums 33 34 ] WebGLRenderingContext : CanvasRenderingContext { … … 288 289 const unsigned int RENDERER = 0x1F01; 289 290 const unsigned int VERSION = 0x1F02; 290 const unsigned int EXTENSIONS = 0x1F03;291 291 292 292 /* TextureMagFilter */ … … 536 536 [StrictTypeChecking] unsigned long getError(); 537 537 538 // object getExtension(in DOMString name); 539 [StrictTypeChecking, Custom] void getExtension(in DOMString name); 540 538 541 // any getFramebufferAttachmentParameter(in unsigned long target, in unsigned long attachment, in unsigned long pname) raises(DOMException); 539 542 [StrictTypeChecking, Custom] void getFramebufferAttachmentParameter(); … … 554 557 555 558 [StrictTypeChecking, ConvertNullStringTo=Null] DOMString getShaderSource(in WebGLShader shader) raises(DOMException); 559 560 // DOMString[] getSupportedExtensions() 561 [StrictTypeChecking, Custom] void getSupportedExtensions(); 556 562 557 563 // any getTexParameter(in unsigned long target, in unsigned long pname) raises(DOMException); -
trunk/WebCore/platform/graphics/Extensions3D.h
r72124 r73806 51 51 // GL_EXT_packed_depth_stencil / GL_OES_packed_depth_stencil 52 52 // GL_ANGLE_framebuffer_blit / GL_ANGLE_framebuffer_multisample 53 // GL_OES_texture_float 53 54 54 55 // Takes full name of extension; for example, 55 56 // "GL_EXT_texture_format_BGRA8888". 56 57 virtual bool supports(const String&) = 0; 58 59 // Certain OpenGL and WebGL implementations may support enabling 60 // extensions lazily. This method may only be called with 61 // extension names for which supports returns true. 62 virtual void ensureEnabled(const String&) = 0; 57 63 58 64 enum ExtensionsEnumType { -
trunk/WebCore/platform/graphics/GraphicsContext3D.cpp
r72130 r73806 86 86 *componentsPerPixel = 1; 87 87 *bytesPerComponent = sizeof(unsigned short); 88 break; 89 case GraphicsContext3D::FLOAT: // OES_texture_float 90 *bytesPerComponent = sizeof(float); 88 91 break; 89 92 default: … … 189 192 } 190 193 break; 194 case FLOAT: // OES_texture_float 195 switch (format) { 196 case RGBA: 197 sourceDataFormat = SourceFormatRGBA32F; 198 break; 199 case RGB: 200 sourceDataFormat = SourceFormatRGB32F; 201 break; 202 case ALPHA: 203 sourceDataFormat = SourceFormatA32F; 204 break; 205 case LUMINANCE: 206 sourceDataFormat = SourceFormatR32F; 207 break; 208 case LUMINANCE_ALPHA: 209 sourceDataFormat = SourceFormatRA32F; 210 break; 211 default: 212 ASSERT_NOT_REACHED(); 213 } 214 break; 191 215 case UNSIGNED_SHORT_5_5_5_1: 192 216 sourceDataFormat = SourceFormatRGBA5551; … … 502 526 } 503 527 528 void unpackRGB32FToRGBA32F(const float* source, float* destination) 529 { 530 destination[0] = source[0]; 531 destination[1] = source[1]; 532 destination[2] = source[2]; 533 destination[3] = 1; 534 } 535 536 void unpackR32FToRGBA32F(const float* source, float* destination) 537 { 538 destination[0] = source[0]; 539 destination[1] = source[0]; 540 destination[2] = source[0]; 541 destination[3] = 1; 542 } 543 544 void unpackRA32FToRGBA32F(const float* source, float* destination) 545 { 546 destination[0] = source[0]; 547 destination[1] = source[0]; 548 destination[2] = source[0]; 549 destination[3] = source[1]; 550 } 551 552 void unpackA32FToRGBA32F(const float* source, float* destination) 553 { 554 destination[0] = 0; 555 destination[1] = 0; 556 destination[2] = 0; 557 destination[3] = source[0]; 558 } 559 504 560 //---------------------------------------------------------------------- 505 561 // Pixel packing routines. … … 714 770 } 715 771 772 void packRGBA32FToRGB32F(const float* source, float* destination) 773 { 774 destination[0] = source[0]; 775 destination[1] = source[1]; 776 destination[2] = source[2]; 777 } 778 779 void packRGBA32FToRGB32FPremultiply(const float* source, float* destination) 780 { 781 float scaleFactor = source[3]; 782 destination[0] = source[0] * scaleFactor; 783 destination[1] = source[1] * scaleFactor; 784 destination[2] = source[2] * scaleFactor; 785 } 786 787 void packRGBA32FToRGBA32FPremultiply(const float* source, float* destination) 788 { 789 float scaleFactor = source[3]; 790 destination[0] = source[0] * scaleFactor; 791 destination[1] = source[1] * scaleFactor; 792 destination[2] = source[2] * scaleFactor; 793 destination[3] = source[3]; 794 } 795 796 void packRGBA32FToA32F(const float* source, float* destination) 797 { 798 destination[0] = source[3]; 799 } 800 801 void packRGBA32FToR32F(const float* source, float* destination) 802 { 803 destination[0] = source[0]; 804 } 805 806 void packRGBA32FToR32FPremultiply(const float* source, float* destination) 807 { 808 float scaleFactor = source[3]; 809 destination[0] = source[0] * scaleFactor; 810 } 811 812 813 void packRGBA32FToRA32F(const float* source, float* destination) 814 { 815 destination[0] = source[0]; 816 destination[1] = source[3]; 817 } 818 819 void packRGBA32FToRA32FPremultiply(const float* source, float* destination) 820 { 821 float scaleFactor = source[3]; 822 destination[0] = source[0] * scaleFactor; 823 destination[1] = scaleFactor; 824 } 825 716 826 } // anonymous namespace 717 827 718 828 // This is used whenever unpacking is necessary; i.e., the source data 719 // is not in RGBA8 format, or the unpack alignment specifies that rows720 // are not tightly packed.721 template<typename SourceType, typename DestType,722 void unpackingFunc(const SourceType*, uint8_t*),723 void packingFunc(const uint8_t*, DestType*)>829 // is not in RGBA8/RGBA32F format, or the unpack alignment specifies 830 // that rows are not tightly packed. 831 template<typename SourceType, typename IntermediateType, typename DestType, 832 void unpackingFunc(const SourceType*, IntermediateType*), 833 void packingFunc(const IntermediateType*, DestType*)> 724 834 static void doUnpackingAndPacking(const SourceType* sourceData, 725 835 unsigned int width, … … 733 843 unsigned int numElements = width * height * sourceElementsPerPixel; 734 844 const SourceType* endPointer = sourceData + numElements; 735 uint8_ttemporaryRGBAData[4];845 IntermediateType temporaryRGBAData[4]; 736 846 while (sourceData < endPointer) { 737 847 unpackingFunc(sourceData, temporaryRGBAData); … … 741 851 } 742 852 } else { 743 uint8_ttemporaryRGBAData[4];853 IntermediateType temporaryRGBAData[4]; 744 854 for (unsigned int y = 0; y < height; ++y) { 745 855 const SourceType* currentSource = sourceData; … … 803 913 } 804 914 } else { 805 doUnpackingAndPacking<uint8_t, DestType, unpackRGBA8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);915 doUnpackingAndPacking<uint8_t, uint8_t, DestType, unpackRGBA8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 806 916 } 807 917 break; … … 810 920 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 811 921 computeIncrementParameters<uint16_t>(width, 8, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 812 doUnpackingAndPacking<uint16_t, DestType, unpackRGBA16LittleToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);922 doUnpackingAndPacking<uint16_t, uint8_t, DestType, unpackRGBA16LittleToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 813 923 break; 814 924 } … … 816 926 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 817 927 computeIncrementParameters<uint16_t>(width, 8, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 818 doUnpackingAndPacking<uint16_t, DestType, unpackRGBA16BigToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);928 doUnpackingAndPacking<uint16_t, uint8_t, DestType, unpackRGBA16BigToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 819 929 break; 820 930 } … … 822 932 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 823 933 computeIncrementParameters<uint8_t>(width, 3, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 824 doUnpackingAndPacking<uint8_t, DestType, unpackRGB8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);934 doUnpackingAndPacking<uint8_t, uint8_t, DestType, unpackRGB8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 825 935 break; 826 936 } … … 828 938 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 829 939 computeIncrementParameters<uint16_t>(width, 6, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 830 doUnpackingAndPacking<uint16_t, DestType, unpackRGB16LittleToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);940 doUnpackingAndPacking<uint16_t, uint8_t, DestType, unpackRGB16LittleToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 831 941 break; 832 942 } … … 834 944 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 835 945 computeIncrementParameters<uint16_t>(width, 6, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 836 doUnpackingAndPacking<uint16_t, DestType, unpackRGB16BigToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);946 doUnpackingAndPacking<uint16_t, uint8_t, DestType, unpackRGB16BigToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 837 947 break; 838 948 } … … 840 950 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 841 951 computeIncrementParameters<uint8_t>(width, 3, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 842 doUnpackingAndPacking<uint8_t, DestType, unpackBGR8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);952 doUnpackingAndPacking<uint8_t, uint8_t, DestType, unpackBGR8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 843 953 break; 844 954 } … … 846 956 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 847 957 computeIncrementParameters<uint8_t>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 848 doUnpackingAndPacking<uint8_t, DestType, unpackARGB8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);958 doUnpackingAndPacking<uint8_t, uint8_t, DestType, unpackARGB8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 849 959 break; 850 960 } … … 852 962 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 853 963 computeIncrementParameters<uint16_t>(width, 8, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 854 doUnpackingAndPacking<uint16_t, DestType, unpackARGB16LittleToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);964 doUnpackingAndPacking<uint16_t, uint8_t, DestType, unpackARGB16LittleToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 855 965 break; 856 966 } … … 858 968 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 859 969 computeIncrementParameters<uint16_t>(width, 8, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 860 doUnpackingAndPacking<uint16_t, DestType, unpackARGB16BigToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);970 doUnpackingAndPacking<uint16_t, uint8_t, DestType, unpackARGB16BigToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 861 971 break; 862 972 } … … 864 974 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 865 975 computeIncrementParameters<uint8_t>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 866 doUnpackingAndPacking<uint8_t, DestType, unpackABGR8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);976 doUnpackingAndPacking<uint8_t, uint8_t, DestType, unpackABGR8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 867 977 break; 868 978 } … … 870 980 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 871 981 computeIncrementParameters<uint8_t>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 872 doUnpackingAndPacking<uint8_t, DestType, unpackBGRA8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);982 doUnpackingAndPacking<uint8_t, uint8_t, DestType, unpackBGRA8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 873 983 break; 874 984 } … … 876 986 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 877 987 computeIncrementParameters<uint16_t>(width, 8, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 878 doUnpackingAndPacking<uint16_t, DestType, unpackBGRA16LittleToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);988 doUnpackingAndPacking<uint16_t, uint8_t, DestType, unpackBGRA16LittleToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 879 989 break; 880 990 } … … 882 992 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 883 993 computeIncrementParameters<uint16_t>(width, 8, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 884 doUnpackingAndPacking<uint16_t, DestType, unpackBGRA16BigToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);994 doUnpackingAndPacking<uint16_t, uint8_t, DestType, unpackBGRA16BigToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 885 995 break; 886 996 } … … 888 998 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 889 999 computeIncrementParameters<uint16_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 890 doUnpackingAndPacking<uint16_t, DestType, unpackRGBA5551ToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);1000 doUnpackingAndPacking<uint16_t, uint8_t, DestType, unpackRGBA5551ToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 891 1001 break; 892 1002 } … … 894 1004 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 895 1005 computeIncrementParameters<uint16_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 896 doUnpackingAndPacking<uint16_t, DestType, unpackRGBA4444ToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);1006 doUnpackingAndPacking<uint16_t, uint8_t, DestType, unpackRGBA4444ToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 897 1007 break; 898 1008 } … … 900 1010 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 901 1011 computeIncrementParameters<uint16_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 902 doUnpackingAndPacking<uint16_t, DestType, unpackRGB565ToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);1012 doUnpackingAndPacking<uint16_t, uint8_t, DestType, unpackRGB565ToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 903 1013 break; 904 1014 } … … 906 1016 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 907 1017 computeIncrementParameters<uint8_t>(width, 1, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 908 doUnpackingAndPacking<uint8_t, DestType, unpackR8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);1018 doUnpackingAndPacking<uint8_t, uint8_t, DestType, unpackR8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 909 1019 break; 910 1020 } … … 912 1022 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 913 1023 computeIncrementParameters<uint16_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 914 doUnpackingAndPacking<uint16_t, DestType, unpackR16LittleToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);1024 doUnpackingAndPacking<uint16_t, uint8_t, DestType, unpackR16LittleToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 915 1025 break; 916 1026 } … … 918 1028 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 919 1029 computeIncrementParameters<uint16_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 920 doUnpackingAndPacking<uint16_t, DestType, unpackR16BigToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);1030 doUnpackingAndPacking<uint16_t, uint8_t, DestType, unpackR16BigToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 921 1031 break; 922 1032 } … … 924 1034 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 925 1035 computeIncrementParameters<uint8_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 926 doUnpackingAndPacking<uint8_t, DestType, unpackRA8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);1036 doUnpackingAndPacking<uint8_t, uint8_t, DestType, unpackRA8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 927 1037 break; 928 1038 } … … 930 1040 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 931 1041 computeIncrementParameters<uint16_t>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 932 doUnpackingAndPacking<uint16_t, DestType, unpackRA16LittleToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);1042 doUnpackingAndPacking<uint16_t, uint8_t, DestType, unpackRA16LittleToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 933 1043 break; 934 1044 } … … 936 1046 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 937 1047 computeIncrementParameters<uint16_t>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 938 doUnpackingAndPacking<uint16_t, DestType, unpackRA16BigToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);1048 doUnpackingAndPacking<uint16_t, uint8_t, DestType, unpackRA16BigToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 939 1049 break; 940 1050 } … … 942 1052 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 943 1053 computeIncrementParameters<uint8_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 944 doUnpackingAndPacking<uint8_t, DestType, unpackAR8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);1054 doUnpackingAndPacking<uint8_t, uint8_t, DestType, unpackAR8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 945 1055 break; 946 1056 } … … 948 1058 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 949 1059 computeIncrementParameters<uint16_t>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 950 doUnpackingAndPacking<uint16_t, DestType, unpackAR16LittleToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);1060 doUnpackingAndPacking<uint16_t, uint8_t, DestType, unpackAR16LittleToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 951 1061 break; 952 1062 } … … 954 1064 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 955 1065 computeIncrementParameters<uint16_t>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 956 doUnpackingAndPacking<uint16_t, DestType, unpackAR16BigToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);1066 doUnpackingAndPacking<uint16_t, uint8_t, DestType, unpackAR16BigToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 957 1067 break; 958 1068 } … … 960 1070 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 961 1071 computeIncrementParameters<uint8_t>(width, 1, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 962 doUnpackingAndPacking<uint8_t, DestType, unpackA8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);1072 doUnpackingAndPacking<uint8_t, uint8_t, DestType, unpackA8ToRGBA8, packingFunc>(static_cast<const uint8_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 963 1073 break; 964 1074 } … … 966 1076 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 967 1077 computeIncrementParameters<uint16_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 968 doUnpackingAndPacking<uint16_t, DestType, unpackA16LittleToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);1078 doUnpackingAndPacking<uint16_t, uint8_t, DestType, unpackA16LittleToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 969 1079 break; 970 1080 } … … 972 1082 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 973 1083 computeIncrementParameters<uint16_t>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 974 doUnpackingAndPacking<uint16_t, DestType, unpackA16BigToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel);1084 doUnpackingAndPacking<uint16_t, uint8_t, DestType, unpackA16BigToRGBA8, packingFunc>(static_cast<const uint16_t*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 975 1085 break; 976 1086 } 977 1087 default: 978 1088 ASSERT(false); 1089 } 1090 } 1091 1092 // This specialized routine is used only for floating-point texture uploads. It 1093 // does not need to be as general as doPacking, above; because there are 1094 // currently no native floating-point image formats in WebKit, there are only a 1095 // few upload paths. 1096 template<void packingFunc(const float*, float*)> 1097 static void doFloatingPointPacking(const void* sourceData, 1098 GraphicsContext3D::SourceDataFormat sourceDataFormat, 1099 unsigned int width, 1100 unsigned int height, 1101 unsigned int sourceUnpackAlignment, 1102 float* destinationData, 1103 unsigned int destinationElementsPerPixel) 1104 { 1105 switch (sourceDataFormat) { 1106 case GraphicsContext3D::SourceFormatRGBA8: { 1107 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 1108 computeIncrementParameters<float>(width, 4, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 1109 ASSERT(!sourceElementsPerRow); // Guaranteed because each color channel is sizeof(float) bytes. 1110 const float* source = static_cast<const float*>(sourceData); 1111 unsigned int numElements = width * height * 4; 1112 const float* endPointer = source + numElements; 1113 while (source < endPointer) { 1114 packingFunc(source, destinationData); 1115 source += sourceElementsPerPixel; 1116 destinationData += destinationElementsPerPixel; 1117 } 1118 break; 1119 } 1120 case GraphicsContext3D::SourceFormatRGB32F: { 1121 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 1122 computeIncrementParameters<float>(width, 3, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 1123 doUnpackingAndPacking<float, float, float, unpackRGB32FToRGBA32F, packingFunc>(static_cast<const float*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 1124 break; 1125 } 1126 case GraphicsContext3D::SourceFormatR32F: { 1127 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 1128 computeIncrementParameters<float>(width, 1, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 1129 doUnpackingAndPacking<float, float, float, unpackR32FToRGBA32F, packingFunc>(static_cast<const float*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 1130 break; 1131 } 1132 case GraphicsContext3D::SourceFormatRA32F: { 1133 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 1134 computeIncrementParameters<float>(width, 2, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 1135 doUnpackingAndPacking<float, float, float, unpackRA32FToRGBA32F, packingFunc>(static_cast<const float*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 1136 break; 1137 } 1138 case GraphicsContext3D::SourceFormatA32F: { 1139 unsigned int sourceElementsPerPixel, sourceElementsPerRow; 1140 computeIncrementParameters<float>(width, 1, sourceUnpackAlignment, &sourceElementsPerPixel, &sourceElementsPerRow); 1141 doUnpackingAndPacking<float, float, float, unpackA32FToRGBA32F, packingFunc>(static_cast<const float*>(sourceData), width, height, sourceElementsPerPixel, sourceElementsPerRow, destinationData, destinationElementsPerPixel); 1142 break; 1143 } 1144 default: 1145 ASSERT_NOT_REACHED(); 979 1146 } 980 1147 } … … 1114 1281 break; 1115 1282 } 1283 case FLOAT: { 1284 // OpenGL ES, and therefore WebGL, require that the format and 1285 // internalformat be identical, which implies that the source and 1286 // destination formats will both be floating-point in this branch -- at 1287 // least, until WebKit supports floating-point image formats natively. 1288 ASSERT(sourceDataFormat == SourceFormatRGBA32F || sourceDataFormat == SourceFormatRGB32F 1289 || sourceDataFormat == SourceFormatRA32F || sourceDataFormat == SourceFormatR32F 1290 || sourceDataFormat == SourceFormatA32F); 1291 // Because WebKit doesn't use floating-point color channels for anything 1292 // internally, there's no chance we have to do a (lossy) unmultiply 1293 // operation. 1294 ASSERT(alphaOp == AlphaDoNothing || alphaOp == AlphaDoPremultiply); 1295 // For the source formats with an even number of channels (RGBA32F, 1296 // RA32F) it is guaranteed that the pixel data is tightly packed because 1297 // unpack alignment <= sizeof(float) * number of channels. 1298 float* destination = static_cast<float*>(destinationData); 1299 if (alphaOp == AlphaDoNothing 1300 && ((sourceDataFormat == SourceFormatRGBA32F && destinationFormat == RGBA) 1301 || (sourceDataFormat == SourceFormatRA32F && destinationFormat == LUMINANCE_ALPHA))) { 1302 // No conversion necessary. 1303 int numChannels = (sourceDataFormat == SourceFormatRGBA32F ? 4 : 2); 1304 memcpy(destinationData, sourceData, width * height * numChannels * sizeof(float)); 1305 break; 1306 } 1307 switch (destinationFormat) { 1308 case RGB: 1309 switch (alphaOp) { 1310 case AlphaDoNothing: 1311 doFloatingPointPacking<packRGBA32FToRGB32F>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 3); 1312 break; 1313 case AlphaDoPremultiply: 1314 doFloatingPointPacking<packRGBA32FToRGB32FPremultiply>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 3); 1315 break; 1316 default: 1317 ASSERT_NOT_REACHED(); 1318 } 1319 break; 1320 case RGBA: 1321 // AlphaDoNothing is handled above with fast path. 1322 ASSERT(alphaOp == AlphaDoPremultiply); 1323 doFloatingPointPacking<packRGBA32FToRGBA32FPremultiply>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 4); 1324 break; 1325 case ALPHA: 1326 // From the desktop OpenGL conversion rules (OpenGL 2.1 1327 // specification, Table 3.15), the alpha channel is chosen 1328 // from the RGBA data. 1329 doFloatingPointPacking<packRGBA32FToA32F>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 1); 1330 break; 1331 case LUMINANCE: 1332 // From the desktop OpenGL conversion rules (OpenGL 2.1 1333 // specification, Table 3.15), the red channel is chosen 1334 // from the RGBA data. 1335 switch (alphaOp) { 1336 case AlphaDoNothing: 1337 doFloatingPointPacking<packRGBA32FToR32F>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 1); 1338 break; 1339 case AlphaDoPremultiply: 1340 doFloatingPointPacking<packRGBA32FToR32FPremultiply>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 1); 1341 break; 1342 default: 1343 ASSERT_NOT_REACHED(); 1344 } 1345 break; 1346 case LUMINANCE_ALPHA: 1347 // From the desktop OpenGL conversion rules (OpenGL 2.1 1348 // specification, Table 3.15), the red and alpha channels 1349 // are chosen from the RGBA data. 1350 switch (alphaOp) { 1351 case AlphaDoNothing: 1352 doFloatingPointPacking<packRGBA32FToRA32F>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 2); 1353 break; 1354 case AlphaDoPremultiply: 1355 doFloatingPointPacking<packRGBA32FToRA32FPremultiply>(sourceData, sourceDataFormat, width, height, sourceUnpackAlignment, destination, 2); 1356 break; 1357 default: 1358 ASSERT_NOT_REACHED(); 1359 } 1360 break; 1361 } 1362 break; 1363 } 1116 1364 } 1117 1365 return true; -
trunk/WebCore/platform/graphics/GraphicsContext3D.h
r72130 r73806 537 537 SourceFormatRGBA16Little, 538 538 SourceFormatRGBA16Big, 539 SourceFormatRGBA32F, 539 540 SourceFormatRGB8, 540 541 SourceFormatRGB16Little, 541 542 SourceFormatRGB16Big, 543 SourceFormatRGB32F, 542 544 SourceFormatBGR8, 543 545 SourceFormatBGRA8, … … 554 556 SourceFormatR16Little, 555 557 SourceFormatR16Big, 558 SourceFormatR32F, 556 559 SourceFormatRA8, 557 560 SourceFormatRA16Little, 558 561 SourceFormatRA16Big, 562 SourceFormatRA32F, 559 563 SourceFormatAR8, 560 564 SourceFormatAR16Little, … … 563 567 SourceFormatA16Little, 564 568 SourceFormatA16Big, 569 SourceFormatA32F, 565 570 SourceFormatNumFormats 566 571 }; -
trunk/WebCore/platform/graphics/chromium/Extensions3DChromium.h
r72124 r73806 43 43 // Extensions3D methods. 44 44 virtual bool supports(const String&); 45 virtual void ensureEnabled(const String&); 45 46 virtual int getGraphicsResetStatusARB(); 46 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) { } -
trunk/WebCore/platform/graphics/opengl/Extensions3DOpenGL.cpp
r71853 r73806 77 77 if (name == "GL_ANGLE_framebuffer_multisample") 78 78 return m_availableExtensions.contains("GL_EXT_framebuffer_multisample"); 79 79 80 // If GL_ARB_texture_float is available then we report GL_OES_texture_float and 81 // GL_OES_texture_half_float as available. 82 if (name == "GL_OES_texture_float" || name == "GL_OES_texture_half_float") 83 return m_availableExtensions.contains("GL_ARB_texture_float"); 84 80 85 return m_availableExtensions.contains(name); 86 } 87 88 void Extensions3DOpenGL::ensureEnabled(const String& name) 89 { 90 #ifndef NDEBUG 91 UNUSED_PARAM(name); 92 #endif 93 ASSERT(supports(name)); 81 94 } 82 95 -
trunk/WebCore/platform/graphics/opengl/Extensions3DOpenGL.h
r71853 r73806 41 41 // Extensions3D methods. 42 42 virtual bool supports(const String&); 43 virtual void ensureEnabled(const String&); 43 44 virtual int getGraphicsResetStatusARB(); 44 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); -
trunk/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp
r73543 r73806 1330 1330 makeContextCurrent(); 1331 1331 1332 ::glTexImage2D(target, level, internalformat, width, height, border, format, type, pixels); 1332 unsigned openGLInternalFormat = internalformat; 1333 if (type == GL_FLOAT) { 1334 if (format == GL_RGBA) 1335 openGLInternalFormat = GL_RGBA32F_ARB; 1336 else if (format == GL_RGB) 1337 openGLInternalFormat = GL_RGB32F_ARB; 1338 } 1339 1340 ::glTexImage2D(target, level, openGLInternalFormat, width, height, border, format, type, pixels); 1333 1341 return 0; 1334 1342 } -
trunk/WebCore/platform/graphics/qt/Extensions3DQt.cpp
r71272 r73806 47 47 } 48 48 49 void Extensions3DQt::ensureEnabled(const String& name) 50 { 51 ASSERT(supports(name)); 52 } 53 49 54 int Extensions3DQt::getGraphicsResetStatusARB() 50 55 { -
trunk/WebCore/platform/graphics/qt/Extensions3DQt.h
r71272 r73806 37 37 // Extensions3D methods. 38 38 virtual bool supports(const String&); 39 virtual void ensureEnabled(const String&); 39 40 virtual int getGraphicsResetStatusARB(); 40 41 -
trunk/WebKit/chromium/ChangeLog
r73745 r73806 1 2010-12-10 Kenneth Russell <kbr@google.com> 2 3 Reviewed by James Robinson. 4 5 Implement extension entry points and remove EXTENSIONS enum 6 https://bugs.webkit.org/show_bug.cgi?id=40316 7 8 Added support for ensuring that a particular OpenGL extension is 9 enabled. 10 11 * public/WebGraphicsContext3D.h: 12 * src/Extensions3DChromium.cpp: 13 (WebCore::Extensions3DChromium::ensureEnabled): 14 * src/GraphicsContext3DChromium.cpp: 15 (WebCore::GraphicsContext3DInternal::initializeExtensions): 16 (WebCore::GraphicsContext3DInternal::supportsExtension): 17 (WebCore::GraphicsContext3DInternal::ensureExtensionEnabled): 18 * src/GraphicsContext3DInternal.h: 19 * src/WebGraphicsContext3DDefaultImpl.cpp: 20 (WebKit::WebGraphicsContext3DDefaultImpl::getRequestableExtensionsCHROMIUM): 21 (WebKit::WebGraphicsContext3DDefaultImpl::requestExtensionCHROMIUM): 22 * src/WebGraphicsContext3DDefaultImpl.h: 23 1 24 2010-12-10 John Knottenbelt <jknotten@chromium.org> 2 25 -
trunk/WebKit/chromium/public/WebGraphicsContext3D.h
r72587 r73806 141 141 virtual void copyTextureToParentTextureCHROMIUM(unsigned texture, unsigned parentTexture) = 0; 142 142 143 // GL_CHROMIUM_request_extension 144 virtual WebString getRequestableExtensionsCHROMIUM() = 0; 145 virtual void requestExtensionCHROMIUM(const char*) = 0; 146 143 147 // The entry points below map directly to the OpenGL ES 2.0 API. 144 148 // See: http://www.khronos.org/registry/gles/ -
trunk/WebKit/chromium/src/Extensions3DChromium.cpp
r72587 r73806 49 49 } 50 50 51 void Extensions3DChromium::ensureEnabled(const String& name) 52 { 53 #ifndef NDEBUG 54 bool result = 55 #endif 56 m_internal->ensureExtensionEnabled(name); 57 ASSERT(result); 58 } 59 51 60 int Extensions3DChromium::getGraphicsResetStatusARB() 52 61 { -
trunk/WebKit/chromium/src/GraphicsContext3DChromium.cpp
r72587 r73806 682 682 } 683 683 684 bool GraphicsContext3DInternal::supportsExtension(const String& name) 684 namespace { 685 686 void splitStringHelper(const String& str, HashSet<String>& set) 687 { 688 Vector<String> substrings; 689 str.split(" ", substrings); 690 for (size_t i = 0; i < substrings.size(); ++i) 691 set.add(substrings[i]); 692 } 693 694 } // anonymous namespace 695 696 void GraphicsContext3DInternal::initializeExtensions() 685 697 { 686 698 if (!m_initializedAvailableExtensions) { 687 699 String extensionsString = getString(GraphicsContext3D::EXTENSIONS); 688 Vector<String> availableExtensions; 689 extensionsString.split(" ", availableExtensions); 690 for (size_t i = 0; i < availableExtensions.size(); ++i) 691 m_availableExtensions.add(availableExtensions[i]); 700 splitStringHelper(extensionsString, m_enabledExtensions); 701 702 String requestableExtensionsString = m_impl->getRequestableExtensionsCHROMIUM(); 703 splitStringHelper(requestableExtensionsString, m_requestableExtensions); 704 692 705 m_initializedAvailableExtensions = true; 693 706 } 694 return m_availableExtensions.contains(name); 707 } 708 709 710 bool GraphicsContext3DInternal::supportsExtension(const String& name) 711 { 712 initializeExtensions(); 713 return m_enabledExtensions.contains(name) || m_requestableExtensions.contains(name); 714 } 715 716 bool GraphicsContext3DInternal::ensureExtensionEnabled(const String& name) 717 { 718 initializeExtensions(); 719 720 if (m_enabledExtensions.contains(name)) 721 return true; 722 723 if (m_requestableExtensions.contains(name)) { 724 m_impl->requestExtensionCHROMIUM(name.ascii().data()); 725 m_enabledExtensions.clear(); 726 m_requestableExtensions.clear(); 727 m_initializedAvailableExtensions = false; 728 } 729 730 initializeExtensions(); 731 return m_enabledExtensions.contains(name); 695 732 } 696 733 -
trunk/WebKit/chromium/src/GraphicsContext3DInternal.h
r72587 r73806 266 266 Extensions3D* getExtensions(); 267 267 bool supportsExtension(const String& name); 268 bool ensureExtensionEnabled(const String& name); 268 269 269 270 // EXT_texture_format_BGRA8888 … … 286 287 WebKit::WebViewImpl* m_webViewImpl; 287 288 bool m_initializedAvailableExtensions; 288 HashSet<String> m_availableExtensions; 289 HashSet<String> m_enabledExtensions; 290 HashSet<String> m_requestableExtensions; 289 291 #if USE(ACCELERATED_COMPOSITING) 290 292 RefPtr<WebGLLayerChromium> m_compositingLayer; … … 302 304 unsigned char* m_renderOutput; 303 305 #endif 306 307 void initializeExtensions(); 304 308 }; 305 309 -
trunk/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.cpp
r72587 r73806 625 625 } 626 626 627 WebString WebGraphicsContext3DDefaultImpl::getRequestableExtensionsCHROMIUM() 628 { 629 return WebString(); 630 } 631 632 void WebGraphicsContext3DDefaultImpl::requestExtensionCHROMIUM(const char*) 633 { 634 } 635 627 636 // Helper macros to reduce the amount of code. 628 637 -
trunk/WebKit/chromium/src/WebGraphicsContext3DDefaultImpl.h
r72587 r73806 86 86 virtual void copyTextureToParentTextureCHROMIUM(unsigned texture, unsigned parentTexture); 87 87 88 virtual WebString getRequestableExtensionsCHROMIUM(); 89 virtual void requestExtensionCHROMIUM(const char*); 90 88 91 virtual void activeTexture(unsigned long texture); 89 92 virtual void attachShader(WebGLId program, WebGLId shader);
Note: See TracChangeset
for help on using the changeset viewer.