Title: [160991] trunk/Source/WebCore
Revision
160991
Author
changseok...@collabora.com
Date
2013-12-23 02:18:51 -0800 (Mon, 23 Dec 2013)

Log Message

[GTK][WK2] WebGL is not working with GLES
https://bugs.webkit.org/show_bug.cgi?id=126138

Reviewed by Martin Robinson.

m_texture has been unnecessarily regenerated. It's generated in GraphicsContext3D
constructor for offscreen rendering. And m_compositorTexture is used by only Mac port.
They create it in their GraphicsContext3D constructor so that we don't need to recreate it
in GC3DOpenGLES::reshapeFBOs.

No new tests since no functionality changed.

* platform/graphics/cairo/GraphicsContext3DCairo.cpp:
(WebCore::GraphicsContext3D::~GraphicsContext3D):
* platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
(WebCore::GraphicsContext3D::reshapeFBOs):
* platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
(WebCore::GraphicsContext3D::reshapeFBOs):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (160990 => 160991)


--- trunk/Source/WebCore/ChangeLog	2013-12-23 09:22:08 UTC (rev 160990)
+++ trunk/Source/WebCore/ChangeLog	2013-12-23 10:18:51 UTC (rev 160991)
@@ -1,3 +1,24 @@
+2013-12-23  ChangSeok Oh  <changseok...@collabora.com>
+
+        [GTK][WK2] WebGL is not working with GLES
+        https://bugs.webkit.org/show_bug.cgi?id=126138
+
+        Reviewed by Martin Robinson.
+
+        m_texture has been unnecessarily regenerated. It's generated in GraphicsContext3D
+        constructor for offscreen rendering. And m_compositorTexture is used by only Mac port.
+        They create it in their GraphicsContext3D constructor so that we don't need to recreate it
+        in GC3DOpenGLES::reshapeFBOs.
+
+        No new tests since no functionality changed.
+
+        * platform/graphics/cairo/GraphicsContext3DCairo.cpp:
+        (WebCore::GraphicsContext3D::~GraphicsContext3D):
+        * platform/graphics/opengl/GraphicsContext3DOpenGL.cpp:
+        (WebCore::GraphicsContext3D::reshapeFBOs):
+        * platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp:
+        (WebCore::GraphicsContext3D::reshapeFBOs):
+
 2013-12-22  Benjamin Poulain  <bpoul...@apple.com>
 
         Create a skeleton for CSS Selector code generation

Modified: trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp (160990 => 160991)


--- trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp	2013-12-23 09:22:08 UTC (rev 160990)
+++ trunk/Source/WebCore/platform/graphics/cairo/GraphicsContext3DCairo.cpp	2013-12-23 10:18:51 UTC (rev 160991)
@@ -159,8 +159,11 @@
         return;
 
     makeContextCurrent();
-    ::glDeleteTextures(1, &m_texture);
-    ::glDeleteTextures(1, &m_compositorTexture);
+    if (m_texture)
+        ::glDeleteTextures(1, &m_texture);
+    if (m_compositorTexture)
+        ::glDeleteTextures(1, &m_compositorTexture);
+
     if (m_attrs.antialias) {
         ::glDeleteRenderbuffers(1, &m_multisampleColorBuffer);
         if (m_attrs.stencil || m_attrs.depth)

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp (160990 => 160991)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp	2013-12-23 09:22:08 UTC (rev 160990)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGL.cpp	2013-12-23 10:18:51 UTC (rev 160991)
@@ -124,12 +124,18 @@
         mustRestoreFBO = true;
         ::glBindFramebufferEXT(GL_FRAMEBUFFER_EXT, m_fbo);
     }
+
+    ASSERT(m_texture);
     ::glBindTexture(GL_TEXTURE_2D, m_texture);
     ::glTexImage2D(GL_TEXTURE_2D, 0, m_internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0);
     ::glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT, GL_COLOR_ATTACHMENT0_EXT, GL_TEXTURE_2D, m_texture, 0);
-    ::glBindTexture(GL_TEXTURE_2D, m_compositorTexture);
-    ::glTexImage2D(GL_TEXTURE_2D, 0, m_internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0);
-    ::glBindTexture(GL_TEXTURE_2D, 0);
+
+    if (m_compositorTexture) {
+        ::glBindTexture(GL_TEXTURE_2D, m_compositorTexture);
+        ::glTexImage2D(GL_TEXTURE_2D, 0, m_internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0);
+        ::glBindTexture(GL_TEXTURE_2D, 0);
+    }
+
     if (!m_attrs.antialias && (m_attrs.stencil || m_attrs.depth)) {
         ::glBindRenderbufferEXT(GL_RENDERBUFFER_EXT, m_depthStencilBuffer);
         ::glRenderbufferStorageEXT(GL_RENDERBUFFER_EXT, internalDepthStencilFormat, width, height);

Modified: trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp (160990 => 160991)


--- trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp	2013-12-23 09:22:08 UTC (rev 160990)
+++ trunk/Source/WebCore/platform/graphics/opengl/GraphicsContext3DOpenGLES.cpp	2013-12-23 10:18:51 UTC (rev 160991)
@@ -124,15 +124,16 @@
         ::glBindFramebuffer(GL_FRAMEBUFFER, m_fbo);
     }
 
-    ::glGenTextures(1, &m_texture);
+    ASSERT(m_texture);
     ::glBindTexture(GL_TEXTURE_2D, m_texture);
     ::glTexImage2D(GL_TEXTURE_2D, 0, m_internalColorFormat, width, height, 0, colorFormat, pixelDataType, 0);
     ::glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, m_texture, 0);
 
-    ::glGenTextures(1, &m_compositorTexture);
-    ::glBindTexture(GL_TEXTURE_2D, m_compositorTexture);
-    ::glTexImage2D(GL_TEXTURE_2D, 0, m_internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0);
-    ::glBindTexture(GL_TEXTURE_2D, 0);
+    if (m_compositorTexture) {
+        ::glBindTexture(GL_TEXTURE_2D, m_compositorTexture);
+        ::glTexImage2D(GL_TEXTURE_2D, 0, m_internalColorFormat, width, height, 0, colorFormat, GL_UNSIGNED_BYTE, 0);
+        ::glBindTexture(GL_TEXTURE_2D, 0);
+    }
 
     // We don't support antialiasing yet. See GraphicsContext3D::validateAttributes.
     ASSERT(!m_attrs.antialias);
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to