Add option to not generate resources on bind in OpenGL ES

This allowes us to more efficiently manage ids. It is
not OpenGL ES 2.0 compatible though it probably fits most OpenGL ES
programs.

Note that we need to turn this off on Pepper and/or probably
provide a way for Pepper to turn on on. I'm not sure of the
path Pepper takes to setup. Assuming it goes through
GraphicsContext3D then changes to webkit will be needed to
get the flag all the way down through IPC to the GPU process.

TEST=unit tests and ran a few pages in a chrome build
BUG=92260

Review URL: http://codereview.chromium.org/7633060

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@96904 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder.cc b/gpu/command_buffer/service/gles2_cmd_decoder.cc
index 7a04a7c7..22e01c29 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder.cc
@@ -2682,6 +2682,12 @@
   if (client_id != 0) {
     info = GetBufferInfo(client_id);
     if (!info) {
+      if (!group_->bind_generates_resource()) {
+        SetGLError(GL_INVALID_VALUE,
+                   "glBindBuffer: id not generated by glGenBuffers");
+        return;
+      }
+
       // It's a new id so make a buffer info for it.
       glGenBuffersARB(1, &service_id);
       CreateBufferInfo(client_id, service_id);
@@ -2761,6 +2767,12 @@
   if (client_id != 0) {
     info = GetFramebufferInfo(client_id);
     if (!info) {
+      if (!group_->bind_generates_resource()) {
+        SetGLError(GL_INVALID_VALUE,
+                   "glBindFramebuffer: id not generated by glGenFramebuffers");
+        return;
+      }
+
       // It's a new id so make a framebuffer info for it.
       glGenFramebuffersEXT(1, &service_id);
       CreateFramebufferInfo(client_id, service_id);
@@ -2800,6 +2812,13 @@
   if (client_id != 0) {
     info = GetRenderbufferInfo(client_id);
     if (!info) {
+      if (!group_->bind_generates_resource()) {
+        SetGLError(
+            GL_INVALID_VALUE,
+            "glBindRenderbuffer: id not generated by glGenRenderbuffers");
+        return;
+      }
+
       // It's a new id so make a renderbuffer info for it.
       glGenRenderbuffersEXT(1, &service_id);
       CreateRenderbufferInfo(client_id, service_id);
@@ -2822,6 +2841,12 @@
   if (client_id != 0) {
     info = GetTextureInfo(client_id);
     if (!info) {
+      if (!group_->bind_generates_resource()) {
+        SetGLError(GL_INVALID_VALUE,
+                   "glBindTexture: id not generated by glGenTextures");
+        return;
+      }
+
       // It's a new id so make a texture info for it.
       glGenTextures(1, &service_id);
       CreateTextureInfo(client_id, service_id);