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 3943 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3954 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER)) | 3954 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER)) |
| 3955 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) | 3955 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) |
| 3956 .RetiresOnSaturation(); | 3956 .RetiresOnSaturation(); |
| 3957 SetupExpectationsForFramebufferClearing(GL_DRAW_FRAMEBUFFER, // target | 3957 SetupExpectationsForFramebufferClearing(GL_DRAW_FRAMEBUFFER, // target |
| 3958 GL_COLOR_BUFFER_BIT, // clear bits | 3958 GL_COLOR_BUFFER_BIT, // clear bits |
| 3959 0, 0, 0, 0, // color | 3959 0, 0, 0, 0, // color |
| 3960 0, // stencil | 3960 0, // stencil |
| 3961 1.0f, // depth | 3961 1.0f, // depth |
| 3962 false, // scissor test | 3962 false, // scissor test |
| 3963 0, 0, 128, 64); | 3963 0, 0, 128, 64); |
| 3964 EXPECT_CALL(*gl_, BlitFramebufferEXT(0, 0, _, _, 0, 0, _, _, | |
| 3965 GL_COLOR_BUFFER_BIT, GL_LINEAR)) | |
| 3966 .Times(1) | |
| 3967 .RetiresOnSaturation(); | |
| 3968 BlitFramebufferCHROMIUM cmd; | 3964 BlitFramebufferCHROMIUM cmd; |
| 3969 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_COLOR_BUFFER_BIT, GL_LINEAR); | 3965 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_COLOR_BUFFER_BIT, GL_LINEAR); |
| 3970 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 3966 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 3971 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 3967 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
|
Zhenyao Mo
2016/12/13 19:21:37
Can you add a comment here saying "missing read bu
| |
| 3972 } | 3968 } |
| 3973 } | 3969 } |
| 3974 | 3970 |
| 3975 TEST_P(GLES3DecoderTest, BlitFramebufferMissingDepthOrStencil) { | 3971 TEST_P(GLES3DecoderTest, BlitFramebufferMissingDepthOrStencil) { |
| 3976 // Run BlitFramebufferCHROMIUM with depth or stencil bits, from/to a read/draw | 3972 // Run BlitFramebufferCHROMIUM with depth or stencil bits, from/to a read/draw |
| 3977 // framebuffer that doesn't have depth/stencil. The bits should be silently | 3973 // framebuffer that doesn't have depth/stencil. It should generate |
| 3978 // ignored. | 3974 // INVALID_OPERATION. |
| 3979 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, | 3975 DoBindRenderbuffer(GL_RENDERBUFFER, client_renderbuffer_id_, |
| 3980 kServiceRenderbufferId); | 3976 kServiceRenderbufferId); |
| 3981 DoRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, | 3977 DoRenderbufferStorage(GL_RENDERBUFFER, GL_DEPTH24_STENCIL8, |
| 3982 GL_DEPTH24_STENCIL8, 1, 1, GL_NO_ERROR); | 3978 GL_DEPTH24_STENCIL8, 1, 1, GL_NO_ERROR); |
| 3983 GLuint color_renderbuffer = client_renderbuffer_id_ + 1; | 3979 GLuint color_renderbuffer = client_renderbuffer_id_ + 1; |
| 3984 GLuint color_renderbuffer_service = kServiceRenderbufferId + 1; | 3980 GLuint color_renderbuffer_service = kServiceRenderbufferId + 1; |
| 3985 EXPECT_CALL(*gl_, GenRenderbuffersEXT(1, _)) | 3981 EXPECT_CALL(*gl_, GenRenderbuffersEXT(1, _)) |
| 3986 .WillOnce(SetArgPointee<1>(color_renderbuffer_service)) | 3982 .WillOnce(SetArgPointee<1>(color_renderbuffer_service)) |
| 3987 .RetiresOnSaturation(); | 3983 .RetiresOnSaturation(); |
| 3988 DoBindRenderbuffer(GL_RENDERBUFFER, color_renderbuffer, | 3984 DoBindRenderbuffer(GL_RENDERBUFFER, color_renderbuffer, |
| (...skipping 27 matching lines...) Expand all Loading... | |
| 4016 GL_STENCIL_BUFFER_BIT, // clear bits | 4012 GL_STENCIL_BUFFER_BIT, // clear bits |
| 4017 0, | 4013 0, |
| 4018 0, 0, 0, // color | 4014 0, 0, 0, // color |
| 4019 0, // stencil | 4015 0, // stencil |
| 4020 1.0f, // depth | 4016 1.0f, // depth |
| 4021 false, // scissor test | 4017 false, // scissor test |
| 4022 0, 0, 128, 64); | 4018 0, 0, 128, 64); |
| 4023 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER)) | 4019 EXPECT_CALL(*gl_, CheckFramebufferStatusEXT(GL_READ_FRAMEBUFFER)) |
| 4024 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) | 4020 .WillOnce(Return(GL_FRAMEBUFFER_COMPLETE)) |
| 4025 .RetiresOnSaturation(); | 4021 .RetiresOnSaturation(); |
| 4026 EXPECT_CALL(*gl_, BlitFramebufferEXT(0, 0, 1, 1, 0, 0, 1, 1, | |
| 4027 _, _)) | |
| 4028 .Times(0); | |
| 4029 BlitFramebufferCHROMIUM cmd; | 4022 BlitFramebufferCHROMIUM cmd; |
| 4030 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_DEPTH_BUFFER_BIT, GL_NEAREST); | 4023 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_DEPTH_BUFFER_BIT, GL_NEAREST); |
| 4031 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4024 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 4032 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 4025 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 4033 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_STENCIL_BUFFER_BIT, GL_NEAREST); | 4026 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_STENCIL_BUFFER_BIT, GL_NEAREST); |
| 4034 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4027 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 4035 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 4028 EXPECT_EQ(GL_INVALID_OPERATION, GetGLError()); |
| 4036 } | 4029 } |
| 4037 | 4030 |
| 4038 // Switch FBOs and try the same. | 4031 // Switch FBOs and try the same. |
| 4039 DoBindFramebuffer(GL_READ_FRAMEBUFFER, client_framebuffer_id_, | 4032 DoBindFramebuffer(GL_READ_FRAMEBUFFER, client_framebuffer_id_, |
| 4040 kServiceFramebufferId); | 4033 kServiceFramebufferId); |
| 4041 DoBindFramebuffer(GL_DRAW_FRAMEBUFFER, color_fbo, kNewServiceId); | 4034 DoBindFramebuffer(GL_DRAW_FRAMEBUFFER, color_fbo, kNewServiceId); |
| 4042 { | 4035 { |
| 4043 EXPECT_CALL(*gl_, BlitFramebufferEXT(0, 0, 1, 1, 0, 0, 1, 1, | 4036 EXPECT_CALL(*gl_, BlitFramebufferEXT(0, 0, 1, 1, 0, 0, 1, 1, |
| 4044 _, _)) | 4037 _, _)) |
| 4045 .Times(0); | 4038 .Times(0); |
| 4046 BlitFramebufferCHROMIUM cmd; | 4039 BlitFramebufferCHROMIUM cmd; |
| 4047 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_DEPTH_BUFFER_BIT, GL_NEAREST); | 4040 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_DEPTH_BUFFER_BIT, GL_NEAREST); |
| 4048 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4041 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 4049 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 4042 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 4050 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_STENCIL_BUFFER_BIT, GL_NEAREST); | 4043 cmd.Init(0, 0, 1, 1, 0, 0, 1, 1, GL_STENCIL_BUFFER_BIT, GL_NEAREST); |
| 4051 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); | 4044 EXPECT_EQ(error::kNoError, ExecuteCmd(cmd)); |
| 4052 EXPECT_EQ(GL_NO_ERROR, GetGLError()); | 4045 EXPECT_EQ(GL_NO_ERROR, GetGLError()); |
| 4053 } | 4046 } |
| 4054 } | 4047 } |
| 4055 | 4048 |
| 4056 // TODO(gman): PixelStorei | 4049 // TODO(gman): PixelStorei |
| 4057 | 4050 |
| 4058 // TODO(gman): SwapBuffers | 4051 // TODO(gman): SwapBuffers |
| 4059 | 4052 |
| 4060 } // namespace gles2 | 4053 } // namespace gles2 |
| 4061 } // namespace gpu | 4054 } // namespace gpu |
| OLD | NEW |