Skip to content

Commit

Permalink
Android: Fix up video to work with mailboxes.
Browse files Browse the repository at this point in the history
Change Consume/ProduceTexture to use the same texture target validator as BindTexture(). Otherwise, external and rectangle textures will fail this call, since we exclude these targets from the wider GL APIs using the texture_target validator

Also, pass stream texture flag along and reset it to |false| after Produce() since the new GL texture will be disconnected from the stream.

BUG=230327,179729

Review URL: https://codereview.chromium.org/14095009

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@194668 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
sievers@chromium.org committed Apr 17, 2013
1 parent 21293f7 commit 4cc17b2
Show file tree
Hide file tree
Showing 11 changed files with 147 additions and 17 deletions.
1 change: 1 addition & 0 deletions content/common/gpu/texture_image_transport_surface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ TextureDefinition* TextureImageTransportSurface::CreateTextureDefinition(
GL_CLAMP_TO_EDGE,
GL_NONE,
true,
false,
level_infos);
}

Expand Down
4 changes: 2 additions & 2 deletions gpu/command_buffer/client/gles2_implementation_impl_autogen.h
Original file line number Diff line number Diff line change
Expand Up @@ -1641,7 +1641,7 @@ void GLES2Implementation::CopyTextureCHROMIUM(
void GLES2Implementation::ProduceTextureCHROMIUM(
GLenum target, const GLbyte* mailbox) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glProduceTextureCHROMIUM(" << GLES2Util::GetStringTextureTarget(target) << ", " << static_cast<const void*>(mailbox) << ")"); // NOLINT
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glProduceTextureCHROMIUM(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << static_cast<const void*>(mailbox) << ")"); // NOLINT
GPU_CLIENT_LOG("values: " << mailbox[0] << ", " << mailbox[1] << ", " << mailbox[2] << ", " << mailbox[3] << ", " << mailbox[4] << ", " << mailbox[5] << ", " << mailbox[6] << ", " << mailbox[7] << ", " << mailbox[8] << ", " << mailbox[9] << ", " << mailbox[10] << ", " << mailbox[11] << ", " << mailbox[12] << ", " << mailbox[13] << ", " << mailbox[14] << ", " << mailbox[15] << ", " << mailbox[16] << ", " << mailbox[17] << ", " << mailbox[18] << ", " << mailbox[19] << ", " << mailbox[20] << ", " << mailbox[21] << ", " << mailbox[22] << ", " << mailbox[23] << ", " << mailbox[24] << ", " << mailbox[25] << ", " << mailbox[26] << ", " << mailbox[27] << ", " << mailbox[28] << ", " << mailbox[29] << ", " << mailbox[30] << ", " << mailbox[31] << ", " << mailbox[32] << ", " << mailbox[33] << ", " << mailbox[34] << ", " << mailbox[35] << ", " << mailbox[36] << ", " << mailbox[37] << ", " << mailbox[38] << ", " << mailbox[39] << ", " << mailbox[40] << ", " << mailbox[41] << ", " << mailbox[42] << ", " << mailbox[43] << ", " << mailbox[44] << ", " << mailbox[45] << ", " << mailbox[46] << ", " << mailbox[47] << ", " << mailbox[48] << ", " << mailbox[49] << ", " << mailbox[50] << ", " << mailbox[51] << ", " << mailbox[52] << ", " << mailbox[53] << ", " << mailbox[54] << ", " << mailbox[55] << ", " << mailbox[56] << ", " << mailbox[57] << ", " << mailbox[58] << ", " << mailbox[59] << ", " << mailbox[60] << ", " << mailbox[61] << ", " << mailbox[62] << ", " << mailbox[63]); // NOLINT
helper_->ProduceTextureCHROMIUMImmediate(target, mailbox);
CheckGLError();
Expand All @@ -1650,7 +1650,7 @@ void GLES2Implementation::ProduceTextureCHROMIUM(
void GLES2Implementation::ConsumeTextureCHROMIUM(
GLenum target, const GLbyte* mailbox) {
GPU_CLIENT_SINGLE_THREAD_CHECK();
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glConsumeTextureCHROMIUM(" << GLES2Util::GetStringTextureTarget(target) << ", " << static_cast<const void*>(mailbox) << ")"); // NOLINT
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glConsumeTextureCHROMIUM(" << GLES2Util::GetStringTextureBindTarget(target) << ", " << static_cast<const void*>(mailbox) << ")"); // NOLINT
GPU_CLIENT_LOG("values: " << mailbox[0] << ", " << mailbox[1] << ", " << mailbox[2] << ", " << mailbox[3] << ", " << mailbox[4] << ", " << mailbox[5] << ", " << mailbox[6] << ", " << mailbox[7] << ", " << mailbox[8] << ", " << mailbox[9] << ", " << mailbox[10] << ", " << mailbox[11] << ", " << mailbox[12] << ", " << mailbox[13] << ", " << mailbox[14] << ", " << mailbox[15] << ", " << mailbox[16] << ", " << mailbox[17] << ", " << mailbox[18] << ", " << mailbox[19] << ", " << mailbox[20] << ", " << mailbox[21] << ", " << mailbox[22] << ", " << mailbox[23] << ", " << mailbox[24] << ", " << mailbox[25] << ", " << mailbox[26] << ", " << mailbox[27] << ", " << mailbox[28] << ", " << mailbox[29] << ", " << mailbox[30] << ", " << mailbox[31] << ", " << mailbox[32] << ", " << mailbox[33] << ", " << mailbox[34] << ", " << mailbox[35] << ", " << mailbox[36] << ", " << mailbox[37] << ", " << mailbox[38] << ", " << mailbox[39] << ", " << mailbox[40] << ", " << mailbox[41] << ", " << mailbox[42] << ", " << mailbox[43] << ", " << mailbox[44] << ", " << mailbox[45] << ", " << mailbox[46] << ", " << mailbox[47] << ", " << mailbox[48] << ", " << mailbox[49] << ", " << mailbox[50] << ", " << mailbox[51] << ", " << mailbox[52] << ", " << mailbox[53] << ", " << mailbox[54] << ", " << mailbox[55] << ", " << mailbox[56] << ", " << mailbox[57] << ", " << mailbox[58] << ", " << mailbox[59] << ", " << mailbox[60] << ", " << mailbox[61] << ", " << mailbox[62] << ", " << mailbox[63]); // NOLINT
helper_->ConsumeTextureCHROMIUMImmediate(target, mailbox);
CheckGLError();
Expand Down
4 changes: 2 additions & 2 deletions gpu/command_buffer/cmd_buffer_functions.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,8 @@ GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenumDrawMode m
GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenumDrawMode mode, GLsizei count, GLenumIndexType type, const void* indices, GLsizei primcount);
GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint divisor);
GL_APICALL void GL_APIENTRY glGenMailboxCHROMIUM (GLbyte* mailbox);
GL_APICALL void GL_APIENTRY glProduceTextureCHROMIUM (GLenumTextureTarget target, const GLbyte* mailbox);
GL_APICALL void GL_APIENTRY glConsumeTextureCHROMIUM (GLenumTextureTarget target, const GLbyte* mailbox);
GL_APICALL void GL_APIENTRY glProduceTextureCHROMIUM (GLenumTextureBindTarget target, const GLbyte* mailbox);
GL_APICALL void GL_APIENTRY glConsumeTextureCHROMIUM (GLenumTextureBindTarget target, const GLbyte* mailbox);
GL_APICALL void GL_APIENTRY glBindUniformLocationCHROMIUM (GLidProgram program, GLint location, const char* name);
GL_APICALL void GL_APIENTRY glBindTexImage2DCHROMIUM (GLenumTextureBindTarget target, GLint imageId);
GL_APICALL void GL_APIENTRY glReleaseTexImage2DCHROMIUM (GLenumTextureBindTarget target, GLint imageId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ static GLES2Util::EnumToString enum_to_string_table[] = {
{ 0x0C10, "GL_SCISSOR_BOX", },
{ 0x0C11, "GL_SCISSOR_TEST", },
{ 0x80000000, "GL_MULTISAMPLE_BUFFER_BIT7_QCOM", },
{ 0x300E, "GL_CONTEXT_LOST", },
{ 0x02000000, "GL_MULTISAMPLE_BUFFER_BIT1_QCOM", },
{ 0x8C2F, "GL_ANY_SAMPLES_PASSED_EXT", },
{ 0x8BD2, "GL_TEXTURE_WIDTH_QCOM", },
Expand Down Expand Up @@ -259,7 +260,7 @@ static GLES2Util::EnumToString enum_to_string_table[] = {
{ 0x00000400, "GL_STENCIL_BUFFER_BIT", },
{ 0x800A, "GL_FUNC_SUBTRACT", },
{ 0x8E2C, "GL_DEPTH_COMPONENT16_NONLINEAR_NV", },
{ 0x8508, "GL_DECR_WRAP", },
{ 0x889F, "GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING", },
{ 0x8219, "GL_FRAMEBUFFER_UNDEFINED_OES", },
{ 0x8006, "GL_FUNC_ADD", },
{ 0x8007, "GL_MIN_EXT", },
Expand Down Expand Up @@ -561,7 +562,6 @@ static GLES2Util::EnumToString enum_to_string_table[] = {
{ 0x8CAB, "GL_RENDERBUFFER_SAMPLES_ANGLE", },
{ 0x8057, "GL_RGB5_A1", },
{ 0x8056, "GL_RGBA4", },
{ 0x300E, "GL_CONTEXT_LOST", },
{ 0x150A, "GL_INVERT", },
{ 0x01000000, "GL_MULTISAMPLE_BUFFER_BIT0_QCOM", },
{ 0x78ED, "GL_PIXEL_PACK_TRANSFER_BUFFER_CHROMIUM", },
Expand Down Expand Up @@ -594,7 +594,7 @@ static GLES2Util::EnumToString enum_to_string_table[] = {
{ 0x8253, "GL_GUILTY_CONTEXT_RESET_EXT", },
{ 0x8CE5, "GL_COLOR_ATTACHMENT5_NV", },
{ 0x8872, "GL_MAX_TEXTURE_IMAGE_UNITS", },
{ 0x889F, "GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING", },
{ 0x8508, "GL_DECR_WRAP", },
{ 0x8507, "GL_INCR_WRAP", },
{ 0x8895, "GL_ELEMENT_ARRAY_BUFFER_BINDING", },
{ 0x8894, "GL_ARRAY_BUFFER_BINDING", },
Expand Down
8 changes: 4 additions & 4 deletions gpu/command_buffer/service/gles2_cmd_decoder_autogen.h
Original file line number Diff line number Diff line change
Expand Up @@ -3048,7 +3048,7 @@ error::Error GLES2DecoderImpl::HandleProduceTextureCHROMIUM(
}
const GLbyte* mailbox = GetSharedMemoryAs<const GLbyte*>(
c.mailbox_shm_id, c.mailbox_shm_offset, data_size);
if (!validators_->texture_target.IsValid(target)) {
if (!validators_->texture_bind_target.IsValid(target)) {
LOCAL_SET_GL_ERROR_INVALID_ENUM("glProduceTextureCHROMIUM", target,
"target");
return error::kNoError;
Expand All @@ -3073,7 +3073,7 @@ error::Error GLES2DecoderImpl::HandleProduceTextureCHROMIUMImmediate(
}
const GLbyte* mailbox = GetImmediateDataAs<const GLbyte*>(
c, data_size, immediate_data_size);
if (!validators_->texture_target.IsValid(target)) {
if (!validators_->texture_bind_target.IsValid(target)) {
LOCAL_SET_GL_ERROR_INVALID_ENUM("glProduceTextureCHROMIUM", target,
"target");
return error::kNoError;
Expand All @@ -3094,7 +3094,7 @@ error::Error GLES2DecoderImpl::HandleConsumeTextureCHROMIUM(
}
const GLbyte* mailbox = GetSharedMemoryAs<const GLbyte*>(
c.mailbox_shm_id, c.mailbox_shm_offset, data_size);
if (!validators_->texture_target.IsValid(target)) {
if (!validators_->texture_bind_target.IsValid(target)) {
LOCAL_SET_GL_ERROR_INVALID_ENUM("glConsumeTextureCHROMIUM", target,
"target");
return error::kNoError;
Expand All @@ -3119,7 +3119,7 @@ error::Error GLES2DecoderImpl::HandleConsumeTextureCHROMIUMImmediate(
}
const GLbyte* mailbox = GetImmediateDataAs<const GLbyte*>(
c, data_size, immediate_data_size);
if (!validators_->texture_target.IsValid(target)) {
if (!validators_->texture_bind_target.IsValid(target)) {
LOCAL_SET_GL_ERROR_INVALID_ENUM("glConsumeTextureCHROMIUM", target,
"target");
return error::kNoError;
Expand Down
99 changes: 99 additions & 0 deletions gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5923,6 +5923,105 @@ TEST_F(GLES2DecoderManualInitTest, ReCreateStreamTextureCHROMIUM) {
EXPECT_TRUE(texture->IsStreamTexture());
}

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

StrictMock<MockStreamTextureManager> manager;
StrictMock<MockStreamTexture> stream_texture;
decoder_->SetStreamTextureManager(&manager);

Texture* texture = GetTexture(client_texture_id_);
texture->SetStreamTexture(true);

EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kServiceTextureId))
.Times(1)
.RetiresOnSaturation();
EXPECT_CALL(manager, LookupStreamTexture(kServiceTextureId))
.WillOnce(Return(&stream_texture))
.RetiresOnSaturation();
EXPECT_CALL(stream_texture, Update())
.Times(1)
.RetiresOnSaturation();

BindTexture cmd;
cmd.Init(GL_TEXTURE_EXTERNAL_OES, client_texture_id_);
EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
EXPECT_EQ(GL_NO_ERROR, GetGLError());

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->service_id());

// Assigns and binds new service side texture ID.
EXPECT_CALL(*gl_, GenTextures(1, _))
.WillOnce(SetArgumentPointee<1>(kNewServiceId))
.RetiresOnSaturation();
EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kNewServiceId))
.Times(1)
.RetiresOnSaturation();

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());

// 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();

// TextureManager::Restore will set TexParameters.
EXPECT_CALL(*gl_, TexParameteri(
GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_LINEAR))
.Times(1)
.RetiresOnSaturation();
EXPECT_CALL(*gl_, TexParameteri(
GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR))
.Times(1)
.RetiresOnSaturation();
EXPECT_CALL(*gl_, TexParameteri(
GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE))
.Times(1)
.RetiresOnSaturation();
EXPECT_CALL(*gl_, TexParameteri(
GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE))
.Times(1)
.RetiresOnSaturation();
#if 0
EXPECT_CALL(*gl_, TexParameteri(
GL_TEXTURE_2D, GL_TEXTURE_USAGE_ANGLE, GL_NONE))
.Times(1)
.RetiresOnSaturation();
#endif

// 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->service_id());
}

TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleBindTexture) {
InitDecoder(
"GL_ARB_texture_rectangle", // extensions
Expand Down
2 changes: 2 additions & 0 deletions gpu/command_buffer/service/texture_definition.cc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ TextureDefinition::TextureDefinition(GLenum target,
GLenum wrap_t,
GLenum usage,
bool immutable,
bool stream_texture,
const LevelInfos& level_infos)
: target_(target),
service_id_(service_id),
Expand All @@ -56,6 +57,7 @@ TextureDefinition::TextureDefinition(GLenum target,
wrap_t_(wrap_t),
usage_(usage),
immutable_(immutable),
stream_texture_(stream_texture),
level_infos_(level_infos) {
}

Expand Down
3 changes: 3 additions & 0 deletions gpu/command_buffer/service/texture_definition.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ class GPU_EXPORT TextureDefinition {
GLenum wrap_t,
GLenum usage,
bool immutable,
bool stream_texture,
const LevelInfos& level_infos);
~TextureDefinition();

Expand All @@ -70,6 +71,7 @@ class GPU_EXPORT TextureDefinition {
GLenum usage() const { return usage_; }

bool immutable() const { return immutable_; }
bool stream_texture() const { return stream_texture_; }

const LevelInfos& level_infos() const {
return level_infos_;
Expand All @@ -84,6 +86,7 @@ class GPU_EXPORT TextureDefinition {
GLenum wrap_t_;
GLenum usage_;
bool immutable_;
bool stream_texture_;
std::vector<std::vector<LevelInfo> > level_infos_;

DISALLOW_COPY_AND_ASSIGN(TextureDefinition);
Expand Down
4 changes: 4 additions & 0 deletions gpu/command_buffer/service/texture_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -975,11 +975,13 @@ TextureDefinition* TextureManager::Save(Texture* texture) {

GLuint old_service_id = texture->service_id();
bool immutable = texture->IsImmutable();
bool stream_texture = texture->IsStreamTexture();

GLuint new_service_id = 0;
glGenTextures(1, &new_service_id);
texture->SetServiceId(new_service_id);
texture->SetImmutable(false);
texture->SetStreamTexture(false);

return new TextureDefinition(texture->target(),
old_service_id,
Expand All @@ -989,6 +991,7 @@ TextureDefinition* TextureManager::Save(Texture* texture) {
texture->wrap_t(),
texture->usage(),
immutable,
stream_texture,
level_infos);
}

Expand Down Expand Up @@ -1043,6 +1046,7 @@ bool TextureManager::Restore(
texture->SetServiceId(definition->ReleaseServiceId());
glBindTexture(texture->target(), texture->service_id());
texture->SetImmutable(definition->immutable());
texture->SetStreamTexture(definition->stream_texture());
SetParameter(function_name, decoder, texture, GL_TEXTURE_MIN_FILTER,
definition->min_filter());
SetParameter(function_name, decoder, texture, GL_TEXTURE_MAG_FILTER,
Expand Down
2 changes: 1 addition & 1 deletion gpu/command_buffer/service/texture_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class GPU_EXPORT Texture : public base::RefCounted<Texture> {
stream_texture_ = stream_texture;
}

int IsStreamTexture() {
bool IsStreamTexture() {
return stream_texture_;
}

Expand Down
31 changes: 26 additions & 5 deletions gpu/command_buffer/service/texture_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -368,9 +368,16 @@ class TextureTestBase : public testing::Test {
}

protected:
void SetUpBase(MemoryTracker* memory_tracker) {
void SetUpBase(MemoryTracker* memory_tracker, std::string extensions) {
gl_.reset(new ::testing::StrictMock< ::gfx::MockGLInterface>());
::gfx::GLInterface::SetGLInterface(gl_.get());

if (!extensions.empty()) {
TestHelper::SetupFeatureInfoInitExpectations(gl_.get(),
extensions.c_str());
feature_info_->Initialize(NULL);
}

manager_.reset(new TextureManager(
memory_tracker, feature_info_.get(),
kMaxTextureSize, kMaxCubeMapTextureSize));
Expand Down Expand Up @@ -418,15 +425,15 @@ class TextureTestBase : public testing::Test {
class TextureTest : public TextureTestBase {
protected:
virtual void SetUp() {
SetUpBase(NULL);
SetUpBase(NULL, std::string());
}
};

class TextureMemoryTrackerTest : public TextureTestBase {
protected:
virtual void SetUp() {
mock_memory_tracker_ = new StrictMock<MockMemoryTracker>();
SetUpBase(mock_memory_tracker_.get());
SetUpBase(mock_memory_tracker_.get(), std::string());
}

scoped_refptr<MockMemoryTracker> mock_memory_tracker_;
Expand Down Expand Up @@ -1283,7 +1290,7 @@ TEST_F(TextureTest, AddToSignature) {
class SaveRestoreTextureTest : public TextureTest {
public:
virtual void SetUp() {
TextureTest::SetUp();
TextureTest::SetUpBase(NULL, "GL_OES_EGL_image_external");
manager_->CreateTexture(kClient2Id, kService2Id);
texture2_ = manager_->GetTexture(kClient2Id);
}
Expand Down Expand Up @@ -1380,7 +1387,7 @@ class SaveRestoreTextureTest : public TextureTest {

TextureDefinition* Save(Texture* texture) {
EXPECT_CALL(*gl_, GenTextures(_, _))
.WillOnce(SetArgumentPointee<1>(kService2Id));
.WillOnce(SetArgumentPointee<1>(kEmptyTextureServiceId));
TextureDefinition* definition = manager_->Save(texture);
EXPECT_TRUE(definition != NULL);
return definition;
Expand Down Expand Up @@ -1469,6 +1476,20 @@ TEST_F(SaveRestoreTextureTest, SaveRestoreClearRectangle) {
decoder_.get(), texture2_, GL_TEXTURE_RECTANGLE_ARB, 0));
}

TEST_F(SaveRestoreTextureTest, SaveRestoreStreamTexture) {
manager_->SetTarget(texture_, GL_TEXTURE_EXTERNAL_OES);
EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_EXTERNAL_OES), texture_->target());
texture_->SetStreamTexture(true);
GLuint service_id = texture_->service_id();
scoped_ptr<TextureDefinition> definition(Save(texture_));
EXPECT_FALSE(texture_->IsStreamTexture());
manager_->SetTarget(texture2_, GL_TEXTURE_EXTERNAL_OES);
Restore(texture2_, definition.release());
EXPECT_TRUE(texture2_->IsStreamTexture());
EXPECT_TRUE(texture2_->IsImmutable());
EXPECT_EQ(service_id, texture2_->service_id());
}

TEST_F(SaveRestoreTextureTest, SaveRestoreCube) {
manager_->SetTarget(texture_, GL_TEXTURE_CUBE_MAP);
EXPECT_EQ(static_cast<GLenum>(GL_TEXTURE_CUBE_MAP), texture_->target());
Expand Down

0 comments on commit 4cc17b2

Please sign in to comment.