diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-13 20:49:10 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-05-13 20:49:10 +0000 |
commit | 939e7367d5d984efe1f402c7e5135503beaebfae (patch) | |
tree | 749c5b189a679e96c9f6d1e933f36cf51f12090c /gpu/command_buffer/build_gles2_cmd_buffer.py | |
parent | 451371ef73d2b718758a210640d06fad0182ac7d (diff) | |
download | chromium_src-939e7367d5d984efe1f402c7e5135503beaebfae.zip chromium_src-939e7367d5d984efe1f402c7e5135503beaebfae.tar.gz chromium_src-939e7367d5d984efe1f402c7e5135503beaebfae.tar.bz2 |
Adds wrapping to support BOOL types on uniforms since some OpenGL drivers
fail at this.
TEST=conformance tests.
BUG=43258
Review URL: http://codereview.chromium.org/2067002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@47188 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 | 92 |
1 files changed, 88 insertions, 4 deletions
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py index b3e5ade..9c7f358 100755 --- a/gpu/command_buffer/build_gles2_cmd_buffer.py +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py @@ -1348,7 +1348,13 @@ _FUNCTION_INFO = { 'decoder_func': 'DoTexParameteriv', }, 'TexSubImage2D': {'type': 'Data'}, - 'Uniform1fv': {'type': 'PUTn', 'data_type': 'GLfloat', 'count': 1}, + 'Uniform1f': {'type': 'PUTXn', 'data_type': 'GLfloat', 'count': 1}, + 'Uniform1fv': { + 'type': 'PUTn', + 'data_type': 'GLfloat', + 'count': 1, + 'decoder_func': 'DoUniform1fv', + }, 'Uniform1i': {'decoder_func': 'DoUniform1i', 'unit_test': False}, 'Uniform1iv': { 'type': 'PUTn', @@ -1357,11 +1363,31 @@ _FUNCTION_INFO = { 'decoder_func': 'DoUniform1iv', 'unit_test': False, }, - 'Uniform2fv': {'type': 'PUTn', 'data_type': 'GLfloat', 'count': 2}, + 'Uniform2f': {'type': 'PUTXn', 'data_type': 'GLfloat', 'count': 2}, + 'Uniform2fv': { + 'type': 'PUTn', + 'data_type': 'GLfloat', + 'count': 2, + 'decoder_func': 'DoUniform2fv', + }, 'Uniform2iv': {'type': 'PUTn', 'data_type': 'GLint', 'count': 2}, - 'Uniform3fv': {'type': 'PUTn', 'data_type': 'GLfloat', 'count': 3}, + 'Uniform3f': {'type': 'PUTXn', 'data_type': 'GLfloat', 'count': 3}, + 'Uniform3fv': { + 'type': 'PUTn', + 'data_type': 'GLfloat', + 'count': 3, + 'decoder_func': 'DoUniform3fv', + }, 'Uniform3iv': {'type': 'PUTn', 'data_type': 'GLint', 'count': 3}, - 'Uniform4fv': {'type': 'PUTn', 'data_type': 'GLfloat', 'count': 4}, + 'Uniform4f': { + 'type': 'PUTXn', 'data_type': 'GLfloat', 'count': 4 + }, + 'Uniform4fv': { + 'type': 'PUTn', + 'data_type': 'GLfloat', + 'count': 4, + 'decoder_func': 'DoUniform4fv', + }, 'Uniform4iv': {'type': 'PUTn', 'data_type': 'GLint', 'count': 4}, 'UniformMatrix2fv': {'type': 'PUTn', 'data_type': 'GLfloat', 'count': 4}, 'UniformMatrix3fv': {'type': 'PUTn', 'data_type': 'GLfloat', 'count': 9}, @@ -3284,6 +3310,63 @@ TEST_F(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) { file.Write("\n") +class PUTXnHandler(TypeHandler): + """Handler for glUniform?f functions.""" + def __init__(self): + TypeHandler.__init__(self) + + def WriteHandlerImplementation(self, func, file): + """Overrriden from TypeHandler.""" + code = """ GLfloat temp[%(count)s] = { %(values)s}; + DoUniform%(count)sfv(%(location)s, 1, &temp[0]); +""" + values = "" + args = func.GetOriginalArgs() + count = int(func.GetInfo('count')) + num_args = len(args) + for ii in range(count): + values += "%s, " % args[len(args) - count + ii].name + + file.Write(code % { + 'count': func.GetInfo('count'), + 'location': args[0].name, + 'args': func.MakeOriginalArgString(""), + 'values': values, + }) + + def WriteServiceUnitTest(self, func, file): + """Overrriden from TypeHandler.""" + valid_test = """ +TEST_F(%(test_name)s, %(name)sValidArgs) { + EXPECT_CALL(*gl_, Uniform%(count)sfv(%(local_args)s)); + SpecializedSetup<%(name)s, 0>(); + %(name)s cmd; + cmd.Init(%(args)s); + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); + EXPECT_EQ(GL_NO_ERROR, GetGLError()); +} +""" + args = func.GetOriginalArgs() + local_args = "%s, 1, _" % args[0].GetValidArg(0, 0) + self.WriteValidUnitTest(func, file, valid_test, { + 'count': func.GetInfo('count'), + 'local_args': local_args, + }) + + invalid_test = """ +TEST_F(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) { + EXPECT_CALL(*gl_, Uniform%(count)s(_, _, _).Times(0); + SpecializedSetup<%(name)s, 0>(); + %(name)s cmd; + cmd.Init(%(args)s); + EXPECT_EQ(error::%(parse_result)s, ExecuteCmd(cmd));%(gl_error_test)s +} +""" + self.WriteInvalidUnitTest(func, file, invalid_test, { + 'count': func.GetInfo('count'), + }) + + class GLcharHandler(CustomHandler): """Handler for functions that pass a single string .""" @@ -4444,6 +4527,7 @@ class GLGenerator(object): 'Manual': ManualHandler(), 'PUT': PUTHandler(), 'PUTn': PUTnHandler(), + 'PUTXn': PUTXnHandler(), 'STRn': STRnHandler(), 'Todo': TodoHandler(), } |