diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-07 23:35:31 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-07 23:35:31 +0000 |
commit | 9e64440a70e0a18ff5b6edcbf10652feb2954b39 (patch) | |
tree | c2012f5a29786e7dfd2cdd638bc7f0c1e6da2083 /gpu/command_buffer/build_gles2_cmd_buffer.py | |
parent | 891ca0f165421a6d748df275058832d2e9ebecab (diff) | |
download | chromium_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/build_gles2_cmd_buffer.py')
-rwxr-xr-x | gpu/command_buffer/build_gles2_cmd_buffer.py | 53 |
1 files changed, 37 insertions, 16 deletions
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py index 9b90b38..a4f4588 100755 --- a/gpu/command_buffer/build_gles2_cmd_buffer.py +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py @@ -181,7 +181,7 @@ GL_APICALL GLuint GL_APIENTRY glGetMaxValueInBuffer (GLidBuffer buffer_id, GL_APICALL void GL_APIENTRY glGenSharedIds (GLuint namespace_id, GLuint id_offset, GLsizei n, GLuint* ids); GL_APICALL void GL_APIENTRY glDeleteSharedIds (GLuint namespace_id, GLsizei n, const GLuint* ids); GL_APICALL void GL_APIENTRY glRegisterSharedIds (GLuint namespace_id, GLsizei n, const GLuint* ids); -""" +GL_APICALL void GL_APIENTRY glCommandBufferEnable (GLenumCommandBufferState cap, GLboolean enable);""" # This is the list of all commmands that will be generated and their Id. # If a command is not listed in this table it is an error. @@ -375,6 +375,7 @@ _CMD_ID_TABLE = { 'GenSharedIds': 439, 'DeleteSharedIds': 440, 'RegisterSharedIds': 441, + 'CommandBufferEnable': 442, } # This is a list of enum names and their valid values. It is used to map @@ -511,6 +512,12 @@ _ENUM_LISTS = { 'GL_FOG_HINT', ], }, + 'CommandBufferState': { + 'type': 'GLenum', + 'valid': [ + 'GLES2_ALLOW_BUFFERS_ON_MULTIPLE_TARGETS', + ], + }, 'TextureTarget': { 'type': 'GLenum', 'valid': [ @@ -1009,6 +1016,10 @@ _FUNCTION_INFO = { 'result': ['GLenum'], }, 'ClearDepthf': {'decoder_func': 'glClearDepth'}, + 'CommandBufferEnable': { + 'decoder_func': 'DoCommandBufferEnable', + 'expectation': False, + }, 'CompileShader': {'decoder_func': 'DoCompileShader', 'unit_test': False}, 'CompressedTexImage2D': {'type': 'Manual','immediate': True}, 'CompressedTexSubImage2D': {'type': 'Data'}, @@ -2296,6 +2307,10 @@ class GENnHandler(TypeHandler): def WriteGLES2ImplementationHeader(self, func, file): """Overrriden from TypeHandler.""" code = """%(return_type)s %(name)s(%(typed_args)s) { + if (%(count_name)s < 0) { + SetGLError(GL_INVALID_VALUE, "gl%(name)s: n < 0"); + return; + } %(resource_type)s_id_handler_->MakeIds(0, %(args)s); helper_->%(name)sImmediate(%(args)s); } @@ -2306,7 +2321,8 @@ class GENnHandler(TypeHandler): 'name': func.original_name, 'typed_args': func.MakeTypedOriginalArgString(""), 'args': func.MakeOriginalArgString(""), - 'resource_type': func.name[3:-1].lower() + 'resource_type': func.name[3:-1].lower(), + 'count_name': func.GetOriginalArgs()[0].name, }) def WriteServiceUnitTest(self, func, file): @@ -2658,15 +2674,24 @@ TEST_F(%(test_name)s, %(name)sInvalidArgs) { """Overrriden from TypeHandler.""" impl_decl = func.GetInfo('impl_decl') if impl_decl == None or impl_decl == True: - file.Write("%s %s(%s) {\n" % - (func.return_type, func.original_name, - func.MakeTypedOriginalArgString(""))) - file.Write(" %s_id_handler_->FreeIds(%s);\n" % - (func.name[6:-1].lower(), func.MakeOriginalArgString(""))) - file.Write(" helper_->%sImmediate(%s);\n" % - (func.name, func.MakeOriginalArgString(""))) - file.Write("}\n") - file.Write("\n") + code = """%(return_type)s %(name)s(%(typed_args)s) { + if (%(count_name)s < 0) { + SetGLError(GL_INVALID_VALUE, "gl%(name)s: n < 0"); + return; + } + %(resource_type)s_id_handler_->FreeIds(%(args)s); + helper_->%(name)sImmediate(%(args)s); +} + +""" + file.Write(code % { + 'return_type': func.return_type, + 'name': func.original_name, + 'typed_args': func.MakeTypedOriginalArgString(""), + 'args': func.MakeOriginalArgString(""), + 'resource_type': func.name[6:-1].lower(), + 'count_name': func.GetOriginalArgs()[0].name, + }) def WriteImmediateCmdComputeSize(self, func, file): """Overrriden from TypeHandler.""" @@ -2788,11 +2813,7 @@ class GETnHandler(TypeHandler): arg.WriteGetCode(file) code = """ typedef %(func_name)s::Result Result; - GLsizei num_values = util_.GLGetNumValuesReturned(pname); - if (num_values == 0) { - SetGLError(GL_INVALID_ENUM, "gl%(func_name)s: invalid enum"); - return error::kNoError; - } + GLsizei num_values = GetNumValuesReturnedForGLGet(pname, &num_values); Result* result = GetSharedMemoryAs<Result*>( c.params_shm_id, c.params_shm_offset, Result::ComputeSize(num_values)); %(last_arg_type)s params = result ? result->GetData() : NULL; |