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 7032 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7043 EXPECT_EQ(error::kNoError, ExecuteCmd(is_enabled_cmd)); | 7043 EXPECT_EQ(error::kNoError, ExecuteCmd(is_enabled_cmd)); |
7044 EXPECT_NE(0u, *result); | 7044 EXPECT_NE(0u, *result); |
7045 Disable disable_cmd; | 7045 Disable disable_cmd; |
7046 disable_cmd.Init(state); | 7046 disable_cmd.Init(state); |
7047 EXPECT_EQ(error::kNoError, ExecuteCmd(disable_cmd)); | 7047 EXPECT_EQ(error::kNoError, ExecuteCmd(disable_cmd)); |
7048 EXPECT_EQ(error::kNoError, ExecuteCmd(is_enabled_cmd)); | 7048 EXPECT_EQ(error::kNoError, ExecuteCmd(is_enabled_cmd)); |
7049 EXPECT_EQ(0u, *result); | 7049 EXPECT_EQ(0u, *result); |
7050 } | 7050 } |
7051 } | 7051 } |
7052 | 7052 |
| 7053 TEST_F(GLES2DecoderTest, PixelTransferBufferObjectCHROMIUM) { |
| 7054 GLenum target = GL_PIXEL_UNPACK_TRANSFER_BUFFER_CHROMIUM; |
| 7055 const uint8 data[] = {4, 3, 2, 1}; |
| 7056 BindBuffer bind_cmd; |
| 7057 bind_cmd.Init(target, client_buffer_id_); |
| 7058 EXPECT_EQ(error::kNoError, ExecuteCmd(bind_cmd)); |
| 7059 BufferManager* manager = group().buffer_manager(); |
| 7060 BufferManager::BufferInfo* info = |
| 7061 manager->GetBufferInfo(client_buffer_id_); |
| 7062 ASSERT_TRUE(info != NULL); |
| 7063 EXPECT_EQ(0, info->size()); |
| 7064 |
| 7065 int8* shm_buf = static_cast<int8*>(shared_memory_address_); |
| 7066 memcpy(shm_buf, data, sizeof(data)); |
| 7067 BufferData data_cmd; |
| 7068 data_cmd.Init(target, sizeof(data), shared_memory_id_, shared_memory_offset_, |
| 7069 GL_STREAM_DRAW); |
| 7070 EXPECT_EQ(error::kNoError, ExecuteCmd(data_cmd)); |
| 7071 |
| 7072 // Check if buffer data is set correctly. |
| 7073 const uint8* buf = static_cast<const uint8*>( |
| 7074 info->GetRange(0, sizeof(data))); |
| 7075 ASSERT_TRUE(buf != NULL); |
| 7076 ASSERT_EQ(data[0], buf[0]); |
| 7077 ASSERT_EQ(data[sizeof(data) - 1], buf[sizeof(data) - 1]); |
| 7078 |
| 7079 // Check if shared memory buffer is used for texture upload. |
| 7080 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 7081 EXPECT_CALL(*gl_, GetError()) |
| 7082 .WillRepeatedly(Return(GL_NO_ERROR)); |
| 7083 TexImage2D cmd1; |
| 7084 EXPECT_CALL(*gl_, TexImage2D( |
| 7085 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, |
| 7086 GL_UNSIGNED_BYTE, shm_buf)) |
| 7087 .Times(1) |
| 7088 .RetiresOnSaturation(); |
| 7089 cmd1.Init( |
| 7090 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, |
| 7091 GL_UNSIGNED_BYTE, 0, 0); |
| 7092 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd1)); |
| 7093 } |
| 7094 |
7053 // TODO(gman): Complete this test. | 7095 // TODO(gman): Complete this test. |
7054 // TEST_F(GLES2DecoderTest, CompressedTexImage2DGLError) { | 7096 // TEST_F(GLES2DecoderTest, CompressedTexImage2DGLError) { |
7055 // } | 7097 // } |
7056 | 7098 |
7057 // TODO(gman): BufferData | 7099 // TODO(gman): BufferData |
7058 | 7100 |
7059 // TODO(gman): BufferDataImmediate | 7101 // TODO(gman): BufferDataImmediate |
7060 | 7102 |
7061 // TODO(gman): BufferSubData | 7103 // TODO(gman): BufferSubData |
7062 | 7104 |
(...skipping 16 matching lines...) Expand all Loading... |
7079 // TODO(gman): TexImage2DImmediate | 7121 // TODO(gman): TexImage2DImmediate |
7080 | 7122 |
7081 // TODO(gman): TexSubImage2DImmediate | 7123 // TODO(gman): TexSubImage2DImmediate |
7082 | 7124 |
7083 // TODO(gman): UseProgram | 7125 // TODO(gman): UseProgram |
7084 | 7126 |
7085 // TODO(gman): SwapBuffers | 7127 // TODO(gman): SwapBuffers |
7086 | 7128 |
7087 } // namespace gles2 | 7129 } // namespace gles2 |
7088 } // namespace gpu | 7130 } // namespace gpu |
OLD | NEW |