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/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/id_allocator.h" | 10 #include "gpu/command_buffer/common/id_allocator.h" |
(...skipping 7241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7252 | 7252 |
7253 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 7253 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
7254 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 7254 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
7255 0, 0); | 7255 0, 0); |
7256 DoTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, 2, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 7256 DoTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, 2, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, |
7257 0, 0); | 7257 0, 0); |
7258 TextureManager::TextureInfo* info = | 7258 TextureManager::TextureInfo* info = |
7259 group().texture_manager()->GetTextureInfo(client_texture_id_); | 7259 group().texture_manager()->GetTextureInfo(client_texture_id_); |
7260 EXPECT_EQ(kServiceTextureId, info->service_id()); | 7260 EXPECT_EQ(kServiceTextureId, info->service_id()); |
7261 | 7261 |
7262 // Assigns and binds new service side texture ID and applies the texture | 7262 // Assigns and binds new service side texture ID. |
7263 // objects' state to it. | |
7264 EXPECT_CALL(*gl_, GenTextures(1, _)) | 7263 EXPECT_CALL(*gl_, GenTextures(1, _)) |
7265 .WillOnce(SetArgumentPointee<1>(kNewServiceId)) | 7264 .WillOnce(SetArgumentPointee<1>(kNewServiceId)) |
7266 .RetiresOnSaturation(); | 7265 .RetiresOnSaturation(); |
7267 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kNewServiceId)) | 7266 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kNewServiceId)) |
7268 .Times(1) | 7267 .Times(1) |
7269 .RetiresOnSaturation(); | 7268 .RetiresOnSaturation(); |
7270 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_2D, | |
7271 GL_TEXTURE_MIN_FILTER, | |
7272 GL_NEAREST_MIPMAP_LINEAR)); | |
7273 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_2D, | |
7274 GL_TEXTURE_MAG_FILTER, | |
7275 GL_LINEAR)); | |
7276 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_2D, | |
7277 GL_TEXTURE_WRAP_S, | |
7278 GL_REPEAT)); | |
7279 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_2D, | |
7280 GL_TEXTURE_WRAP_T, | |
7281 GL_REPEAT)); | |
7282 | 7269 |
7283 ProduceTextureCHROMIUM produce_cmd; | 7270 ProduceTextureCHROMIUM produce_cmd; |
7284 produce_cmd.Init(GL_TEXTURE_2D, kSharedMemoryId, kSharedMemoryOffset); | 7271 produce_cmd.Init(GL_TEXTURE_2D, kSharedMemoryId, kSharedMemoryOffset); |
7285 EXPECT_EQ(error::kNoError, ExecuteCmd(produce_cmd)); | 7272 EXPECT_EQ(error::kNoError, ExecuteCmd(produce_cmd)); |
7286 | 7273 |
7287 // Texture is zero-by-zero. | 7274 // Texture is zero-by-zero. |
7288 GLsizei width; | 7275 GLsizei width; |
7289 GLsizei height; | 7276 GLsizei height; |
7290 GLenum type; | 7277 GLenum type; |
7291 GLenum internal_format; | 7278 GLenum internal_format; |
7292 | 7279 |
7293 EXPECT_TRUE(info->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); | 7280 EXPECT_TRUE(info->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |
7294 EXPECT_EQ(0, width); | 7281 EXPECT_EQ(0, width); |
7295 EXPECT_EQ(0, height); | 7282 EXPECT_EQ(0, height); |
7296 EXPECT_TRUE(info->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); | 7283 EXPECT_TRUE(info->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); |
7297 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); | 7284 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); |
7298 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); | 7285 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); |
7299 | 7286 |
7300 EXPECT_TRUE(info->GetLevelSize(GL_TEXTURE_2D, 1, &width, &height)); | 7287 EXPECT_TRUE(info->GetLevelSize(GL_TEXTURE_2D, 1, &width, &height)); |
7301 EXPECT_EQ(0, width); | 7288 EXPECT_EQ(0, width); |
7302 EXPECT_EQ(0, height); | 7289 EXPECT_EQ(0, height); |
7303 EXPECT_TRUE(info->GetLevelType(GL_TEXTURE_2D, 1, &type, &internal_format)); | 7290 EXPECT_TRUE(info->GetLevelType(GL_TEXTURE_2D, 1, &type, &internal_format)); |
7304 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); | 7291 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); |
7305 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); | 7292 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); |
7306 | 7293 |
7307 // Service ID has changed. | 7294 // Service ID has changed. |
7308 EXPECT_EQ(kNewServiceId, info->service_id()); | 7295 EXPECT_EQ(kNewServiceId, info->service_id()); |
7309 | 7296 |
7310 // Assigns and binds original service side texture ID and applies the texture | 7297 // Assigns and binds original service size texture ID. |
7311 // objects' state to it. | |
7312 EXPECT_CALL(*gl_, DeleteTextures(1, _)) | 7298 EXPECT_CALL(*gl_, DeleteTextures(1, _)) |
7313 .Times(1) | 7299 .Times(1) |
7314 .RetiresOnSaturation(); | 7300 .RetiresOnSaturation(); |
7315 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId)) | 7301 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId)) |
7316 .Times(1) | 7302 .Times(1) |
7317 .RetiresOnSaturation(); | 7303 .RetiresOnSaturation(); |
7318 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_2D, | |
7319 GL_TEXTURE_MIN_FILTER, | |
7320 GL_NEAREST_MIPMAP_LINEAR)); | |
7321 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_2D, | |
7322 GL_TEXTURE_MAG_FILTER, | |
7323 GL_LINEAR)); | |
7324 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_2D, | |
7325 GL_TEXTURE_WRAP_S, | |
7326 GL_REPEAT)); | |
7327 EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_2D, | |
7328 GL_TEXTURE_WRAP_T, | |
7329 GL_REPEAT)); | |
7330 | 7304 |
7331 ConsumeTextureCHROMIUM consume_cmd; | 7305 ConsumeTextureCHROMIUM consume_cmd; |
7332 consume_cmd.Init(GL_TEXTURE_2D, kSharedMemoryId, kSharedMemoryOffset); | 7306 consume_cmd.Init(GL_TEXTURE_2D, kSharedMemoryId, kSharedMemoryOffset); |
7333 EXPECT_EQ(error::kNoError, ExecuteCmd(consume_cmd)); | 7307 EXPECT_EQ(error::kNoError, ExecuteCmd(consume_cmd)); |
7334 | 7308 |
7335 // Texture is redefined. | 7309 // Texture is redefined. |
7336 EXPECT_TRUE(info->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); | 7310 EXPECT_TRUE(info->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); |
7337 EXPECT_EQ(3, width); | 7311 EXPECT_EQ(3, width); |
7338 EXPECT_EQ(1, height); | 7312 EXPECT_EQ(1, height); |
7339 EXPECT_TRUE(info->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); | 7313 EXPECT_TRUE(info->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); |
(...skipping 801 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
8141 // TODO(gman): TexImage2DImmediate | 8115 // TODO(gman): TexImage2DImmediate |
8142 | 8116 |
8143 // TODO(gman): TexSubImage2DImmediate | 8117 // TODO(gman): TexSubImage2DImmediate |
8144 | 8118 |
8145 // TODO(gman): UseProgram | 8119 // TODO(gman): UseProgram |
8146 | 8120 |
8147 // TODO(gman): SwapBuffers | 8121 // TODO(gman): SwapBuffers |
8148 | 8122 |
8149 } // namespace gles2 | 8123 } // namespace gles2 |
8150 } // namespace gpu | 8124 } // namespace gpu |
OLD | NEW |