Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1648)

Unified Diff: Source/platform/graphics/gpu/DrawingBuffer.cpp

Issue 1002523007: Removed arbitrary 4096 size limit on WebGL canvas backbuffers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Testing potential fix Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/platform/graphics/gpu/DrawingBuffer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/graphics/gpu/DrawingBuffer.cpp
diff --git a/Source/platform/graphics/gpu/DrawingBuffer.cpp b/Source/platform/graphics/gpu/DrawingBuffer.cpp
index aa528a3b761c82c8ed8dd9b4e8eaa86145009398..921199de031989157712021ea049004b5a7385ea 100644
--- a/Source/platform/graphics/gpu/DrawingBuffer.cpp
+++ b/Source/platform/graphics/gpu/DrawingBuffer.cpp
@@ -620,7 +620,8 @@ bool DrawingBuffer::resizeFramebuffer(const IntSize& size)
m_context->bindTexture(GL_TEXTURE_2D, m_colorBuffer.textureId);
- allocateTextureMemory(&m_colorBuffer, size);
+ if (!allocateTextureMemory(&m_colorBuffer, size))
+ return false;
if (m_multisampleMode == ImplicitResolve)
m_context->framebufferTexture2DMultisampleEXT(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_colorBuffer.textureId, 0, m_sampleCount);
@@ -629,8 +630,10 @@ bool DrawingBuffer::resizeFramebuffer(const IntSize& size)
m_context->bindTexture(GL_TEXTURE_2D, 0);
- if (m_multisampleMode != ExplicitResolve)
- resizeDepthStencil(size);
+ if (m_multisampleMode != ExplicitResolve) {
+ if (!resizeDepthStencil(size))
+ return false;
+ }
if (m_context->checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
return false;
@@ -649,7 +652,8 @@ bool DrawingBuffer::resizeMultisampleFramebuffer(const IntSize& size)
return false;
m_context->framebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, m_multisampleColorBuffer);
- resizeDepthStencil(size);
+ if (!resizeDepthStencil(size))
+ return false;
if (m_context->checkFramebufferStatus(GL_FRAMEBUFFER) != GL_FRAMEBUFFER_COMPLETE)
return false;
}
@@ -657,10 +661,10 @@ bool DrawingBuffer::resizeMultisampleFramebuffer(const IntSize& size)
return true;
}
-void DrawingBuffer::resizeDepthStencil(const IntSize& size)
+bool DrawingBuffer::resizeDepthStencil(const IntSize& size)
{
if (!m_requestedAttributes.depth && !m_requestedAttributes.stencil)
- return;
+ return true;
if (m_packedDepthStencilExtensionSupported) {
if (!m_depthStencilBuffer)
@@ -701,6 +705,11 @@ void DrawingBuffer::resizeDepthStencil(const IntSize& size)
}
}
m_context->bindRenderbuffer(GL_RENDERBUFFER, 0);
+
+ if (m_context->getError() == GL_OUT_OF_MEMORY)
+ return false;
+
+ return true;
}
@@ -963,19 +972,28 @@ void DrawingBuffer::texImage2DResourceSafe(GLenum target, GLint level, GLenum in
m_context->texImage2D(target, level, internalformat, width, height, border, format, type, 0);
}
-void DrawingBuffer::allocateTextureMemory(TextureInfo* info, const IntSize& size)
+bool DrawingBuffer::allocateTextureMemory(TextureInfo* info, const IntSize& size)
{
if (RuntimeEnabledFeatures::webGLImageChromiumEnabled()) {
deleteChromiumImageForTexture(info);
info->imageId = m_context->createGpuMemoryBufferImageCHROMIUM(size.width(), size.height(), GL_RGBA, GC3D_SCANOUT_CHROMIUM);
+
+ if (m_context->getError() == GL_OUT_OF_MEMORY)
+ return false;
+
if (info->imageId) {
m_context->bindTexImage2DCHROMIUM(GL_TEXTURE_2D, info->imageId);
- return;
+ return true;
}
}
texImage2DResourceSafe(GL_TEXTURE_2D, 0, m_internalColorFormat, size.width(), size.height(), 0, m_colorFormat, GL_UNSIGNED_BYTE);
+
+ if (m_context->getError() == GL_OUT_OF_MEMORY)
+ return false;
+
+ return true;
}
void DrawingBuffer::deleteChromiumImageForTexture(TextureInfo* info)
« no previous file with comments | « Source/platform/graphics/gpu/DrawingBuffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698