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

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

Issue 1870483003: Add command buffer support for GL_RGB CHROMIUM image emulation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comments from piman. Rebase. Created 4 years, 8 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
« no previous file with comments | « gpu/command_buffer/service/framebuffer_manager.cc ('k') | gpu/command_buffer/service/texture_manager.h » ('j') | 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 7ec620aff0096d86e72aa19957d27614e1892266..4fbbe60075bb5d696c74dc457dc136a38cc96733 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_textures.cc
@@ -49,6 +49,16 @@ using ::testing::SetArgPointee;
using ::testing::StrEq;
using ::testing::StrictMock;
+namespace {
+class EmulatingRGBImageStub : public gl::GLImageStub {
+ protected:
+ ~EmulatingRGBImageStub() override {}
+ bool EmulatingRGB() const override {
+ return true;
+ }
+};
+} // namespace
+
namespace gpu {
namespace gles2 {
@@ -3676,6 +3686,67 @@ TEST_P(GLES3DecoderTest, ClearLevel3DMultipleCallsPerLayer) {
texture, kTarget, kLevel, kFormat, kType, kWidth, kHeight, kDepth));
}
+// Test that copyTexImage2D uses the emulated internal format, rather than the
+// real internal format.
+TEST_P(GLES2DecoderWithShaderTest, CHROMIUMImageEmulatingRGB) {
+ const GLuint kFBOClientTextureId = 4100;
+ const GLuint kFBOServiceTextureId = 4101;
+ GLenum target = GL_TEXTURE_2D;
+ GLint level = 0;
+ GLsizei width = 1;
+ GLsizei height = 1;
+
+ // Generate the source framebuffer.
+ EXPECT_CALL(*gl_, GenTextures(_, _))
+ .WillOnce(SetArgPointee<1>(kFBOServiceTextureId))
+ .RetiresOnSaturation();
+ GenHelper<GenTexturesImmediate>(kFBOClientTextureId);
+ DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_,
+ kServiceFramebufferId);
+
+ for (int image_id = 1; image_id < 3; ++image_id) {
+ bool use_emulation = (image_id == 2);
+ DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId);
+
+ // Generate and bind the source image.
+ scoped_refptr<gl::GLImage> image;
+ if (use_emulation)
+ image = new EmulatingRGBImageStub;
+ else
+ image = new gl::GLImageStub;
+ GetImageManager()->AddImage(image.get(), image_id);
+ EXPECT_FALSE(GetImageManager()->LookupImage(image_id) == NULL);
+ DoBindTexImage2DCHROMIUM(GL_TEXTURE_2D, image_id);
+ DoFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, target,
+ kFBOClientTextureId, kFBOServiceTextureId, level,
+ GL_NO_ERROR);
+
+ if (!use_emulation) {
+ EXPECT_CALL(*gl_, GetError())
+ .WillOnce(Return(GL_NO_ERROR))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*gl_,
+ CopyTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 0, 0, 1, 1, 0))
+ .Times(1)
+ .RetiresOnSaturation();
+ EXPECT_CALL(*gl_, GetError())
+ .WillOnce(Return(GL_NO_ERROR))
+ .RetiresOnSaturation();
+ }
+
+ EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_FRAMEBUFFER))
+ .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
+ .RetiresOnSaturation();
+
+ DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
+ CopyTexImage2D cmd;
+ cmd.Init(target, level, GL_RGBA, 0, 0, width, height);
piman 2016/04/14 21:51:37 Can you add a check that GL_RGB does work?
erikchen 2016/04/15 00:17:05 Done.
+ EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
+ GLenum expectation = use_emulation ? GL_INVALID_OPERATION : GL_NO_ERROR;
+ EXPECT_EQ(expectation, static_cast<GLenum>(GetGLError()));
+ }
+}
+
// TODO(gman): Complete this test.
// TEST_P(GLES2DecoderTest, CompressedTexImage2DGLError) {
// }
« no previous file with comments | « gpu/command_buffer/service/framebuffer_manager.cc ('k') | gpu/command_buffer/service/texture_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698