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 3624 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3635 | 3635 |
3636 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_DEPTH_BUFFER_BIT, GL_LINEAR); | 3636 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_DEPTH_BUFFER_BIT, GL_LINEAR); |
3637 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 3637 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
3638 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 3638 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
3639 | 3639 |
3640 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_STENCIL_BUFFER_BIT, GL_LINEAR); | 3640 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_STENCIL_BUFFER_BIT, GL_LINEAR); |
3641 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 3641 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
3642 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); | 3642 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
3643 } | 3643 } |
3644 | 3644 |
| 3645 TEST_P(GLES3DecoderTest, BlitFramebufferDisabledReadBuffer) { |
| 3646 // Run BlitFramebufferCHROMIUM from a disabled read buffer. Even though the |
| 3647 // read and draw framebuffer use the same attachment, since the read buffer is |
| 3648 // disabled, no feedback loop happens. |
| 3649 DoBindFramebuffer(GL_DRAW_FRAMEBUFFER, client_framebuffer_id_, |
| 3650 kServiceFramebufferId); |
| 3651 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, |
| 3652 kServiceRenderbufferId); |
| 3653 DoRenderbufferStorage(GL_RENDERBUFFER, GL_RGBA8, GL_RGBA8, 1, 1, GL_NO_ERROR); |
| 3654 DoFramebufferRenderbuffer(GL_DRAW_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
| 3655 GL_RENDERBUFFER, client_renderbuffer_id_, |
| 3656 kServiceRenderbufferId, GL_NO_ERROR); |
| 3657 |
| 3658 EXPECT_CALL(*gl_, GenFramebuffersEXT(1, _)) |
| 3659 .WillOnce(SetArgPointee<1>(kNewServiceId)) |
| 3660 .RetiresOnSaturation(); |
| 3661 GLuint read_fbo = client_framebuffer_id_ + 1; |
| 3662 DoBindFramebuffer(GL_READ_FRAMEBUFFER, read_fbo, kNewServiceId); |
| 3663 DoFramebufferRenderbuffer(GL_READ_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, |
| 3664 GL_RENDERBUFFER, client_renderbuffer_id_, |
| 3665 kServiceRenderbufferId, GL_NO_ERROR); |
| 3666 { |
| 3667 EXPECT_CALL(*gl_, ReadBuffer(GL_NONE)) |
| 3668 .Times(1) |
| 3669 .RetiresOnSaturation(); |
| 3670 ReadBuffer cmd; |
| 3671 cmd.Init(GL_NONE); |
| 3672 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 3673 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3674 } |
| 3675 |
| 3676 { |
| 3677 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER)) |
| 3678 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) |
| 3679 .RetiresOnSaturation(); |
| 3680 SetupExpectationsForFramebufferClearing(GL_DRAW_FRAMEBUFFER, // target |
| 3681 GL_COLOR_BUFFER_BIT, // clear bits |
| 3682 0, 0, 0, 0, // color |
| 3683 0, // stencil |
| 3684 1.0f, // depth |
| 3685 false, // scissor test |
| 3686 0, 0, 128, 64); |
| 3687 SetupExpectationsForEnableDisable(GL_SCISSOR_TEST, false); |
| 3688 EXPECT_CALL(*gl_, BlitFramebufferEXT(0, 0, 1, 1, 0, 0, 1, 1, |
| 3689 GL_COLOR_BUFFER_BIT, GL_LINEAR)) |
| 3690 .Times(1) |
| 3691 .RetiresOnSaturation(); |
| 3692 SetupExpectationsForEnableDisable(GL_SCISSOR_TEST, false); |
| 3693 BlitFramebufferCHROMIUM cmd; |
| 3694 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_COLOR_BUFFER_BIT, GL_LINEAR); |
| 3695 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 3696 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 3697 } |
| 3698 } |
| 3699 |
3645 // TODO(gman): PixelStorei | 3700 // TODO(gman): PixelStorei |
3646 | 3701 |
3647 // TODO(gman): SwapBuffers | 3702 // TODO(gman): SwapBuffers |
3648 | 3703 |
3649 } // namespace gles2 | 3704 } // namespace gles2 |
3650 } // namespace gpu | 3705 } // namespace gpu |
OLD | NEW |