summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-05 19:01:49 +0000
committeroshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-05 19:01:49 +0000
commitd0e64a7b0edfa2329a14b23931b24ae5618f8552 (patch)
treebf232dcc3b15ba93ad2f89779471d81808555420
parent30ca75e25a30803e11bfa0673556dcb6731adeca (diff)
downloadchromium_src-d0e64a7b0edfa2329a14b23931b24ae5618f8552.zip
chromium_src-d0e64a7b0edfa2329a14b23931b24ae5618f8552.tar.gz
chromium_src-d0e64a7b0edfa2329a14b23931b24ae5618f8552.tar.bz2
ChromeOS only version of r261563
This is a fix for the crash in mirror mode. BUG=358345 TBR=oshima@chromium.org Review URL: https://codereview.chromium.org/267683008 git-svn-id: svn://svn.chromium.org/chrome/branches/1916/src@268236 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--content/browser/compositor/gpu_process_transport_factory.cc4
-rw-r--r--content/browser/renderer_host/compositor_impl_android.cc4
-rw-r--r--content/browser/renderer_host/image_transport_factory_android.cc4
-rw-r--r--content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc21
-rw-r--r--content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h4
-rw-r--r--content/common/gpu/gpu_command_buffer_stub.cc13
-rw-r--r--content/content_common.gypi4
-rw-r--r--content/renderer/render_widget.cc4
-rw-r--r--gpu/GLES2/gl2extchromium.h6
-rw-r--r--gpu/command_buffer/client/gles2_implementation.cc21
-rw-r--r--gpu/command_buffer/client/gles2_implementation.h3
-rw-r--r--gpu/command_buffer/client/gles2_implementation_unittest.cc94
-rw-r--r--gpu/command_buffer/common/gles2_cmd_utils.cc6
-rw-r--r--gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h7
-rw-r--r--gpu/command_buffer/service/gles2_cmd_decoder.cc8
-rw-r--r--gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h3
-rw-r--r--ui/gl/gl_bindings.h3
17 files changed, 204 insertions, 5 deletions
diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc
index 79c1749..1f0d79aa 100644
--- a/content/browser/compositor/gpu_process_transport_factory.cc
+++ b/content/browser/compositor/gpu_process_transport_factory.cc
@@ -428,7 +428,9 @@ GpuProcessTransportFactory::CreateContextCommon(int surface_id) {
attrs.stencil = false;
attrs.antialias = false;
attrs.noAutomaticFlushes = true;
+#if !defined(OS_CHROMEOS)
bool bind_generates_resources = false;
+#endif
bool lose_context_when_out_of_memory = true;
CauseForGpuLaunch cause =
CAUSE_FOR_GPU_LAUNCH_WEBGRAPHICSCONTEXT3DCOMMANDBUFFERIMPL_INITIALIZE;
@@ -445,7 +447,9 @@ GpuProcessTransportFactory::CreateContextCommon(int surface_id) {
url,
gpu_channel_host.get(),
attrs,
+#if !defined(OS_CHROMEOS)
bind_generates_resources,
+#endif
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 cc87443..6deaa5d 100644
--- a/content/browser/renderer_host/compositor_impl_android.cc
+++ b/content/browser/renderer_host/compositor_impl_android.cc
@@ -397,14 +397,18 @@ CreateGpuProcessViewContext(
limits.max_transfer_buffer_size = std::min(
3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize);
limits.mapped_memory_reclaim_limit = 2 * 1024 * 1024;
+#if !defined(OS_CHROMEOS)
bool bind_generates_resource = false;
+#endif
bool lose_context_when_out_of_memory = true;
return make_scoped_ptr(
new WebGraphicsContext3DCommandBufferImpl(surface_id,
url,
gpu_channel_host.get(),
attributes,
+#if !defined(OS_CHROMEOS)
bind_generates_resource,
+#endif
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..f9e3b03 100644
--- a/content/browser/renderer_host/image_transport_factory_android.cc
+++ b/content/browser/renderer_host/image_transport_factory_android.cc
@@ -82,14 +82,18 @@ CmdBufferImageTransportFactory::CmdBufferImageTransportFactory() {
3 * full_screen_texture_size_in_bytes, kDefaultMaxTransferBufferSize);
limits.mapped_memory_reclaim_limit =
WebGraphicsContext3DCommandBufferImpl::kNoLimit;
+#if !defined(OS_CHROMEOS)
bool bind_generates_resource = false;
+#endif
bool lose_context_when_out_of_memory = false;
context_.reset(
new WebGraphicsContext3DCommandBufferImpl(0, // offscreen
url,
gpu_channel_host.get(),
attrs,
+#if !defined(OS_CHROMEOS)
bind_generates_resource,
+#endif
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..1701b83 100644
--- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
+++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.cc
@@ -229,7 +229,9 @@ WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl(
const GURL& active_url,
GpuChannelHost* host,
const Attributes& attributes,
+#if !defined(OS_CHROMEOS)
bool bind_generates_resources,
+#endif
bool lose_context_when_out_of_memory,
const SharedMemoryLimits& limits,
WebGraphicsContext3DCommandBufferImpl* share_context)
@@ -247,7 +249,9 @@ WebGraphicsContext3DCommandBufferImpl::WebGraphicsContext3DCommandBufferImpl(
weak_ptr_factory_(this),
initialized_(false),
gl_(NULL),
+#if !defined(OS_CHROMEOS)
bind_generates_resources_(bind_generates_resources),
+#endif
lose_context_when_out_of_memory_(lose_context_when_out_of_memory),
mem_limits_(limits),
flush_id_(0) {
@@ -354,6 +358,10 @@ 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);
+#if defined(OS_CHROMEOS)
+ attribs.push_back(BIND_GENERATES_RESOURCES);
+ attribs.push_back(0);
+#endif
attribs.push_back(NONE);
// Create a proxy to a command buffer in the GPU process.
@@ -428,11 +436,19 @@ bool WebGraphicsContext3DCommandBufferImpl::CreateContext(bool onscreen) {
DCHECK(host_.get());
// Create the object exposing the OpenGL API.
+#if defined(OS_CHROMEOS)
+ bool bind_generates_resources = false;
+#endif
+
real_gl_.reset(
new gpu::gles2::GLES2Implementation(gles2_helper_.get(),
gles2_share_group,
transfer_buffer_.get(),
+#if defined(OS_CHROMEOS)
+ bind_generates_resources,
+#else
bind_generates_resources_,
+#endif
lose_context_when_out_of_memory_,
command_buffer_.get()));
gl_ = real_gl_.get();
@@ -1205,14 +1221,17 @@ WebGraphicsContext3DCommandBufferImpl::CreateOffscreenContext(
if (share_context && share_context->IsCommandBufferContextLost())
return NULL;
-
+#if !defined(OS_CHROMEOS)
bool bind_generates_resources = false;
+#endif
return new WebGraphicsContext3DCommandBufferImpl(
0,
active_url,
host,
attributes,
+#if !defined(OS_CHROMEOS)
bind_generates_resources,
+#endif
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..25a487e 100644
--- a/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h
+++ b/content/common/gpu/client/webgraphicscontext3d_command_buffer_impl.h
@@ -123,7 +123,9 @@ class WebGraphicsContext3DCommandBufferImpl
const GURL& active_url,
GpuChannelHost* host,
const Attributes& attributes,
+#if !defined(OS_CHROMEOS)
bool bind_generates_resources,
+#endif
bool lose_context_when_out_of_memory,
const SharedMemoryLimits& limits,
WebGraphicsContext3DCommandBufferImpl* share_context);
@@ -769,7 +771,9 @@ class WebGraphicsContext3DCommandBufferImpl
scoped_ptr<gpu::gles2::GLES2Implementation> real_gl_;
scoped_ptr<gpu::gles2::GLES2Interface> trace_gl_;
Error last_error_;
+#if !defined(OS_CHROMEOS)
bool bind_generates_resources_;
+#endif
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 ef6a45a..511da7b 100644
--- a/content/common/gpu/gpu_command_buffer_stub.cc
+++ b/content/common/gpu/gpu_command_buffer_stub.cc
@@ -139,15 +139,28 @@ GpuCommandBufferStub::GpuCommandBufferStub(
total_gpu_memory_(0) {
active_url_hash_ = base::Hash(active_url.possibly_invalid_spec());
FastSetActiveURL(active_url_, active_url_hash_);
+#if defined(OS_CHROMEOS)
+ gpu::gles2::ContextCreationAttribHelper attrib_parser;
+ attrib_parser.Parse(requested_attribs_);
+#endif
+
if (share_group) {
context_group_ = share_group->context_group_;
+#if defined(OS_CHROMEOS)
+ DCHECK(context_group_->bind_generates_resource() ==
+ attrib_parser.bind_generates_resource_);
+#endif
} else {
context_group_ = new gpu::gles2::ContextGroup(
mailbox_manager,
image_manager,
new GpuCommandBufferMemoryTracker(channel),
NULL,
+#if defined(OS_CHROMEOS)
+ attrib_parser.bind_generates_resource_);
+#else
true);
+#endif
}
use_virtualized_gl_context_ |=
diff --git a/content/content_common.gypi b/content/content_common.gypi
index 1d7089d..a28e37f 100644
--- a/content/content_common.gypi
+++ b/content/content_common.gypi
@@ -603,6 +603,7 @@
['target_arch=="arm" and chromeos == 1 and use_x11 == 1', {
'dependencies': [
'../media/media.gyp:media',
+ '../gpu/command_buffer/command_buffer.gyp:gles2_utils',
],
'sources': [
'common/gpu/media/exynos_v4l2_video_device.cc',
@@ -625,6 +626,9 @@
},
}],
['target_arch != "arm" and chromeos == 1 and use_x11 == 1', {
+ 'dependencies': [
+ '../gpu/command_buffer/command_buffer.gyp:gles2_utils',
+ ],
'sources': [
'common/gpu/media/h264_dpb.cc',
'common/gpu/media/h264_dpb.h',
diff --git a/content/renderer/render_widget.cc b/content/renderer/render_widget.cc
index 7fcaed3..e37b937 100644
--- a/content/renderer/render_widget.cc
+++ b/content/renderer/render_widget.cc
@@ -2852,7 +2852,9 @@ RenderWidget::CreateGraphicsContext3D() {
attributes.noAutomaticFlushes = true;
attributes.depth = false;
attributes.stencil = false;
+#if !defined(OS_CHROMEOS)
bool bind_generates_resources = false;
+#endif
bool lose_context_when_out_of_memory = true;
WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits limits;
#if defined(OS_ANDROID)
@@ -2883,7 +2885,9 @@ RenderWidget::CreateGraphicsContext3D() {
GetURLForGraphicsContext3D(),
gpu_channel_host.get(),
attributes,
+#if !defined(OS_CHROMEOS)
bind_generates_resources,
+#endif
lose_context_when_out_of_memory,
limits,
NULL));
diff --git a/gpu/GLES2/gl2extchromium.h b/gpu/GLES2/gl2extchromium.h
index 50a6247..301c5b3 100644
--- a/gpu/GLES2/gl2extchromium.h
+++ b/gpu/GLES2/gl2extchromium.h
@@ -351,6 +351,12 @@ typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERCHROMIUMPROC) (GLint srcX0, GLint
#endif
#endif /* GL_CHROMIUM_async_pixel_transfers */
+#if defined(OS_CHROMEOS)
+#ifndef GL_BIND_GENERATES_RESOURCE_CHROMIUM
+#define GL_BIND_GENERATES_RESOURCE_CHROMIUM 0x9244
+#endif
+#endif
+
/* GL_CHROMIUM_copy_texture */
#ifndef GL_CHROMIUM_copy_texture
#define GL_CHROMIUM_copy_texture 1
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 9d58f76..50a7436 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -66,8 +66,11 @@ GLES2Implementation::GLStaticState::IntState::IntState()
max_vertex_texture_image_units(0),
max_vertex_uniform_vectors(0),
num_compressed_texture_formats(0),
- num_shader_binary_formats(0) {
-}
+ num_shader_binary_formats(0)
+#if defined(OS_CHROMEOS)
+ , bind_generates_resource_chromium(0)
+#endif
+{}
GLES2Implementation::SingleThreadChecker::SingleThreadChecker(
GLES2Implementation* gles2_implementation)
@@ -188,6 +191,17 @@ bool GLES2Implementation::Initialize(
reserved_ids_[0],
reserved_ids_[1]));
+#if defined(OS_CHROMEOS)
+ // GL_BIND_GENERATES_RESOURCE_CHROMIUM state must be the same
+ // on Client & Service.
+ if (static_state_.int_state.bind_generates_resource_chromium !=
+ (share_group_->bind_generates_resource() ? 1 : 0)) {
+ SetGLError(GL_INVALID_OPERATION,
+ "Initialize",
+ "Service bind_generates_resource mismatch.");
+ return false;
+ }
+#endif
return true;
}
@@ -206,6 +220,9 @@ bool GLES2Implementation::QueryAndCacheStaticState() {
GL_MAX_VERTEX_UNIFORM_VECTORS,
GL_NUM_COMPRESSED_TEXTURE_FORMATS,
GL_NUM_SHADER_BINARY_FORMATS,
+#if defined(OS_CHROMEOS)
+ GL_BIND_GENERATES_RESOURCE_CHROMIUM,
+#endif
};
GetMultipleIntegervState integerv_state(
diff --git a/gpu/command_buffer/client/gles2_implementation.h b/gpu/command_buffer/client/gles2_implementation.h
index f7664fa..1edd9eb 100644
--- a/gpu/command_buffer/client/gles2_implementation.h
+++ b/gpu/command_buffer/client/gles2_implementation.h
@@ -148,6 +148,9 @@ class GLES2_IMPL_EXPORT GLES2Implementation
GLint max_vertex_uniform_vectors;
GLint num_compressed_texture_formats;
GLint num_shader_binary_formats;
+#if defined(OS_CHROMEOS)
+ GLint bind_generates_resource_chromium;
+#endif
};
IntState int_state;
diff --git a/gpu/command_buffer/client/gles2_implementation_unittest.cc b/gpu/command_buffer/client/gles2_implementation_unittest.cc
index f57d07a..ca151d4 100644
--- a/gpu/command_buffer/client/gles2_implementation_unittest.cc
+++ b/gpu/command_buffer/client/gles2_implementation_unittest.cc
@@ -392,11 +392,22 @@ class GLES2ImplementationTest : public testing::Test {
public:
TestContext() : commands_(NULL), token_(0) {}
+#if defined(OS_CHROMEOS)
+ bool Initialize(ShareGroup* share_group,
+ bool bind_generates_resource,
+ bool lose_context_when_out_of_memory) {
+#else
void Initialize(ShareGroup* share_group,
bool bind_generates_resource,
bool lose_context_when_out_of_memory) {
+#endif
command_buffer_.reset(new StrictMock<MockClientCommandBuffer>());
+#if defined(OS_CHROMEOS)
+ if (!command_buffer_->Initialize())
+ return false;
+#else
ASSERT_TRUE(command_buffer_->Initialize());
+#endif
transfer_buffer_.reset(
new MockTransferBuffer(command_buffer_.get(),
@@ -426,6 +437,10 @@ class GLES2ImplementationTest : public testing::Test {
int_state.max_vertex_uniform_vectors = kMaxVertexUniformVectors;
int_state.num_compressed_texture_formats = kNumCompressedTextureFormats;
int_state.num_shader_binary_formats = kNumShaderBinaryFormats;
+#if defined(OS_CHROMEOS)
+ int_state.bind_generates_resource_chromium =
+ bind_generates_resource ? 1 : 0;
+#endif
// This just happens to work for now because IntState has 1 GLint per
// state.
@@ -449,10 +464,18 @@ class GLES2ImplementationTest : public testing::Test {
bind_generates_resource,
lose_context_when_out_of_memory,
gpu_control_.get()));
+#if defined(OS_CHROMEOS)
+ if (!gl_->Initialize(kTransferBufferSize,
+ kTransferBufferSize,
+ kTransferBufferSize,
+ GLES2Implementation::kNoLimit))
+ return false;
+#else
ASSERT_TRUE(gl_->Initialize(kTransferBufferSize,
kTransferBufferSize,
kTransferBufferSize,
GLES2Implementation::kNoLimit));
+#endif
}
EXPECT_CALL(*command_buffer_, OnFlush()).Times(1).RetiresOnSaturation();
@@ -466,6 +489,9 @@ class GLES2ImplementationTest : public testing::Test {
EXPECT_TRUE(transfer_buffer_->InSync());
::testing::Mock::VerifyAndClearExpectations(command_buffer());
+#if defined(OS_CHROMEOS)
+ return true;
+#endif
}
void TearDown() {
@@ -518,6 +544,7 @@ class GLES2ImplementationTest : public testing::Test {
return gl_->query_tracker_->GetQuery(id);
}
+#if !defined(OS_CHROMEOS)
void Initialize(bool bind_generates_resource,
bool lose_context_when_out_of_memory) {
share_group_ = new ShareGroup(bind_generates_resource);
@@ -526,6 +553,30 @@ class GLES2ImplementationTest : public testing::Test {
test_contexts_[i].Initialize(share_group_.get(),
bind_generates_resource,
lose_context_when_out_of_memory);
+#else
+ struct ContextInitOptions {
+ ContextInitOptions()
+ : bind_generates_resource_client(true),
+ bind_generates_resource_service(true),
+ lose_context_when_out_of_memory(false) {}
+
+ bool bind_generates_resource_client;
+ bool bind_generates_resource_service;
+ bool lose_context_when_out_of_memory;
+ };
+
+ bool Initialize(const ContextInitOptions& init_options) {
+ bool success = true;
+ share_group_ = new ShareGroup(init_options.bind_generates_resource_service);
+
+ for (int i = 0; i < kNumTestContexts; i++) {
+ if (!test_contexts_[i].Initialize(
+ share_group_.get(),
+ init_options.bind_generates_resource_client,
+ init_options.lose_context_when_out_of_memory))
+ success = false;
+ }
+#endif
// Default to test context 0.
gpu_control_ = test_contexts_[0].gpu_control_.get();
@@ -533,6 +584,9 @@ class GLES2ImplementationTest : public testing::Test {
transfer_buffer_ = test_contexts_[0].transfer_buffer_.get();
gl_ = test_contexts_[0].gl_.get();
commands_ = test_contexts_[0].commands_;
+#if defined(OS_CHROMEOS)
+ return success;
+#endif
}
MockClientCommandBuffer* command_buffer() const {
@@ -592,9 +646,14 @@ class GLES2ImplementationTest : public testing::Test {
};
void GLES2ImplementationTest::SetUp() {
+#if defined(OS_CHROMEOS)
+ ContextInitOptions init_options;
+ ASSERT_TRUE(Initialize(init_options));
+#else
bool bind_generates_resource = true;
bool lose_context_when_out_of_memory = false;
Initialize(bind_generates_resource, lose_context_when_out_of_memory);
+#endif
}
void GLES2ImplementationTest::TearDown() {
@@ -697,9 +756,16 @@ class GLES2ImplementationStrictSharedTest : public GLES2ImplementationTest {
};
void GLES2ImplementationStrictSharedTest::SetUp() {
+#if defined(OS_CHROMEOS)
+ ContextInitOptions init_options;
+ init_options.bind_generates_resource_client = false;
+ init_options.bind_generates_resource_service = false;
+ ASSERT_TRUE(Initialize(init_options));
+#else
bool bind_generates_resource = false;
bool lose_context_when_out_of_memory = false;
Initialize(bind_generates_resource, lose_context_when_out_of_memory);
+#endif
}
// GCC requires these declarations, but MSVC requires they not be present
@@ -3117,9 +3183,15 @@ TEST_F(GLES2ImplementationTest, ProduceTextureCHROMIUM) {
}
TEST_F(GLES2ImplementationManualInitTest, LoseContextOnOOM) {
+#if defined(OS_CHROMEOS)
+ ContextInitOptions init_options;
+ init_options.lose_context_when_out_of_memory = true;
+ ASSERT_TRUE(Initialize(init_options));
+#else
bool bind_generates_resource = false;
bool lose_context_when_out_of_memory = true;
Initialize(bind_generates_resource, lose_context_when_out_of_memory);
+#endif
struct Cmds {
cmds::LoseContextCHROMIUM cmd;
@@ -3136,10 +3208,14 @@ TEST_F(GLES2ImplementationManualInitTest, LoseContextOnOOM) {
}
TEST_F(GLES2ImplementationManualInitTest, NoLoseContextOnOOM) {
+#if defined(OS_CHROMEOS)
+ ContextInitOptions init_options;
+ ASSERT_TRUE(Initialize(init_options));
+#else
bool bind_generates_resource = false;
bool lose_context_when_out_of_memory = false;
Initialize(bind_generates_resource, lose_context_when_out_of_memory);
-
+#endif
struct Cmds {
cmds::LoseContextCHROMIUM cmd;
};
@@ -3152,6 +3228,22 @@ TEST_F(GLES2ImplementationManualInitTest, NoLoseContextOnOOM) {
EXPECT_TRUE(NoCommandsWritten());
}
+#if defined(OS_CHROMEOS)
+TEST_F(GLES2ImplementationManualInitTest, FailInitOnBGRMismatch1) {
+ ContextInitOptions init_options;
+ init_options.bind_generates_resource_client = false;
+ init_options.bind_generates_resource_service = true;
+ EXPECT_FALSE(Initialize(init_options));
+}
+
+TEST_F(GLES2ImplementationManualInitTest, FailInitOnBGRMismatch2) {
+ ContextInitOptions init_options;
+ init_options.bind_generates_resource_client = true;
+ init_options.bind_generates_resource_service = false;
+ EXPECT_FALSE(Initialize(init_options));
+}
+#endif
+
#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..28d162f 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils.cc
+++ b/gpu/command_buffer/common/gles2_cmd_utils.cc
@@ -325,7 +325,11 @@ int GLES2Util::GLGetNumValuesReturned(int id) const {
// -- glHint with GL_OES_standard_derivatives
case GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES:
return 1;
-
+#if defined(OS_CHROMEOS)
+ // Chromium internal bind_generates_resource query
+ case GL_BIND_GENERATES_RESOURCE_CHROMIUM:
+ return 1;
+#endif
// bad enum
default:
return 0;
diff --git a/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h b/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h
index 5908cc0..6171225 100644
--- a/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h
+++ b/gpu/command_buffer/common/gles2_cmd_utils_implementation_autogen.h
@@ -389,6 +389,9 @@ static const GLES2Util::EnumToString enum_to_string_table[] = {
{0x812D, "GL_CLAMP_TO_BORDER_NV", },
{0x812F, "GL_CLAMP_TO_EDGE", },
{0x86A3, "GL_COMPRESSED_TEXTURE_FORMATS", },
+#if defined(OS_CHROMEOS)
+ {0x9244, "GL_BIND_GENERATES_RESOURCE_CHROMIUM", },
+#endif
{0x86A2, "GL_NUM_COMPRESSED_TEXTURE_FORMATS", },
{0x0CF3, "GL_UNPACK_SKIP_ROWS_EXT", },
{0x0CF2, "GL_UNPACK_ROW_LENGTH_EXT", },
@@ -1002,6 +1005,10 @@ std::string GLES2Util::GetStringGLState(uint32 value) {
"GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM"},
{GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM,
"GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM"},
+#if defined(OS_CHROMEOS)
+ {GL_BIND_GENERATES_RESOURCE_CHROMIUM,
+ "GL_BIND_GENERATES_RESOURCE_CHROMIUM"},
+#endif
{GL_VERTEX_ARRAY_BINDING_OES, "GL_VERTEX_ARRAY_BINDING_OES"},
{GL_VIEWPORT, "GL_VIEWPORT"},
{GL_BLEND_COLOR, "GL_BLEND_COLOR"},
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index dba06e6..e68823d 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -4511,6 +4511,14 @@ bool GLES2DecoderImpl::GetHelper(
params[0] = unpack_unpremultiply_alpha_;
}
return true;
+#if defined(OS_CHROMEOS)
+ case GL_BIND_GENERATES_RESOURCE_CHROMIUM:
+ *num_written = 1;
+ if (params) {
+ params[0] = group_->bind_generates_resource() ? 1 : 0;
+ }
+ return true;
+#endif
default:
if (pname >= GL_DRAW_BUFFER0_ARB &&
pname < GL_DRAW_BUFFER0_ARB + group_->max_draw_buffers()) {
diff --git a/gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h b/gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h
index d4ea545..839dd5b 100644
--- a/gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h
+++ b/gpu/command_buffer/service/gles2_cmd_validation_implementation_autogen.h
@@ -116,6 +116,9 @@ static const GLenum valid_g_l_state_table[] = {
GL_UNPACK_FLIP_Y_CHROMIUM,
GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM,
GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM,
+#if defined(OS_CHROMEOS)
+ GL_BIND_GENERATES_RESOURCE_CHROMIUM,
+#endif
GL_VERTEX_ARRAY_BINDING_OES,
GL_VIEWPORT,
GL_BLEND_COLOR,
diff --git a/ui/gl/gl_bindings.h b/ui/gl/gl_bindings.h
index 8a28a64..1a0d6db 100644
--- a/ui/gl/gl_bindings.h
+++ b/ui/gl/gl_bindings.h
@@ -74,6 +74,9 @@
#define GL_UNPACK_PREMULTIPLY_ALPHA_CHROMIUM 0x9241
#define GL_UNPACK_UNPREMULTIPLY_ALPHA_CHROMIUM 0x9242
#define GL_UNPACK_COLORSPACE_CONVERSION_CHROMIUM 0x9243
+#if defined(OS_CHROMEOS)
+#define GL_BIND_GENERATES_RESOURCE_CHROMIUM 0x9244
+#endif
// GL_CHROMIUM_gpu_memory_manager
#define GL_TEXTURE_POOL_CHROMIUM 0x6000