| OLD | NEW |
| 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 1802 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1813 | 1813 |
| 1814 TEST_P(GLES2DecoderWithShaderTest, DrawArraysClearsAfterTexImage2DNULL) { | 1814 TEST_P(GLES2DecoderWithShaderTest, DrawArraysClearsAfterTexImage2DNULL) { |
| 1815 SetupAllNeededVertexBuffers(); | 1815 SetupAllNeededVertexBuffers(); |
| 1816 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 1816 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 1817 // Create an uncleared texture with 2 levels. | 1817 // Create an uncleared texture with 2 levels. |
| 1818 DoTexImage2D( | 1818 DoTexImage2D( |
| 1819 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); | 1819 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); |
| 1820 DoTexImage2D( | 1820 DoTexImage2D( |
| 1821 GL_TEXTURE_2D, 1, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); | 1821 GL_TEXTURE_2D, 1, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); |
| 1822 // Expect 2 levels will be cleared. | 1822 // Expect 2 levels will be cleared. |
| 1823 SetupClearTextureExpectations(kServiceTextureId, | 1823 SetupClearTextureExpectations(kServiceTextureId, kServiceTextureId, |
| 1824 kServiceTextureId, | 1824 GL_TEXTURE_2D, GL_TEXTURE_2D, 0, GL_RGBA, |
| 1825 GL_TEXTURE_2D, | 1825 GL_RGBA, GL_UNSIGNED_BYTE, 0, 0, 2, 2); |
| 1826 GL_TEXTURE_2D, | 1826 SetupClearTextureExpectations(kServiceTextureId, kServiceTextureId, |
| 1827 0, | 1827 GL_TEXTURE_2D, GL_TEXTURE_2D, 1, GL_RGBA, |
| 1828 GL_RGBA, | 1828 GL_RGBA, GL_UNSIGNED_BYTE, 0, 0, 1, 1); |
| 1829 GL_RGBA, | |
| 1830 GL_UNSIGNED_BYTE, | |
| 1831 2, | |
| 1832 2); | |
| 1833 SetupClearTextureExpectations(kServiceTextureId, | |
| 1834 kServiceTextureId, | |
| 1835 GL_TEXTURE_2D, | |
| 1836 GL_TEXTURE_2D, | |
| 1837 1, | |
| 1838 GL_RGBA, | |
| 1839 GL_RGBA, | |
| 1840 GL_UNSIGNED_BYTE, | |
| 1841 1, | |
| 1842 1); | |
| 1843 SetupExpectationsForApplyingDefaultDirtyState(); | 1829 SetupExpectationsForApplyingDefaultDirtyState(); |
| 1844 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 1830 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 1845 .Times(1) | 1831 .Times(1) |
| 1846 .RetiresOnSaturation(); | 1832 .RetiresOnSaturation(); |
| 1847 DrawArrays cmd; | 1833 DrawArrays cmd; |
| 1848 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 1834 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 1849 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1835 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1850 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1836 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1851 | 1837 |
| 1852 // But not again | 1838 // But not again |
| 1853 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 1839 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 1854 .Times(1) | 1840 .Times(1) |
| 1855 .RetiresOnSaturation(); | 1841 .RetiresOnSaturation(); |
| 1856 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1842 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1857 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1843 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1858 } | 1844 } |
| 1859 | 1845 |
| 1860 TEST_P(GLES2DecoderWithShaderTest, DrawElementsClearsAfterTexImage2DNULL) { | 1846 TEST_P(GLES2DecoderWithShaderTest, DrawElementsClearsAfterTexImage2DNULL) { |
| 1861 SetupAllNeededVertexBuffers(); | 1847 SetupAllNeededVertexBuffers(); |
| 1862 SetupIndexBuffer(); | 1848 SetupIndexBuffer(); |
| 1863 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 1849 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 1864 // Create an uncleared texture with 2 levels. | 1850 // Create an uncleared texture with 2 levels. |
| 1865 DoTexImage2D( | 1851 DoTexImage2D( |
| 1866 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); | 1852 GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); |
| 1867 DoTexImage2D( | 1853 DoTexImage2D( |
| 1868 GL_TEXTURE_2D, 1, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); | 1854 GL_TEXTURE_2D, 1, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); |
| 1869 // Expect 2 levels will be cleared. | 1855 // Expect 2 levels will be cleared. |
| 1870 SetupClearTextureExpectations(kServiceTextureId, | 1856 SetupClearTextureExpectations(kServiceTextureId, kServiceTextureId, |
| 1871 kServiceTextureId, | 1857 GL_TEXTURE_2D, GL_TEXTURE_2D, 0, GL_RGBA, |
| 1872 GL_TEXTURE_2D, | 1858 GL_RGBA, GL_UNSIGNED_BYTE, 0, 0, 2, 2); |
| 1873 GL_TEXTURE_2D, | 1859 SetupClearTextureExpectations(kServiceTextureId, kServiceTextureId, |
| 1874 0, | 1860 GL_TEXTURE_2D, GL_TEXTURE_2D, 1, GL_RGBA, |
| 1875 GL_RGBA, | 1861 GL_RGBA, GL_UNSIGNED_BYTE, 0, 0, 1, 1); |
| 1876 GL_RGBA, | |
| 1877 GL_UNSIGNED_BYTE, | |
| 1878 2, | |
| 1879 2); | |
| 1880 SetupClearTextureExpectations(kServiceTextureId, | |
| 1881 kServiceTextureId, | |
| 1882 GL_TEXTURE_2D, | |
| 1883 GL_TEXTURE_2D, | |
| 1884 1, | |
| 1885 GL_RGBA, | |
| 1886 GL_RGBA, | |
| 1887 GL_UNSIGNED_BYTE, | |
| 1888 1, | |
| 1889 1); | |
| 1890 SetupExpectationsForApplyingDefaultDirtyState(); | 1862 SetupExpectationsForApplyingDefaultDirtyState(); |
| 1891 | 1863 |
| 1892 EXPECT_CALL(*gl_, | 1864 EXPECT_CALL(*gl_, |
| 1893 DrawElements(GL_TRIANGLES, | 1865 DrawElements(GL_TRIANGLES, |
| 1894 kValidIndexRangeCount, | 1866 kValidIndexRangeCount, |
| 1895 GL_UNSIGNED_SHORT, | 1867 GL_UNSIGNED_SHORT, |
| 1896 BufferOffset(kValidIndexRangeStart * 2))) | 1868 BufferOffset(kValidIndexRangeStart * 2))) |
| 1897 .Times(1) | 1869 .Times(1) |
| 1898 .RetiresOnSaturation(); | 1870 .RetiresOnSaturation(); |
| 1899 DrawElements cmd; | 1871 DrawElements cmd; |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2100 GL_RGBA, | 2072 GL_RGBA, |
| 2101 1, | 2073 1, |
| 2102 1, | 2074 1, |
| 2103 0, | 2075 0, |
| 2104 GL_RGBA, | 2076 GL_RGBA, |
| 2105 GL_UNSIGNED_BYTE, | 2077 GL_UNSIGNED_BYTE, |
| 2106 shm_id, | 2078 shm_id, |
| 2107 shm_offset); | 2079 shm_offset); |
| 2108 } | 2080 } |
| 2109 // Expect 2 levels will be cleared. | 2081 // Expect 2 levels will be cleared. |
| 2110 SetupClearTextureExpectations(kServiceTextureId, | 2082 SetupClearTextureExpectations(kServiceTextureId, kServiceTextureId, |
| 2111 kServiceTextureId, | |
| 2112 GL_TEXTURE_CUBE_MAP, | 2083 GL_TEXTURE_CUBE_MAP, |
| 2113 GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, | 2084 GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 0, GL_RGBA, |
| 2114 0, | 2085 GL_RGBA, GL_UNSIGNED_BYTE, 0, 0, 2, 2); |
| 2115 GL_RGBA, | 2086 SetupClearTextureExpectations(kServiceTextureId, kServiceTextureId, |
| 2116 GL_RGBA, | |
| 2117 GL_UNSIGNED_BYTE, | |
| 2118 2, | |
| 2119 2); | |
| 2120 SetupClearTextureExpectations(kServiceTextureId, | |
| 2121 kServiceTextureId, | |
| 2122 GL_TEXTURE_CUBE_MAP, | 2087 GL_TEXTURE_CUBE_MAP, |
| 2123 GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, | 2088 GL_TEXTURE_CUBE_MAP_NEGATIVE_Y, 1, GL_RGBA, |
| 2124 1, | 2089 GL_RGBA, GL_UNSIGNED_BYTE, 0, 0, 1, 1); |
| 2125 GL_RGBA, | |
| 2126 GL_RGBA, | |
| 2127 GL_UNSIGNED_BYTE, | |
| 2128 1, | |
| 2129 1); | |
| 2130 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); | 2090 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); |
| 2131 SetupExpectationsForApplyingDefaultDirtyState(); | 2091 SetupExpectationsForApplyingDefaultDirtyState(); |
| 2132 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) | 2092 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) |
| 2133 .Times(1) | 2093 .Times(1) |
| 2134 .RetiresOnSaturation(); | 2094 .RetiresOnSaturation(); |
| 2135 DrawArrays cmd; | 2095 DrawArrays cmd; |
| 2136 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 2096 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 2137 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2097 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 2138 } | 2098 } |
| 2139 | 2099 |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2352 .Times(1) | 2312 .Times(1) |
| 2353 .RetiresOnSaturation(); | 2313 .RetiresOnSaturation(); |
| 2354 DrawArrays cmd; | 2314 DrawArrays cmd; |
| 2355 cmd.Init(GL_TRIANGLES, 0, kNumVertices); | 2315 cmd.Init(GL_TRIANGLES, 0, kNumVertices); |
| 2356 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2316 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 2357 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 2317 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 2358 } | 2318 } |
| 2359 | 2319 |
| 2360 } // namespace gles2 | 2320 } // namespace gles2 |
| 2361 } // namespace gpu | 2321 } // namespace gpu |
| OLD | NEW |