0

Disable scissor test during texture copies

BUG=160075


Review URL: https://chromiumcodereview.appspot.com/11368152

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@166835 0039d316-1c4b-4281-b951-d872f2087c98
This commit is contained in:
jamesr@chromium.org
2012-11-09 01:38:44 +00:00
parent 0e94de000c
commit b38d4c26b9
2 changed files with 12 additions and 3 deletions

@ -49,6 +49,8 @@ void AcceleratedTextureCopier::copyTexture(Parameters parameters)
{
TRACE_EVENT0("cc", "TextureCopier::copyTexture");
GLC(m_context, m_context->disable(GL_SCISSOR_TEST));
// Note: this code does not restore the viewport, bound program, 2D texture, framebuffer, buffer or blend enable.
GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, m_fbo));
GLC(m_context, m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, parameters.destTexture, 0));
@ -88,6 +90,8 @@ void AcceleratedTextureCopier::copyTexture(Parameters parameters)
GLC(m_context, m_context->framebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, 0, 0));
GLC(m_context, m_context->bindFramebuffer(GL_FRAMEBUFFER, 0));
GLC(m_context, m_context->bindTexture(GL_TEXTURE_2D, 0));
GLC(m_context, m_context->enable(GL_SCISSOR_TEST));
}
void AcceleratedTextureCopier::flush()

@ -23,6 +23,8 @@ class MockContext : public FakeWebGraphicsContext3D {
public:
MOCK_METHOD2(bindFramebuffer, void(WGC3Denum, WebGLId));
MOCK_METHOD3(texParameteri, void(WGC3Denum target, WGC3Denum pname, WGC3Dint param));
MOCK_METHOD1(disable, void(WGC3Denum cap));
MOCK_METHOD1(enable, void(WGC3Denum cap));
MOCK_METHOD3(drawArrays, void(WGC3Denum mode, WGC3Dint first, WGC3Dsizei count));
};
@ -34,6 +36,8 @@ TEST(TextureCopierTest, testDrawArraysCopy)
{
InSequence sequence;
EXPECT_CALL(*mockContext, disable(GL_SCISSOR_TEST));
// Here we check just some essential properties of copyTexture() to avoid mirroring the full implementation.
EXPECT_CALL(*mockContext, bindFramebuffer(GL_FRAMEBUFFER, _));
@ -41,14 +45,15 @@ TEST(TextureCopierTest, testDrawArraysCopy)
EXPECT_CALL(*mockContext, texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST));
EXPECT_CALL(*mockContext, texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST));
EXPECT_CALL(*mockContext, disable(GL_BLEND));
EXPECT_CALL(*mockContext, drawArrays(_, _, _));
// Linear filtering should be restored.
// Linear filtering, default framebuffer and scissor test should be restored.
EXPECT_CALL(*mockContext, texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
EXPECT_CALL(*mockContext, texParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
// Default framebuffer should be restored
EXPECT_CALL(*mockContext, bindFramebuffer(GL_FRAMEBUFFER, 0));
EXPECT_CALL(*mockContext, enable(GL_SCISSOR_TEST));
}
int sourceTextureId = 1;