| 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 7261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7272 ASSERT_EQ(static_cast<uint32>(GL_MAILBOX_SIZE_CHROMIUM), bucket->size()); | 7272 ASSERT_EQ(static_cast<uint32>(GL_MAILBOX_SIZE_CHROMIUM), bucket->size()); |
| 7273 | 7273 |
| 7274 static const GLbyte zero[GL_MAILBOX_SIZE_CHROMIUM] = { | 7274 static const GLbyte zero[GL_MAILBOX_SIZE_CHROMIUM] = { |
| 7275 0 | 7275 0 |
| 7276 }; | 7276 }; |
| 7277 EXPECT_NE(0, memcmp(zero, | 7277 EXPECT_NE(0, memcmp(zero, |
| 7278 bucket->GetData(0, GL_MAILBOX_SIZE_CHROMIUM), | 7278 bucket->GetData(0, GL_MAILBOX_SIZE_CHROMIUM), |
| 7279 sizeof(zero))); | 7279 sizeof(zero))); |
| 7280 } | 7280 } |
| 7281 | 7281 |
| 7282 TEST_F(GLES2DecoderTest, ProduceAndConsumeTextureCHROMIUM) { | 7282 class TextureMailboxTest : public GLES2DecoderTestBase { |
| 7283 GLbyte mailbox[GL_MAILBOX_SIZE_CHROMIUM]; | 7283 public: |
| 7284 group().mailbox_manager()->GenerateMailboxName( | 7284 TextureMailboxTest() |
| 7285 reinterpret_cast<MailboxName*>(mailbox)); | 7285 : GLES2DecoderTestBase() { |
| 7286 | 7286 } |
| 7287 memcpy(shared_memory_address_, mailbox, sizeof(mailbox)); | 7287 |
| 7288 virtual void SetUp() { |
| 7289 GLES2DecoderTestBase::SetUp(); |
| 7290 |
| 7291 // Register some extra texture ids. |
| 7292 RegisterTexture(kClientId1, kServiceId1); |
| 7293 RegisterTexture(kClientId2, kServiceId2); |
| 7294 RegisterTexture(kClientId3, kServiceId3); |
| 7295 } |
| 7296 |
| 7297 protected: |
| 7298 MailboxName ProduceTexture() { |
| 7299 // Assigns and binds new service side texture ID. |
| 7300 EXPECT_CALL(*gl_, GenTextures(1, _)) |
| 7301 .WillOnce(SetArgumentPointee<1>(kNewServiceId)).RetiresOnSaturation(); |
| 7302 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kNewServiceId)).Times(1) |
| 7303 .RetiresOnSaturation(); |
| 7304 |
| 7305 MailboxName mailbox; |
| 7306 group().mailbox_manager()->GenerateMailboxName(&mailbox); |
| 7307 memcpy(shared_memory_address_, &mailbox, sizeof(mailbox)); |
| 7308 ProduceTextureCHROMIUM produce_cmd; |
| 7309 produce_cmd.Init(GL_TEXTURE_2D, kSharedMemoryId, kSharedMemoryOffset); |
| 7310 EXPECT_EQ(error::kNoError, ExecuteCmd(produce_cmd)); |
| 7311 return mailbox; |
| 7312 } |
| 7313 |
| 7314 void ConsumeTexture( |
| 7315 const MailboxName& mailbox, GLuint old_texture, GLuint new_texture) { |
| 7316 // TextureManager::Restore will set TexParameters. |
| 7317 EXPECT_CALL( |
| 7318 *gl_, |
| 7319 TexParameteri( |
| 7320 GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR)) |
| 7321 .Times(1).RetiresOnSaturation(); |
| 7322 EXPECT_CALL(*gl_, |
| 7323 TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)) |
| 7324 .Times(1).RetiresOnSaturation(); |
| 7325 EXPECT_CALL(*gl_, |
| 7326 TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)) |
| 7327 .Times(1).RetiresOnSaturation(); |
| 7328 EXPECT_CALL(*gl_, |
| 7329 TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT)) |
| 7330 .Times(1).RetiresOnSaturation(); |
| 7331 #if 0 |
| 7332 EXPECT_CALL(*gl_, |
| 7333 TexParameteri(GL_TEXTURE_2D, GL_TEXTURE_USAGE_ANGLE, GL_NONE)) |
| 7334 .Times(1).RetiresOnSaturation(); |
| 7335 #endif |
| 7336 // Assigns and binds original service size texture ID. |
| 7337 EXPECT_CALL(*gl_, DeleteTextures(1, Pointee(old_texture))).Times(1) |
| 7338 .RetiresOnSaturation(); |
| 7339 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, new_texture)).Times(1) |
| 7340 .RetiresOnSaturation(); |
| 7341 |
| 7342 memcpy(shared_memory_address_, &mailbox, sizeof(mailbox)); |
| 7343 ConsumeTextureCHROMIUM consume_cmd; |
| 7344 consume_cmd.Init(GL_TEXTURE_2D, kSharedMemoryId, kSharedMemoryOffset); |
| 7345 EXPECT_EQ(error::kNoError, ExecuteCmd(consume_cmd)); |
| 7346 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 7347 ::testing::Mock::VerifyAndClearExpectations(gl_.get()); |
| 7348 } |
| 7349 |
| 7350 void VerifyLevel(Texture* texture, GLint level, GLint width, GLint height, |
| 7351 GLenum type, GLenum format) { |
| 7352 GLint w, h; |
| 7353 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, level, &w, &h)); |
| 7354 EXPECT_EQ(w, width); |
| 7355 EXPECT_EQ(h, height); |
| 7356 GLenum t, f; |
| 7357 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, level, &t, &f)); |
| 7358 EXPECT_EQ(static_cast<GLenum>(type), t); |
| 7359 EXPECT_EQ(static_cast<GLenum>(format), f); |
| 7360 } |
| 7361 |
| 7362 static const GLuint kClientId1; |
| 7363 static const GLuint kServiceId1; |
| 7364 static const GLuint kClientId2; |
| 7365 static const GLuint kServiceId2; |
| 7366 static const GLuint kClientId3; |
| 7367 static const GLuint kServiceId3; |
| 7368 |
| 7369 private: |
| 7370 void RegisterTexture(GLuint client_id, GLuint service_id) { |
| 7371 EXPECT_CALL(*gl_, GenTextures(_, _)) |
| 7372 .WillOnce(SetArgumentPointee<1>(service_id)) |
| 7373 .RetiresOnSaturation(); |
| 7374 GenHelper<GenTexturesImmediate>(client_id); |
| 7375 Texture* texture = group().texture_manager()->GetTexture(client_id); |
| 7376 EXPECT_EQ(service_id, texture->service_id()); |
| 7377 } |
| 7378 }; |
| 7379 |
| 7380 const GLuint TextureMailboxTest::kClientId1 = 4100; |
| 7381 const GLuint TextureMailboxTest::kServiceId1 = 4101; |
| 7382 const GLuint TextureMailboxTest::kClientId2 = 4102; |
| 7383 const GLuint TextureMailboxTest::kServiceId2 = 4103; |
| 7384 const GLuint TextureMailboxTest::kClientId3 = 4104; |
| 7385 const GLuint TextureMailboxTest::kServiceId3 = 4105; |
| 7386 |
| 7387 // Produces and consumes a texture back into the same client texture. |
| 7388 TEST_F(TextureMailboxTest, ProduceAndConsumeToSameTexture) { |
| 7389 GLsizei level0_width = 3; |
| 7390 GLsizei level0_height = 1; |
| 7391 GLenum type = GL_UNSIGNED_BYTE; |
| 7392 GLenum format = GL_RGBA; |
| 7393 |
| 7394 DoBindTexture(GL_TEXTURE_2D, kClientId1, kServiceId1); |
| 7395 DoTexImage2D(GL_TEXTURE_2D, 0, format, level0_width, level0_height, |
| 7396 0, format, type, 0, 0); |
| 7397 Texture* texture = group().texture_manager()->GetTexture(kClientId1); |
| 7398 EXPECT_FALSE(texture->IsImmutable()); |
| 7399 |
| 7400 MailboxName mailbox = ProduceTexture(); |
| 7401 |
| 7402 VerifyLevel(texture, 0, 0, 0, type, format); |
| 7403 |
| 7404 // Service ID has changed. |
| 7405 EXPECT_EQ(kNewServiceId, texture->service_id()); |
| 7406 EXPECT_TRUE(texture->IsImmutable()); |
| 7407 |
| 7408 ConsumeTexture(mailbox, kNewServiceId, kServiceId1); |
| 7409 |
| 7410 // Texture is restored to the previous state. |
| 7411 VerifyLevel(texture, 0, level0_width, level0_height, type, format); |
| 7412 EXPECT_EQ(kServiceId1, texture->service_id()); |
| 7413 EXPECT_FALSE(texture->IsImmutable()); |
| 7414 |
| 7415 DoDeleteTexture(kClientId1, kServiceId1); |
| 7416 |
| 7417 // The texture should have been removed from the mailbox. |
| 7418 EXPECT_TRUE(group().mailbox_manager()-> |
| 7419 ConsumeTexture(GL_TEXTURE_2D, mailbox) == NULL); |
| 7420 } |
| 7421 |
| 7422 // Produces and consumes two textures between two clients. |
| 7423 TEST_F(TextureMailboxTest, ProduceAndConsumeTextures) { |
| 7424 const GLsizei level0_width = 3; |
| 7425 const GLsizei level0_height = 1; |
| 7426 const GLsizei level1_width = 2; |
| 7427 const GLsizei level1_height = 4; |
| 7428 const GLenum type = GL_UNSIGNED_BYTE; |
| 7429 const GLenum format = GL_RGBA; |
| 7430 |
| 7431 // Produce a texture with two levels. |
| 7432 DoBindTexture(GL_TEXTURE_2D, kClientId1, kServiceId1); |
| 7433 DoTexImage2D(GL_TEXTURE_2D, 0, format, level0_width, level0_height, |
| 7434 0, format, type, 0, 0); |
| 7435 DoTexImage2D(GL_TEXTURE_2D, 1, format, level1_width, level1_height, |
| 7436 0, format, type, 0, 0); |
| 7437 MailboxName mailbox1 = ProduceTexture(); |
| 7438 |
| 7439 // Produce a second 16x16 texture. |
| 7440 DoBindTexture(GL_TEXTURE_2D, kClientId2, kServiceId2); |
| 7441 DoTexImage2D(GL_TEXTURE_2D, 0, format, 16, 16, |
| 7442 0, format, type, 0, 0); |
| 7443 MailboxName mailbox2 = ProduceTexture(); |
| 7444 |
| 7445 // Consume the first texture. |
| 7446 DoBindTexture(GL_TEXTURE_2D, kClientId3, kServiceId3); |
| 7447 ConsumeTexture(mailbox1, kServiceId3, kServiceId1); |
| 7448 Texture* texture = group().texture_manager()->GetTexture(kClientId3); |
| 7449 EXPECT_FALSE(texture->IsImmutable()); |
| 7450 |
| 7451 // The textures should have been removed from the mailbox. |
| 7452 EXPECT_TRUE(group().mailbox_manager()-> |
| 7453 ConsumeTexture(GL_TEXTURE_2D, mailbox1) == NULL); |
| 7454 |
| 7455 // Delete the producer texture now and make sure it still gets cleaned up |
| 7456 // correctly from the consumer. |
| 7457 DoDeleteTexture(kClientId1, kNewServiceId); |
| 7458 |
| 7459 // Texture is redefined. |
| 7460 VerifyLevel(texture, 0, level0_width, level0_height, type, format); |
| 7461 VerifyLevel(texture, 1, level1_width, level1_height, type, format); |
| 7462 |
| 7463 // Service ID is unchanged. |
| 7464 EXPECT_EQ(kServiceId1, texture->service_id()); |
| 7465 |
| 7466 // Consume the second texture, which deletes the previous shared texture. |
| 7467 ConsumeTexture(mailbox2, kServiceId1, kServiceId2); |
| 7468 VerifyLevel(texture, 0, 16, 16, type, format); |
| 7469 VerifyLevel(texture, 1, 0, 0, 0, 0); |
| 7470 |
| 7471 // The textures should have been removed from the mailbox. |
| 7472 EXPECT_TRUE(group().mailbox_manager()-> |
| 7473 ConsumeTexture(GL_TEXTURE_2D, mailbox2) == NULL); |
| 7474 |
| 7475 // Delete the empty producer-side texture. |
| 7476 DoDeleteTexture(kClientId2, kNewServiceId); |
| 7477 |
| 7478 // Deleting the consumer-side texure (most recent mailbox texture). |
| 7479 DoDeleteTexture(kClientId3, kServiceId2); |
| 7480 } |
| 7481 |
| 7482 // Produces and consumes a texture back and forth between two clients. |
| 7483 TEST_F(TextureMailboxTest, PingPongTexture) { |
| 7484 const GLsizei width = 2; |
| 7485 const GLsizei height = 4; |
| 7486 const GLenum type = GL_UNSIGNED_BYTE; |
| 7487 const GLenum format = GL_RGBA; |
| 7488 |
| 7489 // Produce a texture from client1. |
| 7490 DoBindTexture(GL_TEXTURE_2D, kClientId1, kServiceId1); |
| 7491 DoTexImage2D(GL_TEXTURE_2D, 0, format, width, height, |
| 7492 0, format, type, 0, 0); |
| 7493 MailboxName mailbox1 = ProduceTexture(); |
| 7494 |
| 7495 // Consume the texture from client2. |
| 7496 DoBindTexture(GL_TEXTURE_2D, kClientId2, kServiceId2); |
| 7497 ConsumeTexture(mailbox1, kServiceId2, kServiceId1); |
| 7498 |
| 7499 // The textures should have been removed from the mailbox. |
| 7500 EXPECT_TRUE(group().mailbox_manager()-> |
| 7501 ConsumeTexture(GL_TEXTURE_2D, mailbox1) == NULL); |
| 7502 |
| 7503 // Produce it into a new mailbox. |
| 7504 MailboxName mailbox2 = ProduceTexture(); |
| 7505 Texture* texture = group().texture_manager()->GetTexture(kClientId2); |
| 7506 EXPECT_TRUE(texture->IsImmutable()); |
| 7507 |
| 7508 // Consume the texture back from client1. |
| 7509 DoBindTexture(GL_TEXTURE_2D, kClientId1, kNewServiceId); |
| 7510 ConsumeTexture(mailbox2, kNewServiceId, kServiceId1); |
| 7511 texture = group().texture_manager()->GetTexture(kClientId1); |
| 7512 EXPECT_FALSE(texture->IsImmutable()); |
| 7513 VerifyLevel(texture, 0, width, height, type, format); |
| 7514 |
| 7515 // The textures should have been removed from the mailbox. |
| 7516 EXPECT_TRUE(group().mailbox_manager()-> |
| 7517 ConsumeTexture(GL_TEXTURE_2D, mailbox2) == NULL); |
| 7518 |
| 7519 // Delete kClientId2 first to also release the reference to kServiceId1. |
| 7520 DoDeleteTexture(kClientId2, kNewServiceId); |
| 7521 DoDeleteTexture(kClientId1, kServiceId1); |
| 7522 } |
| 7523 |
| 7524 // Produces a texture but deletes it before it gets consumed from the mailbox. |
| 7525 TEST_F(TextureMailboxTest, ProduceAndDeleteTexture) { |
| 7526 GLsizei width = 3; |
| 7527 GLsizei height = 1; |
| 7528 GLenum type = GL_UNSIGNED_BYTE; |
| 7529 GLenum format = GL_RGBA; |
| 7288 | 7530 |
| 7289 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); | 7531 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 7290 DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 7532 DoTexImage2D(GL_TEXTURE_2D, 0, format, width, height, |
| 7291 0, 0); | 7533 0, format, type, 0, 0); |
| 7292 DoTexImage2D(GL_TEXTURE_2D, 1, GL_RGBA, 2, 4, 0, GL_RGBA, GL_UNSIGNED_BYTE, | 7534 |
| 7293 0, 0); | 7535 MailboxName mailbox = ProduceTexture(); |
| 7294 Texture* texture = group().texture_manager()->GetTexture(client_texture_id_); | 7536 |
| 7295 EXPECT_EQ(kServiceTextureId, texture->service_id()); | 7537 // Both texures should get deleted (the empty producer texture and |
| 7296 | 7538 // the one in the mailbox). |
| 7297 // Assigns and binds new service side texture ID. | 7539 EXPECT_CALL(*gl_, DeleteTextures(1, Pointee(kNewServiceId))) |
| 7298 EXPECT_CALL(*gl_, GenTextures(1, _)) | |
| 7299 .WillOnce(SetArgumentPointee<1>(kNewServiceId)) | |
| 7300 .RetiresOnSaturation(); | |
| 7301 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kNewServiceId)) | |
| 7302 .Times(1) | 7540 .Times(1) |
| 7303 .RetiresOnSaturation(); | 7541 .RetiresOnSaturation(); |
| 7304 | 7542 DoDeleteTexture(client_texture_id_, kServiceTextureId); |
| 7543 |
| 7544 // The texture should have been removed from the mailbox. |
| 7545 EXPECT_TRUE(group().mailbox_manager()-> |
| 7546 ConsumeTexture(GL_TEXTURE_2D, mailbox) == NULL); |
| 7547 } |
| 7548 |
| 7549 // Test that trying to produce an immutable texture repeatedly fails. |
| 7550 TEST_F(TextureMailboxTest, ProduceTextureTwiceFails) { |
| 7551 GLsizei width = 3; |
| 7552 GLsizei height = 1; |
| 7553 GLenum type = GL_UNSIGNED_BYTE; |
| 7554 GLenum format = GL_RGBA; |
| 7555 |
| 7556 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| 7557 DoTexImage2D(GL_TEXTURE_2D, 0, format, width, height, |
| 7558 0, format, type, 0, 0); |
| 7559 |
| 7560 MailboxName mailbox = ProduceTexture(); |
| 7561 |
| 7562 EXPECT_EQ(memcmp(shared_memory_address_, &mailbox, sizeof(mailbox)), 0); |
| 7305 ProduceTextureCHROMIUM produce_cmd; | 7563 ProduceTextureCHROMIUM produce_cmd; |
| 7306 produce_cmd.Init(GL_TEXTURE_2D, kSharedMemoryId, kSharedMemoryOffset); | 7564 produce_cmd.Init(GL_TEXTURE_2D, kSharedMemoryId, kSharedMemoryOffset); |
| 7307 EXPECT_EQ(error::kNoError, ExecuteCmd(produce_cmd)); | 7565 EXPECT_EQ(error::kNoError, ExecuteCmd(produce_cmd)); |
| 7308 | 7566 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 7309 // Texture is zero-by-zero. | 7567 |
| 7310 GLsizei width; | 7568 // Both texures should get deleted (the empty producer texture and |
| 7311 GLsizei height; | 7569 // the one in the mailbox). |
| 7312 GLenum type; | 7570 EXPECT_CALL(*gl_, DeleteTextures(1, Pointee(kNewServiceId))) |
| 7313 GLenum internal_format; | |
| 7314 | |
| 7315 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); | |
| 7316 EXPECT_EQ(0, width); | |
| 7317 EXPECT_EQ(0, height); | |
| 7318 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); | |
| 7319 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); | |
| 7320 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); | |
| 7321 | |
| 7322 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 1, &width, &height)); | |
| 7323 EXPECT_EQ(0, width); | |
| 7324 EXPECT_EQ(0, height); | |
| 7325 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 1, &type, &internal_format)); | |
| 7326 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); | |
| 7327 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); | |
| 7328 | |
| 7329 // Service ID has changed. | |
| 7330 EXPECT_EQ(kNewServiceId, texture->service_id()); | |
| 7331 | |
| 7332 // Assigns and binds original service size texture ID. | |
| 7333 EXPECT_CALL(*gl_, DeleteTextures(1, _)) | |
| 7334 .Times(1) | 7571 .Times(1) |
| 7335 .RetiresOnSaturation(); | 7572 .RetiresOnSaturation(); |
| 7336 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId)) | 7573 DoDeleteTexture(client_texture_id_, kServiceTextureId); |
| 7337 .Times(1) | 7574 } |
| 7338 .RetiresOnSaturation(); | |
| 7339 | |
| 7340 // TextureManager::Restore will set TexParameters. | |
| 7341 EXPECT_CALL(*gl_, TexParameteri( | |
| 7342 GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_LINEAR)) | |
| 7343 .Times(1) | |
| 7344 .RetiresOnSaturation(); | |
| 7345 EXPECT_CALL(*gl_, TexParameteri( | |
| 7346 GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)) | |
| 7347 .Times(1) | |
| 7348 .RetiresOnSaturation(); | |
| 7349 EXPECT_CALL(*gl_, TexParameteri( | |
| 7350 GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)) | |
| 7351 .Times(1) | |
| 7352 .RetiresOnSaturation(); | |
| 7353 EXPECT_CALL(*gl_, TexParameteri( | |
| 7354 GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT)) | |
| 7355 .Times(1) | |
| 7356 .RetiresOnSaturation(); | |
| 7357 #if 0 | |
| 7358 EXPECT_CALL(*gl_, TexParameteri( | |
| 7359 GL_TEXTURE_2D, GL_TEXTURE_USAGE_ANGLE, GL_NONE)) | |
| 7360 .Times(1) | |
| 7361 .RetiresOnSaturation(); | |
| 7362 #endif | |
| 7363 | |
| 7364 ConsumeTextureCHROMIUM consume_cmd; | |
| 7365 consume_cmd.Init(GL_TEXTURE_2D, kSharedMemoryId, kSharedMemoryOffset); | |
| 7366 EXPECT_EQ(error::kNoError, ExecuteCmd(consume_cmd)); | |
| 7367 | |
| 7368 // Texture is redefined. | |
| 7369 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height)); | |
| 7370 EXPECT_EQ(3, width); | |
| 7371 EXPECT_EQ(1, height); | |
| 7372 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); | |
| 7373 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); | |
| 7374 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); | |
| 7375 | |
| 7376 EXPECT_TRUE(texture->GetLevelSize(GL_TEXTURE_2D, 1, &width, &height)); | |
| 7377 EXPECT_EQ(2, width); | |
| 7378 EXPECT_EQ(4, height); | |
| 7379 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 1, &type, &internal_format)); | |
| 7380 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); | |
| 7381 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); | |
| 7382 | |
| 7383 // Service ID is restored. | |
| 7384 EXPECT_EQ(kServiceTextureId, texture->service_id()); | |
| 7385 } | |
| 7386 | |
| 7387 | 7575 |
| 7388 TEST_F(GLES2DecoderTest, CanChangeSurface) { | 7576 TEST_F(GLES2DecoderTest, CanChangeSurface) { |
| 7389 scoped_refptr<GLSurfaceMock> other_surface(new GLSurfaceMock); | 7577 scoped_refptr<GLSurfaceMock> other_surface(new GLSurfaceMock); |
| 7390 EXPECT_CALL(*other_surface.get(), GetBackingFrameBufferObject()). | 7578 EXPECT_CALL(*other_surface.get(), GetBackingFrameBufferObject()). |
| 7391 WillOnce(Return(7)); | 7579 WillOnce(Return(7)); |
| 7392 EXPECT_CALL(*gl_, BindFramebufferEXT(GL_FRAMEBUFFER_EXT, 7)); | 7580 EXPECT_CALL(*gl_, BindFramebufferEXT(GL_FRAMEBUFFER_EXT, 7)); |
| 7393 | 7581 |
| 7394 decoder_->SetSurface(other_surface); | 7582 decoder_->SetSurface(other_surface); |
| 7395 } | 7583 } |
| 7396 | 7584 |
| (...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 8513 // TODO(gman): TexImage2DImmediate | 8701 // TODO(gman): TexImage2DImmediate |
| 8514 | 8702 |
| 8515 // TODO(gman): TexSubImage2DImmediate | 8703 // TODO(gman): TexSubImage2DImmediate |
| 8516 | 8704 |
| 8517 // TODO(gman): UseProgram | 8705 // TODO(gman): UseProgram |
| 8518 | 8706 |
| 8519 // TODO(gman): SwapBuffers | 8707 // TODO(gman): SwapBuffers |
| 8520 | 8708 |
| 8521 } // namespace gles2 | 8709 } // namespace gles2 |
| 8522 } // namespace gpu | 8710 } // namespace gpu |
| OLD | NEW |