Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 3392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3403 GL_COLOR_ATTACHMENT0, | 3403 GL_COLOR_ATTACHMENT0, |
| 3404 kServiceTextureId, 4, 5)) | 3404 kServiceTextureId, 4, 5)) |
| 3405 .Times(1) | 3405 .Times(1) |
| 3406 .RetiresOnSaturation(); | 3406 .RetiresOnSaturation(); |
| 3407 cmds::FramebufferTextureLayer cmd; | 3407 cmds::FramebufferTextureLayer cmd; |
| 3408 cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, client_texture_id_, 4, 5); | 3408 cmd.Init(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, client_texture_id_, 4, 5); |
| 3409 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 3409 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 3410 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3410 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3411 } | 3411 } |
| 3412 | 3412 |
| 3413 TEST_P(GLES3DecoderTest, InvalidateFramebufferDepthStencilAttachment) { | |
| 3414 DoBindFramebuffer( | |
| 3415 GL_FRAMEBUFFER, client_framebuffer_id_, kServiceFramebufferId); | |
| 3416 DoBindRenderbuffer( | |
| 3417 GL_RENDERBUFFER, client_renderbuffer_id_, kServiceRenderbufferId); | |
| 3418 DoRenderbufferStorage( | |
| 3419 GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, GL_DEPTH24_STENCIL8, | |
| 3420 1, 1, GL_NO_ERROR); | |
| 3421 DoFramebufferRenderbuffer( | |
| 3422 GL_FRAMEBUFFER, GL_DEPTH_STENCIL_ATTACHMENT, GL_RENDERBUFFER, | |
| 3423 client_renderbuffer_id_, kServiceRenderbufferId, GL_NO_ERROR); | |
| 3424 | |
| 3425 Framebuffer* framebuffer = | |
| 3426 group().framebuffer_manager()->GetFramebuffer(client_framebuffer_id_); | |
| 3427 framebuffer->MarkAttachmentAsCleared(group().renderbuffer_manager(), nullptr, | |
| 3428 GL_DEPTH_STENCIL_ATTACHMENT, true); | |
| 3429 EXPECT_TRUE(framebuffer->IsCleared()); | |
| 3430 | |
| 3431 const GLenum target = GL_FRAMEBUFFER; | |
| 3432 const GLsizei count = 1; | |
| 3433 const GLenum attachments[] = {GL_DEPTH_ATTACHMENT}; | |
| 3434 EXPECT_CALL(*gl_, InvalidateFramebuffer(target, 1, _)) | |
| 3435 .Times(1) | |
| 3436 .RetiresOnSaturation(); | |
| 3437 InvalidateFramebufferImmediate& cmd = | |
| 3438 *GetImmediateAs<InvalidateFramebufferImmediate>(); | |
| 3439 cmd.Init(target, count, attachments); | |
| 3440 | |
| 3441 EXPECT_EQ(error::kNoError, ExecuteImmediateCmd(cmd, sizeof(attachments))); | |
| 3442 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | |
| 3443 // Invalidating part of DEPTH_STENCIL attachment doesn't change framebuffer | |
| 3444 // clearance status. | |
| 3445 EXPECT_TRUE(framebuffer->IsCleared()); | |
| 3446 EXPECT_FALSE(framebuffer->HasUnclearedAttachment(GL_DEPTH_ATTACHMENT)); | |
| 3447 EXPECT_FALSE(framebuffer->HasUnclearedAttachment(GL_STENCIL_ATTACHMENT)); | |
|
qiankun
2016/07/20 19:23:58
zhenyao, do you know how to check glInvalidateFram
Zhenyao Mo
2016/07/20 19:36:49
EXPECT_CALL(*gl_, InvalidateFramebuffer(target, 1,
qiankun
2016/07/20 19:39:56
This is used to check InvalidateFramebuffer in com
Zhenyao Mo
2016/07/20 19:41:44
No, this is the mock expectation for the underlyin
qiankun
2016/07/20 20:12:28
Updated the code.
I will try this unit_tests with
| |
| 3448 } | |
| 3449 | |
| 3413 // TODO(gman): PixelStorei | 3450 // TODO(gman): PixelStorei |
| 3414 | 3451 |
| 3415 // TODO(gman): SwapBuffers | 3452 // TODO(gman): SwapBuffers |
| 3416 | 3453 |
| 3417 } // namespace gles2 | 3454 } // namespace gles2 |
| 3418 } // namespace gpu | 3455 } // namespace gpu |
| OLD | NEW |