gpu/command_buffer/build_cmd_buffer_lib.py
def WriteGLES2ImplementationUnitTest(self, func, f):
    """Writes the GLES2 Implemention unit test."""
    client_test = func.GetInfo('client_test', True)
    if not client_test:
      return;
    code = """
TEST_F(%(prefix)sImplementationTest, %(name)s) {
  %(type)s data[%(count)d] = {0};
  struct Cmds {
    cmds::%(name)sImmediate cmd;
    %(type)s data[%(count)d];
  };

  for (int jj = 0; jj < %(count)d; ++jj) {
    data[jj] = static_cast<%(type)s>(jj);
  }
  Cmds expected;
  expected.cmd.Init(%(cmd_args)s, &data[0]);
  gl_->%(name)s(%(args)s, &data[0]);
  EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
}
"""
    cmd_arg_strings = [
      arg.GetValidClientSideCmdArg(func) for arg in func.GetCmdArgs()[0:-2]
    ]
    gl_arg_strings = [
      arg.GetValidClientSideArg(func) for arg in func.GetOriginalArgs()[0:-1]
    ]

    f.write(code % {
          'prefix' : _prefix,
          'name': func.name,
          'type': self.GetArrayType(func),
          'count': self.GetArrayCount(func),
          'args': ", ".join(gl_arg_strings),
          'cmd_args': ", ".join(cmd_arg_strings),
        })
Writes the GLES2 Implemention unit test.
Writes the GLES2 Implemention unit test.
Writes the GLES2 Implemention unit test .
def WriteGLES2ImplementationUnitTest(self, func, f):
    client_test = func.GetInfo('client_test', True)
    if not client_test:
      return;
    code = """
TEST_F(%(prefix)sImplementationTest, %(name)s) {
  %(type)s data[%(count)d] = {0};
  struct Cmds {
    cmds::%(name)sImmediate cmd;
    %(type)s data[%(count)d];
  };
  for (int jj = 0; jj < %(count)d; ++jj) {
    data[jj] = static_cast<%(type)s>(jj);
  }
  Cmds expected;
  expected.cmd.Init(%(cmd_args)s, &data[0]);
  gl_->%(name)s(%(args)s, &data[0]);
  EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
}
"""
    cmd_arg_strings = [
      arg.GetValidClientSideCmdArg(func) for arg in func.GetCmdArgs()[0:-2]
    ]
    gl_arg_strings = [
      arg.GetValidClientSideArg(func) for arg in func.GetOriginalArgs()[0:-1]
    ]
    f.write(code % {
          'prefix' : _prefix,
          'name': func.name,
          'type': self.GetArrayType(func),
          'count': self.GetArrayCount(func),
          'args': ", ".join(gl_arg_strings),
          'cmd_args': ", ".join(cmd_arg_strings),
        })
def WriteGLES2ImplementationUnitTest ( self , func , f ) : client_test = func . GetInfo ( 'client_test' , True ) if not client_test : return ; code = """
TEST_F(%(prefix)sImplementationTest, %(name)s) {
  %(type)s data[%(count)d] = {0};
  struct Cmds {
    cmds::%(name)sImmediate cmd;
    %(type)s data[%(count)d];
  };

  for (int jj = 0; jj < %(count)d; ++jj) {
    data[jj] = static_cast<%(type)s>(jj);
  }
  Cmds expected;
  expected.cmd.Init(%(cmd_args)s, &data[0]);
  gl_->%(name)s(%(args)s, &data[0]);
  EXPECT_EQ(0, memcmp(&expected, commands_, sizeof(expected)));
}
""" cmd_arg_strings = [ arg . GetValidClientSideCmdArg ( func ) for arg in func . GetCmdArgs ( ) [ 0 : - 2 ] ] gl_arg_strings = [ arg . GetValidClientSideArg ( func ) for arg in func . GetOriginalArgs ( ) [ 0 : - 1 ] ] f . write ( code % { 'prefix' : _prefix , 'name' : func . name , 'type' : self . GetArrayType ( func ) , 'count' : self . GetArrayCount ( func ) , 'args' : ", " . join ( gl_arg_strings ) , 'cmd_args' : ", " . join ( cmd_arg_strings ) , } )
Writes the GLES2 Implemention unit test.
Writes the GLES2 Implemention unit test .
"""Writes the GLES2 Implemention unit test."""
self
func
f