Chromium Code Reviews| Index: gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc |
| diff --git a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc |
| index e1acdebe073f3b930cfd4dcbbd59637b192466be..a8a64fac71b38cd9939771d6a8382e6ed86f843c 100644 |
| --- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc |
| +++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc |
| @@ -1912,6 +1912,9 @@ TEST_P(GLES3DecoderTest, CopyTexImage2DValidInternalFormat) { |
| kFBOServiceTextureId, |
| 0, |
| GL_NO_ERROR); |
| + EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT(_, _, _, _)) |
|
Zhenyao Mo
2015/10/13 01:19:32
We can probably be more specific and put GL_FRAMEB
qiankun
2015/10/13 14:28:01
Done.
|
| + .WillOnce(SetArgPointee<3>(GL_LINEAR)) |
| + .RetiresOnSaturation(); |
| EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER)) |
| .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) |
| .RetiresOnSaturation(); |
| @@ -1982,6 +1985,162 @@ TEST_P(GLES3DecoderTest, CopyTexImage2DInvalidInternalFormat) { |
| EXPECT_EQ(GL_INVALID_ENUM, GetGLError()); |
| } |
| +TEST_P(GLES3DecoderTest, CopyTexImage2DInvalidInternalFormat_Float) { |
| + const GLuint kFBOClientTextureId = 4100; |
| + const GLuint kFBOServiceTextureId = 4101; |
| + |
| + GLenum target = GL_TEXTURE_2D; |
| + GLint level = 0; |
| + GLenum internal_format = GL_RG16F; |
| + GLenum format = GL_RG; |
| + GLenum type = GL_HALF_FLOAT; |
| + GLsizei width = 16; |
| + GLsizei height = 8; |
| + GLint border = 0; |
| + |
| + EXPECT_CALL(*gl_, GenTextures(_, _)) |
| + .WillOnce(SetArgPointee<1>(kFBOServiceTextureId)) |
| + .RetiresOnSaturation(); |
| + GenHelper<GenTexturesImmediate>(kFBOClientTextureId); |
| + |
| + DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId); |
| + DoTexImage2D(GL_TEXTURE_2D, |
| + level, |
| + internal_format, |
| + width, |
| + height, |
| + 0, |
| + format, |
| + type, |
| + kSharedMemoryId, |
| + kSharedMemoryOffset); |
| + DoBindFramebuffer( |
| + GL_READ_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
| + DoFramebufferTexture2D(GL_READ_FRAMEBUFFER, |
| + GL_COLOR_ATTACHMENT0, |
| + GL_TEXTURE_2D, |
| + kFBOClientTextureId, |
| + kFBOServiceTextureId, |
| + 0, |
| + GL_NO_ERROR); |
| + EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT(_, _, _, _)) |
| + .WillOnce(SetArgPointee<3>(GL_LINEAR)) |
| + .RetiresOnSaturation(); |
| + EXPECT_CALL(*gl_, |
| + CopyTexImage2D( |
| + target, level, internal_format, 0, 0, width, height, border)) |
| + .Times(0); |
| + DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| + CopyTexImage2D cmd; |
| + cmd.Init(target, level, internal_format, 0, 0, width, height); |
| + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| + EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| +} |
| + |
| +TEST_P(GLES3DecoderTest, CopyTexImage2DInvalidInternalFormat_Integer) { |
| + const GLuint kFBOClientTextureId = 4100; |
| + const GLuint kFBOServiceTextureId = 4101; |
| + |
| + GLenum target = GL_TEXTURE_2D; |
| + GLint level = 0; |
| + GLenum internal_format = GL_RG8I; |
| + GLenum format = GL_RG_INTEGER; |
| + GLenum type = GL_UNSIGNED_BYTE; |
| + GLsizei width = 16; |
| + GLsizei height = 8; |
| + GLint border = 0; |
| + |
| + EXPECT_CALL(*gl_, GenTextures(_, _)) |
| + .WillOnce(SetArgPointee<1>(kFBOServiceTextureId)) |
| + .RetiresOnSaturation(); |
| + GenHelper<GenTexturesImmediate>(kFBOClientTextureId); |
| + |
| + DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId); |
| + DoTexImage2D(GL_TEXTURE_2D, |
| + level, |
| + GL_RG8UI, |
| + width, |
| + height, |
| + 0, |
| + format, |
| + type, |
| + kSharedMemoryId, |
| + kSharedMemoryOffset); |
| + DoBindFramebuffer( |
| + GL_READ_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
| + DoFramebufferTexture2D(GL_READ_FRAMEBUFFER, |
| + GL_COLOR_ATTACHMENT0, |
| + GL_TEXTURE_2D, |
| + kFBOClientTextureId, |
| + kFBOServiceTextureId, |
| + 0, |
| + GL_NO_ERROR); |
| + EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT(_, _, _, _)) |
| + .WillOnce(SetArgPointee<3>(GL_LINEAR)) |
| + .RetiresOnSaturation(); |
| + EXPECT_CALL(*gl_, |
| + CopyTexImage2D( |
| + target, level, internal_format, 0, 0, width, height, border)) |
| + .Times(0); |
| + DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| + CopyTexImage2D cmd; |
| + cmd.Init(target, level, internal_format, 0, 0, width, height); |
| + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| + EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| +} |
| + |
| +TEST_P(GLES3DecoderTest, CopyTexImage2DInvalidInternalFormat_sRGB) { |
| + const GLuint kFBOClientTextureId = 4100; |
| + const GLuint kFBOServiceTextureId = 4101; |
| + |
| + GLenum target = GL_TEXTURE_2D; |
| + GLint level = 0; |
| + GLenum internal_format = GL_SRGB8; |
| + GLenum format = GL_RGB; |
| + GLenum type = GL_UNSIGNED_BYTE; |
| + GLsizei width = 16; |
| + GLsizei height = 8; |
| + GLint border = 0; |
| + |
| + EXPECT_CALL(*gl_, GenTextures(_, _)) |
| + .WillOnce(SetArgPointee<1>(kFBOServiceTextureId)) |
| + .RetiresOnSaturation(); |
| + GenHelper<GenTexturesImmediate>(kFBOClientTextureId); |
| + |
| + DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId); |
| + DoTexImage2D(GL_TEXTURE_2D, |
| + level, |
| + internal_format, |
| + width, |
| + height, |
| + 0, |
| + format, |
| + type, |
| + kSharedMemoryId, |
| + kSharedMemoryOffset); |
| + DoBindFramebuffer( |
| + GL_READ_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); |
| + DoFramebufferTexture2D(GL_READ_FRAMEBUFFER, |
| + GL_COLOR_ATTACHMENT0, |
| + GL_TEXTURE_2D, |
| + kFBOClientTextureId, |
| + kFBOServiceTextureId, |
| + 0, |
| + GL_NO_ERROR); |
| + EXPECT_CALL(*gl_, GetFramebufferAttachmentParameterivEXT(_, _, _, _)) |
| + .WillOnce(SetArgPointee<3>(GL_LINEAR)) |
| + .RetiresOnSaturation(); |
| + EXPECT_CALL(*gl_, |
| + CopyTexImage2D( |
| + target, level, internal_format, 0, 0, width, height, border)) |
| + .Times(0); |
| + DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); |
| + CopyTexImage2D cmd; |
| + cmd.Init(target, level, internal_format, 0, 0, width, height); |
| + EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| + EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| +} |
| + |
| TEST_P(GLES2DecoderManualInitTest, |
| UnClearedAttachmentsGetClearedOnReadPixelsAndDrawBufferGetsRestored) { |
| InitState init; |