<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[181596] trunk/Source/WebCore</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/181596">181596</a></dd>
<dt>Author</dt> <dd>roger_fong@apple.com</dd>
<dt>Date</dt> <dd>2015-03-16 16:46:43 -0700 (Mon, 16 Mar 2015)</dd>
</dl>
<h3>Log Message</h3>
<pre>[WebGL2] Instancing draw calls.
https://bugs.webkit.org/show_bug.cgi?id=126939.
<rdar://problem/15002379>
Reviewed by Dean Jackson.
Tested by a modified version of the 1.0.3 conformance tests:
conformance/extensions/angle-instanced-arrays.html
conformance/extensions/angle-instanced-arrays-out-of-bounds.html
These tests will be landed along with other modified extension conformance tests
once approval from Khronos is received.
* html/canvas/WebGL2RenderingContext.cpp:
(WebCore::WebGL2RenderingContext::clear): Generate error if clearing an integer color buffer.
(WebCore::WebGL2RenderingContext::vertexAttribDivisor): Call method from base class.
(WebCore::WebGL2RenderingContext::drawArraysInstanced): Ditto.
(WebCore::WebGL2RenderingContext::drawElementsInstanced): Ditto.
(WebCore::WebGL2RenderingContext::isIntegerFormat): Ditto.
(WebCore::WebGL2RenderingContext::validateDrawElements): Deleted. Move back to base class.
* html/canvas/WebGL2RenderingContext.h:
* html/canvas/WebGL2RenderingContext.idl: Add a missing enum.
* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::clear): Copied from WebGLRenderingContextBase.
(WebCore::WebGLRenderingContext::validateDrawElements): Deleted. Move back to base class.
* html/canvas/WebGLRenderingContext.h:
* html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::clear): Deleted. Moved to WebGLRenderingContext.
(WebCore::WebGLRenderingContextBase::getVertexAttrib): Check for WebGL2 context.
(WebCore::WebGLRenderingContext::validateDrawElements): Ditto.
* html/canvas/WebGLRenderingContextBase.h:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGL2RenderingContextcpp">trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGL2RenderingContexth">trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.h</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGL2RenderingContextidl">trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.idl</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGLRenderingContextcpp">trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGLRenderingContexth">trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGLRenderingContextBasecpp">trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp</a></li>
<li><a href="#trunkSourceWebCorehtmlcanvasWebGLRenderingContextBaseh">trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (181595 => 181596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-03-16 23:33:33 UTC (rev 181595)
+++ trunk/Source/WebCore/ChangeLog        2015-03-16 23:46:43 UTC (rev 181596)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2015-03-16 Roger Fong <roger_fong@apple.com>
+
+ [WebGL2] Instancing draw calls.
+ https://bugs.webkit.org/show_bug.cgi?id=126939.
+ <rdar://problem/15002379>
+
+ Reviewed by Dean Jackson.
+
+ Tested by a modified version of the 1.0.3 conformance tests:
+ conformance/extensions/angle-instanced-arrays.html
+ conformance/extensions/angle-instanced-arrays-out-of-bounds.html
+
+ These tests will be landed along with other modified extension conformance tests
+ once approval from Khronos is received.
+
+ * html/canvas/WebGL2RenderingContext.cpp:
+ (WebCore::WebGL2RenderingContext::clear): Generate error if clearing an integer color buffer.
+ (WebCore::WebGL2RenderingContext::vertexAttribDivisor): Call method from base class.
+ (WebCore::WebGL2RenderingContext::drawArraysInstanced): Ditto.
+ (WebCore::WebGL2RenderingContext::drawElementsInstanced): Ditto.
+ (WebCore::WebGL2RenderingContext::isIntegerFormat): Ditto.
+ (WebCore::WebGL2RenderingContext::validateDrawElements): Deleted. Move back to base class.
+ * html/canvas/WebGL2RenderingContext.h:
+ * html/canvas/WebGL2RenderingContext.idl: Add a missing enum.
+ * html/canvas/WebGLRenderingContext.cpp:
+ (WebCore::WebGLRenderingContext::clear): Copied from WebGLRenderingContextBase.
+ (WebCore::WebGLRenderingContext::validateDrawElements): Deleted. Move back to base class.
+ * html/canvas/WebGLRenderingContext.h:
+ * html/canvas/WebGLRenderingContextBase.cpp:
+ (WebCore::WebGLRenderingContextBase::clear): Deleted. Moved to WebGLRenderingContext.
+ (WebCore::WebGLRenderingContextBase::getVertexAttrib): Check for WebGL2 context.
+ (WebCore::WebGLRenderingContext::validateDrawElements): Ditto.
+ * html/canvas/WebGLRenderingContextBase.h:
+
</ins><span class="cx"> 2015-03-16 Commit Queue <commit-queue@webkit.org>
</span><span class="cx">
</span><span class="cx"> Unreviewed, rolling out r181572.
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGL2RenderingContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp (181595 => 181596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp        2015-03-16 23:33:33 UTC (rev 181595)
+++ trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp        2015-03-16 23:46:43 UTC (rev 181596)
</span><span class="lines">@@ -449,28 +449,50 @@
</span><span class="cx"> UNUSED_PARAM(offset);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void WebGL2RenderingContext::clear(GC3Dbitfield mask)
+{
+ if (isContextLostOrPending())
+ return;
+ if (mask & ~(GraphicsContext3D::COLOR_BUFFER_BIT | GraphicsContext3D::DEPTH_BUFFER_BIT | GraphicsContext3D::STENCIL_BUFFER_BIT)) {
+ synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "clear", "invalid mask");
+ return;
+ }
+ if (m_framebufferBinding && (mask & GraphicsContext3D::COLOR_BUFFER_BIT) && isIntegerFormat(m_framebufferBinding->getColorBufferFormat())) {
+ synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, "clear", "cannot clear an integer buffer");
+ return;
+ }
+ const char* reason = "framebuffer incomplete";
+ if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(), &reason)) {
+ synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, "clear", reason);
+ return;
+ }
+ if (!clearIfComposited(mask))
+ m_context->clear(mask);
+ markContextChanged();
+}
</ins><span class="cx">
</span><span class="cx"> void WebGL2RenderingContext::vertexAttribDivisor(GC3Duint index, GC3Duint divisor)
</span><span class="cx"> {
</span><del>- UNUSED_PARAM(index);
- UNUSED_PARAM(divisor);
</del><ins>+ if (isContextLostOrPending())
+ return;
+
+ WebGLRenderingContextBase::vertexAttribDivisor(index, divisor);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebGL2RenderingContext::drawArraysInstanced(GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei instanceCount)
</span><span class="cx"> {
</span><del>- UNUSED_PARAM(mode);
- UNUSED_PARAM(first);
- UNUSED_PARAM(count);
- UNUSED_PARAM(instanceCount);
</del><ins>+ if (isContextLostOrPending())
+ return;
+
+ WebGLRenderingContextBase::drawArraysInstanced(mode, first, count, instanceCount);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebGL2RenderingContext::drawElementsInstanced(GC3Denum mode, GC3Dsizei count, GC3Denum type, GC3Dint64 offset, GC3Dsizei instanceCount)
</span><span class="cx"> {
</span><del>- UNUSED_PARAM(mode);
- UNUSED_PARAM(count);
- UNUSED_PARAM(type);
- UNUSED_PARAM(offset);
- UNUSED_PARAM(instanceCount);
</del><ins>+ if (isContextLostOrPending())
+ return;
+
+ WebGLRenderingContextBase::drawElementsInstanced(mode, count, type, offset, instanceCount);
</ins><span class="cx"> }
</span><span class="cx">
</span><span class="cx"> void WebGL2RenderingContext::drawRangeElements(GC3Denum mode, GC3Duint start, GC3Duint end, GC3Dsizei count, GC3Denum type, GC3Dint64 offset)
</span><span class="lines">@@ -2043,6 +2065,18 @@
</span><span class="cx"> }
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool WebGL2RenderingContext::isIntegerFormat(GC3Denum internalformat)
+{
+ switch (baseInternalFormatFromInternalFormat(internalformat)) {
+ case GraphicsContext3D::RED_INTEGER:
+ case GraphicsContext3D::RG_INTEGER:
+ case GraphicsContext3D::RGB_INTEGER:
+ case GraphicsContext3D::RGBA_INTEGER:
+ return true;
+ }
+ return false;
+}
+
</ins><span class="cx"> WebGLGetInfo WebGL2RenderingContext::getParameter(GC3Denum pname, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><span class="lines">@@ -2435,83 +2469,6 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool WebGL2RenderingContext::validateDrawElements(const char* functionName, GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset, unsigned& numElements, GC3Dsizei primitiveCount)
-{
- if (isContextLostOrPending() || !validateDrawMode(functionName, mode))
- return false;
-
- if (!validateStencilSettings(functionName))
- return false;
-
- switch (type) {
- case GraphicsContext3D::UNSIGNED_BYTE:
- case GraphicsContext3D::UNSIGNED_SHORT:
- break;
- case GraphicsContext3D::UNSIGNED_INT:
- break;
- default:
- synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid type");
- return false;
- }
-
- if (count < 0 || offset < 0) {
- synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "count or offset < 0");
- return false;
- }
-
- if (!count) {
- markContextChanged();
- return false;
- }
-
- if (primitiveCount < 0) {
- synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "primcount < 0");
- return false;
- }
-
- if (!m_boundVertexArrayObject->getElementArrayBuffer()) {
- synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "no ELEMENT_ARRAY_BUFFER bound");
- return false;
- }
-
- if (!isErrorGeneratedOnOutOfBoundsAccesses()) {
- // Ensure we have a valid rendering state
- if (!validateElementArraySize(count, type, static_cast<GC3Dintptr>(offset))) {
- synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "request out of bounds for current ELEMENT_ARRAY_BUFFER");
- return false;
- }
- if (!count)
- return false;
-
- Checked<GC3Dint, RecordOverflow> checkedCount(count);
- Checked<GC3Dint, RecordOverflow> checkedPrimitiveCount(primitiveCount);
- if (checkedCount.hasOverflowed() || checkedPrimitiveCount.hasOverflowed()) {
- synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attempt to access out of bounds arrays");
- return false;
- }
-
- if (!validateIndexArrayConservative(type, numElements) || !validateVertexAttributes(numElements, checkedPrimitiveCount.unsafeGet())) {
- if (!validateIndexArrayPrecise(checkedCount.unsafeGet(), type, static_cast<GC3Dintptr>(offset), numElements) || !validateVertexAttributes(numElements, checkedPrimitiveCount.unsafeGet())) {
- synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attempt to access out of bounds arrays");
- return false;
- }
- }
- } else {
- if (!validateVertexAttributes(0)) {
- synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attribs not setup correctly");
- return false;
- }
- }
-
- const char* reason = "framebuffer incomplete";
- if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(), &reason)) {
- synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, functionName, reason);
- return false;
- }
-
- return true;
-}
-
</del><span class="cx"> bool WebGL2RenderingContext::validateBlendEquation(const char* functionName, GC3Denum mode)
</span><span class="cx"> {
</span><span class="cx"> switch (mode) {
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGL2RenderingContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.h (181595 => 181596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.h        2015-03-16 23:33:33 UTC (rev 181595)
+++ trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.h        2015-03-16 23:46:43 UTC (rev 181596)
</span><span class="lines">@@ -97,6 +97,7 @@
</span><span class="cx"> void vertexAttribIPointer(GC3Duint index, GC3Dint size, GC3Denum type, GC3Dsizei stride, GC3Dint64 offset);
</span><span class="cx">
</span><span class="cx"> /* Writing to the drawing buffer */
</span><ins>+ virtual void clear(GC3Dbitfield mask) override;
</ins><span class="cx"> void vertexAttribDivisor(GC3Duint index, GC3Duint divisor);
</span><span class="cx"> void drawArraysInstanced(GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei instanceCount);
</span><span class="cx"> void drawElementsInstanced(GC3Denum mode, GC3Dsizei count, GC3Denum type, GC3Dint64 offset, GC3Dsizei instanceCount);
</span><span class="lines">@@ -193,7 +194,6 @@
</span><span class="cx"> virtual GC3Dint getMaxDrawBuffers() override;
</span><span class="cx"> virtual GC3Dint getMaxColorAttachments() override;
</span><span class="cx"> virtual bool validateIndexArrayConservative(GC3Denum type, unsigned& numElementsRequired) override;
</span><del>- virtual bool validateDrawElements(const char* functionName, GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset, unsigned& numElements, GC3Dsizei primitiveCount) override;
</del><span class="cx"> virtual bool validateBlendEquation(const char* functionName, GC3Denum mode) override;
</span><span class="cx"> virtual bool validateTexFuncFormatAndType(const char* functionName, GC3Denum internalformat, GC3Denum format, GC3Denum type, GC3Dint level) override;
</span><span class="cx"> virtual bool validateTexFuncParameters(const char* functionName,
</span><span class="lines">@@ -212,6 +212,7 @@
</span><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> GC3Denum baseInternalFormatFromInternalFormat(GC3Denum internalformat);
</span><ins>+ bool isIntegerFormat(GC3Denum internalformat);
</ins><span class="cx"> void initializeShaderExtensions();
</span><span class="cx"> };
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGL2RenderingContextidl"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.idl (181595 => 181596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.idl        2015-03-16 23:33:33 UTC (rev 181595)
+++ trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.idl        2015-03-16 23:46:43 UTC (rev 181596)
</span><span class="lines">@@ -326,6 +326,7 @@
</span><span class="cx"> const GLenum MAX_ELEMENT_INDEX = 0x8D6B;
</span><span class="cx"> const GLenum NUM_SAMPLE_COUNTS = 0x9380;
</span><span class="cx"> const GLenum TEXTURE_IMMUTABLE_LEVELS = 0x82DF;
</span><ins>+ const GLenum VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE = 0x88FE;
</ins><span class="cx">
</span><span class="cx"> const GLuint64 TIMEOUT_IGNORED = 0xFFFFFFFFFFFFFFFF;
</span><span class="cx">
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLRenderingContextcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp (181595 => 181596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp        2015-03-16 23:33:33 UTC (rev 181595)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp        2015-03-16 23:46:43 UTC (rev 181596)
</span><span class="lines">@@ -448,6 +448,24 @@
</span><span class="cx"> }
</span><span class="cx"> m_context->hint(target, mode);
</span><span class="cx"> }
</span><ins>+
+void WebGLRenderingContext::clear(GC3Dbitfield mask)
+{
+ if (isContextLostOrPending())
+ return;
+ if (mask & ~(GraphicsContext3D::COLOR_BUFFER_BIT | GraphicsContext3D::DEPTH_BUFFER_BIT | GraphicsContext3D::STENCIL_BUFFER_BIT)) {
+ synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "clear", "invalid mask");
+ return;
+ }
+ const char* reason = "framebuffer incomplete";
+ if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(), &reason)) {
+ synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, "clear", reason);
+ return;
+ }
+ if (!clearIfComposited(mask))
+ m_context->clear(mask);
+ markContextChanged();
+}
</ins><span class="cx">
</span><span class="cx"> void WebGLRenderingContext::copyTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Dint border)
</span><span class="cx"> {
</span><span class="lines">@@ -1219,86 +1237,6 @@
</span><span class="cx"> return false;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-bool WebGLRenderingContext::validateDrawElements(const char* functionName, GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset, unsigned& numElements, GC3Dsizei primitiveCount)
-{
- if (isContextLostOrPending() || !validateDrawMode(functionName, mode))
- return false;
-
- if (!validateStencilSettings(functionName))
- return false;
-
- switch (type) {
- case GraphicsContext3D::UNSIGNED_BYTE:
- case GraphicsContext3D::UNSIGNED_SHORT:
- break;
- case GraphicsContext3D::UNSIGNED_INT:
- if (m_oesElementIndexUint)
- break;
- synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid type");
- return false;
- default:
- synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid type");
- return false;
- }
-
- if (count < 0 || offset < 0) {
- synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "count or offset < 0");
- return false;
- }
-
- if (!count) {
- markContextChanged();
- return false;
- }
-
- if (primitiveCount < 0) {
- synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "primcount < 0");
- return false;
- }
-
- if (!m_boundVertexArrayObject->getElementArrayBuffer()) {
- synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "no ELEMENT_ARRAY_BUFFER bound");
- return false;
- }
-
- if (!isErrorGeneratedOnOutOfBoundsAccesses()) {
- // Ensure we have a valid rendering state
- if (!validateElementArraySize(count, type, static_cast<GC3Dintptr>(offset))) {
- synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "request out of bounds for current ELEMENT_ARRAY_BUFFER");
- return false;
- }
- if (!count)
- return false;
-
- Checked<GC3Dint, RecordOverflow> checkedCount(count);
- Checked<GC3Dint, RecordOverflow> checkedPrimitiveCount(primitiveCount);
- if (checkedCount.hasOverflowed() || checkedPrimitiveCount.hasOverflowed()) {
- synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attempt to access out of bounds arrays");
- return false;
- }
-
- if (!validateIndexArrayConservative(type, numElements) || !validateVertexAttributes(numElements, checkedPrimitiveCount.unsafeGet())) {
- if (!validateIndexArrayPrecise(checkedCount.unsafeGet(), type, static_cast<GC3Dintptr>(offset), numElements) || !validateVertexAttributes(numElements, checkedPrimitiveCount.unsafeGet())) {
- synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attempt to access out of bounds arrays");
- return false;
- }
- }
- } else {
- if (!validateVertexAttributes(0)) {
- synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attribs not setup correctly");
- return false;
- }
- }
-
- const char* reason = "framebuffer incomplete";
- if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(), &reason)) {
- synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, functionName, reason);
- return false;
- }
-
- return true;
-}
-
</del><span class="cx"> bool WebGLRenderingContext::validateBlendEquation(const char* functionName, GC3Denum mode)
</span><span class="cx"> {
</span><span class="cx"> switch (mode) {
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLRenderingContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h (181595 => 181596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h        2015-03-16 23:33:33 UTC (rev 181595)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.h        2015-03-16 23:46:43 UTC (rev 181596)
</span><span class="lines">@@ -44,6 +44,7 @@
</span><span class="cx"> virtual void renderbufferStorage(GC3Denum target, GC3Denum internalformat, GC3Dsizei width, GC3Dsizei height) override;
</span><span class="cx"> virtual bool validateFramebufferFuncParameters(const char* functionName, GC3Denum target, GC3Denum attachment) override;
</span><span class="cx"> virtual void hint(GC3Denum target, GC3Denum mode) override;
</span><ins>+ virtual void clear(GC3Dbitfield mask) override;
</ins><span class="cx"> virtual void copyTexImage2D(GC3Denum target, GC3Dint level, GC3Denum internalformat, GC3Dint x, GC3Dint y, GC3Dsizei width, GC3Dsizei height, GC3Dint border) override;
</span><span class="cx"> virtual void texSubImage2DBase(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Dsizei width, GC3Dsizei height, GC3Denum internalformat, GC3Denum format, GC3Denum type, const void* pixels, ExceptionCode&) override;
</span><span class="cx"> virtual void texSubImage2DImpl(GC3Denum target, GC3Dint level, GC3Dint xoffset, GC3Dint yoffset, GC3Denum format, GC3Denum type, Image*, GraphicsContext3D::ImageHtmlDomSource, bool flipY, bool premultiplyAlpha, ExceptionCode&) override;
</span><span class="lines">@@ -66,7 +67,6 @@
</span><span class="cx"> virtual GC3Dint getMaxColorAttachments() override;
</span><span class="cx"> virtual void initializeVertexArrayObjects() override;
</span><span class="cx"> virtual bool validateIndexArrayConservative(GC3Denum type, unsigned& numElementsRequired) override;
</span><del>- virtual bool validateDrawElements(const char* functionName, GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset, unsigned& numElements, GC3Dsizei primitiveCount) override;
</del><span class="cx"> virtual bool validateBlendEquation(const char* functionName, GC3Denum mode) override;
</span><span class="cx"> virtual bool validateTexFuncParameters(const char* functionName,
</span><span class="cx"> TexFuncValidationFunctionType,
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLRenderingContextBasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (181595 => 181596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp        2015-03-16 23:33:33 UTC (rev 181595)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp        2015-03-16 23:46:43 UTC (rev 181596)
</span><span class="lines">@@ -1170,24 +1170,6 @@
</span><span class="cx"> return result;
</span><span class="cx"> }
</span><span class="cx">
</span><del>-void WebGLRenderingContextBase::clear(GC3Dbitfield mask)
-{
- if (isContextLostOrPending())
- return;
- if (mask & ~(GraphicsContext3D::COLOR_BUFFER_BIT | GraphicsContext3D::DEPTH_BUFFER_BIT | GraphicsContext3D::STENCIL_BUFFER_BIT)) {
- synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "clear", "invalid mask");
- return;
- }
- const char* reason = "framebuffer incomplete";
- if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(), &reason)) {
- synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, "clear", reason);
- return;
- }
- if (!clearIfComposited(mask))
- m_context->clear(mask);
- markContextChanged();
-}
-
</del><span class="cx"> void WebGLRenderingContextBase::clearColor(GC3Dfloat r, GC3Dfloat g, GC3Dfloat b, GC3Dfloat a)
</span><span class="cx"> {
</span><span class="cx"> if (isContextLostOrPending())
</span><span class="lines">@@ -1809,6 +1791,86 @@
</span><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+bool WebGLRenderingContextBase::validateDrawElements(const char* functionName, GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset, unsigned& numElements, GC3Dsizei primitiveCount)
+{
+ if (isContextLostOrPending() || !validateDrawMode(functionName, mode))
+ return false;
+
+ if (!validateStencilSettings(functionName))
+ return false;
+
+ switch (type) {
+ case GraphicsContext3D::UNSIGNED_BYTE:
+ case GraphicsContext3D::UNSIGNED_SHORT:
+ break;
+ case GraphicsContext3D::UNSIGNED_INT:
+ if (m_oesElementIndexUint && !isWebGL2())
+ break;
+ synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid type");
+ return false;
+ default:
+ synthesizeGLError(GraphicsContext3D::INVALID_ENUM, functionName, "invalid type");
+ return false;
+ }
+
+ if (count < 0 || offset < 0) {
+ synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "count or offset < 0");
+ return false;
+ }
+
+ if (!count) {
+ markContextChanged();
+ return false;
+ }
+
+ if (primitiveCount < 0) {
+ synthesizeGLError(GraphicsContext3D::INVALID_VALUE, functionName, "primcount < 0");
+ return false;
+ }
+
+ if (!m_boundVertexArrayObject->getElementArrayBuffer()) {
+ synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "no ELEMENT_ARRAY_BUFFER bound");
+ return false;
+ }
+
+ if (!isErrorGeneratedOnOutOfBoundsAccesses()) {
+ // Ensure we have a valid rendering state
+ if (!validateElementArraySize(count, type, static_cast<GC3Dintptr>(offset))) {
+ synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "request out of bounds for current ELEMENT_ARRAY_BUFFER");
+ return false;
+ }
+ if (!count)
+ return false;
+
+ Checked<GC3Dint, RecordOverflow> checkedCount(count);
+ Checked<GC3Dint, RecordOverflow> checkedPrimitiveCount(primitiveCount);
+ if (checkedCount.hasOverflowed() || checkedPrimitiveCount.hasOverflowed()) {
+ synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attempt to access out of bounds arrays");
+ return false;
+ }
+
+ if (!validateIndexArrayConservative(type, numElements) || !validateVertexAttributes(numElements, checkedPrimitiveCount.unsafeGet())) {
+ if (!validateIndexArrayPrecise(checkedCount.unsafeGet(), type, static_cast<GC3Dintptr>(offset), numElements) || !validateVertexAttributes(numElements, checkedPrimitiveCount.unsafeGet())) {
+ synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attempt to access out of bounds arrays");
+ return false;
+ }
+ }
+ } else {
+ if (!validateVertexAttributes(0)) {
+ synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attribs not setup correctly");
+ return false;
+ }
+ }
+
+ const char* reason = "framebuffer incomplete";
+ if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(), &reason)) {
+ synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, functionName, reason);
+ return false;
+ }
+
+ return true;
+}
+
</ins><span class="cx"> void WebGLRenderingContextBase::drawArrays(GC3Denum mode, GC3Dint first, GC3Dsizei count, ExceptionCode& ec)
</span><span class="cx"> {
</span><span class="cx"> UNUSED_PARAM(ec);
</span><span class="lines">@@ -2515,7 +2577,7 @@
</span><span class="cx">
</span><span class="cx"> const WebGLVertexArrayObjectBase::VertexAttribState& state = m_boundVertexArrayObject->getVertexAttribState(index);
</span><span class="cx">
</span><del>- if (m_angleInstancedArrays && pname == GraphicsContext3D::VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE)
</del><ins>+ if ((isWebGL2() || m_angleInstancedArrays) && pname == GraphicsContext3D::VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE)
</ins><span class="cx"> return WebGLGetInfo(state.divisor);
</span><span class="cx">
</span><span class="cx"> switch (pname) {
</span></span></pre></div>
<a id="trunkSourceWebCorehtmlcanvasWebGLRenderingContextBaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h (181595 => 181596)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h        2015-03-16 23:33:33 UTC (rev 181595)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h        2015-03-16 23:46:43 UTC (rev 181596)
</span><span class="lines">@@ -145,7 +145,7 @@
</span><span class="cx"> void bufferSubData(GC3Denum target, long long offset, ArrayBufferView* data, ExceptionCode&);
</span><span class="cx">
</span><span class="cx"> GC3Denum checkFramebufferStatus(GC3Denum target);
</span><del>- void clear(GC3Dbitfield mask);
</del><ins>+ virtual void clear(GC3Dbitfield mask) = 0;
</ins><span class="cx"> void clearColor(GC3Dfloat red, GC3Dfloat green, GC3Dfloat blue, GC3Dfloat alpha);
</span><span class="cx"> void clearDepth(GC3Dfloat);
</span><span class="cx"> void clearStencil(GC3Dint);
</span><span class="lines">@@ -354,7 +354,7 @@
</span><span class="cx">
</span><span class="cx"> unsigned getMaxVertexAttribs() const { return m_maxVertexAttribs; }
</span><span class="cx">
</span><del>- // ANGLE_instanced_arrays extension functions.
</del><ins>+ // Instanced Array helper functions.
</ins><span class="cx"> void drawArraysInstanced(GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei primcount);
</span><span class="cx"> void drawElementsInstanced(GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset, GC3Dsizei primcount);
</span><span class="cx"> void vertexAttribDivisor(GC3Duint index, GC3Duint divisor);
</span><span class="lines">@@ -421,7 +421,7 @@
</span><span class="cx"> bool validateWebGLObject(const char*, WebGLObject*);
</span><span class="cx">
</span><span class="cx"> bool validateDrawArrays(const char* functionName, GC3Denum mode, GC3Dint first, GC3Dsizei count, GC3Dsizei primcount);
</span><del>- virtual bool validateDrawElements(const char* functionName, GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset, unsigned& numElements, GC3Dsizei primcount) = 0;
</del><ins>+ bool validateDrawElements(const char* functionName, GC3Denum mode, GC3Dsizei count, GC3Denum type, long long offset, unsigned& numElements, GC3Dsizei primcount);
</ins><span class="cx">
</span><span class="cx"> // Adds a compressed texture format.
</span><span class="cx"> void addCompressedTextureFormat(GC3Denum);
</span></span></pre>
</div>
</div>
</body>
</html>