Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(974)

Unified Diff: gpu/command_buffer/build_gles2_cmd_buffer.py

Issue 842063003: Add glBindBufferRange to GPU command buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@buffer
Patch Set: With fixes Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « gpu/GLES2/gl2chromium_autogen.h ('k') | gpu/command_buffer/client/gles2_c_lib_autogen.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/build_gles2_cmd_buffer.py
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py
index 2292c4dd84ae406a9fc80ae3e5cb30d8f00ce0bf..922a496c2ae8d8cca742a04933789d4a50019986 100755
--- a/gpu/command_buffer/build_gles2_cmd_buffer.py
+++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -1434,6 +1434,12 @@ _FUNCTION_INFO = {
'gen_func': 'GenBuffersARB',
'unsafe': True,
},
+ 'BindBufferRange': {
+ 'type': 'Bind',
+ 'id_mapping': [ 'Buffer' ],
+ 'gen_func': 'GenBuffersARB',
+ 'unsafe': True,
+ },
'BindFramebuffer': {
'type': 'Bind',
'decoder_func': 'DoBindFramebuffer',
@@ -4429,12 +4435,12 @@ TEST_P(%(test_name)s, %(name)sValidArgs) {
valid_test += """
TEST_P(%(test_name)s, %(name)sValidArgsNewId) {
EXPECT_CALL(*gl_,
- %(gl_func_name)s(%(all_except_last_gl_arg)s, kNewServiceId));
+ %(gl_func_name)s(%(gl_args_with_new_id)s));
EXPECT_CALL(*gl_, %(gl_gen_func_name)s(1, _))
.WillOnce(SetArgumentPointee<1>(kNewServiceId));
SpecializedSetup<cmds::%(name)s, 0>(true);
cmds::%(name)s cmd;
- cmd.Init(%(all_except_last_arg)s, kNewClientId);"""
+ cmd.Init(%(args_with_new_id)s);"""
if func.IsUnsafe():
valid_test += """
decoder_->set_unsafe_es3_apis_enabled(true);
@@ -4453,16 +4459,19 @@ TEST_P(%(test_name)s, %(name)sValidArgsNewId) {
}
"""
- all_except_last_arg = [
- arg.GetValidArg(func) for arg in func.GetOriginalArgs()[:-1]
- ]
- all_except_last_gl_arg = [
- arg.GetValidGLArg(func) for arg in func.GetOriginalArgs()[:-1]
- ]
+ gl_args_with_new_id = []
+ args_with_new_id = []
+ for arg in func.GetOriginalArgs():
+ if hasattr(arg, 'resource_type'):
+ gl_args_with_new_id.append('kNewServiceId')
+ args_with_new_id.append('kNewClientId')
+ else:
+ gl_args_with_new_id.append(arg.GetValidGLArg(func))
+ args_with_new_id.append(arg.GetValidArg(func))
self.WriteValidUnitTest(func, file, valid_test, {
- 'all_except_last_arg': ", ".join(all_except_last_arg),
- 'all_except_last_gl_arg': ", ".join(all_except_last_gl_arg),
- 'resource_type': func.GetOriginalArgs()[-1].resource_type,
+ 'args_with_new_id': ", ".join(args_with_new_id),
+ 'gl_args_with_new_id': ", ".join(gl_args_with_new_id),
+ 'resource_type': func.GetResourceIdArg().resource_type,
'gl_gen_func_name': func.GetInfo("gen_func"),
}, *extras)
@@ -4505,14 +4514,7 @@ TEST_P(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) {
}
"""
- name_arg = None
- if len(func.GetOriginalArgs()) == 1:
- # Bind functions that have no target (like BindVertexArrayOES)
- name_arg = func.GetOriginalArgs()[0]
- else:
- # Bind functions that have both a target and a name (like BindTexture)
- name_arg = func.GetOriginalArgs()[-1]
-
+ name_arg = func.GetResourceIdArg()
file.Write(code % {
'name': func.name,
'arg_string': func.MakeOriginalArgString(""),
@@ -7556,6 +7558,12 @@ class Function(object):
def GetLastOriginalPointerArg(self):
return self.last_original_pointer_arg
+ def GetResourceIdArg(self):
+ for arg in self.original_args:
+ if hasattr(arg, 'resource_type'):
+ return arg
+ return None
+
def __MaybePrependComma(self, arg_string, add_comma):
"""Adds a comma if arg_string is not empty and add_comma is true."""
comma = ""
« no previous file with comments | « gpu/GLES2/gl2chromium_autogen.h ('k') | gpu/command_buffer/client/gles2_c_lib_autogen.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698