Commit 81bb4971 authored by kbr@google.com's avatar kbr@google.com

2010-12-10 Kenneth Russell <kbr@google.com>

        Reviewed by James Robinson.

        Implement extension entry points and remove EXTENSIONS enum
        https://bugs.webkit.org/show_bug.cgi?id=40316

        Added support for ensuring that a particular OpenGL extension is
        enabled.

        * public/WebGraphicsContext3D.h:
        * src/Extensions3DChromium.cpp:
        (WebCore::Extensions3DChromium::ensureEnabled):
        * src/GraphicsContext3DChromium.cpp:
        (WebCore::GraphicsContext3DInternal::initializeExtensions):
        (WebCore::GraphicsContext3DInternal::supportsExtension):
        (WebCore::GraphicsContext3DInternal::ensureExtensionEnabled):
        * src/GraphicsContext3DInternal.h:
        * src/WebGraphicsContext3DDefaultImpl.cpp:
        (WebKit::WebGraphicsContext3DDefaultImpl::getRequestableExtensionsCHROMIUM):
        (WebKit::WebGraphicsContext3DDefaultImpl::requestExtensionCHROMIUM):
        * src/WebGraphicsContext3DDefaultImpl.h:
2010-12-10  Kenneth Russell  <kbr@google.com>

        Reviewed by James Robinson.

        Implement extension entry points and remove EXTENSIONS enum
        https://bugs.webkit.org/show_bug.cgi?id=40316

        Implemented WebGLRenderingContext's getSupportedExtensions and
        getExtensions entry points, and, to verify them, added support for
        the first specified WebGL extension, OES_texture_float. This
        extension is now advertised in the Chromium and WebKit ports when
        the underlying hardware supports it.

        The new OES_texture_float test in the WebGL conformance suite
        verifies the allocation and population of floating point textures,
        and their use as render targets. However, because this extension
        is optional, it is not easily testable with a layout test; there
        is only one set of expectations for a given test, and two would be
        needed, one when the extension is available and one when it is not.

        Tested with the oes-texture-float.html WebGL conformance test in
        Chromium and WebKit on Mac OS X on hardware that supports the
        extension. Also verified with a configuration that does not
        advertise the extension that this same test passes.

        * CMakeLists.txt:
        * DerivedSources.make:
        * GNUmakefile.am:
        * WebCore.gypi:
        * WebCore.pri:
        * WebCore.pro:
        * WebCore.xcodeproj/project.pbxproj:
        * bindings/js/JSWebGLRenderingContextCustom.cpp:
        (WebCore::toJS):
        (WebCore::JSWebGLRenderingContext::markChildren):
        (WebCore::JSWebGLRenderingContext::getExtension):
        (WebCore::JSWebGLRenderingContext::getSupportedExtensions):
        * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:
        (WebCore::toV8Object):
        (WebCore::V8WebGLRenderingContext::getExtensionCallback):
        (WebCore::V8WebGLRenderingContext::getSupportedExtensionsCallback):
        * html/canvas/OESTextureFloat.cpp: Added.
        (WebCore::OESTextureFloat::OESTextureFloat):
        (WebCore::OESTextureFloat::~OESTextureFloat):
        (WebCore::OESTextureFloat::getName):
        (WebCore::OESTextureFloat::create):
        * html/canvas/OESTextureFloat.h: Added.
        * html/canvas/OESTextureFloat.idl: Added.
        * html/canvas/WebGLExtension.cpp: Added.
        (WebCore::WebGLExtension::WebGLExtension):
        (WebCore::WebGLExtension::~WebGLExtension):
        * html/canvas/WebGLExtension.h: Added.
        * html/canvas/WebGLRenderingContext.cpp:
        (WebCore::WebGLRenderingContext::getExtension):
        (WebCore::WebGLRenderingContext::getSupportedExtensions):
        (WebCore::WebGLRenderingContext::validateTexFuncFormatAndType):
        (WebCore::WebGLRenderingContext::validateTexFuncData):
        (WebCore::WebGLRenderingContext::getNumberOfExtensions):
        (WebCore::WebGLRenderingContext::getExtensionNumber):
        * html/canvas/WebGLRenderingContext.h:
        * html/canvas/WebGLRenderingContext.idl:
        * platform/graphics/Extensions3D.h:
        * platform/graphics/GraphicsContext3D.cpp:
        (WebCore::GraphicsContext3D::computeFormatAndTypeParameters):
        (WebCore::GraphicsContext3D::extractTextureData):
        (WebCore::doUnpackingAndPacking):
        (WebCore::doPacking):
        (WebCore::doFloatingPointPacking):
        (WebCore::GraphicsContext3D::packPixels):
        * platform/graphics/GraphicsContext3D.h:
        * platform/graphics/chromium/Extensions3DChromium.h:
        * platform/graphics/opengl/Extensions3DOpenGL.cpp:
        (WebCore::Extensions3DOpenGL::supports):
        (WebCore::Extensions3DOpenGL::ensureEnabled):
        * platform/graphics/opengl/Extensions3DOpenGL.h:
        * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
        (WebCore::GraphicsContext3D::texImage2D):
        * platform/graphics/qt/Extensions3DQt.cpp:
        (WebCore::Extensions3DQt::ensureEnabled):
        * platform/graphics/qt/Extensions3DQt.h:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73806 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent dfffae98
......@@ -287,6 +287,7 @@ SET(WebCore_IDL_FILES
html/canvas/Int16Array.idl
html/canvas/Int32Array.idl
html/canvas/Int8Array.idl
html/canvas/OESTextureFloat.idl
html/canvas/Uint16Array.idl
html/canvas/Uint32Array.idl
html/canvas/Uint8Array.idl
......
2010-12-10 Kenneth Russell <kbr@google.com>
Reviewed by James Robinson.
Implement extension entry points and remove EXTENSIONS enum
https://bugs.webkit.org/show_bug.cgi?id=40316
Implemented WebGLRenderingContext's getSupportedExtensions and
getExtensions entry points, and, to verify them, added support for
the first specified WebGL extension, OES_texture_float. This
extension is now advertised in the Chromium and WebKit ports when
the underlying hardware supports it.
The new OES_texture_float test in the WebGL conformance suite
verifies the allocation and population of floating point textures,
and their use as render targets. However, because this extension
is optional, it is not easily testable with a layout test; there
is only one set of expectations for a given test, and two would be
needed, one when the extension is available and one when it is not.
Tested with the oes-texture-float.html WebGL conformance test in
Chromium and WebKit on Mac OS X on hardware that supports the
extension. Also verified with a configuration that does not
advertise the extension that this same test passes.
* CMakeLists.txt:
* DerivedSources.make:
* GNUmakefile.am:
* WebCore.gypi:
* WebCore.pri:
* WebCore.pro:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSWebGLRenderingContextCustom.cpp:
(WebCore::toJS):
(WebCore::JSWebGLRenderingContext::markChildren):
(WebCore::JSWebGLRenderingContext::getExtension):
(WebCore::JSWebGLRenderingContext::getSupportedExtensions):
* bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:
(WebCore::toV8Object):
(WebCore::V8WebGLRenderingContext::getExtensionCallback):
(WebCore::V8WebGLRenderingContext::getSupportedExtensionsCallback):
* html/canvas/OESTextureFloat.cpp: Added.
(WebCore::OESTextureFloat::OESTextureFloat):
(WebCore::OESTextureFloat::~OESTextureFloat):
(WebCore::OESTextureFloat::getName):
(WebCore::OESTextureFloat::create):
* html/canvas/OESTextureFloat.h: Added.
* html/canvas/OESTextureFloat.idl: Added.
* html/canvas/WebGLExtension.cpp: Added.
(WebCore::WebGLExtension::WebGLExtension):
(WebCore::WebGLExtension::~WebGLExtension):
* html/canvas/WebGLExtension.h: Added.
* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::getExtension):
(WebCore::WebGLRenderingContext::getSupportedExtensions):
(WebCore::WebGLRenderingContext::validateTexFuncFormatAndType):
(WebCore::WebGLRenderingContext::validateTexFuncData):
(WebCore::WebGLRenderingContext::getNumberOfExtensions):
(WebCore::WebGLRenderingContext::getExtensionNumber):
* html/canvas/WebGLRenderingContext.h:
* html/canvas/WebGLRenderingContext.idl:
* platform/graphics/Extensions3D.h:
* platform/graphics/GraphicsContext3D.cpp:
(WebCore::GraphicsContext3D::computeFormatAndTypeParameters):
(WebCore::GraphicsContext3D::extractTextureData):
(WebCore::doUnpackingAndPacking):
(WebCore::doPacking):
(WebCore::doFloatingPointPacking):
(WebCore::GraphicsContext3D::packPixels):
* platform/graphics/GraphicsContext3D.h:
* platform/graphics/chromium/Extensions3DChromium.h:
* platform/graphics/opengl/Extensions3DOpenGL.cpp:
(WebCore::Extensions3DOpenGL::supports):
(WebCore::Extensions3DOpenGL::ensureEnabled):
* platform/graphics/opengl/Extensions3DOpenGL.h:
* platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
(WebCore::GraphicsContext3D::texImage2D):
* platform/graphics/qt/Extensions3DQt.cpp:
(WebCore::Extensions3DQt::ensureEnabled):
* platform/graphics/qt/Extensions3DQt.h:
2010-12-10 Darin Adler <darin@apple.com>
Try to fix Windows build.
......
......@@ -310,6 +310,7 @@ DOM_CLASSES = \
Notation \
Notification \
NotificationCenter \
OESTextureFloat \
OverflowEvent \
PageTransitionEvent \
Performance \
......
......@@ -473,6 +473,8 @@ webcore_built_sources += \
DerivedSources/WebCore/JSNotificationCenter.h \
DerivedSources/WebCore/JSNotification.cpp \
DerivedSources/WebCore/JSNotification.h \
DerivedSources/WebCore/JSOESTextureFloat.cpp \
DerivedSources/WebCore/JSOESTextureFloat.h \
DerivedSources/WebCore/JSOverflowEvent.cpp \
DerivedSources/WebCore/JSOverflowEvent.h \
DerivedSources/WebCore/JSPageTransitionEvent.cpp \
......@@ -1565,6 +1567,8 @@ webcore_sources += \
WebCore/html/canvas/Int32Array.h \
WebCore/html/canvas/Int8Array.cpp \
WebCore/html/canvas/Int8Array.h \
WebCore/html/canvas/OESTextureFloat.cpp \
WebCore/html/canvas/OESTextureFloat.h \
WebCore/html/canvas/Uint16Array.cpp \
WebCore/html/canvas/Uint16Array.h \
WebCore/html/canvas/Uint32Array.cpp \
......
......@@ -213,6 +213,7 @@
'html/canvas/Int16Array.idl',
'html/canvas/Int32Array.idl',
'html/canvas/Int8Array.idl',
'html/canvas/OESTextureFloat.idl',
'html/canvas/Uint16Array.idl',
'html/canvas/Uint32Array.idl',
'html/canvas/Uint8Array.idl',
......@@ -1913,6 +1914,8 @@
'html/canvas/Int8Array.cpp',
'html/canvas/Int8Array.h',
'html/canvas/IntegralTypedArrayBase.h',
'html/canvas/OESTextureFloat.cpp',
'html/canvas/OESTextureFloat.h',
'html/canvas/TypedArrayBase.h',
'html/canvas/Uint16Array.cpp',
'html/canvas/Uint16Array.h',
......@@ -1926,6 +1929,8 @@
'html/canvas/WebGLContextAttributes.h',
'html/canvas/WebGLContextEvent.cpp',
'html/canvas/WebGLContextEvent.h',
'html/canvas/WebGLExtension.cpp',
'html/canvas/WebGLExtension.h',
'html/canvas/WebGLFramebuffer.cpp',
'html/canvas/WebGLFramebuffer.h',
'html/canvas/WebGLGetInfo.cpp',
......
......@@ -191,6 +191,7 @@ IDL_BINDINGS += \
html/canvas/CanvasPattern.idl \
html/canvas/CanvasRenderingContext.idl \
html/canvas/CanvasRenderingContext2D.idl \
html/canvas/OESTextureFloat.idl \
html/canvas/WebGLActiveInfo.idl \
html/canvas/WebGLBuffer.idl \
html/canvas/WebGLContextAttributes.idl \
......
......@@ -3728,6 +3728,7 @@ HEADERS += \
html/canvas/Int8Array.h \
html/canvas/WebGLContextAttributes.h \
html/canvas/Float32Array.h \
html/canvas/WebGLExtension.h \
html/canvas/WebGLFramebuffer.h \
html/canvas/WebGLGetInfo.h \
html/canvas/Int32Array.h \
......@@ -3736,6 +3737,7 @@ HEADERS += \
html/canvas/WebGLRenderingContext.h \
html/canvas/WebGLShader.h \
html/canvas/Int16Array.h \
html/canvas/OESTextureFloat.h \
html/canvas/WebGLTexture.h \
html/canvas/WebGLUniformLocation.h \
html/canvas/Uint8Array.h \
......@@ -3768,6 +3770,7 @@ SOURCES += \
html/canvas/Int8Array.cpp \
html/canvas/WebGLContextAttributes.cpp \
html/canvas/Float32Array.cpp \
html/canvas/WebGLExtension.cpp \
html/canvas/WebGLFramebuffer.cpp \
html/canvas/WebGLGetInfo.cpp \
html/canvas/Int32Array.cpp \
......@@ -3776,6 +3779,7 @@ SOURCES += \
html/canvas/WebGLRenderingContext.cpp \
html/canvas/WebGLShader.cpp \
html/canvas/Int16Array.cpp \
html/canvas/OESTextureFloat.cpp \
html/canvas/WebGLTexture.cpp \
html/canvas/WebGLUniformLocation.cpp \
html/canvas/Uint8Array.cpp \
......
......@@ -1523,6 +1523,12 @@
6E67D2A91280E8BD008758F7 /* Extensions3D.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E67D2A81280E8BD008758F7 /* Extensions3D.h */; };
6E96BB1C11986EE2007D94CD /* IntegralTypedArrayBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E96BB1A11986EE1007D94CD /* IntegralTypedArrayBase.h */; };
6E96BB1D11986EE2007D94CD /* TypedArrayBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E96BB1B11986EE1007D94CD /* TypedArrayBase.h */; };
6EBF0E4812A8926100DB1709 /* OESTextureFloat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6EBF0E4512A8926100DB1709 /* OESTextureFloat.cpp */; };
6EBF0E4912A8926100DB1709 /* OESTextureFloat.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EBF0E4612A8926100DB1709 /* OESTextureFloat.h */; };
6EBF0E5412A8929800DB1709 /* WebGLExtension.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6EBF0E5212A8929800DB1709 /* WebGLExtension.cpp */; };
6EBF0E5512A8929800DB1709 /* WebGLExtension.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EBF0E5312A8929800DB1709 /* WebGLExtension.h */; };
6EBF0E7612A9868800DB1709 /* JSOESTextureFloat.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6EBF0E7412A9868800DB1709 /* JSOESTextureFloat.cpp */; };
6EBF0E7712A9868800DB1709 /* JSOESTextureFloat.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EBF0E7512A9868800DB1709 /* JSOESTextureFloat.h */; };
6EE8A77210F803F3005A4A24 /* JSWebGLContextAttributes.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6EE8A77010F803F3005A4A24 /* JSWebGLContextAttributes.cpp */; };
6EE8A77310F803F3005A4A24 /* JSWebGLContextAttributes.h in Headers */ = {isa = PBXBuildFile; fileRef = 6EE8A77110F803F3005A4A24 /* JSWebGLContextAttributes.h */; };
72626E020EF022FE00A07E20 /* FontFastPath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 72626E010EF022FE00A07E20 /* FontFastPath.cpp */; };
......@@ -7886,6 +7892,13 @@
6E67D2A81280E8BD008758F7 /* Extensions3D.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Extensions3D.h; sourceTree = "<group>"; };
6E96BB1A11986EE1007D94CD /* IntegralTypedArrayBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = IntegralTypedArrayBase.h; path = canvas/IntegralTypedArrayBase.h; sourceTree = "<group>"; };
6E96BB1B11986EE1007D94CD /* TypedArrayBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TypedArrayBase.h; path = canvas/TypedArrayBase.h; sourceTree = "<group>"; };
6EBF0E4512A8926100DB1709 /* OESTextureFloat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = OESTextureFloat.cpp; path = canvas/OESTextureFloat.cpp; sourceTree = "<group>"; };
6EBF0E4612A8926100DB1709 /* OESTextureFloat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OESTextureFloat.h; path = canvas/OESTextureFloat.h; sourceTree = "<group>"; };
6EBF0E4712A8926100DB1709 /* OESTextureFloat.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = OESTextureFloat.idl; path = canvas/OESTextureFloat.idl; sourceTree = "<group>"; };
6EBF0E5212A8929800DB1709 /* WebGLExtension.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLExtension.cpp; path = canvas/WebGLExtension.cpp; sourceTree = "<group>"; };
6EBF0E5312A8929800DB1709 /* WebGLExtension.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLExtension.h; path = canvas/WebGLExtension.h; sourceTree = "<group>"; };
6EBF0E7412A9868800DB1709 /* JSOESTextureFloat.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSOESTextureFloat.cpp; sourceTree = "<group>"; };
6EBF0E7512A9868800DB1709 /* JSOESTextureFloat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSOESTextureFloat.h; sourceTree = "<group>"; };
6EE8A77010F803F3005A4A24 /* JSWebGLContextAttributes.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLContextAttributes.cpp; sourceTree = "<group>"; };
6EE8A77110F803F3005A4A24 /* JSWebGLContextAttributes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLContextAttributes.h; sourceTree = "<group>"; };
72626E010EF022FE00A07E20 /* FontFastPath.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FontFastPath.cpp; sourceTree = "<group>"; };
......@@ -13059,6 +13072,9 @@
49C7B9AC1042D32E0009D447 /* Int8Array.h */,
49C7B9AD1042D32E0009D447 /* Int8Array.idl */,
6E96BB1A11986EE1007D94CD /* IntegralTypedArrayBase.h */,
6EBF0E4512A8926100DB1709 /* OESTextureFloat.cpp */,
6EBF0E4612A8926100DB1709 /* OESTextureFloat.h */,
6EBF0E4712A8926100DB1709 /* OESTextureFloat.idl */,
6E96BB1B11986EE1007D94CD /* TypedArrayBase.h */,
49EECDDC10503C2300099FAB /* Uint16Array.cpp */,
49EECDDD10503C2400099FAB /* Uint16Array.h */,
......@@ -13080,6 +13096,8 @@
93F6F1EA127F70B10055CB06 /* WebGLContextEvent.cpp */,
93F6F1EB127F70B10055CB06 /* WebGLContextEvent.h */,
93F6F1EC127F70B10055CB06 /* WebGLContextEvent.idl */,
6EBF0E5212A8929800DB1709 /* WebGLExtension.cpp */,
6EBF0E5312A8929800DB1709 /* WebGLExtension.h */,
49C7B9AE1042D32E0009D447 /* WebGLFramebuffer.cpp */,
49C7B9AF1042D32E0009D447 /* WebGLFramebuffer.h */,
49C7B9B01042D32E0009D447 /* WebGLFramebuffer.idl */,
......@@ -15938,6 +15956,8 @@
49C7B9831042D2D30009D447 /* JSInt8Array.h */,
E44614100CD6826900FADA75 /* JSMediaError.cpp */,
E44614110CD6826900FADA75 /* JSMediaError.h */,
6EBF0E7412A9868800DB1709 /* JSOESTextureFloat.cpp */,
6EBF0E7512A9868800DB1709 /* JSOESTextureFloat.h */,
BCEF45F30E687B5C001C1287 /* JSTextMetrics.cpp */,
BCEF45F40E687B5C001C1287 /* JSTextMetrics.h */,
E44614120CD6826900FADA75 /* JSTimeRanges.cpp */,
......@@ -22167,6 +22187,9 @@
FDA15ECA12B03F50003A583A /* JSRealtimeAnalyserNode.h in Headers */,
FDA15ECE12B03F61003A583A /* JSJavaScriptAudioNode.h in Headers */,
FDA15ED212B03F94003A583A /* JSDelayNode.h in Headers */,
6EBF0E4912A8926100DB1709 /* OESTextureFloat.h in Headers */,
6EBF0E5512A8929800DB1709 /* WebGLExtension.h in Headers */,
6EBF0E7712A9868800DB1709 /* JSOESTextureFloat.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -24834,6 +24857,9 @@
FDA15ED112B03F94003A583A /* JSDelayNode.cpp in Sources */,
494BC40D12AEDD9E00743BD2 /* TransformationMatrixCA.cpp in Sources */,
BC51156E12B1749C00C96754 /* ScrollAnimatorMac.mm in Sources */,
6EBF0E4812A8926100DB1709 /* OESTextureFloat.cpp in Sources */,
6EBF0E5412A8929800DB1709 /* WebGLExtension.cpp in Sources */,
6EBF0E7612A9868800DB1709 /* JSOESTextureFloat.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -35,6 +35,7 @@
#include "JSHTMLCanvasElement.h"
#include "JSHTMLImageElement.h"
#include "JSImageData.h"
#include "JSOESTextureFloat.h"
#include "JSWebGLBuffer.h"
#include "JSFloat32Array.h"
#include "JSWebGLFramebuffer.h"
......@@ -47,8 +48,10 @@
#include "JSUint8Array.h"
#include "JSWebKitCSSMatrix.h"
#include "NotImplemented.h"
#include "OESTextureFloat.h"
#include "WebGLBuffer.h"
#include "Float32Array.h"
#include "WebGLExtension.h"
#include "WebGLFramebuffer.h"
#include "WebGLGetInfo.h"
#include "Int32Array.h"
......@@ -161,6 +164,27 @@ enum WhichProgramCall {
kProgramParameter, kUniform
};
static JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, WebGLExtension* extension)
{
if (!extension)
return jsNull();
switch (extension->getName()) {
case WebGLExtension::OESTextureFloatName:
return toJS(exec, globalObject, static_cast<OESTextureFloat*>(extension));
}
ASSERT_NOT_REACHED();
return jsNull();
}
void JSWebGLRenderingContext::markChildren(MarkStack& markStack)
{
Base::markChildren(markStack);
WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
for (int i = 0; i < context->getNumberOfExtensions(); ++i)
markDOMObjectWrapper(markStack, *Heap::heap(this)->globalData(), context->getExtensionNumber(i));
}
JSValue JSWebGLRenderingContext::getAttachedShaders(ExecState* exec)
{
if (exec->argumentCount() < 1)
......@@ -186,6 +210,19 @@ JSValue JSWebGLRenderingContext::getAttachedShaders(ExecState* exec)
return constructArray(exec, list);
}
JSValue JSWebGLRenderingContext::getExtension(ExecState* exec)
{
if (exec->argumentCount() < 1)
return throwSyntaxError(exec);
WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
const String& name = ustringToString(exec->argument(0).toString(exec));
if (exec->hadException())
return jsUndefined();
WebGLExtension* extension = context->getExtension(name);
return toJS(exec, globalObject(), extension);
}
JSValue JSWebGLRenderingContext::getBufferParameter(ExecState* exec)
{
return getObjectParameter(this, exec, kBuffer);
......@@ -280,6 +317,16 @@ JSValue JSWebGLRenderingContext::getShaderParameter(ExecState* exec)
return toJS(exec, globalObject(), info);
}
JSValue JSWebGLRenderingContext::getSupportedExtensions(ExecState* exec)
{
WebGLRenderingContext* context = static_cast<WebGLRenderingContext*>(impl());
Vector<String> value = context->getSupportedExtensions();
MarkedArgumentBuffer list;
for (size_t ii = 0; ii < value.size(); ++ii)
list.append(jsString(exec, value[ii]));
return constructArray(exec, list);
}
JSValue JSWebGLRenderingContext::getTexParameter(ExecState* exec)
{
return getObjectParameter(this, exec, kTexture);
......
......@@ -41,6 +41,7 @@
#include <wtf/FastMalloc.h>
#include "V8Binding.h"
#include "V8BindingMacros.h"
#include "V8ArrayBufferView.h"
#include "V8WebGLBuffer.h"
#include "V8Int8Array.h"
......@@ -60,6 +61,7 @@
#include "V8HTMLImageElement.h"
#include "V8HTMLVideoElement.h"
#include "V8ImageData.h"
#include "V8OESTextureFloat.h"
#include "V8Proxy.h"
#include "WebGLRenderingContext.h"
......@@ -151,6 +153,21 @@ static v8::Handle<v8::Value> toV8Object(const WebGLGetInfo& info)
}
}
static v8::Handle<v8::Value> toV8Object(WebGLExtension* extension, v8::Handle<v8::Object> contextObject)
{
if (!extension)
return v8::Null();
v8::Handle<v8::Value> extensionObject;
switch (extension->getName()) {
case WebGLExtension::OESTextureFloatName:
extensionObject = toV8(static_cast<OESTextureFloat*>(extension));
break;
}
ASSERT(!extensionObject.IsEmpty());
V8DOMWrapper::setHiddenReference(contextObject, extensionObject);
return extensionObject;
}
enum ObjectType {
kBuffer, kRenderbuffer, kTexture, kVertexAttrib
};
......@@ -243,6 +260,19 @@ v8::Handle<v8::Value> V8WebGLRenderingContext::getBufferParameterCallback(const
return getObjectParameter(args, kBuffer);
}
v8::Handle<v8::Value> V8WebGLRenderingContext::getExtensionCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.getExtensionCallback()");
WebGLRenderingContext* imp = V8WebGLRenderingContext::toNative(args.Holder());
if (args.Length() < 1) {
V8Proxy::setDOMException(SYNTAX_ERR);
return notHandledByInterceptor();
}
STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, name, args[0]);
WebGLExtension* extension = imp->getExtension(name);
return toV8Object(extension, args.Holder());
}
v8::Handle<v8::Value> V8WebGLRenderingContext::getFramebufferAttachmentParameterCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.getFramebufferAttachmentParameter()");
......@@ -341,6 +371,17 @@ v8::Handle<v8::Value> V8WebGLRenderingContext::getShaderParameterCallback(const
return toV8Object(info);
}
v8::Handle<v8::Value> V8WebGLRenderingContext::getSupportedExtensionsCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.getSupportedExtensionsCallback()");
WebGLRenderingContext* imp = V8WebGLRenderingContext::toNative(args.Holder());
Vector<String> value = imp->getSupportedExtensions();
v8::Local<v8::Array> array = v8::Array::New(value.size());
for (size_t ii = 0; ii < value.size(); ++ii)
array->Set(v8::Integer::New(ii), v8::String::New(fromWebCoreString(value[ii]), value[ii].length()));
return array;
}
v8::Handle<v8::Value> V8WebGLRenderingContext::getTexParameterCallback(const v8::Arguments& args)
{
INC_STATS("DOM.WebGLRenderingContext.getTexParameter()");
......
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#if ENABLE(3D_CANVAS)
#include "OESTextureFloat.h"
namespace WebCore {
OESTextureFloat::OESTextureFloat() : WebGLExtension()
{
}
OESTextureFloat::~OESTextureFloat()
{
}
WebGLExtension::ExtensionName OESTextureFloat::getName() const
{
return OESTextureFloatName;
}
PassRefPtr<OESTextureFloat> OESTextureFloat::create()
{
return adoptRef(new OESTextureFloat);
}
} // namespace WebCore
#endif // ENABLE(3D_CANVAS)
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef OESTextureFloat_h
#define OESTextureFloat_h
#include "WebGLExtension.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
namespace WebCore {
class OESTextureFloat : public WebGLExtension {
public:
static PassRefPtr<OESTextureFloat> create();
virtual ~OESTextureFloat();
virtual ExtensionName getName() const;
private:
OESTextureFloat();
};
} // namespace WebCore
#endif // OESTextureFloat_h
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
module html {
interface [Conditional=3D_CANVAS, OmitConstructor] OESTextureFloat {
};
}
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#if ENABLE(3D_CANVAS)
#include "WebGLExtension.h"
namespace WebCore {
WebGLExtension::WebGLExtension()
{
}
WebGLExtension::~WebGLExtension()
{
}
} // namespace WebCore
#endif // ENABLE(3D_CANVAS)
/*
* Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef WebGLExtension_h
#define WebGLExtension_h
#include <wtf/RefCounted.h>
namespace WebCore {
class WebGLExtension : public RefCounted<WebGLExtension> {