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

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

Issue 1938493002: [Reland] Fix ReadPixels from float fbo buffer in ES2/WebGL1. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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 258d63d4a1721acf8f96a99a192f5053f12ffa80..09ae7a3e22992fd7a39f24bdc090688f62312608 100644
--- a/gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc
+++ b/gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc
@@ -3198,105 +3198,38 @@ TEST_P(GLES2DecoderManualInitTest,
EXPECT_FALSE(framebuffer_manager->IsComplete(framebuffer));
}
-TEST_P(GLES2DecoderManualInitTest, ReadFormatExtension) {
- InitState init;
- init.extensions = "GL_OES_read_format";
- init.bind_generates_resource = true;
- InitDecoder(init);
-
- EXPECT_CALL(*gl_, GetError())
- .WillOnce(Return(GL_NO_ERROR))
- .WillOnce(Return(GL_NO_ERROR))
- .WillOnce(Return(GL_NO_ERROR))
- .WillOnce(Return(GL_NO_ERROR))
- .RetiresOnSaturation();
- EXPECT_CALL(*gl_, GetError()).Times(6).RetiresOnSaturation();
-
- typedef GetIntegerv::Result Result;
- Result* result = static_cast<Result*>(shared_memory_address_);
- GetIntegerv cmd;
- const GLuint kFBOClientTextureId = 4100;
- const GLuint kFBOServiceTextureId = 4101;
-
- // Register a texture id.
- EXPECT_CALL(*gl_, GenTextures(_, _))
- .WillOnce(SetArgPointee<1>(kFBOServiceTextureId))
- .RetiresOnSaturation();
- GenHelper<GenTexturesImmediate>(kFBOClientTextureId);
-
- // Setup "render to" texture.
- DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId);
+TEST_P(GLES2DecoderTest, ImplementationReadColorFormatAndType) {
+ ClearSharedMemory();
+ DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId);
DoTexImage2D(
- GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
+ GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE,
+ kSharedMemoryId, kSharedMemoryOffset);
DoBindFramebuffer(
GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId);
DoFramebufferTexture2D(GL_FRAMEBUFFER,
GL_COLOR_ATTACHMENT0,
GL_TEXTURE_2D,
- kFBOClientTextureId,
- kFBOServiceTextureId,
+ client_texture_id_,
+ kServiceTextureId,
0,
GL_NO_ERROR);
- result->size = 0;
- EXPECT_CALL(*gl_, GetIntegerv(_, _)).Times(1).RetiresOnSaturation();
- cmd.Init(GL_IMPLEMENTATION_COLOR_READ_FORMAT,
- shared_memory_id_,
- shared_memory_offset_);
- EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
- EXPECT_EQ(1, result->GetNumResults());
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
+ typedef GetIntegerv::Result Result;
+ Result* result = static_cast<Result*>(shared_memory_address_);
+ GetIntegerv cmd;
result->size = 0;
- EXPECT_CALL(*gl_, GetIntegerv(_, _)).Times(1).RetiresOnSaturation();
- cmd.Init(GL_IMPLEMENTATION_COLOR_READ_TYPE,
- shared_memory_id_,
- shared_memory_offset_);
- EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
- EXPECT_EQ(1, result->GetNumResults());
- EXPECT_EQ(GL_NO_ERROR, GetGLError());
-}
-
-TEST_P(GLES2DecoderManualInitTest, NoReadFormatExtension) {
- InitState init;
- init.bind_generates_resource = true;
- InitDecoder(init);
-
EXPECT_CALL(*gl_, GetError())
.WillOnce(Return(GL_NO_ERROR))
.WillOnce(Return(GL_NO_ERROR))
.WillOnce(Return(GL_NO_ERROR))
.WillOnce(Return(GL_NO_ERROR))
+ .WillOnce(Return(GL_NO_ERROR))
.RetiresOnSaturation();
-
- typedef GetIntegerv::Result Result;
- Result* result = static_cast<Result*>(shared_memory_address_);
- GetIntegerv cmd;
- const GLuint kFBOClientTextureId = 4100;
- const GLuint kFBOServiceTextureId = 4101;
-
- // Register a texture id.
- EXPECT_CALL(*gl_, GenTextures(_, _))
- .WillOnce(SetArgPointee<1>(kFBOServiceTextureId))
+ EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(_))
+ .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
.RetiresOnSaturation();
- GenHelper<GenTexturesImmediate>(kFBOClientTextureId);
-
- // Setup "render to" texture.
- DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId);
- DoTexImage2D(
- GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
- DoBindFramebuffer(
- GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId);
- DoFramebufferTexture2D(GL_FRAMEBUFFER,
- GL_COLOR_ATTACHMENT0,
- GL_TEXTURE_2D,
- kFBOClientTextureId,
- kFBOServiceTextureId,
- 0,
- GL_NO_ERROR);
-
- result->size = 0;
- EXPECT_CALL(*gl_, GetIntegerv(_, _)).Times(0).RetiresOnSaturation();
+ EXPECT_CALL(*gl_, GetIntegerv(_, _)).Times(1).RetiresOnSaturation();
cmd.Init(GL_IMPLEMENTATION_COLOR_READ_FORMAT,
shared_memory_id_,
shared_memory_offset_);
@@ -3305,7 +3238,16 @@ TEST_P(GLES2DecoderManualInitTest, NoReadFormatExtension) {
EXPECT_EQ(GL_NO_ERROR, GetGLError());
result->size = 0;
- EXPECT_CALL(*gl_, GetIntegerv(_, _)).Times(0).RetiresOnSaturation();
+ EXPECT_CALL(*gl_, GetError())
+ .WillOnce(Return(GL_NO_ERROR))
+ .WillOnce(Return(GL_NO_ERROR))
+ .WillOnce(Return(GL_NO_ERROR))
+ .WillOnce(Return(GL_NO_ERROR))
+ .WillOnce(Return(GL_NO_ERROR))
+ .RetiresOnSaturation();
+ EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(_))
+ .Times(0);
+ EXPECT_CALL(*gl_, GetIntegerv(_, _)).Times(1).RetiresOnSaturation();
cmd.Init(GL_IMPLEMENTATION_COLOR_READ_TYPE,
shared_memory_id_,
shared_memory_offset_);

Powered by Google App Engine
This is Rietveld 408576698