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.h" | 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
6 | 6 |
7 #include "base/atomicops.h" | 7 #include "base/atomicops.h" |
8 #include "gpu/command_buffer/common/gl_mock.h" | 8 #include "gpu/command_buffer/common/gl_mock.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 7407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7418 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 7418 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
7419 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 7419 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
7420 // check bad name "name[1]" non zero | 7420 // check bad name "name[1]" non zero |
7421 memcpy(shared_memory_address_, kBadName2, kBadName2Size); | 7421 memcpy(shared_memory_address_, kBadName2, kBadName2Size); |
7422 cmd.Init(client_program_id_, kLocation, kSharedMemoryId, kSharedMemoryOffset, | 7422 cmd.Init(client_program_id_, kLocation, kSharedMemoryId, kSharedMemoryOffset, |
7423 kBadName2Size); | 7423 kBadName2Size); |
7424 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 7424 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
7425 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); | 7425 EXPECT_EQ(GL_INVALID_VALUE, GetGLError()); |
7426 } | 7426 } |
7427 | 7427 |
| 7428 TEST_F(GLES2DecoderTest, TexImagePixmap2DCHROMIUM) { |
| 7429 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 7430 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 7431 0, 0); |
| 7432 TextureManager::TextureInfo* info = |
| 7433 group().texture_manager()->GetTextureInfo(client_texture_id_); |
| 7434 EXPECT_EQ(kServiceTextureId, info->service_id()); |
| 7435 |
| 7436 GLsizei width; |
| 7437 GLsizei height; |
| 7438 GLenum type; |
| 7439 GLenum internal_format; |
| 7440 |
| 7441 EXPECT_TRUE(info->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |
| 7442 EXPECT_EQ(3, width); |
| 7443 EXPECT_EQ(1, height); |
| 7444 EXPECT_TRUE(info->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); |
| 7445 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); |
| 7446 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); |
| 7447 EXPECT_TRUE(info->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); |
| 7448 |
| 7449 // Bind pixmap to texture. |
| 7450 TexImagePixmap2DCHROMIUM tex_image_pixmap_2d_cmd; |
| 7451 tex_image_pixmap_2d_cmd.Init(GL_TEXTURE_2D, 1); |
| 7452 EXPECT_EQ(error::kNoError, ExecuteCmd(tex_image_pixmap_2d_cmd)); |
| 7453 EXPECT_TRUE(info->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |
| 7454 // Image should now be set. |
| 7455 EXPECT_FALSE(info->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); |
| 7456 |
| 7457 // Define new texture image. |
| 7458 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
| 7459 0, 0); |
| 7460 EXPECT_TRUE(info->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |
| 7461 // Image should no longer be set. |
| 7462 EXPECT_TRUE(info->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); |
| 7463 } |
7428 | 7464 |
7429 // TODO(gman): Complete this test. | 7465 // TODO(gman): Complete this test. |
7430 // TEST_F(GLES2DecoderTest, CompressedTexImage2DGLError) { | 7466 // TEST_F(GLES2DecoderTest, CompressedTexImage2DGLError) { |
7431 // } | 7467 // } |
7432 | 7468 |
7433 // TODO(gman): BufferData | 7469 // TODO(gman): BufferData |
7434 | 7470 |
7435 // TODO(gman): BufferDataImmediate | 7471 // TODO(gman): BufferDataImmediate |
7436 | 7472 |
7437 // TODO(gman): BufferSubData | 7473 // TODO(gman): BufferSubData |
(...skipping 17 matching lines...) Expand all Loading... |
7455 // TODO(gman): TexImage2DImmediate | 7491 // TODO(gman): TexImage2DImmediate |
7456 | 7492 |
7457 // TODO(gman): TexSubImage2DImmediate | 7493 // TODO(gman): TexSubImage2DImmediate |
7458 | 7494 |
7459 // TODO(gman): UseProgram | 7495 // TODO(gman): UseProgram |
7460 | 7496 |
7461 // TODO(gman): SwapBuffers | 7497 // TODO(gman): SwapBuffers |
7462 | 7498 |
7463 } // namespace gles2 | 7499 } // namespace gles2 |
7464 } // namespace gpu | 7500 } // namespace gpu |
OLD | NEW |