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

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

Issue 867123008: Add glGetFragDataLocation to gpu command buffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 f7b7fb565dfd872ae364144f2aae3b84798e7d84..bcfeb1bff2ebf872c3c244f59babb0dde5ba9c20 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_programs.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_programs.cc
@@ -875,6 +875,58 @@ TEST_P(GLES2DecoderWithShaderTest, GetAttribLocationInvalidArgs) {
EXPECT_NE(error::kNoError, ExecuteCmd(cmd));
}
+TEST_P(GLES2DecoderWithShaderTest, GetFragDataLocation) {
+ const uint32 kBucketId = 123;
+ const GLint kLocation = 10;
+ const char* kName = "color";
+ typedef GetFragDataLocation::Result Result;
+ Result* result = GetSharedMemoryAs<Result*>();
+ SetBucketAsCString(kBucketId, kName);
+ *result = -1;
+ GetFragDataLocation cmd;
+ cmd.Init(client_program_id_, kBucketId, kSharedMemoryId, kSharedMemoryOffset);
+ EXPECT_CALL(*gl_, GetFragDataLocation(kServiceProgramId, StrEq(kName)))
+ .WillOnce(Return(kLocation))
+ .RetiresOnSaturation();
+ decoder_->set_unsafe_es3_apis_enabled(true);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(kLocation, *result);
+ decoder_->set_unsafe_es3_apis_enabled(false);
+ EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
+}
+
+TEST_P(GLES2DecoderWithShaderTest, GetFragDataLocationInvalidArgs) {
+ const uint32 kBucketId = 123;
+ typedef GetFragDataLocation::Result Result;
+ Result* result = GetSharedMemoryAs<Result*>();
+ *result = -1;
+ GetFragDataLocation cmd;
+ decoder_->set_unsafe_es3_apis_enabled(true);
+ // Check no bucket
+ cmd.Init(client_program_id_, kBucketId, kSharedMemoryId, kSharedMemoryOffset);
+ EXPECT_NE(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(-1, *result);
+ // Check bad program id.
+ const char* kName = "color";
+ SetBucketAsCString(kBucketId, kName);
+ cmd.Init(kInvalidClientId, kBucketId, kSharedMemoryId, kSharedMemoryOffset);
+ *result = -1;
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(-1, *result);
+ EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
no sievers 2015/01/27 00:17:20 Is this error set from the client?
Zhenyao Mo 2015/01/27 00:36:46 It's set by decoder in GetProgramInfoNotShader().
+ // Check bad memory
+ cmd.Init(client_program_id_,
+ kBucketId,
+ kInvalidSharedMemoryId,
+ kSharedMemoryOffset);
+ EXPECT_NE(error::kNoError, ExecuteCmd(cmd));
+ cmd.Init(client_program_id_,
+ kBucketId,
+ kSharedMemoryId,
+ kInvalidSharedMemoryOffset);
+ EXPECT_NE(error::kNoError, ExecuteCmd(cmd));
+}
+
TEST_P(GLES2DecoderWithShaderTest, GetUniformLocation) {
const uint32 kBucketId = 123;
const char* kNonExistentName = "foobar";

Powered by Google App Engine
This is Rietveld 408576698