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 <stdint.h> | 7 #include <stdint.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 using ::testing::_; | 35 using ::testing::_; |
36 using ::testing::DoAll; | 36 using ::testing::DoAll; |
37 using ::testing::InSequence; | 37 using ::testing::InSequence; |
38 using ::testing::Invoke; | 38 using ::testing::Invoke; |
39 using ::testing::MatcherCast; | 39 using ::testing::MatcherCast; |
40 using ::testing::Mock; | 40 using ::testing::Mock; |
41 using ::testing::Pointee; | 41 using ::testing::Pointee; |
42 using ::testing::Return; | 42 using ::testing::Return; |
43 using ::testing::SaveArg; | 43 using ::testing::SaveArg; |
44 using ::testing::SetArrayArgument; | 44 using ::testing::SetArrayArgument; |
45 using ::testing::SetArgumentPointee; | 45 using ::testing::SetArgPointee; |
46 using ::testing::SetArgPointee; | 46 using ::testing::SetArgPointee; |
47 using ::testing::StrEq; | 47 using ::testing::StrEq; |
48 using ::testing::StrictMock; | 48 using ::testing::StrictMock; |
49 | 49 |
50 namespace gpu { | 50 namespace gpu { |
51 namespace gles2 { | 51 namespace gles2 { |
52 | 52 |
53 using namespace cmds; | 53 using namespace cmds; |
54 | 54 |
55 class GLES2DecoderGeometryInstancingTest : public GLES2DecoderWithShaderTest { | 55 class GLES2DecoderGeometryInstancingTest : public GLES2DecoderWithShaderTest { |
(...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
311 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); | 311 EXPECT_EQ(error::kNoError, ExecuteCmd(draw_cmd)); |
312 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 312 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
313 | 313 |
314 // Setup Frame buffer. | 314 // Setup Frame buffer. |
315 // needs to be 1x1 or else it's not renderable. | 315 // needs to be 1x1 or else it's not renderable. |
316 const GLsizei kWidth = 1; | 316 const GLsizei kWidth = 1; |
317 const GLsizei kHeight = 1; | 317 const GLsizei kHeight = 1; |
318 const GLenum kFormat = GL_RGB; | 318 const GLenum kFormat = GL_RGB; |
319 // Use a different texture for framebuffer to avoid drawing feedback loops. | 319 // Use a different texture for framebuffer to avoid drawing feedback loops. |
320 EXPECT_CALL(*gl_, GenTextures(_, _)) | 320 EXPECT_CALL(*gl_, GenTextures(_, _)) |
321 .WillOnce(SetArgumentPointee<1>(kNewServiceId)) | 321 .WillOnce(SetArgPointee<1>(kNewServiceId)) |
322 .RetiresOnSaturation(); | 322 .RetiresOnSaturation(); |
323 GenHelper<GenTexturesImmediate>(kNewClientId); | 323 GenHelper<GenTexturesImmediate>(kNewClientId); |
324 DoBindTexture(GL_TEXTURE_2D, kNewClientId, kNewServiceId); | 324 DoBindTexture(GL_TEXTURE_2D, kNewClientId, kNewServiceId); |
325 // Pass some data so the texture will be marked as cleared. | 325 // Pass some data so the texture will be marked as cleared. |
326 DoTexImage2D(GL_TEXTURE_2D, | 326 DoTexImage2D(GL_TEXTURE_2D, |
327 0, | 327 0, |
328 kFormat, | 328 kFormat, |
329 kWidth, | 329 kWidth, |
330 kHeight, | 330 kHeight, |
331 0, | 331 0, |
(...skipping 1573 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1905 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1905 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1906 } | 1906 } |
1907 | 1907 |
1908 TEST_P(GLES2DecoderWithShaderTest, DrawClearsAfterTexImage2DNULLInFBO) { | 1908 TEST_P(GLES2DecoderWithShaderTest, DrawClearsAfterTexImage2DNULLInFBO) { |
1909 const GLuint kFBOClientTextureId = 4100; | 1909 const GLuint kFBOClientTextureId = 4100; |
1910 const GLuint kFBOServiceTextureId = 4101; | 1910 const GLuint kFBOServiceTextureId = 4101; |
1911 | 1911 |
1912 SetupAllNeededVertexBuffers(); | 1912 SetupAllNeededVertexBuffers(); |
1913 // Register a texture id. | 1913 // Register a texture id. |
1914 EXPECT_CALL(*gl_, GenTextures(_, _)) | 1914 EXPECT_CALL(*gl_, GenTextures(_, _)) |
1915 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) | 1915 .WillOnce(SetArgPointee<1>(kFBOServiceTextureId)) |
1916 .RetiresOnSaturation(); | 1916 .RetiresOnSaturation(); |
1917 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); | 1917 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); |
1918 | 1918 |
1919 // Setup "render to" texture. | 1919 // Setup "render to" texture. |
1920 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId); | 1920 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId); |
1921 DoTexImage2D( | 1921 DoTexImage2D( |
1922 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); | 1922 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); |
1923 DoBindFramebuffer( | 1923 DoBindFramebuffer( |
1924 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | 1924 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
1925 DoFramebufferTexture2D(GL_FRAMEBUFFER, | 1925 DoFramebufferTexture2D(GL_FRAMEBUFFER, |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1969 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1969 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
1970 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1970 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
1971 } | 1971 } |
1972 | 1972 |
1973 TEST_P(GLES2DecoderWithShaderTest, DrawWitFBOThatCantClearDoesNotDraw) { | 1973 TEST_P(GLES2DecoderWithShaderTest, DrawWitFBOThatCantClearDoesNotDraw) { |
1974 const GLuint kFBOClientTextureId = 4100; | 1974 const GLuint kFBOClientTextureId = 4100; |
1975 const GLuint kFBOServiceTextureId = 4101; | 1975 const GLuint kFBOServiceTextureId = 4101; |
1976 | 1976 |
1977 // Register a texture id. | 1977 // Register a texture id. |
1978 EXPECT_CALL(*gl_, GenTextures(_, _)) | 1978 EXPECT_CALL(*gl_, GenTextures(_, _)) |
1979 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) | 1979 .WillOnce(SetArgPointee<1>(kFBOServiceTextureId)) |
1980 .RetiresOnSaturation(); | 1980 .RetiresOnSaturation(); |
1981 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); | 1981 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); |
1982 | 1982 |
1983 // Setup "render to" texture. | 1983 // Setup "render to" texture. |
1984 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId); | 1984 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId); |
1985 DoTexImage2D( | 1985 DoTexImage2D( |
1986 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); | 1986 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); |
1987 DoBindFramebuffer( | 1987 DoBindFramebuffer( |
1988 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | 1988 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
1989 DoFramebufferTexture2D(GL_FRAMEBUFFER, | 1989 DoFramebufferTexture2D(GL_FRAMEBUFFER, |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2116 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2116 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
2117 } | 2117 } |
2118 | 2118 |
2119 TEST_P(GLES2DecoderWithShaderTest, | 2119 TEST_P(GLES2DecoderWithShaderTest, |
2120 DrawClearsAfterRenderbuffersWithMultipleAttachments) { | 2120 DrawClearsAfterRenderbuffersWithMultipleAttachments) { |
2121 const GLuint kFBOClientTextureId = 4100; | 2121 const GLuint kFBOClientTextureId = 4100; |
2122 const GLuint kFBOServiceTextureId = 4101; | 2122 const GLuint kFBOServiceTextureId = 4101; |
2123 | 2123 |
2124 // Register a texture id. | 2124 // Register a texture id. |
2125 EXPECT_CALL(*gl_, GenTextures(_, _)) | 2125 EXPECT_CALL(*gl_, GenTextures(_, _)) |
2126 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) | 2126 .WillOnce(SetArgPointee<1>(kFBOServiceTextureId)) |
2127 .RetiresOnSaturation(); | 2127 .RetiresOnSaturation(); |
2128 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); | 2128 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); |
2129 | 2129 |
2130 // Setup "render to" texture. | 2130 // Setup "render to" texture. |
2131 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId); | 2131 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId); |
2132 DoTexImage2D( | 2132 DoTexImage2D( |
2133 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); | 2133 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); |
2134 DoBindFramebuffer( | 2134 DoBindFramebuffer( |
2135 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | 2135 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
2136 DoFramebufferTexture2D(GL_FRAMEBUFFER, | 2136 DoFramebufferTexture2D(GL_FRAMEBUFFER, |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2192 | 2192 |
2193 TEST_P(GLES2DecoderWithShaderTest, | 2193 TEST_P(GLES2DecoderWithShaderTest, |
2194 DrawingWithFBOTwiceChecksForFBOCompleteOnce) { | 2194 DrawingWithFBOTwiceChecksForFBOCompleteOnce) { |
2195 const GLuint kFBOClientTextureId = 4100; | 2195 const GLuint kFBOClientTextureId = 4100; |
2196 const GLuint kFBOServiceTextureId = 4101; | 2196 const GLuint kFBOServiceTextureId = 4101; |
2197 | 2197 |
2198 SetupAllNeededVertexBuffers(); | 2198 SetupAllNeededVertexBuffers(); |
2199 | 2199 |
2200 // Register a texture id. | 2200 // Register a texture id. |
2201 EXPECT_CALL(*gl_, GenTextures(_, _)) | 2201 EXPECT_CALL(*gl_, GenTextures(_, _)) |
2202 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId)) | 2202 .WillOnce(SetArgPointee<1>(kFBOServiceTextureId)) |
2203 .RetiresOnSaturation(); | 2203 .RetiresOnSaturation(); |
2204 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); | 2204 GenHelper<GenTexturesImmediate>(kFBOClientTextureId); |
2205 | 2205 |
2206 // Setup "render to" texture that is cleared. | 2206 // Setup "render to" texture that is cleared. |
2207 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId); | 2207 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId); |
2208 DoTexImage2D(GL_TEXTURE_2D, | 2208 DoTexImage2D(GL_TEXTURE_2D, |
2209 0, | 2209 0, |
2210 GL_RGBA, | 2210 GL_RGBA, |
2211 1, | 2211 1, |
2212 1, | 2212 1, |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2352 TEST_P(GLES2DecoderTest, ClearInvalidValue) { | 2352 TEST_P(GLES2DecoderTest, ClearInvalidValue) { |
2353 EXPECT_CALL(*gl_, Clear(_)).Times(0); | 2353 EXPECT_CALL(*gl_, Clear(_)).Times(0); |
2354 Clear cmd; | 2354 Clear cmd; |
2355 cmd.Init(0xffffffff); | 2355 cmd.Init(0xffffffff); |
2356 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 2356 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
2357 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); | 2357 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
2358 } | 2358 } |
2359 | 2359 |
2360 } // namespace gles2 | 2360 } // namespace gles2 |
2361 } // namespace gpu | 2361 } // namespace gpu |
OLD | NEW |