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

Side by Side Diff: gpu/command_buffer/service/gles2_cmd_decoder_unittest_framebuffers.cc

Issue 1929203003: Revert of 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, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" 5 #include "gpu/command_buffer/service/gles2_cmd_decoder.h"
6 6
7 #include <limits.h> 7 #include <limits.h>
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 3180 matching lines...) Expand 10 before | Expand all | Expand 10 after
3191 EXPECT_CALL(*gl_, DiscardFramebufferEXT(target, count, _)) 3191 EXPECT_CALL(*gl_, DiscardFramebufferEXT(target, count, _))
3192 .Times(1) 3192 .Times(1)
3193 .RetiresOnSaturation(); 3193 .RetiresOnSaturation();
3194 EXPECT_EQ(error::kNoError, 3194 EXPECT_EQ(error::kNoError,
3195 ExecuteImmediateCmd(discard_cmd, sizeof(attachments))); 3195 ExecuteImmediateCmd(discard_cmd, sizeof(attachments)));
3196 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 3196 EXPECT_EQ(GL_NO_ERROR, GetGLError());
3197 EXPECT_FALSE(framebuffer->IsCleared()); 3197 EXPECT_FALSE(framebuffer->IsCleared());
3198 EXPECT_FALSE(framebuffer_manager->IsComplete(framebuffer)); 3198 EXPECT_FALSE(framebuffer_manager->IsComplete(framebuffer));
3199 } 3199 }
3200 3200
3201 TEST_P(GLES2DecoderTest, ImplementationReadColorFormatAndType) { 3201 TEST_P(GLES2DecoderManualInitTest, ReadFormatExtension) {
3202 ClearSharedMemory(); 3202 InitState init;
3203 DoBindTexture(GL_TEXTURE_2D, client_texture_id_, kServiceTextureId); 3203 init.extensions = "GL_OES_read_format";
3204 init.bind_generates_resource = true;
3205 InitDecoder(init);
3206
3207 EXPECT_CALL(*gl_, GetError())
3208 .WillOnce(Return(GL_NO_ERROR))
3209 .WillOnce(Return(GL_NO_ERROR))
3210 .WillOnce(Return(GL_NO_ERROR))
3211 .WillOnce(Return(GL_NO_ERROR))
3212 .RetiresOnSaturation();
3213 EXPECT_CALL(*gl_, GetError()).Times(6).RetiresOnSaturation();
3214
3215 typedef GetIntegerv::Result Result;
3216 Result* result = static_cast<Result*>(shared_memory_address_);
3217 GetIntegerv cmd;
3218 const GLuint kFBOClientTextureId = 4100;
3219 const GLuint kFBOServiceTextureId = 4101;
3220
3221 // Register a texture id.
3222 EXPECT_CALL(*gl_, GenTextures(_, _))
3223 .WillOnce(SetArgPointee<1>(kFBOServiceTextureId))
3224 .RetiresOnSaturation();
3225 GenHelper<GenTexturesImmediate>(kFBOClientTextureId);
3226
3227 // Setup "render to" texture.
3228 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId);
3204 DoTexImage2D( 3229 DoTexImage2D(
3205 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 3230 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
3206 kSharedMemoryId, kSharedMemoryOffset);
3207 DoBindFramebuffer( 3231 DoBindFramebuffer(
3208 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); 3232 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId);
3209 DoFramebufferTexture2D(GL_FRAMEBUFFER, 3233 DoFramebufferTexture2D(GL_FRAMEBUFFER,
3210 GL_COLOR_ATTACHMENT0, 3234 GL_COLOR_ATTACHMENT0,
3211 GL_TEXTURE_2D, 3235 GL_TEXTURE_2D,
3212 client_texture_id_, 3236 kFBOClientTextureId,
3213 kServiceTextureId, 3237 kFBOServiceTextureId,
3214 0, 3238 0,
3215 GL_NO_ERROR); 3239 GL_NO_ERROR);
3216 3240
3217 typedef GetIntegerv::Result Result;
3218 Result* result = static_cast<Result*>(shared_memory_address_);
3219 GetIntegerv cmd;
3220
3221 result->size = 0; 3241 result->size = 0;
3222 EXPECT_CALL(*gl_, GetError())
3223 .WillOnce(Return(GL_NO_ERROR))
3224 .WillOnce(Return(GL_NO_ERROR))
3225 .WillOnce(Return(GL_NO_ERROR))
3226 .WillOnce(Return(GL_NO_ERROR))
3227 .WillOnce(Return(GL_NO_ERROR))
3228 .RetiresOnSaturation();
3229 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(_))
3230 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE))
3231 .RetiresOnSaturation();
3232 EXPECT_CALL(*gl_, GetIntegerv(_, _)).Times(1).RetiresOnSaturation(); 3242 EXPECT_CALL(*gl_, GetIntegerv(_, _)).Times(1).RetiresOnSaturation();
3233 cmd.Init(GL_IMPLEMENTATION_COLOR_READ_FORMAT, 3243 cmd.Init(GL_IMPLEMENTATION_COLOR_READ_FORMAT,
3234 shared_memory_id_, 3244 shared_memory_id_,
3235 shared_memory_offset_); 3245 shared_memory_offset_);
3236 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 3246 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
3237 EXPECT_EQ(1, result->GetNumResults()); 3247 EXPECT_EQ(1, result->GetNumResults());
3238 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 3248 EXPECT_EQ(GL_NO_ERROR, GetGLError());
3239 3249
3240 result->size = 0; 3250 result->size = 0;
3241 EXPECT_CALL(*gl_, GetError())
3242 .WillOnce(Return(GL_NO_ERROR))
3243 .WillOnce(Return(GL_NO_ERROR))
3244 .WillOnce(Return(GL_NO_ERROR))
3245 .WillOnce(Return(GL_NO_ERROR))
3246 .WillOnce(Return(GL_NO_ERROR))
3247 .RetiresOnSaturation();
3248 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(_))
3249 .Times(0);
3250 EXPECT_CALL(*gl_, GetIntegerv(_, _)).Times(1).RetiresOnSaturation(); 3251 EXPECT_CALL(*gl_, GetIntegerv(_, _)).Times(1).RetiresOnSaturation();
3251 cmd.Init(GL_IMPLEMENTATION_COLOR_READ_TYPE, 3252 cmd.Init(GL_IMPLEMENTATION_COLOR_READ_TYPE,
3252 shared_memory_id_, 3253 shared_memory_id_,
3253 shared_memory_offset_); 3254 shared_memory_offset_);
3254 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 3255 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
3255 EXPECT_EQ(1, result->GetNumResults()); 3256 EXPECT_EQ(1, result->GetNumResults());
3256 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 3257 EXPECT_EQ(GL_NO_ERROR, GetGLError());
3257 } 3258 }
3258 3259
3260 TEST_P(GLES2DecoderManualInitTest, NoReadFormatExtension) {
3261 InitState init;
3262 init.bind_generates_resource = true;
3263 InitDecoder(init);
3264
3265 EXPECT_CALL(*gl_, GetError())
3266 .WillOnce(Return(GL_NO_ERROR))
3267 .WillOnce(Return(GL_NO_ERROR))
3268 .WillOnce(Return(GL_NO_ERROR))
3269 .WillOnce(Return(GL_NO_ERROR))
3270 .RetiresOnSaturation();
3271
3272 typedef GetIntegerv::Result Result;
3273 Result* result = static_cast<Result*>(shared_memory_address_);
3274 GetIntegerv cmd;
3275 const GLuint kFBOClientTextureId = 4100;
3276 const GLuint kFBOServiceTextureId = 4101;
3277
3278 // Register a texture id.
3279 EXPECT_CALL(*gl_, GenTextures(_, _))
3280 .WillOnce(SetArgPointee<1>(kFBOServiceTextureId))
3281 .RetiresOnSaturation();
3282 GenHelper<GenTexturesImmediate>(kFBOClientTextureId);
3283
3284 // Setup "render to" texture.
3285 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId);
3286 DoTexImage2D(
3287 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
3288 DoBindFramebuffer(
3289 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId);
3290 DoFramebufferTexture2D(GL_FRAMEBUFFER,
3291 GL_COLOR_ATTACHMENT0,
3292 GL_TEXTURE_2D,
3293 kFBOClientTextureId,
3294 kFBOServiceTextureId,
3295 0,
3296 GL_NO_ERROR);
3297
3298 result->size = 0;
3299 EXPECT_CALL(*gl_, GetIntegerv(_, _)).Times(0).RetiresOnSaturation();
3300 cmd.Init(GL_IMPLEMENTATION_COLOR_READ_FORMAT,
3301 shared_memory_id_,
3302 shared_memory_offset_);
3303 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
3304 EXPECT_EQ(1, result->GetNumResults());
3305 EXPECT_EQ(GL_NO_ERROR, GetGLError());
3306
3307 result->size = 0;
3308 EXPECT_CALL(*gl_, GetIntegerv(_, _)).Times(0).RetiresOnSaturation();
3309 cmd.Init(GL_IMPLEMENTATION_COLOR_READ_TYPE,
3310 shared_memory_id_,
3311 shared_memory_offset_);
3312 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
3313 EXPECT_EQ(1, result->GetNumResults());
3314 EXPECT_EQ(GL_NO_ERROR, GetGLError());
3315 }
3316
3259 // TODO(gman): PixelStorei 3317 // TODO(gman): PixelStorei
3260 3318
3261 // TODO(gman): SwapBuffers 3319 // TODO(gman): SwapBuffers
3262 3320
3263 } // namespace gles2 3321 } // namespace gles2
3264 } // namespace gpu 3322 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | gpu/command_buffer/tests/gl_readback_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698