Title: [127758] trunk/Source/WebCore
- Revision
- 127758
- Author
- commit-qu...@webkit.org
- Date
- 2012-09-06 10:44:59 -0700 (Thu, 06 Sep 2012)
Log Message
[CSS Shaders] Vertex attributes should be unbound after a custom filter is applied
https://bugs.webkit.org/show_bug.cgi?id=95891
Patch by Max Vujovic <mvujo...@adobe.com> on 2012-09-06
Reviewed by Dean Jackson.
Now we unbind the vertex attributes after a custom filter is applied.
Before this patch, Chromium's GPU process would sometimes print the following error message:
"ERROR:gles2_cmd_decoder.cc(5142)] 002CA47B: GL ERROR :GL_INVALID_OPERATION :
glDrawElements: attempt to render with no buffer attached to enabled attribute 2"
This would happen in the following situation:
1) There are two FECustomFilters on the page.
2) One FECustomFilter has a detached mesh. One FECustomFilter has an attached mesh. The
detached FECustomFilter has one more vertex attribute (a_triangleCoord) than the attached
FECustomFilter.
3) The detached FECustomFilter is destroyed, but a_triangleCoord remains bound.
4) The attached FECustomFilter tries to render, but Chromium notices that there is no buffer
attached to the a_triangleCoord attribute.
No new tests. We can't create an automated test for this because it only reproduces using
Chromium's GPU process. DRT does not use Chromium's GPU process.
* platform/graphics/filters/FECustomFilter.cpp:
(WebCore::FECustomFilter::applyShader):
Unbind the vertex attributes after the drawElements call.
(WebCore::FECustomFilter::unbindVertexAttribute):
(WebCore):
(WebCore::FECustomFilter::unbindVertexAttributes):
Unbind all of the attributes that we bound earlier.
* platform/graphics/filters/FECustomFilter.h:
(FECustomFilter):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (127757 => 127758)
--- trunk/Source/WebCore/ChangeLog 2012-09-06 17:36:48 UTC (rev 127757)
+++ trunk/Source/WebCore/ChangeLog 2012-09-06 17:44:59 UTC (rev 127758)
@@ -1,3 +1,38 @@
+2012-09-06 Max Vujovic <mvujo...@adobe.com>
+
+ [CSS Shaders] Vertex attributes should be unbound after a custom filter is applied
+ https://bugs.webkit.org/show_bug.cgi?id=95891
+
+ Reviewed by Dean Jackson.
+
+ Now we unbind the vertex attributes after a custom filter is applied.
+
+ Before this patch, Chromium's GPU process would sometimes print the following error message:
+ "ERROR:gles2_cmd_decoder.cc(5142)] 002CA47B: GL ERROR :GL_INVALID_OPERATION :
+ glDrawElements: attempt to render with no buffer attached to enabled attribute 2"
+
+ This would happen in the following situation:
+ 1) There are two FECustomFilters on the page.
+ 2) One FECustomFilter has a detached mesh. One FECustomFilter has an attached mesh. The
+ detached FECustomFilter has one more vertex attribute (a_triangleCoord) than the attached
+ FECustomFilter.
+ 3) The detached FECustomFilter is destroyed, but a_triangleCoord remains bound.
+ 4) The attached FECustomFilter tries to render, but Chromium notices that there is no buffer
+ attached to the a_triangleCoord attribute.
+
+ No new tests. We can't create an automated test for this because it only reproduces using
+ Chromium's GPU process. DRT does not use Chromium's GPU process.
+
+ * platform/graphics/filters/FECustomFilter.cpp:
+ (WebCore::FECustomFilter::applyShader):
+ Unbind the vertex attributes after the drawElements call.
+ (WebCore::FECustomFilter::unbindVertexAttribute):
+ (WebCore):
+ (WebCore::FECustomFilter::unbindVertexAttributes):
+ Unbind all of the attributes that we bound earlier.
+ * platform/graphics/filters/FECustomFilter.h:
+ (FECustomFilter):
+
2012-09-05 Sam Weinig <s...@webkit.org>
Part 2 of removing PlatformString.h, remove PlatformString.h
Modified: trunk/Source/WebCore/platform/graphics/filters/FECustomFilter.cpp (127757 => 127758)
--- trunk/Source/WebCore/platform/graphics/filters/FECustomFilter.cpp 2012-09-06 17:36:48 UTC (rev 127757)
+++ trunk/Source/WebCore/platform/graphics/filters/FECustomFilter.cpp 2012-09-06 17:44:59 UTC (rev 127758)
@@ -187,6 +187,8 @@
m_context->drawElements(GraphicsContext3D::TRIANGLES, m_mesh->indicesCount(), GraphicsContext3D::UNSIGNED_SHORT, 0);
+ unbindVertexAttributes();
+
ASSERT(static_cast<size_t>(newContextSize.width() * newContextSize.height() * 4) == dstPixelArray->length());
m_context->readPixels(0, 0, newContextSize.width(), newContextSize.height(), GraphicsContext3D::RGBA, GraphicsContext3D::UNSIGNED_BYTE, dstPixelArray->data());
@@ -253,6 +255,12 @@
}
}
+void FECustomFilter::unbindVertexAttribute(int attributeLocation)
+{
+ if (attributeLocation != -1)
+ m_context->disableVertexAttribArray(attributeLocation);
+}
+
void FECustomFilter::bindProgramNumberParameters(int uniformLocation, CustomFilterNumberParameter* numberParameter)
{
switch (numberParameter->size()) {
@@ -366,6 +374,16 @@
bindProgramParameters();
}
+void FECustomFilter::unbindVertexAttributes()
+{
+ unbindVertexAttribute(m_compiledProgram->positionAttribLocation());
+ unbindVertexAttribute(m_compiledProgram->texAttribLocation());
+ unbindVertexAttribute(m_compiledProgram->internalTexCoordAttribLocation());
+ unbindVertexAttribute(m_compiledProgram->meshAttribLocation());
+ if (m_meshType == CustomFilterOperation::DETACHED)
+ unbindVertexAttribute(m_compiledProgram->triangleAttribLocation());
+}
+
void FECustomFilter::dump()
{
}
Modified: trunk/Source/WebCore/platform/graphics/filters/FECustomFilter.h (127757 => 127758)
--- trunk/Source/WebCore/platform/graphics/filters/FECustomFilter.h 2012-09-06 17:36:48 UTC (rev 127757)
+++ trunk/Source/WebCore/platform/graphics/filters/FECustomFilter.h 2012-09-06 17:44:59 UTC (rev 127758)
@@ -80,10 +80,12 @@
void deleteRenderBuffers();
void resizeContext(const IntSize& newContextSize);
void bindVertexAttribute(int attributeLocation, unsigned size, unsigned offset);
+ void unbindVertexAttribute(int attributeLocation);
void bindProgramNumberParameters(int uniformLocation, CustomFilterNumberParameter*);
void bindProgramTransformParameter(int uniformLocation, CustomFilterTransformParameter*);
void bindProgramParameters();
void bindProgramAndBuffers(Uint8ClampedArray* srcPixelArray);
+ void unbindVertexAttributes();
// No need to keep a reference here. It is owned by the RenderView.
CustomFilterGlobalContext* m_globalContext;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes