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

Unified Diff: gpu/command_buffer/build_gles2_cmd_buffer.py

Issue 780433006: Add framebuffer object related commands to command buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@tex
Patch Set: Created 6 years 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 6c00cdf07f83c7653c1e39ae451d20068029744b..9302e98a0c98c800aa06ee905b1c5767d173370b 100755
--- a/gpu/command_buffer/build_gles2_cmd_buffer.py
+++ b/gpu/command_buffer/build_gles2_cmd_buffer.py
@@ -2017,6 +2017,20 @@ _FUNCTION_INFO = {
'result': ['SizedResult<GLuint>'],
'client_test': False,
},
+ 'InvalidateFramebuffer': {
+ 'type': 'PUTn',
+ 'count': 1,
+ 'client_test': False,
+ 'unit_test': False,
+ 'unsafe': True,
+ },
+ 'InvalidateSubFramebuffer': {
+ 'type': 'PUTn',
+ 'count': 1,
+ 'client_test': False,
+ 'unit_test': False,
+ 'unsafe': True,
+ },
'IsBuffer': {
'type': 'Is',
'decoder_func': 'DoIsBuffer',
@@ -2133,6 +2147,9 @@ _FUNCTION_INFO = {
'unit_test': False,
'extension_flag': 'multisampled_render_to_texture',
},
+ 'ReadBuffer': {
+ 'unsafe': True,
+ },
'ReadPixels': {
'cmd_comment':
'// ReadPixels has the result separated from the pixel buffer so that\n'
@@ -3149,12 +3166,10 @@ COMPILE_ASSERT(offsetof(%(cmd_name)s::Result, %(field_name)s) == %(offset)d,
self.WriteServiceHandlerFunctionHeader(func, file)
self.WriteHandlerExtensionCheck(func, file)
self.WriteHandlerDeferReadWrite(func, file);
- last_arg = func.GetLastOriginalArg()
- all_but_last_arg = func.GetOriginalArgs()[:-1]
- for arg in all_but_last_arg:
+ for arg in func.GetOriginalArgs():
+ if arg.IsPointer():
+ self.WriteGetDataSizeCode(func, file)
arg.WriteGetCode(file)
- self.WriteGetDataSizeCode(func, file)
- last_arg.WriteGetCode(file)
func.WriteHandlerValidation(file)
func.WriteHandlerImplementation(file)
file.Write(" return error::kNoError;\n")
@@ -5577,18 +5592,26 @@ TEST_F(GLES2ImplementationTest, %(name)s) {
data[ii][jj] = static_cast<%(type)s>(ii * %(count)d + jj);
}
}
- expected.cmd.Init(%(cmd_args)s, &data[0][0]);
- gl_->%(name)s(%(args)s, &data[0][0]);
+ expected.cmd.Init(%(cmd_args)s);
+ gl_->%(name)s(%(args)s);
EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
}
"""
- cmd_arg_strings = [
- arg.GetValidClientSideCmdArg(func) for arg in func.GetCmdArgs()[0:-2]
- ]
+ cmd_arg_strings = []
+ for arg in func.GetCmdArgs():
+ if arg.name.endswith("_shm_id"):
+ cmd_arg_strings.append("&data[0][0]")
+ elif arg.name.endswith("_shm_offset"):
+ continue
+ else:
+ cmd_arg_strings.append(arg.GetValidClientSideCmdArg(func))
gl_arg_strings = []
count_param = 0
- for arg in func.GetOriginalArgs()[0:-1]:
- valid_value = arg.GetValidClientSideArg(func)
+ for arg in func.GetOriginalArgs():
+ if arg.IsPointer():
+ valid_value = "&data[0][0]"
Ken Russell (switch to Gerrit) 2014/12/04 01:42:56 These changes seem really over-specialized, and sc
+ else:
+ valid_value = arg.GetValidClientSideArg(func)
gl_arg_strings.append(valid_value)
if arg.name == "count":
count_param = int(valid_value)
@@ -5617,7 +5640,7 @@ TEST_F(GLES2ImplementationTest, %(name)sInvalidConstantArg%(invalid_index)d) {
data[ii][jj] = static_cast<%(type)s>(ii * %(count)d + jj);
}
}
- gl_->%(name)s(%(args)s, &data[0][0]);
+ gl_->%(name)s(%(args)s);
EXPECT_TRUE(NoCommandsWritten());
EXPECT_EQ(%(gl_error)s, CheckError());
}
@@ -5625,9 +5648,11 @@ TEST_F(GLES2ImplementationTest, %(name)sInvalidConstantArg%(invalid_index)d) {
for invalid_arg in constants:
gl_arg_strings = []
invalid = invalid_arg.GetInvalidArg(func)
- for arg in func.GetOriginalArgs()[0:-1]:
+ for arg in func.GetOriginalArgs():
if arg is invalid_arg:
gl_arg_strings.append(invalid[0])
+ elif arg.IsPointer():
+ gl_arg_strings.append("&data[0][0]")
else:
valid_value = arg.GetValidClientSideArg(func)
gl_arg_strings.append(valid_value)
@@ -5670,28 +5695,28 @@ TEST_F(GLES2ImplementationTest, %(name)sInvalidConstantArg%(invalid_index)d) {
def WriteImmediateCmdInit(self, func, file):
"""Overrriden from TypeHandler."""
- last_arg = func.GetLastOriginalArg()
- file.Write(" void Init(%s, %s _%s) {\n" %
- (func.MakeTypedCmdArgString("_"),
- last_arg.type, last_arg.name))
+ file.Write(" void Init(%s) {\n" %
+ func.MakeTypedInitString("_"))
file.Write(" SetHeader(_count);\n")
args = func.GetCmdArgs()
for arg in args:
file.Write(" %s = _%s;\n" % (arg.name, arg.name))
file.Write(" memcpy(ImmediateDataAddress(this),\n")
- file.Write(" _%s, ComputeDataSize(_count));\n" % last_arg.name)
+ pointer_arg = None
+ for arg in func.GetOriginalArgs():
+ if arg.IsPointer():
+ pointer_arg = arg
+ break
+ file.Write(" _%s, ComputeDataSize(_count));\n" % pointer_arg.name)
file.Write(" }\n")
file.Write("\n")
def WriteImmediateCmdSet(self, func, file):
"""Overrriden from TypeHandler."""
- last_arg = func.GetLastOriginalArg()
- copy_args = func.MakeCmdArgString("_", False)
- file.Write(" void* Set(void* cmd%s, %s _%s) {\n" %
- (func.MakeTypedCmdArgString("_", True),
- last_arg.type, last_arg.name))
- file.Write(" static_cast<ValueType*>(cmd)->Init(%s, _%s);\n" %
- (copy_args, last_arg.name))
+ file.Write(" void* Set(void* cmd%s) {\n" %
+ func.MakeTypedInitString("_", True))
+ file.Write(" static_cast<ValueType*>(cmd)->Init(%s);\n" %
+ func.MakeInitString("_"))
file.Write(" const uint32_t size = ComputeSize(_count);\n")
file.Write(" return NextImmediateCmdAddressTotalSize<ValueType>("
"cmd, size);\n")
@@ -5718,7 +5743,7 @@ TEST_F(GLES2ImplementationTest, %(name)sInvalidConstantArg%(invalid_index)d) {
def WriteImmediateFormatTest(self, func, file):
"""Overrriden from TypeHandler."""
- args = func.GetCmdArgs()
+ args = func.GetOriginalArgs()
count_param = 0
for arg in args:
if arg.name == "count":
@@ -5739,13 +5764,20 @@ TEST_F(GLES2ImplementationTest, %(name)sInvalidConstantArg%(invalid_index)d) {
file.Write(" void* next_cmd = cmd.Set(\n")
file.Write(" &cmd")
for value, arg in enumerate(args):
- file.Write(",\n static_cast<%s>(%d)" % (arg.type, value + 1))
- file.Write(",\n data);\n")
+ if arg.IsPointer():
+ file.Write(",\n data")
+ elif arg.type == "GLboolean":
+ continue
+ else:
+ file.Write(",\n static_cast<%s>(%d)" % (arg.type, value + 1))
+ file.Write(");\n")
file.Write(" EXPECT_EQ(static_cast<uint32_t>(cmds::%s::kCmdId),\n" %
func.name)
file.Write(" cmd.header.command);\n")
file.Write(" EXPECT_EQ(kExpectedCmdSize, cmd.header.size * 4u);\n")
for value, arg in enumerate(args):
+ if arg.IsPointer() or arg.type == "GLboolean":
+ continue
file.Write(" EXPECT_EQ(static_cast<%s>(%d), cmd.%s);\n" %
(arg.type, value + 1, arg.name))
file.Write(" CheckBytesWrittenMatchesExpectedSize(\n")
@@ -6995,6 +7027,13 @@ class Function(object):
self.num_pointer_args = sum(
[1 for arg in self.args_for_cmds if arg.IsPointer()])
+ if self.num_pointer_args > 0:
+ for arg in reversed(self.original_args):
+ if arg.IsPointer():
+ self.last_original_pointer_arg = arg
+ break
+ else:
+ self.last_original_pointer_arg = None
self.info = info
self.type_handler = self.type_handlers[info['type']]
self.can_auto_generate = (self.num_pointer_args == 0 and
« 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