| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/gles2_cmd_format.h" | 8 #include "gpu/command_buffer/common/gles2_cmd_format.h" |
| 9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" | 9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" |
| 10 #include "gpu/command_buffer/common/gl_mock.h" | 10 #include "gpu/command_buffer/common/gl_mock.h" |
| (...skipping 3951 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3962 // Check buffer is what we expect | 3962 // Check buffer is what we expect |
| 3963 EXPECT_EQ(0, results[0]); | 3963 EXPECT_EQ(0, results[0]); |
| 3964 EXPECT_EQ(1, results[1]); | 3964 EXPECT_EQ(1, results[1]); |
| 3965 EXPECT_EQ(0, results[2]); | 3965 EXPECT_EQ(0, results[2]); |
| 3966 EXPECT_EQ(0, results[3]); | 3966 EXPECT_EQ(0, results[3]); |
| 3967 EXPECT_EQ(0, results[4]); | 3967 EXPECT_EQ(0, results[4]); |
| 3968 EXPECT_EQ(0, results[5]); | 3968 EXPECT_EQ(0, results[5]); |
| 3969 EXPECT_EQ(kSentinel, results[num_results]); // End of results | 3969 EXPECT_EQ(kSentinel, results[num_results]); // End of results |
| 3970 } | 3970 } |
| 3971 | 3971 |
| 3972 TEST_F(GLES2DecoderTest, TexImage2DRedefinitionSucceeds) { |
| 3973 const int kWidth = 16; |
| 3974 const int kHeight = 8; |
| 3975 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 3976 EXPECT_CALL(*gl_, GetError()) |
| 3977 .WillRepeatedly(Return(GL_NO_ERROR)); |
| 3978 for (int ii = 0; ii < 2; ++ii) { |
| 3979 if (ii == 0) { |
| 3980 EXPECT_CALL(*gl_, TexImage2D( |
| 3981 GL_TEXTURE_2D, 0, GL_RGBA, kWidth, kHeight, 0, GL_RGBA, |
| 3982 GL_UNSIGNED_BYTE, _)) |
| 3983 .Times(1) |
| 3984 .RetiresOnSaturation(); |
| 3985 } |
| 3986 TexImage2D cmd; |
| 3987 cmd.Init( |
| 3988 GL_TEXTURE_2D, 0, GL_RGBA, kWidth, kHeight, 0, GL_RGBA, |
| 3989 GL_UNSIGNED_BYTE, 0, 0); |
| 3990 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 3991 EXPECT_CALL(*gl_, TexSubImage2D( |
| 3992 GL_TEXTURE_2D, 0, 0, 0, kWidth, kHeight - 1, GL_RGBA, GL_UNSIGNED_BYTE, |
| 3993 shared_memory_address_)) |
| 3994 .Times(1) |
| 3995 .RetiresOnSaturation(); |
| 3996 // Consider this TexSubImage2D command part of the previous TexImage2D |
| 3997 // (last GL_TRUE argument). It will be skipped if there are bugs in the |
| 3998 // redefinition case. |
| 3999 TexSubImage2D cmd2; |
| 4000 cmd2.Init( |
| 4001 GL_TEXTURE_2D, 0, 0, 0, kWidth, kHeight - 1, GL_RGBA, GL_UNSIGNED_BYTE, |
| 4002 kSharedMemoryId, kSharedMemoryOffset, GL_TRUE); |
| 4003 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2)); |
| 4004 } |
| 4005 } |
| 4006 |
| 3972 TEST_F(GLES2DecoderTest, TexImage2DGLError) { | 4007 TEST_F(GLES2DecoderTest, TexImage2DGLError) { |
| 3973 GLenum target = GL_TEXTURE_2D; | 4008 GLenum target = GL_TEXTURE_2D; |
| 3974 GLint level = 0; | 4009 GLint level = 0; |
| 3975 GLenum internal_format = GL_RGBA; | 4010 GLenum internal_format = GL_RGBA; |
| 3976 GLsizei width = 2; | 4011 GLsizei width = 2; |
| 3977 GLsizei height = 4; | 4012 GLsizei height = 4; |
| 3978 GLint border = 0; | 4013 GLint border = 0; |
| 3979 GLenum format = GL_RGBA; | 4014 GLenum format = GL_RGBA; |
| 3980 GLenum type = GL_UNSIGNED_BYTE; | 4015 GLenum type = GL_UNSIGNED_BYTE; |
| 3981 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 4016 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4570 // TODO(gman): TexImage2DImmediate | 4605 // TODO(gman): TexImage2DImmediate |
| 4571 | 4606 |
| 4572 // TODO(gman): TexSubImage2DImmediate | 4607 // TODO(gman): TexSubImage2DImmediate |
| 4573 | 4608 |
| 4574 // TODO(gman): UseProgram | 4609 // TODO(gman): UseProgram |
| 4575 | 4610 |
| 4576 // TODO(gman): SwapBuffers | 4611 // TODO(gman): SwapBuffers |
| 4577 | 4612 |
| 4578 } // namespace gles2 | 4613 } // namespace gles2 |
| 4579 } // namespace gpu | 4614 } // namespace gpu |
| OLD | NEW |