summaryrefslogtreecommitdiffstats
path: root/gpu/command_buffer/client
diff options
context:
space:
mode:
authorgman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-07 23:35:31 +0000
committergman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-05-07 23:35:31 +0000
commit9e64440a70e0a18ff5b6edcbf10652feb2954b39 (patch)
treec2012f5a29786e7dfd2cdd638bc7f0c1e6da2083 /gpu/command_buffer/client
parent891ca0f165421a6d748df275058832d2e9ebecab (diff)
downloadchromium_src-9e64440a70e0a18ff5b6edcbf10652feb2954b39.zip
chromium_src-9e64440a70e0a18ff5b6edcbf10652feb2954b39.tar.gz
chromium_src-9e64440a70e0a18ff5b6edcbf10652feb2954b39.tar.bz2
This CL adds the option to support buffers that are bound
to more than one target. We had originally decided that this would be an disallowed. glBindBuffer(GL_ARRAY_BUFFER, some_buffer_id); glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, some_buffer_id); Unfortunately the GLES2 conformance tests require this behavior. This CL makes this behavior possible but it has to be turned on because it means all buffers have to have CPU side backing (not just ELEMENT_ARRAY_BUFFERs) and it means a slowdown for dynamic vertex related stuff like skinning because an extra copy has to be made every time they are updated. So, by default it will be off but we'll come up with some way to turn it on. Al's suggestion is to use eglCreateContext with a custom intialization attribute. My #1 question: What about the name of the command, the name of the constant and the filename the constant is in. Any thoughts? TEST=none BUG=none Review URL: http://codereview.chromium.org/1992008 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@46756 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu/command_buffer/client')
-rw-r--r--gpu/command_buffer/client/gles2_c_lib_autogen.h3
-rw-r--r--gpu/command_buffer/client/gles2_cmd_helper_autogen.h5
-rw-r--r--gpu/command_buffer/client/gles2_implementation.cc4
-rw-r--r--gpu/command_buffer/client/gles2_implementation_autogen.h32
4 files changed, 44 insertions, 0 deletions
diff --git a/gpu/command_buffer/client/gles2_c_lib_autogen.h b/gpu/command_buffer/client/gles2_c_lib_autogen.h
index 73cd6ce..d7983ea 100644
--- a/gpu/command_buffer/client/gles2_c_lib_autogen.h
+++ b/gpu/command_buffer/client/gles2_c_lib_autogen.h
@@ -519,6 +519,9 @@ void GLES2RegisterSharedIds(
GLuint namespace_id, GLsizei n, const GLuint* ids) {
gles2::GetGLContext()->RegisterSharedIds(namespace_id, n, ids);
}
+void GLES2CommandBufferEnable(GLenum cap, GLboolean enable) {
+ gles2::GetGLContext()->CommandBufferEnable(cap, enable);
+}
#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_C_LIB_AUTOGEN_H_
diff --git a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
index 652579d..1cbc45f 100644
--- a/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
+++ b/gpu/command_buffer/client/gles2_cmd_helper_autogen.h
@@ -1148,5 +1148,10 @@
c.Init(namespace_id, n, ids_shm_id, ids_shm_offset);
}
+ void CommandBufferEnable(GLenum cap, GLboolean enable) {
+ gles2::CommandBufferEnable& c = GetCmdSpace<gles2::CommandBufferEnable>();
+ c.Init(cap, enable);
+ }
+
#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_CMD_HELPER_AUTOGEN_H_
diff --git a/gpu/command_buffer/client/gles2_implementation.cc b/gpu/command_buffer/client/gles2_implementation.cc
index 8e7867c..8d7c57f 100644
--- a/gpu/command_buffer/client/gles2_implementation.cc
+++ b/gpu/command_buffer/client/gles2_implementation.cc
@@ -1340,6 +1340,10 @@ void GLES2Implementation::BindBuffer(GLenum target, GLuint buffer) {
}
void GLES2Implementation::DeleteBuffers(GLsizei n, const GLuint* buffers) {
+ if (n < 0) {
+ SetGLError(GL_INVALID_VALUE, "glDeleteBuffers: n < 0");
+ return;
+ }
buffer_id_handler_->FreeIds(n, buffers);
for (GLsizei ii = 0; ii < n; ++ii) {
if (buffers[ii] == bound_array_buffer_id_) {
diff --git a/gpu/command_buffer/client/gles2_implementation_autogen.h b/gpu/command_buffer/client/gles2_implementation_autogen.h
index 63d0b53..ae826d8 100644
--- a/gpu/command_buffer/client/gles2_implementation_autogen.h
+++ b/gpu/command_buffer/client/gles2_implementation_autogen.h
@@ -167,6 +167,10 @@ void CullFace(GLenum mode) {
}
void DeleteFramebuffers(GLsizei n, const GLuint* framebuffers) {
+ if (n < 0) {
+ SetGLError(GL_INVALID_VALUE, "glDeleteFramebuffers: n < 0");
+ return;
+ }
framebuffer_id_handler_->FreeIds(n, framebuffers);
helper_->DeleteFramebuffersImmediate(n, framebuffers);
}
@@ -177,6 +181,10 @@ void DeleteProgram(GLuint program) {
}
void DeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) {
+ if (n < 0) {
+ SetGLError(GL_INVALID_VALUE, "glDeleteRenderbuffers: n < 0");
+ return;
+ }
renderbuffer_id_handler_->FreeIds(n, renderbuffers);
helper_->DeleteRenderbuffersImmediate(n, renderbuffers);
}
@@ -187,6 +195,10 @@ void DeleteShader(GLuint shader) {
}
void DeleteTextures(GLsizei n, const GLuint* textures) {
+ if (n < 0) {
+ SetGLError(GL_INVALID_VALUE, "glDeleteTextures: n < 0");
+ return;
+ }
texture_id_handler_->FreeIds(n, textures);
helper_->DeleteTexturesImmediate(n, textures);
}
@@ -240,6 +252,10 @@ void FrontFace(GLenum mode) {
}
void GenBuffers(GLsizei n, GLuint* buffers) {
+ if (n < 0) {
+ SetGLError(GL_INVALID_VALUE, "glGenBuffers: n < 0");
+ return;
+ }
buffer_id_handler_->MakeIds(0, n, buffers);
helper_->GenBuffersImmediate(n, buffers);
}
@@ -249,16 +265,28 @@ void GenerateMipmap(GLenum target) {
}
void GenFramebuffers(GLsizei n, GLuint* framebuffers) {
+ if (n < 0) {
+ SetGLError(GL_INVALID_VALUE, "glGenFramebuffers: n < 0");
+ return;
+ }
framebuffer_id_handler_->MakeIds(0, n, framebuffers);
helper_->GenFramebuffersImmediate(n, framebuffers);
}
void GenRenderbuffers(GLsizei n, GLuint* renderbuffers) {
+ if (n < 0) {
+ SetGLError(GL_INVALID_VALUE, "glGenRenderbuffers: n < 0");
+ return;
+ }
renderbuffer_id_handler_->MakeIds(0, n, renderbuffers);
helper_->GenRenderbuffersImmediate(n, renderbuffers);
}
void GenTextures(GLsizei n, GLuint* textures) {
+ if (n < 0) {
+ SetGLError(GL_INVALID_VALUE, "glGenTextures: n < 0");
+ return;
+ }
texture_id_handler_->MakeIds(0, n, textures);
helper_->GenTexturesImmediate(n, textures);
}
@@ -762,5 +790,9 @@ void DeleteSharedIds(GLuint namespace_id, GLsizei n, const GLuint* ids);
void RegisterSharedIds(GLuint namespace_id, GLsizei n, const GLuint* ids);
+void CommandBufferEnable(GLenum cap, GLboolean enable) {
+ helper_->CommandBufferEnable(cap, enable);
+}
+
#endif // GPU_COMMAND_BUFFER_CLIENT_GLES2_IMPLEMENTATION_AUTOGEN_H_