| Index: gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
|
| diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
|
| index 906eb88f8f645e23d3aa8c49b7c533a2902a8aab..f40951b97bb10d3e656d5bc3936df95e52802ffa 100644
|
| --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
|
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
|
| @@ -19,10 +19,8 @@
|
| #include "gpu/command_buffer/service/mailbox_manager.h"
|
| #include "gpu/command_buffer/service/mocks.h"
|
| #include "gpu/command_buffer/service/program_manager.h"
|
| -#include "gpu/command_buffer/service/stream_texture_manager_mock.h"
|
| -#include "gpu/command_buffer/service/stream_texture_mock.h"
|
| -#include "gpu/command_buffer/service/test_helper.h"
|
| #include "testing/gtest/include/gtest/gtest.h"
|
| +#include "ui/gl/gl_image_mock.h"
|
| #include "ui/gl/gl_implementation.h"
|
| #include "ui/gl/gl_mock.h"
|
| #include "ui/gl/gl_surface_stub.h"
|
| @@ -5631,122 +5629,153 @@ TEST_F(GLES2DecoderManualInitTest, BindGeneratesResourceFalse) {
|
| EXPECT_NE(error::kNoError, ExecuteCmd(cmd4));
|
| }
|
|
|
| -TEST_F(GLES2DecoderManualInitTest, CreateStreamTextureCHROMIUM) {
|
| - const GLuint kObjectId = 123;
|
| - InitDecoder(
|
| - "GL_CHROMIUM_stream_texture", // extensions
|
| - false, // has alpha
|
| - false, // has depth
|
| - false, // has stencil
|
| - false, // request alpha
|
| - false, // request depth
|
| - false, // request stencil
|
| - true); // bind generates resource
|
| +class GLES2StreamTextureTest : public GLES2DecoderManualInitTest {
|
| + public:
|
| + GLES2StreamTextureTest() { }
|
|
|
| - EXPECT_CALL(*stream_texture_manager(), CreateStreamTexture(
|
| - kServiceTextureId, client_texture_id_))
|
| - .WillOnce(Return(kObjectId))
|
| - .RetiresOnSaturation();
|
| + virtual void SetUp() {
|
| + InitDecoder(
|
| + "GL_CHROMIUM_stream_texture GL_OES_EGL_image_external", // extensions
|
| + true, // has alpha
|
| + true, // has depth
|
| + false, // has stencil
|
| + true, // request alpha
|
| + true, // request depth
|
| + false, // request stencil
|
| + true); // bind generates resource
|
| + }
|
|
|
| - CreateStreamTextureCHROMIUM cmd;
|
| - CreateStreamTextureCHROMIUM::Result* result =
|
| - static_cast<CreateStreamTextureCHROMIUM::Result*>(shared_memory_address_);
|
| - cmd.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_);
|
| - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| - EXPECT_EQ(kObjectId, *result);
|
| + protected:
|
| + void CreateAndBindTexImage(GLuint client_texture_id,
|
| + GLuint service_texture_id) {
|
| + TextureRef* texture_ref = GetTexture(client_texture_id);
|
| + DoBindTexture(
|
| + GL_TEXTURE_EXTERNAL_OES, client_texture_id, service_texture_id);
|
| + scoped_refptr<gfx::GLImage> image =
|
| + gfx::GLImage::CreateGLImageForStreamTexture(service_texture_id);
|
| + group().texture_manager()->SetLevelInfo(texture_ref,
|
| + GL_TEXTURE_EXTERNAL_OES,
|
| + 0,
|
| + GL_RGBA,
|
| + 0,
|
| + 0,
|
| + 1,
|
| + 0,
|
| + GL_RGBA,
|
| + GL_UNSIGNED_BYTE,
|
| + true);
|
| + group().texture_manager()->SetLevelImage(
|
| + texture_ref, GL_TEXTURE_EXTERNAL_OES, 0, image);
|
| + }
|
| +
|
| + GLuint AddImage(Texture* texture) {
|
| + GLuint image_id = GetIdAllocator(id_namespaces::kImages)->AllocateID();
|
| + scoped_refptr<gfx::GLImage> image =
|
| + texture->GetLevelImage(GL_TEXTURE_EXTERNAL_OES, 0);
|
| + EXPECT_TRUE(image != NULL);
|
| + group().image_manager()->AddImage(image, image_id);
|
| + return image_id;
|
| + }
|
| +
|
| + GLuint DoCreateStreamTexture(GLuint client_texture_id) {
|
| + CreateStreamTextureCHROMIUM cmd;
|
| + CreateStreamTextureCHROMIUM::Result* result =
|
| + static_cast<CreateStreamTextureCHROMIUM::Result*>(
|
| + shared_memory_address_);
|
| + cmd.Init(client_texture_id, shared_memory_id_, shared_memory_offset_);
|
| + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| + return *result;
|
| + }
|
| +
|
| + scoped_refptr<gfx::GLImage> LookupImage(int32 image_id) {
|
| + return group().image_manager()->LookupImage(image_id);
|
| + }
|
| +};
|
| +
|
| +TEST_F(GLES2StreamTextureTest, CreateStreamTextureCHROMIUM) {
|
| + GLuint image_id = DoCreateStreamTexture(client_texture_id_);
|
| EXPECT_EQ(GL_NO_ERROR, GetGLError());
|
| +
|
| TextureRef* texture_ref = GetTexture(client_texture_id_);
|
| EXPECT_TRUE(texture_ref != NULL);
|
| - EXPECT_TRUE(texture_ref->texture()->IsStreamTexture());
|
| - EXPECT_CALL(*stream_texture_manager(),
|
| - DestroyStreamTexture(kServiceTextureId))
|
| - .Times(1)
|
| - .RetiresOnSaturation();
|
| -}
|
| + EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES),
|
| + texture_ref->texture()->target());
|
| + EXPECT_NE(0U, image_id);
|
|
|
| -TEST_F(GLES2DecoderManualInitTest, CreateStreamTextureCHROMIUMBadId) {
|
| - InitDecoder(
|
| - "GL_CHROMIUM_stream_texture", // extensions
|
| - false, // has alpha
|
| - false, // has depth
|
| - false, // has stencil
|
| - false, // request alpha
|
| - false, // request depth
|
| - false, // request stencil
|
| - true); // bind generates resource
|
| + scoped_refptr<gfx::GLImage> attached_image =
|
| + texture_ref->texture()->GetLevelImage(GL_TEXTURE_EXTERNAL_OES, 0);
|
| + scoped_refptr<gfx::GLImage> image = LookupImage(image_id);
|
| + EXPECT_TRUE(image.get() != NULL);
|
| + EXPECT_EQ(image.get(), attached_image.get());
|
| +}
|
|
|
| - CreateStreamTextureCHROMIUM cmd;
|
| - CreateStreamTextureCHROMIUM::Result* result =
|
| - static_cast<CreateStreamTextureCHROMIUM::Result*>(shared_memory_address_);
|
| - cmd.Init(kNewClientId, shared_memory_id_, shared_memory_offset_);
|
| - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| - EXPECT_EQ(static_cast<GLuint>(GL_ZERO), *result);
|
| +TEST_F(GLES2StreamTextureTest, CreateStreamTextureCHROMIUMBadTextureId) {
|
| + GLuint image_id = DoCreateStreamTexture(kNewClientId);
|
| + EXPECT_EQ(0U, image_id);
|
| EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
|
| }
|
|
|
| -TEST_F(GLES2DecoderManualInitTest, CreateStreamTextureCHROMIUMAlreadyBound) {
|
| - InitDecoder(
|
| - "GL_CHROMIUM_stream_texture", // extensions
|
| - false, // has alpha
|
| - false, // has depth
|
| - false, // has stencil
|
| - false, // request alpha
|
| - false, // request depth
|
| - false, // request stencil
|
| - true); // bind generates resource
|
| +TEST_F(GLES2StreamTextureTest, CreateStreamTextureCHROMIUMAlreadyBound2D) {
|
| DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
|
|
|
| - CreateStreamTextureCHROMIUM cmd;
|
| - CreateStreamTextureCHROMIUM::Result* result =
|
| - static_cast<CreateStreamTextureCHROMIUM::Result*>(shared_memory_address_);
|
| - cmd.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_);
|
| - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| - EXPECT_EQ(static_cast<GLuint>(GL_ZERO), *result);
|
| + // Cannot create stream from a texture that's already bound to an incompatible
|
| + // target (not bound to GL_TEXTURE_EXTERNAL_OES).
|
| + GLuint image_id = DoCreateStreamTexture(client_texture_id_);
|
| + EXPECT_EQ(0U, image_id);
|
| EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
|
| }
|
|
|
| -TEST_F(GLES2DecoderManualInitTest, CreateStreamTextureCHROMIUMAlreadySet) {
|
| - InitDecoder(
|
| - "GL_CHROMIUM_stream_texture", // extensions
|
| - false, // has alpha
|
| - false, // has depth
|
| - false, // has stencil
|
| - false, // request alpha
|
| - false, // request depth
|
| - false, // request stencil
|
| - true); // bind generates resource
|
| +TEST_F(GLES2StreamTextureTest,
|
| + CreateStreamTextureCHROMIUMAlreadyBoundExternal) {
|
| + DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId);
|
|
|
| - TextureRef* texture_ref = GetTexture(client_texture_id_);
|
| - group().texture_manager()->SetStreamTexture(texture_ref, true);
|
| + GLuint image_id = DoCreateStreamTexture(client_texture_id_);
|
| + EXPECT_NE(0U, image_id);
|
| + EXPECT_EQ(GL_NO_ERROR, GetGLError());
|
| +}
|
|
|
| - CreateStreamTextureCHROMIUM cmd;
|
| - cmd.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_);
|
| - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| - EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
|
|
|
| - EXPECT_CALL(*stream_texture_manager(),
|
| - DestroyStreamTexture(kServiceTextureId))
|
| - .Times(1)
|
| - .RetiresOnSaturation();
|
| -}
|
| +TEST_F(GLES2StreamTextureTest, ReCreateStreamTextureCHROMIUM) {
|
| + CreateAndBindTexImage(client_texture_id_, kServiceTextureId);
|
| + Texture* texture = GetTexture(client_texture_id_)->texture();
|
| + GLuint image_id = AddImage(texture);
|
|
|
| -TEST_F(GLES2DecoderManualInitTest, DrawStreamTextureCHROMIUM) {
|
| - InitDecoder(
|
| - "GL_CHROMIUM_stream_texture GL_OES_EGL_image_external", // extensions
|
| - true, // has alpha
|
| - true, // has depth
|
| - false, // has stencil
|
| - true, // request alpha
|
| - true, // request depth
|
| - false, // request stencil
|
| - true); // bind generates resource
|
| + scoped_refptr<gfx::GLImage> old_image(LookupImage(image_id));
|
| + EXPECT_TRUE(old_image.get() != NULL);
|
|
|
| - StrictMock<MockStreamTexture> stream_texture;
|
| + DestroyStreamTextureCHROMIUM cmd;
|
| + cmd.Init(image_id);
|
| + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| + EXPECT_EQ(GL_NO_ERROR, GetGLError());
|
|
|
| - TextureRef* texture_ref = GetTexture(client_texture_id_);
|
| - group().texture_manager()->SetStreamTexture(texture_ref, true);
|
| + image_id = DoCreateStreamTexture(client_texture_id_);
|
| + EXPECT_NE(0U, image_id);
|
| + EXPECT_EQ(GL_NO_ERROR, GetGLError());
|
| +
|
| + scoped_refptr<gfx::GLImage> new_image(LookupImage(image_id));
|
| + EXPECT_TRUE(new_image != NULL);
|
| + EXPECT_EQ(new_image.get(),
|
| + texture->GetLevelImage(GL_TEXTURE_EXTERNAL_OES, 0));
|
| + EXPECT_NE(old_image.get(), new_image.get());
|
| +}
|
|
|
| +TEST_F(GLES2StreamTextureTest, DrawStreamTextureCHROMIUM) {
|
| + scoped_refptr<gfx::GLImageMock> mock_image(new StrictMock<gfx::GLImageMock>);
|
| + TextureRef* texture_ref = GetTexture(client_texture_id_);
|
| DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId);
|
| + group().texture_manager()->SetLevelInfo(texture_ref,
|
| + GL_TEXTURE_EXTERNAL_OES,
|
| + 0,
|
| + GL_RGBA,
|
| + 0,
|
| + 0,
|
| + 1,
|
| + 0,
|
| + GL_RGBA,
|
| + GL_UNSIGNED_BYTE,
|
| + true);
|
| + group().texture_manager()->SetLevelImage(
|
| + texture_ref, GL_TEXTURE_EXTERNAL_OES, 0, mock_image);
|
| EXPECT_EQ(GL_NO_ERROR, GetGLError());
|
|
|
| SetupSamplerExternalProgram();
|
| @@ -5756,10 +5785,7 @@ TEST_F(GLES2DecoderManualInitTest, DrawStreamTextureCHROMIUM) {
|
| EXPECT_TRUE(group().texture_manager()->CanRender(texture_ref));
|
|
|
| InSequence s;
|
| - EXPECT_CALL(*stream_texture_manager(), LookupStreamTexture(kServiceTextureId))
|
| - .WillOnce(Return(&stream_texture))
|
| - .RetiresOnSaturation();
|
| - EXPECT_CALL(stream_texture, Update())
|
| + EXPECT_CALL(*mock_image, UpdateTexImage())
|
| .Times(1)
|
| .RetiresOnSaturation();
|
| EXPECT_CALL(*gl_, DrawElements(_, _, _, _))
|
| @@ -5769,235 +5795,30 @@ TEST_F(GLES2DecoderManualInitTest, DrawStreamTextureCHROMIUM) {
|
| kValidIndexRangeStart * 2);
|
| EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| EXPECT_EQ(GL_NO_ERROR, GetGLError());
|
| -
|
| - EXPECT_CALL(*stream_texture_manager(),
|
| - DestroyStreamTexture(kServiceTextureId))
|
| - .Times(1)
|
| - .RetiresOnSaturation();
|
| -}
|
| -
|
| -TEST_F(GLES2DecoderManualInitTest, BindStreamTextureCHROMIUMInvalid) {
|
| - InitDecoder(
|
| - "GL_CHROMIUM_stream_texture", // extensions
|
| - false, // has alpha
|
| - false, // has depth
|
| - false, // has stencil
|
| - false, // request alpha
|
| - false, // request depth
|
| - false, // request stencil
|
| - true); // bind generates resource
|
| -
|
| - TextureRef* texture_ref = GetTexture(client_texture_id_);
|
| - group().texture_manager()->SetStreamTexture(texture_ref, true);
|
| -
|
| - BindTexture cmd;
|
| - cmd.Init(GL_TEXTURE_2D, client_texture_id_);
|
| - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| - EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
|
| -
|
| - BindTexture cmd2;
|
| - cmd2.Init(GL_TEXTURE_CUBE_MAP, client_texture_id_);
|
| - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2));
|
| - EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
|
| -
|
| - EXPECT_CALL(*stream_texture_manager(),
|
| - DestroyStreamTexture(kServiceTextureId))
|
| - .Times(1)
|
| - .RetiresOnSaturation();
|
| }
|
|
|
| -TEST_F(GLES2DecoderManualInitTest, DestroyStreamTextureCHROMIUM) {
|
| - InitDecoder(
|
| - "GL_CHROMIUM_stream_texture", // extensions
|
| - false, // has alpha
|
| - false, // has depth
|
| - false, // has stencil
|
| - false, // request alpha
|
| - false, // request depth
|
| - false, // request stencil
|
| - true); // bind generates resource
|
| -
|
| - TextureRef* texture_ref = GetTexture(client_texture_id_);
|
| - group().texture_manager()->SetStreamTexture(texture_ref, true);
|
| -
|
| - EXPECT_CALL(*stream_texture_manager(),
|
| - DestroyStreamTexture(kServiceTextureId))
|
| - .Times(1)
|
| - .RetiresOnSaturation();
|
| +TEST_F(GLES2StreamTextureTest, DestroyStreamTextureCHROMIUM) {
|
| + CreateAndBindTexImage(client_texture_id_, kServiceTextureId);
|
| + Texture* texture = GetTexture(client_texture_id_)->texture();
|
| + const GLuint image_id = AddImage(texture);
|
|
|
| DestroyStreamTextureCHROMIUM cmd;
|
| - cmd.Init(client_texture_id_);
|
| + cmd.Init(image_id);
|
| EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| EXPECT_EQ(GL_NO_ERROR, GetGLError());
|
| - EXPECT_FALSE(texture_ref->texture()->IsStreamTexture());
|
| - EXPECT_EQ(0U, texture_ref->texture()->target());
|
| + EXPECT_TRUE(LookupImage(image_id) == NULL);
|
| }
|
|
|
| -TEST_F(GLES2DecoderManualInitTest, DestroyStreamTextureCHROMIUMInvalid) {
|
| - InitDecoder(
|
| - "GL_CHROMIUM_stream_texture", // extensions
|
| - false, // has alpha
|
| - false, // has depth
|
| - false, // has stencil
|
| - false, // request alpha
|
| - false, // request depth
|
| - false, // request stencil
|
| - true); // bind generates resource
|
| +TEST_F(GLES2StreamTextureTest, DestroyStreamTextureCHROMIUMUntracked) {
|
| + CreateAndBindTexImage(client_texture_id_, kServiceTextureId);
|
|
|
| + // This should fail because the image is not tracked by the manager.
|
| DestroyStreamTextureCHROMIUM cmd;
|
| cmd.Init(client_texture_id_);
|
| EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
|
| }
|
|
|
| -TEST_F(GLES2DecoderManualInitTest, DestroyStreamTextureCHROMIUMBadId) {
|
| - InitDecoder(
|
| - "GL_CHROMIUM_stream_texture", // extensions
|
| - false, // has alpha
|
| - false, // has depth
|
| - false, // has stencil
|
| - false, // request alpha
|
| - false, // request depth
|
| - false, // request stencil
|
| - true); // bind generates resource
|
| -
|
| - DestroyStreamTextureCHROMIUM cmd;
|
| - cmd.Init(GL_ZERO);
|
| - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| - EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
|
| -}
|
| -
|
| -TEST_F(GLES2DecoderManualInitTest, StreamTextureCHROMIUMNullMgr) {
|
| - InitDecoder(
|
| - "", // extensions
|
| - false, // has alpha
|
| - false, // has depth
|
| - false, // has stencil
|
| - false, // request alpha
|
| - false, // request depth
|
| - false, // request stencil
|
| - true); // bind generates resource
|
| -
|
| - CreateStreamTextureCHROMIUM cmd;
|
| - cmd.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_);
|
| - EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd));
|
| - GetGLError(); // ignore internal error
|
| -
|
| - TextureRef* texture_ref = GetTexture(client_texture_id_);
|
| - group().texture_manager()->SetStreamTexture(texture_ref, true);
|
| -
|
| - DestroyStreamTextureCHROMIUM cmd2;
|
| - cmd2.Init(client_texture_id_);
|
| - EXPECT_EQ(error::kInvalidArguments, ExecuteCmd(cmd2));
|
| - GetGLError(); // ignore internal error
|
| -}
|
| -
|
| -TEST_F(GLES2DecoderManualInitTest, ReCreateStreamTextureCHROMIUM) {
|
| - const GLuint kObjectId = 123;
|
| - InitDecoder(
|
| - "GL_CHROMIUM_stream_texture GL_OES_EGL_image_external", // extensions
|
| - false, // has alpha
|
| - false, // has depth
|
| - false, // has stencil
|
| - false, // request alpha
|
| - false, // request depth
|
| - false, // request stencil
|
| - true); // bind generates resource
|
| -
|
| - EXPECT_CALL(*stream_texture_manager(),
|
| - DestroyStreamTexture(kServiceTextureId))
|
| - .Times(1)
|
| - .RetiresOnSaturation();
|
| - EXPECT_CALL(*stream_texture_manager(),
|
| - CreateStreamTexture(kServiceTextureId, client_texture_id_))
|
| - .WillOnce(Return(kObjectId))
|
| - .RetiresOnSaturation();
|
| -
|
| - TextureRef* texture_ref = GetTexture(client_texture_id_);
|
| - group().texture_manager()->SetStreamTexture(texture_ref, true);
|
| -
|
| - DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId);
|
| - EXPECT_EQ(GL_NO_ERROR, GetGLError());
|
| -
|
| - DestroyStreamTextureCHROMIUM cmd;
|
| - cmd.Init(client_texture_id_);
|
| - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
|
| - EXPECT_EQ(GL_NO_ERROR, GetGLError());
|
| - EXPECT_FALSE(texture_ref->texture()->IsStreamTexture());
|
| -
|
| - CreateStreamTextureCHROMIUM cmd2;
|
| - cmd2.Init(client_texture_id_, shared_memory_id_, shared_memory_offset_);
|
| - EXPECT_EQ(error::kNoError, ExecuteCmd(cmd2));
|
| - EXPECT_EQ(GL_NO_ERROR, GetGLError());
|
| - EXPECT_TRUE(texture_ref->texture()->IsStreamTexture());
|
| -
|
| - EXPECT_CALL(*stream_texture_manager(),
|
| - DestroyStreamTexture(kServiceTextureId))
|
| - .Times(1)
|
| - .RetiresOnSaturation();
|
| -}
|
| -
|
| -TEST_F(GLES2DecoderManualInitTest, ProduceAndConsumeStreamTextureCHROMIUM) {
|
| - InitDecoder(
|
| - "GL_CHROMIUM_stream_texture GL_OES_EGL_image_external", // extensions
|
| - false, // has alpha
|
| - false, // has depth
|
| - false, // has stencil
|
| - false, // request alpha
|
| - false, // request depth
|
| - false, // request stencil
|
| - true); // bind generates resource
|
| -
|
| - TextureRef* texture_ref = GetTexture(client_texture_id_);
|
| - group().texture_manager()->SetStreamTexture(texture_ref, true);
|
| -
|
| - DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId);
|
| -
|
| - GLbyte mailbox[GL_MAILBOX_SIZE_CHROMIUM];
|
| - group().mailbox_manager()->GenerateMailboxName(
|
| - reinterpret_cast<MailboxName*>(mailbox));
|
| -
|
| - memcpy(shared_memory_address_, mailbox, sizeof(mailbox));
|
| -
|
| - EXPECT_EQ(kServiceTextureId, texture_ref->service_id());
|
| -
|
| - ProduceTextureCHROMIUM produce_cmd;
|
| - produce_cmd.Init(
|
| - GL_TEXTURE_EXTERNAL_OES, kSharedMemoryId, kSharedMemoryOffset);
|
| - EXPECT_EQ(error::kNoError, ExecuteCmd(produce_cmd));
|
| - EXPECT_EQ(GL_NO_ERROR, GetGLError());
|
| -
|
| - // Create new texture for consume.
|
| - EXPECT_CALL(*gl_, GenTextures(_, _))
|
| - .WillOnce(SetArgumentPointee<1>(kNewServiceId))
|
| - .RetiresOnSaturation();
|
| - DoBindTexture(GL_TEXTURE_EXTERNAL_OES, kNewClientId, kNewServiceId);
|
| -
|
| - // Assigns and binds original service size texture ID.
|
| - EXPECT_CALL(*gl_, DeleteTextures(1, _))
|
| - .Times(1)
|
| - .RetiresOnSaturation();
|
| - EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kServiceTextureId))
|
| - .Times(1)
|
| - .RetiresOnSaturation();
|
| -
|
| - // Shared mem got clobbered from GetError() above.
|
| - memcpy(shared_memory_address_, mailbox, sizeof(mailbox));
|
| - ConsumeTextureCHROMIUM consume_cmd;
|
| - consume_cmd.Init(
|
| - GL_TEXTURE_EXTERNAL_OES, kSharedMemoryId, kSharedMemoryOffset);
|
| - EXPECT_EQ(error::kNoError, ExecuteCmd(consume_cmd));
|
| - EXPECT_EQ(GL_NO_ERROR, GetGLError());
|
| -
|
| - // Service ID is restored.
|
| - EXPECT_EQ(kServiceTextureId, texture_ref->service_id());
|
| -
|
| - EXPECT_CALL(*stream_texture_manager(),
|
| - DestroyStreamTexture(kServiceTextureId))
|
| - .Times(1)
|
| - .RetiresOnSaturation();
|
| -}
|
| -
|
| TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleBindTexture) {
|
| InitDecoder(
|
| "GL_ARB_texture_rectangle", // extensions
|
|
|