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

Unified Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest_programs.cc

Issue 1335243002: Improve Uniform*ui{v} command handling. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 3 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
Index: gpu/command_buffer/service/gles2_cmd_decoder_unittest_programs.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_programs.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_programs.cc
index 2a3dc20d2010ab8d4e6dd5efcde9a3b9272e7d58..f7f6e615548ad6c1336f3efe660f7b19afac7930 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_programs.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_programs.cc
@@ -1738,6 +1738,17 @@ TEST_P(GLES2DecoderWithShaderTest, Uniform1iValidArgs) {
EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
}
+TEST_P(GLES2DecoderWithShaderTest, Uniform1uiValidArgs) {
+ EXPECT_CALL(*gl_, Uniform1uiv(kUniform4RealLocation, 1, _));
+ cmds::Uniform1ui cmd;
+ cmd.Init(kUniform4FakeLocation, 2);
+ decoder_->set_unsafe_es3_apis_enabled(true);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ decoder_->set_unsafe_es3_apis_enabled(false);
+ EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
+}
+
TEST_P(GLES2DecoderWithShaderTest, Uniform1ivImmediateValidArgs) {
Uniform1ivImmediate& cmd = *GetImmediateAs<Uniform1ivImmediate>();
EXPECT_CALL(*gl_,
@@ -1788,6 +1799,134 @@ TEST_P(GLES2DecoderWithShaderTest, Uniform1ivSamplerIsLimited) {
EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
}
+TEST_P(GLES2DecoderWithShaderTest, Uniform1uivImmediateValidArgs) {
+ cmds::Uniform1uivImmediate& cmd =
+ *GetImmediateAs<cmds::Uniform1uivImmediate>();
+ EXPECT_CALL(
+ *gl_,
+ Uniform1uiv(kUniform4RealLocation, 1,
+ reinterpret_cast<GLuint*>(ImmediateDataAddress(&cmd))));
+ GLuint temp[1 * 2] = {
+ 0,
+ };
+ cmd.Init(kUniform4FakeLocation, 1, &temp[0]);
+ decoder_->set_unsafe_es3_apis_enabled(true);
+ EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ decoder_->set_unsafe_es3_apis_enabled(false);
+ EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
+}
+
+TEST_P(GLES2DecoderWithShaderTest, Uniform1uivImmediateInvalidType) {
+ EXPECT_CALL(*gl_, Uniform1uiv(_, _, _)).Times(0);
+ Uniform1uivImmediate& cmd = *GetImmediateAs<Uniform1uivImmediate>();
+ GLuint temp[1 * 2] = {
+ 0,
+ };
+ // uniform1 is SAMPLER type.
+ cmd.Init(kUniform1FakeLocation, 1, &temp[0]);
+ decoder_->set_unsafe_es3_apis_enabled(true);
+ EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
+ EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
+}
+
+TEST_P(GLES2DecoderWithShaderTest, Uniform1uivZeroCount) {
+ EXPECT_CALL(*gl_, Uniform1uiv(_, _, _)).Times(0);
+ Uniform1uivImmediate& cmd = *GetImmediateAs<Uniform1uivImmediate>();
+ GLuint temp = 0;
+ cmd.Init(kUniform4FakeLocation, 0, &temp);
+ decoder_->set_unsafe_es3_apis_enabled(true);
+ EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+}
+
+TEST_P(GLES2DecoderWithShaderTest, Uniform2uiValidArgs) {
+ EXPECT_CALL(*gl_, Uniform2uiv(kUniform5RealLocation, 1, _));
+ cmds::Uniform2ui cmd;
+ cmd.Init(kUniform5FakeLocation, 2, 3);
+ decoder_->set_unsafe_es3_apis_enabled(true);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ decoder_->set_unsafe_es3_apis_enabled(false);
+ EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
+}
+
+TEST_P(GLES2DecoderWithShaderTest, Uniform2uivImmediateValidArgs) {
+ cmds::Uniform2uivImmediate& cmd =
+ *GetImmediateAs<cmds::Uniform2uivImmediate>();
+ EXPECT_CALL(
+ *gl_,
+ Uniform2uiv(kUniform5RealLocation, 1,
+ reinterpret_cast<GLuint*>(ImmediateDataAddress(&cmd))));
+ GLuint temp[2 * 1] = {
+ 0,
+ };
+ cmd.Init(kUniform5FakeLocation, 1, &temp[0]);
+ decoder_->set_unsafe_es3_apis_enabled(true);
+ EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ decoder_->set_unsafe_es3_apis_enabled(false);
+ EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
+}
+
+TEST_P(GLES2DecoderWithShaderTest, Uniform3uiValidArgs) {
+ EXPECT_CALL(*gl_, Uniform3uiv(kUniform6RealLocation, 1, _));
+ cmds::Uniform3ui cmd;
+ cmd.Init(kUniform6FakeLocation, 2, 3, 4);
+ decoder_->set_unsafe_es3_apis_enabled(true);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ decoder_->set_unsafe_es3_apis_enabled(false);
+ EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
+}
+
+TEST_P(GLES2DecoderWithShaderTest, Uniform3uivImmediateValidArgs) {
+ cmds::Uniform3uivImmediate& cmd =
+ *GetImmediateAs<cmds::Uniform3uivImmediate>();
+ EXPECT_CALL(
+ *gl_,
+ Uniform3uiv(kUniform6RealLocation, 1,
+ reinterpret_cast<GLuint*>(ImmediateDataAddress(&cmd))));
+ GLuint temp[3 * 1] = {
+ 0,
+ };
+ cmd.Init(kUniform6FakeLocation, 1, &temp[0]);
+ decoder_->set_unsafe_es3_apis_enabled(true);
+ EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ decoder_->set_unsafe_es3_apis_enabled(false);
+ EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
+}
+
+TEST_P(GLES2DecoderWithShaderTest, Uniform4uiValidArgs) {
+ EXPECT_CALL(*gl_, Uniform4uiv(kUniform7RealLocation, 1, _));
+ cmds::Uniform4ui cmd;
+ cmd.Init(kUniform7FakeLocation, 2, 3, 4, 5);
+ decoder_->set_unsafe_es3_apis_enabled(true);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ decoder_->set_unsafe_es3_apis_enabled(false);
+ EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
+}
+
+TEST_P(GLES2DecoderWithShaderTest, Uniform4uivImmediateValidArgs) {
+ cmds::Uniform4uivImmediate& cmd =
+ *GetImmediateAs<cmds::Uniform4uivImmediate>();
+ EXPECT_CALL(
+ *gl_,
+ Uniform4uiv(kUniform7RealLocation, 1,
+ reinterpret_cast<GLuint*>(ImmediateDataAddress(&cmd))));
+ GLuint temp[4 * 1] = {
+ 0,
+ };
+ cmd.Init(kUniform7FakeLocation, 1, &temp[0]);
+ decoder_->set_unsafe_es3_apis_enabled(true);
+ EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(temp)));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ decoder_->set_unsafe_es3_apis_enabled(false);
+ EXPECT_EQ(error::kUnknownCommand, ExecuteImmediateCmd(cmd, sizeof(temp)));
+}
+
TEST_P(GLES2DecoderTest, BindAttribLocationBucket) {
const uint32 kBucketId = 123;
const GLint kLocation = 2;
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc ('k') | gpu/command_buffer/service/program_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698