| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_unittest.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder_unittest.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1332 .WillOnce(Return(false)) | 1332 .WillOnce(Return(false)) |
| 1333 .RetiresOnSaturation(); | 1333 .RetiresOnSaturation(); |
| 1334 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 1334 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 1335 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); | 1335 EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError()); |
| 1336 EXPECT_EQ(128u, memory_tracker->GetPoolSize()); | 1336 EXPECT_EQ(128u, memory_tracker->GetPoolSize()); |
| 1337 } | 1337 } |
| 1338 | 1338 |
| 1339 TEST_P(GLES2DecoderManualInitTest, ImmutableCopyTexImage2D) { | 1339 TEST_P(GLES2DecoderManualInitTest, ImmutableCopyTexImage2D) { |
| 1340 const GLenum kTarget = GL_TEXTURE_2D; | 1340 const GLenum kTarget = GL_TEXTURE_2D; |
| 1341 const GLint kLevel = 0; | 1341 const GLint kLevel = 0; |
| 1342 const GLint kLevels = 2; |
| 1342 const GLenum kInternalFormat = GL_RGBA; | 1343 const GLenum kInternalFormat = GL_RGBA; |
| 1343 const GLenum kSizedInternalFormat = GL_RGBA8; | 1344 const GLenum kSizedInternalFormat = GL_RGBA8; |
| 1344 const GLsizei kWidth = 4; | 1345 const GLsizei kWidth = 4; |
| 1345 const GLsizei kHeight = 8; | 1346 const GLsizei kHeight = 8; |
| 1346 const GLint kBorder = 0; | 1347 const GLint kBorder = 0; |
| 1347 InitState init; | 1348 InitState init; |
| 1348 init.extensions = "GL_EXT_texture_storage"; | 1349 init.extensions = "GL_EXT_texture_storage"; |
| 1349 init.has_alpha = true; | 1350 init.has_alpha = true; |
| 1350 init.request_alpha = true; | 1351 init.request_alpha = true; |
| 1351 init.bind_generates_resource = true; | 1352 init.bind_generates_resource = true; |
| 1353 init.gl_version = "OpenGL ES 2.0"; // To avoid TexStorage emulation. |
| 1352 InitDecoder(init); | 1354 InitDecoder(init); |
| 1353 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 1355 DoBindTexture(kTarget, client_texture_id_, kServiceTextureId); |
| 1354 | 1356 |
| 1355 // CopyTexImage2D will call arbitrary amount of GetErrors. | 1357 // CopyTexImage2D will call arbitrary amount of GetErrors. |
| 1356 EXPECT_CALL(*gl_, GetError()) | 1358 EXPECT_CALL(*gl_, GetError()) |
| 1357 .Times(AtLeast(1)); | 1359 .Times(AtLeast(1)); |
| 1358 | 1360 |
| 1359 EXPECT_CALL(*gl_, | 1361 EXPECT_CALL(*gl_, |
| 1360 CopyTexImage2D( | 1362 CopyTexImage2D( |
| 1361 kTarget, kLevel, kInternalFormat, 0, 0, kWidth, kHeight, | 1363 kTarget, kLevel, kInternalFormat, 0, 0, kWidth, kHeight, |
| 1362 kBorder)) | 1364 kBorder)) |
| 1363 .Times(1); | 1365 .Times(1); |
| 1364 | 1366 |
| 1365 EXPECT_CALL(*gl_, | 1367 EXPECT_CALL(*gl_, |
| 1366 TexStorage2DEXT( | 1368 TexStorage2DEXT( |
| 1367 kTarget, kLevel, kSizedInternalFormat, kWidth, kHeight)) | 1369 kTarget, kLevels, kSizedInternalFormat, kWidth, kHeight)) |
| 1368 .Times(1); | 1370 .Times(1); |
| 1369 CopyTexImage2D copy_cmd; | 1371 CopyTexImage2D copy_cmd; |
| 1370 copy_cmd.Init(kTarget, kLevel, kInternalFormat, 0, 0, kWidth, kHeight); | 1372 copy_cmd.Init(kTarget, kLevel, kInternalFormat, 0, 0, kWidth, kHeight); |
| 1371 EXPECT_EQ(error::kNoError, ExecuteCmd(copy_cmd)); | 1373 EXPECT_EQ(error::kNoError, ExecuteCmd(copy_cmd)); |
| 1372 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1374 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1373 | 1375 |
| 1374 TexStorage2DEXT storage_cmd; | 1376 TexStorage2DEXT storage_cmd; |
| 1375 storage_cmd.Init(kTarget, kLevel, kSizedInternalFormat, kWidth, kHeight); | 1377 storage_cmd.Init(kTarget, kLevels, kSizedInternalFormat, kWidth, kHeight); |
| 1376 EXPECT_EQ(error::kNoError, ExecuteCmd(storage_cmd)); | 1378 EXPECT_EQ(error::kNoError, ExecuteCmd(storage_cmd)); |
| 1377 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 1379 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 1378 | 1380 |
| 1379 // This should not invoke CopyTexImage2D. | 1381 // This should not invoke CopyTexImage2D. |
| 1380 copy_cmd.Init(kTarget, kLevel, kInternalFormat, 0, 0, kWidth, kHeight); | 1382 copy_cmd.Init(kTarget, kLevel, kInternalFormat, 0, 0, kWidth, kHeight); |
| 1381 EXPECT_EQ(error::kNoError, ExecuteCmd(copy_cmd)); | 1383 EXPECT_EQ(error::kNoError, ExecuteCmd(copy_cmd)); |
| 1382 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 1384 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 1383 } | 1385 } |
| 1384 | 1386 |
| 1385 TEST_P(GLES2DecoderTest, LoseContextCHROMIUMGuilty) { | 1387 TEST_P(GLES2DecoderTest, LoseContextCHROMIUMGuilty) { |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1544 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderDoCommandsTest, ::testing::Bool()); | 1546 INSTANTIATE_TEST_CASE_P(Service, GLES2DecoderDoCommandsTest, ::testing::Bool()); |
| 1545 | 1547 |
| 1546 INSTANTIATE_TEST_CASE_P(Service, GLES3DecoderTest, ::testing::Bool()); | 1548 INSTANTIATE_TEST_CASE_P(Service, GLES3DecoderTest, ::testing::Bool()); |
| 1547 | 1549 |
| 1548 INSTANTIATE_TEST_CASE_P(Service, | 1550 INSTANTIATE_TEST_CASE_P(Service, |
| 1549 GLES3DecoderWithESSL3ShaderTest, | 1551 GLES3DecoderWithESSL3ShaderTest, |
| 1550 ::testing::Bool()); | 1552 ::testing::Bool()); |
| 1551 | 1553 |
| 1552 } // namespace gles2 | 1554 } // namespace gles2 |
| 1553 } // namespace gpu | 1555 } // namespace gpu |
| OLD | NEW |