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

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

Issue 2474593002: Float formats are allowed for CopyTexImage with EXT_color_buffer_float (Closed)
Patch Set: Created 4 years, 1 month 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_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 ba58f9f340581599b68f5b0fa41396a375ee5f1a..1db8c4a0184787cde1a945470ff3f05e3ded0d72 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc
@@ -2697,6 +2697,134 @@ TEST_P(GLES3DecoderTest, CopyTexImage2DValidInternalFormat) {
EXPECT_EQ(GL_NO_ERROR, GetGLError());
}
+TEST_P(GLES3DecoderManualInitTest, CopyTexImage2DValidInternalFormat_FloatEXT) {
+ base::CommandLine command_line(0, nullptr);
+ command_line.AppendSwitch(switches::kEnableUnsafeES3APIs);
Zhenyao Mo 2016/11/02 18:26:09 Again, this will conflict with kainino's effort of
Kai Ninomiya 2016/11/02 18:47:34 qiankun, don't worry about using kEnableUnsafeES3A
Kai Ninomiya 2016/11/03 02:11:30 My changes removing it have landed: https://codere
+ InitState init;
+ init.extensions = "GL_EXT_color_buffer_float";
+ init.gl_version = "OpenGL ES 3.0";
+ init.bind_generates_resource = true;
+ init.context_type = CONTEXT_TYPE_OPENGLES3;
+ InitDecoderWithCommandLine(init, &command_line);
+
+ const GLuint kFBOClientTextureId = 4100;
+ const GLuint kFBOServiceTextureId = 4101;
+
+ GLenum target = GL_TEXTURE_2D;
+ GLint level = 0;
+ GLenum internal_format = GL_RG16F;
+ GLenum format = GL_RGBA;
+ 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,
+ GL_RGBA16F,
+ 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_,
+ CopyTexImage2D(
+ target, level, internal_format, 0, 0, width, height, border))
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(*gl_, GetError())
+ .WillOnce(Return(GL_NO_ERROR))
+ .WillOnce(Return(GL_NO_ERROR))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER))
+ .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
+ .RetiresOnSaturation();
+ 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_NO_ERROR, GetGLError());
+}
+
+TEST_P(GLES3DecoderManualInitTest,
+ CopyTexImage2DInvalidInternalFormat_FloatEXT) {
+ base::CommandLine command_line(0, nullptr);
+ command_line.AppendSwitch(switches::kEnableUnsafeES3APIs);
Zhenyao Mo 2016/11/02 18:26:09 Same here.
+ InitState init;
+ init.extensions = "GL_EXT_color_buffer_float";
+ init.gl_version = "OpenGL ES 3.0";
+ init.bind_generates_resource = true;
+ init.context_type = CONTEXT_TYPE_OPENGLES3;
+ InitDecoderWithCommandLine(init, &command_line);
+
+ const GLuint kFBOClientTextureId = 4100;
+ const GLuint kFBOServiceTextureId = 4101;
+
+ GLenum target = GL_TEXTURE_2D;
+ GLint level = 0;
+ GLenum internal_format = GL_RG16F;
+ GLenum format = GL_RGBA;
+ 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_RGBA8,
+ 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_,
+ CopyTexImage2D(
+ target, level, internal_format, 0, 0, width, height, border))
+ .Times(0);
+ EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER))
+ .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
+ .RetiresOnSaturation();
+ 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) {
const GLuint kFBOClientTextureId = 4100;
const GLuint kFBOServiceTextureId = 4101;

Powered by Google App Engine
This is Rietveld 408576698