diff options
author | vmiura@chromium.org <vmiura@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-03 23:00:50 +0000 |
---|---|---|
committer | vmiura@chromium.org <vmiura@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-04-03 23:00:50 +0000 |
commit | 6eda682dba27bd393c3da8a1609336bdf665b3f5 (patch) | |
tree | 87beeb8b1e64bac4697ce95d613bc2832d372378 /content | |
parent | 686c2a5545271c9b985a0a02ea1cc71a112c09c1 (diff) | |
download | chromium_src-6eda682dba27bd393c3da8a1609336bdf665b3f5.zip chromium_src-6eda682dba27bd393c3da8a1609336bdf665b3f5.tar.gz chromium_src-6eda682dba27bd393c3da8a1609336bdf665b3f5.tar.bz2 |
Pass GL context bind_generates_resources flag to GPU Service.
GPU Client has been respecting the bind_generates_resources attrib,
however the GPU Service has been forcing it to always 'true'. This
means glBind semantic validation has been incorrect when
bind_generates_resources is 'false' on the Client.
This patch passes the bind_generates_resources attrib for
WebGraphicsContext3DCommandBufferImpl, and checks that all contexts
in the same ContextGroup use the same setting.
BUG=333063, 244968
Review URL: https://codereview.chromium.org/213743003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@261563 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
8 files changed, 12 insertions, 16 deletions
diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc index 20966a1..3add5c6 100644 --- a/content/browser/compositor/gpu_process_transport_factory.cc +++ b/content/browser/compositor/gpu_process_transport_factory.cc @@ -445,7 +445,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; @@ -462,7 +461,6 @@ GpuProcessTransportFactory::CreateContextCommon(int surface_id) { url, gpu_channel_host.get(), attrs, - bind_generates_resources, lose_context_when_out_of_memory, 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..db02a7c 100644 --- a/content/browser/renderer_host/compositor_impl_android.cc +++ b/content/browser/renderer_host/compositor_impl_android.cc @@ -518,14 +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, 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..391ec9b 100644 --- a/content/browser/renderer_host/image_transport_factory_android.cc +++ b/content/browser/renderer_host/image_transport_factory_android.cc @@ -82,14 +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, limits, NULL)); diff --git a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc index 425990c..0ece341 100644 --- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc +++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc @@ -229,7 +229,6 @@ WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl( const GURL& active_url, GpuChannelHost* host, const Attributes& attributes, - bool bind_generates_resources, bool lose_context_when_out_of_memory, const SharedMemoryLimits& limits, WebGraphicsContext3DCommandBufferImpl* share_context) @@ -247,7 +246,6 @@ WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl( weak_ptr_factory_(this), 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) { @@ -354,6 +352,8 @@ bool WebGraphicsContext3DCommandBufferImpl::InitializeCommandBuffer( 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(BIND_GENERATES_RESOURCES); + attribs.push_back(0); attribs.push_back(NONE); // Create a proxy to a command buffer in the GPU process. @@ -428,11 +428,12 @@ bool WebGraphicsContext3DCommandBufferImpl::CreateContext(bool onscreen) { DCHECK(host_.get()); // Create the object exposing the OpenGL API. + bool bind_generates_resources = false; real_gl_.reset( new gpu::gles2::GLES2Implementation(gles2_helper_.get(), gles2_share_group, transfer_buffer_.get(), - bind_generates_resources_, + bind_generates_resources, lose_context_when_out_of_memory_, command_buffer_.get())); gl_ = real_gl_.get(); @@ -1206,13 +1207,11 @@ 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); diff --git a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h index dd65b76..a167c64 100644 --- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h +++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h @@ -123,7 +123,6 @@ class WebGraphicsContext3DCommandBufferImpl const GURL& active_url, GpuChannelHost* host, const Attributes& attributes, - bool bind_generates_resources, bool lose_context_when_out_of_memory, const SharedMemoryLimits& limits, WebGraphicsContext3DCommandBufferImpl* share_context); @@ -769,7 +768,6 @@ class WebGraphicsContext3DCommandBufferImpl scoped_ptr<gpu::gles2::GLES2Implementation> real_gl_; scoped_ptr<gpu::gles2::GLES2Interface> trace_gl_; Error last_error_; - bool bind_generates_resources_; bool lose_context_when_out_of_memory_; SharedMemoryLimits mem_limits_; diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc index ceb7acb..68e4733 100644 --- a/content/common/gpu/gpu_command_buffer_stub.cc +++ b/content/common/gpu/gpu_command_buffer_stub.cc @@ -140,8 +140,14 @@ GpuCommandBufferStub::GpuCommandBufferStub( total_gpu_memory_(0) { active_url_hash_ = base::Hash(active_url.possibly_invalid_spec()); FastSetActiveURL(active_url_, active_url_hash_); + + gpu::gles2::ContextCreationAttribHelper attrib_parser; + attrib_parser.Parse(requested_attribs_); + if (share_group) { context_group_ = share_group->context_group_; + DCHECK(context_group_->bind_generates_resource() == + attrib_parser.bind_generates_resource_); } else { context_group_ = new gpu::gles2::ContextGroup( mailbox_manager, @@ -149,7 +155,7 @@ GpuCommandBufferStub::GpuCommandBufferStub( new GpuCommandBufferMemoryTracker(channel), channel_->gpu_channel_manager()->shader_translator_cache(), NULL, - true); + attrib_parser.bind_generates_resource_); } use_virtualized_gl_context_ |= diff --git a/content/content_common.gypi b/content/content_common.gypi index 03e0014..6f4741a 100644 --- a/content/content_common.gypi +++ b/content/content_common.gypi @@ -6,6 +6,7 @@ 'dependencies': [ '../base/base.gyp:base', '../components/tracing.gyp:tracing', + '../gpu/command_buffer/command_buffer.gyp:gles2_utils', '../net/net.gyp:net', '../skia/skia.gyp:skia', '../third_party/WebKit/public/blink_headers.gyp:blink_headers', diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc index 5f0f7c7..04e49a3 100644 --- a/content/renderer/render_widget.cc +++ b/content/renderer/render_widget.cc @@ -2832,7 +2832,6 @@ RenderWidget::CreateGraphicsContext3D() { 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) @@ -2863,7 +2862,6 @@ RenderWidget::CreateGraphicsContext3D() { GetURLForGraphicsContext3D(), gpu_channel_host.get(), attributes, - bind_generates_resources, lose_context_when_out_of_memory, limits, NULL)); |