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

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

Issue 2182443003: WebGL 2: Fix bugs in negativetextureapi.html for Mac (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: small change Created 4 years, 5 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_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 768fa6022fce080fe340d36bbf9acf10edfcea6e..e937c66c2631ee0154d75f75a582104e4fd277bc 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
@@ -1075,6 +1075,128 @@ TEST_P(GLES2DecoderTest, CompressedTexImage3DFailsOnES2) {
}
}
+TEST_P(GLES2DecoderTest, CopyTexSubImage3DFailsOnES2) {
+ const GLenum kTarget = GL_TEXTURE_2D_ARRAY;
+ const GLint kLevel = 0;
+ const GLsizei kWidth = 4;
+ const GLsizei kHeight = 4;
+
+ {
qiankun 2016/07/27 13:56:26 {} is not required.
yunchao 2016/07/27 23:46:11 Done.
+ CopyTexSubImage3D cmd;
+ cmd.Init(kTarget,
+ kLevel,
+ 0, 0, 0,
+ 0, 0,
+ kWidth,
+ kHeight);
+ EXPECT_EQ(error::kUnknownCommand, ExecuteCmd(cmd));
+ }
+}
+
+TEST_P(GLES3DecoderTest, CopyTexSubImage3DValidArgs) {
+ const GLenum kTarget = GL_TEXTURE_3D;
+ const GLint kLevel = 1;
+ const GLint kInternalFormat = GL_RGB8;
+ const GLsizei kWidth = 2;
+ const GLsizei kHeight = 2;
+ const GLsizei kDepth = 2;
+ const GLenum kFormat = GL_RGB;
+ const GLenum kType = GL_UNSIGNED_BYTE;
+
+ DoBindTexture(kTarget, client_texture_id_, kServiceTextureId);
+ DoTexImage3D(kTarget, kLevel, kInternalFormat, kWidth, kHeight, kDepth, 0,
+ kFormat, kType, kSharedMemoryId, kSharedMemoryOffset);
+
+ EXPECT_CALL(*gl_,
+ CopyTexSubImage3D(kTarget, 1, 0, 0, 0, 0, 0, kWidth, kHeight))
Zhenyao Mo 2016/07/27 17:38:29 Can you use kLevel, kXOffset, kYOffset, kZOffset,
yunchao 2016/07/27 23:46:11 Done.
+ .Times(1)
+ .RetiresOnSaturation();
+ CopyTexSubImage3D cmd;
+ cmd.Init(kTarget, 1, 0, 0, 0, 0, 0, kWidth, kHeight);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+}
+
+TEST_P(GLES3DecoderTest, CopyTexSubImage3DBadArgs0) {
+ const GLenum kTarget = GL_TEXTURE_3D;
+ const GLsizei kWidth = 2;
+ const GLsizei kHeight = 2;
+
+ CopyTexSubImage3D cmd;
+
+ // No texture bound
+ cmd.Init(kTarget, 0, 0, 0, 0, 0, 0, kWidth, kHeight);
Zhenyao Mo 2016/07/27 17:38:29 Same here, please define constants and use it.
yunchao 2016/07/27 23:46:11 Done.
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
+
+ // Incompatible format / type
+ const GLint kLevel = 1;
+ const GLint kInternalFormat = GL_RGBA8;
+ const GLsizei kDepth = 2;
+ const GLenum kFormat = GL_RGBA;
+ const GLenum kType = GL_UNSIGNED_BYTE;
+ DoBindTexture(kTarget, client_texture_id_, kServiceTextureId);
+ DoTexImage3D(kTarget, kLevel, kInternalFormat, kWidth, kHeight, kDepth, 0,
+ kFormat, kType, kSharedMemoryId, kSharedMemoryOffset);
+
+ cmd.Init(kTarget, 1, 0, 0, 0, 0, 0, kWidth, kHeight);
qiankun 2016/07/27 13:56:26 What's the format of read buffer here?
Zhenyao Mo 2016/07/27 17:38:29 Same here, please define constants and use it. It
yunchao 2016/07/27 23:46:11 AFAIK, the default format/type of the default read
yunchao 2016/07/27 23:46:11 Good suggestion. It would be much clear. Done.
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_INVALID_OPERATION, GetGLError());
+}
+
+TEST_P(GLES3DecoderTest, CopyTexSubImage3DBadArgs1) {
+ const GLenum kTarget = GL_TEXTURE_3D;
+ const GLint kLevel = 1;
+ const GLint kInternalFormat = GL_RGB8;
+ const GLsizei kWidth = 2;
+ const GLsizei kHeight = 2;
+ const GLsizei kDepth = 2;
+ const GLenum kFormat = GL_RGB;
+ const GLenum kType = GL_UNSIGNED_BYTE;
+
+ DoBindTexture(kTarget, client_texture_id_, kServiceTextureId);
+ DoTexImage3D(kTarget, kLevel, kInternalFormat, kWidth, kHeight, kDepth, 0,
+ kFormat, kType, kSharedMemoryId, kSharedMemoryOffset);
+
+ CopyTexSubImage3D cmd;
+
+ // Bad target
+ cmd.Init(GL_TEXTURE_2D, 1, 0, 0, 0, 0, 0, kWidth, kHeight);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
+
+ // Bad xoffest / yoffset of 3D texture
+ cmd.Init(GL_TEXTURE_3D, 1, -1, 0, 0, 0, 0, kWidth, kHeight);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+ cmd.Init(GL_TEXTURE_3D, 1, 1, 0, 0, 0, 0, kWidth, kHeight);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+ cmd.Init(GL_TEXTURE_3D, 1, 0, -1, 0, 0, 0, kWidth, kHeight);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+ cmd.Init(GL_TEXTURE_3D, 1, 0, 1, 0, 0, 0, kWidth, kHeight);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+
+ // Bad zoffset: zoffset specifies the mipmap level of the
+ // 3D texture to be replaced
+ cmd.Init(GL_TEXTURE_3D, 1, 0, 0, -1, 0, 0, kWidth, kHeight);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+ cmd.Init(GL_TEXTURE_3D, 1, 0, 0, 2, 0, 0, kWidth, kHeight);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+
+ // Bad width / height
+ cmd.Init(GL_TEXTURE_3D, 1, 0, 0, 0, 0, 0, kWidth + 1, kHeight);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+ cmd.Init(GL_TEXTURE_3D, 1, 0, 0, 0, 0, 0, kWidth, kHeight + 1);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_INVALID_VALUE, GetGLError());
+}
+
TEST_P(GLES3DecoderTest, CompressedTexImage3DFailsWithBadImageSize) {
const uint32_t kBucketId = 123;
const GLenum kTarget = GL_TEXTURE_2D_ARRAY;

Powered by Google App Engine
This is Rietveld 408576698