+2012-02-08 Gregg Tavares <gman@chromium.org>
+
+ Implement new WEBGL compressed texture extensions
+ https://bugs.webkit.org/show_bug.cgi?id=77066
+
+ Reviewed by Kenneth Russell.
+
+ * fast/canvas/webgl/constants.html:
+ * fast/canvas/webgl/gl-get-calls-expected.txt:
+ * fast/canvas/webgl/gl-get-calls.html:
+
2012-02-08 Csaba Osztrogonác <ossy@webkit.org>
[Qt] svg/zoom/page/zoom-coords-viewattr-01-b.svg fails
/* TEXTURE_WRAP_S */
/* TEXTURE_WRAP_T */
-NUM_COMPRESSED_TEXTURE_FORMATS : 0x86A2,
COMPRESSED_TEXTURE_FORMATS : 0x86A3,
/* HintMode */
PASS context.getParameter(context.MAX_FRAGMENT_UNIFORM_VECTORS) >= 16 is true
PASS context.getParameter(context.MAX_VERTEX_UNIFORM_VECTORS) >= 128 is true
PASS context.getParameter(context.MAX_VARYING_VECTORS) >= 8 is true
-PASS context.getParameter(context.NUM_COMPRESSED_TEXTURE_FORMATS) is 0
+PASS context.getParameter(context.COMPRESSED_TEXTURE_FORMATS) is []
PASS successfullyParsed is true
shouldBeTrue('context.getParameter(context.MAX_FRAGMENT_UNIFORM_VECTORS) >= 16');
shouldBeTrue('context.getParameter(context.MAX_VERTEX_UNIFORM_VECTORS) >= 128');
shouldBeTrue('context.getParameter(context.MAX_VARYING_VECTORS) >= 8');
- shouldBe('context.getParameter(context.NUM_COMPRESSED_TEXTURE_FORMATS)', '0');
+ shouldBe('context.getParameter(context.COMPRESSED_TEXTURE_FORMATS)', '[]');
}
debug("");
${THIRDPARTY_DIR}/ANGLE/src/compiler/ValidateLimitations.cpp
${THIRDPARTY_DIR}/ANGLE/src/compiler/VariableInfo.cpp
html/canvas/WebGLBuffer.cpp
- html/canvas/WebGLCompressedTextures.cpp
+ html/canvas/WebGLCompressedTextureS3TC.cpp
html/canvas/WebGLContextAttributes.cpp
html/canvas/WebGLContextEvent.cpp
html/canvas/WebGLContextGroup.cpp
html/canvas/OESVertexArrayObject.idl
html/canvas/WebGLActiveInfo.idl
html/canvas/WebGLBuffer.idl
- html/canvas/WebGLCompressedTextures.idl
+ html/canvas/WebGLCompressedTextureS3TC.idl
html/canvas/WebGLContextAttributes.idl
html/canvas/WebGLContextEvent.idl
html/canvas/WebGLDebugRendererInfo.idl
+2012-02-08 Gregg Tavares <gman@google.com>
+
+ Implement new WEBGL compressed texture extensions
+ https://bugs.webkit.org/show_bug.cgi?id=77066
+
+ This removes the old experimental compressed
+ texture extension and implements the first new
+ one.
+
+ A test is in the WebGL conformance tests in
+ extensions/webgl-compressed-texture-s3tc.html
+ and will be copied here in a future patch.
+
+ Reviewed by Kenneth Russell.
+
+ No new tests. Test coming in future patch.
+
+ * CMakeLists.txt:
+ * DerivedSources.make:
+ * GNUmakefile.list.am:
+ * Target.pri:
+ * WebCore.gypi:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSWebGLRenderingContextCustom.cpp:
+ (WebCore::toJS):
+ * bindings/v8/custom/V8WebGLRenderingContextCustom.cpp:
+ (WebCore::toV8Object):
+ * html/canvas/WebGLCompressedTextureS3TC.cpp: Added.
+ (WebCore):
+ (WebCore::WebGLCompressedTextureS3TC::WebGLCompressedTextureS3TC):
+ (WebCore::WebGLCompressedTextureS3TC::~WebGLCompressedTextureS3TC):
+ (WebCore::WebGLCompressedTextureS3TC::getName):
+ (WebCore::WebGLCompressedTextureS3TC::create):
+ (WebCore::WebGLCompressedTextureS3TC::supported):
+ * html/canvas/WebGLCompressedTextureS3TC.h: Copied from Source/WebCore/html/canvas/WebGLExtension.h.
+ (WebCore):
+ (WebGLCompressedTextureS3TC):
+ * html/canvas/WebGLCompressedTextureS3TC.idl: Renamed from Source/WebCore/html/canvas/WebGLCompressedTextures.idl.
+ * html/canvas/WebGLCompressedTextures.cpp: Removed.
+ * html/canvas/WebGLCompressedTextures.h: Removed.
+ * html/canvas/WebGLExtension.h:
+ * html/canvas/WebGLGetInfo.cpp:
+ (WebCore::WebGLGetInfo::WebGLGetInfo):
+ (WebCore):
+ (WebCore::WebGLGetInfo::getWebGLUnsignedIntArray):
+ * html/canvas/WebGLGetInfo.h:
+ * html/canvas/WebGLObject.cpp:
+ * html/canvas/WebGLRenderingContext.cpp:
+ (WebCore):
+ (WebCore::WebGLRenderingContext::addCompressedTextureFormat):
+ (WebCore::WebGLRenderingContext::compressedTexImage2D):
+ (WebCore::WebGLRenderingContext::compressedTexSubImage2D):
+ (WebCore::WebGLRenderingContext::getExtension):
+ (WebCore::WebGLRenderingContext::getParameter):
+ (WebCore::WebGLRenderingContext::getSupportedExtensions):
+ (WebCore::WebGLRenderingContext::validateCompressedTexFormat):
+ (WebCore::WebGLRenderingContext::validateCompressedTexFuncData):
+ (WebCore::WebGLRenderingContext::validateCompressedTexDimensions):
+ (WebCore::WebGLRenderingContext::validateCompressedTexSubDimensions):
+ * html/canvas/WebGLRenderingContext.h:
+ (WebCore):
+ (WebGLRenderingContext):
+ * html/canvas/WebGLRenderingContext.idl:
+
2012-02-08 Ilya Tikhonovsky <loislo@chromium.org>
Web Inspector: heap snapshot: implement Distance column in Object's retaining tree.
$(WebCore)/html/canvas/Uint8ClampedArray.idl \
$(WebCore)/html/canvas/WebGLActiveInfo.idl \
$(WebCore)/html/canvas/WebGLBuffer.idl \
- $(WebCore)/html/canvas/WebGLCompressedTextures.idl \
+ $(WebCore)/html/canvas/WebGLCompressedTextureS3TC.idl \
$(WebCore)/html/canvas/WebGLContextAttributes.idl \
$(WebCore)/html/canvas/WebGLContextEvent.idl \
$(WebCore)/html/canvas/WebGLFramebuffer.idl \
$$PWD/html/canvas/OESVertexArrayObject.idl \
$$PWD/html/canvas/WebGLActiveInfo.idl \
$$PWD/html/canvas/WebGLBuffer.idl \
+ $$PWD/html/canvas/WebGLCompressedTextureS3TC.idl \
$$PWD/html/canvas/WebGLContextAttributes.idl \
$$PWD/html/canvas/WebGLContextEvent.idl \
$$PWD/html/canvas/WebGLDebugRendererInfo.idl \
DerivedSources/WebCore/JSWebGLActiveInfo.h \
DerivedSources/WebCore/JSWebGLBuffer.cpp \
DerivedSources/WebCore/JSWebGLBuffer.h \
+ DerivedSources/WebCore/JSWebGLCompressedTextureS3TC.cpp \
+ DerivedSources/WebCore/JSWebGLCompressedTextureS3TC.h \
DerivedSources/WebCore/JSWebGLContextAttributes.cpp \
DerivedSources/WebCore/JSWebGLContextAttributes.h \
DerivedSources/WebCore/JSWebGLContextEvent.cpp \
$(WebCore)/html/canvas/Uint8ClampedArray.idl \
$(WebCore)/html/canvas/WebGLActiveInfo.idl \
$(WebCore)/html/canvas/WebGLBuffer.idl \
+ $(WebCore)/html/canvas/WebGLCompressedTextureS3TC.idl \
$(WebCore)/html/canvas/WebGLContextAttributes.idl \
$(WebCore)/html/canvas/WebGLContextEvent.idl \
$(WebCore)/html/canvas/WebGLFramebuffer.idl \
Source/WebCore/html/canvas/WebGLActiveInfo.h \
Source/WebCore/html/canvas/WebGLBuffer.cpp \
Source/WebCore/html/canvas/WebGLBuffer.h \
- Source/WebCore/html/canvas/WebGLCompressedTextures.cpp \
- Source/WebCore/html/canvas/WebGLCompressedTextures.h \
+ Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.cpp \
+ Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.h \
Source/WebCore/html/canvas/WebGLContextAttributes.cpp \
Source/WebCore/html/canvas/WebGLContextAttributes.h \
Source/WebCore/html/canvas/WebGLContextEvent.cpp \
html/canvas/WebGLObject.h \
html/canvas/WebGLActiveInfo.h \
html/canvas/WebGLBuffer.h \
- html/canvas/WebGLCompressedTextures.h \
+ html/canvas/WebGLCompressedTextureS3TC.h \
html/canvas/WebGLContextAttributes.h \
html/canvas/WebGLContextEvent.h \
html/canvas/WebGLContextGroup.h \
html/canvas/CanvasContextAttributes.cpp \
html/canvas/WebGLObject.cpp \
html/canvas/WebGLBuffer.cpp \
- html/canvas/WebGLCompressedTextures.cpp \
+ html/canvas/WebGLCompressedTextureS3TC.cpp \
html/canvas/WebGLContextAttributes.cpp \
html/canvas/WebGLContextEvent.cpp \
html/canvas/WebGLContextGroup.cpp \
'html/canvas/Uint8ClampedArray.idl',
'html/canvas/WebGLActiveInfo.idl',
'html/canvas/WebGLBuffer.idl',
- 'html/canvas/WebGLCompressedTextures.idl',
+ 'html/canvas/WebGLCompressedTextureS3TC.idl',
'html/canvas/WebGLContextAttributes.idl',
'html/canvas/WebGLContextEvent.idl',
'html/canvas/WebGLDebugRendererInfo.idl',
'html/canvas/WebGLActiveInfo.h',
'html/canvas/WebGLBuffer.cpp',
'html/canvas/WebGLBuffer.h',
- 'html/canvas/WebGLCompressedTextures.cpp',
- 'html/canvas/WebGLCompressedTextures.h',
+ 'html/canvas/WebGLCompressedTextureS3TC.cpp',
+ 'html/canvas/WebGLCompressedTextureS3TC.h',
'html/canvas/WebGLContextAttributes.cpp',
'html/canvas/WebGLContextAttributes.h',
'html/canvas/WebGLContextEvent.cpp',
'<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebGLActiveInfo.h',
'<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebGLBuffer.cpp',
'<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebGLBuffer.h',
+ '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebGLCompressedTextureS3TC.cpp',
+ '<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebGLCompressedTextureS3TC.h',
'<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebGLContextAttributes.cpp',
'<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebGLContextAttributes.h',
'<(PRODUCT_DIR)/DerivedSources/WebCore/JSWebGLFramebuffer.cpp',
65FEA86909833ADE00BED4AB /* Page.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 65FEA86809833ADE00BED4AB /* Page.cpp */; };
6E21C6C01126338500A7BE02 /* GraphicsContext3D.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E21C6BF1126338500A7BE02 /* GraphicsContext3D.cpp */; };
6E21C6C21126339900A7BE02 /* GraphicsContext3DCG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E21C6C11126339900A7BE02 /* GraphicsContext3DCG.cpp */; };
- 6E3FAD3814733F4000E42306 /* JSWebGLCompressedTextures.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E3FAD3614733F4000E42306 /* JSWebGLCompressedTextures.cpp */; };
- 6E3FAD3914733F4000E42306 /* JSWebGLCompressedTextures.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3FAD3714733F4000E42306 /* JSWebGLCompressedTextures.h */; };
- 6E3FAE8E14733FDB00E42306 /* WebGLCompressedTextures.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E3FAE8C14733FDB00E42306 /* WebGLCompressedTextures.cpp */; };
- 6E3FAE8F14733FDB00E42306 /* WebGLCompressedTextures.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3FAE8D14733FDB00E42306 /* WebGLCompressedTextures.h */; };
+ 6E3FAD3814733F4000E42306 /* JSWebGLCompressedTextureS3TC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E3FAD3614733F4000E42306 /* JSWebGLCompressedTextureS3TC.cpp */; };
+ 6E3FAD3914733F4000E42306 /* JSWebGLCompressedTextureS3TC.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3FAD3714733F4000E42306 /* JSWebGLCompressedTextureS3TC.h */; };
+ 6E3FAE8E14733FDB00E42306 /* WebGLCompressedTextureS3TC.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E3FAE8C14733FDB00E42306 /* WebGLCompressedTextureS3TC.cpp */; };
+ 6E3FAE8F14733FDB00E42306 /* WebGLCompressedTextureS3TC.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E3FAE8D14733FDB00E42306 /* WebGLCompressedTextureS3TC.h */; };
6E47E66010B7944B00B186C8 /* WebGLGetInfo.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E47E65E10B7944B00B186C8 /* WebGLGetInfo.cpp */; };
6E47E66110B7944B00B186C8 /* WebGLGetInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = 6E47E65F10B7944B00B186C8 /* WebGLGetInfo.h */; };
6E4ABCD4138EA0B70071D291 /* JSHTMLUnknownElement.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 6E4ABCD2138EA0B70071D291 /* JSHTMLUnknownElement.cpp */; };
65FEA86809833ADE00BED4AB /* Page.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Page.cpp; sourceTree = "<group>"; };
6E21C6BF1126338500A7BE02 /* GraphicsContext3D.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContext3D.cpp; sourceTree = "<group>"; };
6E21C6C11126339900A7BE02 /* GraphicsContext3DCG.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = GraphicsContext3DCG.cpp; sourceTree = "<group>"; };
- 6E3FAD3614733F4000E42306 /* JSWebGLCompressedTextures.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLCompressedTextures.cpp; sourceTree = "<group>"; };
- 6E3FAD3714733F4000E42306 /* JSWebGLCompressedTextures.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLCompressedTextures.h; sourceTree = "<group>"; };
- 6E3FAE8C14733FDB00E42306 /* WebGLCompressedTextures.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLCompressedTextures.cpp; path = canvas/WebGLCompressedTextures.cpp; sourceTree = "<group>"; };
- 6E3FAE8D14733FDB00E42306 /* WebGLCompressedTextures.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLCompressedTextures.h; path = canvas/WebGLCompressedTextures.h; sourceTree = "<group>"; };
- 6E3FAE9014733FEA00E42306 /* WebGLCompressedTextures.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = WebGLCompressedTextures.idl; path = canvas/WebGLCompressedTextures.idl; sourceTree = "<group>"; };
+ 6E3FAD3614733F4000E42306 /* JSWebGLCompressedTextureS3TC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSWebGLCompressedTextureS3TC.cpp; sourceTree = "<group>"; };
+ 6E3FAD3714733F4000E42306 /* JSWebGLCompressedTextureS3TC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGLCompressedTextureS3TC.h; sourceTree = "<group>"; };
+ 6E3FAE8C14733FDB00E42306 /* WebGLCompressedTextureS3TC.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLCompressedTextureS3TC.cpp; path = canvas/WebGLCompressedTextureS3TC.cpp; sourceTree = "<group>"; };
+ 6E3FAE8D14733FDB00E42306 /* WebGLCompressedTextureS3TC.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLCompressedTextureS3TC.h; path = canvas/WebGLCompressedTextureS3TC.h; sourceTree = "<group>"; };
+ 6E3FAE9014733FEA00E42306 /* WebGLCompressedTextureS3TC.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = WebGLCompressedTextureS3TC.idl; path = canvas/WebGLCompressedTextureS3TC.idl; sourceTree = "<group>"; };
6E47E65E10B7944B00B186C8 /* WebGLGetInfo.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WebGLGetInfo.cpp; path = canvas/WebGLGetInfo.cpp; sourceTree = "<group>"; };
6E47E65F10B7944B00B186C8 /* WebGLGetInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WebGLGetInfo.h; path = canvas/WebGLGetInfo.h; sourceTree = "<group>"; };
6E4ABCD2138EA0B70071D291 /* JSHTMLUnknownElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSHTMLUnknownElement.cpp; sourceTree = "<group>"; };
49C7B9A81042D32E0009D447 /* WebGLBuffer.cpp */,
49C7B9A91042D32E0009D447 /* WebGLBuffer.h */,
49C7B9AA1042D32E0009D447 /* WebGLBuffer.idl */,
- 6E3FAE8C14733FDB00E42306 /* WebGLCompressedTextures.cpp */,
- 6E3FAE8D14733FDB00E42306 /* WebGLCompressedTextures.h */,
- 6E3FAE9014733FEA00E42306 /* WebGLCompressedTextures.idl */,
+ 6E3FAE8C14733FDB00E42306 /* WebGLCompressedTextureS3TC.cpp */,
+ 6E3FAE8D14733FDB00E42306 /* WebGLCompressedTextureS3TC.h */,
+ 6E3FAE9014733FEA00E42306 /* WebGLCompressedTextureS3TC.idl */,
6E4E91A910F7FB3100A2779C /* WebGLContextAttributes.cpp */,
6E4E91AA10F7FB3100A2779C /* WebGLContextAttributes.h */,
6E4E91AB10F7FB3100A2779C /* WebGLContextAttributes.idl */,
A7D20F61107F406900A80392 /* JSWebGLActiveInfo.h */,
49C7B9801042D2D30009D447 /* JSWebGLBuffer.cpp */,
49C7B9811042D2D30009D447 /* JSWebGLBuffer.h */,
- 6E3FAD3614733F4000E42306 /* JSWebGLCompressedTextures.cpp */,
- 6E3FAD3714733F4000E42306 /* JSWebGLCompressedTextures.h */,
+ 6E3FAD3614733F4000E42306 /* JSWebGLCompressedTextureS3TC.cpp */,
+ 6E3FAD3714733F4000E42306 /* JSWebGLCompressedTextureS3TC.h */,
6EE8A77010F803F3005A4A24 /* JSWebGLContextAttributes.cpp */,
6EE8A77110F803F3005A4A24 /* JSWebGLContextAttributes.h */,
BC2CBF7A140F1D58003879BE /* JSWebGLContextEvent.cpp */,
FD82D7F813D4C8BD004E4372 /* JSWaveShaperNode.h in Headers */,
A7D20F63107F406900A80392 /* JSWebGLActiveInfo.h in Headers */,
49C7B9941042D2D30009D447 /* JSWebGLBuffer.h in Headers */,
- 6E3FAD3914733F4000E42306 /* JSWebGLCompressedTextures.h in Headers */,
+ 6E3FAD3914733F4000E42306 /* JSWebGLCompressedTextureS3TC.h in Headers */,
6EE8A77310F803F3005A4A24 /* JSWebGLContextAttributes.h in Headers */,
BC2CBF4E140F1ABD003879BE /* JSWebGLContextEvent.h in Headers */,
49C7B9981042D2D30009D447 /* JSWebGLFramebuffer.h in Headers */,
BC6DADEF0A195FDF00E5CD14 /* WebFontCache.h in Headers */,
A7D20F6D107F438B00A80392 /* WebGLActiveInfo.h in Headers */,
49C7B9C91042D32F0009D447 /* WebGLBuffer.h in Headers */,
- 6E3FAE8F14733FDB00E42306 /* WebGLCompressedTextures.h in Headers */,
+ 6E3FAE8F14733FDB00E42306 /* WebGLCompressedTextureS3TC.h in Headers */,
6E4E91AF10F7FB3100A2779C /* WebGLContextAttributes.h in Headers */,
93F6F1EE127F70B10055CB06 /* WebGLContextEvent.h in Headers */,
01D3CF8314BD0A3000FE9970 /* WebGLContextGroup.h in Headers */,
FD8E9BDF13D4CD2B0050DC72 /* JSWaveShaperNodeCustom.cpp in Sources */,
A7D20F62107F406900A80392 /* JSWebGLActiveInfo.cpp in Sources */,
49C7B9931042D2D30009D447 /* JSWebGLBuffer.cpp in Sources */,
- 6E3FAD3814733F4000E42306 /* JSWebGLCompressedTextures.cpp in Sources */,
+ 6E3FAD3814733F4000E42306 /* JSWebGLCompressedTextureS3TC.cpp in Sources */,
6EE8A77210F803F3005A4A24 /* JSWebGLContextAttributes.cpp in Sources */,
BC2CBF7B140F1D58003879BE /* JSWebGLContextEvent.cpp in Sources */,
49C7B9971042D2D30009D447 /* JSWebGLFramebuffer.cpp in Sources */,
93F19B0708245E59001E9ABC /* WebCoreView.m in Sources */,
BC6DADFA0A19602B00E5CD14 /* WebFontCache.mm in Sources */,
49C7B9C81042D32F0009D447 /* WebGLBuffer.cpp in Sources */,
- 6E3FAE8E14733FDB00E42306 /* WebGLCompressedTextures.cpp in Sources */,
+ 6E3FAE8E14733FDB00E42306 /* WebGLCompressedTextureS3TC.cpp in Sources */,
6E4E91AE10F7FB3100A2779C /* WebGLContextAttributes.cpp in Sources */,
93F6F1ED127F70B10055CB06 /* WebGLContextEvent.cpp in Sources */,
01D3CF8214BD0A3000FE9970 /* WebGLContextGroup.cpp in Sources */,
#include "JSOESStandardDerivatives.h"
#include "JSOESTextureFloat.h"
#include "JSOESVertexArrayObject.h"
+#include "JSUint32Array.h"
#include "JSUint8Array.h"
#include "JSWebGLBuffer.h"
+#include "JSWebGLCompressedTextureS3TC.h"
#include "JSWebGLFramebuffer.h"
#include "JSWebGLLoseContext.h"
#include "JSWebGLProgram.h"
#include "OESTextureFloat.h"
#include "OESVertexArrayObject.h"
#include "WebGLBuffer.h"
-#include "WebGLCompressedTextures.h"
+#include "WebGLCompressedTextureS3TC.h"
#include "WebGLDebugRendererInfo.h"
#include "WebGLDebugShaders.h"
#include "WebGLExtension.h"
#include <wtf/FastMalloc.h>
#include <wtf/Float32Array.h>
#include <wtf/Int32Array.h>
+#include <wtf/Uint32Array.h>
#if ENABLE(VIDEO)
#include "HTMLVideoElement.h"
return toJS(exec, globalObject, info.getWebGLTexture());
case WebGLGetInfo::kTypeWebGLUnsignedByteArray:
return toJS(exec, globalObject, info.getWebGLUnsignedByteArray());
+ case WebGLGetInfo::kTypeWebGLUnsignedIntArray:
+ return toJS(exec, globalObject, info.getWebGLUnsignedIntArray());
case WebGLGetInfo::kTypeWebGLVertexArrayObjectOES:
return toJS(exec, globalObject, info.getWebGLVertexArrayObjectOES());
default:
return toJS(exec, globalObject, static_cast<WebGLDebugRendererInfo*>(extension));
case WebGLExtension::WebGLDebugShadersName:
return toJS(exec, globalObject, static_cast<WebGLDebugShaders*>(extension));
- case WebGLExtension::WebKitWebGLCompressedTexturesName:
- return toJS(exec, globalObject, static_cast<WebGLCompressedTextures*>(extension));
+ case WebGLExtension::WebKitWebGLCompressedTextureS3TCName:
+ return toJS(exec, globalObject, static_cast<WebGLCompressedTextureS3TC*>(extension));
}
ASSERT_NOT_REACHED();
return jsNull();
#include "V8Uint32Array.h"
#include "V8Uint8Array.h"
#include "V8WebGLBuffer.h"
-#include "V8WebGLCompressedTextures.h"
+#include "V8WebGLCompressedTextureS3TC.h"
#include "V8WebGLDebugRendererInfo.h"
#include "V8WebGLDebugShaders.h"
#include "V8WebGLFramebuffer.h"
return toV8(info.getWebGLTexture());
case WebGLGetInfo::kTypeWebGLUnsignedByteArray:
return toV8(info.getWebGLUnsignedByteArray());
+ case WebGLGetInfo::kTypeWebGLUnsignedIntArray:
+ return toV8(info.getWebGLUnsignedIntArray());
case WebGLGetInfo::kTypeWebGLVertexArrayObjectOES:
return toV8(info.getWebGLVertexArrayObjectOES());
default:
extensionObject = toV8(static_cast<WebGLDebugShaders*>(extension));
referenceName = "webGLDebugShadersName";
break;
- case WebGLExtension::WebKitWebGLCompressedTexturesName:
- extensionObject = toV8(static_cast<WebGLCompressedTextures*>(extension));
- referenceName = "webKitWebGLCompressedTexturesName";
+ case WebGLExtension::WebKitWebGLCompressedTextureS3TCName:
+ extensionObject = toV8(static_cast<WebGLCompressedTextureS3TC*>(extension));
+ referenceName = "webKitWebGLCompressedTextureS3TCName";
break;
}
ASSERT(!extensionObject.IsEmpty());
--- /dev/null
+/*
+ * Copyright (C) 2011 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(WEBGL)
+
+#include "WebGLCompressedTextureS3TC.h"
+
+#include "Extensions3D.h"
+#include "WebGLRenderingContext.h"
+
+#include <wtf/Int32Array.h>
+#include <wtf/OwnArrayPtr.h>
+
+namespace WebCore {
+
+WebGLCompressedTextureS3TC::WebGLCompressedTextureS3TC(WebGLRenderingContext* context)
+ : WebGLExtension(context)
+{
+ context->addCompressedTextureFormat(Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT);
+ context->addCompressedTextureFormat(Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT);
+ context->addCompressedTextureFormat(Extensions3D::COMPRESSED_RGBA_S3TC_DXT3_EXT);
+ context->addCompressedTextureFormat(Extensions3D::COMPRESSED_RGBA_S3TC_DXT5_EXT);
+}
+
+WebGLCompressedTextureS3TC::~WebGLCompressedTextureS3TC()
+{
+}
+
+WebGLExtension::ExtensionName WebGLCompressedTextureS3TC::getName() const
+{
+ return WebKitWebGLCompressedTextureS3TCName;
+}
+
+PassOwnPtr<WebGLCompressedTextureS3TC> WebGLCompressedTextureS3TC::create(WebGLRenderingContext* context)
+{
+ return adoptPtr(new WebGLCompressedTextureS3TC(context));
+}
+
+bool WebGLCompressedTextureS3TC::supported(WebGLRenderingContext* context)
+{
+ Extensions3D* extensions = context->graphicsContext3D()->getExtensions();
+ return extensions->supports("GL_EXT_texture_compression_s3tc")
+ || (extensions->supports("GL_EXT_texture_compression_dxt1")
+ && extensions->supports("GL_CHROMIUM_texture_compression_dxt3")
+ && extensions->supports("GL_CHROMIUM_texture_compression_dxt5"));
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(WEBGL)
/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef WebGLCompressedTextures_h
-#define WebGLCompressedTextures_h
+#ifndef WebGLCompressedTextureS3TC_h
+#define WebGLCompressedTextureS3TC_h
#include "ExceptionCode.h"
#include "WebGLExtension.h"
-#include <wtf/ArrayBufferView.h>
#include <wtf/PassOwnPtr.h>
namespace WebCore {
class WebGLTexture;
-class WebGLCompressedTextures : public WebGLExtension {
+class WebGLCompressedTextureS3TC : public WebGLExtension {
public:
- static PassOwnPtr<WebGLCompressedTextures> create(WebGLRenderingContext*);
+ static PassOwnPtr<WebGLCompressedTextureS3TC> create(WebGLRenderingContext*);
static bool supported(WebGLRenderingContext*);
- virtual ~WebGLCompressedTextures();
+ virtual ~WebGLCompressedTextureS3TC();
virtual ExtensionName getName() const;
- void compressedTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width,
- GC3Dsizei height, GC3Dint border, ArrayBufferView* data);
- void compressedTexSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
- GC3Dsizei width, GC3Dsizei height, GC3Denum format, ArrayBufferView* data);
-
- WebGLGetInfo getCompressedTextureFormats();
-
private:
- WebGLCompressedTextures(WebGLRenderingContext*);
-
- bool validateCompressedTexFuncData(const char* functionName,
- GC3Dsizei width, GC3Dsizei height,
- GC3Denum format, ArrayBufferView* pixels);
-
- bool validateCompressedTexFormat(GC3Denum format);
-
- bool validateCompressedTexSubDimensions(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
- GC3Dsizei width, GC3Dsizei height, GC3Denum format, WebGLTexture*);
-
- bool m_supportsDxt1;
- bool m_supportsDxt5;
- bool m_supportsEtc1;
- bool m_supportsPvrtc;
-
- Vector<int> m_formats;
+ WebGLCompressedTextureS3TC(WebGLRenderingContext*);
};
} // namespace WebCore
-#endif // WebGLCompressedTextures_h
+#endif // WebGLCompressedTextureS3TC_h
/*
- * Copyright (C) 2011 Google Inc. All rights reserved.
+ * Copyright (C) 2012 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
JSGenerateIsReachable=ImplContext,
OmitConstructor,
DoNotCheckConstants
- ] WebGLCompressedTextures {
+ ] WebGLCompressedTextureS3TC {
/* Compressed Texture Formats */
const unsigned int COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0;
const unsigned int COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1;
+ const unsigned int COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2;
const unsigned int COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3;
- const unsigned int ETC1_RGB8_OES = 0x8D64;
- const unsigned int COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 0x8C00;
- const unsigned int COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 0x8C02;
-
- [StrictTypeChecking] void compressedTexImage2D(in unsigned long target, in long level, in unsigned long internalformat,
- in long width, in long height, in long border, in ArrayBufferView data);
- [StrictTypeChecking] void compressedTexSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset,
- in long width, in long height, in unsigned long format, in ArrayBufferView data);
};
}
+++ /dev/null
-/*
- * Copyright (C) 2011 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(WEBGL)
-
-#include "WebGLCompressedTextures.h"
-
-#include "Extensions3D.h"
-#include "WebGLRenderingContext.h"
-
-#include <wtf/Int32Array.h>
-#include <wtf/OwnArrayPtr.h>
-
-namespace WebCore {
-
-WebGLCompressedTextures::WebGLCompressedTextures(WebGLRenderingContext* context)
- : WebGLExtension(context)
- , m_supportsDxt1(false)
- , m_supportsDxt5(false)
- , m_supportsEtc1(false)
- , m_supportsPvrtc(false)
-{
- Extensions3D* extensions = context->graphicsContext3D()->getExtensions();
- if (extensions->supports("GL_EXT_texture_compression_dxt1")) {
- extensions->ensureEnabled("GL_EXT_texture_compression_dxt1");
- m_supportsDxt1 = true;
- }
- if (extensions->supports("GL_EXT_texture_compression_s3tc")) {
- extensions->ensureEnabled("GL_EXT_texture_compression_s3tc");
- m_supportsDxt1 = true;
- m_supportsDxt5 = true;
- }
- if (extensions->supports("GL_CHROMIUM_texture_compression_dxt5")) {
- extensions->ensureEnabled("GL_CHROMIUM_texture_compression_dxt5");
- m_supportsDxt5 = true;
- }
- if (extensions->supports("GL_OES_compressed_ETC1_RGB8_texture")) {
- extensions->ensureEnabled("GL_OES_compressed_ETC1_RGB8_texture");
- m_supportsEtc1 = true;
- }
- if (extensions->supports("GL_IMG_texture_compression_pvrtc")) {
- extensions->ensureEnabled("GL_IMG_texture_compression_pvrtc");
- m_supportsPvrtc = true;
- }
-
- if (m_supportsDxt1) {
- m_formats.append(Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT);
- m_formats.append(Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT);
- }
-
- if (m_supportsDxt5)
- m_formats.append(Extensions3D::COMPRESSED_RGBA_S3TC_DXT5_EXT);
-
- if (m_supportsEtc1)
- m_formats.append(Extensions3D::ETC1_RGB8_OES);
-
- if (m_supportsPvrtc) {
- m_formats.append(Extensions3D::COMPRESSED_RGB_PVRTC_4BPPV1_IMG);
- m_formats.append(Extensions3D::COMPRESSED_RGBA_PVRTC_4BPPV1_IMG);
- }
-}
-
-WebGLCompressedTextures::~WebGLCompressedTextures()
-{
-}
-
-WebGLExtension::ExtensionName WebGLCompressedTextures::getName() const
-{
- return WebKitWebGLCompressedTexturesName;
-}
-
-PassOwnPtr<WebGLCompressedTextures> WebGLCompressedTextures::create(WebGLRenderingContext* context)
-{
- return adoptPtr(new WebGLCompressedTextures(context));
-}
-
-bool WebGLCompressedTextures::supported(WebGLRenderingContext* context)
-{
- Extensions3D* extensions = context->graphicsContext3D()->getExtensions();
- return extensions->supports("GL_EXT_texture_compression_dxt1")
- || extensions->supports("GL_EXT_texture_compression_s3tc")
- || extensions->supports("GL_CHROMIUM_texture_compression_dxt5")
- || extensions->supports("GL_OES_compressed_ETC1_RGB8_texture")
- || extensions->supports("GL_IMG_texture_compression_pvrtc");
-}
-
-bool WebGLCompressedTextures::validateCompressedTexFormat(GC3Denum format)
-{
- switch (format) {
- case Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT:
- case Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT:
- return m_supportsDxt1;
- case Extensions3D::ETC1_RGB8_OES:
- return m_supportsEtc1;
- case Extensions3D::COMPRESSED_RGBA_S3TC_DXT5_EXT:
- return m_supportsDxt5;
- case Extensions3D::COMPRESSED_RGB_PVRTC_4BPPV1_IMG:
- case Extensions3D::COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:
- return m_supportsPvrtc;
- }
- return false;
-}
-
-bool WebGLCompressedTextures::validateCompressedTexFuncData(const char* functionName,
- GC3Dsizei width, GC3Dsizei height,
- GC3Denum format, ArrayBufferView* pixels)
-{
- if (!pixels) {
- m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no pixels");
- return false;
- }
- if (width < 0 || height < 0) {
- m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "width or height < 0");
- return false;
- }
-
- unsigned int bytesRequired = 0;
-
- switch (format) {
- case Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT:
- case Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case Extensions3D::ETC1_RGB8_OES:
- {
- const int kBlockWidth = 4;
- const int kBlockHeight = 4;
- const int kBlockSize = 8;
- int numBlocksAcross = (width + kBlockWidth - 1) / kBlockWidth;
- int numBlocksDown = (height + kBlockHeight - 1) / kBlockHeight;
- int numBlocks = numBlocksAcross * numBlocksDown;
- bytesRequired = numBlocks * kBlockSize;
- }
- break;
- case Extensions3D::COMPRESSED_RGBA_S3TC_DXT5_EXT:
- {
- const int kBlockWidth = 4;
- const int kBlockHeight = 4;
- const int kBlockSize = 16;
- int numBlocksAcross = (width + kBlockWidth - 1) / kBlockWidth;
- int numBlocksDown = (height + kBlockHeight - 1) / kBlockHeight;
- int numBlocks = numBlocksAcross * numBlocksDown;
- bytesRequired = numBlocks * kBlockSize;
- }
- break;
- case Extensions3D::COMPRESSED_RGB_PVRTC_4BPPV1_IMG:
- case Extensions3D::COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:
- {
- bytesRequired = (std::max(width, 8) * std::max(height, 8) + 7) / 8;
- }
- break;
- default:
- m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid format");
- return false;
- }
-
- if (pixels->byteLength() != bytesRequired) {
- m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "length of ArrayBufferView is not correct for dimensions");
- return false;
- }
-
- return true;
-}
-
-bool WebGLCompressedTextures::validateCompressedTexSubDimensions(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
- GC3Dsizei width, GC3Dsizei height, GC3Denum format, WebGLTexture* tex)
-{
- switch (format) {
- case Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT:
- case Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT:
- case Extensions3D::COMPRESSED_RGBA_S3TC_DXT5_EXT:
- case Extensions3D::ETC1_RGB8_OES:
- {
- const int kBlockWidth = 4;
- const int kBlockHeight = 4;
- if ((xoffset % kBlockWidth) || (yoffset % kBlockHeight))
- return false;
- if (!xoffset) {
- if (width != tex->getWidth(target, level))
- return false;
- } else {
- if (width % kBlockWidth)
- return false;
- }
- if (!yoffset) {
- if (height != tex->getHeight(target, level))
- return false;
- } else {
- if (height % kBlockHeight)
- return false;
- }
- return true;
- }
- case Extensions3D::COMPRESSED_RGB_PVRTC_4BPPV1_IMG:
- case Extensions3D::COMPRESSED_RGBA_PVRTC_4BPPV1_IMG:
- {
- if (xoffset || yoffset
- || width != tex->getWidth(target, level) || height != tex->getHeight(target, level)) {
- return false;
- }
- return true;
- }
- }
- return false;
-}
-
-void WebGLCompressedTextures::compressedTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width,
- GC3Dsizei height, GC3Dint border, ArrayBufferView* data)
-{
- if (m_context->isContextLost())
- return;
- if (!validateCompressedTexFormat(internalformat)) {
- m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "compressedTexImage2D", "invalid internalformat");
- return;
- }
- if (border) {
- m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "compressedTexImage2D", "border not 0");
- return;
- }
- if (!validateCompressedTexFuncData("compressedTexImage2D", width, height, internalformat, data))
- return;
- WebGLTexture* tex = m_context->validateTextureBinding("compressedTexImage2D", target, true);
- if (!tex)
- return;
- if (!m_context->isGLES2NPOTStrict()) {
- if (level && WebGLTexture::isNPOT(width, height)) {
- m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "compressedTexImage2D", "level > 0 not power of 2");
- return;
- }
- }
- m_context->graphicsContext3D()->compressedTexImage2D(target, level, internalformat, width, height,
- border, data->byteLength(), data->baseAddress());
- tex->setLevelInfo(target, level, internalformat, width, height, GraphicsContext3D::UNSIGNED_BYTE);
- m_context->cleanupAfterGraphicsCall(false);
-}
-
-void WebGLCompressedTextures::compressedTexSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
- GC3Dsizei width, GC3Dsizei height, GC3Denum format, ArrayBufferView* data)
-{
- if (m_context->isContextLost())
- return;
- if (!validateCompressedTexFormat(format)) {
- m_context->synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "compressedTexSubImage2D", "invalid format");
- return;
- }
- if (!validateCompressedTexFuncData("compressedTexSubImage2D", width, height, format, data))
- return;
-
- WebGLTexture* tex = m_context->validateTextureBinding("compressedTexSubImage2D", target, true);
- if (!tex)
- return;
-
- if (format != tex->getInternalFormat(target, level)) {
- m_context->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "compressedTexSubImage2D", "format does not match texture format");
- return;
- }
-
- if (!validateCompressedTexSubDimensions(target, level, xoffset, yoffset, width, height, format, tex)) {
- m_context->synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "compressedTexSubImage2D", "dimensions invalid for format");
- return;
- }
-
- m_context->graphicsContext3D()->compressedTexSubImage2D(target, level, xoffset, yoffset,
- width, height, format, data->byteLength(), data->baseAddress());
- m_context->cleanupAfterGraphicsCall(false);
-}
-
-WebGLGetInfo WebGLCompressedTextures::getCompressedTextureFormats()
-{
- return WebGLGetInfo(Int32Array::create(&m_formats[0], m_formats.size()));
-}
-
-} // namespace WebCore
-
-#endif // ENABLE(WEBGL)
OESVertexArrayObjectName,
WebGLDebugRendererInfoName,
WebGLDebugShadersName,
- WebKitWebGLCompressedTexturesName, // WEBKIT_ prefix until extension is official
+ WebKitWebGLCompressedTextureS3TCName, // WEBKIT_ prefix until extension is official
};
void ref() { m_context->ref(); }
#include "WebGLVertexArrayObjectOES.h"
#include <wtf/Float32Array.h>
#include <wtf/Int32Array.h>
+#include <wtf/Uint32Array.h>
#include <wtf/Uint8Array.h>
namespace WebCore {
{
}
+WebGLGetInfo::WebGLGetInfo(PassRefPtr<Uint32Array> value)
+ : m_type(kTypeWebGLUnsignedIntArray)
+ , m_bool(false)
+ , m_float(0)
+ , m_int(0)
+ , m_unsignedInt(0)
+ , m_webglUnsignedIntArray(value)
+{
+}
+
WebGLGetInfo::WebGLGetInfo(PassRefPtr<WebGLVertexArrayObjectOES> value)
: m_type(kTypeWebGLVertexArrayObjectOES)
, m_bool(false)
return m_webglUnsignedByteArray;
}
+PassRefPtr<Uint32Array> WebGLGetInfo::getWebGLUnsignedIntArray() const
+{
+ ASSERT(getType() == kTypeWebGLUnsignedIntArray);
+ return m_webglUnsignedIntArray;
+}
+
PassRefPtr<WebGLVertexArrayObjectOES> WebGLGetInfo::getWebGLVertexArrayObjectOES() const
{
ASSERT(getType() == kTypeWebGLVertexArrayObjectOES);
#include <wtf/Int32Array.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
+#include <wtf/Uint32Array.h>
#include <wtf/Uint8Array.h>
namespace WebCore {
kTypeWebGLRenderbuffer,
kTypeWebGLTexture,
kTypeWebGLUnsignedByteArray,
+ kTypeWebGLUnsignedIntArray,
kTypeWebGLVertexArrayObjectOES,
};
explicit WebGLGetInfo(PassRefPtr<WebGLRenderbuffer> value);
explicit WebGLGetInfo(PassRefPtr<WebGLTexture> value);
explicit WebGLGetInfo(PassRefPtr<Uint8Array> value);
+ explicit WebGLGetInfo(PassRefPtr<Uint32Array> value);
explicit WebGLGetInfo(PassRefPtr<WebGLVertexArrayObjectOES> value);
virtual ~WebGLGetInfo();
PassRefPtr<WebGLRenderbuffer> getWebGLRenderbuffer() const;
PassRefPtr<WebGLTexture> getWebGLTexture() const;
PassRefPtr<Uint8Array> getWebGLUnsignedByteArray() const;
+ PassRefPtr<Uint32Array> getWebGLUnsignedIntArray() const;
PassRefPtr<WebGLVertexArrayObjectOES> getWebGLVertexArrayObjectOES() const;
private:
RefPtr<WebGLRenderbuffer> m_webglRenderbuffer;
RefPtr<WebGLTexture> m_webglTexture;
RefPtr<Uint8Array> m_webglUnsignedByteArray;
+ RefPtr<Uint32Array> m_webglUnsignedIntArray;
RefPtr<WebGLVertexArrayObjectOES> m_webglVertexArrayObject;
};
#include "OESStandardDerivatives.h"
#include "OESTextureFloat.h"
#include "OESVertexArrayObject.h"
-#include "WebGLCompressedTextures.h"
+#include "WebGLCompressedTextureS3TC.h"
#include "WebGLContextGroup.h"
#include "WebGLDebugRendererInfo.h"
#include "WebGLDebugShaders.h"
#include "Settings.h"
#include "WebGLActiveInfo.h"
#include "WebGLBuffer.h"
-#include "WebGLCompressedTextures.h"
+#include "WebGLCompressedTextureS3TC.h"
#include "WebGLContextAttributes.h"
#include "WebGLContextEvent.h"
#include "WebGLContextGroup.h"
#include <wtf/OwnArrayPtr.h>
#include <wtf/PassOwnArrayPtr.h>
#include <wtf/Uint16Array.h>
+#include <wtf/Uint32Array.h>
#include <wtf/text/StringBuilder.h>
#if PLATFORM(QT)
return false;
}
+void WebGLRenderingContext::addCompressedTextureFormat(GC3Denum format)
+{
+ if (!m_compressedTextureFormats.contains(format))
+ m_compressedTextureFormats.append(format);
+}
+
WebGLRenderingContext::~WebGLRenderingContext()
{
// Remove all references to WebGLObjects so if they are the last reference
cleanupAfterGraphicsCall(false);
}
-void WebGLRenderingContext::compressedTexImage2D(GC3Denum /*target*/, GC3Dint /*level*/, GC3Denum /*internalformat*/, GC3Dsizei /*width*/,
- GC3Dsizei /*height*/, GC3Dint /*border*/, ArrayBufferView* /*data*/)
+void WebGLRenderingContext::compressedTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dsizei width,
+ GC3Dsizei height, GC3Dint border, ArrayBufferView* data)
{
if (isContextLost())
return;
+ if (!validateTexFuncLevel("compressedTexImage2D", target, level))
+ return;
+
+ if (!validateCompressedTexFormat(internalformat)) {
+ synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "compressedTexImage2D", "invalid internalformat");
+ return;
+ }
+ if (border) {
+ synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "compressedTexImage2D", "border not 0");
+ return;
+ }
+ if (!validateCompressedTexDimensions("compressedTexImage2D", level, width, height, internalformat))
+ return;
+ if (!validateCompressedTexFuncData("compressedTexImage2D", width, height, internalformat, data))
+ return;
- // FIXME: implement this.
- synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "compressedTexImage2D", "invalid internalformat");
+ WebGLTexture* tex = validateTextureBinding("compressedTexImage2D", target, true);
+ if (!tex)
+ return;
+ if (!isGLES2NPOTStrict()) {
+ if (level && WebGLTexture::isNPOT(width, height)) {
+ synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "compressedTexImage2D", "level > 0 not power of 2");
+ return;
+ }
+ }
+ graphicsContext3D()->compressedTexImage2D(target, level, internalformat, width, height,
+ border, data->byteLength(), data->baseAddress());
+ tex->setLevelInfo(target, level, internalformat, width, height, GraphicsContext3D::UNSIGNED_BYTE);
+ cleanupAfterGraphicsCall(false);
}
-void WebGLRenderingContext::compressedTexSubImage2D(GC3Denum /*target*/, GC3Dint /*level*/, GC3Dint /*xoffset*/, GC3Dint /*yoffset*/,
- GC3Dsizei /*width*/, GC3Dsizei /*height*/, GC3Denum /*format*/, ArrayBufferView* /*data*/)
+void WebGLRenderingContext::compressedTexSubImage2D(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
+ GC3Dsizei width, GC3Dsizei height, GC3Denum format, ArrayBufferView* data)
{
if (isContextLost())
return;
+ if (!validateTexFuncLevel("compressedTexSubImage2D", target, level))
+ return;
+ if (!validateCompressedTexFormat(format)) {
+ synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "compressedTexSubImage2D", "invalid format");
+ return;
+ }
+ if (!validateCompressedTexFuncData("compressedTexSubImage2D", width, height, format, data))
+ return;
+
+ WebGLTexture* tex = validateTextureBinding("compressedTexSubImage2D", target, true);
+ if (!tex)
+ return;
- // FIXME: implement this.
- synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "compressedTexSubImage2D", "invalid format");
+ if (format != tex->getInternalFormat(target, level)) {
+ synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "compressedTexSubImage2D", "format does not match texture format");
+ return;
+ }
+
+ if (!validateCompressedTexSubDimensions("compressedTexSubImage2D", target, level, xoffset, yoffset, width, height, format, tex))
+ return;
+
+ graphicsContext3D()->compressedTexSubImage2D(target, level, xoffset, yoffset,
+ width, height, format, data->byteLength(), data->baseAddress());
+ cleanupAfterGraphicsCall(false);
}
void WebGLRenderingContext::copyTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Dint border)
m_webglLoseContext = WebGLLoseContext::create(this);
return m_webglLoseContext.get();
}
- if (equalIgnoringCase(name, "WEBKIT_WEBGL_compressed_textures")) {
+ if (equalIgnoringCase(name, "WEBKIT_WEBGL_compressed_texture_s3tc")) {
// Use WEBKIT_ prefix until extension is official.
- if (!m_webglCompressedTextures)
- m_webglCompressedTextures = WebGLCompressedTextures::create(this);
- return m_webglCompressedTextures.get();
+ if (!m_webglCompressedTextureS3TC)
+ m_webglCompressedTextureS3TC = WebGLCompressedTextureS3TC::create(this);
+ return m_webglCompressedTextureS3TC.get();
}
if (allowPrivilegedExtensions()) {
case GraphicsContext3D::COLOR_WRITEMASK:
return getBooleanArrayParameter(pname);
case GraphicsContext3D::COMPRESSED_TEXTURE_FORMATS:
- if (m_webglCompressedTextures)
- return m_webglCompressedTextures->getCompressedTextureFormats();
- // Defined as null in the spec
- return WebGLGetInfo();
+ return WebGLGetInfo(Uint32Array::create(m_compressedTextureFormats.data(), m_compressedTextureFormats.size()));
case GraphicsContext3D::CULL_FACE:
return getBooleanParameter(pname);
case GraphicsContext3D::CULL_FACE_MODE:
return getIntParameter(pname);
case GraphicsContext3D::MAX_VIEWPORT_DIMS:
return getWebGLIntArrayParameter(pname);
- case GraphicsContext3D::NUM_COMPRESSED_TEXTURE_FORMATS:
- // WebGL 1.0 specifies that there are no compressed texture formats.
- return WebGLGetInfo(static_cast<int>(0));
case GraphicsContext3D::NUM_SHADER_BINARY_FORMATS:
// FIXME: should we always return 0 for this?
return getIntParameter(pname);
if (m_context->getExtensions()->supports("GL_OES_vertex_array_object"))
result.append("OES_vertex_array_object");
result.append("WEBKIT_WEBGL_lose_context");
- if (WebGLCompressedTextures::supported(this))
- result.append("WEBKIT_WEBGL_compressed_textures");
+ if (WebGLCompressedTextureS3TC::supported(this))
+ result.append("WEBKIT_WEBGL_compressed_texture_s3tc");
if (allowPrivilegedExtensions()) {
if (m_context->getExtensions()->supports("GL_ANGLE_translated_shader_source"))
return true;
}
+bool WebGLRenderingContext::validateCompressedTexFormat(GC3Denum format)
+{
+ return m_compressedTextureFormats.contains(format);
+}
+
+bool WebGLRenderingContext::validateCompressedTexFuncData(const char* functionName,
+ GC3Dsizei width, GC3Dsizei height,
+ GC3Denum format, ArrayBufferView* pixels)
+{
+ if (!pixels) {
+ synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "no pixels");
+ return false;
+ }
+ if (width < 0 || height < 0) {
+ synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "width or height < 0");
+ return false;
+ }
+
+ unsigned int bytesRequired = 0;
+
+ switch (format) {
+ case Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ {
+ const int kBlockWidth = 4;
+ const int kBlockHeight = 4;
+ const int kBlockSize = 8;
+ int numBlocksAcross = (width + kBlockWidth - 1) / kBlockWidth;
+ int numBlocksDown = (height + kBlockHeight - 1) / kBlockHeight;
+ int numBlocks = numBlocksAcross * numBlocksDown;
+ bytesRequired = numBlocks * kBlockSize;
+ }
+ break;
+ case Extensions3D::COMPRESSED_RGBA_S3TC_DXT3_EXT:
+ case Extensions3D::COMPRESSED_RGBA_S3TC_DXT5_EXT:
+ {
+ const int kBlockWidth = 4;
+ const int kBlockHeight = 4;
+ const int kBlockSize = 16;
+ int numBlocksAcross = (width + kBlockWidth - 1) / kBlockWidth;
+ int numBlocksDown = (height + kBlockHeight - 1) / kBlockHeight;
+ int numBlocks = numBlocksAcross * numBlocksDown;
+ bytesRequired = numBlocks * kBlockSize;
+ }
+ break;
+ default:
+ synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid format");
+ return false;
+ }
+
+ if (pixels->byteLength() != bytesRequired) {
+ synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "length of ArrayBufferView is not correct for dimensions");
+ return false;
+ }
+
+ return true;
+}
+
+bool WebGLRenderingContext::validateCompressedTexDimensions(const char* functionName, GC3Dint level, GC3Dsizei width, GC3Dsizei height, GC3Denum format)
+{
+ switch (format) {
+ case Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ case Extensions3D::COMPRESSED_RGBA_S3TC_DXT3_EXT:
+ case Extensions3D::COMPRESSED_RGBA_S3TC_DXT5_EXT: {
+ const int kBlockWidth = 4;
+ const int kBlockHeight = 4;
+ bool widthValid = (level && width == 1) || (level && width == 2) || !(width % kBlockWidth);
+ bool heightValid = (level && height == 1) || (level && height == 2) || !(height % kBlockHeight);
+ if (!widthValid || !heightValid) {
+ synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "width or height invalid for level");
+ return false;
+ }
+ return true;
+ }
+ default:
+ return false;
+ }
+}
+
+bool WebGLRenderingContext::validateCompressedTexSubDimensions(const char* functionName, GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
+ GC3Dsizei width, GC3Dsizei height, GC3Denum format, WebGLTexture* tex)
+{
+ if (xoffset < 0 || yoffset < 0) {
+ synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "xoffset or yoffset < 0");
+ return false;
+ }
+
+ switch (format) {
+ case Extensions3D::COMPRESSED_RGB_S3TC_DXT1_EXT:
+ case Extensions3D::COMPRESSED_RGBA_S3TC_DXT1_EXT:
+ case Extensions3D::COMPRESSED_RGBA_S3TC_DXT3_EXT:
+ case Extensions3D::COMPRESSED_RGBA_S3TC_DXT5_EXT: {
+ const int kBlockWidth = 4;
+ const int kBlockHeight = 4;
+ if ((xoffset % kBlockWidth) || (yoffset % kBlockHeight)) {
+ synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "xoffset or yoffset not multiple of 4");
+ return false;
+ }
+ if (width - xoffset > tex->getWidth(target, level)
+ || height - yoffset > tex->getHeight(target, level)) {
+ synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "dimensions out of range");
+ return false;
+ }
+ return validateCompressedTexDimensions(functionName, level, width, height, format);
+ }
+ default:
+ return false;
+ }
+}
+
bool WebGLRenderingContext::validateDrawMode(const char* functionName, GC3Denum mode)
{
switch (mode) {
class WebGLBuffer;
class WebGLContextGroup;
class WebGLContextObject;
-class WebGLCompressedTextures;
+class WebGLCompressedTextureS3TC;
class WebGLContextAttributes;
class WebGLDebugRendererInfo;
class WebGLDebugShaders;
friend class WebGLObject;
friend class OESVertexArrayObject;
friend class WebGLDebugShaders;
- friend class WebGLCompressedTextures;
+ friend class WebGLCompressedTextureS3TC;
friend class WebGLRenderingContextErrorMessageCallback;
WebGLRenderingContext(HTMLCanvasElement*, PassRefPtr<GraphicsContext3D>, GraphicsContext3D::Attributes);
bool validateWebGLObject(const char*, WebGLObject*);
+ // Adds a compressed texture format.
+ void addCompressedTextureFormat(GC3Denum);
+
#if ENABLE(VIDEO)
PassRefPtr<Image> videoFrameToImage(HTMLVideoElement*, ExceptionCode&);
#endif
RefPtr<WebGLTexture> m_blackTexture2D;
RefPtr<WebGLTexture> m_blackTextureCubeMap;
+ Vector<GC3Denum> m_compressedTextureFormats;
+
// Fixed-size cache of reusable image buffers for video texImage2D calls.
class LRUImageBufferCache {
public:
OwnPtr<WebGLLoseContext> m_webglLoseContext;
OwnPtr<WebGLDebugRendererInfo> m_webglDebugRendererInfo;
OwnPtr<WebGLDebugShaders> m_webglDebugShaders;
- OwnPtr<WebGLCompressedTextures> m_webglCompressedTextures;
+ OwnPtr<WebGLCompressedTextureS3TC> m_webglCompressedTextureS3TC;
// Helpers for getParameter and others
WebGLGetInfo getBooleanParameter(GC3Denum);
GC3Denum format, GC3Denum type,
ArrayBufferView* pixels);
+ // Helper function to validate compressed texture data is correct size
+ // for the given format and dimensions.
+ bool validateCompressedTexFuncData(const char* functionName,
+ GC3Dsizei width, GC3Dsizei height,
+ GC3Denum format, ArrayBufferView* pixels);
+
+ // Helper function for validating compressed texture formats.
+ bool validateCompressedTexFormat(GC3Denum format);
+
+ // Helper function to validate compressed texture dimensions are valid for
+ // the given format.
+ bool validateCompressedTexDimensions(const char* functionName, GC3Dint level, GC3Dsizei width, GC3Dsizei height, GC3Denum format);
+
+ // Helper function to validate compressed texture dimensions are valid for
+ // the given format.
+ bool validateCompressedTexSubDimensions(const char* functionName, GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset,
+ GC3Dsizei width, GC3Dsizei height, GC3Denum format, WebGLTexture*);
+
// Helper function to validate mode for draw{Arrays/Elements}.
bool validateDrawMode(const char* functionName, GC3Denum);
/* TEXTURE_WRAP_S */
/* TEXTURE_WRAP_T */
- const unsigned int NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2;
const unsigned int COMPRESSED_TEXTURE_FORMATS = 0x86A3;
/* HintMode */