Log Message
[WebGL] Remove unused Chromium-specific OpenGL extensions https://bugs.webkit.org/show_bug.cgi?id=164782
Reviewed by Dean Jackson. No new tests because there is no behavior change. * html/canvas/WebGL2RenderingContext.cpp: (WebCore::WebGL2RenderingContext::copyBufferSubData): (WebCore::WebGL2RenderingContext::clear): (WebCore::WebGL2RenderingContext::getExtension): * html/canvas/WebGLCompressedTextureS3TC.cpp: (WebCore::WebGLCompressedTextureS3TC::supported): * html/canvas/WebGLDepthTexture.cpp: (WebCore::WebGLDepthTexture::supported): * html/canvas/WebGLDrawBuffers.cpp: (WebCore::WebGLDrawBuffers::satisfiesWebGLRequirements): * html/canvas/WebGLFramebuffer.cpp: (WebCore::WebGLFramebuffer::onAccess): * html/canvas/WebGLFramebuffer.h: * html/canvas/WebGLRenderingContext.cpp: (WebCore::WebGLRenderingContext::getExtension): (WebCore::WebGLRenderingContext::clear): * html/canvas/WebGLRenderingContextBase.cpp: (WebCore::WebGLRenderingContextBase::setupFlags): (WebCore::WebGLRenderingContextBase::bufferData): (WebCore::WebGLRenderingContextBase::bufferSubData): (WebCore::WebGLRenderingContextBase::copyTexSubImage2D): (WebCore::WebGLRenderingContextBase::validateDrawArrays): (WebCore::WebGLRenderingContextBase::validateDrawElements): (WebCore::WebGLRenderingContextBase::readPixels): (WebCore::WebGLRenderingContextBase::texImage2DBase): (WebCore::WebGLRenderingContextBase::copyTexImage2D): * html/canvas/WebGLRenderingContextBase.h: (WebCore::WebGLRenderingContextBase::isGLES2NPOTStrict): (WebCore::WebGLRenderingContextBase::isErrorGeneratedOnOutOfBoundsAccesses): Deleted. (WebCore::WebGLRenderingContextBase::isResourceSafe): Deleted. * platform/graphics/GraphicsContext3D.cpp: (WebCore::GraphicsContext3D::texImage2DResourceSafe): * platform/graphics/GraphicsContext3D.h: * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp: (WebCore::GraphicsContext3D::isResourceSafe): Deleted.
Modified Paths
- trunk/Source/WebCore/ChangeLog
- trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp
- trunk/Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.cpp
- trunk/Source/WebCore/html/canvas/WebGLDepthTexture.cpp
- trunk/Source/WebCore/html/canvas/WebGLDrawBuffers.cpp
- trunk/Source/WebCore/html/canvas/WebGLFramebuffer.cpp
- trunk/Source/WebCore/html/canvas/WebGLFramebuffer.h
- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h
- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.cpp
- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h
- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp
Diff
Modified: trunk/Source/WebCore/ChangeLog (208746 => 208747)
--- trunk/Source/WebCore/ChangeLog 2016-11-15 20:35:44 UTC (rev 208746)
+++ trunk/Source/WebCore/ChangeLog 2016-11-15 20:55:29 UTC (rev 208747)
@@ -1,3 +1,48 @@
+2016-11-15 Myles C. Maxfield <mmaxfi...@apple.com>
+
+ [WebGL] Remove unused Chromium-specific OpenGL extensions
+ https://bugs.webkit.org/show_bug.cgi?id=164782
+
+ Reviewed by Dean Jackson.
+
+ No new tests because there is no behavior change.
+
+ * html/canvas/WebGL2RenderingContext.cpp:
+ (WebCore::WebGL2RenderingContext::copyBufferSubData):
+ (WebCore::WebGL2RenderingContext::clear):
+ (WebCore::WebGL2RenderingContext::getExtension):
+ * html/canvas/WebGLCompressedTextureS3TC.cpp:
+ (WebCore::WebGLCompressedTextureS3TC::supported):
+ * html/canvas/WebGLDepthTexture.cpp:
+ (WebCore::WebGLDepthTexture::supported):
+ * html/canvas/WebGLDrawBuffers.cpp:
+ (WebCore::WebGLDrawBuffers::satisfiesWebGLRequirements):
+ * html/canvas/WebGLFramebuffer.cpp:
+ (WebCore::WebGLFramebuffer::onAccess):
+ * html/canvas/WebGLFramebuffer.h:
+ * html/canvas/WebGLRenderingContext.cpp:
+ (WebCore::WebGLRenderingContext::getExtension):
+ (WebCore::WebGLRenderingContext::clear):
+ * html/canvas/WebGLRenderingContextBase.cpp:
+ (WebCore::WebGLRenderingContextBase::setupFlags):
+ (WebCore::WebGLRenderingContextBase::bufferData):
+ (WebCore::WebGLRenderingContextBase::bufferSubData):
+ (WebCore::WebGLRenderingContextBase::copyTexSubImage2D):
+ (WebCore::WebGLRenderingContextBase::validateDrawArrays):
+ (WebCore::WebGLRenderingContextBase::validateDrawElements):
+ (WebCore::WebGLRenderingContextBase::readPixels):
+ (WebCore::WebGLRenderingContextBase::texImage2DBase):
+ (WebCore::WebGLRenderingContextBase::copyTexImage2D):
+ * html/canvas/WebGLRenderingContextBase.h:
+ (WebCore::WebGLRenderingContextBase::isGLES2NPOTStrict):
+ (WebCore::WebGLRenderingContextBase::isErrorGeneratedOnOutOfBoundsAccesses): Deleted.
+ (WebCore::WebGLRenderingContextBase::isResourceSafe): Deleted.
+ * platform/graphics/GraphicsContext3D.cpp:
+ (WebCore::GraphicsContext3D::texImage2DResourceSafe):
+ * platform/graphics/GraphicsContext3D.h:
+ * platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp:
+ (WebCore::GraphicsContext3D::isResourceSafe): Deleted.
+
2016-11-14 Brent Fulgham <bfulg...@apple.com>
Correct handling of changing input type
Modified: trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp (208746 => 208747)
--- trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp 2016-11-15 20:35:44 UTC (rev 208746)
+++ trunk/Source/WebCore/html/canvas/WebGL2RenderingContext.cpp 2016-11-15 20:55:29 UTC (rev 208747)
@@ -198,11 +198,9 @@
return;
}
- if (!this->isErrorGeneratedOnOutOfBoundsAccesses()) {
- if (!writeBuffer->associateCopyBufferSubData(*readBuffer, checkedReadOffset.unsafeGet(), checkedWriteOffset.unsafeGet(), checkedSize.unsafeGet())) {
- this->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "copyBufferSubData", "offset out of range");
- return;
- }
+ if (!writeBuffer->associateCopyBufferSubData(*readBuffer, checkedReadOffset.unsafeGet(), checkedWriteOffset.unsafeGet(), checkedSize.unsafeGet())) {
+ this->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "copyBufferSubData", "offset out of range");
+ return;
}
m_context->moveErrorsToSyntheticErrorList();
@@ -440,7 +438,7 @@
return;
}
const char* reason = "framebuffer incomplete";
- if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(), &reason)) {
+ if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) {
synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, "clear", reason);
return;
}
@@ -914,10 +912,8 @@
}
if (equalIgnoringASCIICase(name, "WEBGL_depth_texture")
&& WebGLDepthTexture::supported(*graphicsContext3D())) {
- if (!m_webglDepthTexture) {
- m_context->getExtensions().ensureEnabled("GL_CHROMIUM_depth_texture");
+ if (!m_webglDepthTexture)
m_webglDepthTexture = std::make_unique<WebGLDepthTexture>(*this);
- }
return m_webglDepthTexture.get();
}
if (equalIgnoringASCIICase(name, "WEBGL_debug_renderer_info")) {
Modified: trunk/Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.cpp (208746 => 208747)
--- trunk/Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.cpp 2016-11-15 20:35:44 UTC (rev 208746)
+++ trunk/Source/WebCore/html/canvas/WebGLCompressedTextureS3TC.cpp 2016-11-15 20:55:29 UTC (rev 208747)
@@ -56,9 +56,7 @@
{
auto& 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"));
+ || extensions.supports("GL_EXT_texture_compression_dxt1");
}
} // namespace WebCore
Modified: trunk/Source/WebCore/html/canvas/WebGLDepthTexture.cpp (208746 => 208747)
--- trunk/Source/WebCore/html/canvas/WebGLDepthTexture.cpp 2016-11-15 20:35:44 UTC (rev 208746)
+++ trunk/Source/WebCore/html/canvas/WebGLDepthTexture.cpp 2016-11-15 20:55:29 UTC (rev 208747)
@@ -50,8 +50,7 @@
bool WebGLDepthTexture::supported(GraphicsContext3D& context)
{
Extensions3D& extensions = context.getExtensions();
- return extensions.supports("GL_CHROMIUM_depth_texture")
- || extensions.supports("GL_OES_depth_texture")
+ return extensions.supports("GL_OES_depth_texture")
|| extensions.supports("GL_ARB_depth_texture");
}
Modified: trunk/Source/WebCore/html/canvas/WebGLDrawBuffers.cpp (208746 => 208747)
--- trunk/Source/WebCore/html/canvas/WebGLDrawBuffers.cpp 2016-11-15 20:35:44 UTC (rev 208746)
+++ trunk/Source/WebCore/html/canvas/WebGLDrawBuffers.cpp 2016-11-15 20:55:29 UTC (rev 208747)
@@ -103,9 +103,8 @@
context->bindFramebuffer(GraphicsContext3D::FRAMEBUFFER, fbo);
const unsigned char buffer[4] = { 0, 0, 0, 0 }; // textures are required to be initialized for other ports.
- bool supportsDepth = (context->getExtensions().supports("GL_CHROMIUM_depth_texture")
- || context->getExtensions().supports("GL_OES_depth_texture")
- || context->getExtensions().supports("GL_ARB_depth_texture"));
+ bool supportsDepth = context->getExtensions().supports("GL_OES_depth_texture")
+ || context->getExtensions().supports("GL_ARB_depth_texture");
bool supportsDepthStencil = (context->getExtensions().supports("GL_EXT_packed_depth_stencil")
|| context->getExtensions().supports("GL_OES_packed_depth_stencil"));
Platform3DObject depthStencil = 0;
Modified: trunk/Source/WebCore/html/canvas/WebGLFramebuffer.cpp (208746 => 208747)
--- trunk/Source/WebCore/html/canvas/WebGLFramebuffer.cpp 2016-11-15 20:35:44 UTC (rev 208746)
+++ trunk/Source/WebCore/html/canvas/WebGLFramebuffer.cpp 2016-11-15 20:55:29 UTC (rev 208747)
@@ -479,13 +479,11 @@
return GraphicsContext3D::FRAMEBUFFER_COMPLETE;
}
-bool WebGLFramebuffer::onAccess(GraphicsContext3D* context3d, bool needToInitializeAttachments, const char** reason)
+bool WebGLFramebuffer::onAccess(GraphicsContext3D* context3d, const char** reason)
{
if (checkStatus(reason) != GraphicsContext3D::FRAMEBUFFER_COMPLETE)
return false;
- if (needToInitializeAttachments)
- return initializeAttachments(context3d, reason);
- return true;
+ return initializeAttachments(context3d, reason);
}
bool WebGLFramebuffer::hasStencilBuffer() const
Modified: trunk/Source/WebCore/html/canvas/WebGLFramebuffer.h (208746 => 208747)
--- trunk/Source/WebCore/html/canvas/WebGLFramebuffer.h 2016-11-15 20:35:44 UTC (rev 208746)
+++ trunk/Source/WebCore/html/canvas/WebGLFramebuffer.h 2016-11-15 20:55:29 UTC (rev 208747)
@@ -78,7 +78,7 @@
// Return false if the framebuffer is incomplete; otherwise initialize
// the buffers if they haven't been initialized and
// needToInitializeAttachments is true.
- bool onAccess(GraphicsContext3D*, bool needToInitializeAttachments, const char** reason);
+ bool onAccess(GraphicsContext3D*, const char** reason);
// Software version of glCheckFramebufferStatus(), except that when
// FRAMEBUFFER_COMPLETE is returned, it is still possible for
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp (208746 => 208747)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp 2016-11-15 20:35:44 UTC (rev 208746)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContext.cpp 2016-11-15 20:55:29 UTC (rev 208747)
@@ -210,10 +210,8 @@
}
if (equalIgnoringASCIICase(name, "WEBGL_depth_texture")
&& WebGLDepthTexture::supported(*graphicsContext3D())) {
- if (!m_webglDepthTexture) {
- m_context->getExtensions().ensureEnabled("GL_CHROMIUM_depth_texture");
+ if (!m_webglDepthTexture)
m_webglDepthTexture = std::make_unique<WebGLDepthTexture>(*this);
- }
return m_webglDepthTexture.get();
}
if (equalIgnoringASCIICase(name, "WEBGL_draw_buffers") && supportsDrawBuffers()) {
@@ -456,7 +454,7 @@
return;
}
const char* reason = "framebuffer incomplete";
- if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(), &reason)) {
+ if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) {
synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, "clear", reason);
return;
}
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp (208746 => 208747)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2016-11-15 20:35:44 UTC (rev 208746)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp 2016-11-15 20:55:29 UTC (rev 208747)
@@ -575,8 +575,6 @@
m_synthesizedErrorsToConsole = page->settings().webGLErrorsToConsoleEnabled();
m_isGLES2Compliant = m_context->isGLES2Compliant();
- m_isErrorGeneratedOnOutOfBoundsAccesses = m_context->getExtensions().isEnabled("GL_CHROMIUM_strict_attribs");
- m_isResourceSafe = m_context->getExtensions().isEnabled("GL_CHROMIUM_resource_safe");
if (m_isGLES2Compliant) {
m_isGLES2NPOTStrict = !m_context->getExtensions().isEnabled("GL_OES_texture_npot");
m_isDepthStencilSupported = m_context->getExtensions().isEnabled("GL_OES_packed_depth_stencil");
@@ -1091,11 +1089,9 @@
synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferData", "size == 0");
return;
}
- if (!isErrorGeneratedOnOutOfBoundsAccesses()) {
- if (!buffer->associateBufferData(static_cast<GC3Dsizeiptr>(size))) {
- synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferData", "invalid buffer");
- return;
- }
+ if (!buffer->associateBufferData(static_cast<GC3Dsizeiptr>(size))) {
+ synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferData", "invalid buffer");
+ return;
}
m_context->moveErrorsToSyntheticErrorList();
@@ -1119,11 +1115,9 @@
return;
WTF::visit([&](auto& data) {
- if (!this->isErrorGeneratedOnOutOfBoundsAccesses()) {
- if (!buffer->associateBufferData(data.get())) {
- this->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferData", "invalid buffer");
- return;
- }
+ if (!buffer->associateBufferData(data.get())) {
+ this->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferData", "invalid buffer");
+ return;
}
m_context->moveErrorsToSyntheticErrorList();
@@ -1150,11 +1144,9 @@
return;
WTF::visit([&](auto& data) {
- if (!this->isErrorGeneratedOnOutOfBoundsAccesses()) {
- if (!buffer->associateBufferSubData(static_cast<GC3Dintptr>(offset), data.get())) {
- this->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferSubData", "offset out of range");
- return;
- }
+ if (!buffer->associateBufferSubData(static_cast<GC3Dintptr>(offset), data.get())) {
+ this->synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "bufferSubData", "offset out of range");
+ return;
}
m_context->moveErrorsToSyntheticErrorList();
@@ -1355,45 +1347,41 @@
return;
}
const char* reason = "framebuffer incomplete";
- if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(), &reason)) {
+ if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) {
synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, "copyTexSubImage2D", reason);
return;
}
clearIfComposited();
- if (isResourceSafe())
- m_context->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
- else {
- GC3Dint clippedX, clippedY;
- GC3Dsizei clippedWidth, clippedHeight;
- if (clip2D(x, y, width, height, getBoundFramebufferWidth(), getBoundFramebufferHeight(), &clippedX, &clippedY, &clippedWidth, &clippedHeight)) {
- GC3Denum format;
- GC3Denum type;
- if (!GraphicsContext3D::possibleFormatAndTypeForInternalFormat(tex->getInternalFormat(target, level), format, type)) {
- synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "copyTexSubImage2D", "Texture has unknown internal format");
+
+ GC3Dint clippedX, clippedY;
+ GC3Dsizei clippedWidth, clippedHeight;
+ if (clip2D(x, y, width, height, getBoundFramebufferWidth(), getBoundFramebufferHeight(), &clippedX, &clippedY, &clippedWidth, &clippedHeight)) {
+ GC3Denum format;
+ GC3Denum type;
+ if (!GraphicsContext3D::possibleFormatAndTypeForInternalFormat(tex->getInternalFormat(target, level), format, type)) {
+ synthesizeGLError(GraphicsContext3D::INVALID_ENUM, "copyTexSubImage2D", "Texture has unknown internal format");
+ return;
+ }
+ std::unique_ptr<unsigned char[]> zero;
+ if (width && height) {
+ unsigned size;
+ GC3Denum error = m_context->computeImageSizeInBytes(format, type, width, height, m_unpackAlignment, &size, 0);
+ if (error != GraphicsContext3D::NO_ERROR) {
+ synthesizeGLError(error, "copyTexSubImage2D", "bad dimensions");
return;
}
- std::unique_ptr<unsigned char[]> zero;
- if (width && height) {
- unsigned int size;
- GC3Denum error = m_context->computeImageSizeInBytes(format, type, width, height, m_unpackAlignment, &size, 0);
- if (error != GraphicsContext3D::NO_ERROR) {
- synthesizeGLError(error, "copyTexSubImage2D", "bad dimensions");
- return;
- }
- zero = std::make_unique<unsigned char[]>(size);
- if (!zero) {
- synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "copyTexSubImage2D", "out of memory");
- return;
- }
- memset(zero.get(), 0, size);
+ zero = std::make_unique<unsigned char[]>(size);
+ if (!zero) {
+ synthesizeGLError(GraphicsContext3D::INVALID_VALUE, "copyTexSubImage2D", "out of memory");
+ return;
}
- m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, zero.get());
- if (clippedWidth > 0 && clippedHeight > 0)
- m_context->copyTexSubImage2D(target, level, xoffset + clippedX - x, yoffset + clippedY - y,
- clippedX, clippedY, clippedWidth, clippedHeight);
- } else
- m_context->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
- }
+ memset(zero.get(), 0, size);
+ }
+ m_context->texSubImage2D(target, level, xoffset, yoffset, width, height, format, type, zero.get());
+ if (clippedWidth > 0 && clippedHeight > 0)
+ m_context->copyTexSubImage2D(target, level, xoffset + clippedX - x, yoffset + clippedY - y, clippedX, clippedY, clippedWidth, clippedHeight);
+ } else
+ m_context->copyTexSubImage2D(target, level, xoffset, yoffset, x, y, width, height);
}
RefPtr<WebGLBuffer> WebGLRenderingContextBase::createBuffer()
@@ -1818,29 +1806,22 @@
return false;
}
- if (!isErrorGeneratedOnOutOfBoundsAccesses()) {
- // Ensure we have a valid rendering state
- Checked<GC3Dint, RecordOverflow> checkedFirst(first);
- Checked<GC3Dint, RecordOverflow> checkedCount(count);
- Checked<GC3Dint, RecordOverflow> checkedSum = checkedFirst + checkedCount;
- Checked<GC3Dint, RecordOverflow> checkedPrimitiveCount(primitiveCount);
- if (checkedSum.hasOverflowed() || checkedPrimitiveCount.hasOverflowed() || !validateVertexAttributes(checkedSum.unsafeGet(), checkedPrimitiveCount.unsafeGet())) {
- synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attempt to access out of bounds arrays");
- return false;
- }
- if (!validateSimulatedVertexAttrib0(checkedSum.unsafeGet() - 1)) {
- synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attempt to access outside the bounds of the simulated vertexAttrib0 array");
- return false;
- }
- } else {
- if (!validateVertexAttributes(0)) {
- synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attribs not setup correctly");
- return false;
- }
+ // Ensure we have a valid rendering state.
+ Checked<GC3Dint, RecordOverflow> checkedFirst(first);
+ Checked<GC3Dint, RecordOverflow> checkedCount(count);
+ Checked<GC3Dint, RecordOverflow> checkedSum = checkedFirst + checkedCount;
+ Checked<GC3Dint, RecordOverflow> checkedPrimitiveCount(primitiveCount);
+ if (checkedSum.hasOverflowed() || checkedPrimitiveCount.hasOverflowed() || !validateVertexAttributes(checkedSum.unsafeGet(), checkedPrimitiveCount.unsafeGet())) {
+ synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attempt to access out of bounds arrays");
+ return false;
}
+ if (!validateSimulatedVertexAttrib0(checkedSum.unsafeGet() - 1)) {
+ synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attempt to access outside the bounds of the simulated vertexAttrib0 array");
+ return false;
+ }
const char* reason = "framebuffer incomplete";
- if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(), &reason)) {
+ if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) {
synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, functionName, reason);
return false;
}
@@ -1889,44 +1870,36 @@
synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "no ELEMENT_ARRAY_BUFFER bound");
return false;
}
+
+ // 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;
- 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()) {
+ 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;
}
-
- 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;
- }
- }
+ }
- if (!validateSimulatedVertexAttrib0(numElements)) {
- synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attempt to access outside the bounds of the simulated vertexAttrib0 array");
- return false;
- }
-
- } else {
- if (!validateVertexAttributes(0)) {
- synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attribs not setup correctly");
- return false;
- }
+ if (!validateSimulatedVertexAttrib0(numElements)) {
+ synthesizeGLError(GraphicsContext3D::INVALID_OPERATION, functionName, "attempt to access outside the bounds of the simulated vertexAttrib0 array");
+ return false;
}
const char* reason = "framebuffer incomplete";
- if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(), &reason)) {
+ if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) {
synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, functionName, reason);
return false;
}
@@ -3014,7 +2987,7 @@
GC3Denum internalFormat = 0;
if (m_framebufferBinding) {
const char* reason = "framebuffer incomplete";
- if (!m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(), &reason)) {
+ if (!m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) {
synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, "readPixels", reason);
return;
}
@@ -3283,18 +3256,8 @@
ASSERT(tex);
ASSERT(validateNPOTTextureLevel(width, height, level, "texImage2D"));
if (!pixels) {
- // Note: Chromium's OpenGL implementation clears textures and isResourceSafe() is therefore true.
- // For other implementations, if they are using ANGLE_depth_texture, ANGLE depth textures
- // can not be cleared with texImage2D and must be cleared by binding to an fbo and calling
- // clear.
- if (isResourceSafe())
- m_context->texImage2D(target, level, internalFormat, width, height, border, format, type, nullptr);
- else {
- bool succeed = m_context->texImage2DResourceSafe(target, level, internalFormat, width, height,
- border, format, type, m_unpackAlignment);
- if (!succeed)
- return;
- }
+ if (!m_context->texImage2DResourceSafe(target, level, internalFormat, width, height, border, format, type, m_unpackAlignment))
+ return;
} else {
ASSERT(validateSettableTexInternalFormat("texImage2D", internalFormat));
m_context->moveErrorsToSyntheticErrorList();
@@ -3978,26 +3941,24 @@
return;
}
const char* reason = "framebuffer incomplete";
- if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), !isResourceSafe(), &reason)) {
+ if (m_framebufferBinding && !m_framebufferBinding->onAccess(graphicsContext3D(), &reason)) {
synthesizeGLError(GraphicsContext3D::INVALID_FRAMEBUFFER_OPERATION, "copyTexImage2D", reason);
return;
}
clearIfComposited();
- if (isResourceSafe())
+
+ GC3Dint clippedX, clippedY;
+ GC3Dsizei clippedWidth, clippedHeight;
+ if (clip2D(x, y, width, height, getBoundFramebufferWidth(), getBoundFramebufferHeight(), &clippedX, &clippedY, &clippedWidth, &clippedHeight)) {
+ m_context->texImage2DResourceSafe(target, level, internalFormat, width, height, border,
+ internalFormat, GraphicsContext3D::UNSIGNED_BYTE, m_unpackAlignment);
+ if (clippedWidth > 0 && clippedHeight > 0) {
+ m_context->copyTexSubImage2D(target, level, clippedX - x, clippedY - y,
+ clippedX, clippedY, clippedWidth, clippedHeight);
+ }
+ } else
m_context->copyTexImage2D(target, level, internalFormat, x, y, width, height, border);
- else {
- GC3Dint clippedX, clippedY;
- GC3Dsizei clippedWidth, clippedHeight;
- if (clip2D(x, y, width, height, getBoundFramebufferWidth(), getBoundFramebufferHeight(), &clippedX, &clippedY, &clippedWidth, &clippedHeight)) {
- m_context->texImage2DResourceSafe(target, level, internalFormat, width, height, border,
- internalFormat, GraphicsContext3D::UNSIGNED_BYTE, m_unpackAlignment);
- if (clippedWidth > 0 && clippedHeight > 0) {
- m_context->copyTexSubImage2D(target, level, clippedX - x, clippedY - y,
- clippedX, clippedY, clippedWidth, clippedHeight);
- }
- } else
- m_context->copyTexImage2D(target, level, internalFormat, x, y, width, height, border);
- }
+
// FIXME: if the framebuffer is not complete, none of the below should be executed.
tex->setLevelInfo(target, level, internalFormat, width, height, GraphicsContext3D::UNSIGNED_BYTE);
}
Modified: trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h (208746 => 208747)
--- trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h 2016-11-15 20:35:44 UTC (rev 208746)
+++ trunk/Source/WebCore/html/canvas/WebGLRenderingContextBase.h 2016-11-15 20:55:29 UTC (rev 208747)
@@ -371,10 +371,6 @@
bool isGLES2Compliant() { return m_isGLES2Compliant; }
// Query if the GL implementation is NPOT strict.
bool isGLES2NPOTStrict() { return m_isGLES2NPOTStrict; }
- // Query if the GL implementation generates errors on out-of-bounds buffer accesses.
- bool isErrorGeneratedOnOutOfBoundsAccesses() { return m_isErrorGeneratedOnOutOfBoundsAccesses; }
- // Query if the GL implementation initializes textures/renderbuffers to 0.
- bool isResourceSafe() { return m_isResourceSafe; }
// Query if depth_stencil buffer is supported.
bool isDepthStencilSupported() { return m_isDepthStencilSupported; }
@@ -536,8 +532,6 @@
bool m_isGLES2Compliant;
bool m_isGLES2NPOTStrict;
- bool m_isErrorGeneratedOnOutOfBoundsAccesses;
- bool m_isResourceSafe;
bool m_isDepthStencilSupported;
bool m_isRobustnessEXTSupported;
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.cpp (208746 => 208747)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.cpp 2016-11-15 20:35:44 UTC (rev 208746)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.cpp 2016-11-15 20:55:29 UTC (rev 208747)
@@ -147,7 +147,7 @@
{
ASSERT(unpackAlignment == 1 || unpackAlignment == 2 || unpackAlignment == 4 || unpackAlignment == 8);
std::unique_ptr<unsigned char[]> zero;
- if (!isResourceSafe() && width > 0 && height > 0) {
+ if (width > 0 && height > 0) {
unsigned int size;
GC3Denum error = computeImageSizeInBytes(format, type, width, height, unpackAlignment, &size, 0);
if (error != GraphicsContext3D::NO_ERROR) {
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h (208746 => 208747)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h 2016-11-15 20:35:44 UTC (rev 208746)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext3D.h 2016-11-15 20:55:29 UTC (rev 208747)
@@ -1306,7 +1306,6 @@
#endif
int m_currentWidth, m_currentHeight;
- bool isResourceSafe();
#if PLATFORM(COCOA)
RetainPtr<WebGLLayer> m_webGLLayer;
Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp (208746 => 208747)
--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp 2016-11-15 20:35:44 UTC (rev 208746)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLCommon.cpp 2016-11-15 20:55:29 UTC (rev 208747)
@@ -156,11 +156,6 @@
}
}
-bool GraphicsContext3D::isResourceSafe()
-{
- return false;
-}
-
void GraphicsContext3D::paintRenderingResultsToCanvas(ImageBuffer* imageBuffer)
{
int rowBytes = m_currentWidth * 4;
_______________________________________________ webkit-changes mailing list webkit-changes@lists.webkit.org https://lists.webkit.org/mailman/listinfo/webkit-changes