OLD | NEW |
---|---|
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 Loading... | |
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 Result* result = GetSharedMemoryAs<Result*>(); | |
jbates
2011/11/30 22:00:51
It doesn't look like result is ever accessed (ther
greggman
2011/11/30 22:13:15
Yea, actual results from readPixels are checked in
| |
5511 uint32 result_shm_id = kSharedMemoryId; | |
5512 uint32 result_shm_offset = kSharedMemoryOffset; | |
5513 uint32 pixels_shm_id = kSharedMemoryId; | |
5514 uint32 pixels_shm_offset = kSharedMemoryOffset + sizeof(*result); | |
5515 ReadPixels cmd; | |
5516 cmd.Init(0, 0, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, | |
5517 pixels_shm_id, pixels_shm_offset, | |
5518 result_shm_id, result_shm_offset); | |
5519 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | |
5520 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | |
5521 } | |
5522 | |
5462 TEST_F(GLES2DecoderWithShaderTest, DrawClearsAfterRenderbufferStorageInFBO) { | 5523 TEST_F(GLES2DecoderWithShaderTest, DrawClearsAfterRenderbufferStorageInFBO) { |
5463 SetupTexture(); | 5524 SetupTexture(); |
5464 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, | 5525 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, |
5465 kServiceRenderbufferId); | 5526 kServiceRenderbufferId); |
5466 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, | 5527 DoBindFramebuffer(GL_FRAMEBUFFER, client_framebuffer_id_, |
5467 kServiceFramebufferId); | 5528 kServiceFramebufferId); |
5468 DoRenderbufferStorage( | 5529 DoRenderbufferStorage( |
5469 GL_RENDERBUFFER, GL_RGBA4, GL_RGBA, 100, 50, GL_NO_ERROR); | 5530 GL_RENDERBUFFER, GL_RGBA4, GL_RGBA, 100, 50, GL_NO_ERROR); |
5470 DoFramebufferRenderbuffer( | 5531 DoFramebufferRenderbuffer( |
5471 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, | 5532 GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_RENDERBUFFER, |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5657 // TODO(gman): TexImage2DImmediate | 5718 // TODO(gman): TexImage2DImmediate |
5658 | 5719 |
5659 // TODO(gman): TexSubImage2DImmediate | 5720 // TODO(gman): TexSubImage2DImmediate |
5660 | 5721 |
5661 // TODO(gman): UseProgram | 5722 // TODO(gman): UseProgram |
5662 | 5723 |
5663 // TODO(gman): SwapBuffers | 5724 // TODO(gman): SwapBuffers |
5664 | 5725 |
5665 } // namespace gles2 | 5726 } // namespace gles2 |
5666 } // namespace gpu | 5727 } // namespace gpu |
OLD | NEW |