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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc

Issue 1168213003: gpu: Make sure we restore scissor rect after clearing a texture level. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 unified diff | Download patch
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest_drawing.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/strings/string_number_conversions.h" 8 #include "base/strings/string_number_conversions.h"
9 #include "gpu/command_buffer/common/gles2_cmd_format.h" 9 #include "gpu/command_buffer/common/gles2_cmd_format.h"
10 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 10 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
(...skipping 1657 matching lines...) Expand 10 before | Expand all | Expand 10 after
1668 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 1668 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
1669 DoBindFramebuffer( 1669 DoBindFramebuffer(
1670 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); 1670 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId);
1671 DoFramebufferTexture2D(GL_FRAMEBUFFER, 1671 DoFramebufferTexture2D(GL_FRAMEBUFFER,
1672 GL_COLOR_ATTACHMENT0, 1672 GL_COLOR_ATTACHMENT0,
1673 GL_TEXTURE_2D, 1673 GL_TEXTURE_2D,
1674 kFBOClientTextureId, 1674 kFBOClientTextureId,
1675 kFBOServiceTextureId, 1675 kFBOServiceTextureId,
1676 0, 1676 0,
1677 GL_NO_ERROR); 1677 GL_NO_ERROR);
1678 DoEnableDisable(GL_SCISSOR_TEST, false);
1679 DoScissor(0, 0, 1, 1);
1678 1680
1679 // Setup "render from" texture. 1681 // Setup "render from" texture.
1680 SetupTexture(); 1682 SetupTexture();
1681 1683
1682 SetupExpectationsForFramebufferClearing(GL_FRAMEBUFFER, // target 1684 SetupExpectationsForFramebufferClearing(GL_FRAMEBUFFER, // target
1683 GL_COLOR_BUFFER_BIT, // clear bits 1685 GL_COLOR_BUFFER_BIT, // clear bits
1684 0, 1686 0, 0, 0,
1685 0, 1687 0, // color
1686 0, 1688 0, // stencil
1687 0, // color 1689 1.0f, // depth
1688 0, // stencil 1690 false, // scissor test
1689 1.0f, // depth 1691 0, 0, 1, 1);
1690 false); // scissor test
1691 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB 1692 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB
1692 false, // Framebuffer has depth 1693 false, // Framebuffer has depth
1693 false, // Framebuffer has stencil 1694 false, // Framebuffer has stencil
1694 0x1111, // color bits 1695 0x1111, // color bits
1695 false, // depth mask 1696 false, // depth mask
1696 false, // depth enabled 1697 false, // depth enabled
1697 0, // front stencil mask 1698 0, // front stencil mask
1698 0, // back stencil mask 1699 0, // back stencil mask
1699 false); // stencil enabled 1700 false); // stencil enabled
1700 1701
(...skipping 21 matching lines...) Expand all
1722 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 1723 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
1723 DoBindFramebuffer( 1724 DoBindFramebuffer(
1724 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); 1725 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId);
1725 DoFramebufferTexture2D(GL_FRAMEBUFFER, 1726 DoFramebufferTexture2D(GL_FRAMEBUFFER,
1726 GL_COLOR_ATTACHMENT0, 1727 GL_COLOR_ATTACHMENT0,
1727 GL_TEXTURE_2D, 1728 GL_TEXTURE_2D,
1728 kFBOClientTextureId, 1729 kFBOClientTextureId,
1729 kFBOServiceTextureId, 1730 kFBOServiceTextureId,
1730 0, 1731 0,
1731 GL_NO_ERROR); 1732 GL_NO_ERROR);
1733 DoEnableDisable(GL_SCISSOR_TEST, false);
1734 DoScissor(0, 0, 1, 1);
1732 1735
1733 // Setup "render from" texture. 1736 // Setup "render from" texture.
1734 SetupTexture(); 1737 SetupTexture();
1735 1738
1736 SetupExpectationsForFramebufferClearing(GL_FRAMEBUFFER, // target 1739 SetupExpectationsForFramebufferClearing(GL_FRAMEBUFFER, // target
1737 GL_COLOR_BUFFER_BIT, // clear bits 1740 GL_COLOR_BUFFER_BIT, // clear bits
1738 0, 1741 0, 0, 0,
1739 0, 1742 0, // color
1740 0, 1743 0, // stencil
1741 0, // color 1744 1.0f, // depth
1742 0, // stencil 1745 false, // scissor test
1743 1.0f, // depth 1746 0, 0, 1, 1);
1744 false); // scissor test
1745 1747
1746 EXPECT_CALL(*gl_, GetError()) 1748 EXPECT_CALL(*gl_, GetError())
1747 .WillOnce(Return(GL_NO_ERROR)) 1749 .WillOnce(Return(GL_NO_ERROR))
1748 .WillOnce(Return(GL_NO_ERROR)) 1750 .WillOnce(Return(GL_NO_ERROR))
1749 .RetiresOnSaturation(); 1751 .RetiresOnSaturation();
1750 EXPECT_CALL(*gl_, ReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, _)) 1752 EXPECT_CALL(*gl_, ReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, _))
1751 .Times(1) 1753 .Times(1)
1752 .RetiresOnSaturation(); 1754 .RetiresOnSaturation();
1753 typedef ReadPixels::Result Result; 1755 typedef ReadPixels::Result Result;
1754 uint32 result_shm_id = kSharedMemoryId; 1756 uint32 result_shm_id = kSharedMemoryId;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
1793 DoBindFramebuffer( 1795 DoBindFramebuffer(
1794 GL_READ_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); 1796 GL_READ_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId);
1795 DoFramebufferTexture2D(GL_READ_FRAMEBUFFER, 1797 DoFramebufferTexture2D(GL_READ_FRAMEBUFFER,
1796 GL_COLOR_ATTACHMENT0, 1798 GL_COLOR_ATTACHMENT0,
1797 GL_TEXTURE_2D, 1799 GL_TEXTURE_2D,
1798 kFBOClientTextureId, 1800 kFBOClientTextureId,
1799 kFBOServiceTextureId, 1801 kFBOServiceTextureId,
1800 0, 1802 0,
1801 GL_NO_ERROR); 1803 GL_NO_ERROR);
1802 1804
1803 // Enable GL_SCISSOR_TEST to make sure we disable it in the clear, 1805 // Set scissor rect and disable GL_SCISSOR_TEST to make sure we enable it in
1804 // then re-enable after. 1806 // the clear, then disable it and restore the rect again.
Ken Russell (switch to Gerrit) 2015/06/09 02:46:19 It looks to me like we've lost a test where we go
reveman 2015/06/09 03:07:37 Made the UnClearedAttachmentsGetClearedOnClear tes
1805 DoEnableDisable(GL_SCISSOR_TEST, true); 1807 DoScissor(0, 0, 32, 32);
1808 DoEnableDisable(GL_SCISSOR_TEST, false);
1806 1809
1807 SetupExpectationsForFramebufferClearingMulti( 1810 SetupExpectationsForFramebufferClearingMulti(
1808 kServiceFramebufferId, // read framebuffer service id 1811 kServiceFramebufferId, // read framebuffer service id
1809 0, // backbuffer service id 1812 0, // backbuffer service id
1810 GL_READ_FRAMEBUFFER, // target 1813 GL_READ_FRAMEBUFFER, // target
1811 GL_COLOR_BUFFER_BIT, // clear bits 1814 GL_COLOR_BUFFER_BIT, // clear bits
1812 0, 1815 0, 0, 0,
1813 0,
1814 0,
1815 0, // color 1816 0, // color
1816 0, // stencil 1817 0, // stencil
1817 1.0f, // depth 1818 1.0f, // depth
1818 true); // scissor test 1819 false, // scissor test
1820 0, 0, 32, 32);
1819 1821
1820 EXPECT_CALL(*gl_, GetError()) 1822 EXPECT_CALL(*gl_, GetError())
1821 .WillOnce(Return(GL_NO_ERROR)) 1823 .WillOnce(Return(GL_NO_ERROR))
1822 .WillOnce(Return(GL_NO_ERROR)) 1824 .WillOnce(Return(GL_NO_ERROR))
1823 .RetiresOnSaturation(); 1825 .RetiresOnSaturation();
1824 EXPECT_CALL(*gl_, ReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, _)) 1826 EXPECT_CALL(*gl_, ReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, _))
1825 .Times(1) 1827 .Times(1)
1826 .RetiresOnSaturation(); 1828 .RetiresOnSaturation();
1827 typedef ReadPixels::Result Result; 1829 typedef ReadPixels::Result Result;
1828 uint32 result_shm_id = kSharedMemoryId; 1830 uint32 result_shm_id = kSharedMemoryId;
(...skipping 365 matching lines...) Expand 10 before | Expand all | Expand 10 after
2194 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 2196 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
2195 DoBindFramebuffer( 2197 DoBindFramebuffer(
2196 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); 2198 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId);
2197 DoFramebufferTexture2D(GL_FRAMEBUFFER, 2199 DoFramebufferTexture2D(GL_FRAMEBUFFER,
2198 GL_COLOR_ATTACHMENT0, 2200 GL_COLOR_ATTACHMENT0,
2199 GL_TEXTURE_2D, 2201 GL_TEXTURE_2D,
2200 kFBOClientTextureId, 2202 kFBOClientTextureId,
2201 kFBOServiceTextureId, 2203 kFBOServiceTextureId,
2202 0, 2204 0,
2203 GL_NO_ERROR); 2205 GL_NO_ERROR);
2206 DoEnableDisable(GL_SCISSOR_TEST, false);
2207 DoScissor(0, 0, 1, 1);
2204 2208
2205 // Setup "render from" texture. 2209 // Setup "render from" texture.
2206 SetupTexture(); 2210 SetupTexture();
2207 2211
2208 SetupExpectationsForFramebufferClearing(GL_FRAMEBUFFER, // target 2212 SetupExpectationsForFramebufferClearing(GL_FRAMEBUFFER, // target
2209 GL_COLOR_BUFFER_BIT, // clear bits 2213 GL_COLOR_BUFFER_BIT, // clear bits
2210 0, 2214 0, 0, 0,
2211 0, 2215 0, // color
2212 0, 2216 0, // stencil
2213 0, // color 2217 1.0f, // depth
2214 0, // stencil 2218 false, // scissor test
2215 1.0f, // depth 2219 0, 0, 1, 1);
2216 false); // scissor test
2217 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB 2220 SetupExpectationsForApplyingDirtyState(false, // Framebuffer is RGB
2218 false, // Framebuffer has depth 2221 false, // Framebuffer has depth
2219 false, // Framebuffer has stencil 2222 false, // Framebuffer has stencil
2220 0x1111, // color bits 2223 0x1111, // color bits
2221 false, // depth mask 2224 false, // depth mask
2222 false, // depth enabled 2225 false, // depth enabled
2223 0, // front stencil mask 2226 0, // front stencil mask
2224 0, // back stencil mask 2227 0, // back stencil mask
2225 false); // stencil enabled 2228 false); // stencil enabled
2226 2229
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after
2377 EXPECT_EQ(1, result->GetNumResults()); 2380 EXPECT_EQ(1, result->GetNumResults());
2378 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 2381 EXPECT_EQ(GL_NO_ERROR, GetGLError());
2379 } 2382 }
2380 2383
2381 // TODO(gman): PixelStorei 2384 // TODO(gman): PixelStorei
2382 2385
2383 // TODO(gman): SwapBuffers 2386 // TODO(gman): SwapBuffers
2384 2387
2385 } // namespace gles2 2388 } // namespace gles2
2386 } // namespace gpu 2389 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest_drawing.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698