[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da
zmo at google.com
zmo at google.com
Wed Dec 22 18:05:10 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 726cbee5031acb446c8cfa2a34fb029be7f0c03f
Author: zmo at google.com <zmo at google.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Dec 6 23:16:58 2010 +0000
2010-12-03 Zhenyao Mo <zmo at google.com>
Reviewed by Kenneth Russell.
Postpone gl delete* calls until shaders/programs are no longer attached
https://bugs.webkit.org/show_bug.cgi?id=50501
* html/canvas/WebGLBuffer.cpp:
(WebCore::WebGLBuffer::deleteObjectImpl): Simply delete GL resource.
* html/canvas/WebGLFramebuffer.cpp:
(WebCore::WebGLFramebuffer::deleteObjectImpl): Ditto.
* html/canvas/WebGLObject.cpp:
(WebCore::WebGLObject::deleteObject): Tracking whether deleteObjectImpl should be called or not.
* html/canvas/WebGLObject.h:
(WebCore::WebGLObject::detachContext): Set attachmentCount to 0 to ensure OpenGL resource deletion.
(WebCore::WebGLObject::onDetached): No need to track attachmentCount here as we track it in deleteObject.
(WebCore::WebGLObject::isDeleted): Make this public.
* html/canvas/WebGLProgram.cpp:
(WebCore::WebGLProgram::deleteObjectImpl): Simply delete GL resource.
* html/canvas/WebGLRenderbuffer.cpp:
(WebCore::WebGLRenderbuffer::deleteObjectImpl): Ditto.
* html/canvas/WebGLRenderingContext.cpp:
(WebCore::WebGLRenderingContext::getProgramParameter): intercept DELETE_STATUS.
(WebCore::WebGLRenderingContext::getShaderParameter): Ditto.
* html/canvas/WebGLShader.cpp:
(WebCore::WebGLShader::deleteObjectImpl): Simply delete GL resource.
* html/canvas/WebGLTexture.cpp:
(WebCore::WebGLTexture::deleteObjectImpl): Simply delete GL resource.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73406 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 907a3e8..1999892 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,32 @@
+2010-12-03 Zhenyao Mo <zmo at google.com>
+
+ Reviewed by Kenneth Russell.
+
+ Postpone gl delete* calls until shaders/programs are no longer attached
+ https://bugs.webkit.org/show_bug.cgi?id=50501
+
+ * html/canvas/WebGLBuffer.cpp:
+ (WebCore::WebGLBuffer::deleteObjectImpl): Simply delete GL resource.
+ * html/canvas/WebGLFramebuffer.cpp:
+ (WebCore::WebGLFramebuffer::deleteObjectImpl): Ditto.
+ * html/canvas/WebGLObject.cpp:
+ (WebCore::WebGLObject::deleteObject): Tracking whether deleteObjectImpl should be called or not.
+ * html/canvas/WebGLObject.h:
+ (WebCore::WebGLObject::detachContext): Set attachmentCount to 0 to ensure OpenGL resource deletion.
+ (WebCore::WebGLObject::onDetached): No need to track attachmentCount here as we track it in deleteObject.
+ (WebCore::WebGLObject::isDeleted): Make this public.
+ * html/canvas/WebGLProgram.cpp:
+ (WebCore::WebGLProgram::deleteObjectImpl): Simply delete GL resource.
+ * html/canvas/WebGLRenderbuffer.cpp:
+ (WebCore::WebGLRenderbuffer::deleteObjectImpl): Ditto.
+ * html/canvas/WebGLRenderingContext.cpp:
+ (WebCore::WebGLRenderingContext::getProgramParameter): intercept DELETE_STATUS.
+ (WebCore::WebGLRenderingContext::getShaderParameter): Ditto.
+ * html/canvas/WebGLShader.cpp:
+ (WebCore::WebGLShader::deleteObjectImpl): Simply delete GL resource.
+ * html/canvas/WebGLTexture.cpp:
+ (WebCore::WebGLTexture::deleteObjectImpl): Simply delete GL resource.
+
2010-12-06 Ryosuke Niwa <rniwa at webkit.org>
Yet unreviewed another Leopard build fix for r73380.
diff --git a/WebCore/html/canvas/WebGLBuffer.cpp b/WebCore/html/canvas/WebGLBuffer.cpp
index 36ef048..f8c7b38 100644
--- a/WebCore/html/canvas/WebGLBuffer.cpp
+++ b/WebCore/html/canvas/WebGLBuffer.cpp
@@ -52,8 +52,7 @@ WebGLBuffer::WebGLBuffer(WebGLRenderingContext* ctx)
void WebGLBuffer::deleteObjectImpl(Platform3DObject object)
{
- if (!isDeleted())
- context()->graphicsContext3D()->deleteBuffer(object);
+ context()->graphicsContext3D()->deleteBuffer(object);
}
bool WebGLBuffer::associateBufferDataImpl(ArrayBuffer* array, unsigned byteOffset, unsigned byteLength)
diff --git a/WebCore/html/canvas/WebGLFramebuffer.cpp b/WebCore/html/canvas/WebGLFramebuffer.cpp
index 0ef8ef6..838876b 100644
--- a/WebCore/html/canvas/WebGLFramebuffer.cpp
+++ b/WebCore/html/canvas/WebGLFramebuffer.cpp
@@ -190,8 +190,7 @@ bool WebGLFramebuffer::onAccess()
void WebGLFramebuffer::deleteObjectImpl(Platform3DObject object)
{
- if (!isDeleted())
- context()->graphicsContext3D()->deleteFramebuffer(object);
+ context()->graphicsContext3D()->deleteFramebuffer(object);
m_colorAttachment = 0;
m_depthAttachment = 0;
m_stencilAttachment = 0;
diff --git a/WebCore/html/canvas/WebGLObject.cpp b/WebCore/html/canvas/WebGLObject.cpp
index 8aa4663..41ad0f1 100644
--- a/WebCore/html/canvas/WebGLObject.cpp
+++ b/WebCore/html/canvas/WebGLObject.cpp
@@ -56,14 +56,13 @@ void WebGLObject::setObject(Platform3DObject object)
void WebGLObject::deleteObject()
{
- if (m_object) {
- if (m_context) {
- m_context->graphicsContext3D()->makeContextCurrent();
- deleteObjectImpl(m_object);
- }
- if (!m_attachmentCount)
- m_object = 0;
- m_deleted = true;
+ m_deleted = true;
+ if (!m_context || !m_object)
+ return;
+ if (!m_attachmentCount) {
+ m_context->graphicsContext3D()->makeContextCurrent();
+ deleteObjectImpl(m_object);
+ m_object = 0;
}
}
diff --git a/WebCore/html/canvas/WebGLObject.h b/WebCore/html/canvas/WebGLObject.h
index 82b8079..3bb9f29 100644
--- a/WebCore/html/canvas/WebGLObject.h
+++ b/WebCore/html/canvas/WebGLObject.h
@@ -40,10 +40,15 @@ public:
virtual ~WebGLObject();
Platform3DObject object() const { return m_object; }
+
+ // deleteObject may not always delete the OpenGL resource. For programs and
+ // shaders, deletion is delayed until they are no longer attached.
+ // FIXME: revisit this when resource sharing between contexts are implemented.
void deleteObject();
void detachContext()
{
+ m_attachmentCount = 0; // Make sure OpenGL resource is deleted.
deleteObject();
m_context = 0;
}
@@ -62,10 +67,14 @@ public:
{
if (m_attachmentCount)
--m_attachmentCount;
- if (!m_attachmentCount && m_deleted)
+ if (m_deleted)
deleteObject();
}
- unsigned getAttachmentCount() { return m_attachmentCount; }
+
+ // This indicates whether the client side issue a delete call already, not
+ // whether the OpenGL resource is deleted.
+ // object()==0 indicates the OpenGL resource is deleted.
+ bool isDeleted() { return m_deleted; }
protected:
WebGLObject(WebGLRenderingContext*);
@@ -73,12 +82,8 @@ protected:
// setObject should be only called once right after creating a WebGLObject.
void setObject(Platform3DObject);
- // deleteObjectImpl() may be called multiple times for the same object;
- // isDeleted() needs to be tested in implementations when deciding whether
- // to delete the OpenGL resource.
+ // deleteObjectImpl should be only called once to delete the OpenGL resource.
virtual void deleteObjectImpl(Platform3DObject) = 0;
- bool isDeleted() { return m_deleted; }
- void setDeteled() { m_deleted = true; }
private:
Platform3DObject m_object;
diff --git a/WebCore/html/canvas/WebGLProgram.cpp b/WebCore/html/canvas/WebGLProgram.cpp
index 1c06e83..53706fe 100644
--- a/WebCore/html/canvas/WebGLProgram.cpp
+++ b/WebCore/html/canvas/WebGLProgram.cpp
@@ -47,17 +47,14 @@ WebGLProgram::WebGLProgram(WebGLRenderingContext* ctx)
void WebGLProgram::deleteObjectImpl(Platform3DObject obj)
{
- if (!isDeleted())
- context()->graphicsContext3D()->deleteProgram(obj);
- if (!getAttachmentCount()) {
- if (m_vertexShader) {
- m_vertexShader->onDetached();
- m_vertexShader = 0;
- }
- if (m_fragmentShader) {
- m_fragmentShader->onDetached();
- m_fragmentShader = 0;
- }
+ context()->graphicsContext3D()->deleteProgram(obj);
+ if (m_vertexShader) {
+ m_vertexShader->onDetached();
+ m_vertexShader = 0;
+ }
+ if (m_fragmentShader) {
+ m_fragmentShader->onDetached();
+ m_fragmentShader = 0;
}
}
diff --git a/WebCore/html/canvas/WebGLRenderbuffer.cpp b/WebCore/html/canvas/WebGLRenderbuffer.cpp
index 0c3ac84..03a419a 100644
--- a/WebCore/html/canvas/WebGLRenderbuffer.cpp
+++ b/WebCore/html/canvas/WebGLRenderbuffer.cpp
@@ -52,8 +52,7 @@ WebGLRenderbuffer::WebGLRenderbuffer(WebGLRenderingContext* ctx)
void WebGLRenderbuffer::deleteObjectImpl(Platform3DObject object)
{
- if (!isDeleted())
- context()->graphicsContext3D()->deleteRenderbuffer(object);
+ context()->graphicsContext3D()->deleteRenderbuffer(object);
}
}
diff --git a/WebCore/html/canvas/WebGLRenderingContext.cpp b/WebCore/html/canvas/WebGLRenderingContext.cpp
index 9200b88..8cd46a3 100644
--- a/WebCore/html/canvas/WebGLRenderingContext.cpp
+++ b/WebCore/html/canvas/WebGLRenderingContext.cpp
@@ -1685,6 +1685,7 @@ WebGLGetInfo WebGLRenderingContext::getProgramParameter(WebGLProgram* program, u
int value = 0;
switch (pname) {
case GraphicsContext3D::DELETE_STATUS:
+ return WebGLGetInfo(program->isDeleted());
case GraphicsContext3D::VALIDATE_STATUS:
m_context->getProgramiv(objectOrZero(program), pname, &value);
return WebGLGetInfo(static_cast<bool>(value));
@@ -1791,6 +1792,7 @@ WebGLGetInfo WebGLRenderingContext::getShaderParameter(WebGLShader* shader, unsi
int value = 0;
switch (pname) {
case GraphicsContext3D::DELETE_STATUS:
+ return WebGLGetInfo(shader->isDeleted());
case GraphicsContext3D::COMPILE_STATUS:
m_context->getShaderiv(objectOrZero(shader), pname, &value);
return WebGLGetInfo(static_cast<bool>(value));
diff --git a/WebCore/html/canvas/WebGLShader.cpp b/WebCore/html/canvas/WebGLShader.cpp
index 1ccaad8..4f8bf68 100644
--- a/WebCore/html/canvas/WebGLShader.cpp
+++ b/WebCore/html/canvas/WebGLShader.cpp
@@ -47,8 +47,7 @@ WebGLShader::WebGLShader(WebGLRenderingContext* ctx, GraphicsContext3D::WebGLEnu
void WebGLShader::deleteObjectImpl(Platform3DObject object)
{
- if (!isDeleted())
- context()->graphicsContext3D()->deleteShader(object);
+ context()->graphicsContext3D()->deleteShader(object);
}
}
diff --git a/WebCore/html/canvas/WebGLTexture.cpp b/WebCore/html/canvas/WebGLTexture.cpp
index c2b1c10..4fedaf0 100644
--- a/WebCore/html/canvas/WebGLTexture.cpp
+++ b/WebCore/html/canvas/WebGLTexture.cpp
@@ -202,8 +202,7 @@ bool WebGLTexture::needToUseBlackTexture() const
void WebGLTexture::deleteObjectImpl(Platform3DObject object)
{
- if (!isDeleted())
- context()->graphicsContext3D()->deleteTexture(object);
+ context()->graphicsContext3D()->deleteTexture(object);
}
int WebGLTexture::mapTargetToIndex(unsigned long target)
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list