diff options
author | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-23 08:59:00 +0000 |
---|---|---|
committer | gman@chromium.org <gman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-02-23 08:59:00 +0000 |
commit | ad3dfb184dd49226046c6b9f14e008357a03d80c (patch) | |
tree | ba0350eed8e825957068a70d1769c279e0c00211 /gpu | |
parent | 4343b28161f6e381a4bb483e4581408d11240791 (diff) | |
download | chromium_src-ad3dfb184dd49226046c6b9f14e008357a03d80c.zip chromium_src-ad3dfb184dd49226046c6b9f14e008357a03d80c.tar.gz chromium_src-ad3dfb184dd49226046c6b9f14e008357a03d80c.tar.bz2 |
Fix fake uniforms for Uniform2i, 3i and 4i
These 3 functions were not getting translated from fake to real locations
TEST=WebGL conformance tests
BUG=115397
Review URL: http://codereview.chromium.org/9455004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123199 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'gpu')
4 files changed, 37 insertions, 14 deletions
diff --git a/gpu/command_buffer/build_gles2_cmd_buffer.py b/gpu/command_buffer/build_gles2_cmd_buffer.py index ecbf73e..d092034 100755 --- a/gpu/command_buffer/build_gles2_cmd_buffer.py +++ b/gpu/command_buffer/build_gles2_cmd_buffer.py @@ -1325,6 +1325,7 @@ _FUNCTION_INFO = { 'decoder_func': 'DoUniform1iv', 'unit_test': False, }, + 'Uniform2i': {'type': 'PUTXn', 'data_type': 'GLint', 'count': 2}, 'Uniform2f': {'type': 'PUTXn', 'data_type': 'GLfloat', 'count': 2}, 'Uniform2fv': { 'type': 'PUTn', @@ -1338,6 +1339,7 @@ _FUNCTION_INFO = { 'count': 2, 'decoder_func': 'DoUniform2iv', }, + 'Uniform3i': {'type': 'PUTXn', 'data_type': 'GLint', 'count': 3}, 'Uniform3f': {'type': 'PUTXn', 'data_type': 'GLfloat', 'count': 3}, 'Uniform3fv': { 'type': 'PUTn', @@ -1351,9 +1353,8 @@ _FUNCTION_INFO = { 'count': 3, 'decoder_func': 'DoUniform3iv', }, - 'Uniform4f': { - 'type': 'PUTXn', 'data_type': 'GLfloat', 'count': 4 - }, + 'Uniform4i': {'type': 'PUTXn', 'data_type': 'GLint', 'count': 4}, + 'Uniform4f': {'type': 'PUTXn', 'data_type': 'GLfloat', 'count': 4}, 'Uniform4fv': { 'type': 'PUTn', 'data_type': 'GLfloat', @@ -3863,8 +3864,8 @@ class PUTXnHandler(TypeHandler): def WriteHandlerImplementation(self, func, file): """Overrriden from TypeHandler.""" - code = """ GLfloat temp[%(count)s] = { %(values)s}; - DoUniform%(count)sfv(%(location)s, 1, &temp[0]); + code = """ %(type)s temp[%(count)s] = { %(values)s}; + Do%(name)sv(%(location)s, 1, &temp[0]); """ values = "" args = func.GetOriginalArgs() @@ -3874,7 +3875,9 @@ class PUTXnHandler(TypeHandler): values += "%s, " % args[len(args) - count + ii].name file.Write(code % { + 'name': func.name, 'count': func.GetInfo('count'), + 'type': func.GetInfo('data_type'), 'location': args[0].name, 'args': func.MakeOriginalArgString(""), 'values': values, @@ -3884,7 +3887,7 @@ class PUTXnHandler(TypeHandler): """Overrriden from TypeHandler.""" valid_test = """ TEST_F(%(test_name)s, %(name)sValidArgs) { - EXPECT_CALL(*gl_, Uniform%(count)sfv(%(local_args)s)); + EXPECT_CALL(*gl_, %(name)sv(%(local_args)s)); SpecializedSetup<%(name)s, 0>(true); %(name)s cmd; cmd.Init(%(args)s); @@ -3895,13 +3898,14 @@ TEST_F(%(test_name)s, %(name)sValidArgs) { args = func.GetOriginalArgs() local_args = "%s, 1, _" % args[0].GetValidGLArg(func, 0, 0) self.WriteValidUnitTest(func, file, valid_test, { + 'name': func.name, '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); + EXPECT_CALL(*gl_, %(name)sv(_, _, _).Times(0); SpecializedSetup<%(name)s, 0>(false); %(name)s cmd; cmd.Init(%(args)s); @@ -3909,6 +3913,7 @@ TEST_F(%(test_name)s, %(name)sInvalidArgs%(arg_index)d_%(value_index)d) { } """ self.WriteInvalidUnitTest(func, file, invalid_test, { + 'name': func.GetInfo('name'), 'count': func.GetInfo('count'), }) diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h index 78ccd1b..9725642 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_autogen.h @@ -1900,7 +1900,8 @@ error::Error GLES2DecoderImpl::HandleUniform2i( static_cast<GLint>(c.location)); GLint x = static_cast<GLint>(c.x); GLint y = static_cast<GLint>(c.y); - glUniform2i(location, x, y); + GLint temp[2] = { x, y, }; + DoUniform2iv(location, 1, &temp[0]); return error::kNoError; } @@ -2001,7 +2002,8 @@ error::Error GLES2DecoderImpl::HandleUniform3i( GLint x = static_cast<GLint>(c.x); GLint y = static_cast<GLint>(c.y); GLint z = static_cast<GLint>(c.z); - glUniform3i(location, x, y, z); + GLint temp[3] = { x, y, z, }; + DoUniform3iv(location, 1, &temp[0]); return error::kNoError; } @@ -2104,7 +2106,8 @@ error::Error GLES2DecoderImpl::HandleUniform4i( GLint y = static_cast<GLint>(c.y); GLint z = static_cast<GLint>(c.z); GLint w = static_cast<GLint>(c.w); - glUniform4i(location, x, y, z, w); + GLint temp[4] = { x, y, z, w, }; + DoUniform4iv(location, 1, &temp[0]); return error::kNoError; } diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2.cc index 8dd05f9..0293bb4 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2.cc +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2.cc @@ -1,4 +1,4 @@ -// Copyright (c) 2011 The Chromium Authors. All rights reserved. +// Copyright (c) 2012 The Chromium Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. @@ -135,6 +135,11 @@ void GLES2DecoderTestBase::SpecializedSetup<Uniform2f, 0>(bool /* valid */) { }; template <> +void GLES2DecoderTestBase::SpecializedSetup<Uniform2i, 0>(bool /* valid */) { + SetupShaderForUniform(); +}; + +template <> void GLES2DecoderTestBase::SpecializedSetup<Uniform2fv, 0>(bool /* valid */) { SetupShaderForUniform(); }; @@ -162,6 +167,11 @@ void GLES2DecoderTestBase::SpecializedSetup<Uniform3f, 0>(bool /* valid */) { }; template <> +void GLES2DecoderTestBase::SpecializedSetup<Uniform3i, 0>(bool /* valid */) { + SetupShaderForUniform(); +}; + +template <> void GLES2DecoderTestBase::SpecializedSetup<Uniform3fv, 0>(bool /* valid */) { SetupShaderForUniform(); }; @@ -189,6 +199,11 @@ void GLES2DecoderTestBase::SpecializedSetup<Uniform4f, 0>(bool /* valid */) { }; template <> +void GLES2DecoderTestBase::SpecializedSetup<Uniform4i, 0>(bool /* valid */) { + SetupShaderForUniform(); +}; + +template <> void GLES2DecoderTestBase::SpecializedSetup<Uniform4fv, 0>(bool /* valid */) { SetupShaderForUniform(); }; diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2_autogen.h b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2_autogen.h index 8f40d0a..75db49c 100644 --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2_autogen.h +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_2_autogen.h @@ -860,7 +860,7 @@ TEST_F(GLES2DecoderTest2, Uniform2fvImmediateValidArgs) { } TEST_F(GLES2DecoderTest2, Uniform2iValidArgs) { - EXPECT_CALL(*gl_, Uniform2i(1, 2, 3)); + EXPECT_CALL(*gl_, Uniform2iv(1, 1, _)); SpecializedSetup<Uniform2i, 0>(true); Uniform2i cmd; cmd.Init(program_manager()->SwizzleLocation(1), 2, 3); @@ -1020,7 +1020,7 @@ TEST_F(GLES2DecoderTest2, Uniform3fvImmediateValidArgs) { } TEST_F(GLES2DecoderTest2, Uniform3iValidArgs) { - EXPECT_CALL(*gl_, Uniform3i(1, 2, 3, 4)); + EXPECT_CALL(*gl_, Uniform3iv(1, 1, _)); SpecializedSetup<Uniform3i, 0>(true); Uniform3i cmd; cmd.Init(program_manager()->SwizzleLocation(1), 2, 3, 4); @@ -1180,7 +1180,7 @@ TEST_F(GLES2DecoderTest2, Uniform4fvImmediateValidArgs) { } TEST_F(GLES2DecoderTest2, Uniform4iValidArgs) { - EXPECT_CALL(*gl_, Uniform4i(1, 2, 3, 4, 5)); + EXPECT_CALL(*gl_, Uniform4iv(1, 1, _)); SpecializedSetup<Uniform4i, 0>(true); Uniform4i cmd; cmd.Init(program_manager()->SwizzleLocation(1), 2, 3, 4, 5); |