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

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

Issue 7458008: Support GL_OES_EGL_image_external (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: fix typo which hung the windows gpu_unittests by corrupting the stack Created 9 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.cc
diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
index b5997f55089ae4d60305f622b2daa16f6be7fb90..823cc1a4003cf005dbf154db74577f79a1d587a0 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest.cc
@@ -4288,6 +4288,203 @@ TEST_F(GLES2DecoderWithShaderTest, GetProgramInfoCHROMIUMInvalidArgs) {
EXPECT_EQ(0u, info->num_uniforms);
}
+TEST_F(GLES2DecoderManualInitTest, EGLImageExternalBindTexture) {
+ InitDecoder(
+ "GL_OES_EGL_image_external", // extensions
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false); // request stencil
+ EXPECT_CALL(*gl_, BindTexture(GL_TEXTURE_EXTERNAL_OES, kNewServiceId));
+ EXPECT_CALL(*gl_, GenTextures(1, _))
+ .WillOnce(SetArgumentPointee<1>(kNewServiceId));
+ BindTexture cmd;
+ cmd.Init(GL_TEXTURE_EXTERNAL_OES, kNewClientId);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ TextureManager::TextureInfo* info = GetTextureInfo(kNewClientId);
+ EXPECT_TRUE(info != NULL);
+ EXPECT_TRUE(info->target() == GL_TEXTURE_EXTERNAL_OES);
+}
+
+TEST_F(GLES2DecoderManualInitTest, EGLImageExternalGetBinding) {
+ InitDecoder(
+ "GL_OES_EGL_image_external", // extensions
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false); // request stencil
+ DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId);
+
+ EXPECT_CALL(*gl_, GetError())
+ .WillOnce(Return(GL_NO_ERROR))
+ .WillOnce(Return(GL_NO_ERROR))
+ .RetiresOnSaturation();
+ typedef GetIntegerv::Result Result;
+ Result* result = static_cast<Result*>(shared_memory_address_);
+ EXPECT_CALL(*gl_, GetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES,
+ result->GetData()))
+ .Times(0);
+ result->size = 0;
+ GetIntegerv cmd;
+ cmd.Init(GL_TEXTURE_BINDING_EXTERNAL_OES,
+ shared_memory_id_,
+ shared_memory_offset_);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(decoder_->GetGLES2Util()->GLGetNumValuesReturned(
+ GL_TEXTURE_BINDING_EXTERNAL_OES), result->GetNumResults());
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ EXPECT_EQ(client_texture_id_, (uint32)result->GetData()[0]);
+}
+
+TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureDefaults) {
+ InitDecoder(
+ "GL_OES_EGL_image_external", // extensions
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false); // request stencil
+ DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId);
+
+ TextureManager::TextureInfo* info = GetTextureInfo(client_texture_id_);
+ EXPECT_TRUE(info != NULL);
+ EXPECT_TRUE(info->target() == GL_TEXTURE_EXTERNAL_OES);
+ EXPECT_TRUE(info->min_filter() == GL_LINEAR);
+ EXPECT_TRUE(info->wrap_s() == GL_CLAMP_TO_EDGE);
+ EXPECT_TRUE(info->wrap_t() == GL_CLAMP_TO_EDGE);
+}
+
+TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureParam) {
+ InitDecoder(
+ "GL_OES_EGL_image_external", // extensions
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false); // request stencil
+
+ DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId);
+
+ EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_EXTERNAL_OES,
+ GL_TEXTURE_MIN_FILTER,
+ GL_NEAREST));
+ EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_EXTERNAL_OES,
+ GL_TEXTURE_MIN_FILTER,
+ GL_LINEAR));
+ EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_EXTERNAL_OES,
+ GL_TEXTURE_WRAP_S,
+ GL_CLAMP_TO_EDGE));
+ EXPECT_CALL(*gl_, TexParameteri(GL_TEXTURE_EXTERNAL_OES,
+ GL_TEXTURE_WRAP_T,
+ GL_CLAMP_TO_EDGE));
+ TexParameteri cmd;
+ cmd.Init(GL_TEXTURE_EXTERNAL_OES,
+ GL_TEXTURE_MIN_FILTER,
+ GL_NEAREST);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+
+ cmd.Init(GL_TEXTURE_EXTERNAL_OES,
+ GL_TEXTURE_MIN_FILTER,
+ GL_LINEAR);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+
+ cmd.Init(GL_TEXTURE_EXTERNAL_OES,
+ GL_TEXTURE_WRAP_S,
+ GL_CLAMP_TO_EDGE);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+
+ cmd.Init(GL_TEXTURE_EXTERNAL_OES,
+ GL_TEXTURE_WRAP_T,
+ GL_CLAMP_TO_EDGE);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_NO_ERROR, GetGLError());
+
+ TextureManager::TextureInfo* info = GetTextureInfo(client_texture_id_);
+ EXPECT_TRUE(info != NULL);
+ EXPECT_TRUE(info->target() == GL_TEXTURE_EXTERNAL_OES);
+ EXPECT_TRUE(info->min_filter() == GL_LINEAR);
+ EXPECT_TRUE(info->wrap_s() == GL_CLAMP_TO_EDGE);
+ EXPECT_TRUE(info->wrap_t() == GL_CLAMP_TO_EDGE);
+}
+
+TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTextureParamInvalid) {
+ InitDecoder(
+ "GL_OES_EGL_image_external", // extensions
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false); // request stencil
+
+ DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId);
+
+ TexParameteri cmd;
+ cmd.Init(GL_TEXTURE_EXTERNAL_OES,
+ GL_TEXTURE_MIN_FILTER,
+ GL_NEAREST_MIPMAP_NEAREST);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
+
+ cmd.Init(GL_TEXTURE_EXTERNAL_OES,
+ GL_TEXTURE_WRAP_S,
+ GL_REPEAT);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
+
+ cmd.Init(GL_TEXTURE_EXTERNAL_OES,
+ GL_TEXTURE_WRAP_T,
+ GL_REPEAT);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
+
+ TextureManager::TextureInfo* info = GetTextureInfo(client_texture_id_);
+ EXPECT_TRUE(info != NULL);
+ EXPECT_TRUE(info->target() == GL_TEXTURE_EXTERNAL_OES);
+ EXPECT_TRUE(info->min_filter() == GL_LINEAR);
+ EXPECT_TRUE(info->wrap_s() == GL_CLAMP_TO_EDGE);
+ EXPECT_TRUE(info->wrap_t() == GL_CLAMP_TO_EDGE);
+}
+
+TEST_F(GLES2DecoderManualInitTest, EGLImageExternalTexImage2DError) {
+ InitDecoder(
+ "GL_OES_EGL_image_external", // extensions
+ false, // has alpha
+ false, // has depth
+ false, // has stencil
+ false, // request alpha
+ false, // request depth
+ false); // request stencil
+
+ GLenum target = GL_TEXTURE_EXTERNAL_OES;
+ GLint level = 0;
+ GLenum internal_format = GL_RGBA;
+ GLsizei width = 2;
+ GLsizei height = 4;
+ GLint border = 0;
+ GLenum format = GL_RGBA;
+ GLenum type = GL_UNSIGNED_BYTE;
+ DoBindTexture(GL_TEXTURE_EXTERNAL_OES, client_texture_id_, kServiceTextureId);
+ ASSERT_TRUE(GetTextureInfo(client_texture_id_) != NULL);
+ TexImage2D cmd;
+ cmd.Init(target, level, internal_format, width, height, border, format,
+ type, kSharedMemoryId, kSharedMemoryOffset);
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+
+ // TexImage2D is not allowed with GL_TEXTURE_EXTERNAL_OES targets.
+ EXPECT_EQ(GL_INVALID_ENUM, GetGLError());
+}
+
// TODO(gman): Complete this test.
// TEST_F(GLES2DecoderTest, CompressedTexImage2DGLError) {
// }
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder_autogen.h ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698