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

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

Issue 8756001: Rebind to correct backbuffer after clearing READ buffer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remove unused result Created 9 years 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "base/atomicops.h" 7 #include "base/atomicops.h"
8 #include "gpu/command_buffer/common/gles2_cmd_format.h" 8 #include "gpu/command_buffer/common/gles2_cmd_format.h"
9 #include "gpu/command_buffer/common/gles2_cmd_utils.h" 9 #include "gpu/command_buffer/common/gles2_cmd_utils.h"
10 #include "gpu/command_buffer/common/gl_mock.h" 10 #include "gpu/command_buffer/common/gl_mock.h"
(...skipping 5441 matching lines...) Expand 10 before | Expand all | Expand 10 after
5452 uint32 pixels_shm_id = kSharedMemoryId; 5452 uint32 pixels_shm_id = kSharedMemoryId;
5453 uint32 pixels_shm_offset = kSharedMemoryOffset + sizeof(*result); 5453 uint32 pixels_shm_offset = kSharedMemoryOffset + sizeof(*result);
5454 ReadPixels cmd; 5454 ReadPixels cmd;
5455 cmd.Init(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, 5455 cmd.Init(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE,
5456 pixels_shm_id, pixels_shm_offset, 5456 pixels_shm_id, pixels_shm_offset,
5457 result_shm_id, result_shm_offset); 5457 result_shm_id, result_shm_offset);
5458 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); 5458 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
5459 EXPECT_EQ(GL_NO_ERROR, GetGLError()); 5459 EXPECT_EQ(GL_NO_ERROR, GetGLError());
5460 } 5460 }
5461 5461
5462 TEST_F(GLES2DecoderManualInitTest,
5463 UnClearedAttachmentsGetClearedOnReadPixelsAndDrawBufferGetsRestored) {
5464 InitDecoder(
5465 "GL_EXT_framebuffer_multisample", // extensions
5466 false, // has alpha
5467 false, // has depth
5468 false, // has stencil
5469 false, // request alpha
5470 false, // request depth
5471 false, // request stencil
5472 true); // bind generates resource
5473 const GLuint kFBOClientTextureId = 4100;
5474 const GLuint kFBOServiceTextureId = 4101;
5475
5476 // Register a texture id.
5477 EXPECT_CALL(*gl_, GenTextures(_, _))
5478 .WillOnce(SetArgumentPointee<1>(kFBOServiceTextureId))
5479 .RetiresOnSaturation();
5480 GenHelper<GenTexturesImmediate>(kFBOClientTextureId);
5481
5482 // Setup "render from" texture.
5483 DoBindTexture(GL_TEXTURE_2D, kFBOClientTextureId, kFBOServiceTextureId);
5484 DoTexImage2D(
5485 GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, 0, 0);
5486 DoBindFramebuffer(
5487 GL_READ_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId);
5488 DoFramebufferTexture2D(
5489 GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
5490 kFBOClientTextureId, kFBOServiceTextureId, 0, GL_NO_ERROR);
5491
5492 SetupExpectationsForFramebufferClearingMulti(
5493 kServiceFramebufferId, // read framebuffer service id
5494 0, // backbuffer service id
5495 GL_READ_FRAMEBUFFER, // target
5496 GL_COLOR_BUFFER_BIT, // clear bits
5497 0, 0, 0, 0, // color
5498 0, // stencil
5499 1.0f, // depth
5500 false); // scissor test
5501
5502 EXPECT_CALL(*gl_, GetError())
5503 .WillOnce(Return(GL_NO_ERROR))
5504 .WillOnce(Return(GL_NO_ERROR))
5505 .RetiresOnSaturation();
5506 EXPECT_CALL(*gl_, ReadPixels(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, _))
5507 .Times(1)
5508 .RetiresOnSaturation();
5509 typedef ReadPixels::Result Result;
5510 uint32 result_shm_id = kSharedMemoryId;
5511 uint32 result_shm_offset = kSharedMemoryOffset;
5512 uint32 pixels_shm_id = kSharedMemoryId;
5513 uint32 pixels_shm_offset = kSharedMemoryOffset + sizeof(Result);
5514 ReadPixels cmd;
5515 cmd.Init(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE,
5516 pixels_shm_id, pixels_shm_offset,
5517 result_shm_id, result_shm_offset);
5518 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd));
5519 EXPECT_EQ(GL_NO_ERROR, GetGLError());
5520 }
5521
5462 TEST_F(GLES2DecoderWithShaderTest, DrawClearsAfterRenderbufferStorageInFBO) { 5522 TEST_F(GLES2DecoderWithShaderTest, DrawClearsAfterRenderbufferStorageInFBO) {
5463 SetupTexture(); 5523 SetupTexture();
5464 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, 5524 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_,
5465 kServiceRenderbufferId); 5525 kServiceRenderbufferId);
5466 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, 5526 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_,
5467 kServiceFramebufferId); 5527 kServiceFramebufferId);
5468 DoRenderbufferStorage( 5528 DoRenderbufferStorage(
5469 GL_RENDERBUFFER, GL_RGBA4, GL_RGBA, 100, 50, GL_NO_ERROR); 5529 GL_RENDERBUFFER, GL_RGBA4, GL_RGBA, 100, 50, GL_NO_ERROR);
5470 DoFramebufferRenderbuffer( 5530 DoFramebufferRenderbuffer(
5471 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, 5531 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER,
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
5657 // TODO(gman): TexImage2DImmediate 5717 // TODO(gman): TexImage2DImmediate
5658 5718
5659 // TODO(gman): TexSubImage2DImmediate 5719 // TODO(gman): TexSubImage2DImmediate
5660 5720
5661 // TODO(gman): UseProgram 5721 // TODO(gman): UseProgram
5662 5722
5663 // TODO(gman): SwapBuffers 5723 // TODO(gman): SwapBuffers
5664 5724
5665 } // namespace gles2 5725 } // namespace gles2
5666 } // namespace gpu 5726 } // namespace gpu
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/gles2_cmd_decoder.cc ('k') | gpu/command_buffer/service/gles2_cmd_decoder_unittest_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698