Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(499)

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc

Issue 2388653002: gpu: Add CHROMIUM_texture_from_image spec and fence support.
Patch Set: rebase Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 3354 matching lines...) Expand 10 before | Expand all | Expand 10 after
3365 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr)); 3365 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr));
3366 EXPECT_EQ(3, width); 3366 EXPECT_EQ(3, width);
3367 EXPECT_EQ(1, height); 3367 EXPECT_EQ(1, height);
3368 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); 3368 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format));
3369 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); 3369 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format);
3370 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); 3370 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type);
3371 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); 3371 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL);
3372 3372
3373 // Bind image to texture. 3373 // Bind image to texture.
3374 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. 3374 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor.
3375 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1); 3375 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1, 0);
3376 EXPECT_TRUE( 3376 EXPECT_TRUE(
3377 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr)); 3377 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr));
3378 // Image should now be set. 3378 // Image should now be set.
3379 EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); 3379 EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL);
3380 3380
3381 // Define new texture image. 3381 // Define new texture image.
3382 DoTexImage2D( 3382 DoTexImage2D(
3383 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 3383 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
3384 EXPECT_TRUE( 3384 EXPECT_TRUE(
3385 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr)); 3385 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr));
3386 // Image should no longer be set. 3386 // Image should no longer be set.
3387 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); 3387 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL);
3388 } 3388 }
3389 3389
3390 TEST_P(GLES2DecoderTest, BindTexImage2DCHROMIUMCubeMapNotAllowed) { 3390 TEST_P(GLES2DecoderTest, BindTexImage2DCHROMIUMCubeMapNotAllowed) {
3391 scoped_refptr<gl::GLImage> image(new gl::GLImageStub); 3391 scoped_refptr<gl::GLImage> image(new gl::GLImageStub);
3392 GetImageManager()->AddImage(image.get(), 1); 3392 GetImageManager()->AddImage(image.get(), 1);
3393 DoBindTexture(GL_TEXTURE_CUBE_MAP, client_texture_id_, kServiceTextureId); 3393 DoBindTexture(GL_TEXTURE_CUBE_MAP, client_texture_id_, kServiceTextureId);
3394 3394
3395 BindTexImage2DCHROMIUM bind_tex_image_2d_cmd; 3395 BindTexImage2DCHROMIUM bind_tex_image_2d_cmd;
3396 bind_tex_image_2d_cmd.Init(GL_TEXTURE_CUBE_MAP, 1); 3396 bind_tex_image_2d_cmd.Init(GL_TEXTURE_CUBE_MAP, 1, 0);
3397 EXPECT_EQ(error::kNoError, ExecuteCmd(bind_tex_image_2d_cmd)); 3397 EXPECT_EQ(error::kNoError, ExecuteCmd(bind_tex_image_2d_cmd));
3398 EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); 3398 EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
3399 } 3399 }
3400 3400
3401 TEST_P(GLES2DecoderTest, OrphanGLImageWithTexImage2D) { 3401 TEST_P(GLES2DecoderTest, OrphanGLImageWithTexImage2D) {
3402 scoped_refptr<gl::GLImage> image(new gl::GLImageStub); 3402 scoped_refptr<gl::GLImage> image(new gl::GLImageStub);
3403 GetImageManager()->AddImage(image.get(), 1); 3403 GetImageManager()->AddImage(image.get(), 1);
3404 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 3404 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
3405 3405
3406 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1); 3406 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1, 0);
3407 3407
3408 TextureRef* texture_ref = 3408 TextureRef* texture_ref =
3409 group().texture_manager()->GetTexture(client_texture_id_); 3409 group().texture_manager()->GetTexture(client_texture_id_);
3410 ASSERT_TRUE(texture_ref != NULL); 3410 ASSERT_TRUE(texture_ref != NULL);
3411 Texture* texture = texture_ref->texture(); 3411 Texture* texture = texture_ref->texture();
3412 3412
3413 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get()); 3413 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get());
3414 DoTexImage2D( 3414 DoTexImage2D(
3415 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0); 3415 GL_TEXTURE_2D, 0, GL_RGBA, 3, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
3416 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); 3416 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL);
(...skipping 20 matching lines...) Expand all
3437 GLenum type = GL_UNSIGNED_BYTE; 3437 GLenum type = GL_UNSIGNED_BYTE;
3438 uint32_t pixels_shm_id = kSharedMemoryId; 3438 uint32_t pixels_shm_id = kSharedMemoryId;
3439 uint32_t pixels_shm_offset = kSharedMemoryOffset; 3439 uint32_t pixels_shm_offset = kSharedMemoryOffset;
3440 GLboolean internal = 0; 3440 GLboolean internal = 0;
3441 3441
3442 // Define texture first. 3442 // Define texture first.
3443 DoTexImage2D(target, level, format, width, height, border, format, type, 3443 DoTexImage2D(target, level, format, width, height, border, format, type,
3444 pixels_shm_id, pixels_shm_offset); 3444 pixels_shm_id, pixels_shm_offset);
3445 3445
3446 // Bind texture to GLImage. 3446 // Bind texture to GLImage.
3447 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1); 3447 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1, 0);
3448 3448
3449 // Check binding. 3449 // Check binding.
3450 TextureRef* texture_ref = 3450 TextureRef* texture_ref =
3451 group().texture_manager()->GetTexture(client_texture_id_); 3451 group().texture_manager()->GetTexture(client_texture_id_);
3452 ASSERT_TRUE(texture_ref != NULL); 3452 ASSERT_TRUE(texture_ref != NULL);
3453 Texture* texture = texture_ref->texture(); 3453 Texture* texture = texture_ref->texture();
3454 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get()); 3454 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get());
3455 3455
3456 // TexSubImage2D should not unbind GLImage. 3456 // TexSubImage2D should not unbind GLImage.
3457 EXPECT_CALL(*gl_, TexSubImage2D(target, level, xoffset, yoffset, width, 3457 EXPECT_CALL(*gl_, TexSubImage2D(target, level, xoffset, yoffset, width,
(...skipping 23 matching lines...) Expand all
3481 GLenum format = GL_RGBA; 3481 GLenum format = GL_RGBA;
3482 GLenum type = GL_UNSIGNED_BYTE; 3482 GLenum type = GL_UNSIGNED_BYTE;
3483 uint32_t pixels_shm_id = kSharedMemoryId; 3483 uint32_t pixels_shm_id = kSharedMemoryId;
3484 uint32_t pixels_shm_offset = kSharedMemoryOffset; 3484 uint32_t pixels_shm_offset = kSharedMemoryOffset;
3485 3485
3486 // Define texture first. 3486 // Define texture first.
3487 DoTexImage2D(target, level, format, width, height, border, format, type, 3487 DoTexImage2D(target, level, format, width, height, border, format, type,
3488 pixels_shm_id, pixels_shm_offset); 3488 pixels_shm_id, pixels_shm_offset);
3489 3489
3490 // Bind texture to GLImage. 3490 // Bind texture to GLImage.
3491 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1); 3491 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1, 0);
3492 3492
3493 // Check binding. 3493 // Check binding.
3494 TextureRef* texture_ref = 3494 TextureRef* texture_ref =
3495 group().texture_manager()->GetTexture(client_texture_id_); 3495 group().texture_manager()->GetTexture(client_texture_id_);
3496 ASSERT_TRUE(texture_ref != NULL); 3496 ASSERT_TRUE(texture_ref != NULL);
3497 Texture* texture = texture_ref->texture(); 3497 Texture* texture = texture_ref->texture();
3498 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get()); 3498 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == image.get());
3499 3499
3500 // ClearLevel should use glTexSubImage2D to avoid unbinding GLImage. 3500 // ClearLevel should use glTexSubImage2D to avoid unbinding GLImage.
3501 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId)) 3501 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId))
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
3533 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr)); 3533 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr));
3534 EXPECT_EQ(3, width); 3534 EXPECT_EQ(3, width);
3535 EXPECT_EQ(1, height); 3535 EXPECT_EQ(1, height);
3536 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format)); 3536 EXPECT_TRUE(texture->GetLevelType(GL_TEXTURE_2D, 0, &type, &internal_format));
3537 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format); 3537 EXPECT_EQ(static_cast<GLenum>(GL_RGBA), internal_format);
3538 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type); 3538 EXPECT_EQ(static_cast<GLenum>(GL_UNSIGNED_BYTE), type);
3539 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); 3539 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL);
3540 3540
3541 // Bind image to texture. 3541 // Bind image to texture.
3542 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. 3542 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor.
3543 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1); 3543 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, 1, 0);
3544 EXPECT_TRUE( 3544 EXPECT_TRUE(
3545 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr)); 3545 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr));
3546 // Image should now be set. 3546 // Image should now be set.
3547 EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); 3547 EXPECT_FALSE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL);
3548 3548
3549 // Release image from texture. 3549 // Release image from texture.
3550 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. 3550 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor.
3551 EXPECT_CALL(*gl_, GetError()) 3551 EXPECT_CALL(*gl_, GetError())
3552 .WillOnce(Return(GL_NO_ERROR)) 3552 .WillOnce(Return(GL_NO_ERROR))
3553 .WillOnce(Return(GL_NO_ERROR)) 3553 .WillOnce(Return(GL_NO_ERROR))
3554 .RetiresOnSaturation(); 3554 .RetiresOnSaturation();
3555 ReleaseTexImage2DCHROMIUM release_tex_image_2d_cmd; 3555 ReleaseTexImage2DCHROMIUM release_tex_image_2d_cmd;
3556 release_tex_image_2d_cmd.Init(GL_TEXTURE_2D, 1); 3556 release_tex_image_2d_cmd.Init(GL_TEXTURE_2D, 1);
3557 EXPECT_EQ(error::kNoError, ExecuteCmd(release_tex_image_2d_cmd)); 3557 EXPECT_EQ(error::kNoError, ExecuteCmd(release_tex_image_2d_cmd));
3558 EXPECT_TRUE( 3558 EXPECT_TRUE(
3559 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr)); 3559 texture->GetLevelSize(GL_TEXTURE_2D, 0, &width, &height, nullptr));
3560 // Image should no longer be set. 3560 // Image should no longer be set.
3561 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL); 3561 EXPECT_TRUE(texture->GetLevelImage(GL_TEXTURE_2D, 0) == NULL);
3562 } 3562 }
3563 3563
3564 class MockGLImage : public gl::GLImage { 3564 class MockGLImage : public gl::GLImage {
3565 public: 3565 public:
3566 MockGLImage() {} 3566 MockGLImage() {}
3567 3567
3568 // Overridden from gl::GLImage: 3568 // Overridden from gl::GLImage:
3569 MOCK_METHOD0(GetSize, gfx::Size()); 3569 MOCK_METHOD0(GetSize, gfx::Size());
3570 MOCK_METHOD0(GetInternalFormat, unsigned()); 3570 MOCK_METHOD0(GetInternalFormat, unsigned());
3571 MOCK_METHOD1(Destroy, void(bool)); 3571 MOCK_METHOD1(Destroy, void(bool));
3572 MOCK_METHOD1(BindTexImage, bool(unsigned)); 3572 MOCK_METHOD2(BindTexImage, bool(unsigned, gl::GLFence*));
3573 MOCK_METHOD1(ReleaseTexImage, void(unsigned)); 3573 MOCK_METHOD1(ReleaseTexImage, void(unsigned));
3574 MOCK_METHOD1(CopyTexImage, bool(unsigned)); 3574 MOCK_METHOD1(CopyTexImage, bool(unsigned));
3575 MOCK_METHOD3(CopyTexSubImage, 3575 MOCK_METHOD3(CopyTexSubImage,
3576 bool(unsigned, const gfx::Point&, const gfx::Rect&)); 3576 bool(unsigned, const gfx::Point&, const gfx::Rect&));
3577 MOCK_METHOD5(ScheduleOverlayPlane, bool(gfx::AcceleratedWidget, 3577 MOCK_METHOD5(ScheduleOverlayPlane, bool(gfx::AcceleratedWidget,
3578 int, 3578 int,
3579 gfx::OverlayTransform, 3579 gfx::OverlayTransform,
3580 const gfx::Rect&, 3580 const gfx::Rect&,
3581 const gfx::RectF&)); 3581 const gfx::RectF&));
3582 MOCK_METHOD3(OnMemoryDump, 3582 MOCK_METHOD3(OnMemoryDump,
(...skipping 23 matching lines...) Expand all
3606 group().texture_manager()->GetTexture(client_texture_id_); 3606 group().texture_manager()->GetTexture(client_texture_id_);
3607 ASSERT_TRUE(texture_ref != NULL); 3607 ASSERT_TRUE(texture_ref != NULL);
3608 Texture* texture = texture_ref->texture(); 3608 Texture* texture = texture_ref->texture();
3609 EXPECT_EQ(kServiceTextureId, texture->service_id()); 3609 EXPECT_EQ(kServiceTextureId, texture->service_id());
3610 3610
3611 const int32_t kImageId = 1; 3611 const int32_t kImageId = 1;
3612 scoped_refptr<MockGLImage> image(new MockGLImage); 3612 scoped_refptr<MockGLImage> image(new MockGLImage);
3613 GetImageManager()->AddImage(image.get(), kImageId); 3613 GetImageManager()->AddImage(image.get(), kImageId);
3614 3614
3615 // Bind image to texture. 3615 // Bind image to texture.
3616 EXPECT_CALL(*image.get(), BindTexImage(GL_TEXTURE_2D)) 3616 EXPECT_CALL(*image.get(), BindTexImage(GL_TEXTURE_2D, nullptr))
3617 .Times(1) 3617 .Times(1)
3618 .WillOnce(Return(false)) 3618 .WillOnce(Return(false))
3619 .RetiresOnSaturation(); 3619 .RetiresOnSaturation();
3620 EXPECT_CALL(*image.get(), GetSize()) 3620 EXPECT_CALL(*image.get(), GetSize())
3621 .Times(1) 3621 .Times(1)
3622 .WillOnce(Return(gfx::Size(1, 1))) 3622 .WillOnce(Return(gfx::Size(1, 1)))
3623 .RetiresOnSaturation(); 3623 .RetiresOnSaturation();
3624 EXPECT_CALL(*image.get(), GetInternalFormat()) 3624 EXPECT_CALL(*image.get(), GetInternalFormat())
3625 .Times(1) 3625 .Times(1)
3626 .WillOnce(Return(GL_RGBA)) 3626 .WillOnce(Return(GL_RGBA))
3627 .RetiresOnSaturation(); 3627 .RetiresOnSaturation();
3628 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. 3628 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor.
3629 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, kImageId); 3629 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, kImageId, 0);
3630 3630
3631 AddExpectationsForSimulatedAttrib0(kNumVertices, 0); 3631 AddExpectationsForSimulatedAttrib0(kNumVertices, 0);
3632 SetupExpectationsForApplyingDefaultDirtyState(); 3632 SetupExpectationsForApplyingDefaultDirtyState();
3633 3633
3634 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. 3634 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor.
3635 EXPECT_CALL(*gl_, GetError()) 3635 EXPECT_CALL(*gl_, GetError())
3636 .WillOnce(Return(GL_NO_ERROR)) 3636 .WillOnce(Return(GL_NO_ERROR))
3637 .WillOnce(Return(GL_NO_ERROR)) 3637 .WillOnce(Return(GL_NO_ERROR))
3638 .RetiresOnSaturation(); 3638 .RetiresOnSaturation();
3639 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)).Times(2).RetiresOnSaturation(); 3639 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)).Times(2).RetiresOnSaturation();
3640 EXPECT_CALL(*image.get(), CopyTexImage(GL_TEXTURE_2D)) 3640 EXPECT_CALL(*image.get(), CopyTexImage(GL_TEXTURE_2D))
3641 .Times(1) 3641 .Times(1)
3642 .WillOnce(Return(true)) 3642 .WillOnce(Return(true))
3643 .RetiresOnSaturation(); 3643 .RetiresOnSaturation();
3644 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices)) 3644 EXPECT_CALL(*gl_, DrawArrays(GL_TRIANGLES, 0, kNumVertices))
3645 .Times(1) 3645 .Times(1)
3646 .RetiresOnSaturation(); 3646 .RetiresOnSaturation();
3647 DrawArrays cmd; 3647 DrawArrays cmd;
3648 cmd.Init(GL_TRIANGLES, 0, kNumVertices); 3648 cmd.Init(GL_TRIANGLES, 0, kNumVertices);
3649 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 3649 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
3650 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 3650 EXPECT_EQ(GL_NO_ERROR, GetGLError());
3651 3651
3652 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 3652 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
3653 // Re-bind image to texture. 3653 // Re-bind image to texture.
3654 ReleaseTexImage2DCHROMIUM release_tex_image_2d_cmd; 3654 ReleaseTexImage2DCHROMIUM release_tex_image_2d_cmd;
3655 release_tex_image_2d_cmd.Init(GL_TEXTURE_2D, kImageId); 3655 release_tex_image_2d_cmd.Init(GL_TEXTURE_2D, kImageId);
3656 EXPECT_EQ(error::kNoError, ExecuteCmd(release_tex_image_2d_cmd)); 3656 EXPECT_EQ(error::kNoError, ExecuteCmd(release_tex_image_2d_cmd));
3657 EXPECT_CALL(*image.get(), BindTexImage(GL_TEXTURE_2D)) 3657 EXPECT_CALL(*image.get(), BindTexImage(GL_TEXTURE_2D, nullptr))
3658 .Times(1) 3658 .Times(1)
3659 .WillOnce(Return(false)) 3659 .WillOnce(Return(false))
3660 .RetiresOnSaturation(); 3660 .RetiresOnSaturation();
3661 EXPECT_CALL(*image.get(), GetSize()) 3661 EXPECT_CALL(*image.get(), GetSize())
3662 .Times(1) 3662 .Times(1)
3663 .WillOnce(Return(gfx::Size(1, 1))) 3663 .WillOnce(Return(gfx::Size(1, 1)))
3664 .RetiresOnSaturation(); 3664 .RetiresOnSaturation();
3665 EXPECT_CALL(*image.get(), GetInternalFormat()) 3665 EXPECT_CALL(*image.get(), GetInternalFormat())
3666 .Times(1) 3666 .Times(1)
3667 .WillOnce(Return(GL_RGBA)) 3667 .WillOnce(Return(GL_RGBA))
3668 .RetiresOnSaturation(); 3668 .RetiresOnSaturation();
3669 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, kImageId); 3669 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, kImageId, 0);
3670 3670
3671 DoBindFramebuffer( 3671 DoBindFramebuffer(
3672 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); 3672 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId);
3673 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor. 3673 // ScopedGLErrorSuppressor calls GetError on its constructor and destructor.
3674 EXPECT_CALL(*gl_, GetError()) 3674 EXPECT_CALL(*gl_, GetError())
3675 .WillOnce(Return(GL_NO_ERROR)) 3675 .WillOnce(Return(GL_NO_ERROR))
3676 .WillOnce(Return(GL_NO_ERROR)) 3676 .WillOnce(Return(GL_NO_ERROR))
3677 .RetiresOnSaturation(); 3677 .RetiresOnSaturation();
3678 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)).Times(1).RetiresOnSaturation(); 3678 EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE0)).Times(1).RetiresOnSaturation();
3679 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId)) 3679 EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_2D, kServiceTextureId))
(...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after
4352 int image_id = use_rgb_emulation * 2 + destination_texture_index; 4352 int image_id = use_rgb_emulation * 2 + destination_texture_index;
4353 scoped_refptr<gl::GLImage> image; 4353 scoped_refptr<gl::GLImage> image;
4354 if (use_rgb_emulation) 4354 if (use_rgb_emulation)
4355 image = new EmulatingRGBImageStub; 4355 image = new EmulatingRGBImageStub;
4356 else 4356 else
4357 image = new gl::GLImageStub; 4357 image = new gl::GLImageStub;
4358 GetImageManager()->AddImage(image.get(), image_id); 4358 GetImageManager()->AddImage(image.get(), image_id);
4359 EXPECT_FALSE(GetImageManager()->LookupImage(image_id) == NULL); 4359 EXPECT_FALSE(GetImageManager()->LookupImage(image_id) == NULL);
4360 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId); 4360 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId);
4361 4361
4362 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id); 4362 DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id, 0);
4363 DoFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target, 4363 DoFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target,
4364 kFBOClientTextureId, kFBOServiceTextureId, level, 4364 kFBOClientTextureId, kFBOServiceTextureId, level,
4365 GL_NO_ERROR); 4365 GL_NO_ERROR);
4366 4366
4367 GLenum destination_texture_format = 4367 GLenum destination_texture_format =
4368 destination_texture_formats[destination_texture_index]; 4368 destination_texture_formats[destination_texture_index];
4369 bool should_succeed = 4369 bool should_succeed =
4370 !use_rgb_emulation || (destination_texture_format == GL_RGB); 4370 !use_rgb_emulation || (destination_texture_format == GL_RGB);
4371 if (should_succeed) { 4371 if (should_succeed) {
4372 EXPECT_CALL(*gl_, GetError()) 4372 EXPECT_CALL(*gl_, GetError())
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
4460 // TODO(gman): CompressedTexSubImage2DImmediate 4460 // TODO(gman): CompressedTexSubImage2DImmediate
4461 4461
4462 // TODO(gman): TexImage2D 4462 // TODO(gman): TexImage2D
4463 4463
4464 // TODO(gman): TexImage2DImmediate 4464 // TODO(gman): TexImage2DImmediate
4465 4465
4466 // TODO(gman): TexSubImage2DImmediate 4466 // TODO(gman): TexSubImage2DImmediate
4467 4467
4468 } // namespace gles2 4468 } // namespace gles2
4469 } // namespace gpu 4469 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698