summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/browser/android/in_process/synchronous_compositor_factory_impl.cc8
-rw-r--r--content/browser/compositor/gpu_process_transport_factory.cc5
-rw-r--r--content/browser/gpu/gpu_ipc_browsertests.cc4
-rw-r--r--content/browser/renderer_host/compositor_impl_android.cc5
-rw-r--r--content/browser/renderer_host/image_transport_factory_android.cc5
-rw-r--r--content/common/gpu/client/context_provider_command_buffer_browsertest.cc2
-rw-r--r--content/common/gpu/client/gl_helper_unittest.cc3
-rw-r--r--content/common/gpu/client/gpu_in_process_context_tests.cc6
-rw-r--r--content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc35
-rw-r--r--content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h32
-rw-r--r--content/renderer/render_thread_impl.cc7
-rw-r--r--content/renderer/render_widget.cc56
-rw-r--r--content/renderer/render_widget.h3
-rw-r--r--content/renderer/renderer_webkitplatformsupport_impl.cc3
-rw-r--r--content/test/test_context_provider_factory.cc4
-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
-rw-r--r--gpu/gles2_conform_support/egl/display.cc16
-rw-r--r--mojo/examples/aura_demo/demo_context_factory.cc8
-rw-r--r--mojo/gles2/gles2_context.cc7
-rw-r--r--ppapi/shared_impl/ppb_graphics_3d_shared.cc2
-rw-r--r--ui/compositor/test/in_process_context_factory.cc11
-rw-r--r--webkit/common/gpu/context_provider_in_process.cc6
-rw-r--r--webkit/common/gpu/context_provider_in_process.h6
-rw-r--r--webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc29
-rw-r--r--webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h6
41 files changed, 1028 insertions, 853 deletions
diff --git a/content/browser/android/in_process/synchronous_compositor_factory_impl.cc b/content/browser/android/in_process/synchronous_compositor_factory_impl.cc
index b17aa6c..86d1619 100644
--- a/content/browser/android/in_process/synchronous_compositor_factory_impl.cc
+++ b/content/browser/android/in_process/synchronous_compositor_factory_impl.cc
@@ -44,10 +44,12 @@ scoped_ptr<gpu::GLInProcessContext> CreateContext(
gpu::GLInProcessContextAttribs in_process_attribs;
WebGraphicsContext3DInProcessCommandBufferImpl::ConvertAttributes(
GetDefaultAttribs(), &in_process_attribs);
- in_process_attribs.lose_context_when_out_of_memory = 1;
scoped_ptr<gpu::GLInProcessContext> context(
- gpu::GLInProcessContext::CreateWithSurface(
- surface, service, share_context, in_process_attribs, gpu_preference));
+ gpu::GLInProcessContext::CreateWithSurface(surface,
+ service,
+ share_context,
+ in_process_attribs,
+ gpu_preference));
return context.Pass();
}
diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc
index 79c1749..bc9f7ec 100644
--- a/content/browser/compositor/gpu_process_transport_factory.cc
+++ b/content/browser/compositor/gpu_process_transport_factory.cc
@@ -428,8 +428,6 @@ GpuProcessTransportFactory::CreateContextCommon(int surface_id) {
attrs.stencil = false;
attrs.antialias = false;
attrs.noAutomaticFlushes = true;
- bool bind_generates_resources = false;
- bool lose_context_when_out_of_memory = true;
CauseForGpuLaunch cause =
CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE;
scoped_refptr<GpuChannelHost> gpu_channel_host(
@@ -445,8 +443,7 @@ GpuProcessTransportFactory::CreateContextCommon(int surface_id) {
url,
gpu_channel_host.get(),
attrs,
- bind_generates_resources,
- lose_context_when_out_of_memory,
+ false,
WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(),
NULL));
return context.Pass();
diff --git a/content/browser/gpu/gpu_ipc_browsertests.cc b/content/browser/gpu/gpu_ipc_browsertests.cc
index cbe4539..ebeceff 100644
--- a/content/browser/gpu/gpu_ipc_browsertests.cc
+++ b/content/browser/gpu/gpu_ipc_browsertests.cc
@@ -35,14 +35,12 @@ class ContextTestBase : public content::ContentBrowserTest {
content::BrowserGpuChannelHostFactory* factory =
content::BrowserGpuChannelHostFactory::instance();
CHECK(factory);
- bool lose_context_when_out_of_memory = false;
scoped_refptr<content::GpuChannelHost> gpu_channel_host(
factory->EstablishGpuChannelSync(kInitCause));
context_.reset(
WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
gpu_channel_host.get(),
blink::WebGraphicsContext3D::Attributes(),
- lose_context_when_out_of_memory,
GURL(),
WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(),
NULL));
@@ -117,12 +115,10 @@ class BrowserGpuChannelHostFactoryTest : public ContentBrowserTest {
}
scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContext() {
- bool lose_context_when_out_of_memory = false;
return make_scoped_ptr(
WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
GetGpuChannel(),
blink::WebGraphicsContext3D::Attributes(),
- lose_context_when_out_of_memory,
GURL(),
WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(),
NULL));
diff --git a/content/browser/renderer_host/compositor_impl_android.cc b/content/browser/renderer_host/compositor_impl_android.cc
index b3ccbcc..6fd6a2a 100644
--- a/content/browser/renderer_host/compositor_impl_android.cc
+++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -518,15 +518,12 @@ CreateGpuProcessViewContext(
limits.max_transfer_buffer_size = std::min(
3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize);
limits.mapped_memory_reclaim_limit = 2 * 1024 * 1024;
- bool bind_generates_resource = false;
- bool lose_context_when_out_of_memory = true;
return make_scoped_ptr(
new WebGraphicsContext3DCommandBufferImpl(surface_id,
url,
gpu_channel_host.get(),
attributes,
- bind_generates_resource,
- lose_context_when_out_of_memory,
+ false,
limits,
NULL));
}
diff --git a/content/browser/renderer_host/image_transport_factory_android.cc b/content/browser/renderer_host/image_transport_factory_android.cc
index f622f0a..7080ddc 100644
--- a/content/browser/renderer_host/image_transport_factory_android.cc
+++ b/content/browser/renderer_host/image_transport_factory_android.cc
@@ -82,15 +82,12 @@ CmdBufferImageTransportFactory::CmdBufferImageTransportFactory() {
3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize);
limits.mapped_memory_reclaim_limit =
WebGraphicsContext3DCommandBufferImpl::kNoLimit;
- bool bind_generates_resource = false;
- bool lose_context_when_out_of_memory = false;
context_.reset(
new WebGraphicsContext3DCommandBufferImpl(0, // offscreen
url,
gpu_channel_host.get(),
attrs,
- bind_generates_resource,
- lose_context_when_out_of_memory,
+ false,
limits,
NULL));
context_->setContextLostCallback(context_lost_listener_.get());
diff --git a/content/common/gpu/client/context_provider_command_buffer_browsertest.cc b/content/common/gpu/client/context_provider_command_buffer_browsertest.cc
index 7588571..d6378ad 100644
--- a/content/common/gpu/client/context_provider_command_buffer_browsertest.cc
+++ b/content/common/gpu/client/context_provider_command_buffer_browsertest.cc
@@ -30,7 +30,6 @@ class ContextProviderCommandBufferBrowserTest : public ContentBrowserTest {
}
scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateContext3d() {
- bool lose_context_when_out_of_memory = false;
scoped_refptr<GpuChannelHost> gpu_channel_host(
GetFactory()->EstablishGpuChannelSync(
CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE));
@@ -38,7 +37,6 @@ class ContextProviderCommandBufferBrowserTest : public ContentBrowserTest {
WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
gpu_channel_host.get(),
blink::WebGraphicsContext3D::Attributes(),
- lose_context_when_out_of_memory,
GURL("chrome://gpu/ContextProviderCommandBufferTest"),
WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(),
NULL));
diff --git a/content/common/gpu/client/gl_helper_unittest.cc b/content/common/gpu/client/gl_helper_unittest.cc
index 38b45ce..028777b 100644
--- a/content/common/gpu/client/gl_helper_unittest.cc
+++ b/content/common/gpu/client/gl_helper_unittest.cc
@@ -60,10 +60,9 @@ class GLHelperTest : public testing::Test {
protected:
virtual void SetUp() {
WebGraphicsContext3D::Attributes attributes;
- bool lose_context_when_out_of_memory = false;
context_ =
WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext(
- attributes, lose_context_when_out_of_memory);
+ attributes);
context_->makeContextCurrent();
context_support_ = context_->GetContextSupport();
helper_.reset(
diff --git a/content/common/gpu/client/gpu_in_process_context_tests.cc b/content/common/gpu/client/gpu_in_process_context_tests.cc
index 8288237..7be7890 100644
--- a/content/common/gpu/client/gpu_in_process_context_tests.cc
+++ b/content/common/gpu/client/gpu_in_process_context_tests.cc
@@ -20,10 +20,8 @@ class ContextTestBase : public testing::Test {
public:
virtual void SetUp() {
blink::WebGraphicsContext3D::Attributes attributes;
- bool lose_context_when_out_of_memory = false;
- typedef WebGraphicsContext3DInProcessCommandBufferImpl WGC3DIPCBI;
- context_ = WGC3DIPCBI::CreateOffscreenContext(
- attributes, lose_context_when_out_of_memory);
+ context_ = WebGraphicsContext3DInProcessCommandBufferImpl::
+ CreateOffscreenContext(attributes);
context_->makeContextCurrent();
context_support_ = context_->GetContextSupport();
}
diff --git a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
index 425990c..4b91c42 100644
--- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
+++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
@@ -230,7 +230,6 @@ WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl(
GpuChannelHost* host,
const Attributes& attributes,
bool bind_generates_resources,
- bool lose_context_when_out_of_memory,
const SharedMemoryLimits& limits,
WebGraphicsContext3DCommandBufferImpl* share_context)
: initialize_failed_(false),
@@ -248,7 +247,6 @@ WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl(
initialized_(false),
gl_(NULL),
bind_generates_resources_(bind_generates_resources),
- lose_context_when_out_of_memory_(lose_context_when_out_of_memory),
mem_limits_(limits),
flush_id_(0) {
if (share_context) {
@@ -352,8 +350,6 @@ bool WebGraphicsContext3DCommandBufferImpl::InitializeCommandBuffer(
attribs.push_back(attributes_.antialias ? 1 : 0);
attribs.push_back(FAIL_IF_MAJOR_PERF_CAVEAT);
attribs.push_back(attributes_.failIfMajorPerformanceCaveat ? 1 : 0);
- attribs.push_back(LOSE_CONTEXT_WHEN_OUT_OF_MEMORY);
- attribs.push_back(lose_context_when_out_of_memory_ ? 1 : 0);
attribs.push_back(NONE);
// Create a proxy to a command buffer in the GPU process.
@@ -428,13 +424,12 @@ bool WebGraphicsContext3DCommandBufferImpl::CreateContext(bool onscreen) {
DCHECK(host_.get());
// Create the object exposing the OpenGL API.
- real_gl_.reset(
- new gpu::gles2::GLES2Implementation(gles2_helper_.get(),
- gles2_share_group,
- transfer_buffer_.get(),
- bind_generates_resources_,
- lose_context_when_out_of_memory_,
- command_buffer_.get()));
+ real_gl_.reset(new gpu::gles2::GLES2Implementation(
+ gles2_helper_.get(),
+ gles2_share_group,
+ transfer_buffer_.get(),
+ bind_generates_resources_,
+ command_buffer_.get()));
gl_ = real_gl_.get();
if (!real_gl_->Initialize(
@@ -1196,7 +1191,6 @@ WebGraphicsContext3DCommandBufferImpl*
WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
GpuChannelHost* host,
const WebGraphicsContext3D::Attributes& attributes,
- bool lose_context_when_out_of_memory,
const GURL& active_url,
const SharedMemoryLimits& limits,
WebGraphicsContext3DCommandBufferImpl* share_context) {
@@ -1206,16 +1200,13 @@ WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
if (share_context && share_context->IsCommandBufferContextLost())
return NULL;
- bool bind_generates_resources = false;
- return new WebGraphicsContext3DCommandBufferImpl(
- 0,
- active_url,
- host,
- attributes,
- bind_generates_resources,
- lose_context_when_out_of_memory,
- limits,
- share_context);
+ return new WebGraphicsContext3DCommandBufferImpl(0,
+ active_url,
+ host,
+ attributes,
+ false,
+ limits,
+ share_context);
}
DELEGATE_TO_GL_5(texImageIOSurface2DCHROMIUM, TexImageIOSurface2DCHROMIUM,
diff --git a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h
index dd65b76..2ff411b 100644
--- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h
+++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h
@@ -124,7 +124,6 @@ class WebGraphicsContext3DCommandBufferImpl
GpuChannelHost* host,
const Attributes& attributes,
bool bind_generates_resources,
- bool lose_context_when_out_of_memory,
const SharedMemoryLimits& limits,
WebGraphicsContext3DCommandBufferImpl* share_context);
@@ -150,7 +149,6 @@ class WebGraphicsContext3DCommandBufferImpl
CreateOffscreenContext(
GpuChannelHost* host,
const WebGraphicsContext3D::Attributes& attributes,
- bool lose_context_when_out_of_memory,
const GURL& active_url,
const SharedMemoryLimits& limits,
WebGraphicsContext3DCommandBufferImpl* share_context);
@@ -689,21 +687,20 @@ class WebGraphicsContext3DCommandBufferImpl
// gpu/command_buffer/common/gles2_cmd_utils.cc and to
// gpu/command_buffer/client/gl_in_process_context.cc
enum Attribute {
- ALPHA_SIZE = 0x3021,
- BLUE_SIZE = 0x3022,
- GREEN_SIZE = 0x3023,
- RED_SIZE = 0x3024,
- DEPTH_SIZE = 0x3025,
- STENCIL_SIZE = 0x3026,
- SAMPLES = 0x3031,
- SAMPLE_BUFFERS = 0x3032,
- HEIGHT = 0x3056,
- WIDTH = 0x3057,
- NONE = 0x3038, // Attrib list = terminator
- SHARE_RESOURCES = 0x10000,
- BIND_GENERATES_RESOURCES = 0x10001,
- FAIL_IF_MAJOR_PERF_CAVEAT = 0x10002,
- LOSE_CONTEXT_WHEN_OUT_OF_MEMORY = 0x10003,
+ ALPHA_SIZE = 0x3021,
+ BLUE_SIZE = 0x3022,
+ GREEN_SIZE = 0x3023,
+ RED_SIZE = 0x3024,
+ DEPTH_SIZE = 0x3025,
+ STENCIL_SIZE = 0x3026,
+ SAMPLES = 0x3031,
+ SAMPLE_BUFFERS = 0x3032,
+ HEIGHT = 0x3056,
+ WIDTH = 0x3057,
+ NONE = 0x3038, // Attrib list = terminator
+ SHARE_RESOURCES = 0x10000,
+ BIND_GENERATES_RESOURCES = 0x10001,
+ FAIL_IF_MAJOR_PERF_CAVEAT = 0x10002
};
friend class WebGraphicsContext3DErrorMessageCallback;
@@ -770,7 +767,6 @@ class WebGraphicsContext3DCommandBufferImpl
scoped_ptr<gpu::gles2::GLES2Interface> trace_gl_;
Error last_error_;
bool bind_generates_resources_;
- bool lose_context_when_out_of_memory_;
SharedMemoryLimits mem_limits_;
uint32_t flush_id_;
diff --git a/content/renderer/render_thread_impl.cc b/content/renderer/render_thread_impl.cc
index 3a94dcb..8ddb89b 100644
--- a/content/renderer/render_thread_impl.cc
+++ b/content/renderer/render_thread_impl.cc
@@ -984,14 +984,11 @@ RenderThreadImpl::GetGpuFactories() {
gpu_channel_host = EstablishGpuChannelSync(
CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE);
}
- blink::WebGraphicsContext3D::Attributes attributes;
- bool lose_context_when_out_of_memory = false;
gpu_va_context_provider_ = ContextProviderCommandBuffer::Create(
make_scoped_ptr(
WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
gpu_channel_host.get(),
- attributes,
- lose_context_when_out_of_memory,
+ blink::WebGraphicsContext3D::Attributes(),
GURL("chrome://gpu/RenderThreadImpl::GetGpuVDAContext3D"),
WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(),
NULL)),
@@ -1013,7 +1010,6 @@ RenderThreadImpl::CreateOffscreenContext3d() {
attributes.stencil = false;
attributes.antialias = false;
attributes.noAutomaticFlushes = true;
- bool lose_context_when_out_of_memory = true;
scoped_refptr<GpuChannelHost> gpu_channel_host(EstablishGpuChannelSync(
CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE));
@@ -1021,7 +1017,6 @@ RenderThreadImpl::CreateOffscreenContext3d() {
WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
gpu_channel_host.get(),
attributes,
- lose_context_when_out_of_memory,
GURL("chrome://gpu/RenderThreadImpl::CreateOffscreenContext3d"),
WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(),
NULL));
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 4cdae04..21f19c2 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -919,8 +919,25 @@ scoped_ptr<cc::OutputSurface> RenderWidget::CreateOutputSurface(bool fallback) {
scoped_refptr<ContextProviderCommandBuffer> context_provider;
if (!use_software) {
+ // Explicitly disable antialiasing for the compositor. As of the time of
+ // this writing, the only platform that supported antialiasing for the
+ // compositor was Mac OS X, because the on-screen OpenGL context creation
+ // code paths on Windows and Linux didn't yet have multisampling support.
+ // Mac OS X essentially always behaves as though it's rendering offscreen.
+ // Multisampling has a heavy cost especially on devices with relatively low
+ // fill rate like most notebooks, and the Mac implementation would need to
+ // be optimized to resolve directly into the IOSurface shared between the
+ // GPU and browser processes. For these reasons and to avoid platform
+ // disparities we explicitly disable antialiasing.
+ blink::WebGraphicsContext3D::Attributes attributes;
+ attributes.antialias = false;
+ attributes.shareResources = true;
+ attributes.noAutomaticFlushes = true;
+ attributes.depth = false;
+ attributes.stencil = false;
context_provider = ContextProviderCommandBuffer::Create(
- CreateGraphicsContext3D(), "RenderCompositor");
+ CreateGraphicsContext3D(attributes),
+ "RenderCompositor");
if (!context_provider.get()) {
// Cause the compositor to wait and try again.
return scoped_ptr<cc::OutputSurface>();
@@ -2825,7 +2842,8 @@ bool RenderWidget::HasTouchEventHandlersAt(const gfx::Point& point) const {
}
scoped_ptr<WebGraphicsContext3DCommandBufferImpl>
-RenderWidget::CreateGraphicsContext3D() {
+RenderWidget::CreateGraphicsContext3D(
+ const blink::WebGraphicsContext3D::Attributes& attributes) {
if (!webwidget_)
return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>();
if (CommandLine::ForCurrentProcess()->HasSwitch(
@@ -2840,24 +2858,6 @@ RenderWidget::CreateGraphicsContext3D() {
if (!gpu_channel_host)
return scoped_ptr<WebGraphicsContext3DCommandBufferImpl>();
- // Explicitly disable antialiasing for the compositor. As of the time of
- // this writing, the only platform that supported antialiasing for the
- // compositor was Mac OS X, because the on-screen OpenGL context creation
- // code paths on Windows and Linux didn't yet have multisampling support.
- // Mac OS X essentially always behaves as though it's rendering offscreen.
- // Multisampling has a heavy cost especially on devices with relatively low
- // fill rate like most notebooks, and the Mac implementation would need to
- // be optimized to resolve directly into the IOSurface shared between the
- // GPU and browser processes. For these reasons and to avoid platform
- // disparities we explicitly disable antialiasing.
- blink::WebGraphicsContext3D::Attributes attributes;
- attributes.antialias = false;
- attributes.shareResources = true;
- attributes.noAutomaticFlushes = true;
- attributes.depth = false;
- attributes.stencil = false;
- bool bind_generates_resources = false;
- bool lose_context_when_out_of_memory = true;
WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits;
#if defined(OS_ANDROID)
// If we raster too fast we become upload bound, and pending
@@ -2883,14 +2883,14 @@ RenderWidget::CreateGraphicsContext3D() {
#endif
scoped_ptr<WebGraphicsContext3DCommandBufferImpl> context(
- new WebGraphicsContext3DCommandBufferImpl(surface_id(),
- GetURLForGraphicsContext3D(),
- gpu_channel_host.get(),
- attributes,
- bind_generates_resources,
- lose_context_when_out_of_memory,
- limits,
- NULL));
+ new WebGraphicsContext3DCommandBufferImpl(
+ surface_id(),
+ GetURLForGraphicsContext3D(),
+ gpu_channel_host.get(),
+ attributes,
+ false /* bind generates resources */,
+ limits,
+ NULL));
return context.Pass();
}
diff --git a/content/renderer/render_widget.h b/content/renderer/render_widget.h
index 25d929f..b43cfe5 100644
--- a/content/renderer/render_widget.h
+++ b/content/renderer/render_widget.h
@@ -530,7 +530,8 @@ class CONTENT_EXPORT RenderWidget
#endif
// Creates a 3D context associated with this view.
- scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateGraphicsContext3D();
+ scoped_ptr<WebGraphicsContext3DCommandBufferImpl> CreateGraphicsContext3D(
+ const blink::WebGraphicsContext3D::Attributes& attributes);
bool OnSnapshotHelper(const gfx::Rect& src_subrect, SkBitmap* bitmap);
diff --git a/content/renderer/renderer_webkitplatformsupport_impl.cc b/content/renderer/renderer_webkitplatformsupport_impl.cc
index 2bd6fca..1a067f6 100644
--- a/content/renderer/renderer_webkitplatformsupport_impl.cc
+++ b/content/renderer/renderer_webkitplatformsupport_impl.cc
@@ -1005,11 +1005,10 @@ RendererWebKitPlatformSupportImpl::createOffscreenGraphicsContext3D(
limits.command_buffer_size = buffer_size_kb * 1024;
}
}
- bool lose_context_when_out_of_memory = false;
+
return WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
gpu_channel_host.get(),
attributes,
- lose_context_when_out_of_memory,
GURL(attributes.topDocumentURL),
limits,
static_cast<WebGraphicsContext3DCommandBufferImpl*>(share_context));
diff --git a/content/test/test_context_provider_factory.cc b/content/test/test_context_provider_factory.cc
index 33ba614..96ce738e 100644
--- a/content/test/test_context_provider_factory.cc
+++ b/content/test/test_context_provider_factory.cc
@@ -26,9 +26,7 @@ TestContextProviderFactory::~TestContextProviderFactory() {}
scoped_refptr<cc::ContextProvider> TestContextProviderFactory::
OffscreenContextProviderForMainThread() {
if (!main_thread_.get() || main_thread_->DestroyedOnMainThread()) {
- bool lose_context_when_out_of_memory = false;
- main_thread_ = webkit::gpu::ContextProviderInProcess::CreateOffscreen(
- lose_context_when_out_of_memory);
+ main_thread_ = webkit::gpu::ContextProviderInProcess::CreateOffscreen();
if (main_thread_.get() && !main_thread_->BindToCurrentThread())
main_thread_ = NULL;
}
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.
diff --git a/gpu/gles2_conform_support/egl/display.cc b/gpu/gles2_conform_support/egl/display.cc
index 8b43dff..9885cd6 100644
--- a/gpu/gles2_conform_support/egl/display.cc
+++ b/gpu/gles2_conform_support/egl/display.cc
@@ -229,15 +229,13 @@ EGLContext Display::CreateContext(EGLConfig config,
DCHECK(transfer_buffer_.get());
bool bind_generates_resources = true;
- bool lose_context_when_out_of_memory = false;
-
- context_.reset(
- new gpu::gles2::GLES2Implementation(gles2_cmd_helper_.get(),
- NULL,
- transfer_buffer_.get(),
- bind_generates_resources,
- lose_context_when_out_of_memory,
- gpu_control_.get()));
+
+ context_.reset(new gpu::gles2::GLES2Implementation(
+ gles2_cmd_helper_.get(),
+ NULL,
+ transfer_buffer_.get(),
+ bind_generates_resources,
+ gpu_control_.get()));
if (!context_->Initialize(
kTransferBufferSize,
diff --git a/mojo/examples/aura_demo/demo_context_factory.cc b/mojo/examples/aura_demo/demo_context_factory.cc
index 4040208..e9312ad 100644
--- a/mojo/examples/aura_demo/demo_context_factory.cc
+++ b/mojo/examples/aura_demo/demo_context_factory.cc
@@ -56,10 +56,8 @@ DemoContextFactory::OffscreenCompositorContextProvider() {
// to leak the context provider when we shutdown to avoid destroying the
// contexts on the wrong thread.
DCHECK(!ui::Compositor::WasInitializedWithThread());
- bool lose_context_when_out_of_memory = true;
offscreen_compositor_contexts_ =
- webkit::gpu::ContextProviderInProcess::CreateOffscreen(
- lose_context_when_out_of_memory);
+ webkit::gpu::ContextProviderInProcess::CreateOffscreen();
}
return offscreen_compositor_contexts_;
}
@@ -68,10 +66,8 @@ scoped_refptr<cc::ContextProvider>
DemoContextFactory::SharedMainThreadContextProvider() {
if (!shared_main_thread_contexts_ ||
shared_main_thread_contexts_->DestroyedOnMainThread()) {
- bool lose_context_when_out_of_memory = false;
shared_main_thread_contexts_ =
- webkit::gpu::ContextProviderInProcess::CreateOffscreen(
- lose_context_when_out_of_memory);
+ webkit::gpu::ContextProviderInProcess::CreateOffscreen();
if (shared_main_thread_contexts_ &&
!shared_main_thread_contexts_->BindToCurrentThread())
shared_main_thread_contexts_ = NULL;
diff --git a/mojo/gles2/gles2_context.cc b/mojo/gles2/gles2_context.cc
index 306ffeb..6d4106d 100644
--- a/mojo/gles2/gles2_context.cc
+++ b/mojo/gles2/gles2_context.cc
@@ -40,16 +40,11 @@ bool GLES2Context::Initialize() {
return false;
gles2_helper_->SetAutomaticFlushes(false);
transfer_buffer_.reset(new gpu::TransferBuffer(gles2_helper_.get()));
- bool bind_generates_resource = true;
- // TODO(piman): Some contexts (such as compositor) want this to be true, so
- // this needs to be a public parameter.
- bool lose_context_when_out_of_memory = false;
implementation_.reset(
new gpu::gles2::GLES2Implementation(gles2_helper_.get(),
NULL,
transfer_buffer_.get(),
- bind_generates_resource,
- lose_context_when_out_of_memory,
+ true,
&command_buffer_));
return implementation_->Initialize(kDefaultStartTransferBufferSize,
kDefaultMinTransferBufferSize,
diff --git a/ppapi/shared_impl/ppb_graphics_3d_shared.cc b/ppapi/shared_impl/ppb_graphics_3d_shared.cc
index 1b3677b1..b4e258b 100644
--- a/ppapi/shared_impl/ppb_graphics_3d_shared.cc
+++ b/ppapi/shared_impl/ppb_graphics_3d_shared.cc
@@ -118,7 +118,6 @@ bool PPB_Graphics3D_Shared::CreateGLES2Impl(
transfer_buffer_.reset(new gpu::TransferBuffer(gles2_helper_.get()));
const bool bind_creates_resources = true;
- const bool lose_context_when_out_of_memory = false;
// Create the object exposing the OpenGL API.
gles2_impl_.reset(new gpu::gles2::GLES2Implementation(
@@ -126,7 +125,6 @@ bool PPB_Graphics3D_Shared::CreateGLES2Impl(
share_gles2 ? share_gles2->share_group() : NULL,
transfer_buffer_.get(),
bind_creates_resources,
- lose_context_when_out_of_memory,
GetGpuControl()));
if (!gles2_impl_->Initialize(
diff --git a/ui/compositor/test/in_process_context_factory.cc b/ui/compositor/test/in_process_context_factory.cc
index e49ea51..ce83286 100644
--- a/ui/compositor/test/in_process_context_factory.cc
+++ b/ui/compositor/test/in_process_context_factory.cc
@@ -29,12 +29,11 @@ scoped_ptr<cc::OutputSurface> InProcessContextFactory::CreateOutputSurface(
attrs.stencil = false;
attrs.antialias = false;
attrs.shareResources = true;
- bool lose_context_when_out_of_memory = true;
using webkit::gpu::WebGraphicsContext3DInProcessCommandBufferImpl;
scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d(
WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext(
- attrs, lose_context_when_out_of_memory, compositor->widget()));
+ attrs, compositor->widget()));
CHECK(context3d);
using webkit::gpu::ContextProviderInProcess;
@@ -57,10 +56,8 @@ scoped_refptr<cc::ContextProvider>
InProcessContextFactory::OffscreenCompositorContextProvider() {
if (!offscreen_compositor_contexts_.get() ||
!offscreen_compositor_contexts_->DestroyedOnMainThread()) {
- bool lose_context_when_out_of_memory = true;
offscreen_compositor_contexts_ =
- webkit::gpu::ContextProviderInProcess::CreateOffscreen(
- lose_context_when_out_of_memory);
+ webkit::gpu::ContextProviderInProcess::CreateOffscreen();
}
return offscreen_compositor_contexts_;
}
@@ -72,10 +69,8 @@ InProcessContextFactory::SharedMainThreadContextProvider() {
return shared_main_thread_contexts_;
if (ui::Compositor::WasInitializedWithThread()) {
- bool lose_context_when_out_of_memory = false;
shared_main_thread_contexts_ =
- webkit::gpu::ContextProviderInProcess::CreateOffscreen(
- lose_context_when_out_of_memory);
+ webkit::gpu::ContextProviderInProcess::CreateOffscreen();
} else {
shared_main_thread_contexts_ =
static_cast<webkit::gpu::ContextProviderInProcess*>(
diff --git a/webkit/common/gpu/context_provider_in_process.cc b/webkit/common/gpu/context_provider_in_process.cc
index e9d2558..6f1be9c 100644
--- a/webkit/common/gpu/context_provider_in_process.cc
+++ b/webkit/common/gpu/context_provider_in_process.cc
@@ -48,8 +48,7 @@ scoped_refptr<ContextProviderInProcess> ContextProviderInProcess::Create(
// static
scoped_refptr<ContextProviderInProcess>
-ContextProviderInProcess::CreateOffscreen(
- bool lose_context_when_out_of_memory) {
+ContextProviderInProcess::CreateOffscreen() {
blink::WebGraphicsContext3D::Attributes attributes;
attributes.depth = false;
attributes.stencil = true;
@@ -59,8 +58,7 @@ ContextProviderInProcess::CreateOffscreen(
return Create(
WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext(
- attributes, lose_context_when_out_of_memory),
- "Offscreen");
+ attributes), "Offscreen");
}
ContextProviderInProcess::ContextProviderInProcess(
diff --git a/webkit/common/gpu/context_provider_in_process.h b/webkit/common/gpu/context_provider_in_process.h
index c42585f..fc1d15c 100644
--- a/webkit/common/gpu/context_provider_in_process.h
+++ b/webkit/common/gpu/context_provider_in_process.h
@@ -26,9 +26,9 @@ class WEBKIT_GPU_EXPORT ContextProviderInProcess
scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl> context3d,
const std::string& debug_name);
- // Uses default attributes for creating an offscreen context.
- static scoped_refptr<ContextProviderInProcess> CreateOffscreen(
- bool lose_context_when_out_of_memory);
+ // Calls Create() with a default factory method for creating an offscreen
+ // context.
+ static scoped_refptr<ContextProviderInProcess> CreateOffscreen();
virtual blink::WebGraphicsContext3D* WebContext3D() OVERRIDE;
diff --git a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc b/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
index 992bcb4..3c6d608 100644
--- a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
+++ b/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.cc
@@ -73,29 +73,20 @@ static base::LazyInstance<GLES2Initializer> g_gles2_initializer =
scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
WebGraphicsContext3DInProcessCommandBufferImpl::CreateViewContext(
const blink::WebGraphicsContext3D::Attributes& attributes,
- bool lose_context_when_out_of_memory,
gfx::AcceleratedWidget window) {
DCHECK_NE(gfx::GetGLImplementation(), gfx::kGLImplementationNone);
- bool is_offscreen = false;
return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl(
- scoped_ptr< ::gpu::GLInProcessContext>(),
- attributes,
- lose_context_when_out_of_memory,
- is_offscreen,
- window));
+ scoped_ptr< ::gpu::GLInProcessContext>(), attributes, false, window));
}
// static
scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
WebGraphicsContext3DInProcessCommandBufferImpl::CreateOffscreenContext(
- const blink::WebGraphicsContext3D::Attributes& attributes,
- bool lose_context_when_out_of_memory) {
- bool is_offscreen = true;
+ const blink::WebGraphicsContext3D::Attributes& attributes) {
return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl(
scoped_ptr< ::gpu::GLInProcessContext>(),
attributes,
- lose_context_when_out_of_memory,
- is_offscreen,
+ true,
gfx::kNullAcceleratedWidget));
}
@@ -103,13 +94,10 @@ scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
WebGraphicsContext3DInProcessCommandBufferImpl::WrapContext(
scoped_ptr< ::gpu::GLInProcessContext> context,
const blink::WebGraphicsContext3D::Attributes& attributes) {
- bool lose_context_when_out_of_memory = false; // Not used.
- bool is_offscreen = true; // Not used.
return make_scoped_ptr(new WebGraphicsContext3DInProcessCommandBufferImpl(
context.Pass(),
attributes,
- lose_context_when_out_of_memory,
- is_offscreen,
+ true /* is_offscreen. Not used. */,
gfx::kNullAcceleratedWidget /* window. Not used. */));
}
@@ -117,7 +105,6 @@ WebGraphicsContext3DInProcessCommandBufferImpl::
WebGraphicsContext3DInProcessCommandBufferImpl(
scoped_ptr< ::gpu::GLInProcessContext> context,
const blink::WebGraphicsContext3D::Attributes& attributes,
- bool lose_context_when_out_of_memory,
bool is_offscreen,
gfx::AcceleratedWidget window)
: is_offscreen_(is_offscreen),
@@ -129,8 +116,8 @@ WebGraphicsContext3DInProcessCommandBufferImpl::
context_lost_callback_(NULL),
context_lost_reason_(GL_NO_ERROR),
attributes_(attributes),
- lose_context_when_out_of_memory_(lose_context_when_out_of_memory),
- flush_id_(0) {}
+ flush_id_(0) {
+}
WebGraphicsContext3DInProcessCommandBufferImpl::
~WebGraphicsContext3DInProcessCommandBufferImpl() {
@@ -168,9 +155,7 @@ bool WebGraphicsContext3DInProcessCommandBufferImpl::MaybeInitializeGL() {
gfx::GpuPreference gpu_preference = gfx::PreferDiscreteGpu;
::gpu::GLInProcessContextAttribs attrib_struct;
- ConvertAttributes(attributes_, &attrib_struct);
- attrib_struct.lose_context_when_out_of_memory =
- lose_context_when_out_of_memory_;
+ ConvertAttributes(attributes_, &attrib_struct),
context_.reset(GLInProcessContext::CreateContext(
is_offscreen_,
diff --git a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h b/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h
index 0e4348d..f278bb0 100644
--- a/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h
+++ b/webkit/common/gpu/webgraphicscontext3d_in_process_command_buffer_impl.h
@@ -52,13 +52,11 @@ class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl
static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
CreateViewContext(
const blink::WebGraphicsContext3D::Attributes& attributes,
- bool lose_context_when_out_of_memory,
gfx::AcceleratedWidget window);
static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
CreateOffscreenContext(
- const blink::WebGraphicsContext3D::Attributes& attributes,
- bool lose_context_when_out_of_memory);
+ const blink::WebGraphicsContext3D::Attributes& attributes);
static scoped_ptr<WebGraphicsContext3DInProcessCommandBufferImpl>
WrapContext(
@@ -573,7 +571,6 @@ class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl
WebGraphicsContext3DInProcessCommandBufferImpl(
scoped_ptr< ::gpu::GLInProcessContext> context,
const blink::WebGraphicsContext3D::Attributes& attributes,
- bool lose_context_when_out_of_memory,
bool is_offscreen,
gfx::AcceleratedWidget window);
@@ -601,7 +598,6 @@ class WEBKIT_GPU_EXPORT WebGraphicsContext3DInProcessCommandBufferImpl
WGC3Denum context_lost_reason_;
blink::WebGraphicsContext3D::Attributes attributes_;
- bool lose_context_when_out_of_memory_;
// Errors raised by synthesizeGLError().
std::vector<WGC3Denum> synthetic_errors_;