summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer
diff options
context:
space:
mode:
authorpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-02 04:56:18 +0000
committerpfeldman@chromium.org <pfeldman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-04-02 04:56:18 +0000
commit16578a8e3481ffdde5b699fe747f114efb64a26b (patch)
treeaded2899b6e2b8c44ed8efdad826a9c2659c173f /gpu/command_buffer
parent1cd6af20ba32d3fc4ebf4290cf25f8fac9bc9c05 (diff)
downloadchromium_src-16578a8e3481ffdde5b699fe747f114efb64a26b.zip
chromium_src-16578a8e3481ffdde5b699fe747f114efb64a26b.tar.gz
chromium_src-16578a8e3481ffdde5b699fe747f114efb64a26b.tar.bz2
Revert of gpu: Raise GL_OUT_OF_MEMORY when BeginQueryEXT fails to allocate. (https://codereview.chromium.org/199443004/)
Reason for revert: Build failure in content/common/gpu/client/gl_helper_benchmark.cc. http://build.chromium.org/p/chromium/builders/Linux%20x64/builds/63241/steps/compile/logs/stdio Original issue's description: > gpu: Lose context when BeginQueryEXT fails to allocate. > > Instead of crashes, raise a GL_OUT_OF_MEMORY error. Since compositor > does not want to deal with these errors and it would leave it in a > bad state, add the ability to lose the context when GL_OUT_OF_MEMORY > occurs. > > R=piman > BUG=351587 > > Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=261064 TBR=piman@chromium.org,dmichael@chromium.org,jamesr@chromium.org,danakj@chromium.org NOTREECHECKS=true NOTRY=true BUG=351587 Review URL: https://codereview.chromium.org/221783002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261075 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer')
-rw-r--r--gpu/command_buffer/client/gl_in_process_context.cc10
-rw-r--r--gpu/command_buffer/client/gl_in_process_context.h1
-rw-r--r--gpu/command_buffer/client/gles2_implementation.cc31
-rw-r--r--gpu/command_buffer/client/gles2_implementation.h20
-rw-r--r--gpu/command_buffer/client/gles2_implementation_unittest.cc74
-rw-r--r--gpu/command_buffer/common/gles2_cmd_utils.cc32
-rw-r--r--gpu/command_buffer/common/gles2_cmd_utils.h1
-rw-r--r--gpu/command_buffer/service/context_state.cc6
-rw-r--r--gpu/command_buffer/service/context_state.h5
-rw-r--r--gpu/command_buffer/service/error_state.cc14
-rw-r--r--gpu/command_buffer/service/error_state.h7
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc23
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc1216
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc110
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h43
-rw-r--r--gpu/command_buffer/tests/gl_manager.cc17
-rw-r--r--gpu/command_buffer/tests/gl_manager.h2
17 files changed, 931 insertions, 681 deletions
diff --git a/gpu/command_buffer/client/gl_in_process_context.cc b/gpu/command_buffer/client/gl_in_process_context.cc
index 2b5e559..1db894f 100644
--- a/gpu/command_buffer/client/gl_in_process_context.cc
+++ b/gpu/command_buffer/client/gl_in_process_context.cc
@@ -147,7 +147,6 @@ bool GLInProcessContextImpl::Initialize(
// Chromium-specific attributes
const int32 FAIL_IF_MAJOR_PERF_CAVEAT = 0x10002;
- const int32 LOSE_CONTEXT_WHEN_OUT_OF_MEMORY = 0x10003;
std::vector<int32> attrib_vector;
if (attribs.alpha_size >= 0) {
@@ -186,10 +185,6 @@ bool GLInProcessContextImpl::Initialize(
attrib_vector.push_back(FAIL_IF_MAJOR_PERF_CAVEAT);
attrib_vector.push_back(attribs.fail_if_major_perf_caveat);
}
- if (attribs.lose_context_when_out_of_memory > 0) {
- attrib_vector.push_back(LOSE_CONTEXT_WHEN_OUT_OF_MEMORY);
- attrib_vector.push_back(attribs.lose_context_when_out_of_memory);
- }
attrib_vector.push_back(NONE);
base::Closure wrapped_callback =
@@ -255,7 +250,6 @@ bool GLInProcessContextImpl::Initialize(
share_group,
transfer_buffer_.get(),
bind_generates_resources,
- attribs.lose_context_when_out_of_memory > 0,
command_buffer_.get()));
if (use_global_share_group) {
@@ -308,9 +302,7 @@ GLInProcessContextAttribs::GLInProcessContextAttribs()
depth_size(-1),
stencil_size(-1),
samples(-1),
- sample_buffers(-1),
- fail_if_major_perf_caveat(-1),
- lose_context_when_out_of_memory(-1) {}
+ sample_buffers(-1) {}
// static
GLInProcessContext* GLInProcessContext::CreateContext(
diff --git a/gpu/command_buffer/client/gl_in_process_context.h b/gpu/command_buffer/client/gl_in_process_context.h
index be91cfd..188ed34 100644
--- a/gpu/command_buffer/client/gl_in_process_context.h
+++ b/gpu/command_buffer/client/gl_in_process_context.h
@@ -42,7 +42,6 @@ struct GLES2_IMPL_EXPORT GLInProcessContextAttribs {
int32 samples;
int32 sample_buffers;
int32 fail_if_major_perf_caveat;
- int32 lose_context_when_out_of_memory;
};
class GLES2_IMPL_EXPORT GLInProcessContext {
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 194ccfe..c155af5 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -83,12 +83,11 @@ GLES2Implementation::SingleThreadChecker::~SingleThreadChecker() {
}
GLES2Implementation::GLES2Implementation(
- GLES2CmdHelper* helper,
- ShareGroup* share_group,
- TransferBufferInterface* transfer_buffer,
- bool bind_generates_resource,
- bool lose_context_when_out_of_memory,
- GpuControl* gpu_control)
+ GLES2CmdHelper* helper,
+ ShareGroup* share_group,
+ TransferBufferInterface* transfer_buffer,
+ bool bind_generates_resource,
+ GpuControl* gpu_control)
: helper_(helper),
transfer_buffer_(transfer_buffer),
angle_pack_reverse_row_order_status_(kUnknownExtensionStatus),
@@ -114,7 +113,6 @@ GLES2Implementation::GLES2Implementation(
async_upload_sync_shm_offset_(0),
error_bits_(0),
debug_(false),
- lose_context_when_out_of_memory_(lose_context_when_out_of_memory),
use_count_(0),
error_message_callback_(NULL),
gpu_control_(gpu_control),
@@ -506,11 +504,6 @@ void GLES2Implementation::SetGLError(
error_message_callback_->OnErrorMessage(temp.c_str(), 0);
}
error_bits_ |= GLES2Util::GLErrorToErrorBit(error);
-
- if (error == GL_OUT_OF_MEMORY && lose_context_when_out_of_memory_) {
- helper_->LoseContextCHROMIUM(GL_GUILTY_CONTEXT_RESET_ARB,
- GL_UNKNOWN_CONTEXT_RESET_ARB);
- }
}
void GLES2Implementation::SetGLErrorInvalidEnum(
@@ -898,6 +891,16 @@ void GLES2Implementation::ShallowFinishCHROMIUM() {
helper_->CommandBufferHelper::Finish();
}
+bool GLES2Implementation::MustBeContextLost() {
+ bool context_lost = helper_->IsContextLost();
+ if (!context_lost) {
+ WaitForCmd();
+ context_lost = helper_->IsContextLost();
+ }
+ CHECK(context_lost);
+ return context_lost;
+}
+
void GLES2Implementation::FinishHelper() {
GPU_CLIENT_LOG("[" << GetLogPrefix() << "] glFinish()");
TRACE_EVENT0("gpu", "GLES2::Finish");
@@ -3327,9 +3330,7 @@ void GLES2Implementation::BeginQueryEXT(GLenum target, GLuint id) {
if (!query) {
query = query_tracker_->CreateQuery(id, target);
if (!query) {
- SetGLError(GL_OUT_OF_MEMORY,
- "glBeginQueryEXT",
- "transfer buffer allocation failed");
+ MustBeContextLost();
return;
}
} else if (query->target() != target) {
diff --git a/gpu/command_buffer/client/gles2_implementation.h b/gpu/command_buffer/client/gles2_implementation.h
index c843802..b120a62 100644
--- a/gpu/command_buffer/client/gles2_implementation.h
+++ b/gpu/command_buffer/client/gles2_implementation.h
@@ -180,12 +180,12 @@ class GLES2_IMPL_EXPORT GLES2Implementation
// Number of swap buffers allowed before waiting.
static const size_t kMaxSwapBuffers = 2;
- GLES2Implementation(GLES2CmdHelper* helper,
- ShareGroup* share_group,
- TransferBufferInterface* transfer_buffer,
- bool bind_generates_resource,
- bool lose_context_when_out_of_memory,
- GpuControl* gpu_control);
+ GLES2Implementation(
+ GLES2CmdHelper* helper,
+ ShareGroup* share_group,
+ TransferBufferInterface* transfer_buffer,
+ bool bind_generates_resource,
+ GpuControl* gpu_control);
virtual ~GLES2Implementation();
@@ -592,6 +592,11 @@ class GLES2_IMPL_EXPORT GLES2Implementation
void FinishHelper();
+ // Asserts that the context is lost.
+ // NOTE: This is an expensive call and should only be called
+ // for error checking.
+ bool MustBeContextLost();
+
void RunIfContextNotLost(const base::Closure& callback);
void OnSwapBuffersComplete();
@@ -724,9 +729,6 @@ class GLES2_IMPL_EXPORT GLES2Implementation
// Whether or not to print debugging info.
bool debug_;
- // When true, the context is lost when a GL_OUT_OF_MEMORY error occurs.
- bool lose_context_when_out_of_memory_;
-
// Used to check for single threaded access.
int use_count_;
diff --git a/gpu/command_buffer/client/gles2_implementation_unittest.cc b/gpu/command_buffer/client/gles2_implementation_unittest.cc
index f57d07a..aa90733 100644
--- a/gpu/command_buffer/client/gles2_implementation_unittest.cc
+++ b/gpu/command_buffer/client/gles2_implementation_unittest.cc
@@ -6,8 +6,6 @@
#include "gpu/command_buffer/client/gles2_implementation.h"
-#include <limits>
-
#include <GLES2/gl2ext.h>
#include <GLES2/gl2extchromium.h>
#include "base/compiler_specific.h"
@@ -392,9 +390,7 @@ class GLES2ImplementationTest : public testing::Test {
public:
TestContext() : commands_(NULL), token_(0) {}
- void Initialize(ShareGroup* share_group,
- bool bind_generates_resource,
- bool lose_context_when_out_of_memory) {
+ void Initialize(ShareGroup* share_group, bool bind_generates_resource) {
command_buffer_.reset(new StrictMock<MockClientCommandBuffer>());
ASSERT_TRUE(command_buffer_->Initialize());
@@ -443,12 +439,12 @@ class GLES2ImplementationTest : public testing::Test {
.RetiresOnSaturation();
GetNextToken(); // eat the token that starting up will use.
- gl_.reset(new GLES2Implementation(helper_.get(),
- share_group,
- transfer_buffer_.get(),
- bind_generates_resource,
- lose_context_when_out_of_memory,
- gpu_control_.get()));
+ gl_.reset(
+ new GLES2Implementation(helper_.get(),
+ share_group,
+ transfer_buffer_.get(),
+ bind_generates_resource,
+ gpu_control_.get()));
ASSERT_TRUE(gl_->Initialize(kTransferBufferSize,
kTransferBufferSize,
kTransferBufferSize,
@@ -518,14 +514,11 @@ class GLES2ImplementationTest : public testing::Test {
return gl_->query_tracker_->GetQuery(id);
}
- void Initialize(bool bind_generates_resource,
- bool lose_context_when_out_of_memory) {
+ void Initialize(bool bind_generates_resource) {
share_group_ = new ShareGroup(bind_generates_resource);
for (int i = 0; i < kNumTestContexts; i++)
- test_contexts_[i].Initialize(share_group_.get(),
- bind_generates_resource,
- lose_context_when_out_of_memory);
+ test_contexts_[i].Initialize(share_group_.get(), bind_generates_resource);
// Default to test context 0.
gpu_control_ = test_contexts_[0].gpu_control_.get();
@@ -592,9 +585,7 @@ class GLES2ImplementationTest : public testing::Test {
};
void GLES2ImplementationTest::SetUp() {
- bool bind_generates_resource = true;
- bool lose_context_when_out_of_memory = false;
- Initialize(bind_generates_resource, lose_context_when_out_of_memory);
+ Initialize(true);
}
void GLES2ImplementationTest::TearDown() {
@@ -602,11 +593,6 @@ void GLES2ImplementationTest::TearDown() {
test_contexts_[i].TearDown();
}
-class GLES2ImplementationManualInitTest : public GLES2ImplementationTest {
- protected:
- virtual void SetUp() OVERRIDE {}
-};
-
class GLES2ImplementationStrictSharedTest : public GLES2ImplementationTest {
protected:
virtual void SetUp() OVERRIDE;
@@ -697,9 +683,7 @@ class GLES2ImplementationStrictSharedTest : public GLES2ImplementationTest {
};
void GLES2ImplementationStrictSharedTest::SetUp() {
- bool bind_generates_resource = false;
- bool lose_context_when_out_of_memory = false;
- Initialize(bind_generates_resource, lose_context_when_out_of_memory);
+ Initialize(false);
}
// GCC requires these declarations, but MSVC requires they not be present
@@ -3116,42 +3100,6 @@ TEST_F(GLES2ImplementationTest, ProduceTextureCHROMIUM) {
EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
}
-TEST_F(GLES2ImplementationManualInitTest, LoseContextOnOOM) {
- bool bind_generates_resource = false;
- bool lose_context_when_out_of_memory = true;
- Initialize(bind_generates_resource, lose_context_when_out_of_memory);
-
- struct Cmds {
- cmds::LoseContextCHROMIUM cmd;
- };
-
- GLsizei max = std::numeric_limits<GLsizei>::max();
- EXPECT_CALL(*gpu_control_, CreateGpuMemoryBuffer(max, max, _, _))
- .WillOnce(Return(static_cast<gfx::GpuMemoryBuffer*>(NULL)));
- gl_->CreateImageCHROMIUM(max, max, 0);
- // The context should be lost.
- Cmds expected;
- expected.cmd.Init(GL_GUILTY_CONTEXT_RESET_ARB, GL_UNKNOWN_CONTEXT_RESET_ARB);
- EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
-}
-
-TEST_F(GLES2ImplementationManualInitTest, NoLoseContextOnOOM) {
- bool bind_generates_resource = false;
- bool lose_context_when_out_of_memory = false;
- Initialize(bind_generates_resource, lose_context_when_out_of_memory);
-
- struct Cmds {
- cmds::LoseContextCHROMIUM cmd;
- };
-
- GLsizei max = std::numeric_limits<GLsizei>::max();
- EXPECT_CALL(*gpu_control_, CreateGpuMemoryBuffer(max, max, _, _))
- .WillOnce(Return(static_cast<gfx::GpuMemoryBuffer*>(NULL)));
- gl_->CreateImageCHROMIUM(max, max, 0);
- // The context should not be lost.
- EXPECT_TRUE(NoCommandsWritten());
-}
-
#include "gpu/command_buffer/client/gles2_implementation_unittest_autogen.h"
} // namespace gles2
diff --git a/gpu/command_buffer/common/gles2_cmd_utils.cc b/gpu/command_buffer/common/gles2_cmd_utils.cc
index 97bc081..f310d47 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils.cc
+++ b/gpu/command_buffer/common/gles2_cmd_utils.cc
@@ -774,24 +774,23 @@ const int32 kBufferDestroyed = 0x3095; // EGL_BUFFER_DESTROYED
const int32 kShareResources = 0x10000;
const int32 kBindGeneratesResource = 0x10001;
const int32 kFailIfMajorPerfCaveat = 0x10002;
-const int32 kLoseContextWhenOutOfMemory = 0x10003;
} // namespace
ContextCreationAttribHelper::ContextCreationAttribHelper()
- : alpha_size_(-1),
- blue_size_(-1),
- green_size_(-1),
- red_size_(-1),
- depth_size_(-1),
- stencil_size_(-1),
- samples_(-1),
- sample_buffers_(-1),
- buffer_preserved_(true),
- share_resources_(false),
- bind_generates_resource_(true),
- fail_if_major_perf_caveat_(false),
- lose_context_when_out_of_memory_(false) {}
+ : alpha_size_(-1),
+ blue_size_(-1),
+ green_size_(-1),
+ red_size_(-1),
+ depth_size_(-1),
+ stencil_size_(-1),
+ samples_(-1),
+ sample_buffers_(-1),
+ buffer_preserved_(true),
+ share_resources_(false),
+ bind_generates_resource_(true),
+ fail_if_major_perf_caveat_(false) {
+}
void ContextCreationAttribHelper::Serialize(std::vector<int32>* attribs) {
if (alpha_size_ != -1) {
@@ -834,8 +833,6 @@ void ContextCreationAttribHelper::Serialize(std::vector<int32>* attribs) {
attribs->push_back(bind_generates_resource_ ? 1 : 0);
attribs->push_back(kFailIfMajorPerfCaveat);
attribs->push_back(fail_if_major_perf_caveat_ ? 1 : 0);
- attribs->push_back(kLoseContextWhenOutOfMemory);
- attribs->push_back(lose_context_when_out_of_memory_ ? 1 : 0);
attribs->push_back(kNone);
}
@@ -890,9 +887,6 @@ bool ContextCreationAttribHelper::Parse(const std::vector<int32>& attribs) {
case kFailIfMajorPerfCaveat:
fail_if_major_perf_caveat_ = value != 0;
break;
- case kLoseContextWhenOutOfMemory:
- lose_context_when_out_of_memory_ = value != 0;
- break;
case kNone:
// Terminate list, even if more attributes.
return true;
diff --git a/gpu/command_buffer/common/gles2_cmd_utils.h b/gpu/command_buffer/common/gles2_cmd_utils.h
index 0df1f31..59b5d96 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils.h
+++ b/gpu/command_buffer/common/gles2_cmd_utils.h
@@ -199,7 +199,6 @@ class GLES2_UTILS_EXPORT ContextCreationAttribHelper {
bool share_resources_;
bool bind_generates_resource_;
bool fail_if_major_perf_caveat_;
- bool lose_context_when_out_of_memory_;
};
} // namespace gles2
diff --git a/gpu/command_buffer/service/context_state.cc b/gpu/command_buffer/service/context_state.cc
index 6c929de..f046872 100644
--- a/gpu/command_buffer/service/context_state.cc
+++ b/gpu/command_buffer/service/context_state.cc
@@ -87,14 +87,12 @@ TextureUnit::TextureUnit()
TextureUnit::~TextureUnit() {
}
-ContextState::ContextState(FeatureInfo* feature_info,
- ErrorStateClient* error_state_client,
- Logger* logger)
+ContextState::ContextState(FeatureInfo* feature_info, Logger* logger)
: active_texture_unit(0),
pack_reverse_row_order(false),
fbo_binding_for_scissor_workaround_dirty_(false),
feature_info_(feature_info),
- error_state_(ErrorState::Create(error_state_client, logger)) {
+ error_state_(ErrorState::Create(logger)) {
Initialize();
}
diff --git a/gpu/command_buffer/service/context_state.h b/gpu/command_buffer/service/context_state.h
index 2c1f0e1..2697e15 100644
--- a/gpu/command_buffer/service/context_state.h
+++ b/gpu/command_buffer/service/context_state.h
@@ -22,7 +22,6 @@ namespace gles2 {
class Buffer;
class ErrorState;
-class ErrorStateClient;
class FeatureInfo;
class Framebuffer;
class Program;
@@ -94,9 +93,7 @@ struct Vec4 {
};
struct GPU_EXPORT ContextState {
- ContextState(FeatureInfo* feature_info,
- ErrorStateClient* error_state_client,
- Logger* logger);
+ ContextState(FeatureInfo* feature_info, Logger* logger);
~ContextState();
void Initialize();
diff --git a/gpu/command_buffer/service/error_state.cc b/gpu/command_buffer/service/error_state.cc
index ce65aa1..3468c7e 100644
--- a/gpu/command_buffer/service/error_state.cc
+++ b/gpu/command_buffer/service/error_state.cc
@@ -16,7 +16,7 @@ namespace gles2 {
class ErrorStateImpl : public ErrorState {
public:
- explicit ErrorStateImpl(ErrorStateClient* client, Logger* logger);
+ explicit ErrorStateImpl(Logger* logger);
virtual ~ErrorStateImpl();
virtual uint32 GetGLError() OVERRIDE;
@@ -63,7 +63,6 @@ class ErrorStateImpl : public ErrorState {
// Current GL error bits.
uint32 error_bits_;
- ErrorStateClient* client_;
Logger* logger_;
DISALLOW_COPY_AND_ASSIGN(ErrorStateImpl);
@@ -73,12 +72,13 @@ ErrorState::ErrorState() {}
ErrorState::~ErrorState() {}
-ErrorState* ErrorState::Create(ErrorStateClient* client, Logger* logger) {
- return new ErrorStateImpl(client, logger);
+ErrorState* ErrorState::Create(Logger* logger) {
+ return new ErrorStateImpl(logger);
}
-ErrorStateImpl::ErrorStateImpl(ErrorStateClient* client, Logger* logger)
- : error_bits_(0), client_(client), logger_(logger) {}
+ErrorStateImpl::ErrorStateImpl(Logger* logger)
+ : error_bits_(0),
+ logger_(logger) {}
ErrorStateImpl::~ErrorStateImpl() {}
@@ -125,8 +125,6 @@ void ErrorStateImpl::SetGLError(
function_name + ": " + msg);
}
error_bits_ |= GLES2Util::GLErrorToErrorBit(error);
- if (error == GL_OUT_OF_MEMORY)
- client_->OnOutOfMemoryError();
}
void ErrorStateImpl::SetGLErrorInvalidEnum(
diff --git a/gpu/command_buffer/service/error_state.h b/gpu/command_buffer/service/error_state.h
index 0e6a4b0..c4ef691 100644
--- a/gpu/command_buffer/service/error_state.h
+++ b/gpu/command_buffer/service/error_state.h
@@ -55,17 +55,12 @@ class Logger;
#define ERRORSTATE_CLEAR_REAL_GL_ERRORS(error_state, function_name) \
error_state->ClearRealGLErrors(__FILE__, __LINE__, function_name)
-class GPU_EXPORT ErrorStateClient {
- public:
- // GL_OUT_OF_MEMORY can cause side effects such as losing the context.
- virtual void OnOutOfMemoryError() = 0;
-};
class GPU_EXPORT ErrorState {
public:
virtual ~ErrorState();
- static ErrorState* Create(ErrorStateClient* client, Logger* logger);
+ static ErrorState* Create(Logger* logger);
virtual uint32 GetGLError() = 0;
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index c0e0e3d..c3bdae5 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -566,8 +566,7 @@ void GLES2Decoder::EndDecoding() {}
// This class implements GLES2Decoder so we don't have to expose all the GLES2
// cmd stuff to outside this class.
class GLES2DecoderImpl : public GLES2Decoder,
- public FramebufferManager::TextureDetachObserver,
- public ErrorStateClient {
+ public FramebufferManager::TextureDetachObserver {
public:
explicit GLES2DecoderImpl(ContextGroup* group);
virtual ~GLES2DecoderImpl();
@@ -695,9 +694,6 @@ class GLES2DecoderImpl : public GLES2Decoder,
virtual void OnTextureRefDetachedFromFramebuffer(
TextureRef* texture) OVERRIDE;
- // Overriden from ErrorStateClient.
- virtual void OnOutOfMemoryError() OVERRIDE;
-
// Helpers to facilitate calling into compatible extensions.
static void RenderbufferStorageMultisampleHelper(
const FeatureInfo* feature_info,
@@ -1756,9 +1752,6 @@ class GLES2DecoderImpl : public GLES2Decoder,
bool compile_shader_always_succeeds_;
- // An optional behaviour to lose the context and group when OOM.
- bool lose_context_when_out_of_memory_;
-
// Log extra info.
bool service_logging_;
@@ -2224,7 +2217,7 @@ GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group)
: GLES2Decoder(),
group_(group),
logger_(&debug_marker_manager_),
- state_(group_->feature_info(), this, &logger_),
+ state_(group_->feature_info(), &logger_),
unpack_flip_y_(false),
unpack_premultiply_alpha_(false),
unpack_unpremultiply_alpha_(false),
@@ -2257,7 +2250,6 @@ GLES2DecoderImpl::GLES2DecoderImpl(ContextGroup* group)
frag_depth_explicitly_enabled_(false),
draw_buffers_explicitly_enabled_(false),
compile_shader_always_succeeds_(false),
- lose_context_when_out_of_memory_(false),
service_logging_(CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableGPUServiceLoggingGPU)),
viewport_max_width_(0),
@@ -2331,10 +2323,6 @@ bool GLES2DecoderImpl::Initialize(
if (!attrib_parser.Parse(attribs))
return false;
- // Save the loseContextWhenOutOfMemory context creation attribute.
- lose_context_when_out_of_memory_ =
- attrib_parser.lose_context_when_out_of_memory_;
-
// If the failIfMajorPerformanceCaveat context creation attribute was true
// and we are using a software renderer, fail.
if (attrib_parser.fail_if_major_perf_caveat_ &&
@@ -10671,13 +10659,6 @@ void GLES2DecoderImpl::OnTextureRefDetachedFromFramebuffer(
DoDidUseTexImageIfNeeded(texture, texture->target());
}
-void GLES2DecoderImpl::OnOutOfMemoryError() {
- if (lose_context_when_out_of_memory_) {
- group_->LoseContexts(GL_UNKNOWN_CONTEXT_RESET_ARB);
- LoseContext(GL_GUILTY_CONTEXT_RESET_ARB);
- }
-}
-
// Include the auto-generated part of this file. We split this because it means
// we can easily edit the non-auto generated parts right here in this file
// instead of having to edit some template or the code generator.
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
index 16783b8..6437648 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
@@ -71,14 +71,15 @@ class GLES2DecoderTestWithExtensionsOnGLES2
GLES2DecoderTestWithExtensionsOnGLES2() {}
virtual void SetUp() {
- InitState init;
- init.extensions = GetParam();
- init.gl_version = "opengl es 2.0";
- init.has_alpha = true;
- init.has_depth = true;
- init.request_alpha = true;
- init.request_depth = true;
- InitDecoder(init);
+ InitDecoder(GetParam(), // extensions
+ "opengl es 2.0", // gl version
+ true, // has alpha
+ true, // has depth
+ false, // has stencil
+ true, // request alpha
+ true, // request depth
+ false, // request stencil
+ false); // bind generates resource
}
};
@@ -99,15 +100,16 @@ class GLES2DecoderGeometryInstancingTest : public GLES2DecoderWithShaderTest {
}
virtual void SetUp() {
- InitState init;
- init.extensions = "GL_ANGLE_instanced_arrays";
- init.gl_version = "opengl es 2.0";
- init.has_alpha = true;
- init.has_depth = true;
- init.request_alpha = true;
- init.request_depth = true;
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_ANGLE_instanced_arrays", // extensions
+ "opengl es 2.0", // gl version
+ true, // has alpha
+ true, // has depth
+ false, // has stencil
+ true, // request alpha
+ true, // request depth
+ false, // request stencil
+ true); // bind generates resource
SetupDefaultProgram();
}
};
@@ -123,10 +125,17 @@ class GLES2DecoderRGBBackbufferTest : public GLES2DecoderWithShaderTest {
command_line.AppendSwitchASCII(
switches::kGpuDriverBugWorkarounds,
base::IntToString(gpu::CLEAR_ALPHA_IN_READPIXELS));
- InitState init;
- init.gl_version = "3.0";
- init.bind_generates_resource = true;
- InitDecoderWithCommandLine(init, &command_line);
+ InitDecoderWithCommandLine(
+ "", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true, // bind generates resource
+ &command_line);
SetupDefaultProgram();
}
};
@@ -206,7 +215,6 @@ TEST_F(GLES2DecoderWithShaderTest, DrawArraysSimulatedAttrib0OverflowFails) {
cmd.Init(GL_TRIANGLES, 0, kLargeCount);
EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError());
- EXPECT_FALSE(GetDecoder()->WasContextLost());
}
// Tests when the math overflows (0x7FFFFFFF + 1 = 0x8000000 verts)
@@ -220,7 +228,6 @@ TEST_F(GLES2DecoderWithShaderTest, DrawArraysSimulatedAttrib0PosToNegFails) {
cmd.Init(GL_TRIANGLES, 0, kLargeCount);
EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError());
- EXPECT_FALSE(GetDecoder()->WasContextLost());
}
// Tests when the driver returns an error
@@ -236,37 +243,6 @@ TEST_F(GLES2DecoderWithShaderTest, DrawArraysSimulatedAttrib0OOMFails) {
cmd.Init(GL_TRIANGLES, 0, kFakeLargeCount);
EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError());
- EXPECT_FALSE(GetDecoder()->WasContextLost());
-}
-
-// Test that we lose context.
-TEST_F(GLES2DecoderManualInitTest, LoseContextWhenOOM) {
- InitState init;
- init.gl_version = "3.0";
- init.has_alpha = true;
- init.has_depth = true;
- init.request_alpha = true;
- init.request_depth = true;
- init.bind_generates_resource = true;
- init.lose_context_when_out_of_memory = true;
- InitDecoder(init);
- SetupDefaultProgram();
-
- const GLsizei kFakeLargeCount = 0x1234;
- SetupTexture();
- AddExpectationsForSimulatedAttrib0WithError(
- kFakeLargeCount, 0, GL_OUT_OF_MEMORY);
- EXPECT_CALL(*gl_, DrawArrays(_, _, _)).Times(0).RetiresOnSaturation();
- // Other contexts in the group should be lost also.
- EXPECT_CALL(*mock_decoder_, LoseContext(GL_UNKNOWN_CONTEXT_RESET_ARB))
- .Times(1)
- .RetiresOnSaturation();
- DrawArrays cmd;
- cmd.Init(GL_TRIANGLES, 0, kFakeLargeCount);
- // This context should be lost.
- EXPECT_EQ(error::kLostContext, ExecuteCmd(cmd));
- EXPECT_EQ(GL_OUT_OF_MEMORY, GetGLError());
- EXPECT_TRUE(decoder_->WasContextLost());
}
TEST_F(GLES2DecoderWithShaderTest, DrawArraysBadTextureUsesBlack) {
@@ -352,14 +328,17 @@ TEST_F(GLES2DecoderManualInitTest, InitVertexAttributes) {
command_line.AppendSwitchASCII(
switches::kGpuDriverBugWorkarounds,
base::IntToString(gpu::INIT_VERTEX_ATTRIBUTES));
- InitState init;
- init.gl_version = "3.0";
- init.has_alpha = true;
- init.has_depth = true;
- init.request_alpha = true;
- init.request_depth = true;
- init.bind_generates_resource = true;
- InitDecoderWithCommandLine(init, &command_line);
+ InitDecoderWithCommandLine(
+ "", // extensions
+ "3.0", // gl version
+ true, // has alpha
+ true, // has depth
+ false, // has stencil
+ true, // request alpha
+ true, // request depth
+ false, // request stencil
+ true, // bind generates resource
+ &command_line);
SetupDefaultProgram();
SetupTexture();
SetupVertexBuffer();
@@ -1949,10 +1928,17 @@ TEST_F(GLES2DecoderManualInitTest, SetTextureFiltersBeforeGenerateMipmap) {
command_line.AppendSwitchASCII(
switches::kGpuDriverBugWorkarounds,
base::IntToString(gpu::SET_TEXTURE_FILTER_BEFORE_GENERATING_MIPMAP));
- InitState init;
- init.gl_version = "3.0";
- init.bind_generates_resource = true;
- InitDecoderWithCommandLine(init, &command_line);
+ InitDecoderWithCommandLine(
+ "", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true, // bind generates resource
+ &command_line);
EXPECT_CALL(*gl_, GenerateMipmapEXT(_))
.Times(0);
@@ -2618,13 +2604,16 @@ TEST_F(GLES2DecoderTest, ReadPixelsInvalidArgs) {
}
TEST_F(GLES2DecoderManualInitTest, ReadPixelsAsyncError) {
- InitState init;
- init.extensions = "GL_ARB_sync";
- init.gl_version = "opengl es 3.0";
- init.has_alpha = true;
- init.request_alpha = true;
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_ARB_sync", // extensions
+ "opengl es 3.0", // gl version
+ true, // has alpha
+ false, // has depth
+ false, // has stencil
+ true, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
typedef ReadPixels::Result Result;
Result* result = GetSharedMemoryAs<Result*>();
@@ -3903,12 +3892,16 @@ TEST_F(GLES2DecoderRGBBackbufferTest, RGBBackbufferColorMaskFBO) {
}
TEST_F(GLES2DecoderManualInitTest, ActualAlphaMatchesRequestedAlpha) {
- InitState init;
- init.gl_version = "3.0";
- init.has_alpha = true;
- init.request_alpha = true;
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "3.0", // gl version
+ true, // has alpha
+ false, // has depth
+ false, // has stencil
+ true, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
EXPECT_CALL(*gl_, GetError())
.WillOnce(Return(GL_NO_ERROR))
@@ -3931,11 +3924,16 @@ TEST_F(GLES2DecoderManualInitTest, ActualAlphaMatchesRequestedAlpha) {
}
TEST_F(GLES2DecoderManualInitTest, ActualAlphaDoesNotMatchRequestedAlpha) {
- InitState init;
- init.gl_version = "3.0";
- init.has_alpha = true;
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "3.0", // gl version
+ true, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
EXPECT_CALL(*gl_, GetError())
.WillOnce(Return(GL_NO_ERROR))
@@ -3958,12 +3956,16 @@ TEST_F(GLES2DecoderManualInitTest, ActualAlphaDoesNotMatchRequestedAlpha) {
}
TEST_F(GLES2DecoderManualInitTest, ActualDepthMatchesRequestedDepth) {
- InitState init;
- init.gl_version = "3.0";
- init.has_depth = true;
- init.request_depth = true;
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ true, // has depth
+ false, // has stencil
+ false, // request alpha
+ true, // request depth
+ false, // request stencil
+ true); // bind generates resource
EXPECT_CALL(*gl_, GetError())
.WillOnce(Return(GL_NO_ERROR))
@@ -3986,11 +3988,16 @@ TEST_F(GLES2DecoderManualInitTest, ActualDepthMatchesRequestedDepth) {
}
TEST_F(GLES2DecoderManualInitTest, ActualDepthDoesNotMatchRequestedDepth) {
- InitState init;
- init.gl_version = "3.0";
- init.has_depth = true;
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ true, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
EXPECT_CALL(*gl_, GetError())
.WillOnce(Return(GL_NO_ERROR))
@@ -4013,12 +4020,16 @@ TEST_F(GLES2DecoderManualInitTest, ActualDepthDoesNotMatchRequestedDepth) {
}
TEST_F(GLES2DecoderManualInitTest, ActualStencilMatchesRequestedStencil) {
- InitState init;
- init.gl_version = "3.0";
- init.has_stencil = true;
- init.request_stencil = true;
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ true, // has stencil
+ false, // request alpha
+ false, // request depth
+ true, // request stencil
+ true); // bind generates resource
EXPECT_CALL(*gl_, GetError())
.WillOnce(Return(GL_NO_ERROR))
@@ -4041,11 +4052,16 @@ TEST_F(GLES2DecoderManualInitTest, ActualStencilMatchesRequestedStencil) {
}
TEST_F(GLES2DecoderManualInitTest, ActualStencilDoesNotMatchRequestedStencil) {
- InitState init;
- init.gl_version = "3.0";
- init.has_stencil = true;
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ true, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
EXPECT_CALL(*gl_, GetError())
.WillOnce(Return(GL_NO_ERROR))
@@ -4068,12 +4084,16 @@ TEST_F(GLES2DecoderManualInitTest, ActualStencilDoesNotMatchRequestedStencil) {
}
TEST_F(GLES2DecoderManualInitTest, DepthEnableWithDepth) {
- InitState init;
- init.gl_version = "3.0";
- init.has_depth = true;
- init.request_depth = true;
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ true, // has depth
+ false, // has stencil
+ false, // request alpha
+ true, // request depth
+ false, // request stencil
+ true); // bind generates resource
Enable cmd;
cmd.Init(GL_DEPTH_TEST);
@@ -4127,11 +4147,16 @@ TEST_F(GLES2DecoderManualInitTest, DepthEnableWithDepth) {
}
TEST_F(GLES2DecoderManualInitTest, DepthEnableWithoutRequestedDepth) {
- InitState init;
- init.gl_version = "3.0";
- init.has_depth = true;
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ true, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
Enable cmd;
cmd.Init(GL_DEPTH_TEST);
@@ -4184,12 +4209,16 @@ TEST_F(GLES2DecoderManualInitTest, DepthEnableWithoutRequestedDepth) {
}
TEST_F(GLES2DecoderManualInitTest, StencilEnableWithStencil) {
- InitState init;
- init.gl_version = "3.0";
- init.has_stencil = true;
- init.request_stencil = true;
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ true, // has stencil
+ false, // request alpha
+ false, // request depth
+ true, // request stencil
+ true); // bind generates resource
Enable cmd;
cmd.Init(GL_STENCIL_TEST);
@@ -4242,11 +4271,16 @@ TEST_F(GLES2DecoderManualInitTest, StencilEnableWithStencil) {
}
TEST_F(GLES2DecoderManualInitTest, StencilEnableWithoutRequestedStencil) {
- InitState init;
- init.gl_version = "3.0";
- init.has_stencil = true;
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ true, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
Enable cmd;
cmd.Init(GL_STENCIL_TEST);
@@ -4299,15 +4333,16 @@ TEST_F(GLES2DecoderManualInitTest, StencilEnableWithoutRequestedStencil) {
}
TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilReportsCorrectValues) {
- InitState init;
- init.extensions = "GL_OES_packed_depth_stencil";
- init.gl_version = "opengl es 2.0";
- init.has_depth = true;
- init.has_stencil = true;
- init.request_depth = true;
- init.request_stencil = true;
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_OES_packed_depth_stencil", // extensions
+ "opengl es 2.0", // gl version
+ false, // has alpha
+ true, // has depth
+ true, // has stencil
+ false, // request alpha
+ true, // request depth
+ true, // request stencil
+ true); // bind generates resource
EXPECT_CALL(*gl_, GetError())
.WillOnce(Return(GL_NO_ERROR))
@@ -4343,14 +4378,16 @@ TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilReportsCorrectValues) {
}
TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilNoRequestedStencil) {
- InitState init;
- init.extensions = "GL_OES_packed_depth_stencil";
- init.gl_version = "opengl es 2.0";
- init.has_depth = true;
- init.has_stencil = true;
- init.request_depth = true;
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_OES_packed_depth_stencil", // extensions
+ "opengl es 2.0", // gl version
+ false, // has alpha
+ true, // has depth
+ true, // has stencil
+ false, // request alpha
+ true, // request depth
+ false, // request stencil
+ true); // bind generates resource
EXPECT_CALL(*gl_, GetError())
.WillOnce(Return(GL_NO_ERROR))
@@ -4386,11 +4423,16 @@ TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilNoRequestedStencil) {
}
TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilRenderbufferDepth) {
- InitState init;
- init.extensions = "GL_OES_packed_depth_stencil";
- init.gl_version = "opengl es 2.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_OES_packed_depth_stencil", // extensions
+ "opengl es 2.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_,
kServiceRenderbufferId);
DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_,
@@ -4453,11 +4495,16 @@ TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilRenderbufferDepth) {
}
TEST_F(GLES2DecoderManualInitTest, PackedDepthStencilRenderbufferStencil) {
- InitState init;
- init.extensions = "GL_OES_packed_depth_stencil";
- init.gl_version = "opengl es 2.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_OES_packed_depth_stencil", // extensions
+ "opengl es 2.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_,
kServiceRenderbufferId);
DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_,
@@ -4852,11 +4899,16 @@ TEST_F(GLES2DecoderTest, RenderbufferStorageBadArgs) {
TEST_F(GLES2DecoderManualInitTest,
RenderbufferStorageMultisampleCHROMIUMGLError) {
- InitState init;
- init.extensions = "GL_EXT_framebuffer_multisample";
- init.gl_version = "2.1";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_EXT_framebuffer_multisample", // extensions
+ "2.1", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_,
kServiceRenderbufferId);
EXPECT_CALL(*gl_, GetError())
@@ -4875,11 +4927,16 @@ TEST_F(GLES2DecoderManualInitTest,
TEST_F(GLES2DecoderManualInitTest,
RenderbufferStorageMultisampleCHROMIUMBadArgs) {
- InitState init;
- init.extensions = "GL_EXT_framebuffer_multisample";
- init.gl_version = "2.1";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_EXT_framebuffer_multisample", // extensions
+ "2.1", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_,
kServiceRenderbufferId);
EXPECT_CALL(*gl_, RenderbufferStorageMultisampleEXT(_, _, _, _, _))
@@ -4901,10 +4958,16 @@ TEST_F(GLES2DecoderManualInitTest,
}
TEST_F(GLES2DecoderManualInitTest, RenderbufferStorageMultisampleCHROMIUM) {
- InitState init;
- init.extensions = "GL_EXT_framebuffer_multisample";
- init.gl_version = "2.1";
- InitDecoder(init);
+ InitDecoder(
+ "GL_EXT_framebuffer_multisample", // extensions
+ "2.1", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ false); // bind generates resource
DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_,
kServiceRenderbufferId);
InSequence sequence;
@@ -4932,11 +4995,16 @@ TEST_F(GLES2DecoderManualInitTest, RenderbufferStorageMultisampleCHROMIUM) {
TEST_F(GLES2DecoderManualInitTest,
RenderbufferStorageMultisampleEXTNotSupported) {
- InitState init;
- init.extensions = "GL_EXT_framebuffer_multisample";
- init.gl_version = "2.1";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_EXT_framebuffer_multisample", // extensions
+ "2.1", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ false); // bind generates resource
DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_,
kServiceRenderbufferId);
InSequence sequence;
@@ -5046,11 +5114,16 @@ static bool ValueInArray(GLint value, GLint* array, GLint count) {
}
TEST_F(GLES2DecoderManualInitTest, GetCompressedTextureFormats) {
- InitState init;
- init.extensions = "GL_EXT_texture_compression_s3tc";
- init.gl_version = "3.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_EXT_texture_compression_s3tc", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
EXPECT_CALL(*gl_, GetError())
.WillOnce(Return(GL_NO_ERROR))
@@ -5099,10 +5172,16 @@ TEST_F(GLES2DecoderManualInitTest, GetCompressedTextureFormats) {
}
TEST_F(GLES2DecoderManualInitTest, GetNoCompressedTextureFormats) {
- InitState init;
- init.gl_version = "3.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
EXPECT_CALL(*gl_, GetError())
.WillOnce(Return(GL_NO_ERROR))
@@ -5138,11 +5217,16 @@ TEST_F(GLES2DecoderManualInitTest, GetNoCompressedTextureFormats) {
}
TEST_F(GLES2DecoderManualInitTest, CompressedTexImage2DBucketBadBucket) {
- InitState init;
- init.extensions = "GL_EXT_texture_compression_s3tc";
- init.gl_version = "3.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_EXT_texture_compression_s3tc", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
const uint32 kBadBucketId = 123;
DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
@@ -5168,11 +5252,16 @@ struct S3TCTestData {
} // anonymous namespace.
TEST_F(GLES2DecoderManualInitTest, CompressedTexImage2DS3TC) {
- InitState init;
- init.extensions = "GL_EXT_texture_compression_s3tc";
- init.gl_version = "3.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_EXT_texture_compression_s3tc", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
const uint32 kBucketId = 123;
CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId);
ASSERT_TRUE(bucket != NULL);
@@ -5318,11 +5407,16 @@ TEST_F(GLES2DecoderManualInitTest, CompressedTexImage2DS3TC) {
}
TEST_F(GLES2DecoderManualInitTest, CompressedTexImage2DETC1) {
- InitState init;
- init.extensions = "GL_OES_compressed_ETC1_RGB8_texture";
- init.gl_version = "opengl es 2.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_OES_compressed_ETC1_RGB8_texture", // extensions
+ "opengl es 2.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
const uint32 kBucketId = 123;
CommonDecoder::Bucket* bucket = decoder_->CreateBucket(kBucketId);
ASSERT_TRUE(bucket != NULL);
@@ -5386,11 +5480,16 @@ TEST_F(GLES2DecoderManualInitTest, CompressedTexImage2DETC1) {
}
TEST_F(GLES2DecoderManualInitTest, GetCompressedTextureFormatsETC1) {
- InitState init;
- init.extensions = "GL_OES_compressed_ETC1_RGB8_texture";
- init.gl_version = "opengl es 2.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_OES_compressed_ETC1_RGB8_texture", // extensions
+ "opengl es 2.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
EXPECT_CALL(*gl_, GetError())
.WillOnce(Return(GL_NO_ERROR))
@@ -5457,11 +5556,16 @@ TEST_F(GLES2DecoderWithShaderTest, GetProgramInfoCHROMIUMInvalidArgs) {
}
TEST_F(GLES2DecoderManualInitTest, EGLImageExternalBindTexture) {
- InitState init;
- init.extensions = "GL_OES_EGL_image_external";
- init.gl_version = "opengl es 2.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_OES_EGL_image_external", // extensions
+ "opengl es 2.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kNewServiceId));
EXPECT_CALL(*gl_, GenTextures(1, _))
.WillOnce(SetArgumentPointee<1>(kNewServiceId));
@@ -5475,11 +5579,16 @@ TEST_F(GLES2DecoderManualInitTest, EGLImageExternalBindTexture) {
}
TEST_F(GLES2DecoderManualInitTest, EGLImageExternalGetBinding) {
- InitState init;
- init.extensions = "GL_OES_EGL_image_external";
- init.gl_version = "opengl es 2.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_OES_EGL_image_external", // extensions
+ "opengl es 2.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId);
EXPECT_CALL(*gl_, GetError())
@@ -5504,11 +5613,16 @@ TEST_F(GLES2DecoderManualInitTest, EGLImageExternalGetBinding) {
}
TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureDefaults) {
- InitState init;
- init.extensions = "GL_OES_EGL_image_external";
- init.gl_version = "opengl es 2.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_OES_EGL_image_external", // extensions
+ "opengl es 2.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId);
TextureRef* texture_ref = GetTexture(client_texture_id_);
@@ -5521,11 +5635,17 @@ TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureDefaults) {
}
TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureParam) {
- InitState init;
- init.extensions = "GL_OES_EGL_image_external";
- init.gl_version = "opengl es 2.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_OES_EGL_image_external", // extensions
+ "opengl es 2.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
+
DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId);
EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_EXTERNAL_OES,
@@ -5575,11 +5695,17 @@ TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureParam) {
}
TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureParamInvalid) {
- InitState init;
- init.extensions = "GL_OES_EGL_image_external";
- init.gl_version = "opengl es 2.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_OES_EGL_image_external", // extensions
+ "opengl es 2.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
+
DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId);
TexParameteri cmd;
@@ -5611,11 +5737,16 @@ TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureParamInvalid) {
}
TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTexImage2DError) {
- InitState init;
- init.extensions = "GL_OES_EGL_image_external";
- init.gl_version = "opengl es 2.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_OES_EGL_image_external", // extensions
+ "opengl es 2.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
GLenum target = GL_TEXTURE_EXTERNAL_OES;
GLint level = 0;
@@ -5637,9 +5768,16 @@ TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTexImage2DError) {
}
TEST_F(GLES2DecoderManualInitTest, BindGeneratesResourceFalse) {
- InitState init;
- init.gl_version = "3.0";
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ false); // bind generates resource
BindTexture cmd1;
cmd1.Init(GL_TEXTURE_2D, kInvalidClientId);
@@ -5663,11 +5801,16 @@ TEST_F(GLES2DecoderManualInitTest, BindGeneratesResourceFalse) {
}
TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleBindTexture) {
- InitState init;
- init.extensions = "GL_ARB_texture_rectangle";
- init.gl_version = "3.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_ARB_texture_rectangle", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_RECTANGLE_ARB, kNewServiceId));
EXPECT_CALL(*gl_, GenTextures(1, _))
.WillOnce(SetArgumentPointee<1>(kNewServiceId));
@@ -5681,11 +5824,16 @@ TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleBindTexture) {
}
TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleGetBinding) {
- InitState init;
- init.extensions = "GL_ARB_texture_rectangle";
- init.gl_version = "3.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_ARB_texture_rectangle", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
DoBindTexture(
GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId);
@@ -5711,11 +5859,16 @@ TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleGetBinding) {
}
TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTextureDefaults) {
- InitState init;
- init.extensions = "GL_ARB_texture_rectangle";
- init.gl_version = "3.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_ARB_texture_rectangle", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
DoBindTexture(
GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId);
@@ -5728,11 +5881,16 @@ TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTextureDefaults) {
}
TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTextureParam) {
- InitState init;
- init.extensions = "GL_ARB_texture_rectangle";
- init.gl_version = "3.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_ARB_texture_rectangle", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
DoBindTexture(
GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId);
@@ -5783,11 +5941,16 @@ TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTextureParam) {
}
TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTextureParamInvalid) {
- InitState init;
- init.extensions = "GL_ARB_texture_rectangle";
- init.gl_version = "3.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_ARB_texture_rectangle", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
DoBindTexture(
GL_TEXTURE_RECTANGLE_ARB, client_texture_id_, kServiceTextureId);
@@ -5820,11 +5983,16 @@ TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTextureParamInvalid) {
}
TEST_F(GLES2DecoderManualInitTest, ARBTextureRectangleTexImage2DError) {
- InitState init;
- init.extensions = "GL_ARB_texture_rectangle";
- init.gl_version = "3.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_ARB_texture_rectangle", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
GLenum target = GL_TEXTURE_RECTANGLE_ARB;
GLint level = 0;
@@ -5919,10 +6087,17 @@ TEST_F(
command_line.AppendSwitchASCII(
switches::kGpuDriverBugWorkarounds,
base::IntToString(gpu::TEXSUBIMAGE2D_FASTER_THAN_TEXIMAGE2D));
- InitState init;
- init.gl_version = "3.0";
- init.bind_generates_resource = true;
- InitDecoderWithCommandLine(init, &command_line);
+ InitDecoderWithCommandLine(
+ "", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true, // bind generates resource
+ &command_line);
DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 2, 2, 0, GL_RGBA, GL_UNSIGNED_BYTE,
0, 0);
@@ -6204,11 +6379,16 @@ TEST_F(GLES2DecoderTest, CopyTexSubImage2DClearsUnclearedTexture) {
}
TEST_F(GLES2DecoderManualInitTest, CompressedImage2DMarksTextureAsCleared) {
- InitState init;
- init.extensions = "GL_EXT_texture_compression_s3tc";
- init.gl_version = "3.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_EXT_texture_compression_s3tc", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
EXPECT_CALL(*gl_, GetError())
@@ -6339,11 +6519,16 @@ TEST_F(GLES2DecoderWithShaderTest, UnClearedAttachmentsGetClearedOnReadPixels) {
TEST_F(GLES2DecoderManualInitTest,
UnClearedAttachmentsGetClearedOnReadPixelsAndDrawBufferGetsRestored) {
- InitState init;
- init.extensions = "GL_EXT_framebuffer_multisample";
- init.gl_version = "2.1";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_EXT_framebuffer_multisample", // extensions
+ "2.1", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
const GLuint kFBOClientTextureId = 4100;
const GLuint kFBOServiceTextureId = 4101;
@@ -6789,13 +6974,16 @@ TEST_F(GLES2DecoderTest, BeginQueryEXTDisabled) {
}
TEST_F(GLES2DecoderManualInitTest, BeginEndQueryEXT) {
- InitState init;
- init.extensions = "GL_EXT_occlusion_query_boolean";
- init.gl_version = "opengl es 2.0";
- init.has_alpha = true;
- init.request_alpha = true;
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_EXT_occlusion_query_boolean", // extensions
+ "opengl es 2.0", // gl version
+ true, // has alpha
+ false, // has depth
+ false, // has stencil
+ true, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
// Test end fails if no begin.
EndQueryEXT end_cmd;
@@ -6878,13 +7066,16 @@ static void CheckBeginEndQueryBadMemoryFails(
uint32 shm_offset) {
// We need to reset the decoder on each iteration, because we lose the
// context every time.
- GLES2DecoderTestBase::InitState init;
- init.extensions = "GL_EXT_occlusion_query_boolean";
- init.gl_version = "opengl es 2.0";
- init.has_alpha = true;
- init.request_alpha = true;
- init.bind_generates_resource = true;
- test->InitDecoder(init);
+ test->InitDecoder(
+ "GL_EXT_occlusion_query_boolean", // extensions
+ "opengl es 2.0", // gl version
+ true, // has alpha
+ false, // has depth
+ false, // has stencil
+ true, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
::testing::StrictMock< ::gfx::MockGLInterface>* gl = test->GetGLMock();
BeginQueryEXT begin_cmd;
@@ -7150,15 +7341,16 @@ TEST_F(GLES2DecoderTest, IsEnabledReturnsCachedValue) {
}
TEST_F(GLES2DecoderManualInitTest, DepthTextureBadArgs) {
- InitState init;
- init.extensions = "GL_ANGLE_depth_texture";
- init.gl_version = "opengl es 2.0";
- init.has_depth = true;
- init.has_stencil = true;
- init.request_depth = true;
- init.request_stencil = true;
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_ANGLE_depth_texture", // extensions
+ "opengl es 2.0", // gl version
+ false, // has alpha
+ true, // has depth
+ true, // has stencil
+ false, // request alpha
+ true, // request depth
+ true, // request stencil
+ true); // bind generates resource
DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
// Check trying to upload data fails.
@@ -7202,15 +7394,16 @@ TEST_F(GLES2DecoderManualInitTest, DepthTextureBadArgs) {
}
TEST_F(GLES2DecoderManualInitTest, GenerateMipmapDepthTexture) {
- InitState init;
- init.extensions = "GL_ANGLE_depth_texture";
- init.gl_version = "opengl es 2.0";
- init.has_depth = true;
- init.has_stencil = true;
- init.request_depth = true;
- init.request_stencil = true;
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_ANGLE_depth_texture", // extensions
+ "opengl es 2.0", // gl version
+ false, // has alpha
+ true, // has depth
+ true, // has stencil
+ false, // request alpha
+ true, // request depth
+ true, // request stencil
+ true); // bind generates resource
DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
DoTexImage2D(GL_TEXTURE_2D, 0, GL_DEPTH_COMPONENT,
2, 2, 0, GL_DEPTH_COMPONENT, GL_UNSIGNED_INT,
@@ -7222,15 +7415,16 @@ TEST_F(GLES2DecoderManualInitTest, GenerateMipmapDepthTexture) {
}
TEST_F(GLES2DecoderManualInitTest, DrawClearsDepthTexture) {
- InitState init;
- init.extensions = "GL_ANGLE_depth_texture";
- init.gl_version = "opengl es 2.0";
- init.has_alpha = true;
- init.has_depth = true;
- init.request_alpha = true;
- init.request_depth = true;
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_ANGLE_depth_texture", // extensions
+ "opengl es 2.0", // gl version
+ true, // has alpha
+ true, // has depth
+ false, // has stencil
+ true, // request alpha
+ true, // request depth
+ false, // request stencil
+ true); // bind generates resource
SetupDefaultProgram();
SetupAllNeededVertexBuffers();
@@ -7353,11 +7547,16 @@ class GLES2DecoderVertexArraysOESTest : public GLES2DecoderWithShaderTest {
bool vertex_array_deleted_manually_;
virtual void SetUp() {
- InitState init;
- init.extensions = "GL_OES_vertex_array_object";
- init.gl_version = "opengl es 2.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_OES_vertex_array_object", // extensions
+ "opengl es 2.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
SetupDefaultProgram();
AddExpectationsForGenVertexArraysOES();
@@ -7499,10 +7698,16 @@ class GLES2DecoderEmulatedVertexArraysOESTest
GLES2DecoderEmulatedVertexArraysOESTest() { }
virtual void SetUp() {
- InitState init;
- init.gl_version = "3.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
SetupDefaultProgram();
AddExpectationsForGenVertexArraysOES();
@@ -7880,15 +8085,16 @@ TEST_F(GLES2DecoderWithShaderTest, UseTexImage) {
}
TEST_F(GLES2DecoderManualInitTest, DrawWithGLImageExternal) {
- InitState init;
- init.extensions = "GL_OES_EGL_image_external";
- init.gl_version = "opengl es 2.0";
- init.has_alpha = true;
- init.has_depth = true;
- init.request_alpha = true;
- init.request_depth = true;
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_OES_EGL_image_external", // extensions
+ "opengl es 2.0", // gl version
+ true, // has alpha
+ true, // has depth
+ false, // has stencil
+ true, // request alpha
+ true, // request depth
+ false, // request stencil
+ true); // bind generates resource
TextureRef* texture_ref = GetTexture(client_texture_id_);
scoped_refptr<MockGLImage> image(new MockGLImage);
@@ -7954,11 +8160,16 @@ TEST_F(GLES2DecoderManualInitTest, DrawWithGLImageExternal) {
}
TEST_F(GLES2DecoderManualInitTest, GpuMemoryManagerCHROMIUM) {
- InitState init;
- init.extensions = "GL_ARB_texture_rectangle";
- init.gl_version = "3.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_ARB_texture_rectangle", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
Texture* texture = GetTexture(client_texture_id_)->texture();
EXPECT_TRUE(texture != NULL);
@@ -7990,11 +8201,12 @@ TEST_F(GLES2DecoderManualInitTest, GpuMemoryManagerCHROMIUM) {
}
TEST_F(GLES2DecoderManualInitTest, AsyncPixelTransfers) {
- InitState init;
- init.extensions = "GL_CHROMIUM_async_pixel_transfers";
- init.gl_version = "3.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_CHROMIUM_async_pixel_transfers", // extensions
+ "3.0", // gl version
+ false, false, false, // has alpha/depth/stencil
+ false, false, false, // request alpha/depth/stencil
+ true); // bind generates resource
// Set up the texture.
DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
@@ -8227,11 +8439,12 @@ TEST_F(GLES2DecoderManualInitTest, AsyncPixelTransfers) {
}
TEST_F(GLES2DecoderManualInitTest, AsyncPixelTransferManager) {
- InitState init;
- init.extensions = "GL_CHROMIUM_async_pixel_transfers";
- init.gl_version = "3.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_CHROMIUM_async_pixel_transfers", // extensions
+ "3.0", // gl version
+ false, false, false, // has alpha/depth/stencil
+ false, false, false, // request alpha/depth/stencil
+ true); // bind generates resource
// Set up the texture.
DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
@@ -8331,10 +8544,16 @@ TEST_F(GLES2DecoderManualInitTest, MemoryTrackerInitialSize) {
scoped_refptr<SizeOnlyMemoryTracker> memory_tracker =
new SizeOnlyMemoryTracker();
set_memory_tracker(memory_tracker.get());
- InitState init;
- init.gl_version = "3.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
// Expect that initial size - size is 0.
EXPECT_EQ(0u, memory_tracker->GetPoolSize(MemoryTracker::kUnmanaged));
EXPECT_EQ(0u, memory_tracker->GetPoolSize(MemoryTracker::kManaged));
@@ -8344,10 +8563,16 @@ TEST_F(GLES2DecoderManualInitTest, MemoryTrackerTexImage2D) {
scoped_refptr<SizeOnlyMemoryTracker> memory_tracker =
new SizeOnlyMemoryTracker();
set_memory_tracker(memory_tracker.get());
- InitState init;
- init.gl_version = "3.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
EXPECT_CALL(*memory_tracker.get(), EnsureGPUMemoryAvailable(128))
.WillOnce(Return(true)).RetiresOnSaturation();
@@ -8375,10 +8600,16 @@ TEST_F(GLES2DecoderManualInitTest, MemoryTrackerTexStorage2DEXT) {
scoped_refptr<SizeOnlyMemoryTracker> memory_tracker =
new SizeOnlyMemoryTracker();
set_memory_tracker(memory_tracker.get());
- InitState init;
- init.gl_version = "3.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
// Check we get out of memory and no call to glTexStorage2DEXT
// if Ensure fails.
@@ -8401,12 +8632,16 @@ TEST_F(GLES2DecoderManualInitTest, MemoryTrackerCopyTexImage2D) {
scoped_refptr<SizeOnlyMemoryTracker> memory_tracker =
new SizeOnlyMemoryTracker();
set_memory_tracker(memory_tracker.get());
- InitState init;
- init.gl_version = "3.0";
- init.has_alpha = true;
- init.request_alpha = true;
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "3.0", // gl version
+ true, // has alpha
+ false, // has depth
+ false, // has stencil
+ true, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
EXPECT_CALL(*memory_tracker.get(), EnsureGPUMemoryAvailable(128))
.WillOnce(Return(true)).RetiresOnSaturation();
@@ -8435,10 +8670,16 @@ TEST_F(GLES2DecoderManualInitTest, MemoryTrackerRenderbufferStorage) {
scoped_refptr<SizeOnlyMemoryTracker> memory_tracker =
new SizeOnlyMemoryTracker();
set_memory_tracker(memory_tracker.get());
- InitState init;
- init.gl_version = "3.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_,
kServiceRenderbufferId);
EXPECT_CALL(*gl_, GetError())
@@ -8469,10 +8710,16 @@ TEST_F(GLES2DecoderManualInitTest, MemoryTrackerBufferData) {
scoped_refptr<SizeOnlyMemoryTracker> memory_tracker =
new SizeOnlyMemoryTracker();
set_memory_tracker(memory_tracker.get());
- InitState init;
- init.gl_version = "3.0";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
DoBindBuffer(GL_ARRAY_BUFFER, client_buffer_id_,
kServiceBufferId);
EXPECT_CALL(*gl_, GetError())
@@ -8554,9 +8801,15 @@ TEST_F(GLES2DecoderTest, DrawBuffersEXTImmediateBackbuffer) {
}
TEST_F(GLES2DecoderManualInitTest, InvalidateFramebufferBinding) {
- InitState init;
- init.gl_version = "opengl es 3.0";
- InitDecoder(init);
+ InitDecoder("", // extensions
+ "opengl es 3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ false); // bind generates resource
// EXPECT_EQ can't be used to compare function pointers
EXPECT_TRUE(
@@ -8568,10 +8821,15 @@ TEST_F(GLES2DecoderManualInitTest, InvalidateFramebufferBinding) {
}
TEST_F(GLES2DecoderManualInitTest, DiscardFramebufferEXT) {
- InitState init;
- init.extensions = "GL_EXT_discard_framebuffer";
- init.gl_version = "opengl es 2.0";
- InitDecoder(init);
+ InitDecoder("GL_EXT_discard_framebuffer", // extensions
+ "opengl es 2.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ false); // bind generates resource
// EXPECT_EQ can't be used to compare function pointers
EXPECT_TRUE(
@@ -8625,9 +8883,16 @@ TEST_F(GLES2DecoderTest, DiscardFramebufferEXTUnsupported) {
}
TEST_F(GLES2DecoderRestoreStateTest, NullPreviousState) {
- InitState init;
- init.gl_version = "3.0";
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ false); // bind generates resource
SetupTexture();
InSequence sequence;
@@ -8653,14 +8918,21 @@ TEST_F(GLES2DecoderRestoreStateTest, NullPreviousState) {
}
TEST_F(GLES2DecoderRestoreStateTest, WithPreviousState) {
- InitState init;
- init.gl_version = "3.0";
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ false); // bind generates resource
SetupTexture();
// Construct a previous ContextState with all texture bindings
// set to default textures.
- ContextState prev_state(NULL, NULL, NULL);
+ ContextState prev_state(NULL, NULL);
InitializeContextState(&prev_state, std::numeric_limits<uint32>::max(), 0);
InSequence sequence;
@@ -8677,9 +8949,16 @@ TEST_F(GLES2DecoderRestoreStateTest, WithPreviousState) {
}
TEST_F(GLES2DecoderRestoreStateTest, ActiveUnit1) {
- InitState init;
- init.gl_version = "3.0";
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ false); // bind generates resource
// Bind a non-default texture to GL_TEXTURE1 unit.
EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE1));
@@ -8691,7 +8970,7 @@ TEST_F(GLES2DecoderRestoreStateTest, ActiveUnit1) {
// Construct a previous ContextState with all texture bindings
// set to default textures.
- ContextState prev_state(NULL, NULL, NULL);
+ ContextState prev_state(NULL, NULL);
InitializeContextState(&prev_state, std::numeric_limits<uint32>::max(), 0);
InSequence sequence;
@@ -8708,9 +8987,16 @@ TEST_F(GLES2DecoderRestoreStateTest, ActiveUnit1) {
}
TEST_F(GLES2DecoderRestoreStateTest, NonDefaultUnit0) {
- InitState init;
- init.gl_version = "3.0";
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ false); // bind generates resource
// Bind a non-default texture to GL_TEXTURE1 unit.
EXPECT_CALL(*gl_, ActiveTexture(GL_TEXTURE1));
@@ -8724,7 +9010,7 @@ TEST_F(GLES2DecoderRestoreStateTest, NonDefaultUnit0) {
// Construct a previous ContextState with GL_TEXTURE_2D target in
// GL_TEXTURE0 unit bound to a non-default texture and the rest
// set to default textures.
- ContextState prev_state(NULL, NULL, NULL);
+ ContextState prev_state(NULL, NULL);
InitializeContextState(&prev_state, 0, kServiceTextureId);
InSequence sequence;
@@ -8746,9 +9032,16 @@ TEST_F(GLES2DecoderRestoreStateTest, NonDefaultUnit0) {
}
TEST_F(GLES2DecoderRestoreStateTest, NonDefaultUnit1) {
- InitState init;
- init.gl_version = "3.0";
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ false); // bind generates resource
// Bind a non-default texture to GL_TEXTURE0 unit.
SetupTexture();
@@ -8756,7 +9049,7 @@ TEST_F(GLES2DecoderRestoreStateTest, NonDefaultUnit1) {
// Construct a previous ContextState with GL_TEXTURE_2D target in
// GL_TEXTURE1 unit bound to a non-default texture and the rest
// set to default textures.
- ContextState prev_state(NULL, NULL, NULL);
+ ContextState prev_state(NULL, NULL);
InitializeContextState(&prev_state, 1, kServiceTextureId);
InSequence sequence;
@@ -8782,12 +9075,17 @@ TEST_F(GLES2DecoderManualInitTest, ClearUniformsBeforeFirstProgramUse) {
command_line.AppendSwitchASCII(
switches::kGpuDriverBugWorkarounds,
base::IntToString(gpu::CLEAR_UNIFORMS_BEFORE_FIRST_PROGRAM_USE));
- InitState init;
- init.gl_version = "3.0";
- init.has_alpha = true;
- init.request_alpha = true;
- init.bind_generates_resource = true;
- InitDecoderWithCommandLine(init, &command_line);
+ InitDecoderWithCommandLine(
+ "", // extensions
+ "3.0", // gl version
+ true, // has alpha
+ false, // has depth
+ false, // has stencil
+ true, // request alpha
+ false, // request depth
+ false, // request stencil
+ true, // bind generates resource
+ &command_line);
{
static AttribInfo attribs[] = {
{ kAttrib1Name, kAttrib1Size, kAttrib1Type, kAttrib1Location, },
@@ -8824,10 +9122,15 @@ TEST_F(GLES2DecoderManualInitTest, ClearUniformsBeforeFirstProgramUse) {
}
TEST_F(GLES2DecoderManualInitTest, TexImage2DFloatOnGLES2) {
- InitState init;
- init.extensions = "GL_OES_texture_float";
- init.gl_version = "opengl es 2.0";
- InitDecoder(init);
+ InitDecoder("GL_OES_texture_float", // extensions
+ "opengl es 2.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ false); // bind generates resource
DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 17, 0, GL_RGBA, GL_FLOAT, 0, 0);
DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 16, 17, 0, GL_RGB, GL_FLOAT, 0, 0);
@@ -8840,10 +9143,15 @@ TEST_F(GLES2DecoderManualInitTest, TexImage2DFloatOnGLES2) {
}
TEST_F(GLES2DecoderManualInitTest, TexImage2DFloatOnGLES3) {
- InitState init;
- init.extensions = "GL_OES_texture_float GL_EXT_color_buffer_float";
- init.gl_version = "opengl es 3.0";
- InitDecoder(init);
+ InitDecoder("GL_OES_texture_float GL_EXT_color_buffer_float", // extensions
+ "opengl es 3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ false); // bind generates resource
DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 16, 17, 0, GL_RGBA, GL_FLOAT, 0, 0);
DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 16, 17, 0, GL_RGB, GL_FLOAT, 0, 0);
@@ -8858,10 +9166,15 @@ TEST_F(GLES2DecoderManualInitTest, TexImage2DFloatOnGLES3) {
}
TEST_F(GLES2DecoderManualInitTest, TexSubImage2DFloatOnGLES3) {
- InitState init;
- init.extensions = "GL_OES_texture_float GL_EXT_color_buffer_float";
- init.gl_version = "opengl es 3.0";
- InitDecoder(init);
+ InitDecoder("GL_OES_texture_float GL_EXT_color_buffer_float", // extensions
+ "opengl es 3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ false); // bind generates resource
const int kWidth = 8;
const int kHeight = 4;
DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
@@ -8881,10 +9194,15 @@ TEST_F(GLES2DecoderManualInitTest, TexSubImage2DFloatOnGLES3) {
}
TEST_F(GLES2DecoderManualInitTest, TexSubImage2DFloatDoesClearOnGLES3) {
- InitState init;
- init.extensions = "GL_OES_texture_float GL_EXT_color_buffer_float";
- init.gl_version = "opengl es 3.0";
- InitDecoder(init);
+ InitDecoder("GL_OES_texture_float GL_EXT_color_buffer_float", // extensions
+ "opengl es 3.0", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ false); // bind generates resource
const int kWidth = 8;
const int kHeight = 4;
DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
@@ -8907,10 +9225,15 @@ TEST_F(GLES2DecoderManualInitTest, TexSubImage2DFloatDoesClearOnGLES3) {
}
TEST_F(GLES2DecoderManualInitTest, TexImage2DFloatConvertsFormatDesktop) {
- InitState init;
- init.extensions = "GL_ARB_texture_float";
- init.gl_version = "2.1";
- InitDecoder(init);
+ InitDecoder("GL_ARB_texture_float", // extensions
+ "2.1", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ false); // bind generates resource
DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
DoTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA32F, 16, 17, 0, GL_RGBA, GL_FLOAT, 0,
0);
@@ -8930,11 +9253,16 @@ TEST_F(GLES2DecoderManualInitTest, TexImage2DFloatConvertsFormatDesktop) {
}
TEST_F(GLES2DecoderManualInitTest, ReadFormatExtension) {
- InitState init;
- init.extensions = "GL_OES_read_format";
- init.gl_version = "2.1";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "GL_OES_read_format", // extensions
+ "2.1", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
EXPECT_CALL(*gl_, GetError())
.WillOnce(Return(GL_NO_ERROR))
@@ -8992,10 +9320,16 @@ TEST_F(GLES2DecoderManualInitTest, ReadFormatExtension) {
}
TEST_F(GLES2DecoderManualInitTest, NoReadFormatExtension) {
- InitState init;
- init.gl_version = "2.1";
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "2.1", // gl version
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false, // request stencil
+ true); // bind generates resource
EXPECT_CALL(*gl_, GetError())
.WillOnce(Return(GL_NO_ERROR))
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
index c582019..1acdf35 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc
@@ -14,6 +14,7 @@
#include "gpu/command_buffer/common/gles2_cmd_utils.h"
#include "gpu/command_buffer/service/cmd_buffer_engine.h"
#include "gpu/command_buffer/service/context_group.h"
+#include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h"
#include "gpu/command_buffer/service/logger.h"
#include "gpu/command_buffer/service/program_manager.h"
#include "gpu/command_buffer/service/test_helper.h"
@@ -60,14 +61,16 @@ GLES2DecoderTestBase::GLES2DecoderTestBase()
GLES2DecoderTestBase::~GLES2DecoderTestBase() {}
void GLES2DecoderTestBase::SetUp() {
- InitState init;
- init.gl_version = "3.0";
- init.has_alpha = true;
- init.has_depth = true;
- init.request_alpha = true;
- init.request_depth = true;
- init.bind_generates_resource = true;
- InitDecoder(init);
+ InitDecoder(
+ "", // extensions
+ "3.0", // gl version
+ true, // has alpha
+ true, // has depth
+ false, // has stencil
+ true, // request alpha
+ true, // request depth
+ false, // request stencil
+ true); // bind generates resource
}
void GLES2DecoderTestBase::AddExpectationsForVertexAttribManager() {
@@ -78,22 +81,38 @@ void GLES2DecoderTestBase::AddExpectationsForVertexAttribManager() {
}
}
-GLES2DecoderTestBase::InitState::InitState()
- : has_alpha(false),
- has_depth(false),
- has_stencil(false),
- request_alpha(false),
- request_depth(false),
- request_stencil(false),
- bind_generates_resource(false),
- lose_context_when_out_of_memory(false) {}
-
-void GLES2DecoderTestBase::InitDecoder(const InitState& init) {
- InitDecoderWithCommandLine(init, NULL);
+void GLES2DecoderTestBase::InitDecoder(
+ const char* extensions,
+ const char* gl_version,
+ bool has_alpha,
+ bool has_depth,
+ bool has_stencil,
+ bool request_alpha,
+ bool request_depth,
+ bool request_stencil,
+ bool bind_generates_resource) {
+ InitDecoderWithCommandLine(extensions,
+ gl_version,
+ has_alpha,
+ has_depth,
+ has_stencil,
+ request_alpha,
+ request_depth,
+ request_stencil,
+ bind_generates_resource,
+ NULL);
}
void GLES2DecoderTestBase::InitDecoderWithCommandLine(
- const InitState& init,
+ const char* extensions,
+ const char* gl_version,
+ bool has_alpha,
+ bool has_depth,
+ bool has_stencil,
+ bool request_alpha,
+ bool request_depth,
+ bool request_stencil,
+ bool bind_generates_resource,
const base::CommandLine* command_line) {
Framebuffer::ClearFramebufferCompleteComboMap();
@@ -105,16 +124,16 @@ void GLES2DecoderTestBase::InitDecoderWithCommandLine(
// Only create stream texture manager if extension is requested.
std::vector<std::string> list;
- base::SplitString(init.extensions, ' ', &list);
+ base::SplitString(std::string(extensions), ' ', &list);
scoped_refptr<FeatureInfo> feature_info;
if (command_line)
feature_info = new FeatureInfo(*command_line);
- group_ = scoped_refptr<ContextGroup>(
- new ContextGroup(NULL,
- NULL,
- memory_tracker_,
- feature_info.get(),
- init.bind_generates_resource));
+ group_ = scoped_refptr<ContextGroup>(new ContextGroup(
+ NULL,
+ NULL,
+ memory_tracker_,
+ feature_info.get(),
+ bind_generates_resource));
InSequence sequence;
@@ -125,16 +144,14 @@ void GLES2DecoderTestBase::InitDecoderWithCommandLine(
// in turn initialize FeatureInfo, which needs a context to determine
// extension support.
context_ = new gfx::GLContextStubWithExtensions;
- context_->AddExtensionsString(init.extensions.c_str());
- context_->SetGLVersionString(init.gl_version.c_str());
+ context_->AddExtensionsString(extensions);
+ context_->SetGLVersionString(gl_version);
context_->MakeCurrent(surface_.get());
gfx::GLSurface::InitializeDynamicMockBindingsForTests(context_);
TestHelper::SetupContextGroupInitExpectations(gl_.get(),
- DisallowedFeatures(),
- init.extensions.c_str(),
- init.gl_version.c_str());
+ DisallowedFeatures(), extensions, gl_version);
// We initialize the ContextGroup with a MockGLES2Decoder so that
// we can use the ContextGroup to figure out how the real GLES2Decoder
@@ -211,14 +228,14 @@ void GLES2DecoderTestBase::InitDecoderWithCommandLine(
.Times(1)
.RetiresOnSaturation();
EXPECT_CALL(*gl_, GetIntegerv(GL_ALPHA_BITS, _))
- .WillOnce(SetArgumentPointee<1>(init.has_alpha ? 8 : 0))
- .RetiresOnSaturation();
+ .WillOnce(SetArgumentPointee<1>(has_alpha ? 8 : 0))
+ .RetiresOnSaturation();
EXPECT_CALL(*gl_, GetIntegerv(GL_DEPTH_BITS, _))
- .WillOnce(SetArgumentPointee<1>(init.has_depth ? 24 : 0))
- .RetiresOnSaturation();
+ .WillOnce(SetArgumentPointee<1>(has_depth ? 24 : 0))
+ .RetiresOnSaturation();
EXPECT_CALL(*gl_, GetIntegerv(GL_STENCIL_BITS, _))
- .WillOnce(SetArgumentPointee<1>(init.has_stencil ? 8 : 0))
- .RetiresOnSaturation();
+ .WillOnce(SetArgumentPointee<1>(has_stencil ? 8 : 0))
+ .RetiresOnSaturation();
EXPECT_CALL(*gl_, Enable(GL_VERTEX_PROGRAM_POINT_SIZE))
.Times(1)
@@ -275,16 +292,11 @@ void GLES2DecoderTestBase::InitDecoderWithCommandLine(
shared_memory_id_ = kSharedMemoryId;
shared_memory_base_ = buffer->memory();
- static const int32 kLoseContextWhenOutOfMemory = 0x10003;
-
- int32 attributes[] = {EGL_ALPHA_SIZE,
- init.request_alpha ? 8 : 0,
- EGL_DEPTH_SIZE,
- init.request_depth ? 24 : 0,
- EGL_STENCIL_SIZE,
- init.request_stencil ? 8 : 0,
- kLoseContextWhenOutOfMemory,
- init.lose_context_when_out_of_memory ? 1 : 0, };
+ int32 attributes[] = {
+ EGL_ALPHA_SIZE, request_alpha ? 8 : 0,
+ EGL_DEPTH_SIZE, request_depth ? 24 : 0,
+ EGL_STENCIL_SIZE, request_stencil ? 8 : 0,
+ };
std::vector<int32> attribs(attributes, attributes + arraysize(attributes));
decoder_.reset(GLES2Decoder::Create(group_.get()));
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h
index 24a960e..5ceb445 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h
@@ -12,7 +12,6 @@
#include "gpu/command_buffer/service/context_group.h"
#include "gpu/command_buffer/service/framebuffer_manager.h"
#include "gpu/command_buffer/service/gles2_cmd_decoder.h"
-#include "gpu/command_buffer/service/gles2_cmd_decoder_mock.h"
#include "gpu/command_buffer/service/program_manager.h"
#include "gpu/command_buffer/service/query_manager.h"
#include "gpu/command_buffer/service/renderbuffer_manager.h"
@@ -151,24 +150,28 @@ class GLES2DecoderTestBase : public testing::Test {
memory_tracker_ = memory_tracker;
}
- struct InitState {
- InitState();
-
- std::string extensions;
- std::string gl_version;
- bool has_alpha;
- bool has_depth;
- bool has_stencil;
- bool request_alpha;
- bool request_depth;
- bool request_stencil;
- bool bind_generates_resource;
- bool lose_context_when_out_of_memory;
- };
-
- void InitDecoder(const InitState& init);
- void InitDecoderWithCommandLine(const InitState& init,
- const base::CommandLine* command_line);
+ void InitDecoder(
+ const char* extensions,
+ const char* gl_version,
+ bool has_alpha,
+ bool has_depth,
+ bool has_stencil,
+ bool request_alpha,
+ bool request_depth,
+ bool request_stencil,
+ bool bind_generates_resource);
+
+ void InitDecoderWithCommandLine(
+ const char* extensions,
+ const char* gl_version,
+ bool has_alpha,
+ bool has_depth,
+ bool has_stencil,
+ bool request_alpha,
+ bool request_depth,
+ bool request_stencil,
+ bool bind_generates_resource,
+ const base::CommandLine* command_line);
void ResetDecoder();
@@ -486,7 +489,7 @@ class GLES2DecoderTestBase : public testing::Test {
scoped_ptr< ::testing::StrictMock< ::gfx::MockGLInterface> > gl_;
scoped_refptr<gfx::GLSurfaceStub> surface_;
scoped_refptr<gfx::GLContextStubWithExtensions> context_;
- scoped_ptr<MockGLES2Decoder> mock_decoder_;
+ scoped_ptr<GLES2Decoder> mock_decoder_;
scoped_ptr<GLES2Decoder> decoder_;
MemoryTracker* memory_tracker_;
diff --git a/gpu/command_buffer/tests/gl_manager.cc b/gpu/command_buffer/tests/gl_manager.cc
index dc30f45..e8d6452 100644
--- a/gpu/command_buffer/tests/gl_manager.cc
+++ b/gpu/command_buffer/tests/gl_manager.cc
@@ -39,9 +39,9 @@ GLManager::Options::Options()
share_mailbox_manager(NULL),
virtual_manager(NULL),
bind_generates_resource(false),
- lose_context_when_out_of_memory(false),
context_lost_allowed(false),
- image_manager(NULL) {}
+ image_manager(NULL) {
+}
GLManager::GLManager()
: context_lost_allowed_(false) {
@@ -189,13 +189,12 @@ void GLManager::Initialize(const GLManager::Options& options) {
transfer_buffer_.reset(new TransferBuffer(gles2_helper_.get()));
// Create the object exposing the OpenGL API.
- gles2_implementation_.reset(
- new gles2::GLES2Implementation(gles2_helper_.get(),
- client_share_group,
- transfer_buffer_.get(),
- options.bind_generates_resource,
- options.lose_context_when_out_of_memory,
- gpu_control_.get()));
+ gles2_implementation_.reset(new gles2::GLES2Implementation(
+ gles2_helper_.get(),
+ client_share_group,
+ transfer_buffer_.get(),
+ options.bind_generates_resource,
+ gpu_control_.get()));
ASSERT_TRUE(gles2_implementation_->Initialize(
kStartTransferBufferSize,
diff --git a/gpu/command_buffer/tests/gl_manager.h b/gpu/command_buffer/tests/gl_manager.h
index 6eb5909..8a811fd 100644
--- a/gpu/command_buffer/tests/gl_manager.h
+++ b/gpu/command_buffer/tests/gl_manager.h
@@ -53,8 +53,6 @@ class GLManager {
GLManager* virtual_manager;
// Whether or not glBindXXX generates a resource.
bool bind_generates_resource;
- // Whether or not the context is auto-lost when GL_OUT_OF_MEMORY occurs.
- bool lose_context_when_out_of_memory;
// Whether or not it's ok to lose the context.
bool context_lost_allowed;
// Image manager to be used.