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

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

Issue 2543033002: Add texture swizzle back to command buffer. (Closed)
Patch Set: add swizzle value negative test Created 4 years 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
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
index 67e71bd4ce143b09407ba5419e5e2fe924d53c05..266869dfdb44b51bf0aeddbf1500af73cfd029b4 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
@@ -4720,6 +4720,68 @@ TEST_P(GLES2DecoderTest, BindTextureInvalidArgs) {
EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
}
+TEST_P(GLES3DecoderTest, TexSwizzleAllowed) {
+ const GLenum kTarget = GL_TEXTURE_2D;
+ const GLenum kSwizzleParam = GL_TEXTURE_SWIZZLE_R;
+ const GLenum kSwizzleValue = GL_BLUE;
+ const GLenum kInvalidSwizzleValue = GL_RG;
+
+ {
+ EXPECT_CALL(*gl_, TexParameteri(kTarget, kSwizzleParam, kSwizzleValue));
+ TexParameteri cmd;
+ cmd.Init(kTarget, kSwizzleParam, kSwizzleValue);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ }
+
+ {
+ TexParameteri cmd;
+ cmd.Init(kTarget, kSwizzleParam, kInvalidSwizzleValue);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
+ }
+
+ {
+ EXPECT_CALL(*gl_, GetError())
+ .WillOnce(Return(GL_NO_ERROR))
+ .WillOnce(Return(GL_NO_ERROR))
+ .RetiresOnSaturation();
+ typedef GetTexParameteriv::Result Result;
+ Result* result = static_cast<Result*>(shared_memory_address_);
+ result->size = 0;
+ GetTexParameteriv cmd;
+ cmd.Init(kTarget, kSwizzleParam, shared_memory_id_, shared_memory_offset_);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(kSwizzleParam),
+ result->GetNumResults());
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ EXPECT_EQ(kSwizzleValue, static_cast<GLenum>(result->GetData()[0]));
+ }
+}
+
+TEST_P(WebGL2DecoderTest, TexSwizzleDisabled) {
+ const GLenum kTarget = GL_TEXTURE_2D;
+ const GLenum kSwizzleParam = GL_TEXTURE_SWIZZLE_R;
+ const GLenum kSwizzleValue = GL_BLUE;
+
+ {
+ TexParameteri cmd;
+ cmd.Init(kTarget, kSwizzleParam, kSwizzleValue);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
+ }
+
+ {
+ typedef GetTexParameteriv::Result Result;
+ Result* result = static_cast<Result*>(shared_memory_address_);
+ result->size = 0;
+ GetTexParameteriv cmd;
+ cmd.Init(kTarget, kSwizzleParam, shared_memory_id_, shared_memory_offset_);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
+ }
+}
+
// TODO(gman): Complete this test.
// TEST_P(GLES2DecoderTest, CompressedTexImage2DGLError) {
// }
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698